/* GlamGlyphs v2 — "The Glyph Edit"
   A fashion-magazine take on a type-specimen book. See .impeccable.md.
   Tokens → base → chrome (ticker, header, footer) → tools → content → home → responsive */

@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('fonts/fraunces-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+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Fraunces'; font-style: italic; font-weight: 400 800; font-display: swap; src: url('fonts/fraunces-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+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('fonts/instrument-sans-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }

:root {
  /* Paper, ink and berry — neutrals tinted toward the brand hue */
  --paper: oklch(97.6% 0.012 62);
  --paper-2: oklch(95.2% 0.017 52);
  --paper-3: oklch(92.4% 0.022 45);
  --card: oklch(99.2% 0.006 62);
  --ink: oklch(19% 0.035 335);
  --ink-2: oklch(36% 0.035 335);
  --ink-3: oklch(47% 0.03 335);
  --line: oklch(87% 0.018 340);
  --line-2: oklch(79% 0.025 340);
  --berry: oklch(48% 0.19 358);
  --berry-deep: oklch(37% 0.15 358);
  --blush: oklch(93% 0.04 355);
  --blush-2: oklch(87% 0.075 355);
  --lilac: oklch(93% 0.035 305);
  --lilac-ink: oklch(36% 0.11 300);
  --plum: oklch(27% 0.075 330);
  --mint: oklch(47% 0.1 165);
  --mint-bg: oklch(94% 0.045 165);
  --error: oklch(48% 0.17 28);
  --error-bg: oklch(94% 0.03 28);
  --focus: oklch(55% 0.22 300);

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Glyph previews use system fonts so Unicode renders as it will after pasting */
  --glyph: system-ui, -apple-system, 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', 'Noto Sans Symbols 2', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;

  --r-xs: 4px; --r-sm: 8px; --r: 12px; --r-pill: 999px;
  --wrap: 1240px;
  --gutter: clamp(16px, 4.2vw, 40px);
  --header-h: 68px;
  --ticker-h: 36px;
  --ease: cubic-bezier(.25, 1, .5, 1);
  --shadow-pop: 0 1px 0 oklch(19% 0.035 335 / .04), 0 18px 40px -18px oklch(30% 0.12 358 / .35);
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 20px); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.6 var(--sans); overflow-wrap: break-word; -webkit-font-smoothing: antialiased; }
body.has-scratch { padding-bottom: 88px; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1, h2 { font-family: var(--serif); font-weight: 650; letter-spacing: -0.02em; line-height: 1.05; font-optical-sizing: auto; }
h1 { font-size: clamp(2.5rem, 1.6rem + 4.2vw, 5.25rem); }
h2 { font-size: clamp(1.7rem, 1.25rem + 1.6vw, 2.6rem); }
h1 em, h2 em { font-style: italic; color: var(--berry); font-weight: 600; }
h3 { font: 650 1.05rem/1.3 var(--sans); letter-spacing: -0.005em; }
p { margin: 0 0 1em; }
a { color: var(--berry-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--berry); }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--blush-2); color: var(--ink); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -80px; z-index: 300; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--r-sm); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; color: var(--paper); }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.muted { color: var(--ink-3); }

