/* Diacritic Atlas
   Layout concept: a proofing desk. A sticky masthead and filter strip sit over a long sheet of
   mark sections; each section pairs the mark's notes (left) with a specimen grid of letters (right).
   Detail opens in a side drawer drawn like a font editor's metrics view. */

:root {
  --paper: #f5f6f8;
  --surface: #ffffff;
  --sunk: #eceef2;
  --ink: #15171c;
  --ink-2: #4b5160;
  --ink-3: #868c9b;
  --rule: #dcdfe6;
  /* Light-mode accent: blue. --accent fills shapes and the large marks; --accent-text colours text,
     links and thin lines (the same blue here; deeper in the yellow variant below). */
  --accent: #2a50f5;
  --accent-text: #2a50f5;
  --accent-ink: #ffffff;
  --accent-soft: #e8ecff;
  --zone: rgba(42, 80, 245, 0.11);
  --spec: #9a5a07;
  --spec-soft: #f6ead8;
  --ok: #1d7a46;
  --miss: #c2341e;
  --miss-soft: #fbe5e1;
  --shadow: 0 1px 2px rgba(21, 23, 28, 0.06), 0 8px 24px -12px rgba(21, 23, 28, 0.18);

  --f-ui: "IBM Plex Sans", "Noto Sans", "Segoe UI", system-ui, sans-serif; /* Noto Sans fills the letters Plex lacks (ǩ ǥ ḃ ḥ ḷ ɲ …) */
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --f-display: "Noto Serif Display", "Noto Serif", Georgia, "Times New Roman", serif;
  --f-mark: "Noto Serif Atlas", Georgia, serif;
  --f-specimen: "Noto Serif Atlas Light", "Noto Serif Atlas", Georgia, serif;

  --t-xs: 0.75rem;
  --t-sm: 0.8125rem;
  --t-base: 0.9375rem;
  --t-md: 1.125rem;
  --t-lg: 1.5rem;
  --t-xl: 2.25rem;
  --t-xxl: clamp(2.25rem, 5vw, 3.75rem);

  --mast-h: 56px;
  --ease: cubic-bezier(0.2, 0.7, 0.15, 1);
  --radius: 10px;
  color-scheme: light;
}
/* Alternative yellow accent for light mode, tried in October 2026. To use it, add data-accent="yellow"
   to the <html> tag in index.html. Bright yellow is unreadable as text on white, so text uses a deeper
   ochre, and Specialist turns violet so it does not blur with the yellow. Dark mode always uses yellow. */
