/* ============================================================
   serbian.fyi — "study cards"
   A calm study app: a soft tinted ground, floating rounded cards,
   pastel washes and one confident sans voice. Serbian is the only
   serif on the page, so the language itself stands out.
   Source Serif 4 = specimen voice (every Serbian run),
   Source Sans 3  = apparatus voice (titles, labels, UI, glosses).
   ============================================================ */

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-sans-3-normal-cyrillic.woff2') format('woff2');
  unicode-range: U+0300-0301, U+0304, U+0306, U+0308, U+030F, U+0311, U+0400-045F, U+0490-0491, U+04B0-04B1, U+04C1-04C2, U+04D0-04D3, U+04D6-04D7, U+04DC-04DF, U+04E2-04E7, U+04EC-04F1, U+04F4-04F5, U+04F8-04F9, U+2116;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-sans-3-normal-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-sans-3-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-sans-3-italic-cyrillic.woff2') format('woff2');
  unicode-range: U+0300-0301, U+0304, U+0306, U+0308, U+030F, U+0311, U+0400-045F, U+0490-0491, U+04B0-04B1, U+04C1-04C2, U+04D0-04D3, U+04D6-04D7, U+04DC-04DF, U+04E2-04E7, U+04EC-04F1, U+04F4-04F5, U+04F8-04F9, U+2116;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-sans-3-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-sans-3-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-serif-4-sr-normal-cyrillic.woff2') format('woff2');
  unicode-range: U+0300-0301, U+0304, U+0306, U+0308, U+030F, U+0311, U+0400-045F, U+0490-0491, U+04B0-04B1, U+04C1-04C2, U+04D0-04D3, U+04D6-04D7, U+04DC-04DF, U+04E2-04E7, U+04EC-04F1, U+04F4-04F5, U+04F8-04F9, U+2116;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-serif-4-sr-normal-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-serif-4-sr-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-serif-4-sr-italic-cyrillic.woff2') format('woff2');
  unicode-range: U+0300-0301, U+0304, U+0306, U+0308, U+030F, U+0311, U+0400-045F, U+0490-0491, U+04B0-04B1, U+04C1-04C2, U+04D0-04D3, U+04D6-04D7, U+04DC-04DF, U+04E2-04E7, U+04EC-04F1, U+04F4-04F5, U+04F8-04F9, U+2116;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-serif-4-sr-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-serif-4-sr-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* -----------------------------------------------------------
   Tokens
   ----------------------------------------------------------- */

