/* ==========================================================================
   Gridchex: paper & ink design system
   ========================================================================== */

:root {
  --paper: #FBF8F1;
  --paper-2: #F4EFE3;
  --surface: #FFFFFF;
  --ink: #16181F;
  --ink-muted: #545866;
  --line: #E3DDCF;
  --line-strong: #16181F;
  --grid-line: rgba(22, 24, 31, 0.055);
  --marker: #6D28D9;
  --marker-ink: #FFFFFF;
  --marker-soft: #EEE8FC;
  --highlight: #FDE68A;
  --success: #15803D;
  --success-soft: #DCFCE7;
  --error: #B91C1C;
  --error-soft: #FEE2E2;
  --warn: #92400E;
  --warn-soft: #FEF3C7;
  --shadow: 0 1px 0 rgba(22, 24, 31, .04), 0 12px 32px -12px rgba(22, 24, 31, .18);
  --cell-pattern: #EEE8FC;

  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hand: "Kalam", "Comic Sans MS", cursive;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
  --radius: 14px;
  --radius-lg: 22px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --dur: 200ms;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111218; --paper-2: #171922; --surface: #1B1D27; --ink: #F2EFE8; --ink-muted: #A9ACB8;
    --line: #2D303C; --line-strong: #E9E5DC; --grid-line: rgba(242, 239, 232, 0.045);
    --marker: #A78BFA; --marker-ink: #14101F; --marker-soft: #2A2340; --highlight: rgba(250, 204, 21, .32);
    --success: #4ADE80; --success-soft: rgba(74, 222, 128, .12); --error: #F87171; --error-soft: rgba(248, 113, 113, .12);
    --warn: #FCD34D; --warn-soft: rgba(252, 211, 77, .12);
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 16px 40px -16px rgba(0, 0, 0, .6); --cell-pattern: #2A2340;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111218; --paper-2: #171922; --surface: #1B1D27; --ink: #F2EFE8; --ink-muted: #A9ACB8;
  --line: #2D303C; --line-strong: #E9E5DC; --grid-line: rgba(242, 239, 232, 0.045);
  --marker: #A78BFA; --marker-ink: #14101F; --marker-soft: #2A2340; --highlight: rgba(250, 204, 21, .32);
  --success: #4ADE80; --success-soft: rgba(74, 222, 128, .12); --error: #F87171; --error-soft: rgba(248, 113, 113, .12);
  --warn: #FCD34D; --warn-soft: rgba(252, 211, 77, .12);
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 16px 40px -16px rgba(0, 0, 0, .6); --cell-pattern: #2A2340;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
section[id], article[id] { scroll-margin-top: 80px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button, a, label.check { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--marker); outline-offset: 3px; border-radius: 6px; }
.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; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--s4); }
@media (min-width: 768px) { .container { padding: 0 var(--s6); } }
.narrow { max-width: 780px; }

.skip-link { position: absolute; left: var(--s4); top: -100px; z-index: 100; background: var(--ink); color: var(--paper); padding: var(--s2) var(--s4); border-radius: 8px; }
.skip-link:focus { top: var(--s4); }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 48px; padding: 0 var(--s5); border-radius: 999px; border: 2px solid transparent;
  font-weight: 600; font-size: 1rem; text-decoration: none; white-space: nowrap;
  transition: transform var(--dur) var(--ease-out), background-color var(--dur), color var(--dur), border-color var(--dur), box-shadow var(--dur);
}
.btn:active { transform: scale(.97); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--ink) 60%, transparent); }
.btn-marker { background: var(--marker); color: var(--marker-ink); }
.btn-marker:hover { box-shadow: 0 8px 22px -8px var(--marker); }
.btn-line { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-line:hover { border-color: var(--ink); }
.btn-ghost-light { background: transparent; color: var(--paper); border-color: color-mix(in srgb, var(--paper) 35%, transparent); }
.btn-ghost-light:hover { border-color: var(--paper); }
.btn[hidden] { display: none; }
.btn[disabled] { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-small { min-height: 44px; padding: 0 var(--s4); font-size: .9375rem; }
.btn-large { min-height: 56px; padding: 0 var(--s6); font-size: 1.0625rem; }
.btn-icon { padding: 0 14px; }
.btn-block { width: 100%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -0.03em; text-decoration: none; min-height: 44px; }
.brand-mark { width: 32px; height: 32px; }
.nav-links { display: none; list-style: none; margin: 0; padding: 0; gap: var(--s1); }
.nav-links a, .site-menu a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3);
  color: var(--ink-muted); text-decoration: none; font-weight: 500; font-size: .9375rem; border-radius: 999px;
  transition: color var(--dur), background-color var(--dur);
}
.nav-links a:hover, .site-menu a:hover { color: var(--ink); background: var(--paper-2); }
.nav-links a[aria-current="page"], .site-menu a[aria-current="page"] { color: var(--ink); background: var(--paper-2); }
.nav-end { display: flex; align-items: center; gap: var(--s2); }
.nav-toggle {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  border: 1.5px solid var(--line); background: transparent;
}
.nav-toggle[aria-expanded="true"] { background: var(--paper-2); border-color: var(--ink); }
.site-menu { border-top: 1px solid var(--line); background: var(--paper); }
.site-menu ul { list-style: none; margin: 0; padding: var(--s3) 0 var(--s4); display: grid; gap: 2px; }
.site-menu a { width: 100%; font-size: 1rem; border-radius: 10px; }
@media (min-width: 1000px) {
  .nav-links { display: flex; }
  .nav-toggle { display: none; }
  .site-menu { display: none; }
}
@media (max-width: 400px) { .nav-cta { display: none; } }