:root[data-accent="yellow"] {
  --accent: #f2b80f; --accent-text: #8c6400; --accent-ink: #1d1604; --accent-soft: #fcf1cf; --zone: rgba(242, 184, 15, 0.2);
  --spec: #6a4bd6; --spec-soft: #ece8fd;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111317; --surface: #191b21; --sunk: #20232a; --ink: #eceef3; --ink-2: #aab0bd; --ink-3: #6d7383;
    --rule: #2b2e37; --accent: #f6cb4c; --accent-text: #f6cb4c; --accent-ink: #1d1604; --accent-soft: #3a3014; --zone: rgba(246, 203, 76, 0.16);
    --spec: #b9a3ff; --spec-soft: #2a2340; --ok: #5cc98a; --miss: #ff7a63; --miss-soft: #3c1f1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -12px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111317; --surface: #191b21; --sunk: #20232a; --ink: #eceef3; --ink-2: #aab0bd; --ink-3: #6d7383;
  --rule: #2b2e37; --accent: #f6cb4c; --accent-text: #f6cb4c; --accent-ink: #1d1604; --accent-soft: #3a3014; --zone: rgba(246, 203, 76, 0.16);
  --spec: #b9a3ff; --spec-soft: #2a2340; --ok: #5cc98a; --miss: #ff7a63; --miss-soft: #3c1f1a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -12px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}
:root[data-specimen="sans"] { --f-specimen: "Noto Sans", "Helvetica Neue", Arial, sans-serif; }
:root[data-specimen="user"] { --f-specimen: "AtlasUserFont", "Noto Serif Atlas Light", Georgia, serif; }

/* Noto Serif Regular (SIL OFL 1.1), self-hosted as a Latin subset that keeps every spacing
   and combining accent (the Google Fonts download leaves the standalone accents out) */
@font-face { font-family: "Noto Serif Atlas"; src: url("fonts/NotoSerif-Regular-Latin.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
/* letters are shown one step lighter than the marks */
@font-face { font-family: "Noto Serif Atlas Light"; src: url("fonts/NotoSerif-Light-Latin.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
/* Interface fonts, all SIL OFL 1.1, self-hosted as Latin subsets: the page loads nothing from Google or any other server */
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-400-Latin.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-500-Latin.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-600-Latin.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("fonts/NotoSans-400-Latin.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Noto Serif Display"; src: url("fonts/NotoSerifDisplay-300-Latin.woff") format("woff"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Noto Serif Display"; src: url("fonts/NotoSerifDisplay-400-Latin.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Noto Serif Display"; src: url("fonts/NotoSerifDisplay-Italic-300-Latin.woff") format("woff"); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Regular-Latin.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Medium-Latin.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--mast-h) + 140px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--t-base)/1.55 var(--f-ui);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--paper);
}
img, canvas { max-width: 100%; }
a { color: var(--accent-text); text-underline-offset: 0.18em; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
.wrap {
  width: 100%; max-width: 1320px; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 900px) { .wrap { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); } }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font: 500 var(--t-xs)/1.2 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 6px; }
.skip:focus { left: 16px; }

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.mast-inner { height: var(--mast-h); display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand-mark { font: 400 1.75rem/1 var(--f-display); color: var(--accent-text); }
.brand-name { font: 500 var(--t-md)/1 var(--f-display); letter-spacing: 0.01em; }
.tabs { position: relative; display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  position: relative; z-index: 1; padding: 8px 12px; border-radius: 8px; text-decoration: none;
  color: var(--ink-2); font-weight: 500; font-size: var(--t-sm); white-space: nowrap; transition: color 0.25s var(--ease);
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); }
.tab-ink {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 8px; background: var(--sunk);
  transition: transform 0.45s var(--ease), width 0.45s var(--ease);
}
.icon-btn {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2);
  transition: border-color 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn svg { width: 18px; height: 18px; }
/* (the brand name stays visible on phones now that the tabs live in the menu panel) */
/* mobile menu: below 720px the tabs give way to a menu button and a panel that slides in from the right */
.menu-btn { display: none; }
.menu-layer { position: fixed; inset: 0; z-index: 80; visibility: hidden; transition: visibility 0s linear 0.4s; }
.menu-layer.open { visibility: visible; transition: none; }
.menu-scrim { position: absolute; inset: 0; background: rgba(10, 12, 16, 0.38); opacity: 0; transition: opacity 0.35s var(--ease); }
.menu-layer.open .menu-scrim { opacity: 1; }
.menu-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(84vw, 340px); display: flex; flex-direction: column; gap: 2px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px calc(env(safe-area-inset-bottom, 0px) + 20px); overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--rule); box-shadow: -18px 0 40px -20px rgba(0, 0, 0, 0.35);
  transform: translateX(100%); transition: transform 0.4s var(--ease); }
.menu-layer.open .menu-panel { transform: none; }
.menu-head { display: flex; align-items: center; justify-content: space-between; height: 46px; margin-bottom: 14px; }
.menu-title { display: flex; align-items: baseline; gap: 8px; font: 500 var(--t-md)/1 var(--f-display); color: var(--ink); }
.menu-title .brand-mark { font-size: 1.5rem; }
.menu-panel a { display: flex; align-items: center; min-height: 52px; padding: 0 14px; border-radius: 10px; text-decoration: none;
  font: 400 1.5rem/1.1 var(--f-display); color: var(--ink-2); transition: background 0.2s, color 0.2s; }
.menu-panel a:hover { color: var(--ink); background: var(--sunk); }
.menu-panel a[aria-current="page"] { color: var(--ink); background: var(--sunk); box-shadow: inset 3px 0 0 var(--accent); }
.menu-by { margin: auto 14px 0; padding-top: 24px; font-size: var(--t-xs); color: var(--ink-3); }
@media (max-width: 720px) { .tabs { display: none; } .menu-btn { display: grid; } #themeBtn { margin-left: auto; } }
@media (prefers-reduced-motion: reduce) { .menu-panel, .menu-scrim { transition: none; } }

/* ---------- intro ---------- */
.intro { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); align-items: center; padding-block: clamp(40px, 7vw, 104px) clamp(28px, 4vw, 56px);
  min-height: min(calc(100svh - var(--mast-h) - 120px), 820px); }
.intro h1 { font: 300 clamp(2.6rem, 6.4vw, 6rem)/1.02 var(--f-display); letter-spacing: -0.028em; margin-top: 16px; text-wrap: balance; }
.intro h1 em { font-style: italic; color: var(--accent-text); }
.lede { margin-top: clamp(18px, 2.4vw, 28px); max-width: 52ch; color: var(--ink-2); font-size: clamp(1.0625rem, 1.35vw, 1.25rem); line-height: 1.55; }
.facts { display: flex; flex-wrap: wrap; gap: 10px clamp(16px, 4.5vw, 36px); margin: clamp(22px, 3vw, 36px) 0 0; }
.facts div { display: flex; align-items: baseline; gap: 8px; }
/* "marks and related letters" sits on two lines beside its number, so all three facts fit one row on phones */
.facts div.two-line { align-items: center; }
.facts div.two-line dt { line-height: 1.15; }
@media (max-width: 400px) { .facts div { gap: 6px; } }
@media (max-width: 380px) { .facts { column-gap: 12px; } .facts dd { font-size: 1.6rem; } }
.facts dt { order: 2; color: var(--ink-3); font-size: var(--t-sm); }
.facts dd { margin: 0; font: 300 clamp(1.75rem, 3vw, 2.5rem)/1 var(--f-display); font-variant-numeric: tabular-nums; }
/* printable checklist: a small square text tile */
.dl-card { display: inline-grid; justify-items: center; align-content: center; gap: 8px; width: 86px; height: 86px; align-self: center;
  border: 1px solid var(--accent); border-radius: 14px; background: var(--accent); color: var(--accent-ink); text-decoration: none;
  transition: filter 0.25s var(--ease), box-shadow 0.25s var(--ease), transform 0.3s var(--ease); }
/* filled tile: blue with white text in light mode, yellow with dark text in dark mode (follows the accent tokens) */
.dl-card .dl-go { color: inherit; }
.dl-card:hover { filter: brightness(1.08); box-shadow: var(--shadow); transform: translateY(-1px); }
.dl-card:active { transform: scale(0.98); }
.dl-sheet { position: relative; display: grid; align-content: start; gap: 3px; width: 30px; height: 40px; padding: 11px 4px 4px; border-radius: 2px; background: #fff;
  box-shadow: 0 0 0 1px rgba(21, 23, 28, 0.1), 0 4px 10px -5px rgba(21, 23, 28, 0.35); transform: rotate(-6deg); transition: transform 0.4s var(--ease); }
.dl-card:hover .dl-sheet { transform: rotate(0deg) translateY(-2px); }
.dl-sheet b { position: absolute; left: 4px; top: 2px; font: 400 8px/1 var(--f-mark); color: #2a50f5; }
.dl-sheet .r { position: relative; display: block; height: 3px; border-left: 3px solid transparent; background: linear-gradient(#dcdfe6, #dcdfe6) 2px 50% / calc(100% - 2px) 1px no-repeat; }
.dl-sheet .r::before { content: ""; position: absolute; left: -3px; top: 0; width: 3px; height: 3px; box-sizing: border-box; border: 0.6px solid #15171c; border-radius: 0.5px; }
.dl-sheet .r.on::before { background: #2a50f5; border-color: #2a50f5; }
.dl-title { font-size: var(--t-sm); font-weight: 500; line-height: 1.2; text-align: center; }
.dl-go { display: inline-flex; align-items: center; gap: 4px; font: 500 0.6875rem/1 var(--f-mono); letter-spacing: 0.08em; color: var(--accent-text); }
.dl-go svg { width: 11px; height: 11px; transition: transform 0.3s var(--ease); }
.dl-card:hover .dl-go svg { transform: translateY(2px); }
/* the hero specimen sits directly on the page: guide lines fade out at the edges (drawn in the canvas; the letters never fade), a soft pale-blue glow behind the letters (dark mode: a faint white one) */
.hero-specimen { margin: 0; position: relative; isolation: isolate; }
.hero-specimen::before { content: ""; position: absolute; inset: -6% 2% 8%; z-index: -1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(42, 80, 245, 0.13), rgba(42, 80, 245, 0.1) 42%, rgba(42, 80, 245, 0.05) 64%, rgba(42, 80, 245, 0)); filter: blur(6px); opacity: 1; }
.hero-specimen button { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 14px; background: transparent; overflow: visible; cursor: pointer; }
.hero-specimen canvas { display: block; width: 100%; height: clamp(340px, 44vw, 600px);
  transition: transform 0.5s var(--ease); }
.hero-specimen button:hover canvas { transform: scale(1.02); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-specimen::before { opacity: 0.05;
  background: radial-gradient(closest-side, #fff, #fff 42%, rgba(255, 255, 255, 0.75) 64%, rgba(255, 255, 255, 0)); } }
:root[data-theme="dark"] .hero-specimen::before { opacity: 0.05;
  background: radial-gradient(closest-side, #fff, #fff 42%, rgba(255, 255, 255, 0.75) 64%, rgba(255, 255, 255, 0)); }
.hero-label { position: absolute; left: 0; right: 0; bottom: 0; top: 70%; display: grid; align-content: center; justify-items: center; gap: 6px; padding: 0 16px; text-align: center; pointer-events: none; transition: opacity 0.26s var(--ease), transform 0.35s var(--ease); }
.hero-label.out { opacity: 0; transform: translateY(4px); }
.hl-mark { font: 400 clamp(2.25rem, 3.4vw, 2.875rem)/1.1 var(--f-display); color: var(--accent-text); letter-spacing: -0.01em; }
.hl-name { font: 400 var(--t-base)/1.4 var(--f-mono); letter-spacing: 0.02em; color: var(--ink-3); font-variant-numeric: tabular-nums; }
@media (max-width: 820px) { .intro { grid-template-columns: 1fr; min-height: 0; } }

/* ---------- filter strip ---------- */
.filters {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--mast-h)); z-index: 40;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.filters-inner { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 20px; padding-block: 12px; }
.filters-inner > .dl-card { order: -1; } /* checklist tile on the left of the filter bar */
.filters-main { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; min-width: 0; }
.result-line .dl-mini { display: none; text-decoration: none; }
@media (max-width: 860px) { .filters-inner { display: block; } .dl-card { display: none; } .result-line .dl-mini { display: inline-flex; } .result-line .count { margin-right: auto; } }
.search { position: relative; flex: 1 1 240px; min-width: 0; max-width: 360px; }
.search input, .lang-search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--rule); border-radius: 9px;
  background: var(--surface); transition: border-color 0.2s, box-shadow 0.2s;
}
.search input:focus, .lang-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg, .lang-search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.more-filters { display: contents; }
.ctl { display: flex; align-items: center; gap: 6px; }
.ctl-label { font: 500 var(--t-xs)/1 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunk); border-radius: 9px; }
.seg button {
  border: 0; background: transparent; padding: 5px 10px; border-radius: 7px; font-size: var(--t-sm); color: var(--ink-2);
  transition: background 0.25s var(--ease), color 0.2s, box-shadow 0.25s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.12); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); font-size: var(--t-sm);
  transition: background 0.25s var(--ease), border-color 0.25s, color 0.2s, transform 0.2s var(--ease);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip:active { transform: scale(0.97); }
.select {
  height: 34px; padding: 0 30px 0 10px; border: 1px solid var(--rule); border-radius: 9px; background: var(--surface);
  appearance: none; -webkit-appearance: none; max-width: 200px; font-size: var(--t-sm);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.result-line { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.count { font: 500 var(--t-sm)/1 var(--f-mono); color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--rule);
  background: var(--surface); font-size: var(--t-sm); font-weight: 500; color: var(--ink);
  transition: border-color 0.2s, background 0.2s, transform 0.15s var(--ease);
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn svg { width: 15px; height: 15px; }
.btn-text { border: 0; background: none; padding: 0; color: var(--accent-text); font-weight: 500; font-size: var(--t-sm); }
.filters-toggle { display: none; }
@media (max-width: 860px) {
  .filters-toggle { display: inline-flex; }
  .more-filters { display: none; }
  .filters.open .more-filters { display: flex; flex-wrap: wrap; gap: 12px 14px; width: 100%; animation: drop 0.35s var(--ease); }
  .search { max-width: none; }
  .result-line { margin-left: 0; }
}
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- mark index ---------- */
/* families flow side by side and wrap only when the row is full; each keeps its label */
.mark-index { display: flex; flex-wrap: wrap; gap: 14px 28px; padding-block: 18px 20px; }
.mi-fam { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mi-items { display: flex; flex-wrap: wrap; gap: 2px; }
.mark-index a { width: 84px; }
/* one column per mark: the widest row fills the width, shorter rows are centred (set in app.js) */
.mark-index { display: grid; grid-template-columns: repeat(var(--mi-cols, 11), minmax(0, 1fr)); gap: 16px 4px; }
.mi-fam { display: grid; grid-template-columns: subgrid; row-gap: 6px; }
.mi-fam .mi-family { grid-column: 1 / -1; padding-right: 16px; }
.mi-items { display: contents; }
.mark-index a { width: auto; }

.mark-index a {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 8px 6px 8px;
  border-radius: 10px; text-decoration: none; color: var(--ink-2); border: 1px solid transparent;
  transition: background 0.25s var(--ease), border-color 0.25s, opacity 0.3s, color 0.2s;
}
.mark-index a:hover { background: var(--surface); border-color: var(--rule); color: var(--ink); }
.mark-index .mi-glyph { display: block; width: 100%; height: 52px; flex: none; }
.mark-index .mi-name { flex: 1 0 auto; font-size: 0.6875rem; line-height: 1.25; text-align: center; overflow-wrap: normal; hyphens: none; text-wrap: balance; }
.mark-index .mi-count { font: 500 0.6875rem/1 var(--f-mono); color: var(--ink-3); }
.mark-index a.dim { opacity: 0.35; pointer-events: none; }

/* ---------- mark sections ---------- */
#groups { display: grid; gap: 0; padding-bottom: 48px; }
.group {
  display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: clamp(20px, 4vw, 48px);
  padding-block: 40px; border-top: 1px solid var(--rule);
}
.g-head { min-width: 0; }
.g-mark { display: block; width: 180px; max-width: 100%; height: 130px; }
.g-title { font: 400 var(--t-xl)/1.1 var(--f-display); margin-top: 10px; letter-spacing: -0.01em; }
.g-pos { margin-top: 6px; }
.g-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 16px 0 0; font-size: var(--t-sm); }
.g-meta dt { color: var(--ink-3); }
.g-meta dd { margin: 0; font-family: var(--f-mono); font-size: 0.78rem; color: var(--ink-2); overflow-wrap: anywhere; }
.g-note-wrap { margin-top: 18px; }
.g-note { max-width: 62ch; overflow: hidden; transition: max-height 0.5s var(--ease); }
.note-sec + .note-sec { margin-top: 14px; }
.note-h { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font: 500 0.6875rem/1.2 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.note-h::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.ns-design .note-h, .ns-opentype .note-h { color: var(--accent-text); }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.note-list li { position: relative; padding-left: 16px; font-size: var(--t-sm); line-height: 1.55; color: var(--ink-2); }
.note-list li::before { content: ""; position: absolute; left: 2px; top: 0.72em; width: 7px; height: 1.5px; border-radius: 1px; background: var(--ink-3); }
.ns-design .note-list li::before, .ns-opentype .note-list li::before { background: var(--accent); }
.d-note { max-width: none; }
.g-note.clamped { -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.g-note-wrap .btn-text { margin-top: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-content: start; min-width: 0; }
@media (max-width: 860px) { .group { grid-template-columns: 1fr; padding-block: 28px; } .g-mark { height: 104px; width: 150px; } }
@media (max-width: 420px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }

.card {
  position: relative; display: flex; flex-direction: column; text-align: left; min-width: 0; padding: 0; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--surface); color: var(--ink); overflow: hidden;
  transition: transform 0.35s var(--ease), border-color 0.25s, box-shadow 0.35s var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); box-shadow: var(--shadow); }
.card:active { transform: translateY(-1px) scale(0.99); }
.c-glyphs {
  position: relative; display: flex; align-items: baseline; justify-content: center; gap: 0.32em; height: 112px; padding-top: 6px;
  font: 400 3.4rem/112px var(--f-specimen); white-space: nowrap;
}
.c-glyphs .lc, .c-glyphs .uc { display: inline-block; position: relative; z-index: 1; transition: transform 0.4s var(--ease); }
/* hover zoom: scaled around the baseline (origin set in app.js), so the letters stay on the rule */
.card:hover .c-glyphs .lc, .card:hover .c-glyphs .uc, .card:focus-visible .c-glyphs .lc, .card:focus-visible .c-glyphs .uc { transform: scale(1.07); }
/* The baseline rule is a zero-height flex item aligned on the text baseline, so it sits exactly
   where the letters stand, in every font and whether or not the card is hovered. */
.c-glyphs .bl { position: relative; width: 0; height: 0; margin-left: -0.32em; align-self: baseline; }
.c-glyphs .bl::before { content: ""; position: absolute; top: 0; left: -600px; width: 1200px; height: 1px; background: var(--rule); }
.c-body { display: grid; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--rule); }
.c-cp { font: 400 0.72rem/1.2 var(--f-mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.c-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.c-langs { font-size: 0.72rem; color: var(--ink-3); }
.card.missing .c-glyphs { color: var(--miss); }
.card.missing::after {
  content: "missing in your font"; position: absolute; top: 8px; left: 8px; font: 500 0.625rem/1 var(--f-mono);
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--miss); background: var(--miss-soft); padding: 4px 6px; border-radius: 4px;
}

/* tier pills: the form carries the meaning, colour supports it */
.tier { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font: 500 0.6875rem/1 var(--f-ui); letter-spacing: 0.02em; white-space: nowrap; }
.tier.official { background: var(--ink); color: var(--paper); }
.tier.legacy { border: 1px dashed var(--ink-3); color: var(--ink-2); }
.tier.other { border: 1px solid var(--rule); color: var(--ink-2); }
.tip {
  position: fixed; z-index: 95; max-width: 260px; padding: 9px 12px; border-radius: 9px; background: var(--ink); color: var(--paper);
  font-size: 0.78rem; line-height: 1.45; pointer-events: none; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(4px); transition: opacity 0.18s var(--ease), transform 0.25s var(--ease);
}
.tip.below { transform: translateY(-4px); }
.tip.show { opacity: 1; transform: none; }
.tip strong { font-weight: 600; }
.tip::after {
  content: ""; position: absolute; left: var(--arrow-x, 50%); top: 100%; width: 10px; height: 10px; margin-left: -5px; margin-top: -5px;
  background: var(--ink); transform: rotate(45deg); border-radius: 2px;
}
.tip.below::after { top: auto; bottom: 100%; margin-top: 0; margin-bottom: -5px; }
.tier { cursor: help; }
.tierbtn {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid transparent;
  font: 500 var(--t-sm)/1 var(--f-ui); transition: opacity 0.25s var(--ease), filter 0.25s, transform 0.2s var(--ease);
}
.tierbtn.core { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tierbtn.extended { background: var(--surface); border-color: var(--accent-text); color: var(--accent-text); }
.tierbtn.specialist { background: var(--surface); border: 1px dashed var(--accent-text); color: var(--accent-text); }
.tierbtn[aria-pressed="false"] { opacity: 0.35; filter: grayscale(1); }
.tierbtn[aria-pressed="false"]:hover { opacity: 0.7; }
.tierbtn:active { transform: scale(0.96); }
.locl { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-text); font: 500 0.6875rem/1 var(--f-mono); }

.empty { padding: 48px 0 80px; text-align: center; color: var(--ink-2); }
.empty .btn-text { margin-left: 6px; }

/* ---------- views & transitions ---------- */
main { min-height: 70vh; }
.vt-switch .view { view-transition-name: view; }
.vt-filter .card, .vt-filter .g-head { view-transition-name: var(--vtn); }
.vt-lang #langPanel, .vt-lang #checkOut { view-transition-name: panel; }
::view-transition-old(panel) { animation: 0.22s var(--ease) both fade-out-up; }
::view-transition-new(panel) { animation: 0.45s var(--ease) both fade-in-up; }
::view-transition-group(*) { animation-duration: 0.48s; animation-timing-function: var(--ease); }
::view-transition-old(view) { animation: 0.28s var(--ease) both fade-out-up; }
::view-transition-new(view) { animation: 0.48s var(--ease) both fade-in-up; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.3s; }
@keyframes fade-out-up { to { opacity: 0; transform: translateY(-10px); } }
@keyframes fade-in-up { from { opacity: 0; transform: translateY(14px); } }
::view-transition-new(*):only-child { animation: 0.4s var(--ease) both pop-in; }
::view-transition-old(*):only-child { animation: 0.25s var(--ease) both pop-out; }
@keyframes pop-in { from { opacity: 0; transform: scale(0.94); } }
@keyframes pop-out { to { opacity: 0; transform: scale(0.94); } }
.enter > * { animation: rise 0.55s var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(10, 12, 18, 0.42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade 0.35s var(--ease); }
.scrim.closing { animation: fade 0.3s var(--ease) reverse both; }
@keyframes fade { from { opacity: 0; } }
/* letter detail: a centred panel over a dimmed page */
.drawer {
  position: fixed; z-index: 80; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(720px, calc(100vw - 32px)); max-height: min(88vh, 940px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.08);
  animation: modal-in 0.45s var(--ease);
}
.drawer.closing { animation: modal-out 0.28s var(--ease) both; }
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 18px)) scale(0.97); } }
@keyframes modal-out { to { opacity: 0; transform: translate(-50%, calc(-50% + 12px)) scale(0.97); } }
@media (max-width: 640px) {
  .drawer { width: calc(100vw - 20px); max-height: calc(100vh - 40px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); border-radius: 16px; }
}
.d-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.d-bar .eyebrow { margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 32px; display: grid; grid-auto-rows: max-content; gap: 22px; overscroll-behavior: contain; }
.d-scroll.swap > * { animation: rise 0.45s var(--ease) both; }
.d-scroll.swap > *:nth-child(2) { animation-delay: 40ms; } .d-scroll.swap > *:nth-child(3) { animation-delay: 80ms; } .d-scroll.swap > *:nth-child(n+4) { animation-delay: 120ms; }
.d-specimen { position: relative; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); overflow: hidden; }
.d-spec-head { display: flex; align-items: flex-start; gap: 6px; padding: 12px 12px 0; }
.d-spec-langs { display: flex; flex: 1; flex-wrap: wrap; justify-content: flex-start; gap: 6px; min-width: 0; }
.d-spec-langs button, .d-spec-tier {
  height: 26px; padding: 0 10px; border-radius: 999px; font: 500 0.75rem/1 var(--f-ui); letter-spacing: 0; white-space: nowrap;
}
.d-spec-langs button { border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); transition: border-color 0.2s, color 0.2s; }
.d-spec-langs button:hover { border-color: var(--accent-text); color: var(--accent-text); }
.d-spec-tier { flex: none; margin-left: auto; cursor: default; }
.d-specimen canvas { display: block; width: 100%; height: 290px; }
.d-chars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.d-char { border: 1px solid var(--rule); border-radius: 10px; padding: 12px; display: grid; gap: 6px; min-width: 0; }
.d-char-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.d-char-glyph { font: 400 2.4rem/1 var(--f-specimen); }
.d-char dl { display: grid; gap: 2px; margin: 0; font-size: var(--t-xs); }
.d-char dt { color: var(--ink-3); }
.d-char dd { margin: 0 0 6px; font-family: var(--f-mono); color: var(--ink-2); overflow-wrap: anywhere; }
.d-sec h3 { font: 500 var(--t-xs)/1.2 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.d-sec h3 .d-sec-chars { text-transform: none; letter-spacing: 0.02em; font-size: 1.1em; color: var(--ink-2); } /* letters keep their case: ı must not turn into I */
.d-sec p { font-size: var(--t-sm); line-height: 1.65; color: var(--ink-2); }
.d-tier { display: flex; gap: 10px; align-items: flex-start; }
.d-tier p { flex: 1; }
.lang-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lang-chips button { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--rule); background: var(--paper); font-size: var(--t-sm); transition: border-color 0.2s, color 0.2s; }
.lang-chips button:hover { border-color: var(--accent-text); color: var(--accent-text); }
.locl-box { border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--rule)); background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; }
.locl-box p { color: var(--ink); }
.copy-mini { height: 26px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--rule); background: var(--surface); font-size: 0.72rem; color: var(--ink-2); transition: color 0.2s, border-color 0.2s; }
.copy-mini:hover { color: var(--accent-text); border-color: var(--accent-text); }

/* ---------- languages view ---------- */
.lang-layout { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: clamp(20px, 4vw, 48px); padding-block: 32px 64px; align-items: start; }
.lang-list { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--mast-h) + 16px); max-height: calc(100vh - var(--mast-h) - 40px); overflow-y: auto; display: grid; gap: 14px; padding-right: 4px; }
.lang-search { position: relative; }
.lang-group h3 { margin-bottom: 6px; }
.lang-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.lang-group button {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; border-radius: 8px; background: none; text-align: left;
  font-size: var(--t-sm); color: var(--ink-2); transition: background 0.2s, color 0.2s;
}
.lang-group button:hover { background: var(--surface); color: var(--ink); }
.lang-group button[aria-current="true"] { background: var(--ink); color: var(--paper); }
.lang-group button[aria-current="true"] .mono { color: inherit; opacity: 0.7; }
.lang-group .name { flex: 1; min-width: 0; }
.lang-group .mono { font-size: 0.7rem; color: var(--ink-3); }
.lang-panel { min-width: 0; }
.lang-panel h2 { font: 300 var(--t-xxl)/1.05 var(--f-display); letter-spacing: -0.015em; }
.lang-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 14px; color: var(--ink-2); font-size: var(--t-sm); }
.charset { margin-top: 28px; border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); padding: 20px; display: grid; gap: 4px; }
.charset-row { display: flex; flex-wrap: wrap; gap: 4px; }
.charset-row button {
  min-width: 64px; height: 76px; padding: 0 10px; border: 1px solid transparent; border-radius: 10px; background: none;
  font: 400 3rem/1 var(--f-specimen); transition: background 0.25s var(--ease), border-color 0.25s, transform 0.3s var(--ease);
}
.charset-row button:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); transform: translateY(-2px); }
.charset-row button.q { position: relative; }
.charset-row .cs-paren { align-self: center; padding: 0 2px; font: 300 2rem/1 var(--f-specimen); color: var(--ink-3); }
.charset-row button.q::after { content: "*"; position: absolute; top: 6px; right: 6px; font: 500 0.75rem/1 var(--f-mono); color: var(--spec); }
.charset-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); font-size: var(--t-sm); color: var(--ink-3); }
.lang-notes { display: grid; gap: 14px; margin-top: 24px; max-width: 70ch; }
.lang-pick { display: none; }
@media (max-width: 860px) {
  .lang-layout { grid-template-columns: 1fr; padding-top: 20px; }
  .lang-list { position: static; max-height: none; overflow: visible; padding-right: 0; }
  .lang-list .lang-search, #langGroups { display: none; }
  .lang-pick { display: grid; gap: 6px; }
  .lp-eyebrow { display: none; } /* the dropdown above already says Language */
  .lang-pick .select { max-width: none; width: 100%; height: 44px; font-size: var(--t-base); }
}