/* ── Ticker ── */
.ticker { position: relative; z-index: 101; background: var(--ink); color: var(--paper); height: var(--ticker-h); display: flex; align-items: center; overflow: hidden; font-size: .8rem; }
.ticker-label { flex-shrink: 0; display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 14px 0 var(--gutter); background: var(--ink); position: relative; z-index: 2; font: italic 600 .9rem/1 var(--serif); color: oklch(86% 0.06 355); }
.ticker-viewport { flex: 1; overflow: hidden; height: 100%; mask-image: linear-gradient(90deg, transparent, #000 3%, #000 94%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 94%, transparent); }
.ticker-track { display: flex; width: max-content; height: 100%; animation: ticker 80s linear infinite; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track, .ticker.is-paused .ticker-track { animation-play-state: paused; }
.ticker-track button { background: none; border: 0; color: var(--paper); height: 100%; padding: 0 14px; font: 1rem/1 var(--glyph); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.ticker-track button span { font: 500 .72rem/1 var(--sans); color: oklch(78% 0.03 335); }
.ticker-track button:hover { background: var(--plum); }
.ticker-track button.is-copied { background: var(--mint); }
.ticker-pause { flex-shrink: 0; background: var(--ink); border: 0; color: oklch(86% 0.06 355); height: 100%; padding: 0 var(--gutter) 0 14px; font: 600 .78rem/1 var(--sans); }
.ticker-pause:hover { color: var(--paper); }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ── Header ── */
.site-header { position: sticky; top: 0; z-index: 100; background: oklch(97.6% 0.012 62 / .92); backdrop-filter: saturate(1.3) blur(12px); -webkit-backdrop-filter: saturate(1.3) blur(12px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; transition: transform .5s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); }
.brand-name { font: 700 1.5rem/1 var(--serif); letter-spacing: -0.03em; }
.brand-name b { font-style: italic; font-weight: 600; color: var(--berry); }
.primary-nav { display: flex; align-items: center; gap: 2px; }
.primary-nav a { position: relative; white-space: nowrap; display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: .93rem; }
.primary-nav a::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 6px; height: 1.5px; background: var(--berry); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.primary-nav a:hover { color: var(--ink); }
.primary-nav a:hover::after, .primary-nav a[aria-current="page"]::after { transform: scaleX(1); }
.primary-nav a[aria-current="page"] { color: var(--berry-deep); }
.header-search { margin-inline-start: auto; position: relative; width: min(280px, 26vw); }
.header-search input { width: 100%; height: 40px; padding-block: 0; padding-inline: 38px 14px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--card); font-size: .9rem; }
.header-search input::placeholder { color: var(--ink-3); }
.header-search input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--blush); }
.header-search svg { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.menu-toggle { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-weight: 600; font-size: .9rem; }
.menu-toggle:hover { background: var(--plum); }
.menu-toggle svg { width: 16px; height: 16px; }
.menu-toggle[aria-expanded="true"] { background: var(--berry); border-color: var(--berry); }

/* All-tools panel: in-flow disclosure, not a modal */
.tools-panel { border-top: 1px solid var(--line); background: var(--paper); max-height: calc(100vh - var(--header-h)); overflow-y: auto; }
.tools-panel[hidden] { display: none; }
.tools-panel .wrap { padding-top: 28px; padding-bottom: 32px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.tools-panel h2 { font: italic 600 1.15rem/1.1 var(--serif); color: var(--berry-deep); margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.tools-panel ul { list-style: none; margin: 0; padding: 0; }
.tools-panel a { display: flex; align-items: center; gap: 12px; padding: 6px 0; color: var(--ink); text-decoration: none; font-size: .95rem; }
.tools-panel a:hover { color: var(--berry); }
.tools-panel a[aria-current="page"] { color: var(--berry); font-weight: 650; }
.tools-panel .tp-glyph { width: 40px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; font: 1.05rem/1 var(--glyph); color: var(--berry); }
.tools-panel .tp-glyph.is-multi { font-size: .78rem; letter-spacing: -.02em; }

/* ── Page head ── */
.page-head { padding-top: clamp(28px, 4vw, 56px); padding-bottom: clamp(18px, 2.5vw, 30px); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px 40px; }
.crumbs { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; font-size: .82rem; color: var(--ink-3); margin: 0 0 6px; padding: 0; list-style: none; }
.crumbs li + li::before { content: '/'; margin-inline-end: 8px; color: var(--line-2); }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--berry); text-decoration: underline; }
.page-head h1 { max-width: 16ch; }
.h1-sub { display: block; font: 500 clamp(1.05rem, .95rem + .5vw, 1.4rem)/1.3 var(--sans); letter-spacing: 0; color: var(--ink-3); margin-top: 10px; }
.page-head .lede { max-width: 54ch; }
.head-glyph { font: 400 clamp(3.5rem, 2rem + 6vw, 7.5rem)/1 var(--glyph); color: var(--berry); align-self: center; justify-self: end; opacity: .9; user-select: none; }
.lede { font-size: clamp(1.02rem, .96rem + .3vw, 1.18rem); color: var(--ink-2); margin: 14px 0 0; line-height: 1.55; }
.reveal > * { animation: rise .9s var(--ease) both; }
.reveal > :nth-child(2) { animation-delay: .06s; } .reveal > :nth-child(3) { animation-delay: .12s; } .reveal > :nth-child(4) { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ── Tool surface ── */
.tool { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(16px, 2.6vw, 28px); box-shadow: 0 1px 0 oklch(19% 0.035 335 / .03); }
.field-label { display: block; font: 600 .95rem/1.2 var(--sans); color: var(--ink); margin-bottom: 10px; }
.field-hint { font-size: .85rem; color: var(--ink-3); margin: 8px 0 0; }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.text-input { flex: 1; min-width: 0; height: 60px; padding: 0 18px; font-size: 1.15rem; border: 1.5px solid var(--ink); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); transition: box-shadow .2s, background-color .2s; }
.text-input::placeholder { color: var(--ink-3); }
.text-input:focus { outline: none; background: var(--card); box-shadow: 0 0 0 4px var(--blush-2); }
.search-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.search-wrap > svg { position: absolute; inset-inline-start: 18px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--ink-2); pointer-events: none; }
.search-wrap .text-input { padding-inline: 50px 48px; }
.clear-btn { position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; }
.clear-btn:hover { background: var(--blush); color: var(--ink); }
.clear-btn[hidden] { display: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: var(--r-pill); border: 1.5px solid transparent; font-weight: 600; font-size: .93rem; text-decoration: none; white-space: nowrap; transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--ease); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--berry); color: var(--paper); }
.btn-primary:hover { background: var(--berry-deep); color: var(--paper); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--plum); color: var(--paper); }
.btn-ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .86rem; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); text-decoration: none; border-bottom: 1.5px solid var(--berry); padding-bottom: 2px; }
.link-arrow:hover { color: var(--berry); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chip { flex-shrink: 0; min-height: 38px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font-weight: 550; font-size: .87rem; display: inline-flex; align-items: center; text-decoration: none; transition: background-color .15s, border-color .15s, color .15s; }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip .count { font-weight: 500; color: var(--ink-3); margin-inline-start: 6px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .count { color: oklch(85% 0.03 335); }

.result-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 20px 0 12px; font-size: .86rem; color: var(--ink-3); }
.result-meta strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Collection layout with specimen panel */
.collection { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.collection-main { min-width: 0; }

/* Glyph table: hairline specimen grid */
.glyph-grid { --cell: 112px; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--cell), 1fr)); border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); }
.glyph-grid.is-wide { --cell: 250px; }
.glyph { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 108px; padding: 14px 8px 12px; border: 0; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: center; transition: background-color .18s var(--ease), color .18s; }
.glyph:hover, .glyph.is-active { background: var(--blush); }
.glyph:hover .glyph-char { transform: scale(1.12); }
.glyph:focus-visible { outline-offset: -3px; z-index: 1; }
.glyph-char { font: 400 1.9rem/1.15 var(--glyph); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: transform .35s var(--ease); }
.glyph-name { font: 500 .76rem/1.25 var(--sans); color: var(--ink-3); max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.glyph.is-long .glyph-char { font-size: 1.15rem; white-space: normal; overflow-wrap: anywhere; }
.is-wide .glyph { align-items: flex-start; text-align: start; min-height: 92px; padding: 16px 18px; }
.is-wide .glyph-char { font-size: 1.08rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; text-overflow: clip; }
.is-wide .glyph:hover .glyph-char { transform: none; }
.glyph-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--ink); color: var(--paper); font: 600 .88rem/1 var(--sans); opacity: 0; pointer-events: none; transition: opacity .15s; }
.glyph.is-copied .glyph-state { opacity: 1; }
.group-block + .group-block { margin-top: 30px; }
.group-block[hidden] { display: none; }
.group-title { display: flex; align-items: baseline; gap: 12px; margin: 0 0 12px; font: 650 1.3rem/1.15 var(--serif); letter-spacing: -0.01em; }
.group-title .count { font: 500 .85rem/1 var(--sans); color: var(--ink-3); }
.group-note { font-size: .88rem; color: var(--ink-3); margin: -4px 0 12px; }

