/* stylelint-disable order/order */
/* stylelint-disable no-descending-specificity */

/* ------------------ Markdown Enhance: Hint Container  ------------------ */
.plume-content {
  .hint-container {
    padding: 16px 16px 8px;
    font-size: var(--vp-custom-block-font-size);
    line-height: 24px;
    color: var(--vp-c-text-2);
    border-radius: 8px;

    .hint-container-title {
      margin-top: 0;
      font-weight: 600;
    }

    p + p {
      margin: 8px 0;
    }

    code {
      font-size: var(--vp-custom-block-code-font-size);
      color: inherit;
    }

    th,
    blockquote > p {
      font-size: var(--vp-custom-block-font-size);
      color: inherit;
    }

    div[class*="language-"] {
      margin: 8px 0;
    }

    div[class*="language-"] code {
      font-weight: 400;
      background-color: transparent;
    }

    @media (max-width: 419px) {
      div[class*="language-"] {
        margin: 0.85rem -0.75rem 0.85rem -1rem;
      }
    }

    &.note {
      color: var(--vp-c-text-3);
      border-radius: 0;
    }

    &.info {
      color: var(--vp-custom-block-info-text);
    }

    &.tip {
      color: var(--vp-custom-block-tip-text);
    }

    &.warning {
      color: var(--vp-custom-block-warning-text);
    }

    &.caution {
      color: var(--vp-custom-block-danger-text);
    }

    &.detail {
      color: var(--vp-custom-block-detail-text);

      summary {
        margin: -1.5rem -1.5rem -1.1rem;
        font-weight: 700;
        color: var(--vp-c-text-1);
        cursor: pointer;
      }

      summary + p {
        margin: 8px 0;
      }
    }

    &.note,
    &.info,
    &.tip,
    &.detail {
      a,
      code {
        color: var(--vp-c-brand-1);
      }

      a:hover {
        color: var(--vp-c-brand-2);
      }
    }

    &.important {
      a,
      code {
        color: var(--vp-c-purple-1);
      }

      a:hover {
        color: var(--vp-c-purple-2);
      }
    }

    &.warning {
      a,
      code {
        color: var(--vp-c-warning-1);
      }

      a:hover {
        color: var(--vp-c-warning-2);
      }
    }

    &.caution {
      a,
      code {
        color: var(--vp-c-danger-1);
      }

      a:hover {
        color: var(--vp-c-danger-2);
      }
    }

    [class*="language-"] .line-numbers {
      padding-top: 21px;
    }
  }
}

/* ------------------ Markdown Enhance: Code Tabs ----------------------- */
.plume-content {
  .code-tabs-nav {
    margin-bottom: 0;
  }

  .vp-code-tabs-nav {
    margin: 0.85rem 0 0;
  }

  @media (max-width: 419px) {
    .vp-code-tabs-nav {
      margin: 0 -1.5rem -0.85rem;
    }
  }
}

/* --------------------  Markdown Enhance: Code Demo  -------------------- */
.plume-content {
  .vp-code-demo {
    overflow: hidden;
    border: solid 1px var(--vp-c-divider);

    @media (max-width: 419px) {
      .vp-code-demo-codes div[class*="language-"] {
        margin: 0;
        border-radius: 0;
      }
    }

    &:hover {
      box-shadow: none;
    }

    .vp-code-demo-header {
      padding: 8px 12px;
    }

    .vp-code-demo-code-wrapper {
      margin-bottom: -0.9rem;
    }

    .vp-code-demo-toggle-button {
      margin: 0 12px 0 8px;
      background-color: var(--vp-c-gray-2);

      &:hover {
        background-color: var(--vp-c-gray-1);
      }
    }

    .vp-code-demo-title {
      font-size: 1rem;
      line-height: 1.75;
    }

    .vp-code-demo-display {
      border-bottom: transparent;
    }

    .code-demo-jsfiddle .jsfiddle-button,
    .code-demo-codepen .codepen-button {
      background-color: transparent;
    }

    .vp-code-demo-codes div[class*="language-"] {
      border-bottom: 2px dashed var(--vp-c-divider);

      &:first-of-type {
        border-top: 1px solid var(--vp-c-divider);
      }

      &:last-of-type {
        border-bottom: none;
      }
    }

    .vp-code-demo-codes div[class*="language-"] pre {
      margin-bottom: 0;
      border-radius: 0;
    }
  }

  @media (max-width: 419px) {
    .vp-code-demo {
      margin: 8px -12px;
    }
  }
}