/* ---------- font check ---------- */
.check-wrap { padding-block: 32px 72px; display: grid; gap: 28px; }
.check-wrap > *, .report > *, .about > *, .r-sec > * { min-width: 0; }
.check-head h2 { font: 300 var(--t-xxl)/1.05 var(--f-display); letter-spacing: -0.015em; }
.check-head p:not(.eyebrow) { margin-top: 12px; color: var(--ink-2); max-width: 64ch; font-size: var(--t-md); }
.drop {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 24px;
  border: 1.5px dashed var(--ink-3); border-radius: 14px; background: var(--surface); transition: border-color 0.25s, background 0.25s, transform 0.3s var(--ease);
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.005); }
.drop-glyph { font: 300 3.2rem/1 var(--f-display); color: var(--accent-text); }
.drop strong { display: block; font-weight: 500; }
.drop span { color: var(--ink-3); font-size: var(--t-sm); }
@media (max-width: 640px) { .drop { grid-template-columns: 1fr; text-align: left; } }
.check-promise { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.check-promise div { border-top: 1px solid var(--rule); padding-top: 12px; }
.check-promise h3 { font: 500 var(--t-base)/1.3 var(--f-ui); }
.check-promise p { margin-top: 4px; font-size: var(--t-sm); color: var(--ink-2); }
.report { display: grid; gap: 28px; }
.report-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 20px; }
.report-title h3 { font: 400 var(--t-xl)/1.1 var(--f-display); }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.meter { border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; background: var(--surface); display: grid; gap: 8px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.meter-num { font: 400 var(--t-lg)/1 var(--f-display); font-variant-numeric: tabular-nums; }
.meter-track { height: 6px; border-radius: 6px; background: var(--sunk); overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: 6px; background: var(--accent); transition: width 1.1s var(--ease); }
.meter-fill.full { background: var(--ok); }
.r-sec h3 { font: 500 var(--t-xs)/1.2 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.r-sec > p { font-size: var(--t-sm); color: var(--ink-2); margin-bottom: 10px; max-width: 70ch; }
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font: 500 var(--t-xs)/1.3 var(--f-mono); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); background: var(--paper); }
tr:last-child td { border-bottom: 0; }
td.glyphs { font: 400 1.25rem/1.3 var(--f-display); letter-spacing: 0.05em; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--ok); } .status.no { color: var(--miss); } .status.na { color: var(--ink-3); }
.opt-note { color: var(--ink-3); font-size: 0.9em; white-space: nowrap; }
.mini-bar { display: inline-block; width: 64px; height: 5px; border-radius: 5px; background: var(--sunk); vertical-align: middle; margin-right: 8px; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--accent); }
.mini-bar i.full { background: var(--ok); }
.feat-row { display: flex; flex-wrap: wrap; gap: 8px; }
.feat { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); font-size: var(--t-sm); }
.feat code { font-family: var(--f-mono); font-weight: 500; }
.missing-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.missing-grid button { width: 52px; height: 58px; border: 1px dashed var(--miss); border-radius: 8px; background: var(--miss-soft); color: var(--miss); font: 400 1.7rem/1 var(--f-display); transition: transform 0.25s var(--ease); }
.missing-grid button:hover { transform: translateY(-2px); }
.notice { border-left: 3px solid var(--spec); background: var(--spec-soft); padding: 12px 14px; border-radius: 0 8px 8px 0; font-size: var(--t-sm); }

