@charset "UTF-8";

/* src/css/semantics.css */
@layer han-semantics {
  @property --han-semantics { syntax: "on | off"; inherits: true; initial-value: on; }
  @property --han-text-decoration-inset { syntax: "<length> | auto"; inherits: true; initial-value: auto; }
  @property --han-cite-title-marks { syntax: "none | bracket | wavy"; inherits: true; initial-value: none; }
  @property --han-q-quotes { syntax: "on | off"; inherits: true; initial-value: on; }
  @property --han-writing-mode { syntax: "horizontal-tb | vertical-rl | vertical-lr"; inherits: true; initial-value: horizontal-tb; }
  @property --han-zhuyin-ruby-position { syntax: "over | inter-character"; inherits: true; initial-value: over; }
  @property --han-ruby-zhuyin-used-ideographic-ink-descent { syntax: "<length>"; inherits: true; initial-value: 0px; }
  :where(:root) {
    --han-structural-indent: 2em;
    --han-underline-offset: .125em;
    --han-adjacent-lines-skip-gap-fallback: .125em;
    --han-em-symbol: circle;
    --han-em-dot-position: under right;
    --han-title-marks: "\300a" "\300b" "\3008" "\3009";
    --han-title-marks-quotes: "\300e" "\300f" "\300c" "\300d";
    --han-quotes: "\201c" "\201d" "\2018" "\2019";
    --han-system-ui: system-ui, sans-serif;
    --han-sans: sans-serif;
    --han-serif: serif;
    --han-cursive: cursive, serif;
    --han-monospace: ui-monospace, monospace;
    --han-font-default: var(--han-system-ui);
    --han-font-alternative: var(--han-serif);
    --han-font-accent: var(--han-cursive);
    --han-font-zhuyin-serif: "Han Zhuyin Serif", var(--han-cursive);
    --han-ruby-zhuyin-font-size: .3em;
    --han-ruby-zhuyin-baseline-shift: 0em;
    --han-ruby-zhuyin-over-gap: .25em;
    --han-ruby-zhuyin-letter-spacing: -.05em;
  }
  :where(:lang(en-GB)) {
    --han-quotes: "\2018" "\2019" "\201c" "\201d";
  }
  :where(:lang(zh)) {
    --han-em-symbol: dot;
  }
  :where(:lang(zh), :lang(ja), :lang(ko-Kore)) {
    --han-quotes: "\300c" "\300d" "\300e" "\300f";
  }
  :where(:lang(zh-Hans)) {
    --han-quotes: "\201c" "\201d" "\2018" "\2019";
  }
  :where(:lang(ja)) {
    --han-title-marks: var(--han-title-marks-quotes);
    --han-em-dot-position: over right;
  }
  :where(:lang(ko-Kore)) {
    --han-title-marks: var(--han-title-marks-quotes);
  }
  :where(:lang(ko)):where(:not(:lang(ko-Kore))) {
    --han-quotes: "\201c" "\201d" "\2018" "\2019";
  }
  :where(:root, body, [lang]):where(:lang(zh), :lang(ja), :lang(ko)) {
    --_han-em-role: default;
    font-family: var(--han-font-default);
  }
  :where(*):where(:lang(zh), :lang(ja), :lang(ko)) {
    text-decoration-inset: var(--han-text-decoration-inset);
  }
  @container style(--han-semantics: on) {
    :where(:is(:lang(zh), :lang(ja), :lang(ko)) > blockquote) {
      margin-inline: var(--han-structural-indent-blockquote, var(--han-structural-indent));
    }
    :where(:is(:lang(zh), :lang(ja), :lang(ko)) > figure) {
      margin-inline: var(--han-structural-indent-figure, var(--han-structural-indent));
    }
    :where(:is(:lang(zh), :lang(ja), :lang(ko)) > :is(ol, ul)) {
      padding-inline: var(--han-structural-indent-list, var(--han-structural-indent) 0);
    }
    :where(blockquote figure) {
      margin-inline: initial;
    }
    :where(.poem-like) {
      &:where(p),
      & :where(p) {
        margin-inline: var(--han-structural-indent-poem, var(--han-structural-indent) 0);
      }
    }
  }
  @container style(--han-semantics: off) {
    :where(*):where(:lang(zh), :lang(ja), :lang(ko)) {
      text-underline-offset: auto;
    }
  }
  @container style(--han-semantics: on) {
    :where(code, kbd, samp, pre) {
      --_han-em-role: monospace;
      font-family: var(--han-monospace);
    }
    :where(button, input, select, textarea) {
      --_han-em-role: system-ui;
      font-family: var(--han-system-ui);
    }
    :where(*):where(:lang(zh), :lang(ja), :lang(ko)) {
      text-underline-offset: var(--han-underline-offset);
    }
    :where(*):where(:lang(zh), :lang(ja), :lang(ko)) {
      font-style: inherit;
    }
    :where(cite:is(:lang(zh), :lang(ja), :lang(ko-Kore))) {
      & {
        quotes: var(--han-title-marks);
      }
      @container style(--han-cite-title-marks: bracket) {
        &::before {
          content: open-quote;
        }
        &::after {
          content: close-quote;
        }
      }
      @container style(--han-cite-title-marks: wavy) {
        &:where(:lang(zh)) {
          quotes: none;
          text-decoration-line: underline;
          text-decoration-style: wavy;
          text-decoration-thickness: .0625rem;
        }
      }
      @container style(--han-cite-title-marks: none) {
        &:where(:lang(zh), :lang(ja), :lang(ko-Kore)) {
          quotes: none;
        }
        &:where(:lang(zh)) {
          text-decoration: none;
        }
      }
    }
    :where(dfn:is(:lang(zh), :lang(ja), :lang(ko))) {
      font-weight: bolder;
    }
    :where(i:is(:lang(zh), :lang(ja), :lang(ko))) {
      --_han-em-role: accent;
      font-family: var(--han-font-accent);
    }
    :where(em:is(:lang(zh), :lang(ja), :lang(ko))) {
      --_han-em-base: var(--han-font-default);
      @container style(--_han-em-role: accent) {
        --_han-em-base: var(--han-font-accent);
      }
      @container style(--_han-em-role: monospace) {
        --_han-em-base: var(--han-monospace);
      }
      @container style(--_han-em-role: system-ui) {
        --_han-em-base: var(--han-system-ui);
      }
      font-family: var(--han-font-em-mark), var(--han-font-em-base, var(--_han-em-base));
      text-emphasis: var(--han-em-symbol);
      text-emphasis-position: var(--han-em-dot-position);
    }
    :where(var:is(:lang(zh), :lang(ja), :lang(ko))) {
      --_han-em-role: accent;
      font-family: var(--han-font-accent);
    }
  }
  :where(q) {
    & {
      quotes: var(--han-quotes);
    }
    @container style(--han-q-quotes: on) {
      &::before {
        content: open-quote;
      }
      &::after {
        content: close-quote;
      }
    }
    @container style(--han-q-quotes: off) {
      &::before {
        content: none;
      }
      &::after {
        content: none;
      }
    }
  }
  :where(ruby:is(.zhuyin, .mps), ruby:has(> rt:is(.zhuyin, .mps))) {
    & {
      --han-ruby-zhuyin-used-ideographic-ink-descent: .075em;
    }
    :where(& > rt) {
      font-family: var(--han-font-zhuyin-serif);
      font-size: var(--han-ruby-zhuyin-font-size);
      letter-spacing: var(--han-ruby-zhuyin-letter-spacing);
      line-height: 1;
      ruby-align: center;
      text-orientation: upright;
    }
    @container style(--han-writing-mode: vertical-rl) {
      :where(& > rt) {
        margin-block-end: var(--han-ruby-zhuyin-over-gap);
      }
    }
    @container style(--han-writing-mode: vertical-lr) {
      :where(& > rt) {
        margin-block-end: var(--han-ruby-zhuyin-over-gap);
      }
    }
    @container style(--han-zhuyin-ruby-position: over) and style(--han-writing-mode: horizontal-tb) {
      & {
        ruby-position: over;
      }
      :where(& > rt) {
        font-feature-settings: "salt";
      }
    }
    @container style(--han-zhuyin-ruby-position: inter-character) and style(--han-writing-mode: horizontal-tb) {
      & {
        ruby-position: inter-character;
      }
      @supports (ruby-position: inter-character) {
        :where(& > rt)::before,
        :where(& > rt)::after {
          content: "";
        }
        :where(& > rt)::before {
          padding-inline-start: max(0em, calc(-2 * var(--han-ruby-zhuyin-baseline-shift)));
        }
        :where(& > rt)::after {
          padding-inline-start: max(0em, calc(2 * var(--han-ruby-zhuyin-baseline-shift)));
        }
      }
      @supports not (ruby-position: inter-character) {
        & {
          position: relative;
          letter-spacing: calc(var(--han-ruby-zhuyin-font-size) * 5 / 3);
        }
        :where(& > rt) {
          position: absolute;
          inset-block-start: .5em;
          display: inline-flex;
          justify-content: center;
          block-size: 1em;
          inline-size: 3em;
          writing-mode: vertical-rl;
        }
        & {
          anchor-scope: --han-ruby-baseline;
        }
        &::before {
          content: "";
          position: relative;
          inset-block-start: var(--han-ruby-zhuyin-used-ideographic-ink-descent);
          font-size: 0;
          line-height: 0;
          anchor-name: --han-ruby-baseline;
        }
        :where(& > rt) {
          position-anchor: --han-ruby-baseline;
          inset-inline-start: auto;
          inset-inline-end: calc(anchor(--han-ruby-baseline top) + var(--han-ruby-zhuyin-baseline-shift));
          margin-inline-start: 0;
        }
      }
    }
  }
  @container style(--han-semantics: on) {
    @supports not (text-decoration-inset: auto) {
      :where(:is(u, ins):has(+ u, + ins)),
      :where(:is(s, del):has(+ s, + del)) {
        margin-inline-end: var(--han-adjacent-lines-skip-gap-fallback);
      }
      @container style(--han-cite-title-marks: wavy) {
        :where(:is(u, ins, cite:lang(zh)):has(+ u, + ins, + cite:lang(zh))) {
          margin-inline-end: var(--han-adjacent-lines-skip-gap-fallback);
        }
      }
    }
  }
}

/* src/css/semantics.with-js.css */
@layer han-semantics {
  @container style(--han-semantics: on) {
    @supports not (text-decoration-inset: auto) {
      :where(u, ins, s, del, cite) {
        :where([data-adjacent-lines-refined] &:not([data-followed-by-adjacent-line]):not([data-followed-by-adjacent-wavy])) {
          margin-inline-end: initial;
        }
      }
      :where(u, ins, s, del):where([data-followed-by-adjacent-line]) {
        margin-inline-end: var(--han-adjacent-lines-skip-gap-fallback);
      }
      @container style(--han-cite-title-marks: wavy) {
        :where(u, ins, cite:lang(zh)):where([data-followed-by-adjacent-wavy]) {
          margin-inline-end: var(--han-adjacent-lines-skip-gap-fallback);
        }
      }
      @container style(--han-text-decoration-inset: 0) {
        :where(u, ins, s, del, cite):where([data-followed-by-adjacent-line], [data-followed-by-adjacent-wavy]) {
          margin-inline-end: initial;
        }
      }
    }
  }
}

/* src/han.semantics.css */
/*# sourceMappingURL=/han/han.semantics.css.map */
