/* Public static pages (PD-085): the welcome page an uninvited visitor gets at
   "/". Folio: paper, ink, one touch of yellow (FOLIO_DESIGN_RULES §0/§1;
   colors are CwPalette light/dark). The default page loads only same-origin
   styles and images.
   Reusable layout: .page > .brand, .hero, .copy (h1, .lead, .status,
   .actions, .note), footer. A text page (About, How to play) is
   .page.text > header.top (a.brand, a.button Play), .copy (h1, .lead, h2,
   h3, p, ol), footer. */
:root {
  color-scheme: light dark;
  --paper: #F5F2EB;
  --ink: #16171B;
  --on-ink: #FFFFFF;
  --muted: #63666E;
  --hairline: #E3DED3;
  --cursor: #FFC43D;
  --serif: Merriweather, Georgia, "Times New Roman", serif;
  --sans: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121316;
    --ink: #F1EEE7;
    --on-ink: #16171B;
    --muted: #A3A19B;
    --hairline: #2E2F35;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.5 var(--sans);
  overflow-wrap: anywhere;
}
a { color: inherit; }
a:focus-visible { outline: 3px solid var(--cursor); outline-offset: 3px; }

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  display: grid;
  gap: 24px;
  grid-template-areas: "brand" "hero" "copy" "foot";
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 12px; }
.brand img { width: 40px; height: 40px; border-radius: 10px; }
.brand span { font: 400 22px/1.2 var(--serif); }
a.brand { justify-self: start; min-height: 44px; text-decoration: none; }
/* Text pages: the brand and one Play link into the game (same origin "/"),
   on the first screen at every width; a plain link, no script. */
.top {
  grid-area: brand;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.top .button { padding: 0 20px; }

.hero { grid-area: hero; margin: 0; }
.hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  background: var(--hairline);
}
@media (prefers-color-scheme: dark) {
  /* A light illustration, toned down so it does not glare on dark paper. */
  .hero img { filter: brightness(0.82); }
}

.copy { grid-area: copy; display: grid; gap: 16px; align-content: start; }
.copy h1 { margin: 0; font: 400 30px/1.25 var(--serif); }
.copy p { margin: 0; }
.lead { color: var(--muted); max-width: 32em; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
}
.status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--cursor);
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button {
  font: 600 17px/1.5 var(--sans);
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 600;
  text-decoration: none;
}
.button.secondary {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--ink);
}
.note { color: var(--muted); font-size: 15px; }

footer {
  grid-area: foot;
  display: flex;
  flex-wrap: wrap;
  column-gap: 24px;
  border-top: 1px solid var(--hairline);
  padding-top: 16px;
  font-size: 15px;
}
footer a,
footer .note { display: inline-flex; align-items: center; min-height: 44px; }
.analytics-options summary,
.analytics-options button { min-height: 44px; cursor: pointer; }
.analytics-options summary { line-height: 44px; }
.analytics-options p { margin: 0 0 12px; }
.analytics-options button {
  padding: 0 12px;
  border: 1px solid currentColor;
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: 600 1em/1.5 var(--sans);
}
.analytics-options button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--on-ink);
}
.analytics-options :focus-visible { outline: 3px solid var(--cursor); outline-offset: 3px; }

@media (min-width: 840px) {
  .page {
    padding: 40px 32px 48px;
    column-gap: 56px;
    row-gap: 40px;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-areas: "brand brand" "copy hero" "foot foot";
    align-items: center;
  }
  .copy h1 { font-size: 40px; }
}

/* Text pages: one readable column at every width. */
.page.text { max-width: 44rem; }
.text .copy h2 { margin: 12px 0 0; font: 400 22px/1.3 var(--serif); }
.text .copy h3 { margin: 8px 0 -8px; font: 600 16px/1.4 var(--sans); }
.text .copy ol, .text .copy ul:not([class]) { margin: 0; padding-left: 1.4em; display: grid; gap: 8px; }
@media (min-width: 840px) {
  .page.text {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "brand" "copy" "foot";
    align-items: start;
  }
}