/* ---------- about ---------- */
.about { padding-block: 40px 80px; display: grid; gap: 40px; max-width: 900px; }
.about h2 { font: 300 var(--t-xxl)/1.05 var(--f-display); letter-spacing: -0.015em; }
.about .prose { display: grid; gap: 14px; max-width: 66ch; color: var(--ink-2); font-size: var(--t-md); }
.tiers { display: grid; gap: 12px; }
.tier-def { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--rule); }
.tier-def p { color: var(--ink-2); }
@media (max-width: 560px) { .tier-def { grid-template-columns: 1fr; gap: 8px; } }
.sources { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.sources li { padding: 10px 0; border-top: 1px solid var(--rule); display: grid; gap: 2px; }
.sources a { font-weight: 500; text-decoration: none; }
.sources a:hover { text-decoration: underline; }
.sources span { font: 400 0.72rem/1.4 var(--f-mono); color: var(--ink-3); overflow-wrap: anywhere; }

/* ---------- footer, toast ---------- */
.foot { border-top: 1px solid var(--rule); padding-block: 22px 88px; /* room below for the back-to-top button */ color: var(--ink-3); font-size: var(--t-sm); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-size: var(--t-sm); opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease); max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- credits ---------- */
.credits { list-style: none; margin: 12px 0 0; padding: 0; display: grid; max-width: 70ch; }
.credits li { padding: 10px 0; border-top: 1px solid var(--rule); font-size: var(--t-sm); line-height: 1.6; color: var(--ink-2); }
.credits strong { color: var(--ink); font-weight: 600; }
.foot a { color: inherit; }

/* ---------- designer ---------- */
.designer { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: clamp(28px, 6vw, 80px); padding-block: 48px 88px; align-items: start; }
.portrait { margin: 0; position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--mast-h) + 24px); }
.portrait .monogram, .portrait img {
  display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 5; max-width: 100%; border-radius: 16px; object-fit: cover;
}
.portrait .monogram {
  background: var(--surface); border: 1px solid var(--rule); color: var(--accent-text);
  font: 300 clamp(4rem, 10vw, 7.5rem)/1 var(--f-display); letter-spacing: -0.02em;
}
.portrait figcaption { margin-top: 10px; font: 500 var(--t-xs)/1.2 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.designer-text { min-width: 0; max-width: 64ch; display: grid; gap: 28px; }
.designer-text h2 { font: 300 var(--t-xxl)/1.04 var(--f-display); letter-spacing: -0.015em; margin-top: -16px; }
.designer-lede { font: 300 var(--t-lg)/1.4 var(--f-display); color: var(--ink); }
.story { display: grid; gap: 12px; padding-top: 22px; border-top: 1px solid var(--rule); }
.story h3 { font: 500 var(--t-xs)/1.2 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); }
.story p { font-size: var(--t-md); line-height: 1.65; color: var(--ink-2); }
.pull { margin: 8px 0 0; padding-left: 18px; border-left: 2px solid var(--accent); font: 300 italic var(--t-lg)/1.4 var(--f-display); color: var(--ink); }
.ph { color: var(--ink-3); background: var(--sunk); border-radius: 4px; padding: 1px 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
@media (max-width: 760px) {
  .designer { grid-template-columns: 1fr; padding-block: 28px 64px; }
  .portrait { position: static; max-width: 260px; }
  .designer-text h2 { margin-top: -10px; }
}

/* ---------- unicode card in mark sections ---------- */
.g-uni { margin-top: 18px; }
.g-uni .note-h { margin-bottom: 8px; }
.gu-card { border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); }
.gu-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 2px 12px; padding: 10px 12px; }
.gu-row + .gu-row { border-top: 1px solid var(--rule); }
.gu-label { font-size: var(--t-sm); color: var(--ink-3); }
.gu-code { font: 500 0.8125rem/1.4 var(--f-mono); color: var(--ink); overflow-wrap: anywhere; }
.gu-hint { grid-column: 2; font-size: 0.75rem; line-height: 1.45; color: var(--ink-3); }
.gu-blocks { display: flex; flex-wrap: wrap; gap: 4px; }
.gu-block { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--sunk); font-size: 0.72rem; color: var(--ink-2); }

