@font-face { font-family: "Shantell Sans"; src: url("../fonts/shantell-sans-700.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }

:root {
  color-scheme: light dark;
  --page: #e5e4df;
  --pocket: color-mix(in oklch, var(--page), var(--ink) 7%);
  --card: #fff;
  --edge: rgb(0 0 0 / .08);
  --back: #1f1e1c;
  --button: #d8d7d1;
  --ink: #242422;
  --muted: #62625f;
  --quiet: #70706c;
  --rule: #e6e6e3;
  --wash: #f1f1ee;
  --ill: #fbfbfa;
  --amber: #f0a020;
  --shine: rgb(255 255 255 / .55);

  /* The search box is one flap of a departure board, dark in both modes. */
  --flap: #262624;
  --flap2: #1e1e1c;
  --fseam: rgb(0 0 0 / .8);
  --glyph: #f3f2ed;
  --fquiet: #9c9b95;

  /* The five colours in the illustrations. */
  --i-paper: #fff;
  --i-wash: #f1f1ee;
  --i-line: #deded9;
  --i-muted: #747470;
  --i-ink: #242422;

  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --hand: "Shantell Sans", "Comic Sans MS", cursive;
  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0c;
    --card: #1d1d1b;
    --edge: rgb(255 255 255 / .07);
    --back: #2a2926;
    --button: #171716;
    --ink: #ecebe6;
    --muted: #a8a7a1;
    --quiet: #8f8e89;
    --rule: #2a2a27;
    --wash: #232321;
    --ill: #171716;
    --amber: #ffb224;
    --shine: rgb(255 255 255 / .05);
    --flap2: #1f1f1d;
    --i-paper: #1d1d1c;
    --i-wash: #2a2a28;
    --i-line: #464540;
    --i-muted: #a09f99;
    --i-ink: #ecebe6;
  }
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button, a, input { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
::selection { background: color-mix(in oklch, var(--ink) 16%, transparent); }
h1, h2 { text-wrap: balance; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
dialog { color: var(--ink); }

/* Illustrations: map the five source colours to tokens so dark mode can re-tint them. */
svg.ill { display: block; width: 100%; height: 100%; fill: var(--i-ink); pointer-events: none; user-select: none; -webkit-user-select: none; }
svg.ill [fill="#fff"] { fill: var(--i-paper); }
svg.ill [stroke="#fff"] { stroke: var(--i-paper); }
svg.ill [fill="#f1f1ee"] { fill: var(--i-wash); }
svg.ill [fill="#deded9"] { fill: var(--i-line); }
svg.ill [stroke="#deded9"] { stroke: var(--i-line); }
svg.ill [fill="#747470"] { fill: var(--i-muted); }
svg.ill [stroke="#747470"] { stroke: var(--i-muted); }
svg.ill [fill="#242422"] { fill: var(--i-ink); }
svg.ill [stroke="#242422"] { stroke: var(--i-ink); }

.words { min-height: 100dvh; }

/* Search */
.top { position: sticky; top: 0; z-index: 5; padding: 16px clamp(16px, 3vw, 40px) 14px; background: linear-gradient(var(--page) 78%, transparent); }
.find { position: relative; display: flex; align-items: center; gap: 12px; max-width: 560px; height: 52px; margin: 0 auto; padding: 0 18px; border-radius: 6px; color: var(--fquiet); cursor: text;
  background: linear-gradient(transparent calc(50% - .5px), var(--fseam) calc(50% - .5px) calc(50% + .5px), transparent calc(50% + .5px)), linear-gradient(var(--flap) 50%, var(--flap2) 50%);
  box-shadow: 0 1px 0 var(--shine), 0 10px 24px -14px rgb(0 0 0 / .45); outline: 2px solid transparent; outline-offset: 2px; transition: outline-color 150ms ease-out; }
.find:focus-within { outline-color: var(--ink); }
.find input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; appearance: none; font: 600 16px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--glyph); }
.find input:focus { outline: none; }
.find input::placeholder { color: var(--fquiet); opacity: 1; }
.find input::-webkit-search-cancel-button { display: none; }
.count { font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--fquiet); white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { max-width: 560px; margin: 4px auto 18px; padding: 0 clamp(16px, 3vw, 40px); font-size: 13px; color: var(--muted); }
.empty p { margin: 0 0 10px; }
.empty b { display: block; color: var(--ink); font-weight: 550; }
.empty button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 6px; background: var(--button); transition: scale 150ms ease-out; }
.empty button:active { scale: .96; }

/* The deck: every card sits in a pocket, so a lifted card leaves its place behind. */
.deck { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 18px 16px; max-width: 1520px; margin: 0 auto; padding: 6px clamp(16px, 3vw, 40px) 0; }
.pocket { aspect-ratio: 4 / 3; border-radius: 14px; background: var(--pocket); box-shadow: inset 0 1px 2px rgb(0 0 0 / .08); }
.card { position: relative; display: block; height: 100%; container-type: inline-size; color: inherit; text-decoration: none; perspective: 900px; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.card:focus-visible { outline: none; }
.card:focus-visible .front { box-shadow: 0 0 0 2px var(--page), 0 0 0 4px var(--ink); }
.tilt { display: block; height: 100%; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transform-style: preserve-3d; transition: transform 450ms var(--ease-out), translate 200ms ease-out; }
.card[data-tilt] .tilt { transition: transform 80ms linear, translate 200ms ease-out; translate: 0 -4px; }
.card:active .tilt { scale: .98; }
.flip { position: relative; display: block; height: 100%; transform-style: preserve-3d; transition: transform 560ms cubic-bezier(0.45, 0, 0.2, 1) var(--d, 0ms); }
.card[data-down] .flip { transform: rotateY(180deg); }

/* A card face. Sizes are in container units so the big card is an exact enlargement of the small one. */
.face { position: absolute; inset: 0; isolation: isolate; display: flex; flex-direction: column; gap: 3cqw; padding: 4cqw; border-radius: 5.5cqw; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.front { background: var(--card); box-shadow: inset 0 0 0 1px var(--edge), 0 1px 2px rgb(0 0 0 / .08), 0 12px 24px -14px rgb(0 0 0 / .35); }
.head { flex: none; display: flex; align-items: center; gap: 2cqw; min-width: 0; padding: .4cqw 1.2cqw 0; }
.name { flex: 1; min-width: 0; font-size: max(6.4cqw, 13px); line-height: 1.15; font-weight: 600; letter-spacing: -.02em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.art { flex: 1; min-height: 0; display: grid; place-items: center; border-radius: 3cqw; background: var(--ill); box-shadow: inset 0 0 0 1px var(--edge); overflow: hidden; }
.back { transform: rotateY(180deg); justify-content: center; align-items: center; background: repeating-linear-gradient(45deg, rgb(255 255 255 / .05) 0 1px, transparent 1px 7px), var(--back); box-shadow: inset 0 0 0 3cqw var(--back), inset 0 0 0 calc(3cqw + 1px) rgb(255 255 255 / .14), 0 12px 24px -14px rgb(0 0 0 / .35); }
.mark { padding: 4cqw 7cqw; border-radius: 50%; background: var(--back); box-shadow: 0 0 0 1px rgb(255 255 255 / .18); font: 700 8cqw/1 var(--hand); color: #f1f0ea; white-space: nowrap; transform: rotate(-8deg); }

/* The light on the card follows the pointer. */
.shine { position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 300ms ease-out;
  background: radial-gradient(farthest-corner circle at var(--mx, 50%) var(--my, 30%), rgb(255 255 255 / .7), transparent 42%), linear-gradient(115deg, transparent 30%, rgb(0 0 0 / .05) var(--pos, 50%), transparent 80%); mix-blend-mode: overlay; }
.card[data-tilt] .shine { opacity: .6; transition: opacity 150ms ease-out; }

/* The best match: an amber lamp, and the card waits a little higher, ready for Enter. */
.lamp { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 2px rgb(0 0 0 / .1), 0 0 10px 2px color-mix(in oklch, var(--amber) 55%, transparent); opacity: 0; scale: .4; transition: opacity 150ms ease-out, scale 150ms ease-out; }
.words[data-q] .card[data-first] .lamp { opacity: 1; scale: 1; transition: opacity 200ms ease-out 260ms, scale 300ms cubic-bezier(0.34, 1.56, 0.64, 1) 260ms; }
.words[data-q] .card[data-first] .tilt { translate: 0 -6px; }

@media (hover: hover) and (pointer: fine) {
  .close:hover { background: var(--wash); }
  .empty button:hover { background: color-mix(in oklch, var(--button), var(--ink) 6%); }
}

/* An open card: it lifts out of the deck and turns over. Its back holds the entry. */
.view { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; overflow: hidden; }
.view::backdrop { background: transparent; }
.scrim { position: fixed; inset: 0; background: radial-gradient(90% 80% at 50% 45%, rgb(14 14 13 / .5), rgb(14 14 13 / .82)); }
.close { position: fixed; top: 16px; right: 16px; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--card); box-shadow: 0 8px 20px -8px rgb(0 0 0 / .5); transition: background-color 150ms ease-out, scale 150ms ease-out; }
.close:active { scale: .96; }
.hold { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; }
.big { position: relative; width: min(960px, calc(100vw - 48px), calc((100dvh - 96px) * 1.6)); aspect-ratio: 16 / 10; container-type: inline-size; transform-origin: 0 0; perspective: 2400px; }
.big-flip { position: absolute; inset: 0; transform: rotateY(180deg); transform-style: preserve-3d; }
.big .front { box-shadow: inset 0 0 0 1px var(--edge), 0 40px 80px -30px rgb(0 0 0 / .7); }
.entry { transform: rotateY(180deg); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-content: start; gap: 28px; padding: 24px; overflow: auto; overscroll-behavior: contain; background: var(--card); box-shadow: inset 0 0 0 1px var(--edge), 0 40px 80px -30px rgb(0 0 0 / .7); }
.entry-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.entry-art { flex: none; aspect-ratio: 5 / 3; margin-bottom: 12px; border-radius: 12px; background: var(--ill); box-shadow: inset 0 0 0 1px var(--edge); overflow: hidden; }
.entry h2 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -.5px; }
.entry h2:focus { outline: none; }
.gloss { margin: 0; font-size: 16px; color: var(--muted); text-wrap: pretty; }
.lead { margin-top: 14px; }
.entry-notes { min-width: 0; padding-top: 2px; }
.entry-notes .wd > .wd-block:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.notes { display: none; }

/* The entry */
.wd { font-size: 14px; line-height: 1.65; }
.wd p { margin: 0 0 14px; text-wrap: pretty; }
.wd a { text-decoration-color: color-mix(in oklch, currentColor 35%, transparent); text-underline-offset: 3px; }
.wd h4 { margin: 0 0 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.wd-def { font-size: 16px; line-height: 1.6; }
.wd-block { border-top: 1px solid var(--rule); padding-top: 16px; margin-top: 4px; }
.wd blockquote { margin: 0 0 16px; padding: 10px 14px; background: var(--wash); border-radius: 6px; }
.wd-ask { font-weight: 500; }
.wd-note { color: var(--muted); border-top: 1px solid var(--rule); padding-top: 14px; }
.wd-sources { margin: 0 0 16px; }
.wd-sources a { display: flex; align-items: center; min-height: 36px; font-size: 13px; }
.wd-see { margin-top: 4px; }
.wd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wd-chips a { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; border-radius: 999px; box-shadow: 0 0 0 1px var(--rule) inset; text-decoration: none; font-size: 13px; transition: background-color 150ms ease-out; }
@media (hover: hover) and (pointer: fine) {
  .wd-chips a:hover { background: var(--wash); }
  .wd a:hover { text-decoration-color: currentColor; }
}

.credit { max-width: 1520px; margin: 0 auto; padding: 48px clamp(16px, 3vw, 40px) 40px; font-size: 12px; line-height: 1.5; color: var(--quiet); text-wrap: pretty; }
.credit a { text-underline-offset: 3px; }

/* On a phone the open card is too small for the entry, so the entry sits under the card. */
@media (max-width: 760px) {
  .view { overflow: auto; overscroll-behavior: contain; }
  .hold { position: relative; inset: auto; display: block; min-height: 100%; padding: 72px 16px 120px; }
  .big { width: 100%; aspect-ratio: 4 / 3; }
  .entry { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; overflow: hidden; }
  .entry-main { flex: 1; min-height: 0; }
  .entry-art { flex: 1; min-height: 0; aspect-ratio: auto; margin-bottom: 8px; border-radius: 10px; }
  .entry h2 { font-size: 20px; }
  .gloss { font-size: 14px; }
  .entry-notes, .lead { display: none; }
  .notes { display: block; margin-top: 12px; padding: 20px 18px 16px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--edge), 0 20px 40px -24px rgb(0 0 0 / .6); }
}
@media (max-width: 520px) {
  .deck { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .pocket { border-radius: 10px; }
  .name { white-space: normal; line-height: 1.2; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