/* ---------- Shared bits ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: .8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--marker); margin-bottom: var(--s4);
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--marker); transform: rotate(45deg); }
.hl { background: linear-gradient(transparent 58%, var(--highlight) 58%, var(--highlight) 92%, transparent 92%); padding: 0 .06em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.small { font-size: .9375rem; color: var(--ink-muted); }

.section { padding: var(--s8) 0; }
@media (min-width: 768px) { .section { padding: var(--s9) 0; } }
.section-head { max-width: 760px; margin-bottom: var(--s7); }
.section-head h2 { font-size: clamp(2rem, 4.4vw, 3.25rem); font-weight: 800; letter-spacing: -0.035em; }
.section-lede { margin-top: var(--s4); font-size: 1.125rem; color: var(--ink-muted); max-width: 64ch; }
.section-lede strong, .section-lede em { color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s5); box-shadow: var(--shadow); }
@media (min-width: 768px) { .card { padding: var(--s6); } }
.card h3 { font-size: 1.3rem; font-weight: 700; margin: var(--s4) 0 var(--s2); }
.card p { color: var(--ink-muted); }
.card p + p { margin-top: var(--s3); }
.card p strong { color: var(--ink); }
.card-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--marker-soft); color: var(--marker); }

/* ---------- Hero ---------- */
.hero, .page-hero {
  position: relative; padding: var(--s7) 0 var(--s8);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px; background-position: -1px -1px;
}
.hero::after, .page-hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 120px; pointer-events: none; background: linear-gradient(transparent, var(--paper)); }
.hero-grid, .page-hero-grid { position: relative; z-index: 1; display: grid; gap: var(--s7); align-items: center; }
.page-hero-narrow .container { position: relative; z-index: 1; }
@media (min-width: 1024px) {
  .hero { padding: var(--s9) 0; }
  .hero-grid, .page-hero-grid { grid-template-columns: 1fr 1.04fr; gap: var(--s8); }
  .page-hero { padding: var(--s8) 0 var(--s9); }
}
.hero h1 { font-size: clamp(2.75rem, 7.2vw, 5.25rem); font-weight: 800; letter-spacing: -0.045em; line-height: .98; }
.page-hero h1 { font-size: clamp(2.4rem, 5.6vw, 4rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1.02; }
.lede { margin-top: var(--s5); font-size: clamp(1.0625rem, 1.6vw, 1.25rem); color: var(--ink-muted); max-width: 56ch; }
.hero-points { list-style: none; padding: 0; margin: var(--s6) 0 0; display: grid; gap: var(--s3); }
.hero-points li { display: flex; align-items: center; gap: var(--s3); font-weight: 500; }
.hero-points .icon { color: var(--marker); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }

/* ---------- Demo card ---------- */
.demo-card { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: var(--s5); min-width: 0; }
@media (min-width: 560px) { .demo-card { padding: var(--s6); } }
.demo-head { margin-bottom: var(--s5); }
.demo-kicker { font-family: var(--font-hand); color: var(--marker); font-size: 1.15rem; line-height: 1; margin-bottom: var(--s2); }
.demo-clue { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.2rem, 2.2vw, 1.45rem); letter-spacing: -0.02em; line-height: 1.25; }
.clue-len { color: var(--ink-muted); font-weight: 500; }
.demo-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-top: var(--s4); }
.chips-label { font-size: .875rem; color: var(--ink-muted); margin-right: var(--s1); }
.chip {
  min-height: 44px; padding: 0 var(--s4); border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper);
  font-weight: 600; font-size: .875rem; letter-spacing: .04em;
  transition: border-color var(--dur), background-color var(--dur), transform var(--dur) var(--ease-out);
}
.chip:hover { border-color: var(--ink); }
.chip:active { transform: scale(.96); }
.chip-ghost { letter-spacing: 0; font-weight: 500; color: var(--ink-muted); border-style: dashed; }