/* ---------- mark families ---------- */
.mi-family { display: flex; align-items: center; gap: 10px; margin: 0; font: 500 0.6875rem/1.2 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.mi-family::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.family-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 56px 0 14px; font: 500 var(--t-xs)/1.2 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-text); border-top: 1px solid var(--rule); }
.family-h .family-n { color: var(--ink-3); letter-spacing: 0.04em; }
.family-h + .group { border-top: 0; padding-top: 16px; }

.c-glyphs.wide { font-size: 2.5rem; } /* digraph letters (dž) are twice as wide */

/* ---------- filters on phones: one control per row, segmented controls wrap inside the screen ---------- */
@media (max-width: 860px) {
  .filters.open .more-filters { flex-direction: column; align-items: stretch; gap: 10px; }
  .more-filters > .ctl, .more-filters > .chip { width: 100%; min-width: 0; }
  .more-filters > .ctl { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 8px; }
  .more-filters > .chip { justify-content: center; }
  .more-filters .seg { display: flex; flex-wrap: wrap; min-width: 0; }
  .more-filters .seg button { flex: 1 1 auto; padding: 6px 8px; }
  .more-filters #tierChips { display: flex; flex-wrap: wrap; gap: 6px; }
  .more-filters .select { max-width: none; width: 100%; }
  .result-line { width: 100%; justify-content: space-between; }
  .filters.open { max-height: calc(100vh - var(--mast-h) - env(safe-area-inset-top, 0px)); overflow-y: auto; }
}

