/* ── components/typography/typography.css ── */
/* -- Typography component --------------------------------------- */

/* -- Base text ---------------------------------------------- */
/* Sets the default font size for the entire page.            */
/* All typography classes are sized relative to this baseline. */
@layer base {
  body {
    font-size: 0.875rem;
    line-height: 1.5;
  }
  /* code reads in the theme's monospace stack, not the browser's default (a
     Courier on macOS) - zero specificity, so a component's own face wins */
  :where(code, kbd, samp, pre) {
    font-family: var(--font-mono);
  }
}

@layer components {
  /* -- Headings ---------------------------------------------- */
  .h1 {
    scroll-margin-top: 5rem;
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.15;
    text-wrap: balance;
    color: var(--foreground);
  }

  .h2 {
    scroll-margin-top: 5rem;
    font-size: 1.875rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    text-wrap: balance;
    color: var(--foreground);
    border-block-end: 1px solid var(--border);
    padding-block-end: 0.5rem;

    &:first-child {
      margin-block-start: 0;
    }
  }

  .h3 {
    scroll-margin-top: 5rem;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    text-wrap: balance;
    color: var(--foreground);
  }

  .h4 {
    scroll-margin-top: 5rem;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    text-wrap: balance;
    color: var(--foreground);
  }

  /* -- Paragraph --------------------------------------------- */
  .p {
    font-size: 0.875rem;
    line-height: 1.75;
    text-wrap: pretty;
    color: var(--foreground);

    &:not(:first-child) {
      margin-block-start: 1.5rem;
    }
  }

  /* -- Lead --------------------------------------------------- */
  .lead {
    font-size: 1.25rem;
    line-height: 1.6;
    color: var(--muted-foreground);
    text-wrap: pretty;
  }

  /* -- Large -------------------------------------------------- */
  .large {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
  }

  /* -- Small -------------------------------------------------- */
  .small {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    color: var(--foreground);
  }

  /* -- Muted -------------------------------------------------- */
  .muted {
    font-size: 0.875rem;
    color: var(--muted-foreground);
  }

  /* -- Link ------------------------------------------------- */
  /* a link in running text: the primary colour, the line and its offset from
     the theme's link tokens (literal fallbacks for a theme without them) */
  .link {
    color: var(--primary);
    text-decoration: var(--link-text-decoration, underline);
    text-underline-offset: var(--link-underline-offset, 4px);
  }

  /* -- Blockquote --------------------------------------------- */
  .blockquote {
    margin-block-start: 1.5rem;
    border-inline-start: 2px solid var(--border);
    padding-inline-start: 1.5rem;
    font-style: italic;
    hanging-punctuation: first last;
    color: var(--foreground);

    & p {
      margin: 0;
    }
  }

  /* -- Inline code -------------------------------------------- */
  .inline-code {
    position: relative;
    border-radius: var(--radius-sm);
    background: var(--muted);
    padding: 0.2rem 0.3rem;
    font-family: var(--font-mono);
    font-size: 0.875em;
    font-weight: 600;
    color: var(--foreground);
  }

  /* -- CJK: Chinese, Japanese, Korean ------------------------------
     Keyed on the lang attribute, so one set of classes serves every script.
     Latin tuning is undone (negative tracking, faux italics); paragraphs
     justify between characters with strict line breaking (kinsoku: no 。
     or ， at a line start), and sentence-end punctuation may hang past the
     edge (Safari: hanging-punctuation) or trims to half width
     (Chromium: text-spacing-trim) so the justified edge stays straight.
     text-autospace adds the thin gap between CJK and Latin /
     digits that authors used to type by hand. */
  :is(.h1, .h2, .h3, .h4, .lead, .large):is(:lang(zh), :lang(ja), :lang(ko)),
  :is(:lang(zh), :lang(ja), :lang(ko)) :is(.h1, .h2, .h3, .h4, .lead, .large) {
    letter-spacing: 0;
  }
  /* Japanese headings break between phrases (bunsetsu), not mid-word */
  :is(.h1, .h2, .h3, .h4, .lead):lang(ja),
  :lang(ja) :is(.h1, .h2, .h3, .h4, .lead) {
    word-break: auto-phrase;
  }
  :is(.p, .lead, .blockquote):is(:lang(zh), :lang(ja), :lang(ko)),
  :is(:lang(zh), :lang(ja), :lang(ko)) :is(.p, .lead, .blockquote) {
    line-height: 1.9;
    line-break: strict;
    text-autospace: normal;
  }
  :is(.p, .blockquote):is(:lang(zh), :lang(ja)),
  :is(:lang(zh), :lang(ja)) :is(.p, .blockquote) {
    text-align: justify;
    text-justify: inter-character;
    /* the line-end 。，: Safari hangs it past the edge; Chromium trims the
       fullwidth glyph's blank half (text-spacing-trim) - either way the
       justified edge stays straight */
    hanging-punctuation: allow-end;
    text-spacing-trim: normal;
  }
  /* CJK has no italics - a slanted Han character is a synthetic oblique */
  .blockquote:is(:lang(zh), :lang(ja), :lang(ko)),
  :is(:lang(zh), :lang(ja), :lang(ko)) .blockquote {
    font-style: normal;
  }

  /* -- Vertical text (tategaki / 直排) ----------------------------------
     .text-vertical sets top-to-bottom lines flowing right to left. Latin
     runs lie sideways (text-orientation: mixed); .text-upright stands a
     short run (a two-digit number) upright in one cell - tate-chu-yoko.
     The spacing above uses logical properties, so headings, paragraphs and
     the blockquote rule turn with the text. Give the block a height. */
  .text-vertical {
    writing-mode: vertical-rl;
    text-orientation: mixed;
  }
  .text-upright {
    text-combine-upright: all;
  }

  /* -- Emphasis marks (圈点 / 傍点) ---------------------------------------
     Dots beside each character instead of italics: over the text in
     Japanese (right of it when vertical), under it in Chinese. */
  .text-emphasis {
    font-style: normal;
    text-emphasis: filled dot;
    text-emphasis-position: over right;
  }
  .text-emphasis:lang(ja) {
    text-emphasis-style: filled sesame;
  }
  .text-emphasis:lang(zh) {
    text-emphasis-position: under right;
  }

  /* ruby annotations (furigana, pinyin, zhuyin) read as small, muted type */
  :is(.p, .lead, .blockquote, .h1, .h2, .h3, .h4) rt {
    font-size: 0.5em;
    color: var(--muted-foreground);
    letter-spacing: 0;
  }

  /* -- Typesetting (Satz): book and journal setting ----------------------
     .typeset holds continuous text set like a book or a journal page. Each
     classic rule is an opt-in data attribute, tuned by a --typeset-* knob -
     component properties, not theme tokens (the theme set stays the
     tweakcn shape):
       data-columns="2|3"        columns never narrower than
                                 --typeset-column-width: a phone gets one
       data-rule                 a hairline between the columns
       data-align="justify"      Blocksatz: justified and hyphenated (set
                                 lang=""), the last line flush start
       data-indent               Einzug: paragraphs follow without a gap and
                                 indent their first line; the first one after
                                 a heading starts flush (stumpf)
       data-initial="drop|raised"  Initiale over --typeset-initial-lines lines
       data-lead="smallcaps|caps"  the opening line in small capitals or in
                                 letterspaced capitals (Versalien)
       data-ligatures="classic"  discretionary and historical ligatures,
                                 old-style figures - where the font has them
       data-leading="tight|loose"  compact or airy lines, the tracking matched
       data-orphans / data-widows="3|4"  lines kept together at a break (2)
     .typeset-span spans every column (a heading, a figure). Figures, tables,
     quotes, groups and Separator breaks keep --typeset-gap from the text -
     the Separator component draws the break, this block only spaces it.
     VERIFIED: (typography.e2e, the typeset checks) every rule as a computed
     style, the gaps, the captions' counters, 44rem two columns vs 20rem one. */
  .typeset {
    --typeset-measure: 68ch;
    --typeset-column-width: 18rem;
    --typeset-column-gap: 2.5em;
    --typeset-indent: 1em;
    --typeset-leading: 1.65;
    --typeset-tracking: 0em;
    --typeset-gap: 1.5em;
    --typeset-initial-lines: 3;
    --typeset-initial-gap: 0.3em;
    --typeset-initial-font: var(--font-serif);
    --typeset-initial-color: var(--primary);

    max-inline-size: var(--typeset-measure);
    line-height: var(--typeset-leading);
    letter-spacing: var(--typeset-tracking);
    text-wrap: pretty;
    hanging-punctuation: first allow-end last;
    font-kerning: normal;
    orphans: 2;
    widows: 2;

    /* a .typeset-keep is a wrapper, not a block: what it holds is spaced as
       if it sat in the setting itself (each rule names both paths - :is()
       would raise the direct path's specificity to the wrapper path's) */
    & > p,
    & > .typeset-keep > p {
      margin-block: 0 1em;
    }
    /* every block keeps the same distance from the text around it */
    &
      > :is(
        figure,
        table,
        blockquote,
        pre,
        hr,
        .separator,
        .typeset-group,
        .chart,
        .diagram,
        .mockup-code,
        .table-container
      ),
    &
      > .typeset-keep
      > :is(
        figure,
        table,
        blockquote,
        pre,
        hr,
        .separator,
        .typeset-group,
        .chart,
        .diagram,
        .mockup-code,
        .table-container
      ) {
      margin-block: var(--typeset-gap);
    }
    /* a figure spans the measure (the browser indents it 40px by default) */
    & > :is(figure, blockquote),
    & > .typeset-keep > :is(figure, blockquote) {
      margin-inline: 0;
    }
    & > :is(h1, h2, h3, h4, .h1, .h2, .h3, .h4),
    & > .typeset-keep > :is(h1, h2, h3, h4, .h1, .h2, .h3, .h4) {
      margin-block: var(--typeset-gap) 0.5em;
    }
    & > :first-child,
    & > .typeset-keep:first-child > :first-child {
      margin-block-start: 0;
    }
    & :is(figure, blockquote, table, pre, .typeset-group) {
      break-inside: avoid;
    }
    /* a long table or listing may split: kept whole, it would leave the rest
       of a page empty, and one taller than a page splits anyway. Every piece
       keeps the frame (clone): sliced, the first piece lost its bottom border
       and corners at the column foot, the next its top. A figure that may
       split lets the listing inside it split too, and its caption stays with
       the last piece.
       VERIFIED: (Chromium PDF probe 2026-10-12) a framed listing split over
       two columns and over two pages prints a closed, rounded frame on each. */
    & [data-break-inside="allow"],
    & [data-break-inside="allow"] :is(figure, blockquote, table, pre, .typeset-group, .mockup-code) {
      break-inside: auto;
      box-decoration-break: clone;
    }
    /* ... and a listing that may split does not scroll sideways: Chromium
       never breaks a scroll container, so the listing moved whole and left its
       caption behind - wrap its lines instead (pre-wrap, a Code Mockup's
       data-wrap). VERIFIED: (Chromium probe 2026-10-12) overflow-x: auto kept
       the paper's closing report whole at 900px, overflow-x: visible split it. */
    & :is(pre, .mockup-code):is([data-break-inside="allow"], [data-break-inside="allow"] *) {
      overflow-x: visible;
    }
    /* a caption never breaks alone to the next column or page - on screen,
       where the columns balance, as in print. A figure that may split is a
       block, its caption kept to the last piece (below) or the first (above).
       VERIFIED: (Chromium, screen and PDF 2026-10-12) in a grid figure the
       keep did nothing and the caption stood alone at the head of the next
       column; in block flow the break moved up into the listing and two lines
       went along with the caption. A figure group keeps its grid. */
    & figure[data-break-inside="allow"]:not(.typeset-group) {
      display: block;

      & > figcaption:last-child {
        break-before: avoid;
      }
      & > figcaption:first-child {
        break-after: avoid;
      }
    }
    & :is(h1, h2, h3, h4, .h1, .h2, .h3, .h4) {
      break-after: avoid;
    }
    /* the lines a paragraph keeps together at a column or page break: at the
       foot of the column (orphans) and at the head of the next (widows) */
    &[data-orphans="3"] {
      orphans: 3;
    }
    &[data-orphans="4"] {
      orphans: 4;
    }
    &[data-widows="3"] {
      widows: 3;
    }
    &[data-widows="4"] {
      widows: 4;
    }
    & .typeset-span {
      column-span: all;
    }
    /* the columns below a spanning heading or figure start level: the first
       block keeps no top margin - across the column break it cannot collapse
       into the spanner's, so a subheading sat lower than the text beside it */
    &[data-columns] > .typeset-span + :not(.typeset-span),
    &[data-columns] > .typeset-span + .typeset-keep > :first-child {
      margin-block-start: 0;
    }

    &[data-columns] {
      max-inline-size: none;
      column-gap: var(--typeset-column-gap);
    }
    &[data-columns="2"] {
      columns: 2 var(--typeset-column-width);
    }
    &[data-columns="3"] {
      columns: 3 var(--typeset-column-width);
    }
    &[data-rule] {
      column-rule: 1px solid var(--border);
    }

    &[data-align="justify"] {
      text-align: justify;
      text-align-last: start;
      hyphens: auto;
      hyphenate-limit-chars: 6 3 2;

      /* text-align-last inherits: a centered caption inside a justified setting
         kept its last line flush left (a two-line figure caption looked
         off-center) - what centers itself takes its last line from its own alignment */
      & :where(figcaption, caption, .typeset-caption) {
        text-align-last: auto;
      }
    }

    /* leading and tracking move together: tight lines close up a little,
       airy lines open up a little, so the grey of the column stays even */
    &[data-leading="tight"] {
      --typeset-leading: 1.45;
      --typeset-tracking: -0.01em;
    }
    &[data-leading="loose"] {
      --typeset-leading: 1.9;
      --typeset-tracking: 0.01em;
    }

    &[data-indent] > p,
    &[data-indent] > .typeset-keep > p {
      margin-block: 0;
    }
    &[data-indent] > p + p,
    &[data-indent] > .typeset-keep > p + p,
    &[data-indent] > p + .typeset-keep > p:first-child,
    &[data-indent] > p + .typeset-break + p {
      text-indent: var(--typeset-indent);
    }
    /* text-indent inherits into an inline-block, which then indents ITS first line: a badge,
       a key cap or an epistemic tag at the start of an indented paragraph grew a blank
       inside its left edge */
    &[data-indent] > p :where(.badge, kbd, .paper-tag),
    &[data-indent] > .typeset-keep > p :where(.badge, kbd, .paper-tag) {
      text-indent: 0;
    }

    /* the gap is a margin: Chromium ignores logical padding on ::first-letter
       (VERIFIED: probe 2026-10-07 - padding-inline-end computed 0, margin-inline-end 2.52px) */
    &[data-initial] > p:first-of-type::first-letter {
      margin-inline-end: var(--typeset-initial-gap);
      font-family: var(--typeset-initial-font);
      font-weight: 600;
      color: var(--typeset-initial-color);
    }
    &[data-initial="drop"] > p:first-of-type::first-letter {
      -webkit-initial-letter: var(--typeset-initial-lines);
      initial-letter: var(--typeset-initial-lines);
    }
    &[data-initial="raised"] > p:first-of-type::first-letter {
      -webkit-initial-letter: var(--typeset-initial-lines) 1;
      initial-letter: var(--typeset-initial-lines) 1;
    }

    &[data-lead="smallcaps"] > p:first-of-type::first-line {
      font-variant-caps: all-small-caps;
      letter-spacing: 0.04em;
    }
    /* letterspaced capitals - and the small-caps lead beside an initial:
       a first line in small capitals moves the initial down a line
       (Chromium), capitals keep its top level with the line's */
    &:is([data-lead="caps"], [data-initial][data-lead="smallcaps"]) > p:first-of-type::first-line {
      font-variant-caps: normal;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    &[data-ligatures="classic"] {
      font-variant-ligatures: common-ligatures discretionary-ligatures historical-ligatures contextual;
      font-variant-numeric: oldstyle-nums proportional-nums;
    }
  }
  /* a heading is never justified: a wrapping heading stretched to the measure
     opened wide gaps between its words. Flush start and unhyphenated - zero
     specificity, so an alignment the heading sets itself still wins */
  :where(.typeset[data-align="justify"]) :where(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4) {
    text-align: start;
    text-align-last: auto;
    hyphens: manual;
  }
  /* a verbatim record keeps its spacing: justified, a wrapped line of program
     output opened wide gaps between its words, and hyphenation split its
     identifiers (pa-per.mdx) - a pre is set flush start, unhyphenated */
  :where(.typeset[data-align="justify"]) :where(pre) {
    text-align: start;
    text-align-last: auto;
    hyphens: manual;
  }
  /* no initial-letter (Firefox): a floated letter as tall as the lines */
  @supports not ((initial-letter: 3) or (-webkit-initial-letter: 3)) {
    .typeset[data-initial] > p:first-of-type::first-letter {
      float: inline-start;
      font-size: calc(var(--typeset-initial-lines) * var(--typeset-leading) * 1em * 0.82);
      line-height: 0.8;
      padding-block-start: 0.08em;
    }
  }

  /* -- Captions (Bildunterschriften), numbered in order ------------------
     .typeset-caption on a figcaption (a picture, a video, a chart) or a
     table's caption. Inside .typeset-numbered, figures and tables count on
     their own: "Figure 1.", "Table 1." - the words are --typeset-figure-label
     and --typeset-table-label ("" leaves the bare number: "1."). A caption
     is flush start; data-align="justify" or "center" sets it otherwise. */
  .typeset-numbered {
    --typeset-figure-label: "Figure ";
    --typeset-table-label: "Table ";

    counter-reset: typeset-figure typeset-table;
  }
  .typeset-caption {
    margin-block-start: 0.6em;
    color: var(--muted-foreground);
    font-size: 0.875em;
    line-height: 1.5;
    text-align: start;
    text-align-last: auto;
    text-wrap: pretty;
    caption-side: top;

    &[data-align="justify"] {
      text-align: justify;
      text-align-last: start;
      hyphens: auto;
    }
    &[data-align="center"] {
      text-align: center;
      text-wrap: balance;
    }
    table > & {
      margin-block: 0 0.6em;
    }
  }
  .typeset-numbered :is(figcaption.typeset-caption)::before {
    counter-increment: typeset-figure;
    content: var(--typeset-figure-label) counter(typeset-figure) ". ";
    color: var(--foreground);
    font-weight: 600;
  }
  .typeset-numbered
    :is(
      caption.typeset-caption,
      figure:has(> table) > figcaption.typeset-caption,
      figure:has(> .table-container) > figcaption.typeset-caption
    )::before {
    counter-increment: typeset-table;
    content: var(--typeset-table-label) counter(typeset-table) ". ";
  }

  /* -- Figure groups: several figures in one box ---------------------------
     .typeset-group sets two or three figures (charts, pictures, tables) side
     by side; each figure's caption is lettered "(a)", "(b)" (.typeset-subcaption),
     the group's own figcaption numbers the whole. Every figure spans two
     subgrid rows - media, then caption - so the captions of a row sit at one
     height whatever the media's height. data-align="middle" centres the media
     in their row; data-divided draws hairlines between the figures - the
     1px grid gap over a border-coloured background, so the lines run between
     columns and, once the figures stack, between rows, with no container
     query (a size container would scope the caption counters to the group);
     data-variant="cards" gives each figure its own card instead of one box.
     Narrow pages stack them.
     VERIFIED: (typography.e2e "figure groups") captions level, the 1px lines
     between columns and between stacked rows, the cards' borders. */
  .typeset-group {
    --typeset-group-min: 12rem;
    --typeset-group-gap: 1.25rem;

    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--typeset-group-min)), 1fr));
    gap: var(--typeset-group-gap);
    margin-inline: 0;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    counter-reset: typeset-sub;

    & > figure {
      display: grid;
      grid-row: span 2;
      grid-template-rows: subgrid;
      row-gap: 0.4em;
      align-content: start;
      margin: 0;
      min-inline-size: 0;
    }
    & > figcaption {
      grid-column: 1 / -1;
      margin-block-start: 0.25em;
    }
    & img,
    & video {
      display: block;
      inline-size: 100%;
      block-size: auto;
      border-radius: var(--radius-md);
    }

    &[data-align="middle"] > figure > :first-child {
      align-self: center;
    }

    &[data-variant="cards"] {
      padding: 0;
      border: 0;
      background: none;

      & > figure {
        padding: 0.875rem;
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        background: var(--card);
      }
    }

    &[data-divided] {
      gap: 1px;
      padding: 0;
      overflow: hidden;
      background: var(--border);

      & > figure {
        padding: 1rem;
        background: var(--card);
      }
      & > figcaption {
        margin: 0;
        padding: 0.75rem 1rem 1rem;
        background: var(--card);
      }
    }
  }
  .typeset-subcaption {
    margin: 0;
    color: var(--muted-foreground);
    font-size: 0.8125em;
    line-height: 1.45;

    &::before {
      counter-increment: typeset-sub;
      content: "(" counter(typeset-sub, lower-alpha) ") ";
      color: var(--foreground);
      font-weight: 600;
    }
  }

  /* -- Breaks and keeps (Umbruch): where a printed page or column ends -----
     .typeset-break is an empty marker that forces a break before the next
     block: data-break="page" (the default), "column" (inside data-columns),
     "left" / "right" (the next page is a left / right page - duplex). It
     breaks in print only: a screen has no pages, and a column break in a
     balanced screen column would push the rest of the text into the last
     column. In print it is a zero-height box carrying break-before -
     display: none would remove the box and the break with it. On screen it
     is hidden; [data-show-breaks] on an ancestor shows every marker as a
     labelled dashed line, an authoring aid.
     .typeset-keep keeps its content in one column and on one page (avoid
     covers both - avoid-page would still let a column break split it).
     VERIFIED: (typography.e2e "breaks and keeps", paper.e2e "print") the
     computed breaks in print media; a printed PDF with a page and a column
     break; a zero-height break in the paper's grid leaves no gap at the top
     of the new page. */
  .typeset-break {
    display: none;
  }
  @media screen {
    [data-show-breaks] .typeset-break {
      display: flex;
      align-items: center;
      gap: 0.75em;
      margin-block: 1em;
      color: var(--muted-foreground);
      font: 500 0.6875rem/1 var(--font-mono);
      letter-spacing: 0.06em;
      text-transform: uppercase;

      &::before {
        content: "Page break";
      }
      &[data-break="column"]::before {
        content: "Column break";
      }
      &[data-break="left"]::before {
        content: "Page break - left page";
      }
      &[data-break="right"]::before {
        content: "Page break - right page";
      }
      &::after {
        content: "";
        flex: 1;
        border-block-start: 1px dashed currentColor;
      }
    }
  }
  @media print {
    .typeset-break {
      display: block;
      block-size: 0;
      margin: 0;
      padding: 0;
      border: 0;
      visibility: hidden;
      break-before: page;

      &[data-break="column"] {
        break-before: column;
      }
      &[data-break="left"] {
        break-before: left;
      }
      &[data-break="right"] {
        break-before: right;
      }
    }
    /* a printed column rule runs straight through a spanning heading or
       figure that starts a page - so a setting with spanners prints without it.
       VERIFIED: (Chromium PDF probe 2026-10-12) a column-span: all block that a
       natural page break puts at the top of a page is crossed by the rule; an
       opaque background hides it only while background graphics print. */
    .typeset[data-rule]:has(> .typeset-span) {
      column-rule-style: none;
    }
  }
  .typeset-keep {
    break-inside: avoid;
  }

  /* -- Accessibility ------------------------------------------ */

  @media (prefers-contrast: more) {
    .h1,
    .h2,
    .h3,
    .h4 {
      letter-spacing: 0;
    }

    .typeset {
      --typeset-initial-color: var(--foreground);
    }

    .blockquote {
      border-inline-start-width: 3px;
    }

    .inline-code {
      outline: 1px solid var(--border);
    }

    .muted,
    [data-show-breaks] .typeset-break {
      color: var(--foreground);
    }

    /* a theme may drop the underline; more contrast brings it back */
    .link {
      text-decoration-line: underline;
    }
  }

  @media (forced-colors: active) {
    .blockquote {
      border-inline-start-color: CanvasText;
    }

    .typeset {
      --typeset-initial-color: CanvasText;
    }

    .typeset[data-rule] {
      column-rule-color: CanvasText;
    }

    .inline-code {
      background: Canvas;
      outline: 1px solid CanvasText;
      color: CanvasText;
    }

    .link {
      color: LinkText;
      text-decoration-line: underline;
    }
  }
}