/* ---------- Validator ---------- */
.validator, .worked-figure { container-type: inline-size; min-width: 0; }
.v-boards {
  --cell: clamp(40px, calc((100cqi - 8px) / 5), 56px);
  display: grid; gap: var(--s5); grid-template-columns: 1fr; justify-items: center;
}
@container (min-width: 420px) {
  .v-boards { --cell: min(54px, calc((100cqi - 32px) / 10)); grid-template-columns: auto auto; justify-content: space-between; align-items: start; }
  .v-boards.v-single { grid-template-columns: auto; justify-content: center; }
}
.v-panel { display: grid; gap: var(--s2); justify-items: start; }
.v-label { font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.v-grid { display: grid; grid-template-columns: repeat(5, var(--cell)); border: 2.5px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: var(--surface); }
.cell {
  position: relative; width: var(--cell); height: var(--cell); display: grid; place-items: center; padding: 0;
  border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface);
  font-family: var(--font-display); font-weight: 500; font-size: calc(var(--cell) * .46); line-height: 1;
  transition: background-color 160ms;
}
.cell:nth-child(5n) { border-right: 0; }
.cell:nth-last-child(-n+5) { border-bottom: 0; }
button.cell:hover { background: var(--paper-2); }
.cell:focus-visible { outline-offset: -3px; border-radius: 0; z-index: 1; }
.cell .mark { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; color: var(--marker); opacity: .92; }
.mark.draw path { stroke-dasharray: 320; stroke-dashoffset: 320; animation: draw 260ms var(--ease-out) forwards; }
.mark.draw .mx + .mx { animation-delay: 90ms; }
.mark.draw .mp { animation-delay: 180ms; }
.mark.draw .mo { animation-delay: 160ms; animation-duration: 380ms; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.v-target {
  width: calc(var(--cell) * 5 + 5px); height: calc(var(--cell) * 5 + 5px);
  border: 2.5px dashed var(--line); border-radius: 10px; background: var(--paper); color: var(--ink);
}
.v-target svg { width: 100%; height: 100%; }
.v-count { justify-self: center; font-weight: 700; font-family: var(--font-display); font-size: 1.05rem; }

/* Static (build-time) grids: recolour the SVG for the theme */
.v-svg { width: calc(var(--cell) * 5 + 5px); height: calc(var(--cell) * 5 + 5px); background: var(--surface); border-radius: 6px; }
.v-svg svg { width: 100%; height: 100%; }
.v-svg .g-letter { fill: var(--ink); }
.v-svg .g-line { stroke: var(--line); }
.v-svg .g-border { stroke: var(--line-strong); }
.v-svg .g-marks { color: var(--marker); }

.v-input { margin-top: var(--s5); display: grid; gap: var(--s2); min-width: 0; }
.v-input label { font-weight: 600; font-size: .9375rem; }
.v-input-row, .field-row { display: flex; gap: var(--s2); min-width: 0; }
.v-input input, .field input[type="text"], .field textarea {
  flex: 1; width: 100%; min-width: 0; min-height: 52px; padding: 0 var(--s4);
  border: 2px solid var(--line); border-radius: 12px; background: var(--paper);
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: .14em; text-transform: uppercase;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.field textarea { padding: var(--s3) var(--s4); font-size: 1rem; letter-spacing: .08em; resize: vertical; line-height: 1.5; }
.v-input input::placeholder, .field input::placeholder { letter-spacing: .02em; font-weight: 500; color: var(--ink-muted); text-transform: none; font-family: var(--font-body); font-size: 1rem; }
.v-input input:focus, .field input:focus, .field textarea:focus { outline: none; border-color: var(--marker); box-shadow: 0 0 0 4px color-mix(in srgb, var(--marker) 22%, transparent); }

.v-status {
  display: flex; align-items: center; gap: var(--s2); min-height: 48px; margin-top: var(--s3);
  padding: var(--s2) var(--s4); border-radius: 12px; font-weight: 500; font-size: .9375rem;
  background: var(--paper-2); color: var(--ink-muted); transition: background-color var(--dur), color var(--dur);
}
.v-status.is-match { background: var(--success-soft); color: var(--success); font-weight: 600; }
.v-status.is-miss { background: var(--error-soft); color: var(--error); }
.v-status .icon { width: 18px; height: 18px; }

/* ---------- Problem ---------- */
.problem-grid { display: grid; gap: var(--s4); }
@media (min-width: 860px) { .problem-grid { grid-template-columns: repeat(3, 1fr); gap: var(--s5); } }
.mirror { display: inline-block; transform: scaleX(-1); font-family: var(--font-display); font-weight: 800; color: var(--ink); letter-spacing: .06em; background: var(--highlight); padding: 0 6px; border-radius: 4px; }

/* ---------- How: rules + worked ENVELOPE ---------- */
.how { background: var(--paper-2); }
.rules { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s4); }
@media (min-width: 640px) { .rules { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .rules { grid-template-columns: repeat(4, 1fr); gap: var(--s5); } }
.rule { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s5); }
.rule-mark { position: absolute; top: var(--s5); right: var(--s5); width: 56px; height: 56px; border: 1.5px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--paper); }
.mark-icon { width: 100%; height: 100%; }
.step-num { font-family: var(--font-hand); font-weight: 700; font-size: 2.6rem; line-height: 1; color: var(--marker); }
.rule h3 { font-size: 1.25rem; font-weight: 700; margin: var(--s4) 0 var(--s2); }
.rule p { color: var(--ink-muted); }