:root {
  color-scheme:   light dark;

  /* Grounds. The page is a cool lavender-grey; cards float on it in white.
     Dark mode keeps the same three steps, lifted by hairlines, not shadow. */
  --ground:         light-dark(#F2F1F6, #0F1014);
  --card:           light-dark(#FFFFFF, #1A1B21);
  --inner:          light-dark(#F7F6FA, #23242B);
  --inner-deep:     light-dark(#EEEDF3, #2B2C34);
  --ink:            light-dark(#1C1B22, #EEEDF3);
  --ink-soft:       light-dark(#3D3B47, #C9C7D3);
  --ink-muted:      light-dark(#62606E, #9E9CAA);
  /* The faintest text tier still clears 4.5:1 on --inner (4.78 / 4.68). */
  --ink-faint:      light-dark(#6E6C78, #8E8C99);
  --hairline:       light-dark(#E6E4EC, #2C2D35);
  --hairline-strong: light-dark(#D5D3DD, #3A3B45);

  /* Brand coral: the wordmark, focus rings, the greeting, cover glows.
     Decorative and large-text only — tone text uses --tone-orange. */
  --accent:         light-dark(#D9541E, #F08A5D);
  --on-accent:      light-dark(#FFFFFF, #1A1B21);
  --scrim:          light-dark(rgb(28 27 34 / .22), rgb(0 0 0 / .5));
  --cover-glow:     light-dark(rgb(217 84 30 / .13), rgb(240 138 93 / .08));

  /* Elevation. Light: a soft two-layer shadow. Dark: a 1px hairline ring,
     no shadow. One declaration serves both through light-dark(). */
  --ring:           light-dark(transparent, #2C2D35);
  --sh-near:        light-dark(rgb(0 0 0 / .04), transparent);
  --sh-far:         light-dark(rgb(0 0 0 / .05), transparent);
  --sh-float:       light-dark(rgb(24 22 40 / .16), rgb(0 0 0 / .55));
  --shadow-card:    0 0 0 1px var(--ring), 0 1px 2px var(--sh-near), 0 6px 20px var(--sh-far);
  --shadow-float:   0 0 0 1px var(--ring), 0 2px 6px var(--sh-near), 0 18px 44px var(--sh-float);

  /* Case hues. Each clears 4.6:1 as text on --card and --inner, and as a
     fill under --card knockout letters, in both themes. */
  --tone-red:       light-dark(#D22C42, #E46469);
  --tone-orange:    light-dark(#BD4B00, #D8722F);
  --tone-yellow:    light-dark(#8E6906, #AF8809);
  --tone-green:     light-dark(#1C8038, #429F55);
  --tone-cyan:      light-dark(#057B85, #139CA8);
  --tone-blue:      light-dark(#3169D8, #5E8EDD);
  --tone-purple:    light-dark(#8A53CB, #A27BD8);
  --tone-magenta:   light-dark(#BE3C85, #D669A1); /* unassigned — reserve for a future cross-chart axis */

  /* Gender facets use C .050; case accents use C .090-.200.
     Keep these chroma bands separate. When changing hue, re-solve L for
     4.6:1 against --card and --inner in both themes. */
  --facet-m:        light-dark(#597760, #74947C); /* L .539/.635  C .050  h 152 */
  --facet-n:        light-dark(#6D6D8D, #8A8AAC); /* L .547/.646  C .050  h 285 */
  --facet-f:        light-dark(#886955, #A68671); /* L .546/.645  C .050  h  55 */

  /* Decorative washes for the home tiles only — the one page with no case
     hue on it. Pastel grounds carry ink text; the -ink shade is for the
     large decorative glyph. */
  --wash-peach:     light-dark(#FEEADD, #392516);
  --wash-peach-ink: light-dark(#964D09, #F4BD99);
  --wash-coral:     light-dark(#FEE9E5, #3C231D);
  --wash-coral-ink: light-dark(#9C4535, #FAB8AA);
  --wash-butter:    light-dark(#F8EED1, #312911);
  --wash-butter-ink: light-dark(#786101, #DDCA8E);
  --wash-mint:      light-dark(#D9F7E5, #173023);
  --wash-mint-ink:  light-dark(#04764C, #9DDBB9);
  --wash-sky:       light-dark(#E0F1FF, #162D3C);
  --wash-sky-ink:   light-dark(#026A9D, #9BD2FA);
  --wash-lilac:     light-dark(#EFEBFF, #2B263C);
  --wash-lilac-ink: light-dark(#6953A0, #CEC1FA);
  --wash-rose:      light-dark(#FEE8EF, #3A222B);
  --wash-rose-ink:  light-dark(#964267, #F6B5CD);
  --wash-aqua:      light-dark(#D1F7F7, #0D3030);
  --wash-aqua-ink:  light-dark(#067272, #8ADBDB);
  --wash-sand:      light-dark(#FFEBD2, #362712);
  --wash-sand-ink:  light-dark(#855904, #EAC490);

  /* Two voices: serif carries the language, sans carries the apparatus. */
  --ff-display:   'Source Serif 4', Georgia, serif;
  --ff-body:      'Source Sans 3', system-ui, sans-serif;

  /* Fixed rem per role. All viewport fluidity lives in ONE place — the root
     font-size clamp on `html`. Tokens must never carry their own vw terms. */
  --fs-label:     .6875rem;
  --fs-caption:   .8125rem;
  --fs-small:     .9375rem;
  --fs-body:      1.0625rem;
  --fs-lead:      1.1875rem;
  --fs-title:     1.375rem;
  --fs-serif-title: 1.75rem;
  --fs-head:      2.25rem;

  --track-label:   .06em;
  --track-display: -.02em;

  --lh-tight: 1.15;
  --lh-snug:  1.3;
  --lh-prose: 1.5;

  /* Canonical column: one layout per chart. The column (body) caps at
     --max-w and grows physically with the root scale — desktop gets the
     same column, larger, never a different layout. */
  --pad-x:        var(--sp-16);
  --max-w:        28rem;

  /* Spacing scale: a 4px base, named by its pixel value at 1rem = 16px. */
  --sp-2:   .125rem;
  --sp-4:   .25rem;
  --sp-6:   .375rem;
  --sp-8:   .5rem;
  --sp-10:  .625rem;
  --sp-12:  .75rem;
  --sp-14:  .875rem;
  --sp-16:  1rem;
  --sp-20:  1.25rem;
  --sp-24:  1.5rem;
  --sp-32:  2rem;
  --sp-48:  3rem;
  --sp-64:  4rem;
  /* The one gap between cards. */
  --gap:    var(--sp-12);

  /* Three corners: 20px on cards, 14px on the surfaces inside them, a pill
     on chips and toggles. Ending units take a smaller 10px so the knockout
     letter still reads as a tab. Dots stay 50%. */
  --rad-card:   20px;
  --rad-inner:  14px;
  --rad-unit:   10px;
  --rad-pill:   999px;

  /* Motion: short, eased out, never longer than 200ms. */
  --ease:       cubic-bezier(.2, .8, .2, 1);
  --t-fast:     .1s;
  --t-med:      .18s;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* -----------------------------------------------------------
   Reset & base
   ----------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* The ground, with one faint coral glow at the top of the page. */
  background:
    radial-gradient(40rem 22rem at 50% -8rem, color-mix(in oklab, var(--accent) 9%, transparent), transparent 70%) no-repeat,
    var(--ground);
  /* The single viewport-responsive rule on the site. Phones stay at the
     user's default (1rem); wider viewports scale the whole column up —
     type, spacing and width together — capped at 1.35rem. */
  font-size: clamp(1rem, .9rem + .33vw, 1.35rem);
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0 auto;
  max-width: var(--max-w);
  min-height: 100svh;
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  line-height: var(--lh-prose);
  color: var(--ink);
  background: transparent;
  font-feature-settings: "kern", "liga";
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* Long unbreakable tokens wrap instead of forcing a horizontal scroll. */
  overflow-wrap: break-word;
}

/* Serbian italic alternates (п → ū-form, т → ш̄-form) come from the fonts'
   SRB locl feature. Scope the override to Serbian carriers: every Serbian run
   is either a `lang="sr"` element or a dual-emit wrapper (`.s`, whose
   display:contents children inherit it). Nothing else may opt in: a Russian
   gloss or note title inheriting "SRB" renders with Serbian letterforms. */
[lang="sr"],
.s {
  font-language-override: "SRB";
}

::selection { background: color-mix(in oklab, var(--accent) 28%, transparent); color: var(--ink); }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, currentColor 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4, h5 {
  font-family: var(--ff-body);
  font-weight: 700;
  letter-spacing: var(--track-display);
  line-height: var(--lh-tight);
  margin: 0;
  color: var(--ink);
}

p { margin: 0 0 1em; }

/* <i> marks inline Serbian tokens in foreign-language prose so the script
   converter can find them. It's a structural marker, not visual emphasis —
   but the token itself is a specimen, so it renders in the serif voice. */
i { font-style: inherit; font-family: var(--ff-display); }

/* Alphabet switch. Latin is the default; data-script="cyr" selects Cyrillic.
   display:none removes the hidden variant from copying and assistive technology.
   Use .s for inline wrappers; .sr carries block-level specimen styles. */
.s { display: contents; }
[data-s="cyr"] { display: none; }
[data-script="cyr"] [data-s="lat"] { display: none; }
[data-script="cyr"] [data-s="cyr"] { display: inline; }

/* Serbian specimens and their glosses sit in rigid grid/flex example tracks.
   `anywhere` lets an over-long unbreakable token break AND collapse its
   min-content contribution, so the track shrinks to fit at 320px. */
.sr,
.tr,
.chart-form {
  overflow-wrap: anywhere;
}

:root:not([lang="ru"]) [data-lang-only="ru"] {
  display: none;
}

/* -----------------------------------------------------------
   Layout primitives
   ----------------------------------------------------------- */

/* The column (body) owns the width; shells only pad. */
.shell {
  width: 100%;
  margin: 0 auto;
  padding-inline: var(--pad-x);
}

section { position: relative; }

/* One focus ring everywhere: coral, offset, following the element's corners. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Tappables answer the finger immediately: a quick press-in. */
.tile,
.dock-btn,
.seg-btn,
.settings-btn,
.cover-chips a,
.menu-list a,
.tip-chip,
.prep-trigger,
.tip-pop-close {
  transition: transform var(--t-fast) ease-out, background-color var(--t-med) ease-out, color var(--t-med) ease-out, box-shadow var(--t-med) ease-out;
}
.tile:active,
.dock-btn:active,
.seg-btn:active,
.settings-btn:active,
.cover-chips a:active,
.menu-list a:active,
.tip-chip:active,
.prep-trigger:active,
.tip-pop-close:active {
  transform: scale(.97);
}

/* -----------------------------------------------------------
   Masthead
   ----------------------------------------------------------- */

.nav {
  position: sticky; top: 0; z-index: 1100;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in oklab, var(--ground) 78%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  view-transition-name: masthead;
}
/* Without backdrop blur the bar must stay solid, or text shows through. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav { background: var(--ground); }
}
/* A hairline fades in once content scrolls beneath; its ends fade too, so
   on a wide screen it never reads as a hard edge of the column. */
.nav::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--hairline-strong) 12%, var(--hairline-strong) 88%, transparent);
  opacity: 0;
  transition: opacity var(--t-med) ease-out;
  pointer-events: none;
}
.nav.is-scrolled::after { opacity: 1; }

.nav-inner {
  /* Wrap is the no-media-query fallback at enlarged text on a 320px column. */
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8);
  min-height: 3.75rem;
  padding-block: var(--sp-8);
  position: relative;
}
.nav-actions {
  display: inline-flex; align-items: center; gap: var(--sp-8);
  margin-left: auto;
}
.brand {
  display: inline-flex; align-items: center;
  min-height: 44px;
  font-family: var(--ff-body);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -.025em;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--sp-8);
}
.brand-tld { color: var(--accent); }

.settings-btn {
  /* 44px tap target. */
  width: 2.75rem; height: 2.75rem;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  background: var(--card);
  color: var(--ink-soft);
  box-shadow: var(--shadow-card);
}
.settings-btn svg { width: 1.25rem; height: 1.25rem; }
.settings-btn svg circle { fill: var(--card); transition: fill var(--t-med) ease-out; }
.settings-btn[aria-expanded="true"] { background: var(--ink); color: var(--card); }
.settings-btn[aria-expanded="true"] svg circle { fill: var(--ink); }

/* ── Settings panel ────────────────────────────────────────────────────
   One masthead button drops a small card with the theme and the language.
   Non-modal; it scales in from its corner (reduced motion resets it). */
.settings-menu {
  position: absolute;
  right: var(--pad-x);
  top: calc(100% + var(--sp-4));
  /* Never wider than the column minus both gutters. */
  width: min(19rem, calc(100% - 2 * var(--pad-x)));
  z-index: 2;
  opacity: 0;
  transform: scale(.96) translateY(-4px);
  transform-origin: top right;
  transition: opacity var(--t-med) ease-out, transform var(--t-med) var(--ease);
  pointer-events: none;
}
.settings-menu.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.settings-menu-card {
  width: 100%;
  background: var(--card);
  border-radius: var(--rad-card);
  box-shadow: var(--shadow-float);
  padding: var(--sp-8) var(--sp-16);
}
.settings-row {
  display: grid;
  gap: var(--sp-8);
  padding: var(--sp-12) 0;
}
.settings-row + .settings-row { border-top: 1px solid var(--hairline); }
.settings-label,
.sheet-title,
.card-section-label,
.chart-label,
.tile-badge {
  font-family: var(--ff-body);
  font-size: var(--fs-label);
  font-weight: 650;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--ink-muted);
}

/* ── Segmented controls ────────────────────────────────────────────────
   A recessed track with equal segments; the chosen one is an ink pill with
   light letters (a light pill with dark letters in dark mode). The theme and
   language segments take the pill themselves; the script switch slides one. */
.seg {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  padding: 3px;
  border-radius: var(--rad-pill);
  background: var(--inner-deep);
  isolation: isolate;
}
.seg-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.375rem;
  padding: 0 var(--sp-12);
  border-radius: var(--rad-pill);
  font-family: var(--ff-body);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}
/* The seg's 3px track pads a 38px pill into a 44px tap row. */
.seg-btn::after {
  content: "";
  position: absolute;
  inset: -3px -1px;
}
.seg-btn[aria-pressed="true"],
.seg-btn[aria-current="true"] {
  background: var(--ink);
  color: var(--card);
  box-shadow: 0 1px 3px var(--sh-far);
}
.seg-btn:focus-visible { outline-offset: 0; }

/* The script switch: the pill is one layer that slides between Lat and Ћир. */
.script-seg .seg-btn[aria-pressed] { background: transparent; box-shadow: none; }
.script-seg::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 3px; bottom: 3px; left: 3px;
  width: calc(50% - 3px);
  border-radius: var(--rad-pill);
  background: var(--ink);
  box-shadow: 0 1px 3px var(--sh-far);
  transition: transform var(--t-med) var(--ease);
}
[data-script="cyr"] .script-seg::before { transform: translateX(100%); }
.script-seg .seg-btn { color: var(--ink-soft); }
:root:not([data-script="cyr"]) .script-seg [data-script-chip="lat"],
[data-script="cyr"] .script-seg [data-script-chip="cyr"] { color: var(--card); }

/* -----------------------------------------------------------
   The dock — quick navigation at the foot of the column

   A frosted pill: Charts raises the chart switcher, Sections the page's
   own sections, and the script switch flips every Serbian run in one tap.
   The dock box spans the column but only its children take pointer events,
   so the page beside the pill stays tappable.
   ----------------------------------------------------------- */
.dock {
  --dock-gap: var(--sp-12);
  --dock-bottom: max(var(--sp-12), env(safe-area-inset-bottom));
  position: fixed;
  z-index: 1200;
  left: 0; right: 0;
  bottom: var(--dock-bottom);
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: max(var(--sp-12), env(safe-area-inset-left)) max(var(--sp-12), env(safe-area-inset-right));
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
/* The scrim behind an open sheet. It is the dock's own ::before, so a tap on
   it reaches the dock, which closes the sheet. */
.dock::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-med) ease-out;
}
.dock.has-open::before { opacity: 1; pointer-events: auto; }

.dock-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
  padding: var(--sp-4);
  border-radius: var(--rad-pill);
  background: color-mix(in oklab, var(--card) 76%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: var(--shadow-float), inset 0 0 0 1px color-mix(in oklab, var(--card) 60%, transparent);
  view-transition-name: dock;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .dock-bar { background: var(--card); }
}
.dock-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 3.75rem;
  min-height: 2.875rem;
  padding: var(--sp-4) var(--sp-12);
  border-radius: var(--rad-pill);
  color: var(--ink-soft);
  font-family: var(--ff-body);
  font-size: var(--fs-label);
  font-weight: 650;
  letter-spacing: .01em;
  line-height: 1.1;
}
.dock-btn svg { width: 1.375rem; height: 1.375rem; }
.dock-btn[aria-expanded="true"] { background: var(--ink); color: var(--card); }
.dock-bar .seg {
  min-width: 7.25rem;
  margin-left: var(--sp-4);
}
.dock.is-home .dock-bar .seg { margin-left: 0; }
.dock-bar .seg-btn {
  min-height: 2.5rem;
  font-size: var(--fs-small);
  font-weight: 650;
}

/* ── Sheets ───────────────────────────────────────────────────────────
   Rounded panels that rise from the dock. The list scrolls; the sheet is
   capped between the masthead and the pill. */
.sheet {
  position: absolute;
  left: max(var(--sp-12), env(safe-area-inset-left));
  right: max(var(--sp-12), env(safe-area-inset-right));
  bottom: calc(100% + var(--sp-10));
  opacity: 0;
  transform: translateY(1.25rem) scale(.98);
  transform-origin: 50% 100%;
  transition: opacity var(--t-med) ease-out, transform var(--t-med) var(--ease);
}
.sheet.is-open { opacity: 1; transform: none; }
.sheet-card {
  display: flex;
  flex-direction: column;
  /* Between the sticky masthead and the dock: the pill is ~3.5rem tall. */
  max-height: calc(100vh - var(--dock-bottom) - 5rem - var(--sticky-offset, 4rem));
  max-height: calc(100dvh - var(--dock-bottom) - 5rem - var(--sticky-offset, 4rem));
  overflow: hidden;
  background: var(--card);
  border-radius: var(--rad-card);
  box-shadow: var(--shadow-float);
}
.sheet-title {
  position: relative;
  margin: 0;
  padding: var(--sp-24) var(--sp-20) var(--sp-8);
}
/* The grabber: the sheet's native-app tell. */
.sheet-title::before {
  content: "";
  position: absolute;
  top: var(--sp-8); left: 50%;
  width: 2.25rem; height: 5px;
  margin-left: -1.125rem;
  border-radius: var(--rad-pill);
  background: var(--hairline-strong);
}
.menu-list {
  position: relative;
  list-style: none; margin: 0;
  padding: 0 var(--sp-6) var(--sp-6);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.menu-list a {
  display: flex; align-items: center; gap: var(--sp-12);
  width: 100%;
  min-height: 3rem;
  padding: var(--sp-8) var(--sp-14);
  border-radius: var(--rad-inner);
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  font-weight: 500;
  line-height: var(--lh-snug);
  color: var(--ink-soft);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.menu-list a:focus-visible { outline-offset: -2px; }
.menu-list a > span:not(.menu-glyph) { flex: 1; min-width: 0; }
.menu-check { width: 1.25rem; height: 1.25rem; flex: none; color: var(--ink); }

/* Chart switcher rows: each chart's glyph on a small neutral squircle. */
.menu-glyph {
  flex: none;
  display: grid; place-items: center;
  width: 2.25rem; height: 2.25rem;
  border-radius: 10px;
  background: var(--inner-deep);
  color: var(--ink-soft);
  font-family: var(--ff-display);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.01em;
}
.menu-glyph .glyph-pair { display: flex; gap: 1px; font-size: .8125rem; }
.menu-glyph .glyph-pair > :last-child { display: none; }
.chart-menu-list a[aria-current="page"] {
  background: var(--inner);
  color: var(--ink);
  font-weight: 650;
}
.chart-menu-list a[aria-current="page"] .menu-glyph { background: var(--ink); color: var(--card); }

/* Section rows: the tone dot leads; the current section is filled and
   checked. Shared by the sheet list and the cover chips. */
.case-strip-cell a::before {
  content: "";
  width: .625rem;
  height: .625rem;
  flex: none;
  border-radius: 50%;
  background: var(--tone, var(--ink-muted));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--tone, var(--ink-muted)) 16%, transparent);
}
.section-menu-list .case-strip-cell.is-current a {
  background: var(--inner);
  color: var(--ink);
  font-weight: 650;
}
.section-menu-list .case-strip-cell.is-current a::after {
  content: "";
  width: .4rem;
  height: .75rem;
  margin-right: .25rem;
  flex: none;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
}

/* Let the last content clear the dock when scrolled to the end. */
body { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }

/* -----------------------------------------------------------
   Home — a greeting card, then the charts as tiles
   ----------------------------------------------------------- */

.home {
  display: grid;
  gap: var(--gap);
  padding-block: var(--sp-4) var(--sp-24);
}

.hero {
  position: relative;
  padding: var(--sp-24) var(--sp-20) var(--sp-24);
  border-radius: var(--rad-card);
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in oklab, var(--wash-lilac) 90%, transparent), transparent 62%),
    radial-gradient(110% 100% at 0% 100%, color-mix(in oklab, var(--wash-peach) 95%, transparent), transparent 60%),
    var(--card);
  box-shadow: var(--shadow-card);
}
.hello {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-8) var(--sp-12);
  margin: 0 0 var(--sp-20);
}
/* A speech bubble: the greeting is the page's first specimen. */
.hello-bubble {
  position: relative;
  display: inline-block;
  padding: var(--sp-8) var(--sp-16) var(--sp-10);
  border-radius: 18px 18px 18px 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--ff-display);
  font-size: 1.625rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.01em;
  box-shadow: 0 6px 16px color-mix(in oklab, var(--accent) 28%, transparent);
}
.hello-gloss {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--ink-muted);
}
.hello-gloss::before { content: "— "; }
.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1;
}
.hero-tagline {
  margin: var(--sp-10) 0 0;
  max-width: 24ch;
  font-size: var(--fs-lead);
  line-height: var(--lh-snug);
  color: var(--ink-soft);
  text-wrap: balance;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  list-style: none;
  margin: 0;
  padding: 0;
}
.chart-grid li { display: grid; min-width: 0; }
/* The alphabet leads, wide; a chart left alone on the last row widens too. */
.chart-grid li.is-start,
.chart-grid li:nth-child(even):last-child { grid-column: 1 / -1; }

.tile {
  --w: var(--wash-sand);
  --w-ink: var(--wash-sand-ink);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--sp-16);
  min-height: 10.5rem;
  padding: var(--sp-16) var(--sp-16) var(--sp-16);
  border-radius: var(--rad-card);
  background: var(--w);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-card);
}
.tile[data-wash="peach"]  { --w: var(--wash-peach);  --w-ink: var(--wash-peach-ink); }
.tile[data-wash="coral"]  { --w: var(--wash-coral);  --w-ink: var(--wash-coral-ink); }
.tile[data-wash="butter"] { --w: var(--wash-butter); --w-ink: var(--wash-butter-ink); }
.tile[data-wash="mint"]   { --w: var(--wash-mint);   --w-ink: var(--wash-mint-ink); }
.tile[data-wash="sky"]    { --w: var(--wash-sky);    --w-ink: var(--wash-sky-ink); }
.tile[data-wash="lilac"]  { --w: var(--wash-lilac);  --w-ink: var(--wash-lilac-ink); }
.tile[data-wash="rose"]   { --w: var(--wash-rose);   --w-ink: var(--wash-rose-ink); }
.tile[data-wash="aqua"]   { --w: var(--wash-aqua);   --w-ink: var(--wash-aqua-ink); }
.tile[data-wash="sand"]   { --w: var(--wash-sand);   --w-ink: var(--wash-sand-ink); }

.tile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-8);
}
.tile-glyph {
  font-family: var(--ff-display);
  font-size: 2.5rem;
  font-weight: 500;
  line-height: .9;
  letter-spacing: -.02em;
  color: var(--w-ink);
  white-space: nowrap;
}
.glyph-pair { display: inline-flex; gap: .3em; }
.glyph-pair > :last-child { opacity: .6; }
.tile-arrow {
  flex: none;
  width: 2rem; height: 2rem;
  padding: .4375rem;
  border-radius: 50%;
  background: color-mix(in oklab, var(--card) 70%, transparent);
  color: var(--w-ink);
}
.tile-badge {
  flex: none;
  padding: var(--sp-6) var(--sp-10);
  border-radius: var(--rad-pill);
  background: var(--ink);
  color: var(--card);
}
.tile-text { display: grid; gap: var(--sp-4); }
.tile-title {
  font-size: var(--fs-body);
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: var(--lh-snug);
}
/* A teaser, not the whole story: the full lede opens the chart's cover, so
   the tile keeps three lines at most. */
.tile-lede {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  font-size: var(--fs-caption);
  line-height: 1.35;
  color: var(--ink-soft);
  text-wrap: pretty;
}
/* A lone chart on the last row widens but keeps its natural height. */
.chart-grid li:nth-child(even):last-child .tile { min-height: 0; }
.is-start .tile { min-height: 0; gap: var(--sp-20); padding: var(--sp-20); }
.is-start .tile-glyph { font-size: 3rem; }
.is-start .tile-title { font-size: var(--fs-title); }
.is-start .tile-lede { font-size: var(--fs-small); max-width: 30ch; }

/* -----------------------------------------------------------
   Footer
   ----------------------------------------------------------- */

/* Keyboard-only route past the masthead. Off-canvas until focused. */
.skip-link {
  position: absolute;
  left: var(--sp-12); top: -4rem;
  z-index: 1300;
  padding: var(--sp-12) var(--sp-16);
  border-radius: var(--rad-pill);
  background: var(--ink);
  color: var(--card);
  font-family: var(--ff-body);
  font-size: var(--fs-small);
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  transition: top var(--t-med) var(--ease);
}
.skip-link:focus-visible { top: calc(env(safe-area-inset-top) + var(--sp-12)); }

/* With JS off the popovers and the script toggle are inert; everything else
   is already in the served bytes. One line, then out of the way. */
.noscript-note {
  margin: 0 var(--pad-x) var(--gap);
  padding: var(--sp-12) var(--sp-16);
  border-radius: var(--rad-inner);
  background: var(--inner-deep);
  font-size: var(--fs-caption);
  line-height: var(--lh-prose);
  color: var(--ink-soft);
}
.home .noscript-note { margin-inline: 0; }

.foot {
  padding-block: var(--sp-16) var(--sp-16);
  font-family: var(--ff-body);
  font-size: var(--fs-caption);
  color: var(--ink-muted);
}
.foot-meta {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-4);
  text-align: center;
  line-height: var(--lh-snug);
  text-wrap: balance;
}
.foot a { text-decoration-color: color-mix(in oklab, currentColor 40%, transparent); }

@media (hover: hover) and (pointer: fine) {
  .tile:hover { box-shadow: var(--shadow-float); }
  .settings-btn:not([aria-expanded="true"]):hover { color: var(--ink); }
  .dock-btn:not([aria-expanded="true"]):hover { background: color-mix(in oklab, var(--ink) 6%, transparent); color: var(--ink); }
  .seg-btn:not([aria-pressed="true"]):not([aria-current="true"]):hover { color: var(--ink); }
  .menu-list a:hover { background: var(--inner); color: var(--ink); }
  .cover-chips a:hover { color: var(--ink); background: var(--card); }
  .foot a:hover { color: var(--ink); }
  .tip-chip:hover { color: var(--ink); background: var(--inner-deep); }
  .tip-pop-close:hover { color: var(--ink); background: var(--inner-deep); }
}

/* -----------------------------------------------------------
   Chart pages — shared

   One vocabulary for every chart page:

   .cover                            the page's hero card
   .card / .card-head / .card-section  the universal chart card
   .chart-label                      small-caps apparatus label
   .chart-form                       Serbian specimen voice (data cell)
   .chart-table / .chart-row         stacked table: one fact per line
   .chart-example                    Serbian sentence over its gloss
   .chart-sep                        connector glyph in a specimen run
   .chart-pop / .chart-tip           `?` popover card body
   ----------------------------------------------------------- */

.chart-section { padding-block: var(--sp-4) var(--sp-24); }
.chart-layout {
  display: grid;
  align-items: start;
  gap: var(--gap);
}

/* ── The cover ──────────────────────────────────────────────────────── */
.cover {
  position: relative;
  margin-bottom: var(--sp-20);
  padding: var(--sp-20) var(--sp-20) var(--sp-16);
  border-radius: var(--rad-card);
  background:
    radial-gradient(110% 80% at 100% 0%, var(--cover-glow), transparent 62%),
    radial-gradient(90% 90% at 0% 100%, color-mix(in oklab, var(--ink-muted) 7%, transparent), transparent 60%),
    var(--card);
  box-shadow: var(--shadow-card);
}
/* The chart's glyph as its app icon. */
.cover-glyph {
  display: inline-grid; place-items: center;
  min-width: 3.5rem; height: 3.5rem;
  padding-inline: var(--sp-8);
  margin-bottom: var(--sp-16);
  border-radius: 16px;
  background: linear-gradient(145deg, color-mix(in oklab, var(--accent) 18%, var(--card)), color-mix(in oklab, var(--accent) 30%, var(--card)));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 22%, transparent);
  color: color-mix(in oklab, var(--accent) 70%, var(--ink));
  font-family: var(--ff-display);
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.cover-glyph .glyph-pair { gap: .2em; }
.cover-title {
  font-size: var(--fs-head);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.02;
  text-wrap: balance;
}
.cover-lede {
  margin: var(--sp-10) 0 0;
  font-size: var(--fs-body);
  line-height: var(--lh-snug);
  color: var(--ink-soft);
  text-wrap: pretty;
}
/* The sections as a row of chips — it bleeds to the cover's edges and
   scrolls sideways under faded ends. */
.cover-nav { margin: var(--sp-16) calc(-1 * var(--sp-20)) 0; }
.cover-chips {
  display: flex;
  gap: var(--sp-8);
  list-style: none;
  margin: 0;
  padding: var(--sp-4) var(--sp-20) var(--sp-4);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--sp-20);
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--sp-16), #000 calc(100% - var(--sp-24)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--sp-16), #000 calc(100% - var(--sp-24)), transparent);
}
.cover-chips::-webkit-scrollbar { display: none; }
.cover-chips li { flex: none; scroll-snap-align: start; }
.cover-chips a {
  display: inline-flex; align-items: center; gap: var(--sp-8);
  min-height: 2.75rem;
  padding: 0 var(--sp-16) 0 var(--sp-14);
  border-radius: var(--rad-pill);
  background: color-mix(in oklab, var(--inner-deep) 80%, transparent);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}
.cover-chips a:focus-visible { outline-offset: -2px; }

/* ── The card ──────────────────────────────────────────────────────────
   One per chart block: a head washed in the card's tone (ink-soft when the
   block has no grammatical hue), then sections parted by hairlines. Text on
   the wash stays ink; the hue itself is carried by the solid chip. */
.card-list {
  display: grid;
  gap: var(--gap);
}
.card {
  --wash: light-dark(
    color-mix(in oklab, var(--tone, var(--ink-soft)) 9%, var(--card)),
    color-mix(in oklab, var(--tone, var(--ink-soft)) 15%, var(--card)));
  scroll-margin-top: calc(var(--sticky-offset, 4rem) + var(--sp-12));
  position: relative;
  display: grid;
  background: var(--card);
  border-radius: var(--rad-card);
  box-shadow: var(--shadow-card);
}
.card > * { min-width: 0; }
/* A section a formula links to lands below the sticky masthead, like a card. */
.card-section[id] { scroll-margin-top: calc(var(--sticky-offset, 4rem) + var(--sp-12)); }

.card-head {
  padding: var(--sp-16) var(--sp-20);
  border-radius: var(--rad-card) var(--rad-card) 0 0;
  background: var(--wash);
}
.card-head:last-child { border-radius: var(--rad-card); }
/* The title leads; a chip or ? rides at its top-right. */
.card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-8) var(--sp-12);
}
.card-title h3 {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-title);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -.015em;
  color: var(--ink);
}
/* A Serbian title is a specimen: serif, a size up so both voices weigh the same. */
.card-title h3 > [lang="sr"] {
  font-family: var(--ff-display);
  font-size: var(--fs-serif-title);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.05;
}
/* The i18n gloss under a Serbian title is apparatus: small sans. */
.card-title h3 em {
  display: block;
  margin-top: var(--sp-4);
  font-family: var(--ff-body);
  font-style: normal;
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-muted);
}
.card-title .case-tag,
.card-title .tip-chip { flex: 0 0 auto; margin-top: var(--sp-4); }
/* On the washed head a ? sits on a card-white disc. */
.card-head .tip-chip:not([aria-expanded="true"]) { background: var(--card); }

/* The question line pairs a Serbian specimen with its gloss. */
.card-q {
  margin: var(--sp-10) 0 0;
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
  color: var(--ink-soft);
}
.card-q strong {
  font-family: var(--ff-display);
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--ink);
}

.card-section {
  padding: var(--sp-14) var(--sp-20) var(--sp-16);
  border-top: 1px solid var(--hairline);
}
.card-head + .card-section { border-top: 0; }
.card-section-label {
  display: block;
  margin: 0 0 var(--sp-10);
}

/* Solid tone fills with card-coloured letters inherit the tone's >=4.6:1
   contrast. Tone text on a tint does not meet that threshold across cases.
   Shared by case headings, prepositions and noun-count bands. */
.case-tag {
  display: inline-block;
  font-family: var(--ff-body);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--card);
  background: var(--tone, var(--ink-soft));
  border-radius: var(--rad-pill);
  padding: .3125rem var(--sp-10) .25rem;
  line-height: 1;
}
/* Ending units keep gender, form and source attached when wrapping.
   Stretch fields vertically; the parent run equalizes unit heights.
   Gender letters use solid facet fills for 4.6:1 contrast on both grounds.
   A 16% facet tint fails the 4.5:1 target. Always print letters because M/F hues
   converge under deuteranopia. Scope facet rules to .eu-gender: other elements
   also carry data-gender. */
.ending-unit {
  display: inline-flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--rad-unit);
  background: var(--card);
}
.ending-unit > * { display: inline-flex; align-items: center; line-height: 1; }
/* Round end fields without clipping the unit: note hit areas and focus rings
   extend outside it. */
.ending-unit > :first-child {
  border-start-start-radius: calc(var(--rad-unit) - 1px);
  border-end-start-radius: calc(var(--rad-unit) - 1px);
}
.ending-unit > :last-child {
  border-start-end-radius: calc(var(--rad-unit) - 1px);
  border-end-end-radius: calc(var(--rad-unit) - 1px);
}
/* Only form fields may shrink; gender letters must remain visible. */
.eu-gender, .eu-source { flex: 0 0 auto; }
.eu-gender {
  justify-content: center;
  min-width: 1.5rem;
  font-family: var(--ff-body);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: var(--sp-4) var(--sp-6);
  color: var(--card);
  background: var(--facet, var(--ink-muted));
}
/* Separate merged gender fields with a border. Forced colors removes
   box-shadow, which would erase the divider. */
.eu-gender + .eu-gender {
  border-left: 1px solid color-mix(in oklab, var(--card) 55%, transparent);
}
/* Keep forms in body ink: gender fields supply gender hue; the section identifies case. */
.eu-form {
  font-family: var(--ff-display);
  font-style: normal;
  font-weight: 400;
  font-size: var(--fs-lead);
  color: var(--ink);
  letter-spacing: -.005em;
  padding: var(--sp-6) var(--sp-10) var(--sp-6) var(--sp-8);
  white-space: nowrap;
  min-width: 0;
}
/* An ending that merely repeats a shape an earlier case introduced recedes to
   ink-faint; the .eu-source field names the case it came from. */
.eu-form.is-echo { color: var(--ink-faint); }
/* Keep provenance neutral: --ink-soft on --inner-deep. Tone text on a tone
   tint fails contrast across cases. */
.eu-source {
  font-family: var(--ff-body);
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  padding: var(--sp-4) var(--sp-8);
  color: var(--ink-soft);
  background: var(--inner-deep);
  border-left: 1px solid var(--hairline);
  white-space: nowrap;
}

/* Units keep their own height: a stacked AKU pair is two units tall, and
   its neighbours must not stretch to match it. */
.gender-run {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--sp-8);
  min-width: 0;
}
/* A run under its own number heading. Number is a band, never a chip. */
.gender-band {
  display: grid;
  gap: var(--sp-8);
}
/* The one caveat a one-letter chip cannot carry: the past M plural is
   M-or-mixed. It rides beside the band instead. */
.gender-band-note {
  margin: 0;
  font-size: var(--fs-caption);
  line-height: var(--lh-snug);
  color: var(--ink-muted);
}

/* Assign --facet only here, per gender field. Merged units contain multiple
   genders; a unit-level attribute cannot supply each field's hue. */
.eu-gender[data-gender="m"] { --facet: var(--facet-m); }
.eu-gender[data-gender="n"] { --facet: var(--facet-n); }
.eu-gender[data-gender="f"] { --facet: var(--facet-f); }

.cell-note { margin-left: var(--sp-6); }
/* The connector in an inline alternation (`-e¹ / -u²`). One statement, one
   form field — never a second flex row inside the unit. */
.cell-sep {
  font-family: var(--ff-display);
  font-style: normal;
  font-weight: 400;
  font-size: var(--fs-lead);
  color: var(--ink-faint);
  line-height: 1;
  margin: 0 .2em;
}
/* Syncretic split (AKU animacy): the two endings reuse DIFFERENT cases, so
   they stack as two whole units, the alive/thing criterion in the ? note. */
.eu-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-6);
  min-width: 0;
}

/* ── Repeated items: examples as rows ──────────────────────────────── */
.card-items {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.card-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-2);
  padding: var(--sp-10) 0;
  border-top: 1px solid var(--hairline);
}
.card-item:first-child { padding-top: 0; border-top: 0; }
.card-item:last-child { padding-bottom: 0; }
.card-item .sr {
  font-family: var(--ff-display);
  font-size: var(--fs-lead);
  font-weight: 400;
  color: var(--ink);
  line-height: var(--lh-snug);
}
/* Example focus word: the case hue on the card's own white, never a box —
   the hue alone lifts it from the sentence. */
.card-item .sr mark {
  background: transparent;
  color: var(--tone, var(--ink-soft));
  font-weight: 600;
}
.card-item .tr {
  font-family: var(--ff-body);
  font-weight: 400;
  color: var(--ink-muted);
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
}
.card-item .tr em {
  font-style: normal;
  font-size: var(--fs-label);
  color: var(--ink-faint);
  letter-spacing: .04em;
  display: inline-block;
  margin-left: .35em;
}
/* Sound-change pair inside a card item: from → to on the specimen line. */
.card-item .arrow,
.chart-sep {
  font-family: var(--ff-body);
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--ink-faint);
  margin-inline: .15em;
}

/* Inline preposition index; meanings open in the shared preposition card.
   The tokens wrap as a run of pills; the commas stay for screen readers. */
.prep-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-6);
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: var(--fs-lead);
  color: var(--tone, var(--ink-soft));
  line-height: 1.25;
  margin: 0;
}
.prep-sep {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}
/* Each preposition is a live token: a soft tinted pill, the hue its text. */
.prep-trigger {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 .6em .1em;
  border-radius: var(--rad-pill);
  background: color-mix(in oklab, var(--tone, var(--accent)) 5%, var(--card));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tone, var(--accent)) 16%, transparent);
  text-decoration: none;
  line-height: 1;
}
/* A 44px-tall catch area around the 36px pill; neighbours' areas meet in
   the gap rather than stacking over each other. */
.prep-trigger { position: relative; }
.prep-trigger::after {
  content: "";
  position: absolute;
  inset: -4px -3px;
}
.prep-trigger[aria-expanded="true"] {
  background: var(--tone, var(--accent));
  color: var(--card);
}

/* Small `?` glyph used by every popover trigger. */
.tip-chip {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.375rem; height: 1.375rem;
  padding: 0;
  background: var(--inner-deep);
  border: 0;
  border-radius: 50%;
  font-family: var(--ff-body);
  font-size: var(--fs-caption);
  font-weight: 700;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  vertical-align: middle;
  text-transform: none;
  letter-spacing: 0;
}
/* Grow the tap target to ≥44px without moving the visible glyph — a
   centered, transparent overlay that catches the pointer. */
.tip-chip::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 44px; height: 44px;
  min-width: 100%; min-height: 100%;
  transform: translate(-50%, -50%);
}
.tip-chip[aria-expanded="true"] {
  color: var(--card);
  background: var(--ink);
}
/* A ? riding a section label sits on the label's line. */
.card-section-label .tip-chip {
  margin-left: var(--sp-8);
  vertical-align: middle;
  margin-top: -2px;
}

/* ── Popovers ────────────────────────────────────────────────────────── */
.tip-pop {
  position: absolute;
  z-index: 1150;
  width: min(21rem, calc(100vw - 24px));
  opacity: 0;
  transform: translateY(4px) scale(.98);
  transform-origin: 50% 0;
  transition: opacity var(--t-med) ease-out, transform var(--t-med) var(--ease);
  pointer-events: none;
}
.tip-pop[data-placement="above"] { transform-origin: 50% 100%; transform: translateY(-4px) scale(.98); }
.tip-pop.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.tip-pop-card {
  position: relative;
  background: var(--card);
  border-radius: var(--rad-card);
  padding: var(--sp-16) var(--sp-48) var(--sp-16) var(--sp-20);
  box-shadow: var(--shadow-float);
}
.tip-pop-body {
  margin: 0;
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  line-height: var(--lh-prose);
  color: var(--ink-soft);
}
.tip-pop-body strong { color: var(--ink); font-weight: 600; }
.tip-pop-body em { color: var(--ink); font-style: normal; font-family: var(--ff-display); font-weight: 500; }
.tip-pop-close {
  position: absolute;
  top: var(--sp-12); right: var(--sp-12);
  width: 1.75rem; height: 1.75rem;
  display: grid; place-items: center;
  background: var(--inner-deep);
  border: 0;
  color: var(--ink-soft);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}
/* Same invisible 44px catch area as .tip-chip; the glyph stays small. */
.tip-pop-close::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 44px; height: 44px;
  transform: translate(-50%, -50%);
}

/* A toned popover (case notes) carries its hue as a grabber at the top. */
.case-pop .tip-pop-card { padding-top: var(--sp-24); }
.case-pop .tip-pop-card::before {
  content: "";
  position: absolute;
  top: var(--sp-10); left: var(--sp-20);
  width: 2rem; height: 4px;
  border-radius: var(--rad-pill);
  background: var(--tone, var(--accent));
}
.case-pop .tip-pop-body,
.chart-tip {
  display: grid;
  gap: var(--sp-10);
}
.chart-tip h4,
.note-title {
  margin: 0;
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  font-weight: 700;
  font-style: normal;
  letter-spacing: -.01em;
  line-height: var(--lh-snug);
  color: var(--ink);
}
.chart-tip p,
.note-body {
  margin: 0;
  font-size: var(--fs-small);
  line-height: var(--lh-prose);
  color: var(--ink-soft);
  max-width: 56ch;
}
.note-pairs {
  list-style: none; padding: 0;
  margin: var(--sp-4) 0 0;
  display: flex; flex-wrap: wrap;
  gap: var(--sp-6) var(--sp-8);
}
.note-pairs li {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-6);
  padding: var(--sp-4) var(--sp-10);
  border-radius: var(--rad-pill);
  background: var(--inner);
  font-family: var(--ff-display);
  font-size: var(--fs-body);
  line-height: var(--lh-snug);
}
.note-pairs .from { color: var(--ink-soft); }
.note-pairs .arrow {
  font-family: var(--ff-body);
  font-size: var(--fs-caption);
  color: var(--ink-faint);
}
.note-pairs .to { color: var(--ink); }
/* The changed letters: ink on a tinted highlight with a hue underline —
   the tint alone would drag tone text below 4.5:1. */