/* ── components/text-rotate/text-rotate.css ── */
/* -- Text Rotate component ------------------------------------------ */

/* the two counters the loop runs on - registered so they animate, inherited so every line reads them */
@property --_text-rotate-i {
  syntax: "<integer>";
  inherits: true;
  initial-value: 0;
}
/* the line count and a line's index, registered as integers: a value from sibling-count() / sibling-index() computes to
   a number before steps() and calc() read it (VERIFIED: Firefox kept the raw sibling-count() text, and
   steps(sibling-count()) dropped the animation) */
@property --_text-rotate-n {
  syntax: "<integer>";
  inherits: true;
  initial-value: 1;
}
@property --_text-rotate-k {
  syntax: "<integer>";
  inherits: false;
  initial-value: 0;
}
/* the round's progress, 0 to 1 in steps of 1/n - literal keyframes (VERIFIED: Firefox does not interpolate a keyframe
   value written as var(), it flipped at half time) */
@property --_text-rotate-t {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --_text-rotate-e {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

@layer components {
  /* daisyUI's text-rotate, CSS only: a .text-rotate holds one <span> of lines (each a child element, any number from
     2); one line shows at a time and the stack rolls on to the next - an infinite loop that pauses while hovered. The
     window is one line tall (1lh), so it works at any font-size and line-height, inline in a sentence or as a
     headline. --text-rotate-duration sets one full round (default 10s). data-direction="down" rolls the other way,
     data-effect="fade" crossfades in place, data-pause="none" keeps it running under the pointer. Reduced motion shows
     the first line only.

     One mechanism for every line count: two registered counters animate on every line, in step - --_text-rotate-t,
     the round's progress (0, 1/n, 2/n ... in steps(n); times n it is i, the line shown), and --_text-rotate-e, the roll
     at the end of each slot (0 while the line holds, easing to 1 in the slot's last 8%). Every line moves by i + e
     lines, so the stack rolls as one; in the last slot it rolls back to the first line. A fade reads the same counters on every line. n is the line count (sibling-count(), or the :has()
     rules below), k a line's index (sibling-index(), or :nth-child()). */
  .text-rotate {
    --_text-rotate-n: 1;
    --_dur: var(--text-rotate-duration, 10s);
    display: inline-grid;
    height: 1lh;
    overflow: hidden;
    vertical-align: bottom;

    & > span {
      display: flex;
      flex-direction: column;
    }
    /* every line runs the same two animations (in step - they start together) and moves by the same amount, so the
       stack rolls as one; a line's own sibling-count() is the line count */
    & > span > * {
      --_text-rotate-k: 0;
      /* the line shown, 0 to n - 1 (an integer: the progress times n, rounded) */
      --_text-rotate-i: calc(var(--_text-rotate-t) * var(--_text-rotate-n));
      /* 1 in the last slot: the roll goes back to the first line */
      --_last: clamp(0, var(--_text-rotate-i) - var(--_text-rotate-n) + 2, 1);
      /* how many lines the stack has moved up: i + e, and back to 0 across the last slot */
      --_p: calc(var(--_text-rotate-i) + var(--_text-rotate-e) * (1 - var(--_text-rotate-n) * var(--_last)));
      display: block;
      height: 1lh;
      white-space: nowrap;
      translate: 0 calc(var(--_p) * -1lh);
      animation:
        text-rotate-index var(--_dur) steps(var(--_text-rotate-n)) infinite,
        text-rotate-roll calc(var(--_dur) / var(--_text-rotate-n)) infinite;
    }
    &[data-align="center"] > span > * {
      text-align: center;
    }
    &[data-align="end"] > span > * {
      text-align: end;
    }

    &:hover > span > *,
    &:focus-within > span > * {
      animation-play-state: paused;
    }
    &[data-pause="none"]:hover > span > *,
    &[data-pause="none"]:focus-within > span > * {
      animation-play-state: running;
    }

    /* down: the lines stack bottom up and the stack moves down - line i sits n - 1 - i lines from the top */
    &[data-direction="down"] > span {
      flex-direction: column-reverse;
    }
    &[data-direction="down"] > span > * {
      translate: 0 calc((var(--_text-rotate-n) - 1 - var(--_p)) * -1lh);
    }

    /* fade: every line in the same cell; the line shown fades out across the slot's roll while the next fades in */
    &[data-effect="fade"] > span {
      display: grid;
    }
    &[data-effect="fade"] > span > * {
      /* 1 for the line shown, 1 for the line after it (the first after the last) */
      --_on: calc(1 - min(1, abs(var(--_text-rotate-i) - var(--_text-rotate-k))));
      --_text-rotate-next: calc(
        1 - min(1, abs(mod(var(--_text-rotate-i) + 1, var(--_text-rotate-n)) - var(--_text-rotate-k)))
      );
      grid-area: 1 / 1;
      opacity: calc(var(--_on) * (1 - var(--_text-rotate-e)) + var(--_text-rotate-next) * var(--_text-rotate-e));
      translate: 0
        calc((var(--_text-rotate-next) * (1 - var(--_text-rotate-e)) - var(--_on) * var(--_text-rotate-e)) * 0.25lh);
    }
  }

  /* the line count and each line's index: the browser counts where it can, else the rules below (up to 40 lines) */
  .text-rotate:has(> span > :nth-child(2):last-child) {
    --_text-rotate-n: 2;
  }
  .text-rotate:has(> span > :nth-child(3):last-child) {
    --_text-rotate-n: 3;
  }
  .text-rotate:has(> span > :nth-child(4):last-child) {
    --_text-rotate-n: 4;
  }
  .text-rotate:has(> span > :nth-child(5):last-child) {
    --_text-rotate-n: 5;
  }
  .text-rotate:has(> span > :nth-child(6):last-child) {
    --_text-rotate-n: 6;
  }
  .text-rotate:has(> span > :nth-child(7):last-child) {
    --_text-rotate-n: 7;
  }
  .text-rotate:has(> span > :nth-child(8):last-child) {
    --_text-rotate-n: 8;
  }
  .text-rotate:has(> span > :nth-child(9):last-child) {
    --_text-rotate-n: 9;
  }
  .text-rotate:has(> span > :nth-child(10):last-child) {
    --_text-rotate-n: 10;
  }
  .text-rotate:has(> span > :nth-child(11):last-child) {
    --_text-rotate-n: 11;
  }
  .text-rotate:has(> span > :nth-child(12):last-child) {
    --_text-rotate-n: 12;
  }
  .text-rotate:has(> span > :nth-child(13):last-child) {
    --_text-rotate-n: 13;
  }
  .text-rotate:has(> span > :nth-child(14):last-child) {
    --_text-rotate-n: 14;
  }
  .text-rotate:has(> span > :nth-child(15):last-child) {
    --_text-rotate-n: 15;
  }
  .text-rotate:has(> span > :nth-child(16):last-child) {
    --_text-rotate-n: 16;
  }
  .text-rotate:has(> span > :nth-child(17):last-child) {
    --_text-rotate-n: 17;
  }
  .text-rotate:has(> span > :nth-child(18):last-child) {
    --_text-rotate-n: 18;
  }
  .text-rotate:has(> span > :nth-child(19):last-child) {
    --_text-rotate-n: 19;
  }
  .text-rotate:has(> span > :nth-child(20):last-child) {
    --_text-rotate-n: 20;
  }
  .text-rotate:has(> span > :nth-child(21):last-child) {
    --_text-rotate-n: 21;
  }
  .text-rotate:has(> span > :nth-child(22):last-child) {
    --_text-rotate-n: 22;
  }
  .text-rotate:has(> span > :nth-child(23):last-child) {
    --_text-rotate-n: 23;
  }
  .text-rotate:has(> span > :nth-child(24):last-child) {
    --_text-rotate-n: 24;
  }
  .text-rotate:has(> span > :nth-child(25):last-child) {
    --_text-rotate-n: 25;
  }
  .text-rotate:has(> span > :nth-child(26):last-child) {
    --_text-rotate-n: 26;
  }
  .text-rotate:has(> span > :nth-child(27):last-child) {
    --_text-rotate-n: 27;
  }
  .text-rotate:has(> span > :nth-child(28):last-child) {
    --_text-rotate-n: 28;
  }
  .text-rotate:has(> span > :nth-child(29):last-child) {
    --_text-rotate-n: 29;
  }
  .text-rotate:has(> span > :nth-child(30):last-child) {
    --_text-rotate-n: 30;
  }
  .text-rotate:has(> span > :nth-child(31):last-child) {
    --_text-rotate-n: 31;
  }
  .text-rotate:has(> span > :nth-child(32):last-child) {
    --_text-rotate-n: 32;
  }
  .text-rotate:has(> span > :nth-child(33):last-child) {
    --_text-rotate-n: 33;
  }
  .text-rotate:has(> span > :nth-child(34):last-child) {
    --_text-rotate-n: 34;
  }
  .text-rotate:has(> span > :nth-child(35):last-child) {
    --_text-rotate-n: 35;
  }
  .text-rotate:has(> span > :nth-child(36):last-child) {
    --_text-rotate-n: 36;
  }
  .text-rotate:has(> span > :nth-child(37):last-child) {
    --_text-rotate-n: 37;
  }
  .text-rotate:has(> span > :nth-child(38):last-child) {
    --_text-rotate-n: 38;
  }
  .text-rotate:has(> span > :nth-child(39):last-child) {
    --_text-rotate-n: 39;
  }
  .text-rotate:has(> span > :nth-child(40):last-child) {
    --_text-rotate-n: 40;
  }
  .text-rotate > span > :nth-child(2) {
    --_text-rotate-k: 1;
  }
  .text-rotate > span > :nth-child(3) {
    --_text-rotate-k: 2;
  }
  .text-rotate > span > :nth-child(4) {
    --_text-rotate-k: 3;
  }
  .text-rotate > span > :nth-child(5) {
    --_text-rotate-k: 4;
  }
  .text-rotate > span > :nth-child(6) {
    --_text-rotate-k: 5;
  }
  .text-rotate > span > :nth-child(7) {
    --_text-rotate-k: 6;
  }
  .text-rotate > span > :nth-child(8) {
    --_text-rotate-k: 7;
  }
  .text-rotate > span > :nth-child(9) {
    --_text-rotate-k: 8;
  }
  .text-rotate > span > :nth-child(10) {
    --_text-rotate-k: 9;
  }
  .text-rotate > span > :nth-child(11) {
    --_text-rotate-k: 10;
  }
  .text-rotate > span > :nth-child(12) {
    --_text-rotate-k: 11;
  }
  .text-rotate > span > :nth-child(13) {
    --_text-rotate-k: 12;
  }
  .text-rotate > span > :nth-child(14) {
    --_text-rotate-k: 13;
  }
  .text-rotate > span > :nth-child(15) {
    --_text-rotate-k: 14;
  }
  .text-rotate > span > :nth-child(16) {
    --_text-rotate-k: 15;
  }
  .text-rotate > span > :nth-child(17) {
    --_text-rotate-k: 16;
  }
  .text-rotate > span > :nth-child(18) {
    --_text-rotate-k: 17;
  }
  .text-rotate > span > :nth-child(19) {
    --_text-rotate-k: 18;
  }
  .text-rotate > span > :nth-child(20) {
    --_text-rotate-k: 19;
  }
  .text-rotate > span > :nth-child(21) {
    --_text-rotate-k: 20;
  }
  .text-rotate > span > :nth-child(22) {
    --_text-rotate-k: 21;
  }
  .text-rotate > span > :nth-child(23) {
    --_text-rotate-k: 22;
  }
  .text-rotate > span > :nth-child(24) {
    --_text-rotate-k: 23;
  }
  .text-rotate > span > :nth-child(25) {
    --_text-rotate-k: 24;
  }
  .text-rotate > span > :nth-child(26) {
    --_text-rotate-k: 25;
  }
  .text-rotate > span > :nth-child(27) {
    --_text-rotate-k: 26;
  }
  .text-rotate > span > :nth-child(28) {
    --_text-rotate-k: 27;
  }
  .text-rotate > span > :nth-child(29) {
    --_text-rotate-k: 28;
  }
  .text-rotate > span > :nth-child(30) {
    --_text-rotate-k: 29;
  }
  .text-rotate > span > :nth-child(31) {
    --_text-rotate-k: 30;
  }
  .text-rotate > span > :nth-child(32) {
    --_text-rotate-k: 31;
  }
  .text-rotate > span > :nth-child(33) {
    --_text-rotate-k: 32;
  }
  .text-rotate > span > :nth-child(34) {
    --_text-rotate-k: 33;
  }
  .text-rotate > span > :nth-child(35) {
    --_text-rotate-k: 34;
  }
  .text-rotate > span > :nth-child(36) {
    --_text-rotate-k: 35;
  }
  .text-rotate > span > :nth-child(37) {
    --_text-rotate-k: 36;
  }
  .text-rotate > span > :nth-child(38) {
    --_text-rotate-k: 37;
  }
  .text-rotate > span > :nth-child(39) {
    --_text-rotate-k: 38;
  }
  .text-rotate > span > :nth-child(40) {
    --_text-rotate-k: 39;
  }
  @supports (z-index: sibling-count()) {
    .text-rotate > span > * {
      --_text-rotate-n: sibling-count();
      --_text-rotate-k: calc(sibling-index() - 1);
    }
  }

  /* the round's progress: 0, 1/n, 2/n ... (steps(n)) - the line shown is that times n */
  @keyframes text-rotate-index {
    from {
      --_text-rotate-t: 0;
    }
    to {
      --_text-rotate-t: 1;
    }
  }
  /* each slot: the line holds for 92%, then the roll eases to the next */
  @keyframes text-rotate-roll {
    0%,
    92% {
      --_text-rotate-e: 0;
      animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1);
    }
    100% {
      --_text-rotate-e: 1;
    }
  }

  /* -- Accessibility ----------------------------------------------------
     Reduced motion: no rolling - the first line stays (both counters rest at 0). All lines stay in the DOM, so
     assistive tech reads the full list. */
  @media (prefers-reduced-motion: reduce) {
    .text-rotate > span > * {
      animation: none;
    }
  }
}

/* ── components/typewriter/typewriter.css ── */
/* -- Typewriter component ---------------------------------------
   A line typed character by character behind a cursor, deleted and
   cycled through a list of strings. The authored strings stay in the DOM
   for assistive tech (visually hidden); the runtime paints an aria-hidden
   copy. Without script, the first string shows as plain text. */

@layer components {
  .typewriter {
    --_cursor: var(--typewriter-cursor-color, currentColor);
    position: relative;
    display: inline;

    /* no script (or not yet initialized): the first string, as text */
    &:not([data-init]) > :not(:first-child) {
      display: none;
    }

    /* initialized: the authored strings are read, not seen */
    & > .typewriter-source {
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      padding: 0;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
      border: 0;
    }

    & > .typewriter-line {
      white-space: pre-wrap;
    }

    /* -- Cursor: a bar by default; solid while typing, blinking idle -- */
    & .typewriter-cursor {
      display: inline-block;
      width: max(2px, 0.08em);
      height: 1.1em;
      margin-inline-start: 0.06em;
      vertical-align: -0.15em;
      background: var(--_cursor);
      animation: typewriter-blink 1s steps(1) infinite;
    }
    &:is([data-phase="typing"], [data-phase="deleting"]) .typewriter-cursor {
      animation: none;
    }

    &[data-cursor="block"] .typewriter-cursor {
      width: 0.55em;
      opacity: 0.85;
    }
    &[data-cursor="underscore"] .typewriter-cursor {
      width: 0.6em;
      height: max(2px, 0.1em);
      vertical-align: -0.1em;
    }
    &[data-cursor="none"] .typewriter-cursor {
      display: none;
    }
    /* data-cursor-hide: "typing" = only while idle; "done" = gone at the end */
    &[data-cursor-hide="typing"]:is([data-phase="typing"], [data-phase="deleting"]) .typewriter-cursor,
    &[data-cursor-hide="done"][data-state-name="done"] .typewriter-cursor {
      visibility: hidden;
    }

    /* -- data-reserve: as wide as the longest string from the start --- */
    &[data-reserve] {
      display: inline-grid;
      justify-items: start;
      vertical-align: bottom;
      & > :is(.typewriter-line, .typewriter-ghost) {
        grid-area: 1 / 1;
      }
      & > .typewriter-ghost {
        display: grid;
        visibility: hidden;
        pointer-events: none;
        /* room for the cursor after the longest string */
        padding-inline-end: 0.2em;
        & > span {
          grid-area: 1 / 1;
          white-space: pre;
        }
      }
      & > .typewriter-line {
        white-space: pre;
      }
    }
    &[data-reserve][data-align="center"] {
      justify-items: center;
    }
    &[data-reserve][data-align="end"] {
      justify-items: end;
    }
  }

  @keyframes typewriter-blink {
    50% {
      opacity: 0;
    }
  }

  /* -- Accessibility -------------------------------------------- */
  @media (prefers-reduced-motion: reduce) {
    /* the runtime swaps whole strings instead of typing; the cursor stays still */
    .typewriter .typewriter-cursor {
      animation: none;
    }
  }

  @media (prefers-contrast: more) {
    .typewriter[data-cursor="block"] .typewriter-cursor {
      opacity: 1;
    }
  }

  @media (forced-colors: active) {
    .typewriter .typewriter-cursor {
      background: CanvasText;
      forced-color-adjust: none;
    }
  }
}

/* ── components/separator/separator.css ── */
/* -- Separator component ---------------------------------------- */

@layer components {
  /* One element, three looks:
     - empty: a plain line (1px, --border) - horizontal, or vertical with
       data-orientation="vertical" (inside a flex row)
     - with text inside: the text sits ON the line - two pseudo-element lines
       left and right of it (above and below when vertical)
     Knobs: data-variant (line color), data-size (thickness), data-gap (space
     between text and lines), data-align="start|end" (text position),
     data-orientation-md / -lg="vertical" (switch to a vertical line from
     48 / 64rem). --_line / --_thick / --_gap are private. */
  .separator {
    --_line: var(--border);
    --_thick: 1px;
    --_gap: 0.75rem;
    border: none;
    margin: 0;
    flex-shrink: 0;
    background: var(--_line);

    /* Horizontal (default) */
    height: var(--_thick);
    width: 100%;

    /* Vertical */
    &[data-orientation="vertical"] {
      height: auto;
      width: var(--_thick);
      align-self: stretch;
    }

    /* Decorative - hidden from assistive technology */
    &[aria-hidden="true"],
    &[role="none"] {
      /* No visual change - purely semantic */
    }

    /* -- Text on the line ------------------------------------ */
    &:not(:empty) {
      display: flex;
      align-items: center;
      gap: var(--_gap);
      height: auto;
      background: none;
      font-size: 0.75rem;
      font-weight: 500;
      line-height: 1.25rem;
      letter-spacing: 0.02em;
      color: var(--muted-foreground);
      white-space: nowrap;

      &::before,
      &::after {
        content: "";
        flex: 1 1 0;
        height: var(--_thick);
        background: var(--_line);
      }

      /* text position along the line */
      &[data-align="start"]::before {
        display: none;
      }
      &[data-align="end"]::after {
        display: none;
      }

      /* a bare glyph - an asterism, a dinkus, a fleuron - without the lines.
         VERIFIED: (separator.e2e "data-line=none") no pseudo lines, centred */
      &[data-line="none"] {
        justify-content: center;

        &::before,
        &::after {
          display: none;
        }
      }

      &[data-orientation="vertical"] {
        flex-direction: column;
        width: auto;
        align-self: stretch;

        &::before,
        &::after {
          width: var(--_thick);
          height: auto;
          min-height: 0.5rem;
        }
      }
    }

    /* -- Colors (the line; the text stays muted) -------------- */
    &[data-variant="neutral"] {
      --_line: var(--foreground);
    }
    &[data-variant="primary"] {
      --_line: var(--primary);
    }
    /* the tweakcn --secondary / --accent are pale surfaces, too faint for a
       line: the theme's vivid chart colors instead (like the status dot) */
    &[data-variant="secondary"] {
      --_line: var(--chart-2);
    }
    &[data-variant="accent"] {
      --_line: var(--chart-4);
    }
    &[data-variant="destructive"],
    &[data-variant="error"] {
      --_line: var(--destructive);
    }
    /* success / warning / info: literals - the token set has no such pairs */
    &[data-variant="success"] {
      --_line: #16a34a;
    }
    &[data-variant="warning"] {
      --_line: #f59e0b;
    }
    &[data-variant="info"] {
      --_line: #0ea5e9;
    }

    /* -- Thickness -------------------------------------------- */
    &[data-size="sm"] {
      --_thick: 1px;
    }
    &[data-size="md"] {
      --_thick: 2px;
    }
    &[data-size="lg"] {
      --_thick: 4px;
    }
    &[data-size="xl"] {
      --_thick: 8px;
    }

    /* -- Gap between the text and the lines ------------------- */
    &[data-gap="none"] {
      --_gap: 0;
    }
    &[data-gap="sm"] {
      --_gap: 0.375rem;
    }
    &[data-gap="md"] {
      --_gap: 0.75rem;
    }
    &[data-gap="lg"] {
      --_gap: 1.5rem;
    }
    &[data-gap="xl"] {
      --_gap: 2.5rem;
    }

    /* -- Responsive: a vertical line from a breakpoint up (DaisyUI's
       lg:divider-horizontal). The PARENT must turn into a row at the
       same width - the separator only follows it. */
    @media (min-width: 48rem) {
      &[data-orientation-md="vertical"] {
        height: auto;
        width: var(--_thick);
        align-self: stretch;

        &:not(:empty) {
          flex-direction: column;
          width: auto;

          &::before,
          &::after {
            width: var(--_thick);
            height: auto;
            min-height: 0.5rem;
          }
        }
      }
    }
    @media (min-width: 64rem) {
      &[data-orientation-lg="vertical"] {
        height: auto;
        width: var(--_thick);
        align-self: stretch;

        &:not(:empty) {
          flex-direction: column;
          width: auto;

          &::before,
          &::after {
            width: var(--_thick);
            height: auto;
            min-height: 0.5rem;
          }
        }
      }
    }
  }

  /* -- Labeled separator (the older wrapper form) --------------
     Still supported; text inside .separator itself is the simpler form. */
  .separator-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;

    & .separator {
      flex: 1;
    }

    & span {
      font-size: 0.75rem;
      font-weight: 500;
      color: var(--muted-foreground);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      white-space: nowrap;
      flex-shrink: 0;
    }
  }

  /* -- Accessibility ----------------------------------------- */
  @media (forced-colors: active) {
    /* system colors would erase the line (a background) - keep it */
    .separator {
      forced-color-adjust: none;
      --_line: CanvasText;
      color: CanvasText;
    }
  }

  @media (prefers-contrast: more) {
    .separator:not([data-variant]) {
      --_line: var(--foreground);
    }
    .separator:not([data-size]) {
      --_thick: 2px;
    }
  }
}