.worked {
  margin-top: var(--s6); display: grid; gap: var(--s6); align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: var(--s5); box-shadow: var(--shadow);
}
@media (min-width: 960px) { .worked { grid-template-columns: 1fr 1.1fr; padding: var(--s7); gap: var(--s7); } }
.worked > * { min-width: 0; }
.worked h3 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); font-weight: 800; letter-spacing: .02em; margin-bottom: var(--s3); }
.worked .eyebrow { margin-bottom: var(--s2); }
.worked-copy > p { color: var(--ink-muted); }
.worked-copy em { color: var(--ink); }
.table-wrap { overflow-x: auto; margin: var(--s5) 0 var(--s4); }
.edge-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.edge-table th, .edge-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.edge-table thead th { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.edge-table tbody th { font-family: var(--font-display); letter-spacing: .06em; }
.edge-table td { font-family: var(--font-display); letter-spacing: .12em; }

/* ---------- Builder ---------- */
.maker { display: grid; gap: var(--s5); background: var(--surface); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: var(--s5); }
.maker > * { min-width: 0; }
@media (min-width: 960px) { .maker { grid-template-columns: 320px 1fr; gap: var(--s7); padding: var(--s7); } }
.field label { display: block; font-weight: 600; margin-bottom: var(--s2); }
.label-note { font-weight: 400; color: var(--ink-muted); }
.help { margin-top: var(--s2); font-size: .875rem; color: var(--ink-muted); }
.error { margin-top: var(--s2); font-size: .875rem; font-weight: 600; color: var(--error); }
.field input[aria-invalid="true"] { border-color: var(--error); }
.options { margin: var(--s5) 0 0; padding: 0; border: 0; display: grid; gap: var(--s3); }
.options legend { font-weight: 600; margin-bottom: var(--s2); padding: 0; }
.check { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3); border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-size: .875rem; color: var(--ink-muted); }
.check:hover { border-color: var(--ink-muted); }
.check strong { display: block; color: var(--ink); font-size: .9375rem; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--marker); flex: none; }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s1); padding: var(--s1); background: var(--paper-2); border-radius: 14px; }
.maker-intro { font-size: .875rem; color: var(--ink-muted); margin-bottom: var(--s2); }
.tabs [role="tab"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 6px 8px; border: 0; border-radius: 10px; text-align: left;
  background: transparent; color: var(--ink-muted); font-weight: 600; font-size: .9375rem;
  transition: background-color var(--dur), color var(--dur), box-shadow var(--dur);
}
.tabs .tab-n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; background: var(--line); color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); }
.tabs [role="tab"][aria-selected="true"] .tab-n { background: var(--marker); color: var(--marker-ink); }
.tabs .tab-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.tabs .tab-help { font-size: .75rem; font-weight: 500; color: var(--ink-muted); }
@media (max-width: 640px) {
  .tabs { grid-template-columns: repeat(2, 1fr); }
}
.maker-panel { padding-top: var(--s5); }
.maker-caption { color: var(--ink-muted); min-height: 3.2em; max-width: 66ch; margin-bottom: var(--s5); }
.maker-caption strong { color: var(--ink); }
.maker-view { display: flex; justify-content: center; min-height: 260px; }
.maker-view > .validator { width: 100%; }
.stage-grid .cell { cursor: default; }
.cell.is-pattern { background: var(--cell-pattern); }
.cell .dot { width: 30%; height: 30%; border-radius: 50%; background: var(--marker); }
.cell.pop { animation: pop 260ms var(--ease-out); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.cell .letter-new { animation: fadeIn 260ms var(--ease-out) both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.maker-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s5); justify-content: flex-end; }
.maker-actions #maker-prev { margin-right: auto; }

