@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/hanken-grotesk.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------ tokens
   Dark is the evening table; light is the same table by day; warm is the
   table by candlelight. Card stock and card ink never change with the scheme:
   a card is a printed object. With no data-scheme on <html> (no choice made,
   or no JS) the device decides between dark and light. */
:root {
  color-scheme: dark;
  --ground: #1c1713;
  --ground-2: #26201a;
  --lamp: rgba(255, 196, 128, 0.13);
  --ink: #f4ece1;
  --ink-2: #c3b5a4;
  --rule: rgba(244, 236, 225, 0.14);
  --focus: #ffcf8a;

  --stock: #faf5ec;
  --stock-edge: #e8dfd0;
  --card-ink: #231c16;
  --card-ink-2: #6a5c4f;

  --shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 10px 24px -8px rgba(0, 0, 0, 0.55), 0 28px 60px -24px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 1px 1px rgba(0, 0, 0, 0.2), 0 6px 14px -6px rgba(0, 0, 0, 0.5);

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-card: 18px;
  --gutter: clamp(16px, 4vw, 40px);
}
/* The light block appears twice: once for a chosen "light", once for devices
   set to light with no choice made. check.mjs fails if the copies drift. */
:root[data-scheme="light"] {
  color-scheme: light;
  --ground: #efe7da;
  --ground-2: #e5dbcb;
  --lamp: rgba(255, 255, 255, 0.55);
  --ink: #221b15;
  --ink-2: #5f5244;
  --rule: rgba(34, 27, 21, 0.14);
  --focus: #b3401f;
  --shadow: 0 1px 1px rgba(60, 40, 20, 0.12), 0 10px 24px -8px rgba(60, 40, 20, 0.28), 0 28px 60px -24px rgba(60, 40, 20, 0.3);
  --shadow-sm: 0 1px 1px rgba(60, 40, 20, 0.1), 0 6px 14px -6px rgba(60, 40, 20, 0.3);
}
@media (prefers-color-scheme: light) {
  :root:not([data-scheme]) {
    color-scheme: light;
    --ground: #efe7da;
    --ground-2: #e5dbcb;
    --lamp: rgba(255, 255, 255, 0.55);
    --ink: #221b15;
    --ink-2: #5f5244;
    --rule: rgba(34, 27, 21, 0.14);
    --focus: #b3401f;
    --shadow: 0 1px 1px rgba(60, 40, 20, 0.12), 0 10px 24px -8px rgba(60, 40, 20, 0.28), 0 28px 60px -24px rgba(60, 40, 20, 0.3);
    --shadow-sm: 0 1px 1px rgba(60, 40, 20, 0.1), 0 6px 14px -6px rgba(60, 40, 20, 0.3);
  }
}
/* Candlelight: honey paper, the lamp turned down to an amber glow. */
:root[data-scheme="warm"] {
  color-scheme: light;
  --ground: #d8b98c;
  --ground-2: #cdab7a;
  --lamp: rgba(255, 214, 140, 0.6);
  --ink: #2a1a0d;
  --ink-2: #4f3720;
  --rule: rgba(42, 26, 13, 0.18);
  --focus: #8c2a0e;
  --shadow: 0 1px 1px rgba(70, 40, 10, 0.18), 0 10px 24px -8px rgba(70, 40, 10, 0.38), 0 28px 60px -24px rgba(70, 40, 10, 0.4);
  --shadow-sm: 0 1px 1px rgba(70, 40, 10, 0.15), 0 6px 14px -6px rgba(70, 40, 10, 0.38);
}

/* Deck colours. --deck is the card back and the accent; --deck-on is text on it;
   --deck-text is the accent used as text on card stock (needs 4.5:1 on --stock). */