.note-pairs .lit,
.card-item .lit {
  color: var(--ink);
  font-weight: 600;
  background: color-mix(in oklab, var(--tone, var(--ink-soft)) 16%, transparent);
  box-shadow: inset 0 -2px color-mix(in oklab, var(--tone, var(--ink-soft)) 70%, transparent);
  padding: 0 .1em;
  border-radius: 3px;
}
/* Untoned (the sound-change cards): a quiet neutral highlight, no underline. */
.card:not([data-tone]) .card-item .lit {
  background: var(--inner-deep);
  box-shadow: none;
}

/* -----------------------------------------------------------
   Alphabet — letter tiles, two to a row
   ----------------------------------------------------------- */

.alph-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}

/* A tile: the glyph pair, the IPA with its ?, then the example word in both
   scripts over its gloss. The head and IPA wrappers dissolve into the
   tile's own grid so every tile aligns. */
.letter {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "glyphs glyphs"
    "ipa    tip"
    "ex     ex";
  align-content: start;
  row-gap: var(--sp-6);
  min-width: 0;
  padding: var(--sp-14) var(--sp-14) var(--sp-12);
  border-radius: var(--rad-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}
.letter .head,
.letter .ipa-row { display: contents; }

.letter .glyphs {
  grid-area: glyphs;
  display: flex; align-items: baseline; flex-wrap: wrap;
  column-gap: var(--sp-10);
  font-family: var(--ff-display);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.02em;
}
.letter .cyr { font-size: 1.875rem; color: var(--ink); }
.letter .sep { display: none; }
.letter .lat { font-size: 1.25rem; color: var(--ink-muted); font-weight: 400; }

.letter .ipa {
  grid-area: ipa;
  align-self: center;
  justify-self: start;
  padding: var(--sp-2) var(--sp-8);
  border-radius: var(--rad-pill);
  background: var(--inner);
  font-family: var(--ff-body);
  font-size: var(--fs-caption);
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink-soft);
}
.letter .tip-chip { grid-area: tip; align-self: center; }