.checker { margin-top: var(--s6); padding-top: var(--s6); border-top: 1.5px dashed var(--line); display: grid; gap: var(--s4); }
.checker[hidden] { display: none; }
.checker-head h3 { font-size: 1.35rem; font-weight: 700; margin-bottom: var(--s2); }
.checker-head p { color: var(--ink-muted); max-width: 66ch; }
.checker #checker-run { justify-self: start; }
.checker-results { display: grid; gap: var(--s3); }
.checker-results:empty { display: none; }
.checker-loading { color: var(--ink-muted); font-style: italic; }
.checker-clear, .checker-error { display: flex; gap: var(--s2); align-items: center; padding: var(--s3) var(--s4); border-radius: 12px; font-weight: 500; }
.checker-clear { background: var(--success-soft); color: var(--success); }
.checker-error { background: var(--error-soft); color: var(--error); }
.checker-group { padding: var(--s4); border-radius: 14px; border: 1.5px solid var(--line); background: var(--paper); }
.checker-group.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: var(--warn-soft); }
.checker-group h4 { display: flex; gap: var(--s2); align-items: center; font-size: 1rem; font-weight: 700; margin-bottom: var(--s2); }
.checker-group.warn h4 { color: var(--warn); }
.checker-group .note { font-size: .875rem; color: var(--ink-muted); margin-bottom: var(--s2); }
.word-list { font-family: var(--font-display); font-weight: 600; letter-spacing: .06em; line-height: 1.7; overflow-wrap: anywhere; }
.word-list .more { font-family: var(--font-body); font-weight: 400; letter-spacing: 0; color: var(--ink-muted); }
.verdicts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.verdicts li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s1) var(--s3); padding: var(--s2) var(--s3); border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.verdicts li strong { font-family: var(--font-display); letter-spacing: .06em; }
.verdicts li span { display: inline-flex; gap: 6px; align-items: center; font-size: .875rem; }
.verdicts li.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: var(--warn-soft); color: var(--warn); }
.verdicts li.ok span { color: var(--success); }
.verdicts .icon { width: 16px; height: 16px; }

/* ---------- Why (bento) ---------- */
.bento { display: grid; gap: var(--s4); }
@media (min-width: 768px) { .bento { grid-template-columns: repeat(2, 1fr); gap: var(--s5); } }
@media (min-width: 768px) { .bento-full { grid-column: 1 / -1; } }
@media (min-width: 1024px) {
  .bento { grid-template-columns: repeat(6, 1fr); }
  .bento > * { grid-column: span 3; }
  .bento > .bento-wide { grid-column: span 4; }
  .bento > .bento-narrow { grid-column: span 2; }
  .bento > .bento-full { grid-column: 1 / -1; }
}
.bento-wide p { font-size: 1.0625rem; max-width: 72ch; }
.card-note { background: var(--paper-2); box-shadow: none; border-style: dashed; }