/* ---------- back to top ---------- */
.to-top {
  position: fixed; z-index: 55;
  right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--rule); background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(14px) scale(0.9); pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease), background 0.2s, color 0.2s, border-color 0.2s;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.to-top:hover svg { transform: translateY(-2px); }
.to-top svg { width: 22px; height: 22px; transition: transform 0.3s var(--ease); }
@media (max-width: 640px) { .to-top { width: 44px; height: 44px; right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); } }

/* byline in the masthead */
.brand-by { font: 400 0.75rem/1 var(--f-ui); color: var(--ink-3); letter-spacing: 0.01em; white-space: nowrap; }
@media (max-width: 900px) { .brand-by { display: none; } }

/* ---------- contact links (Author page) ---------- */
.contact-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.contact-link {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font-size: var(--t-sm); font-weight: 500; text-decoration: none;
  transition: border-color 0.2s, color 0.2s, transform 0.15s var(--ease);
}
.contact-link::after { content: "↗"; color: var(--accent-text); font-size: 0.9em; }
.contact-link:hover { border-color: var(--accent-text); color: var(--accent-text); }
.contact-link:active { transform: scale(0.97); }
.contact-link.is-empty { border-style: dashed; color: var(--ink-3); background: var(--sunk); cursor: default; }
.contact-link.is-empty::after { content: "address missing"; color: var(--ink-3); font: 400 0.6875rem/1 var(--f-mono); }
.contact-link.is-empty:hover { border-color: var(--rule); color: var(--ink-3); }
.d-allnotes { display: inline-block; margin-top: 12px; cursor: pointer; }
.d-allnotes:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 480px) { .d-chars { grid-template-columns: 1fr; } }