/* Guide articles: illustrations and real game screenshots. */
.text .copy figure { margin: 8px 0; display: grid; gap: 8px; }
.text .copy figure img { width: 100%; height: auto; border-radius: 16px; display: block; }
.text .copy figure.shot img { max-width: 300px; border: 1px solid var(--hairline); }
.text .copy figcaption { font-size: 14px; line-height: 1.4; color: var(--muted); }
.text .copy .pair { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; align-items: start; }
.text .copy .pair figure.shot img { max-width: 100%; }
.text .copy dl { margin: 0; display: grid; gap: 12px; }
.text .copy dt { font-weight: 600; }
.text .copy dd { margin: 0; }
.text .copy ul.guides { margin: 0; padding: 0; list-style: none; display: grid; gap: 16px; }
.text .copy ul.guides a { font-weight: 600; }
.text .copy .crumbs { font-size: 14px; color: var(--muted); }

/* Sample puzzles (ADR-0058): inline SVG grids and folded answers. */
:root { --cell: #FFFFFF; --cell-line: #B9B3A7; --block: #16171B; }
@media (prefers-color-scheme: dark) {
  :root { --cell: #1C1D21; --cell-line: #4A4B52; --block: #050506; }
}
.puzzle-grid { width: 100%; max-width: 300px; height: auto; display: block; }
.puzzle-grid .cell { fill: var(--cell); stroke: var(--cell-line); stroke-width: 1; }
.puzzle-grid .block { fill: var(--block); stroke: var(--block); stroke-width: 1; }
.puzzle-grid .frame { fill: none; stroke: var(--ink); stroke-width: 3; }
.puzzle-grid .num { font: 500 12px var(--sans); fill: var(--muted); }
.puzzle-grid .letter { font: 600 30px var(--sans); fill: var(--ink); text-anchor: middle; }
.text .copy ul.clues { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.text .copy ul.clues b { display: inline-block; min-width: 2em; }
.text .copy ul.clues .source { color: var(--muted); font-size: 14px; }
.archive-date { display: flex; flex-wrap: wrap; column-gap: 16px; align-items: center; }
.archive-date a { display: inline-flex; align-items: center; gap: .25em; min-height: 44px; }
.text .copy details { border-top: 1px solid var(--hairline); }
.text .copy details summary { cursor: pointer; padding: 12px 0; line-height: 20px; }
.text .copy details p { margin: 0 0 12px; }
.text .copy details figure { margin: 0 0 12px; }

/* Word finder (ADR-0058 amendment 1 §4): one GET form; results are a word grid. */
.solver { display: grid; gap: 8px; min-width: 0; }
.solver label { font-weight: 600; }
.solver-row { display: flex; flex-wrap: wrap; gap: 12px; }
.solver input {
  flex: 1 1 10em;
  width: 10em;
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--cell-line);
  border-radius: 12px;
  background: var(--cell);
  color: var(--ink);
  font: 600 20px/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.solver input:focus-visible { outline: 3px solid var(--cursor); outline-offset: 2px; }
.text .copy ul.lengths { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0 20px; }
.text .copy ul.lengths a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.text .copy ul.words {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10em, 1fr));
  gap: 4px 16px;
  font: 600 16px/1.75 var(--sans);
  letter-spacing: 0.06em;
}
.solver-filters { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px 12px; }
.solver-filters label { font-weight: 400; color: var(--muted); }
.solver-filters input { font-size: 17px; min-height: 44px; }
.text .copy nav.az { display: flex; flex-wrap: wrap; gap: 0 4px; }
.text .copy nav.az a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; font-weight: 600; }
.word-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(14em, 1fr)); gap: 8px 24px; }
.text .copy .word-groups h3 { margin: 8px 0 0; }
/* Guide tables (a quick-reference grid on a text page). */
.text .copy table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.4; }
.text .copy th, .text .copy td { text-align: left; vertical-align: top; padding: 8px 8px 8px 0; border-bottom: 1px solid var(--hairline); }
.text .copy th { font-weight: 600; }

/* Word Pix landing (eval 3 B N-P1-7): one sample picture with its empty
   letter boxes; the whole sample opens a puzzle. */