/* ---------- Uses ---------- */
.use-pages { display: grid; gap: var(--s4); margin-bottom: var(--s5); }
@media (min-width: 860px) { .use-pages { grid-template-columns: repeat(3, 1fr); gap: var(--s5); } }
.use-page {
  display: flex; flex-direction: column; gap: var(--s2); padding: var(--s5); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  transition: border-color var(--dur), transform var(--dur) var(--ease-out);
}
.use-page:hover { border-color: var(--marker); transform: translateY(-2px); }
.use-page > .icon { width: 28px; height: 28px; color: var(--marker); margin-bottom: var(--s2); }
.use-page strong { font-family: var(--font-display); font-size: 1.35rem; }
.use-page span { color: var(--ink-muted); }
.use-page .go { margin-top: auto; padding-top: var(--s3); display: inline-flex; gap: 6px; align-items: center; color: var(--marker); font-weight: 600; }
.use-page .go .icon { width: 18px; height: 18px; }
.uses-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
@media (min-width: 640px) { .uses-grid { grid-template-columns: repeat(3, 1fr); } }
.use { display: flex; gap: var(--s4); align-items: flex-start; padding: var(--s5); border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.use .icon { color: var(--marker); width: 24px; height: 24px; margin-top: 2px; }
.use span { color: var(--ink-muted); }
.use strong { display: block; color: var(--ink); font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 2px; }

/* ---------- About ---------- */
.about { background: var(--paper-2); }
.about-grid { display: grid; gap: var(--s5); }
@media (min-width: 900px) { .about-grid { grid-template-columns: 1fr 1.3fr; gap: var(--s8); } }
.about h2 { font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 800; letter-spacing: -0.035em; }
.about-copy { display: grid; gap: var(--s4); font-size: 1.0625rem; color: var(--ink-muted); }
.about-copy a { color: var(--ink); text-decoration-color: var(--marker); text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* ---------- CTA ---------- */
.cta-card {
  display: grid; gap: var(--s5); align-items: center; padding: var(--s6) var(--s5); border-radius: 28px;
  background: var(--ink); color: var(--paper);
  background-image: linear-gradient(color-mix(in srgb, var(--paper) 7%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--paper) 7%, transparent) 1px, transparent 1px);
  background-size: 28px 28px;
}
@media (min-width: 900px) { .cta-card { grid-template-columns: 1fr auto; padding: var(--s7) var(--s8); } }
.cta-card h2 { font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 800; letter-spacing: -0.035em; }
.cta-card p { margin-top: var(--s3); color: color-mix(in srgb, var(--paper) 72%, var(--ink)); max-width: 52ch; font-size: 1.0625rem; }
.cta-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
.cta-card .btn-marker { --marker: #A78BFA; --marker-ink: #14101F; }
:root[data-theme="dark"] .cta-card .btn-marker { --marker: #6D28D9; --marker-ink: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cta-card .btn-marker { --marker: #6D28D9; --marker-ink: #fff; } }

/* ---------- Content pages ---------- */
.prose-section { padding-top: var(--s6); }
.prose-grid { display: grid; gap: var(--s6); align-items: start; }
@media (min-width: 1000px) { .prose-grid { grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s8); } }
.prose { max-width: 70ch; }
.prose h2 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); font-weight: 800; letter-spacing: -0.025em; margin: var(--s7) 0 var(--s3); }
.prose > h2:first-child { margin-top: 0; }
.prose p { color: var(--ink-muted); font-size: 1.0625rem; }
.prose p + p { margin-top: var(--s4); }
.prose p strong, .prose li strong { color: var(--ink); }
.prose a { color: var(--ink); text-decoration-color: var(--marker); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.ticks { list-style: none; padding: 0; margin: var(--s4) 0; display: grid; gap: var(--s3); }
.ticks li { position: relative; padding-left: 30px; color: var(--ink-muted); font-size: 1.0625rem; }
.ticks li::before { content: ""; position: absolute; left: 4px; top: .5em; width: 12px; height: 12px; border-radius: 3px; background: var(--marker); transform: rotate(45deg) scale(.75); }
.tips-card { position: sticky; top: 92px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: var(--s5); }
.tips-card h2 { font-size: 1.35rem; font-weight: 800; margin-bottom: var(--s4); }
.tips-card ol { margin: 0 0 var(--s5); padding-left: 1.3em; display: grid; gap: var(--s3); color: var(--ink-muted); font-size: .9375rem; }
.tips-card li::marker { font-family: var(--font-hand); font-weight: 700; color: var(--marker); }
.tips-card strong { color: var(--ink); }
.tips-card a:not(.btn) { color: var(--ink); text-decoration-color: var(--marker); }
@media (max-width: 999px) { .tips-card { position: static; } }
.callout { margin: var(--s6) 0; padding: var(--s5); border-radius: var(--radius-lg); border: 1.5px dashed var(--line); background: var(--paper-2); }
.callout h2 { margin-top: 0 !important; font-size: 1.35rem; }
.credit-line { margin: var(--s4) 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); }
.credit-line blockquote { margin: 0; flex: 1; min-width: 220px; }
.credit-line p { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--ink) !important; }