/* ── components/icon/icon.css ── */
/* -- Icon component ---------------------------------------- */
/* Styling for Lucide CDN icons (<i data-lucide="name">).     */
/* Lucide replaces <i> with <svg>, these styles target that.  */

@layer components {
  [data-lucide] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    vertical-align: middle;
    width: 1rem;
    height: 1rem;
    pointer-events: none;

    /* -- Sizes via data-size --------------------------------- */
    &[data-size="xs"] {
      width: 0.75rem;
      height: 0.75rem;
    }
    &[data-size="sm"] {
      width: 0.875rem;
      height: 0.875rem;
    }
    &[data-size="md"] {
      width: 1.25rem;
      height: 1.25rem;
    }
    &[data-size="lg"] {
      width: 1.5rem;
      height: 1.5rem;
    }
    &[data-size="xl"] {
      width: 2rem;
      height: 2rem;
    }

    /* -- Spin animation ------------------------------------- */
    &[data-animate="spin"] {
      animation: icon-spin 1s linear infinite;
    }
  }

  @keyframes icon-spin {
    to {
      transform: rotate(360deg);
    }
  }

  /* ---- Accessibility ---------------------------------------- */

  @media (prefers-reduced-motion: reduce) {
    [data-lucide] {
      animation: none !important;
      transition: none !important;
    }
  }

  @media (prefers-contrast: more) {
    [data-lucide] {
      stroke-width: 2.5;
    }
  }

  @media (forced-colors: active) {
    [data-lucide] {
      color: CanvasText;
    }
  }
}