/* Specimen panel */
.specimen { position: sticky; top: calc(var(--header-h) + 20px); border: 1px solid var(--ink); border-radius: var(--r); background: var(--paper); overflow: hidden; }
.specimen-stage { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--blush); border-bottom: 1px solid var(--ink); overflow: hidden; }
.specimen-stage::before, .specimen-stage::after { content: ''; position: absolute; background: oklch(48% 0.19 358 / .18); }
.specimen-stage::before { left: 50%; top: 10%; bottom: 10%; width: 1px; }
.specimen-stage::after { top: 50%; left: 10%; right: 10%; height: 1px; }
.specimen-char { position: relative; z-index: 1; font: 400 6.5rem/1 var(--glyph); color: var(--ink); max-width: 90%; text-align: center; overflow-wrap: anywhere; }
.specimen-char.is-long { font-size: 2.1rem; line-height: 1.3; }
.specimen-body { padding: 16px 18px 18px; }
.specimen-name { font: 650 1.3rem/1.2 var(--serif); margin: 0 0 12px; }
.specimen-meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; font-size: .82rem; }
.specimen-meta dt { color: var(--ink-3); font-size: .8rem; font-weight: 550; align-self: center; }
.specimen-meta dd { margin: 0; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .8rem; color: var(--ink); overflow-wrap: anywhere; }
.specimen-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.specimen-actions .btn { width: 100%; padding: 0 10px; }
.specimen-actions .btn:first-child { grid-column: 1 / -1; }
.specimen-hint { font-size: .78rem; color: var(--ink-3); margin: 12px 0 0; }
.specimen { max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; }
body.has-scratch .specimen { max-height: calc(100vh - var(--header-h) - 130px); }
@media (max-height: 820px) { .specimen-hint { display: none; } .specimen-stage { aspect-ratio: 16 / 10; } }