.letter .example {
  grid-area: ex;
  display: grid;
  gap: var(--sp-2);
  margin-top: var(--sp-6);
  padding-top: var(--sp-10);
  border-top: 1px solid var(--hairline);
  min-width: 0;
}
.letter .example .word {
  display: grid;
  font-family: var(--ff-display);
  font-size: var(--fs-body);
  font-weight: 500;
  line-height: var(--lh-snug);
  overflow-wrap: anywhere;
}
.letter .example .word-cyr { color: var(--ink); }
.letter .example .word-sep { display: none; }
.letter .example .word-lat { color: var(--ink-muted); font-weight: 400; font-size: var(--fs-small); }
.letter .example .tr {
  display: block;
  margin-top: var(--sp-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-snug);
  color: var(--ink-muted);
}

/* -----------------------------------------------------------
   Cases (declension)
   ----------------------------------------------------------- */

/* Baseline for any [data-tone]: ink-soft. Charts that don't carry
   grammatical meaning in color (pronouns, numbers, aspect) inherit this
   neutral tone; chart-specific overrides come below. :where() keeps the
   baseline at 0 specificity so even un-qualified case rules trivially win. */
:where([data-tone]) { --tone: var(--ink-soft); }

/* Per-case tone colors. One hue per case; orange is brand/marker ink and
   never a case. NOM is unmarked — the dictionary form — so it takes an
   ink-tone rather than an accent, distinguishing it visually from the
   inflected cases. */