/* ---------- glossary (Colophon) ---------- */
.glossary { display: grid; gap: 14px; }
.gl-lede { color: var(--ink-2); font-size: var(--t-md); max-width: 60ch; }

.gl-group { margin-top: 18px; }
.gl-h { font: 500 var(--t-xs)/1.2 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 4px; }
.gl-note { color: var(--ink-2); font-size: var(--t-sm); margin: 6px 0 4px; max-width: 66ch; }
.gl { margin: 0; display: grid; }
.gl-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--rule); }
.gl-row dt { display: grid; gap: 4px; align-content: start; }
.gl-term { font-weight: 600; color: var(--ink); }
.gl-ex { font: 400 1.5rem/1.1 var(--f-specimen); color: var(--ink); }
.gl-code { font: 400 0.75rem/1.4 var(--f-mono); color: var(--ink-3); overflow-wrap: anywhere; }
.gl-row dd { margin: 0; color: var(--ink-2); line-height: 1.6; }
@media (max-width: 560px) { .gl-row { grid-template-columns: 1fr; gap: 6px; } }
.glossary .tiers { gap: 0; }
.glossary .tier-def { grid-template-columns: 220px minmax(0, 1fr); padding: 14px 0; }
.glossary .tier-def p { line-height: 1.6; }
.glossary .tiers > p.eyebrow { padding-top: 14px; border-top: 1px solid var(--rule); }
@media (max-width: 560px) { .glossary .tier-def { grid-template-columns: 1fr; gap: 8px; } }

/* ---------- other OpenType / spacing flags ---------- */
.feat { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; background: var(--sunk); color: var(--ink-2); font: 500 0.6875rem/1 var(--f-mono); cursor: help; }
.feat-box { border: 1px solid var(--rule); background: var(--surface); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; margin-bottom: 8px; }
.feat-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.feat-label { font-weight: 600; font-size: var(--t-sm); color: var(--ink); }
.feat-letters { margin-left: auto; font: 400 1.05rem/1 var(--f-specimen); color: var(--ink-2); white-space: pre; }
.feat-box p { color: var(--ink-2); font-size: var(--t-sm); line-height: 1.6; }
.feat-for { font: 600 1rem/1 var(--f-specimen); color: var(--ink); margin-right: 8px; }

/* ---------- glyph names ---------- */
.gl-name { font-family: var(--f-mono); color: var(--ink); }
.gl-prod { font-family: var(--f-mono); color: var(--ink-3); }
.d-char dd.gl-hint { font-family: var(--f-ui); font-size: 0.75rem; line-height: 1.45; color: var(--ink-3); margin-top: -2px; }
.gu-glyphs { display: flex; flex-wrap: wrap; gap: 4px; }
.gu-glyph { display: inline-flex; align-items: center; padding: 2px 6px; border-radius: 4px; background: var(--sunk); font: 500 0.75rem/1.4 var(--f-mono); color: var(--ink); }
.gu-glyph-note { font: 400 0.6875rem/1.4 var(--f-ui); color: var(--ink-3); margin-left: 4px; }
.d-char { align-content: start; }

/* ---------- decomposition table (letter panel) ----------
   Columns are the parts of the decomposition (base letter, mark); rows give the character, its code point
   and the glyph a font usually uses for it. */