/* ── components/kbd/kbd.css ── */
/* -- Kbd ---------------------------------------------------------- */
/* Keyboard keys. Built on the native <kbd> element; a combination is a  */
/* <kbd> holding one <kbd> per key, which is what the HTML spec          */
/* prescribes — so the markup already says "these keys together".        */

@layer components {
  .kbd {
    --kbd-size: 1.375rem;

    display: inline-grid;
    place-items: center;
    min-width: var(--kbd-size);
    height: var(--kbd-size);
    padding-inline: 0.375rem;
    border: 1px solid var(--border);
    /* the bottom edge is thicker, which is what reads as a physical key */
    border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    background: var(--muted);
    color: var(--muted-foreground);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
    transition:
      translate 0.08s ease-out,
      border-bottom-width 0.08s ease-out,
      background-color 0.08s ease-out;

    &[data-size="sm"] {
      --kbd-size: 1.125rem;
      padding-inline: 0.25rem;
      font-size: 0.6875rem;
    }

    &[data-size="lg"] {
      --kbd-size: 1.75rem;
      padding-inline: 0.5rem;
      font-size: 0.875rem;
    }

    /* pressed: the key goes down - the heavy bottom edge collapses and the
       face drops by the same pixel, so the key's outer box never moves.
       A page sets data-pressed while its shortcut runs (the global-keys
       handler that performs it), so the key shows it was heard. */
    &[data-pressed] {
      translate: 0 1px;
      border-bottom-width: 1px;
      background: color-mix(in oklch, var(--muted) 80%, var(--foreground));
      color: var(--foreground);
    }
  }

  /* A key combination: an outer <kbd> holding one <kbd> per key. The outer
     element is not a key itself, so it keeps none of the key styling. */
  .kbd-group {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    vertical-align: middle;
    font-family: inherit;
    background: none;
    border: 0;
    padding: 0;
  }

  /* Optional "+" between keys. Absolutely placed in the gap so it never sits
     inside a key's box. */
  .kbd-group[data-separator] {
    gap: 0.875rem;

    & > .kbd + .kbd {
      position: relative;

      &::before {
        content: "+";
        position: absolute;
        inset-inline-start: -0.625rem;
        color: var(--muted-foreground);
        font-size: 0.6875rem;
        line-height: 1;
        pointer-events: none;
      }
    }
  }

  /* Inside a control - or on a tooltip's inverted surface - the key should
     not out-shout its label: it drops its own surface and borrows the
     text colour around it. */
  .btn .kbd,
  .command-item .kbd,
  .dropdown-item .kbd,
  .menubar-trigger .kbd,
  .tooltip .kbd {
    background: transparent;
    border-color: color-mix(in oklch, currentColor 25%, transparent);
    color: inherit;
    opacity: 0.75;

    &[data-pressed] {
      background: color-mix(in oklch, currentColor 18%, transparent);
      opacity: 1;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  @layer components {
    .kbd,
    .kbd *,
    .kbd::before,
    .kbd::after,
    .kbd *::before,
    .kbd *::after,
    .kbd-group,
    .kbd-group::before,
    .kbd-group::after {
      transition: none;
      animation: none;
    }
  }
}

@media (prefers-contrast: more) {
  @layer components {
    .kbd {
      border-color: var(--foreground);
      color: var(--foreground);
    }
  }
}

@media (forced-colors: active) {
  @layer components {
    .kbd {
      border-color: ButtonText;
      color: ButtonText;
      background: ButtonFace;
    }

    .kbd[data-pressed] {
      border-color: Highlight;
      color: HighlightText;
      background: Highlight;
    }

    .kbd-group[data-separator] > .kbd + .kbd::before {
      color: ButtonText;
    }
  }
}

/* ── components/heading-anchor/heading-anchor.css ── */
/* -- Heading Anchor component ------------------------------- */

@layer components {
  .heading-anchor {
    /* the room between the glyph and the heading text */
    --heading-anchor-gap: 0.375rem;
    color: var(--muted-foreground);
    text-decoration: none;
    font-weight: 400;

    /* -- In front (the default): the glyph hangs in front of the heading, in the gutter - the heading's text keeps
       its own start edge - and shows while the heading is hovered, the link is focused or the section is the target */
    display: inline-block;
    inline-size: 1em;
    margin-inline: calc(-1em - var(--heading-anchor-gap)) var(--heading-anchor-gap);
    text-align: center;
    opacity: 0;
    transition: opacity 150ms ease;

    &:focus-visible {
      opacity: 1;
    }

    /* -- Before / after the text: inline, always shown ----------- */
    &[data-placement="before"] {
      display: inline;
      inline-size: auto;
      margin-inline: 0 var(--heading-anchor-gap);
      opacity: 1;
    }

    &[data-placement="after"] {
      display: inline;
      inline-size: auto;
      margin-inline: var(--heading-anchor-gap) 0;
      opacity: 1;
    }

    &[data-size="xs"] {
      font-size: 0.75rem;
    }
    &[data-size="sm"] {
      font-size: 0.875rem;
    }
    &[data-size="md"] {
      font-size: 1rem;
    }
    &[data-size="lg"] {
      font-size: 1.125rem;
    }
    &[data-size="xl"] {
      font-size: 1.25rem;
    }

    &:hover {
      color: var(--primary);
      text-decoration: underline;
    }
  }

  /* the heading it sits in is hovered, or is the target of the address */
  :hover > .heading-anchor,
  :target > .heading-anchor {
    opacity: 1;
  }

  /* no hover on touch screens, and a narrow gutter: the glyph goes back in front of the text, always shown */
  @media (hover: none) {
    .heading-anchor:not([data-placement="before"], [data-placement="after"]) {
      display: inline;
      inline-size: auto;
      margin-inline: 0 var(--heading-anchor-gap);
      opacity: 1;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .heading-anchor {
      transition: none;
    }
  }

  @media (prefers-contrast: more) {
    .heading-anchor {
      color: var(--foreground);
    }
  }

  @media (forced-colors: active) {
    .heading-anchor {
      color: LinkText;
    }
  }
}