[data-tone="nom"] { --tone: var(--ink-soft); }
[data-tone="gen"] { --tone: var(--tone-purple); }
[data-tone="dat"] { --tone: var(--tone-yellow); }
/* Keep AKU cyan: AKU/INS is the most frequent comparison, and blue/purple
   collapse under the protanopia model on dark backgrounds. */
[data-tone="aku"] { --tone: var(--tone-cyan); }
[data-tone="vok"] { --tone: var(--tone-red); }
[data-tone="ins"] { --tone: var(--tone-blue); }
[data-tone="lok"] { --tone: var(--tone-green); }

.case-extra { padding-top: var(--gap); }

/* The i-declension paradigm — Sg / Pl table in a focusable horizontal-scroll
   pane, drawn as a rounded inner surface with faint alternating rows. */
.i-decl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--rad-inner);
  background: var(--inner);
}
.i-decl-wrap:focus-visible { outline-offset: 2px; }

/* The one table recipe — shared with the verb paradigm: a label row, then
   data rows on alternating faint stripes inside a rounded inner surface. */
.i-decl,
.verb-paradigm {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.verb-paradigm {
  border-radius: var(--rad-inner);
  background: var(--inner);
  overflow: hidden;
}
.i-decl thead th,
.verb-paradigm thead th {
  font-family: var(--ff-body);
  font-size: var(--fs-label);
  font-weight: 650;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: left;
  padding: var(--sp-12) var(--sp-14) var(--sp-6);
}
.i-decl tbody tr:nth-child(odd) > *,
.verb-paradigm tbody tr:nth-child(odd) > * {
  background: color-mix(in oklab, var(--ink) 3.5%, transparent);
}
.i-decl tbody th {
  text-align: left;
  width: 1%;
  white-space: nowrap;
  padding: var(--sp-8) var(--sp-8) var(--sp-8) var(--sp-14);
}
.i-decl tbody td,
.verb-paradigm tbody td {
  padding: var(--sp-10) var(--sp-14);
  vertical-align: top;
}
.i-decl tbody td .end {
  white-space: nowrap;
  font-family: var(--ff-display);
  font-weight: 400;
  font-size: var(--fs-lead);
  color: var(--ink);
}
.i-decl tbody tr:last-child > *,
.verb-paradigm tbody tr:last-child > * { padding-bottom: var(--sp-12); }

/* -----------------------------------------------------------
   Pronouns
   ----------------------------------------------------------- */

/* The pronoun's case forms sit in a rounded inner table: every case but NOM
   is a row led by its chip(s). The chip column is two chips wide on every
   row, merged or not, so the forms align down the card. */
.card-items:has(> .pron-row),
.card-items:has(> .pitch-row) {
  padding: var(--sp-4);
  border-radius: var(--rad-inner);
  background: var(--inner);
}
/* Rows inside an inner table alternate as faint rounded stripes. */
.pron-row,
.pitch-row {
  align-items: baseline;
  column-gap: var(--sp-12);
  padding: var(--sp-8) var(--sp-10);
  border-top: 0;
  border-radius: var(--rad-unit);
}
.pron-row:first-child, .pron-row:last-child,
.pitch-row:first-child, .pitch-row:last-child { padding-block: var(--sp-8); }
.pron-row:nth-child(even),
.pitch-row:nth-child(even) { background: color-mix(in oklab, var(--ink) 4%, transparent); }
.pron-row { grid-template-columns: 6.25rem minmax(0, 1fr); }
.pron-row.is-pair { grid-template-columns: 6.25rem repeat(2, minmax(0, 1fr)); }
.pron-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
}
.pron-form {
  font-family: var(--ff-display);
  font-size: var(--fs-lead);
  line-height: var(--lh-snug);
  color: var(--ink);
}
/* Short (clitic) forms step down one ink tone — position after the comma
   plus the LONG · SHORT label carry the axis; no hue (purple would read GEN). */