.dc-table { width: 100%; border-collapse: collapse; margin-top: 2px; font-size: 0.75rem; table-layout: auto; }
.dc-table th, .dc-table td { background: none; text-align: left; vertical-align: top; padding: 6px 8px 6px 0; border-top: 1px solid var(--rule); border-bottom: 0; }
.dc-table thead th { border-top: 0; padding-top: 2px; }
.dc-rh { width: 76px; white-space: nowrap; font: 500 0.625rem/1.6 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.dc-table thead .dc-rh { line-height: 1; }
.dc-ch { font: 400 1.25rem/1 var(--f-specimen); color: var(--ink); text-transform: none; letter-spacing: 0; }
.dc-mark { font-family: "Noto Serif Atlas", "Noto Serif", Georgia, serif; }
.dc-cp { font-family: var(--f-mono); color: var(--ink-2); white-space: nowrap; }
.dc-gl { font-family: var(--f-mono); color: var(--ink); overflow-wrap: anywhere; }
.dc-gl.dc-special { color: var(--accent-text); }
.dc-note { display: block; margin-top: 3px; font: 400 0.6875rem/1.35 var(--f-ui); color: var(--ink-3); }
.d-char dd .dc-table { font-family: var(--f-ui); }
.dc-alt { color: var(--ink-2); }
.dc-none { color: var(--ink-3); cursor: help; padding: 0 6px; margin-left: -6px; border-radius: 4px; }
.dc-none:hover, .dc-none:focus-visible { background: var(--sunk); color: var(--ink); }
@media (max-width: 480px) { .dc-table { font-size: 0.6875rem; } .dc-rh { width: 74px; } }
.d-char dd .gl-name + .gl-tag { margin-left: 8px; }
.gl-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; vertical-align: 1px;
  background: var(--sunk); color: var(--ink-3); font: 500 0.625rem/1 var(--f-mono); letter-spacing: 0.02em; cursor: help; white-space: nowrap; }
.gl-tag-alt { background: var(--accent-soft); color: var(--accent-text); }
.gl-tag:hover, .gl-tag:focus-visible { color: var(--ink); }
/* names table: the whole letter first, set off from the parts of its decomposition by a fine rule */
.dc-table .dc-whole { padding-right: 10px; }
.dc-table .dc-first { padding-left: 10px; border-left: 1px solid var(--rule); }
.dc-table thead .dc-whole { font-weight: 400; }
.dc-caption { caption-side: bottom; text-align: left; padding-top: 8px; font: 400 0.75rem/1.45 var(--f-ui); color: var(--ink-3); }
/* letter names under each letter in the specimen box, below the descender line */
.d-spec-names { position: absolute; left: 0; right: 0; top: 0; height: 0; }
.dsn-legend, .dsn-block { position: absolute; top: 0; display: grid; grid-auto-rows: 15px; font: 400 0.6875rem/15px var(--f-mono); }
.dsn-legend { left: 10px; font-weight: 500; font-size: 0.625rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.dsn-block { transform: translateX(-50%); justify-items: center; white-space: nowrap; }
.dsn-prod, .dsn-aglfn { color: var(--ink-2); }
.dsn-glyphs { color: var(--ink); }
.dsn-glyphs.dc-special { color: var(--accent-text); }
.gu-label.has-tip { justify-self: start; cursor: help; text-decoration: underline dotted; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
.gu-label.has-tip:hover, .gu-label.has-tip:focus-visible { color: var(--ink); outline: none; }

/* ---------- foldable mark details ---------- */
.group { position: relative; }
.g-fold {
  position: absolute; right: 0; top: 0; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.g-fold:hover { border-color: var(--accent-text); color: var(--accent-text); }
.g-fold-ic { width: 9px; height: 9px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: translateY(2px) rotate(225deg); transition: transform 0.35s var(--ease); }
.group.folded .g-fold-ic { transform: translateY(-2px) rotate(45deg); }
.g-info, .g-cards-fold { display: grid; grid-template-rows: 1fr; min-width: 0; transition: grid-template-rows 0.45s var(--ease), opacity 0.3s; }
.g-info-inner, .g-cards-inner { min-height: 0; min-width: 0; overflow: hidden; }
.g-cards-inner { margin: -8px; padding: 8px; } /* room for the cards' hover lift and shadow */
.group.folded .g-info, .group.folded .g-cards-fold { grid-template-rows: 0fr; opacity: 0; }
.g-info.no-anim, .g-cards-fold.no-anim { transition: none; }
@media (prefers-reduced-motion: reduce) { .g-info, .g-cards-fold, .g-fold-ic { transition: none; } }
@media (max-width: 860px) { .g-title { padding-right: 44px; } }
/* Turkish case pair tag (i ↔ İ, ı ↔ I) */
.casepair { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; background: var(--spec-soft); color: var(--spec); font: 500 0.6875rem/1 var(--f-mono); cursor: help; }
.d-char dd.case-dd { font-family: var(--f-ui); font-size: var(--t-sm); color: var(--ink-2); line-height: 1.5; }
.d-char dd.case-dd .casepair { vertical-align: 1px; margin-right: 2px; }
.casepair.is-default { background: var(--sunk); color: var(--ink-2); }

/* labels in the letter pop-up that explain themselves on hover or focus */
.d-char dt.has-tip, .dc-rh.has-tip, .dsn-legend .has-tip { cursor: help; text-decoration: underline dotted; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
.d-char dt.has-tip { justify-self: start; width: fit-content; }
.d-char dt.has-tip:hover, .dc-rh.has-tip:hover, .dsn-legend .has-tip:hover, .d-char dt.has-tip:focus-visible, .dc-rh.has-tip:focus-visible, .dsn-legend .has-tip:focus-visible { color: var(--ink); outline: none; }

/* phones: a compact two-column list instead of the tall tile grid (desktop keeps the tiles) */
@media (max-width: 640px) {
  .mark-index { display: grid; grid-template-columns: 1fr; gap: 14px; padding-block: 14px 16px; }
  .mark-index .mi-fam { display: grid; grid-template-columns: 1fr; grid-column: auto !important; row-gap: 4px; }
  .mark-index .mi-fam .mi-family { padding-right: 0; margin-bottom: 2px; }
  .mark-index .mi-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; }
  .mark-index a { flex-direction: row; align-items: center; gap: 8px; padding: 5px 8px 5px 4px; border-radius: 8px; }
  .mark-index .mi-glyph { width: 28px; height: 28px; flex: none; }
  .mark-index .mi-name { flex: 1 1 auto; min-width: 0; font-size: 0.75rem; text-align: left; text-wrap: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mark-index .mi-count { flex: none; }
}