/* Generator rows: specimen lines */
.style-list { display: grid; border-top: 1px solid var(--line); }
.style-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px 4px 16px 0; border-bottom: 1px solid var(--line); transition: background-color .18s; }
.style-row:hover { background: linear-gradient(90deg, var(--blush), transparent 85%); }
.style-row:hover .style-name { color: var(--ink-2); }
.style-name { display: flex; align-items: center; gap: 8px; font: 550 .84rem/1 var(--sans); color: var(--ink-3); margin-bottom: 8px; }
.style-out { font: 400 1.5rem/1.3 var(--glyph); color: var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; min-height: 1.3em; }
.style-row:first-child .style-out { font-size: 1.85rem; }
.tag { display: inline-block; padding: 3px 7px; border-radius: var(--r-pill); font: 650 .62rem/1 var(--sans); letter-spacing: .06em; background: var(--lilac); color: var(--lilac-ink); }
.tag.hot { background: var(--blush-2); color: var(--berry-deep); }
.tag.warn { background: oklch(94% 0.05 80); color: oklch(40% 0.09 70); }
.copy-btn { min-width: 92px; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font-weight: 600; font-size: .88rem; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background-color .15s, color .15s; }
.copy-btn:hover { background: var(--ink); color: var(--paper); }
.copy-btn.is-copied { background: var(--mint); border-color: var(--mint); color: var(--paper); }
.copy-btn svg { width: 15px; height: 15px; }

/* Empty / fallback / feedback */
.empty { display: grid; justify-items: center; gap: 8px; padding: 40px 16px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--ink-2); background: var(--paper); }
.empty[hidden] { display: none; }
.empty .empty-glyph { font: italic 500 2.6rem/1 var(--serif); color: var(--berry); }
.empty p { margin: 0; max-width: 46ch; }
.link-btn { background: none; border: 0; padding: 4px 2px; color: var(--berry-deep); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--berry); }