.pron-short,
.pron-comma { color: var(--ink-muted); }
.pron-slash { color: var(--ink-faint); margin: 0 .15em; font-weight: 400; }
/* A chip riding a section label sits on the label's line. */
.card-section-label .pron-chips { vertical-align: middle; margin-left: var(--sp-4); margin-top: -2px; }

/* Owner / demonstrative rows: the gloss over a gender-run. The gloss is a
   translation, not a section name, so it drops the small caps. */
.pron-run-row { gap: var(--sp-6); }
.pron-run-row > .chart-label {
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
}
/* Abstract endings carry emphasis weight, as the verb paradigms do. */
.gender-run.is-abstract .eu-form { font-weight: 500; }

/* The clitic chain: an ordered run of slots, each its word(s) or chip(s)
   over the slot's role — numbered steps on an inner track. */
.pron-chain {
  list-style: none;
  margin: 0;
  padding: var(--sp-12);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-8);
  border-radius: var(--rad-inner);
  background: var(--inner);
  counter-reset: slot;
}
.pron-slot {
  counter-increment: slot;
  display: grid;
  gap: var(--sp-6);
  align-content: start;
  padding: var(--sp-8) var(--sp-12);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--hairline);
}
.pron-slot-word {
  font-family: var(--ff-display);
  font-size: var(--fs-lead);
  line-height: var(--lh-snug);
  color: var(--ink);
}
.pron-slot .chart-label::before { content: counter(slot) " · "; color: var(--ink-faint); }