/* ----------------------  Markdown Enhance: Task List ---------------------- */
.plume-content {
  .task-list-container {
    padding-left: 0;

    .task-list-item {
      input {
        width: 0;
        height: 0;
        padding: 0;
        margin: 0;
      }

      label {
        margin-left: 1.2em;
      }

      input::before,
      input::after {
        position: absolute;
        top: -1em;
        left: 0;
        display: inline-block;
        font-size: 1em;
        content: none;
      }

      input::after {
        content: url('data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="1em" height="1em" viewBox="0 0 32 32"%3E%3Cpath fill="%23c2c2c4" d="M26 27.5H6A1.5 1.5 0 0 1 4.5 26V6c0-.83.67-1.5 1.5-1.5h20c.828 0 1.5.67 1.5 1.5v20a1.5 1.5 0 0 1-1.5 1.5m-18.5-3h17v-17h-17z"%2F%3E%3C%2Fsvg%3E');
        background-color: transparent;
        border: none;
      }

      input:checked[disabled]::after {
        content: url('data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="1em" height="1em" viewBox="0 0 32 32"%3E%3Cpath fill="%23299764" d="M29.548 3.043a2.5 2.5 0 0 0-3.513.4L16 16.067l-3.508-4.414a2.5 2.5 0 0 0-3.915 3.112l5.465 6.875c.474.597 1.195.943 1.957.943s1.482-.35 1.957-.944L29.95 6.555c.86-1.08.68-2.654-.402-3.513zM24.5 24.5h-17v-17h12.756l2.385-3H6c-.83 0-1.5.67-1.5 1.5v20c0 .828.67 1.5 1.5 1.5h20a1.5 1.5 0 0 0 1.5-1.5V12.85l-3 3.774z"%2F%3E%3C%2Fsvg%3E');
        background-color: transparent;
        border: none;
      }
    }
  }
}

/* ----------------------------  Markdown Enhance: Tabs ----------------------------- */
.plume-content {
  .vp-tabs {
    margin: 1.5rem -0.75rem;
    overflow: hidden;
    border: 1px solid var(--vp-c-divider);
  }

  @media (min-width: 419px) {
    .vp-tabs {
      margin: 1.5rem 0;
    }
  }

  .hint-container .vp-tabs {
    margin: 1rem -0.45rem 1rem -0.75rem;

    .vp-tab {
      padding: 0.45rem 0.75rem;
      font-size: 14px;

      p {
        margin: 8px 0;
      }
    }
  }
}

/* --------------------- Markdown Enhance: Footnote -------------------------------- */
.plume-content {
  .footnotes-sep {
    margin-top: 48px;
  }

  .footnotes {
    position: relative;
    padding: 48px 0 12px 16px;
    margin-left: -16px;
    font-size: 14px;
    border-left: 4px solid var(--vp-c-default-soft);

    @media (max-width: 419px) {
      & {
        margin-left: 0;
      }
    }

    &::before {
      position: absolute;
      top: 12px;
      left: 16px;
      font-size: 16px;
      font-weight: 700;

      [lang="zh-CN"] & {
        content: "脚注:";
      }

      [lang="en-US"] & {
        content: "Footnotes:";
      }
    }

    ol {
      margin: 0;

      p {
        margin: 8px 0;
      }

      li:first-of-type p:first-of-type {
        margin-top: 0;
      }

      li:last-of-type p:last-of-type {
        margin-bottom: 0;
      }
    }
  }

  .footnote-item {
    padding-top: 0;
    margin-top: 0;

    > p {
      margin-bottom: 0;
    }
  }

  .footnote-backref {
    position: relative;
    color: transparent;
    text-decoration: none;

    &:hover {
      color: transparent;
    }

    &::before {
      position: absolute;
      top: -0.4em;
      left: 0;
      font-size: 1em;
      content: url('data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="1em" height="1em" viewBox="0 0 48 48"%3E%3Cg fill="none" stroke="%23c2c2c4" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"%3E%3Cpath d="m13 8l-7 6l7 7"%2F%3E%3Cpath d="M6 14h22.994c6.883 0 12.728 5.62 12.996 12.5c.284 7.27-5.723 13.5-12.996 13.5H11.998"%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E');
    }
  }

  .footnote-anchor {
    top: 0;
  }
}

/* --------------  Markdown Enhance: Image Figure --------------------- */
.plume-content {
  figure {
    position: relative;
    display: flex;
    flex-direction: column;
    width: auto;
    margin: 1rem auto;
    text-align: center;

    img {
      margin: 0 auto;
      overflow: hidden;
    }

    > a {
      &[href^="http://"],
      &[href^="https://"] {
        &::after {
          @media print {
            content: "";
          }
        }
      }

      .external-icon {
        display: none;
      }
    }

    figcaption {
      display: inline-block;
      margin: 6px auto;
      font-size: 0.8rem;
    }
  }
}