.manual-copy { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 160; width: min(520px, calc(100vw - 24px)); padding: 18px; border-radius: var(--r); background: var(--card); border: 1.5px solid var(--ink); box-shadow: var(--shadow-pop); }
.manual-copy[hidden] { display: none; }
.manual-copy p { margin: 0 0 10px; font-size: .92rem; color: var(--ink-2); }
.manual-copy p strong { color: var(--ink); }
.manual-copy textarea { width: 100%; min-height: 64px; padding: 10px 12px; border: 1.5px solid var(--berry); border-radius: var(--r-sm); font: 1.15rem var(--glyph); resize: vertical; background: var(--paper); }
.manual-copy .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 170; transform: translate(-50%, 16px); display: inline-flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 12px 20px; border-radius: var(--r-pill); background: var(--ink); color: var(--paper); font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-pop); opacity: 0; pointer-events: none; transition: opacity .2s, transform .35s var(--ease); }
body.has-scratch .toast { bottom: 96px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .tick { color: oklch(85% 0.12 165); }
.toast-glyph { font-family: var(--glyph); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Scratchpad: collects copies so people can build a whole line */
.scratch { position: fixed; left: 0; right: 0; bottom: 0; z-index: 150; background: var(--ink); color: var(--paper); padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 32px -16px oklch(19% 0.035 335 / .5); transition: transform .4s var(--ease); }
.scratch[hidden] { display: none; }
.scratch-inner { max-width: var(--wrap); margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.scratch-label { flex-shrink: 0; font: italic 500 1.15rem/1 var(--serif); color: oklch(86% 0.06 355); }
.scratch-label small { display: block; font: 500 .74rem/1.2 var(--sans); color: oklch(72% 0.03 335); margin-top: 4px; font-style: normal; }
.scratch input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid oklch(40% 0.04 335); background: oklch(25% 0.04 335); color: var(--paper); font: 1.15rem var(--glyph); }
.scratch input:focus { outline: none; border-color: oklch(86% 0.06 355); }
.scratch .btn-primary { min-height: 46px; }
.scratch .icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: oklch(80% 0.03 335); font-size: 1.2rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.scratch .icon-btn:hover { background: oklch(30% 0.05 335); color: var(--paper); }

/* ── Content sections ── */
.section { padding: clamp(40px, 6vw, 80px) 0; }
.section-rule { border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.section-head p { margin: 10px 0 0; color: var(--ink-2); max-width: 58ch; }
.prose { max-width: 66ch; color: var(--ink-2); font-size: 1.04rem; }
.prose h2 { color: var(--ink); margin: 0 0 18px; }
.prose h3 { color: var(--ink); margin: 26px 0 8px; }
.prose ul, .prose ol { padding-inline-start: 1.2em; margin: 0 0 1.1em; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--berry); }
.prose strong { color: var(--ink); }
.prose code, .inline-glyph { font-family: var(--glyph); background: var(--blush); color: var(--ink); padding: 1px 7px; border-radius: var(--r-xs); font-size: .95em; white-space: nowrap; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 26px 0 0; display: grid; border-top: 1px solid var(--line); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 56px 1fr; gap: 4px 16px; padding: 18px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); margin: 0; }
.steps li::before { content: counter(step, decimal-leading-zero); grid-row: span 2; font: italic 500 2rem/1 var(--serif); color: var(--berry); }
.steps li strong { color: var(--ink); font-weight: 650; }
.notes-col { display: grid; gap: 14px; }
.note { padding: 18px 20px; border-radius: var(--r); background: var(--paper-2); color: var(--ink-2); font-size: .95rem; }
.note strong { color: var(--ink); }
.note p:last-child { margin-bottom: 0; }
.compat-table { width: 100%; border-collapse: collapse; font-size: .93rem; margin: 6px 0 14px; }
.compat-table th, .compat-table td { text-align: start; padding-block: 12px; padding-inline: 0 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.compat-table th { font: 650 .88rem/1.2 var(--sans); color: var(--ink); border-bottom: 1.5px solid var(--ink); }
.table-scroll { overflow-x: auto; }

.faq { display: grid; max-width: 900px; border-top: 1px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 20px 52px 20px 0; font: 650 clamp(1.08rem, 1rem + .3vw, 1.25rem)/1.35 var(--serif); position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); font: 300 1.8rem/1 var(--sans); color: var(--berry); transition: transform .3s var(--ease); }
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq details > div { padding: 0 0 20px; color: var(--ink-2); max-width: 70ch; }
.faq details > div p:last-child { margin-bottom: 0; }

/* Related tools / directory: editorial index rows */
.index-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; border-top: 1px solid var(--ink); }
.index-list a { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.index-list .ix-glyph { font: 400 1.8rem/1 var(--glyph); color: var(--berry); text-align: center; transition: transform .4s var(--ease); white-space: nowrap; }
.index-list .ix-glyph.is-multi { font-size: 1.15rem; letter-spacing: -.02em; }
.index-list .ix-title { display: block; font: 650 1.2rem/1.2 var(--serif); }
.index-list .ix-desc { display: block; font-size: .86rem; color: var(--ink-3); margin-top: 3px; }
.index-list .ix-arrow { color: var(--ink-3); transition: transform .3s var(--ease), color .2s; }
.index-list a:hover .ix-glyph { transform: scale(1.18) rotate(-6deg); }
.index-list a:hover .ix-arrow { transform: translateX(4px); color: var(--berry); }
.index-list a:hover .ix-title { color: var(--berry-deep); }

/* ── Ad slots ──
   Reserved positions only between content sections — never adjacent to inputs,
   results, copy buttons, the scratchpad or navigation. Hidden until ads are
   approved (add class "ads-enabled" to <body>); then min-height prevents CLS. */
.ad-slot { display: none; }
.ads-enabled .ad-slot { display: block; margin: 12px auto; max-width: var(--wrap); padding: 0 var(--gutter); }
.ads-enabled .ad-slot::before { content: attr(aria-label); display: block; font-size: .68rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 6px; text-align: center; }
.ads-enabled .ad-slot .ad-box { min-height: 280px; }

/* ── Home ── */
.home-hero { padding-top: clamp(20px, 3.5vw, 48px); padding-bottom: clamp(20px, 3vw, 36px); display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: clamp(24px, 4vw, 64px); align-items: end; }
.home-hero h1 { font-size: clamp(2.7rem, 1.4rem + 5.4vw, 6rem); line-height: 1; letter-spacing: -0.03em; }
.home-hero .lede { max-width: 46ch; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 22px; font-size: .86rem; color: var(--ink-2); }
.hero-stats b { font: 600 1.25rem/1 var(--serif); color: var(--ink); margin-inline-end: 4px; }
.hero-specimen { position: relative; border: 1px solid var(--ink); border-radius: var(--r); background: var(--card); overflow: hidden; }
.hero-specimen .specimen-stage { aspect-ratio: 5 / 4; background: radial-gradient(120% 90% at 30% 20%, var(--blush) 0%, var(--blush-2) 75%); }
.hero-specimen .specimen-char { font-size: 9rem; }
.hero-specimen .specimen-body { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-specimen .specimen-name { margin: 0; font-size: 1.2rem; }
.hero-specimen .specimen-code { margin: 4px 0 0; font-family: ui-monospace, 'SF Mono', Menlo, monospace; color: var(--ink-3); font-size: .76rem; }
.find-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.find-head h2 { font-size: clamp(1.35rem, 1.1rem + .9vw, 1.9rem); }
.find-head p { margin: 0; font-size: .86rem; color: var(--ink-3); }

/* Glow-Up feature: dark editorial band */
.band { padding: clamp(44px, 7vw, 96px) 0; }
.band-ink { background: var(--ink); color: var(--paper); }
.band-ink h2 { color: var(--paper); }
.band-ink h2 em { color: oklch(78% 0.12 355); }
.band-ink p { color: oklch(85% 0.02 335); }
.band-ink .glow-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.band-ink .text-input { background: oklch(25% 0.04 335); border-color: oklch(45% 0.05 335); color: var(--paper); }
.band-ink .text-input::placeholder { color: oklch(70% 0.03 335); }
.band-ink .text-input:focus { box-shadow: 0 0 0 4px oklch(48% 0.19 358 / .45); background: oklch(27% 0.045 335); }
.band-ink .field-label { color: oklch(80% 0.04 335); }
.band-ink .style-list { border-top-color: oklch(35% 0.04 335); }
.band-ink .style-row { border-bottom-color: oklch(35% 0.04 335); }
.band-ink .style-row:hover { background: oklch(100% 0 0 / .07); }
.band-ink .style-row:hover .style-name { color: oklch(90% 0.03 335); }
.band-ink .style-out { color: var(--paper); }
.band-ink .style-name { color: oklch(72% 0.04 335); }
.band-ink .copy-btn { border-color: oklch(80% 0.04 335); color: var(--paper); }
.band-ink .copy-btn:hover { background: var(--paper); color: var(--ink); }
.band-ink .clear-btn { color: oklch(80% 0.03 335); }
.band-ink .clear-btn:hover { background: oklch(30% 0.05 335); color: var(--paper); }
.band-ink .btn-ghost { border-color: var(--paper); color: var(--paper); }
.band-ink .btn-ghost:hover { background: var(--paper); color: var(--ink); }

/* Directory: colour-banded editorial lists */
.dir-band { padding: clamp(40px, 6vw, 80px) 0; }
.dir-band.paper { background: var(--paper-2); }
.dir-band.blush { background: var(--blush); }
.dir-band.lilac { background: var(--lilac); }
.dir-band.blush .index-list a, .dir-band.lilac .index-list a { border-bottom-color: oklch(19% 0.035 335 / .14); }
.dir-grid { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.6fr); gap: clamp(24px, 4vw, 64px); align-items: start; }
.dir-intro { position: sticky; top: calc(var(--header-h) + 24px); }
.dir-intro p { color: var(--ink-2); margin-top: 14px; max-width: 34ch; }

/* ── Footer ── */
.site-footer { background: var(--ink); color: oklch(84% 0.02 335); padding: clamp(48px, 7vw, 88px) 0 28px; font-size: .93rem; }
.site-footer a { color: var(--paper); text-decoration: none; }
.site-footer a:hover { color: oklch(84% 0.1 355); }
.footer-word { display: block; font: 600 clamp(3.2rem, 1rem + 11vw, 10.5rem)/.85 var(--serif); letter-spacing: -0.04em; color: var(--paper); margin: 0 0 36px; text-decoration: none; }
.footer-word b { font-style: italic; font-weight: 600; color: oklch(78% 0.12 355); }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; padding-top: 28px; border-top: 1px solid oklch(35% 0.04 335); }
.footer-grid h2 { font: italic 600 1.1rem/1.2 var(--serif); color: oklch(72% 0.04 335); margin-bottom: 14px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.footer-blurb { margin: 0; max-width: 34ch; color: oklch(80% 0.02 335); }
.footer-bottom { margin-top: 36px; padding-top: 18px; border-top: 1px solid oklch(35% 0.04 335); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; color: oklch(70% 0.03 335); font-size: .82rem; }

/* ── Simple content pages ── */
.doc { max-width: 720px; font-size: 1.04rem; }
.doc h2 { font-size: clamp(1.45rem, 1.2rem + .8vw, 1.9rem); margin: 40px 0 12px; }
.doc h2:first-child { margin-top: 0; }
.doc p, .doc li { color: var(--ink-2); }
.doc ul { padding-inline-start: 1.2em; }
.doc li { margin-bottom: 8px; }
.doc li::marker { color: var(--berry); }
.form-grid { display: grid; gap: 18px; max-width: 580px; margin-top: 24px; }
.form-grid .two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .text-input { height: 52px; font-size: 1rem; }
.form-grid select, .form-grid textarea { width: 100%; padding: 13px 16px; border: 1.5px solid var(--ink); border-radius: var(--r-sm); background: var(--paper); font-size: 1rem; }
.form-grid textarea { min-height: 160px; resize: vertical; }
.form-grid select:focus, .form-grid textarea:focus { outline: none; box-shadow: 0 0 0 4px var(--blush-2); background: var(--card); }
.form-status { padding: 14px 16px; border-radius: var(--r-sm); font-weight: 600; }
.form-status[hidden] { display: none; }
.form-status.ok { background: var(--mint-bg); color: var(--mint); }
.form-status.err { background: var(--error-bg); color: var(--error); }

/* ── Languages: header switcher, "EN" marker on links to English-only pages, RTL ── */
.lang-switch { position: relative; flex-shrink: 0; }
.lang-switch summary { list-style: none; display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--card); font-weight: 600; font-size: .88rem; cursor: pointer; user-select: none; }
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary:hover, .lang-switch[open] summary { border-color: var(--ink); }
.lang-switch summary svg { width: 16px; height: 16px; color: var(--berry); }
.lang-switch .ls-code { display: none; }
.lang-switch ul { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 120; min-width: 210px; margin: 0; padding: 6px; list-style: none; background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--r); box-shadow: var(--shadow-pop); }
.lang-switch a { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-weight: 550; }
.lang-switch a:hover { background: var(--blush); color: var(--ink); }
.lang-switch a[aria-current="true"] { color: var(--berry-deep); font-weight: 700; }
.lang-switch a small { color: var(--ink-3); font-weight: 500; font-size: .78rem; }
.lang-tag { display: inline-block; margin-inline-start: 6px; padding: 1px 5px; border: 1px solid currentColor; border-radius: var(--r-xs); font: 600 .62rem/1.3 var(--sans); letter-spacing: .06em; vertical-align: middle; opacity: .7; }
.footer-langs { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.footer-langs a[aria-current="true"] { color: oklch(84% 0.1 355); }

/* Arabic: Latin display fonts only cover Latin, so Arabic text falls back to a system Arabic face.
   No negative tracking or italics on a connected script. */
:lang(ar) { --serif: 'Fraunces', 'Noto Naskh Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, serif; --sans: 'Instrument Sans', 'Noto Sans Arabic', 'SF Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, sans-serif; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3, :lang(ar) .brand-name, :lang(ar) .footer-word { letter-spacing: 0; }
:lang(ar) h1 { line-height: 1.25; }
:lang(ar) h2 { line-height: 1.3; }
:lang(ar) em, :lang(ar) .tools-panel h2, :lang(ar) .footer-grid h2, :lang(ar) .ticker-label { font-style: normal; }
:lang(ar) body { line-height: 1.8; }
[dir="rtl"] .primary-nav a::after { transform-origin: right; }
/* Symbols and styled text keep the direction they'll have once pasted: decided by their first letter, left-to-right when there is none */
[dir="rtl"] .glyph-char, [dir="rtl"] .style-out, [dir="rtl"] .specimen-char { unicode-bidi: plaintext; }
[dir="rtl"] .ticker-viewport, [dir="rtl"] .specimen-meta dd, [dir="rtl"] .specimen-code { direction: ltr; }
[dir="rtl"] .index-list a:hover .ix-arrow { transform: translateX(-4px); }
[dir="rtl"] .brand-mark { transform: none; }

/* ── Responsive ── */
/* Header room: the language switcher shortens to its code and the last nav links move to "All tools" */
@media (max-width: 1240px) {
  .lang-switch .ls-name { display: none; }
  .lang-switch .ls-code { display: inline; }
}
@media (max-width: 1180px) {
  .primary-nav a:nth-child(n+4) { display: none; }
  .header-search { min-width: 150px; }
}
@media (max-width: 1100px) {
  .collection { grid-template-columns: 1fr; }
  .specimen { display: none; }
}
@media (max-width: 1020px) {
  .primary-nav { display: none; }
  .tools-panel .wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
  .band-ink .glow-grid, .dir-grid { grid-template-columns: 1fr; }
  .dir-intro { position: static; }
}
@media (max-width: 760px) {
  :root { --header-h: 60px; --ticker-h: 32px; }
  .header-search { display: none; }
  .menu-toggle { margin-inline-start: auto; padding: 0 14px; }
  .brand-name { font-size: 1.35rem; }
  .page-head { grid-template-columns: 1fr; padding-top: 22px; }
  .head-glyph { display: none; }
  .home-hero { grid-template-columns: 1fr; padding-top: 22px; }
  .hero-specimen { display: none; }
  .home-hero h1 { font-size: clamp(2.5rem, 11vw, 3.4rem); }
  .hero-stats, .find-head p { display: none; }
  .home-hero .lede { font-size: 1rem; margin-top: 10px; }
  .home-hero   .home-hero h1 { margin-top: 0 !important; }
  .find-head { margin-top: 18px; }
  .two-col { grid-template-columns: 1fr; }
  .tool { padding: 14px; border-radius: var(--r-sm); }
  .text-input { height: 54px; font-size: 1.05rem; }
  .glyph-grid { --cell: 80px; }
  .glyph { min-height: 86px; padding: 10px 4px 8px; }
  .glyph-char { font-size: 1.6rem; }
  .glyph-name { font-size: .68rem; }
  .glyph-grid.is-wide { --cell: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline-end: -14px; padding-inline-end: 14px; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .chips::-webkit-scrollbar { display: none; }
  .style-row { gap: 10px; padding: 14px 0; }
  .style-out { font-size: 1.25rem; }
  .style-row:first-child .style-out { font-size: 1.45rem; }
  .copy-btn { min-width: 74px; padding: 0 12px; }
  .index-list { grid-template-columns: 1fr; }
  .index-list a { grid-template-columns: 48px 1fr auto; padding: 14px 0; }
  .form-grid .two { grid-template-columns: 1fr; }
  .scratch-label small { display: none; }
  .scratch .btn-primary { padding: 0 14px; }
  .ticker-label span { display: none; }
  .lang-switch { margin-inline-start: auto; }
  .lang-switch + .menu-toggle { margin-inline-start: 0; }
  .lang-switch summary { padding: 0 12px; }
  .lang-switch .ls-name { display: none; }
  .lang-switch .ls-code { display: inline; }
  [dir="rtl"] .chips { -webkit-mask-image: linear-gradient(270deg, #000 88%, transparent); mask-image: linear-gradient(270deg, #000 88%, transparent); }
}
@media (max-width: 480px) {
  .tools-panel .wrap { grid-template-columns: 1fr; gap: 22px; }
  .scratch-label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .ticker-viewport { overflow-x: auto; }
}
@media (forced-colors: active) {
  .glyph, .style-row, .chip, .copy-btn, .tool, .specimen { border: 1px solid CanvasText; }
  .chip[aria-pressed="true"] { outline: 2px solid Highlight; }
}

/* Hero specimen: live "No. 1 this week" glyph */
.hero-badge { position: absolute; z-index: 2; inset-inline-start: 14px; top: 14px; padding: 6px 11px; border-radius: var(--r-pill); background: oklch(99% 0.006 62 / .85); color: var(--berry-deep); font: 600 .78rem/1 var(--sans); }
.specimen-char[data-ink-center] { display: inline-block; line-height: 1; will-change: transform; }
.hero-specimen .specimen-char.is-swapping { opacity: 0; transform: scale(.92); }
.hero-specimen .specimen-char { transition: opacity .35s var(--ease); }