/* -----------------------------------------------------------
   Verbs (conjugation)
   ----------------------------------------------------------- */

/* Present forms (all four conjugation buckets + irregulars) share the
   brand marker orange — chrome ink, not a grammatical hue. Past and
   future fall through to the ink-soft baseline. The tone reaches the card
   head only: endings, forms and lemmas are ink. */
[data-tone="im"],
[data-tone="am"],
[data-tone="em"],
[data-tone="jem"],
[data-tone="irr"] { --tone: var(--tone-orange); }

/* The paradigm table: SG | PL columns headed by the number, three rows
   (ja|mi, ti|vi, on|oni — PAIR_ORDER in verbs.ts). A cell stacks the
   pronoun over the form, so oni/one/ona never competes with the form for a
   320px column. Fixed layout: the two columns split the width. */
.verb-paradigm { table-layout: fixed; }
.verb-cell {
  display: grid;
  gap: var(--sp-2);
  min-width: 0;
}
/* Serbian pronoun labels (ja, on/ona/ono) — specimen voice, lowercase. */
.verb-pron {
  font-family: var(--ff-display);
  font-style: italic;
  font-size: var(--fs-caption);
  line-height: var(--lh-snug);
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}
.verb-form {
  font-family: var(--ff-display);
  font-size: var(--fs-lead);
  font-weight: 400;
  line-height: var(--lh-snug);
  color: var(--ink);
  overflow-wrap: anywhere;
}
/* A bare ending is the pattern, not a word: emphasis weight. */
.verb-paradigm.is-abstract .verb-form { font-weight: 600; }

/* Serbian runs in a text section: infinitive cues, the tense formula, the
   merged-form and -ći lists. */
.verb-cues,
.verb-formula,
.verb-list {
  margin: 0;
  font-family: var(--ff-display);
  font-size: var(--fs-lead);
  font-weight: 400;
  line-height: var(--lh-prose);
  color: var(--ink);
}
/* The formula reads as an equation on an inner strip. */
.verb-formula {
  padding: var(--sp-8) var(--sp-14);
  border-radius: var(--rad-inner);
  background: var(--inner);
}
.verb-formula a {
  text-decoration-style: dotted;
  text-decoration-color: color-mix(in oklab, currentColor 50%, transparent);
  text-underline-offset: .22em;
}
/* Apparatus inside the formula — the grammatical term naming what the Serbian
   run combines with. Sans voice, caption size; the specimen keeps the serif. */
.verb-formula .verb-term {
  font-family: var(--ff-body);
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--ink-soft);
}
/* A one-sentence statement in a section (the tense meaning): body prose. */
.verb-prose {
  margin: 0;
  font-size: var(--fs-body);
  line-height: var(--lh-prose);
  color: var(--ink-soft);
}
/* The participle bands: one section, a heading per number. */
.verb-bands {
  display: grid;
  gap: var(--sp-14);
}
/* A number heading inside a section sits one tier below the section label. */
.gender-band > h5 {
  margin: 0;
  font-size: var(--fs-caption);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
}

/* -----------------------------------------------------------
   Numbers
   ----------------------------------------------------------- */

/* Every block on this sheet is a .card; numbers keep tabular figures. */
.num-layout { gap: var(--gap); }
.num-cardinals { gap: var(--gap); }

/* Numbers as tiles: the digits big, the Serbian word under them, two to a row. */
.num-tiles {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-8);
}
.num-tile.card-item {
  align-content: start;
  gap: var(--sp-2);
  padding: var(--sp-10) var(--sp-12) var(--sp-12);
  border: 0;
  border-radius: var(--rad-inner);
  background: var(--inner);
}
.num-tile .num-value {
  font-family: var(--ff-body);
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.num-tile .sr {
  font-size: var(--fs-body);
  line-height: var(--lh-snug);
  color: var(--ink-soft);
}

/* Notable endings — the trailing -a of dvesta/trista, the count-driven
   -u / -e of hiljadu / hiljade — plus the agreement verbs and the clitic se.
   Ink on a coral highlight: the marker pen of the page. */
.num-end,
.num-agreement-verbs .chart-example .sr mark,
.verb-clitic .card-item .sr mark {
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
  background: color-mix(in oklab, var(--accent) 20%, transparent);
  box-shadow: inset 0 -2px color-mix(in oklab, var(--accent) 75%, transparent);
  padding: 0 .1em;
  border-radius: 3px;
}
/* The digit is the index key, not apparatus: you read the number first,
   then the Serbian form. */
.num-value {
  font-family: var(--ff-body);
  font-size: var(--fs-title);
  font-weight: 700;
  line-height: var(--lh-snug);
  letter-spacing: -.01em;
  color: var(--ink);
}

/* Share the digit column through subgrid so compound parts align across rows. */
.num-build-card .card-items {
  grid-template-columns: max-content minmax(0, 1fr);
}
.num-build-card .card-item {
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: baseline;
  gap: var(--sp-12);
}
.num-built {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-4);
}

/* The banded row — shared by the noun-count and verb-agreement blocks. */
.chart-table { display: grid; }
.chart-row {
  display: grid;
  gap: var(--sp-10);
  padding: var(--sp-12) 0;
  border-top: 1px solid var(--hairline);
}
.chart-row:first-child { padding-top: 0; border-top: 0; }
.chart-row:last-child { padding-bottom: 0; }
.chart-row > * { min-width: 0; }
.chart-row :is(h4, h5) {
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  flex-wrap: wrap;
  font-size: var(--fs-label);
  font-weight: 650;
  letter-spacing: var(--track-label);
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.num-band { gap: var(--sp-10); }
.num-band-head .num-value {
  font-size: var(--fs-title);
  letter-spacing: -.01em;
  text-transform: none;
  color: var(--ink);
}
.num-band-head .chart-sep { margin-inline: var(--sp-4); }

/* Stack noun phrases to fit narrow columns. A shared max-content column
   keeps units equally wide within each band. */
.num-count-run {
  display: grid;
  grid-template-columns: max-content;
  gap: var(--sp-6);
  max-width: 100%;
}
/* M is wider than F; the letter is a fixed-width field so specimens align. */
.num-count-run .eu-gender { min-width: 1.75rem; }

/* Place the shared ending pattern above the masculine citation forms. */
.num-ord-rule {
  display: grid;
  gap: var(--sp-10);
}

.chart-example {
  display: grid;
  gap: var(--sp-2);
  min-width: 0;
}
.chart-example .sr {
  font-family: var(--ff-display);
  font-size: var(--fs-lead);
  font-weight: 400;
  line-height: var(--lh-snug);
  color: var(--ink);
}
.chart-example .tr {
  font-family: var(--ff-body);
  font-weight: 400;
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
  color: var(--ink-muted);
}

/* -----------------------------------------------------------
   Verb aspect
   ----------------------------------------------------------- */

/* What an aspect means: apparatus text, not a specimen. */
.aspect-traits {
  margin: 0;
  font-size: var(--fs-body);
  line-height: var(--lh-prose);
  color: var(--ink-soft);
}
/* The aspect abbreviation over its clause, and a pitch accent's length: a
   small neutral pill. */
.aspect-item .chart-label,
.pitch-item > .chart-label {
  justify-self: start;
  margin-bottom: var(--sp-4);
  padding: .25rem var(--sp-8) .1875rem;
  border-radius: var(--rad-pill);
  background: var(--inner-deep);
  color: var(--ink-soft);
}

/* The prefix section line: the prefix as a specimen on the left with its ?,
   the feel as the label pushed right. */
.aspect-prefix-label {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
}
.aspect-prefix-label .tip-chip { margin-left: 0; margin-top: 0; }
.aspect-prefix {
  font-family: var(--ff-display);
  font-size: var(--fs-title);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  line-height: 1;
}
.aspect-feel { margin-left: auto; text-align: right; }

/* -----------------------------------------------------------
   Pitch & stress
   ----------------------------------------------------------- */

/* A section's lead line: apparatus prose. */
.pitch-fact {
  margin: 0;
  font-size: var(--fs-body);
  line-height: var(--lh-prose);
  color: var(--ink-soft);
}
.card-section > .pitch-fact { margin-bottom: var(--sp-12); }

.pitch-item { gap: var(--sp-8); }

/* The contour diagram: a grid whose columns ARE the syllable intervals. The
   stressed column is one unit for a short accent and 1.8 units for a long
   one; the unstressed column after it is always one unit, so the two
   drawings of a contour differ in exactly one thing. Width in rem, not %:
   duration is the datum, and it must not stretch with the viewport. It
   sits on an inner plate like a small chart. */
.pitch-diagram {
  --pitch-unit: 4rem;
  --pitch-stressed: var(--pitch-unit);
  display: grid;
  grid-template-columns: var(--pitch-stressed) var(--pitch-unit);
  justify-self: start;
  row-gap: var(--sp-6);
  padding: var(--sp-12) var(--sp-16) var(--sp-10);
  border-radius: var(--rad-inner);
  background: var(--inner);
}
.pitch-diagram[data-length="long"] { --pitch-stressed: calc(var(--pitch-unit) * 1.8); }
.pitch-curve {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  height: 1.6rem;
  overflow: visible;
  color: var(--ink);
  fill: none;
  stroke: currentColor;
  stroke-width: 2px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.pitch-curve path,
.pitch-curve line { vector-effect: non-scaling-stroke; }
.pitch-curve line { color: var(--ink-faint); stroke: currentColor; stroke-width: 1.5px; }
.pitch-syl {
  font-family: var(--ff-display);
  font-size: var(--fs-title);
  font-weight: 400;
  line-height: 1.05;
  color: var(--ink);
  text-align: center;
}
/* The first syllable is the stressed one; weight is its only marker. */
.pitch-syl:nth-child(2) { font-weight: 600; }

/* Words that share the accent, run inline. */
.pitch-examples {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-8) var(--sp-20);
}
.pitch-dict {
  display: grid;
  gap: var(--sp-8);
  margin-top: var(--sp-4);
}

/* Two paradigms: case chip + number down the side, one column per noun. */
.pitch-item + .pitch-item { padding-top: var(--sp-14); }
.pitch-row { grid-template-columns: 5.5rem repeat(2, minmax(0, 1fr)); }
.pitch-row .sr { font-size: var(--fs-lead); }
.pitch-row-head { align-items: end; }
.pitch-rowhead {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-6);
}