[data-deck="tomato"] { --deck: #c4462c; --deck-on: #fff; --deck-text: #b03d25; }
[data-deck="plum"]   { --deck: #7d3456; --deck-on: #fff; --deck-text: #7d3456; }
[data-deck="ochre"]  { --deck: #d9992a; --deck-on: #2a1d08; --deck-text: #8a5a0b; }
[data-deck="teal"]   { --deck: #1f6f69; --deck-on: #fff; --deck-text: #1b635d; }
[data-deck="ink"]    { --deck: #2f4f94; --deck-on: #fff; --deck-text: #2f4f94; }
[data-deck="indigo"] { --deck: #34336e; --deck-on: #fff; --deck-text: #34336e; }
[data-deck="wine"]    { --deck: #7a2638; --deck-on: #fff; --deck-text: #7a2638; }
[data-deck="rose"]    { --deck: #b8435e; --deck-on: #fff; --deck-text: #a53a53; }
[data-deck="berry"]   { --deck: #8c2f6b; --deck-on: #fff; --deck-text: #8c2f6b; }
[data-deck="lagoon"]  { --deck: #1d6a80; --deck-on: #fff; --deck-text: #1a6275; }
[data-deck="rust"]    { --deck: #a9491f; --deck-on: #fff; --deck-text: #9a421c; }
[data-deck="mustard"] { --deck: #d6b23a; --deck-on: #2a2208; --deck-text: #6f5a0e; }
[data-deck="coral"]   { --deck: #e0735a; --deck-on: #2a120b; --deck-text: #a8432b; }
[data-deck="cocoa"]   { --deck: #6b4a35; --deck-on: #fff; --deck-text: #6b4a35; }
[data-deck="olive"]   { --deck: #5d6b2a; --deck-on: #fff; --deck-text: #535f25; }
[data-deck="slate"]   { --deck: #45566b; --deck-on: #fff; --deck-text: #45566b; }
[data-deck="forest"]  { --deck: #2f5e3f; --deck-on: #fff; --deck-text: #2f5e3f; }
[data-deck="violet"]  { --deck: #5b3f8c; --deck-on: #fff; --deck-text: #5b3f8c; }

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background-color: var(--ground);
  /* The lamp: one warm pool of light above the table, falling off to the edges. */
  background-image:
    radial-gradient(ellipse 90% 60% at 50% -10%, var(--lamp), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 120%, rgba(0, 0, 0, 0.18), transparent 70%);
  background-attachment: fixed;
  font: 400 1.0625rem/1.6 var(--sans);
  overflow-wrap: break-word;
}
main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 var(--gutter); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--stock); color: var(--card-ink); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

/* ------------------------------------------------------------ bar */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; max-width: 1080px; margin: 0 auto; padding: 18px var(--gutter);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 600 1.35rem/1 var(--serif); letter-spacing: -0.02em; }
.mark { width: 30px; height: 30px; flex: none; }
.mark-back { fill: #c4462c; }
.mark-front { fill: var(--stock); stroke: var(--card-ink); stroke-width: 1.6; }
.mark-q { fill: none; stroke: var(--card-ink); stroke-width: 2; stroke-linecap: round; }
.mark-dot { fill: var(--card-ink); }
.bar-nav { display: flex; gap: 4px; }
.bar-nav a { text-decoration: none; color: var(--ink-2); font-weight: 500; padding: 8px 12px; border-radius: 999px; }
.bar-nav a:hover, .bar-nav a[aria-current] { color: var(--ink); background: var(--rule); }

.bar-end { display: flex; align-items: center; gap: 4px; }

/* Colour scheme picker: an icon button that opens a small paper menu. */
.scheme { position: relative; }
.scheme-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); cursor: pointer;
}
.scheme-btn:hover, .scheme-btn[aria-expanded="true"] { color: var(--ink); background: var(--rule); }
.scheme-btn svg, .pop svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.scheme-btn svg { display: none; }
.scheme-btn[data-show="auto"] .i-auto, .scheme-btn[data-show="light"] .i-light,
.scheme-btn[data-show="dark"] .i-dark, .scheme-btn[data-show="warm"] .i-warm { display: block; }
html:not(.js) .scheme { display: none; }

/* Paper popovers (share menu, scheme menu) share one look. */
.pop {
  display: flex; flex-direction: column; padding: 6px;
  border-radius: 14px; background: var(--stock); color: var(--card-ink); box-shadow: var(--shadow);
}
.pop[hidden] { display: none; }
.pop button {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 9px; background: transparent; color: inherit; cursor: pointer;
  font: 600 0.9375rem/1 var(--sans); text-align: left; white-space: nowrap;
}
.pop button:hover, .pop button:focus-visible { background: color-mix(in srgb, var(--card-ink) 8%, transparent); }
.scheme-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; min-width: 190px; }
.scheme-menu button[aria-checked="true"] { background: color-mix(in srgb, var(--card-ink) 10%, transparent); }
.scheme-menu button[aria-checked="true"]::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: #c4462c; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 0;
  font: 600 1rem/1 var(--sans); text-decoration: none; cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn-primary { background: var(--stock); color: var(--card-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: #fff; }
.deck .btn-primary { background: var(--deck); color: var(--deck-on); }
.deck .btn-primary:hover { background: var(--deck); filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--rule); }
.btn-ghost:hover:not(:disabled) { background: var(--rule); }
.btn-icon { width: 48px; padding: 0; }
.btn-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------ the card
   One component, many objects. Base = the kitchen-table playing card; every
   theme in themes.css restyles the same markup. Text colours come from
   --th-* tokens so the contrast check can read them. */
.card {
  --th-ink: var(--card-ink);
  --th-ink-2: var(--card-ink-2);
  --th-accent: var(--deck-text, #b03d25);
  --q-size: clamp(1.4rem, 5.4vw, 1.8rem);
  position: relative;
  display: flex; flex-direction: column;
  aspect-ratio: 5 / 7;
  padding: 22px 24px;
  border-radius: var(--r-card);
  color: var(--th-ink);
  /* Card stock: a faint top-left sheen and a darker bottom edge read as paper
     with thickness rather than a white rectangle. */
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 38%),
    linear-gradient(to bottom, var(--stock), #f3ecdf);
  box-shadow: inset 0 -2px 0 var(--stock-edge), var(--shadow);
  overflow: hidden;
  text-align: left;
}
/* The printed inner border every real card deck has. */
.card::before {
  content: ""; position: absolute; inset: 9px; z-index: 1;
  border: 1px solid color-mix(in srgb, var(--deck, #c4462c) 35%, transparent);
  border-radius: calc(var(--r-card) - 7px);
  pointer-events: none;
}
.card-art { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.art { display: none; position: absolute; inset: 0; }
.card-head, .card-q, .card-foot { position: relative; z-index: 2; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font: 700 0.8125rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--th-accent);
}
.card-roman, .card-deckname { display: none; }
/* The first letter has its own span for styles that make it an initial.
   Everywhere else it must not exist as a box: the question is a flex
   container, and a real span would split it into two columns. */
.q-initial { display: contents; }
.card-q {
  flex: 1; display: flex; align-items: safe center; min-height: 0;
  font: 500 var(--q-size)/1.25 var(--serif);
  letter-spacing: -0.01em; text-wrap: balance;
  padding: 12px 0;
}
.card-foot { display: flex; justify-content: flex-end; align-items: center; }
.card-level { font: 600 0.8125rem/1 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--th-ink-2); }

/* ------------------------------------------------------------ hero */
.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: clamp(24px, 5vw, 64px);
  padding: clamp(24px, 6vw, 72px) 0 clamp(40px, 7vw, 88px);
}
.hero h1 { font-size: clamp(2.4rem, 7vw, 4.2rem); line-height: 1.02; letter-spacing: -0.025em; }
.hero h1 em { font-style: normal; color: var(--ink-2); }
.lede { margin-top: 18px; font-size: clamp(1.05rem, 2.2vw, 1.2rem); color: var(--ink-2); max-width: 36rem; }
.hero .btn { margin-top: 28px; }

.fan { position: relative; height: clamp(340px, 44vw, 460px); }
.fan-slot { position: absolute; top: 50%; left: 50%; width: clamp(180px, 19vw, 225px); transform-origin: 50% 110%; }
.fan-slot .card { --q-size: clamp(1rem, 1.6vw, 1.25rem); }
.fan-slot:nth-child(1) { transform: translate(-50%, -50%) translateX(-62%) rotate(-9deg); }
.fan-slot:nth-child(2) { transform: translate(-50%, -50%) translateX(62%) rotate(8deg); z-index: 1; }
.fan-slot:nth-child(3) { transform: translate(-50%, -50%) translateY(-3%) rotate(-1deg); z-index: 2; }
/* The pile's card backs; themes.css gives each theme its own back. */
.pile, .pile::before {
  border-radius: var(--r-card);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 6px, transparent 6px 12px),
    var(--deck);
  box-shadow: inset 0 0 0 8px color-mix(in srgb, var(--deck) 80%, #000), var(--shadow);
}

/* ------------------------------------------------------------ sections */
.section { padding: clamp(32px, 6vw, 64px) 0; border-top: 1px solid var(--rule); }
.section h2 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.section-sub { margin-top: 8px; color: var(--ink-2); max-width: 40rem; }

/* Deck boxes: a coloured card box with the top card sticking out of it. */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 22px; margin-top: 28px; }
.box {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 200px; text-decoration: none; isolation: isolate;
}
.box-card {
  position: absolute; top: 0; left: 18px; right: 18px; height: 140px; z-index: -1;
  padding: 14px 16px; border-radius: 12px;
  font: 500 1rem/1.3 var(--serif); color: var(--card-ink);
  background: linear-gradient(to bottom, var(--stock), #f3ecdf);
  box-shadow: var(--shadow-sm);
  transform: rotate(-2deg);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.box-body {
  position: relative; display: flex; flex-direction: column; gap: 4px;
  padding: 20px 20px 18px; border-radius: 14px;
  background: linear-gradient(170deg, color-mix(in srgb, var(--deck) 88%, #fff) 0%, var(--deck) 45%, color-mix(in srgb, var(--deck) 82%, #000) 100%);
  color: var(--deck-on);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -3px 0 rgba(0, 0, 0, 0.18), var(--shadow-sm);
}
/* The box's thumb notch, where you pull the deck out. */
.box-body::before {
  content: ""; position: absolute; top: -1px; left: 50%; width: 54px; height: 14px; transform: translateX(-50%);
  border-radius: 0 0 27px 27px; background: color-mix(in srgb, var(--deck) 70%, #000);
  opacity: 0.55;
}
.box-name { font-size: 1.6rem; }
.box-meta { font-weight: 600; font-size: 0.9375rem; opacity: 0.88; }
.box:hover .box-card, .box:focus-visible .box-card { transform: translateY(-14px) rotate(-3deg); }
@media (prefers-reduced-motion: reduce) { .box-card { transition: none; } }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px 32px; }
.steps li { counter-increment: step; color: var(--ink-2); }
.steps li::before { content: counter(step); display: block; font: 600 2.4rem/1 var(--serif); color: var(--ink); margin-bottom: 8px; }
.steps strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------ deck page */
.deck-head { padding: clamp(16px, 4vw, 40px) 0 8px; max-width: 44rem; }
.about-deck { max-width: 44rem; padding: 0 0 clamp(32px, 6vw, 56px); }
/* Desktop: words on the left, the table on the right, all above the fold. */
@media (min-width: 900px) {
  .deck-top { display: grid; grid-template-columns: 1fr 400px; grid-template-rows: auto 1fr; column-gap: clamp(32px, 6vw, 88px); }
  .deck-top .deck-head { grid-column: 1; grid-row: 1; padding-top: 72px; }
  .deck-top .about-deck { grid-column: 1; grid-row: 2; padding-top: 20px; }
  .deck-top .table { grid-column: 2; grid-row: 1 / 3; padding-top: 12px; }
}
.about-deck .lede { margin: 0; }
.deck-note { margin-top: 14px; font-size: 0.9375rem; color: var(--ink-2); max-width: 40rem; }
.ordered-note { font: 600 0.8125rem/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); padding: 13px 0; }
.kicker { font: 700 0.8125rem/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.kicker::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; background: var(--deck, var(--ink-2)); }
.deck-head h1 { margin-top: 12px; font-size: clamp(2.1rem, 6vw, 3.4rem); }

.table { display: flex; flex-direction: column; align-items: center; padding: 28px 0 clamp(40px, 7vw, 72px); }
.modes { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--rule); }
.modes button {
  white-space: nowrap; display: inline-flex; align-items: center;
  min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  font: 600 0.9375rem/1 var(--sans); color: var(--ink-2);
}
.modes button:hover { color: var(--ink); }
.modes button[aria-checked="true"] { background: var(--ink); color: var(--ground); }

/* Narrower than the column so the rotated pile underneath never pokes past it. */
.stage { position: relative; width: min(100% - 28px, 360px); margin-top: 28px; }
.stage .card { cursor: pointer; z-index: 1; will-change: transform; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
/* The pile: two card backs under the live card. It thins as the deck runs down. */
.pile, .pile::before { position: absolute; inset: 0; }
.pile { transform: translate(6px, 8px) rotate(2.5deg); transition: opacity 0.3s; }
.pile::before { content: ""; transform: translate(-10px, 4px) rotate(-5deg); }
.stage[data-left="1"] .pile::before, .stage[data-left="0"] .pile::before { opacity: 0; }
.stage[data-left="0"] .pile { opacity: 0; }

.card.is-end .card-q { font-size: clamp(1.3rem, 4.6vw, 1.6rem); }

.controls { display: flex; align-items: center; gap: 12px; margin-top: 30px; }
.controls .btn-primary { min-width: 170px; }
.share-wrap { position: relative; display: inline-flex; }
.share-menu { position: absolute; bottom: calc(100% + 10px); right: 0; z-index: 5; min-width: 230px; }
.table-status { position: relative; margin-top: 14px; min-height: 1.6em; font-size: 0.9375rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.toast { position: absolute; left: 50%; top: 0; transform: translateX(-50%); white-space: nowrap; color: var(--ink); font-weight: 600; background: var(--ground-2); padding: 0 10px; border-radius: 999px; opacity: 0; transition: opacity 0.2s; }
.toast.is-on { opacity: 1; }
.hint { margin-top: 6px; font-size: 0.875rem; color: var(--ink-2); text-align: center; }
/* Without JS the table is a single static card; the controls would do nothing. */
html:not(.js) .modes, html:not(.js) .controls, html:not(.js) .table-status, html:not(.js) .hint { display: none; }

.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 32px; margin-top: 28px; }
.level h3 { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; }
.level ol { margin: 14px 0 0; padding-left: 1.6em; }
.level li { padding: 6px 0; font: 400 1.125rem/1.4 var(--serif); }
.level li::marker { font: 600 0.875rem var(--sans); color: var(--ink-2); }

/* ------------------------------------------------------------ prose */
.prose { max-width: 40rem; padding: clamp(20px, 5vw, 56px) 0 64px; }
.prose h1 { font-size: clamp(2.1rem, 6vw, 3rem); margin-bottom: 20px; }
.prose h2 { font-size: 1.5rem; margin: 36px 0 10px; }
.prose p, .prose ul { color: var(--ink-2); margin: 0 0 14px; }
.prose p:first-of-type { color: var(--ink); }
.prose a { color: var(--ink); text-underline-offset: 3px; }
.prose li { margin-bottom: 6px; }
.prose .updated { font-size: 0.9375rem; }
.notfound { padding-bottom: 16px; }
.notfound .kicker { margin-bottom: 14px; }

/* ------------------------------------------------------------ footer */
.foot {
  width: 100%; max-width: 1080px; margin: 0 auto; padding: 28px var(--gutter) 40px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px;
  border-top: 1px solid var(--rule); color: var(--ink-2); font-size: 0.9375rem;
}
.foot-brand { font: 600 1.05rem var(--serif); color: var(--ink); }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot a { color: var(--ink-2); text-underline-offset: 3px; }
.foot a:hover { color: var(--ink); }

/* ------------------------------------------------------------ small screens */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .fan { height: 300px; order: -1; }
  .fan-slot { width: 168px; }
  .fan-slot .card { --q-size: 0.95rem; padding: 16px 16px; }
  .fan-slot:nth-child(1) { transform: translate(-50%, -50%) translateX(-33%) rotate(-9deg); }
  .fan-slot:nth-child(2) { transform: translate(-50%, -50%) translateX(33%) rotate(8deg); z-index: 1; }
}
@media (max-width: 420px) {
  /* Four buttons plus symbols don't fit in one line on a small phone:
     symbols go above the label, and labels never break. */
  .modes button { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 46px; padding: 0 12px; white-space: nowrap; }
  .modes .lvl { margin-right: 0; }
  .bar-nav a { padding: 8px 10px; }
  /* Room for the colours button; About is still in the footer. */
  .bar-nav a[href="/about/"] { display: none; }
  .bar { gap: 8px; }
  .modes button { padding: 0 12px; font-size: 0.875rem; }
  .card { padding: 20px; }
  .controls .btn-primary { min-width: 0; flex: 1; }
  .controls { width: min(100%, 360px); }
}
/* Phones: the card and its Next button must fit on one screen, so the card
   gets squarer and the table closes up. */
@media (max-width: 600px) {
  .deck-head h1 { font-size: 2rem; margin-top: 10px; }
  .table { padding-top: 18px; }
  .stage { margin-top: 20px; }
  .stage .card { aspect-ratio: auto; height: clamp(270px, calc(100svh - 368px), 390px); }
  .controls { margin-top: 22px; }
}

/* ------------------------------------------------------------ question of the day */
.qotd { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: center; }
.qotd-stage { width: min(100% - 28px, 340px); justify-self: center; }
.qotd-stage .card { width: 100%; }
.qotd-page { padding: clamp(16px, 4vw, 40px) 0 clamp(32px, 6vw, 56px); }
.qotd-page h1 { margin-top: 12px; font-size: clamp(2.1rem, 6vw, 3.4rem); }
.qotd-page .lede, .qotd-band .section-sub { margin-bottom: 22px; }
.qotd-table { display: flex; flex-direction: column; align-items: center; }
.qotd-table .controls { margin-top: 26px; }
.qotd-band .qotd-stage { width: min(100% - 28px, 270px); }
.qotd-band .qotd-stage .card { --q-size: clamp(1.15rem, 4.4vw, 1.4rem); }
.recent { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 2px; max-width: 44rem; }
.recent li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.recent-date { color: var(--ink-2); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.recent a { font: 400 1.125rem/1.4 var(--serif); text-decoration: none; }
.recent a:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 900px) {
  .qotd-page { grid-template-columns: 1fr 380px; column-gap: clamp(32px, 6vw, 88px); }
  .qotd-band { grid-template-columns: 1fr 300px; column-gap: clamp(32px, 6vw, 88px); }
}
@media (max-width: 480px) {
  .recent li { grid-template-columns: 1fr; gap: 4px; }
}

/* ------------------------------------------------------------ feedback */
/* The feedback button: a real card rendered at fan size and shrunk, so every
   card style draws it with its own decorations. Solid (page text showing
   through a card looks broken); tilted at rest, pulled out on hover. */
.fb-fab {
  position: fixed; right: 14px; bottom: 14px; z-index: 30; width: 72px; height: 101px;
  transform: rotate(-7deg);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s;
}
.fb-fab:hover, .fb-fab:focus-within { transform: translateY(-6px) rotate(-3deg); }
/* Phones, while the card table's buttons or styles are on screen. */
.fb-fab.is-away { transform: translateY(140%) rotate(-7deg); opacity: 0; visibility: hidden; transition: transform 0.25s, opacity 0.2s, visibility 0s 0.25s; }
@media (max-width: 760px) {
  /* Room under the footer links for the card to rest without covering them. */
  .foot { padding-bottom: 112px; }
}
.fb-fab-card { position: absolute; left: 0; top: 0; width: 168px; transform: scale(0.4286); transform-origin: 0 0; pointer-events: none; }
.fb-fab-card .card { --q-size: 28px; padding: 16px; }
/* At this size ornaments need less room than text; site.js then shrinks the
   word until it fits on one line. Parchment's drop cap would split the word. */
.fb-fab-card .card-q { padding-left: 0; padding-right: 0; }
.fb-fab-card[data-theme="letterpress"] .card, .fb-fab-card[data-theme="parchment"] .card { padding-left: 20px; padding-right: 20px; }
.fb-fab-card[data-theme="neon"] .card { padding-left: 16px; padding-right: 16px; }
.fb-fab-card[data-theme="riso"] .card { padding-left: 16px; padding-right: 22px; }
.fb-fab-card[data-theme="riso"] .card-head { display: none; }
.fb-fab-card[data-theme="parchment"] .q-initial { display: contents; font: inherit; color: inherit; padding: 0; margin: 0; border: 0; background: none; }
.fb-fab-hit { position: absolute; inset: -4px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
html:not(.js) .fb-fab, .fb-fab[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .fb-fab { transition: opacity 0.2s; } }
@media print { .fb-fab { display: none; } }
/* Phones: a smaller card, tucked closer into the corner. (After the base rules,
   which would otherwise win.) */
@media (max-width: 600px) {
  .fb-fab { right: 10px; bottom: 10px; width: 52px; height: 73px; }
  .fb-fab-card { transform: scale(0.3095); }
}
/* A sheet of card stock, so its contrast is the card's in every scheme. */
.fb {
  width: min(100% - 32px, 460px); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: var(--r-card);
  background: var(--stock); color: var(--card-ink); box-shadow: var(--shadow);
}
.fb::backdrop { background: rgba(20, 14, 8, 0.55); }
.fb form { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.fb h2 { font-size: 1.5rem; }
.fb-sub { color: var(--card-ink-2); font-size: 0.9375rem; margin-top: -6px; }
.fb label { display: flex; flex-direction: column; gap: 6px; font: 600 0.9375rem/1.3 var(--sans); }
.fb textarea, .fb input[type="email"] {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--stock-edge); border-radius: 10px;
  background: #fff; color: var(--card-ink); font: 400 1rem/1.45 var(--sans);
}
.fb textarea { min-height: 128px; resize: vertical; }
.fb textarea:focus, .fb input:focus { outline: 2px solid #b3401f; outline-offset: 1px; border-color: transparent; }
.fb .fb-card { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 500; color: var(--card-ink-2); }
.fb .fb-card[hidden] { display: none; }
.fb .fb-card input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: #b3401f; flex: none; }
.fb .fb-card q { font-family: var(--serif); color: var(--card-ink); }
.fb-count { align-self: flex-end; margin-top: -8px; font-size: 0.8125rem; color: var(--card-ink-2); font-variant-numeric: tabular-nums; }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fb-actions { display: flex; justify-content: flex-end; gap: 10px; }
.fb .btn-primary { background: var(--card-ink); color: var(--stock); }
.fb .btn-primary:hover { background: #000; }
.fb .btn-ghost { color: var(--card-ink); box-shadow: inset 0 0 0 1.5px var(--stock-edge); }
.fb .btn-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--card-ink) 8%, transparent); }
.fb-status { min-height: 1.4em; font-size: 0.9375rem; color: var(--card-ink-2); }
.fb-status[data-kind="error"] { color: #a3361a; }
.fb-done { display: flex; flex-direction: column; gap: 14px; padding: 28px 24px 24px; }
.fb-done[hidden] { display: none; }