.text .copy .wordpix-sample {
  display: grid; justify-items: center; gap: 12px; margin: 8px 0 4px;
  text-decoration: none;
}
.text .copy .wordpix-sample picture { display: block; width: min(100%, 280px); }
.text .copy .wordpix-sample img {
  width: 100%; height: auto; display: block;
  border-radius: 16px; border: 1px solid var(--hairline);
}
/* Word Pix landing examples (2026-11-15): public-only pictures, answer folded. */
.text .copy .wordpix-example {
  display: grid; justify-items: center; gap: 12px; margin: 24px 0;
  padding-top: 16px; border-top: 1px solid var(--hairline);
}
.text .copy .wordpix-example h3 { justify-self: start; margin: 0; }
.text .copy .wordpix-example img {
  width: 100%; height: auto; display: block;
  border-radius: 16px; border: 1px solid var(--hairline);
}
.text .copy .wordpix-example picture { display: block; width: min(100%, 240px); }
.text .copy .wordpix-example details { justify-self: stretch; }
.text .copy .wordpix-example .wordpix-slots { justify-self: stretch; justify-content: center; }
.text .copy .wordpix-example .wordpix-slots span { flex: 0 1 40px; width: auto; min-width: 0; }
.wordpix-slots { display: flex; gap: 8px; }
.wordpix-slots span {
  width: 40px; height: 44px; border-radius: 8px;
  border: 2px solid var(--muted); background: var(--paper);
}

/* Clue answer pages: the answer first (2026-11-14 SEO template). */
.text .copy .answer-card { font-size: 20px; line-height: 28px; padding: 12px 16px; margin: 8px 0 16px;
  border: 1px solid var(--hairline); border-radius: 12px; }
.text .copy .answer-card strong { letter-spacing: 0.08em; }

/* Printable crosswords (PD-121): the sheet is the only thing on paper. */
.print-facts { color: var(--muted); }
.print-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.print-actions .print-pdf { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--ink); border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 500; }
.print-clues { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 32px; }
.print-clues h2 { margin-top: 16px; }
.clue-list { list-style: none; padding: 0; margin: 0; }
.clue-list li { padding: 4px 0; line-height: 22px; }
.clue-list b { display: inline-block; min-width: 2em; }
.print-sheet figure { margin: 16px 0; }
.print-only { display: none; }
/* Seasonal sets on the printable hub (2026-11-15): one card per puzzle. */
.toc { margin: 8px 0 16px; line-height: 28px; }
.puzzle-card { margin: 24px 0 32px; padding-top: 8px; border-top: 1px solid var(--hairline); }
.puzzle-card .meta { color: var(--muted); margin: 4px 0; }
.puzzle-card figure { margin: 16px 0; }
.puzzle-card .print-clues h4 { margin: 16px 0 4px; }
.puzzle-card details { margin-top: 12px; }
.puzzle-card summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 500; }
@media print {
  :root { --paper: #FFFFFF; --ink: #000000; --muted: #333333; --cell: #FFFFFF; --cell-line: #000000; --block: #000000; }
  body { background: #FFFFFF; color: #000000; }
  header.top, footer, .no-print { display: none !important; }
  .print-page h1 { display: none; }
  .print-only { display: block; }
  .print-heading { font: 600 14pt var(--sans); margin: 0 0 8pt; }
  .print-foot { font-size: 8pt; margin-top: 12pt; }
  .print-sheet figure { break-inside: avoid; page-break-inside: avoid; margin: 0 0 12pt; }
  .print-sheet .puzzle-grid { max-width: 4.2in; }
  .print-clues { grid-template-columns: 1fr 1fr; gap: 0 24pt; font-size: 10.5pt; }
  .print-clues h2 { font-size: 12pt; margin: 0 0 4pt; }
  .clue-list li { padding: 1pt 0; line-height: 1.3; break-inside: avoid; }
  .page { padding: 0; max-width: none; }
  /* The hub prints its seasonal sets only, one puzzle per sheet; an opened
     answer list prints on a sheet of its own. */
  .print-hub > :not(.seasonal), .seasonal > :not(.puzzle-card) { display: none !important; }
  .puzzle-card { break-after: page; page-break-after: always; border: 0; margin: 0; }
  .seasonal:last-of-type > .puzzle-card:last-child { break-after: auto; page-break-after: auto; }
  .puzzle-card .puzzle-grid { max-width: 4.2in; }
  .puzzle-card details { display: none; }
  .puzzle-card details[open] { display: block; break-before: page; page-break-before: always; }
  .puzzle-card summary { display: none; }
  .puzzle-card .print-clues h4 { font-size: 12pt; margin: 0 0 4pt; }
}