/* -----------------------------------------------------------
   Prepositions
   ----------------------------------------------------------- */

/* The lemma is a compact row header over its uses. */
.prep-row {
  display: grid;
  gap: var(--sp-10);
}
.prep-card-group .card-item { padding-block: var(--sp-14); }
.prep-card-group .card-item:first-child { padding-top: 0; }
.prep-card-group .card-item:last-child { padding-bottom: 0; }

/* The dot is the case marker: its hue comes from the use's own data-tone —
   never a second case→hue map. The icon sits on a small inner plate, whose
   colour the occluding frames borrow. */
.prep-icon-cell {
  --prep-dot: var(--tone, var(--ink-soft));
  --prep-ground: var(--inner);
  display: block;
  padding: var(--sp-6) var(--sp-4);
  border-radius: 12px;
  background: var(--prep-ground);
}

.prep-icon {
  width: 100%;
  height: auto;
  color: var(--ink-muted);
  overflow: visible;
}

.prep-icon-object,
.prep-icon-line,
.prep-icon-dash {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.prep-icon-dash { stroke-dasharray: 3 4; }

.prep-icon-dot {
  fill: var(--prep-dot);
  stroke: var(--prep-ground);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

/* The other party — ink like the frames, never case-coloured. */
.prep-icon-hollow {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
/* Depth by occlusion: a plate-filled frame hides what it is drawn over. */
.prep-icon-solid { fill: var(--prep-ground); }

.prep-icon-arrow {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* The lemma is a card item's specimen — a dual-case prep has no single
   tone, so it stays neutral ink and colour lives on the per-use chips and
   icon dots. */
.prep-name {
  font-family: var(--ff-display);
  font-size: var(--fs-serif-title);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.01em;
  color: var(--ink);
}

.prep-uses { display: grid; gap: var(--sp-12); }

/* Shared by the chart row and the popover card: icon | chip + meaning +
   example. The icon column is fixed so every use in a group aligns. */
.prep-use {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  align-items: start;
  column-gap: var(--sp-14);
}
.prep-use-text {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
}
.prep-use-head {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  flex-wrap: wrap;
}
.prep-meaning {
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: var(--lh-snug);
  color: var(--ink-muted);
}

/* Preposition card — the shared popover's prep variant. One entry per lemma;
   every use stacked and tinted by its own case. Widen the shell itself so
   position()'s clamp — which measures the wrapper — keeps it on-screen. */
.prep-pop { width: min(22.5rem, calc(100vw - 24px)); }
.prep-pop .tip-pop-card {
  max-height: min(70vh, 540px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.prep-card { display: grid; gap: var(--sp-14); }
.prep-card-name {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 2rem;
  line-height: 1;
  color: var(--ink);
}
.prep-card-uses { display: grid; gap: var(--sp-14); }

/* -----------------------------------------------------------
   False friends
   ----------------------------------------------------------- */

/* One two-column table as a card: Serbian headword against its Russian
   gloss on faint alternating rows. The headword never breaks. */
.false-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  padding: var(--sp-8);
  border-radius: var(--rad-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}
.false-table tr:nth-child(odd) > * { background: var(--inner); }
.false-table tr > :first-child { border-radius: var(--rad-inner) 0 0 var(--rad-inner); }
.false-table tr > :last-child { border-radius: 0 var(--rad-inner) var(--rad-inner) 0; }
.false-table th,
.false-table td {
  vertical-align: baseline;
  text-align: left;
  padding: var(--sp-12) var(--sp-12);
}
.false-table th {
  width: 1%;
  padding-right: var(--sp-16);
  font-family: var(--ff-display);
  font-size: var(--fs-lead);
  font-weight: 500;
  line-height: var(--lh-snug);
  color: var(--ink);
}
.false-table td {
  font-size: var(--fs-body);
  line-height: var(--lh-snug);
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

/* -----------------------------------------------------------
   Motion
   ----------------------------------------------------------- */

/* Page to page: the masthead and the dock stay put; the page between them
   fades up a touch. */
@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: var(--t-med); animation-timing-function: var(--ease); }
::view-transition-old(root) { animation: var(--t-fast) ease-out both vt-fade-out; }
::view-transition-new(root) { animation: var(--t-med) var(--ease) both vt-rise-in; }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-rise-in { from { opacity: 0; transform: translateY(10px); } }
/* A chart's glyph flies from its home tile into its cover icon, and back.
   Only the tile and the cover are named, so a page never carries a name twice. */
:is(.tile-glyph, .cover-glyph)[data-chart="alphabet"]      { view-transition-name: glyph-alphabet; }
:is(.tile-glyph, .cover-glyph)[data-chart="cases"]         { view-transition-name: glyph-cases; }
:is(.tile-glyph, .cover-glyph)[data-chart="numbers"]       { view-transition-name: glyph-numbers; }
:is(.tile-glyph, .cover-glyph)[data-chart="verbs"]         { view-transition-name: glyph-verbs; }
:is(.tile-glyph, .cover-glyph)[data-chart="pronouns"]      { view-transition-name: glyph-pronouns; }
:is(.tile-glyph, .cover-glyph)[data-chart="prepositions"]  { view-transition-name: glyph-prepositions; }
:is(.tile-glyph, .cover-glyph)[data-chart="aspect"]        { view-transition-name: glyph-aspect; }
:is(.tile-glyph, .cover-glyph)[data-chart="pitch-stress"]  { view-transition-name: glyph-pitch; }
:is(.tile-glyph, .cover-glyph)[data-chart="false-friends"] { view-transition-name: glyph-false-friends; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  /* No press-in either: the state change is enough. */
  :is(.tile, .dock-btn, .seg-btn, .settings-btn, .cover-chips a, .menu-list a, .tip-chip, .prep-trigger, .tip-pop-close):active { transform: none; }
  .sheet, .tip-pop, .settings-menu { transform: none; }
  /* View-transition pseudos have their own animation timeline; disable them explicitly. */
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* Forced colors (Windows High Contrast Mode): shadows vanish, so every
   floating surface draws a real border; selection uses system highlight. */
@media (forced-colors: active) {
  .card, .cover, .hero, .tile, .letter, .false-table,
  .sheet-card, .settings-menu-card, .tip-pop-card, .dock-bar, .settings-btn {
    border: 1px solid CanvasText;
  }
  .card-head { border-bottom: 1px solid CanvasText; }
  .seg-btn[aria-pressed="true"],
  .seg-btn[aria-current="true"],
  .dock-btn[aria-expanded="true"],
  .chart-menu-list a[aria-current="page"],
  .section-menu-list .case-strip-cell.is-current a {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }
  .script-seg::before { display: none; }
  :root:not([data-script="cyr"]) .script-seg [data-script-chip="lat"],
  [data-script="cyr"] .script-seg [data-script-chip="cyr"] {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }
  /* Preserve case hues only on decorative marker dots. Text uses system
     colors; visible case abbreviations carry meaning independently of hue. */
  .case-strip-cell a::before {
    forced-color-adjust: none;
  }
}

/* -----------------------------------------------------------
   Utilities
   ----------------------------------------------------------- */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