.downloads { display: grid; gap: var(--s5); }
@media (min-width: 900px) { .downloads { grid-template-columns: repeat(2, 1fr); gap: var(--s6); } }
.download { display: grid; grid-template-columns: 120px 1fr; gap: var(--s5); align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s5); box-shadow: var(--shadow); }
@media (min-width: 560px) { .download { grid-template-columns: 170px 1fr; } }
.download-preview { display: block; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; box-shadow: 0 6px 16px -10px rgba(0,0,0,.4); }
.download h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: var(--s2); }
.download-copy { display: grid; gap: var(--s3); justify-items: start; }
.download-copy p { color: var(--ink-muted); }
.download .meta { font-size: .875rem; }
@media (max-width: 559px) { .download { grid-template-columns: 1fr; } .download-preview { max-width: 200px; } }
.downloads-more { margin-top: var(--s7); }
.downloads-more h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: var(--s2); }
.downloads-more p { color: var(--ink-muted); }
.downloads-more a { color: var(--ink); text-decoration-color: var(--marker); text-decoration-thickness: 2px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: var(--s7) 0 var(--s5); color: var(--ink-muted); font-size: .9375rem; }
.footer-grid { display: grid; gap: var(--s6); }
@media (min-width: 860px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr; gap: var(--s7); } }
.footer-about { display: grid; gap: var(--s3); max-width: 46ch; }
.footer-credit a, .site-footer nav a, .footer-bottom a { color: var(--ink); text-decoration-color: var(--marker); text-underline-offset: 3px; }
.footer-h { font-family: var(--font-body); font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: var(--s3); }
.site-footer nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 36px; text-decoration: none; }
.site-footer nav a:hover, .site-footer nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--marker); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3); margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--line); }
.brand-small { font-size: 1.15rem; color: var(--ink); }
.brand-small .brand-mark { width: 26px; height: 26px; }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out); }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Print: a clean validator worksheet ---------- */
#print-sheet { display: none; }
@media print {
  body.print-validator > *:not(#print-sheet) { display: none !important; }
  body.print-validator { background: #fff; }
  body.print-validator #print-sheet { display: block; color: #000; font-family: var(--font-body); padding: 10mm; }
  #print-sheet h1 { font-size: 22pt; margin-bottom: 4mm; }
  #print-sheet .ps-q { font-size: 12pt; margin: 6mm 0 10mm; }
  #print-sheet .ps-q span { display: inline-block; width: 120mm; border-bottom: 1px solid #000; }
  #print-sheet .ps-boards { display: flex; gap: 16mm; align-items: flex-start; }
  #print-sheet .ps-label { font-size: 9pt; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3mm; }
  /* 12 mm grid cells; target cells are 12 mm x scale (>= 0.75), so >= 9 mm */
  #print-sheet .ps-grid, #print-sheet .ps-target { width: 60mm; height: 60mm; }
  #print-sheet .ps-target { border: 1pt dashed #999; border-radius: 2mm; }
  #print-sheet svg { width: 100%; height: 100%; }
  #print-sheet .ps-count { text-align: center; font-weight: 700; margin-top: 2mm; }
  #print-sheet .ps-how { margin-top: 12mm; font-size: 10.5pt; max-width: 160mm; line-height: 1.5; }
  #print-sheet .ps-credit { margin-top: 6mm; font-size: 9pt; color: #444; }
}
