:root {
  color-scheme: light;
  --paper: #f5f2ea;
  --card: #fbf9f4;
  --ink: #1c1c19;
  --ink-soft: #3d3c36;
  --muted: #6c695e;
  --line: #e1dccf;
  --line-strong: #cbc4b2;
  --ghost: #746f63;
  --focus: #2d5bb5;
  --ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --pad-x: clamp(20px, 3.4vw, 56px);
  --bar-h: 88px;
  --wordmark-size: 38px;
  --preview-size: 48px;
  --ease: cubic-bezier(.7, 0, .2, 1);
  font-family: var(--ui);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: progress; }
a { color: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
::selection { background: #f2cf62; color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Shared top bar: identical geometry on the splash and in the collection keeps the wordmark still. */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--pad-x), env(safe-area-inset-right)) 0 max(var(--pad-x), env(safe-area-inset-left));
  flex: none;
}
.brand { display: flex; align-items: center; min-height: 48px; color: #111; text-decoration: none; }
/* Its own layer makes both copies rasterise alike (the collection copy is always composited). */
.wordmark { display: inline-flex; align-items: baseline; font-size: var(--wordmark-size); line-height: 1; color: #111; white-space: nowrap; will-change: transform; }
.wordmark > span { display: inline-block; }
.wordmark > :nth-child(1) { font-family: "Bunvale"; }
.wordmark > :nth-child(2) { font-family: "Lapisent"; }
.wordmark > :nth-child(3) { font-family: "Charterquill"; }
.wordmark > :nth-child(4) { font-family: "Presswake"; }
.wordmark > :nth-child(5) { font-family: "Liltvale"; }
.wordmark > :nth-child(6) { font-family: "Marqevra"; }
.wordmark > :nth-child(7) { font-family: "Riftstave"; }
.brand-link { border-radius: 8px; }

/* Splash */
.splash { height: 100vh; height: 100svh; height: 100dvh; min-height: 300px; display: flex; flex-direction: column; position: relative; }
.collection-trigger {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 50px;
  padding: 0 20px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: .01em;
  white-space: nowrap;
  transition: background-color 200ms, color 200ms;
}
.collection-trigger svg { width: 18px; height: 18px; margin-right: 0; transition: transform 240ms var(--ease); }
.collection-trigger:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.collection-trigger:hover:not(:disabled) svg { transform: translate(2px, -2px); }

.hero { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 var(--pad-x); }
.kicker { max-width: 100%; line-height: 1.7; text-wrap: balance; font-size: 11px; font-weight: 500; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: clamp(14px, 3.4vh, 40px); }
.kicker > span { display: inline-block; }
.hero-title { margin: 0; font-weight: 400; font-size: var(--hero-size, clamp(34px, 8vw, 120px)); line-height: 1.16; width: 100%; font-family: Georgia, "Times New Roman", serif; }
.hero-letters { display: block; }
/* Hold the type back until the real fonts arrive, so nothing flashes in a fallback face. */
.js:not([data-ready]) .hero-letters, .js:not([data-ready]) .wordmark { visibility: hidden; }
@keyframes letter-in { from { opacity: 0; transform: translateY(.22em) rotate(-5deg); } }
@media (prefers-reduced-motion: no-preference) {
  .hero-letters.is-entering .hero-letter { animation: letter-in 760ms cubic-bezier(.2, .75, .25, 1) backwards; animation-delay: calc(var(--i) * 24ms); }
}
/* Each line gets its height from the line's own strut, so font swaps never move the baseline. */
.hero-line { display: block; white-space: nowrap; font-family: "Lapisent", Georgia, serif; }
.hero-letter { display: inline-block; line-height: 0; vertical-align: baseline; text-align: left; white-space: pre; }
.hero-space { display: inline-block; width: .27em; }
.cta { display: flex; flex-direction: column; align-items: center; margin-top: clamp(18px, 4.4vh, 48px); }
.repo-cta { display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px; border-radius: 999px; background: var(--ink); color: var(--paper); text-decoration: none; font-size: 15px; letter-spacing: .01em; transition: background-color 200ms, transform 200ms var(--ease); }
.repo-cta:hover { background: #33322c; transform: translateY(-2px); }
.repo-cta .github-mark { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.repo-cta .cta-arrow { width: 16px; height: 16px; margin-left: 6px; opacity: .8; }
.cta-caption { margin-top: 12px; font-size: 12px; color: var(--muted); }

.splash-footer { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 0 max(var(--pad-x), env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(var(--pad-x), env(safe-area-inset-left)); min-height: 64px; font-size: 12px; color: var(--muted); flex: none; }
.motion-toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border-radius: 999px; font-size: 12px; color: var(--ink-soft); }
.motion-toggle:hover:not(:disabled) { background: #ebe6da; }
.motion-icon { position: relative; width: 10px; height: 12px; }
.motion-icon::before, .motion-icon::after { content: ""; position: absolute; top: 0; width: 3px; height: 12px; border-radius: 1px; background: currentColor; }
.motion-icon::before { left: 0; }
.motion-icon::after { right: 0; }
[data-state="paused"] .motion-icon::before { left: 1px; width: 0; height: 0; border-radius: 0; background: none; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent currentColor; }
[data-state="paused"] .motion-icon::after { display: none; }
[data-ready="error"] .motion-toggle { visibility: hidden; }
.load-status { position: fixed; left: 24px; right: 24px; bottom: 76px; text-align: center; font-size: 13px; color: #9e3d2b; }
.load-status:empty { display: none; }

/* Collection: a full-screen view that grows out of the trigger. */
.collection {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
  clip-path: circle(0 at var(--origin-x, calc(100% - 90px)) var(--origin-y, 44px));
  transition: clip-path 620ms var(--ease);
}
.collection.is-open { clip-path: circle(var(--radius, 160vmax) at var(--origin-x, calc(100% - 90px)) var(--origin-y, 44px)); }
.collection::backdrop { background: transparent; }
.collection-shell { height: 100%; display: flex; flex-direction: column; }
/* A shadow rule, not a border, so this bar's content box matches the splash bar to the pixel. */
.collection-bar { box-shadow: 0 1px 0 var(--line); position: relative; z-index: 4; background: var(--paper); }
.collection-heading { display: flex; align-items: center; gap: 22px; min-width: 0; }
.bar-rule { width: 1px; height: 26px; background: var(--line-strong); transform: rotate(18deg); flex: none; }
.collection-heading h2 { margin: 0; font-size: 14px; font-weight: 500; letter-spacing: .01em; white-space: nowrap; }
.close-button { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; border: 1px solid var(--ink); flex: none; transition: background-color 200ms, color 200ms; }
.close-button:hover { background: var(--ink); color: var(--paper); }
.collection-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

.intro { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 14px 32px; padding: clamp(28px, 5vh, 52px) var(--pad-x) 20px; }
.eyebrow { grid-column: 1 / -1; font-size: 11px; font-weight: 500; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-soft); }
.intro-title { font-size: clamp(36px, 4.4vw, 66px); letter-spacing: -.035em; line-height: 1; }
.intro-title span { font-family: "Bunvale", Georgia, serif; letter-spacing: -.01em; }

.tester { position: sticky; top: 0; z-index: 3; padding: 12px var(--pad-x); background: var(--paper); transition: box-shadow 200ms; }
.tester.is-stuck { box-shadow: 0 1px 0 var(--line), 0 14px 24px -22px rgba(48, 40, 20, .5); }
.tester-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto 280px; align-items: center; gap: 0 18px; padding: 14px 16px 14px 22px; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--card); }
.tester-panel:focus-within { border-color: var(--ink); }
.control-label { display: block; font-size: 10px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px; }
#size-output { font-size: 12px; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; margin-bottom: 6px; }
.tester-text input { width: 100%; height: 34px; padding: 0; border: 0; background: none; font-size: 22px; outline: none; text-overflow: ellipsis; }
input::placeholder { color: #747064; opacity: 1; }
.clear-text { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--muted); }
.clear-text:hover { background: #ece7db; color: var(--ink); }
.clear-text svg { width: 18px; height: 18px; }
.tester-size { grid-column: 3; display: grid; grid-template-columns: 1fr auto; align-items: baseline; padding-left: 22px; border-left: 1px solid var(--line); }
.tester-size input { grid-column: 1 / -1; display: block; width: 100%; height: 28px; margin: 0; accent-color: var(--ink); cursor: pointer; }

.sample-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 0 var(--pad-x); padding: 2px 0 24px; border-bottom: 1px solid var(--line); }
.sample-panel .control-label { margin: 0; flex: none; }
.toolbar { display: grid; gap: 10px; padding: 22px var(--pad-x) 22px; }
.toolbar-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.toolbar-heading .control-label { margin: 0; }
.toolbar-filters { display: flex; align-items: center; gap: 20px; min-width: 0; }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.chip-row button { min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13px; white-space: nowrap; transition: background-color 160ms, color 160ms, border-color 160ms; }
.chip-row button:hover { border-color: var(--ink); }
.chip-row button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.search { display: flex; align-items: center; gap: 8px; width: 240px; height: 40px; flex: none; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; }
.search:focus-within { border-color: var(--ink); }
.search svg { width: 16px; height: 16px; color: var(--muted); }
.search input { flex: 1; width: 0; min-width: 0; border: 0; padding: 0; background: none; font-size: 13px; outline: none; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; background: var(--muted); cursor: pointer; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6 6 18' stroke='%23000' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6 6 18' stroke='%23000' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.view-toggle { display: flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; }
.view-toggle button { display: grid; place-items: center; width: 36px; height: 28px; border-radius: 999px; color: var(--muted); }
.view-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.view-toggle svg { width: 16px; height: 16px; }

/* Font cards */
.font-grid { --cols: 3; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 16px; padding: 0 var(--pad-x) 16px; }
.font-grid[data-view="list"] { --cols: 1; }
.font-card {
  display: grid;
  grid-template-areas: "head" "sample" "note" "foot";
  grid-template-rows: auto 1fr auto auto;
  min-width: 0;
  padding: 20px 22px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  transition: border-color 200ms, box-shadow 240ms;
}
.font-card:hover { border-color: var(--line-strong); box-shadow: 0 18px 40px -30px rgba(48, 40, 20, .45); }
.card-head { grid-area: head; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 4px 12px; }
.card-index { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-name { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.005em; }
.card-tags { display: flex; gap: 6px; align-items: center; justify-self: end; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-badge { padding: 3px 8px; border-radius: 999px; background: #ece5d3; color: #5b5240; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.card-desc { grid-column: 2 / -1; font-size: 13px; color: var(--muted); }
.card-sample { grid-area: sample; margin: 26px 0 22px; font-size: var(--preview-size); line-height: 1.24; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.24em; font-kerning: normal; }
/* Characters a font lacks are drawn in the plain UI face and grayed out, never passed off as the font. */
.ghost { font-family: var(--ui); color: var(--ghost); text-decoration: underline dotted; text-decoration-thickness: max(1px, .04em); text-underline-offset: .14em; text-decoration-color: var(--line-strong); }
.card-note { grid-area: note; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: -8px 0 16px; font-size: 12px; line-height: 1.5; color: var(--ink-soft); }
.note-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.note-line > span:first-child { margin-right: 2px; }
.missing-char { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px; background: #eee9dd; color: var(--ink-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.missing-more { color: var(--muted); }
.case-toggle { height: 26px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12px; }
.case-toggle:hover { border-color: var(--ink); }
.card-foot { grid-area: foot; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.card-meta { font-size: 12px; line-height: 1.45; color: var(--muted); min-width: 0; }
.downloads { display: inline-flex; align-items: stretch; flex: none; border: 1px solid var(--ink); border-radius: 999px; overflow: hidden; }
.downloads a { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; font-size: 12px; font-weight: 500; letter-spacing: .02em; text-decoration: none; transition: background-color 160ms, color 160ms; }
.downloads a + a { border-left: 1px solid var(--ink); }
.downloads a:hover { background: var(--ink); color: var(--paper); }
.downloads a:focus-visible { outline-offset: -4px; border-radius: 999px; }
.downloads svg { width: 15px; height: 15px; }
@media (min-width: 761px) {
  .font-grid[data-view="list"] .font-card { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "head foot" "sample sample" "note note"; grid-template-rows: auto auto auto; padding: 24px 28px 20px; }
  .font-grid[data-view="list"] .card-foot { border-top: 0; padding-top: 0; align-self: start; gap: 20px; }
  .font-grid[data-view="list"] .card-meta { text-align: right; }
  .font-grid[data-view="list"] .card-tags { justify-self: start; }
  .font-grid[data-view="list"] .card-head { grid-template-columns: auto auto 1fr; }
  .font-grid[data-view="list"] .card-sample { margin: 20px 0 14px; }
  .font-grid[data-view="list"] .card-note { margin: 0; }
}

.empty-state { padding: 56px var(--pad-x) 40px; text-align: center; }
.empty-title { font-size: 26px; letter-spacing: -.02em; margin-bottom: 8px; }
.empty-state p:not(.empty-title) { font-size: 14px; color: var(--muted); }
.pill-button { height: 44px; margin-top: 18px; padding: 0 20px; border: 1px solid var(--ink); border-radius: 999px; }
.pill-button:hover { background: var(--ink); color: var(--paper); }
.collection-footer { display: grid; gap: 10px; padding: 36px var(--pad-x) max(36px, env(safe-area-inset-bottom)); font-size: 12px; line-height: 1.6; color: var(--muted); }
.collection-footer p:last-child { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.collection-footer a { color: var(--ink); text-underline-offset: 4px; }

@media (min-width: 1720px) { .font-grid { --cols: 4; } }
@media (max-width: 1099px) { .font-grid { --cols: 2; } .tester-panel { grid-template-columns: minmax(0, 1fr) auto 220px; } }
@media (max-width: 760px) {
  :root { --bar-h: 72px; --wordmark-size: 31px; --preview-size: 36px; }
  .collection-trigger { height: 46px; gap: 8px; padding: 0 18px; font-size: 13px; }
  .collection-trigger svg { display: none; }
  .kicker { font-size: 10px; letter-spacing: .2em; }
  .repo-cta { height: 52px; font-size: 14px; }
  .collection-heading { gap: 14px; }
  .collection-heading h2 { font-size: 13px; }
  .bar-rule { height: 22px; }
  .close-button { width: 46px; height: 46px; }
  .intro { grid-template-columns: 1fr; padding-top: 26px; padding-bottom: 14px; }
  .intro-title { font-size: 36px; letter-spacing: -.03em; }
  .tester { padding-top: 8px; padding-bottom: 20px; }
  .tester-panel { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 14px 12px 16px; border-radius: 16px; }
  .tester-text .control-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .tester-text { padding-bottom: 12px; }
  .tester-text input { height: 42px; font-size: 18px; }
  .tester-size { grid-column: 1 / -1; grid-template-columns: auto minmax(0, 1fr) 52px; align-items: center; gap: 12px; padding: 10px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .tester-size .control-label, #size-output { margin: 0; }
  .tester-size input { grid-column: 2; grid-row: 1; }
  .sample-panel { display: grid; gap: 10px; padding-top: 0; padding-bottom: 22px; }
  .toolbar { gap: 12px; padding-top: 22px; padding-bottom: 20px; }
  .toolbar-filters { flex-direction: column; align-items: stretch; gap: 12px; }
  .search { width: 100%; height: 44px; }
  .search input { font-size: 16px; }
  .view-toggle { display: none; }
  .chip-row { gap: 6px; }
  .chip-row button { min-height: 38px; padding: 0 12px; font-size: 12px; }
  .card-foot { flex-wrap: wrap; }
}
@media (max-width: 639px) {
  .font-grid { --cols: 1; gap: 12px; }
  .font-card { padding: 18px 18px 16px; border-radius: 18px; }
  .card-sample { margin: 20px 0 18px; }
  .card-foot { padding-top: 12px; }
  .card-meta { flex: 1 1 100%; }
  .downloads { flex: 1 1 100%; }
  .downloads a { flex: 1; justify-content: center; height: 44px; }
}
@media (max-width: 420px) {
  .kicker { font-size: 9px; letter-spacing: .16em; }
}
@media (max-width: 360px) {
  .collection-trigger { padding: 0 14px; font-size: 12px; }
  .sample-panel .chip-row, .categories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-height: 520px) {
  :root { --bar-h: 62px; }
  .kicker { margin-bottom: 8px; }
  .repo-cta { height: 46px; }
  .cta-caption { margin-top: 6px; }
  .splash-footer { min-height: 48px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .motion-toggle { min-height: 40px; }
  .tester { position: static; }
  .intro { padding-top: 18px; padding-bottom: 8px; }
  .intro .eyebrow { display: none; }
  .intro-title { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; scroll-behavior: auto !important; }
}
