/*
  Sam Ashford puzzles: one stylesheet for every page. No build step.
  Colours are the app's "Scotland Yard Dossier" tokens (books-puzzle-app/lib/ui/tokens.dart).
  The page is dark walnut. Paper things stay light: the legal sheets and the solved card.
  Contrast of every text pair is listed in README.md.
*/

/* ---------- Fonts (self-hosted, SIL Open Font Licence, see NOTICE.md) ---------- */
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/PlayfairDisplay-Variable.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/PlusJakartaSans-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("../fonts/CourierPrime-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --page: #1b110c;        /* walnut: the page */
  --raised: #241914;      /* a surface one step up */
  --raised-2: #281d18;
  --raised-3: #332722;
  --line: #534344;        /* hairlines, frames */
  --text: #f4ded5;        /* cream */
  --text-soft: #d8c1c2;
  --rose: #ffb2bb;        /* titles and links on the dark page */
  --burgundy: #5e1f2b;
  --brass: #c99a3e;       /* frames only, never text */
  --gold: #f2bf5f;        /* gold text on the dark page */
  --gold-soft: #f4d068;   /* focus ring */
  --gold-ink: #412d00;    /* text on gold */
  --parchment: #f4ede1;   /* paper */
  --manila: #f2e2be;
  --ink: #241108;         /* text on paper */
  --crimson: #701c28;     /* titles and links on paper */

  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Courier Prime", "Courier New", Courier, monospace;

  --gutter: 1rem;
  --band: clamp(3.5rem, 2rem + 6vw, 6.5rem);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 500 1.125rem/1.6 var(--sans);
  letter-spacing: 0.005em;
  overflow-wrap: break-word;
}
img, svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, table { margin: 0; padding: 0; }
ul, ol { list-style: none; }
::selection { background: var(--burgundy); color: var(--text); }

a { color: var(--rose); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
a:hover { color: var(--gold); }
:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 3px; border-radius: 2px; }

.wrap { width: min(100% - 2 * var(--gutter), 70rem); margin-inline: auto; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 10;
  padding: 0.6rem 1rem; background: var(--parchment); color: var(--ink); border-radius: 8px; font-weight: 700;
}
.skip:focus { top: 0.5rem; color: var(--ink); }

/* A link slot waits for its address: it shows only when href is filled in (README, "Placeholders"). */
a.slot[href=""], a.slot:not([href]) { display: none; }

/* ---------- Type ---------- */
h1, h2, h3, h4 { font-family: var(--serif); color: var(--rose); font-weight: 800; text-wrap: balance; }
h1 { font-size: clamp(2.75rem, 1.6rem + 5.6vw, 5.25rem); line-height: 1.02; letter-spacing: -0.012em; }
h2 { font-size: clamp(2rem, 1.45rem + 2.6vw, 3.125rem); line-height: 1.1; letter-spacing: -0.008em; }
h3 { font-size: 1.4rem; line-height: 1.25; font-weight: 700; }
h4 { font-size: 1.15rem; line-height: 1.3; font-weight: 700; color: var(--text); }
p { text-wrap: pretty; }
strong { font-weight: 700; color: var(--text); }

.label {            /* the typewriter face, for a few small labels only */
  font-family: var(--mono); font-weight: 700; font-size: 1rem; line-height: 1.3; letter-spacing: 0.03em;
}
.chip {
  display: inline-block; padding: 0.2em 0.75em 0.12em; border-radius: 999px;
  border: 1.5px solid var(--rose); color: var(--rose);
  font-family: var(--mono); font-weight: 700; font-size: 1rem; line-height: 1.4; letter-spacing: 0.02em;
}
.chip-live { border-color: var(--gold); background: var(--gold); color: var(--gold-ink); }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--raised-2); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.4rem 1.5rem; padding-block: 0.8rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.7rem;
  font-family: var(--serif); font-weight: 800; font-size: 1.3rem; color: var(--text); text-decoration: none;
}
.brand:hover { color: var(--rose); }
.brand img { width: 2.5rem; height: 2.5rem; border-radius: 22%; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0.1rem clamp(0.85rem, 4vw, 1.4rem); }
.site-nav a { display: inline-block; padding-block: 0.55rem; font-weight: 600; font-size: 1.0625rem; }
.site-nav a[aria-current="page"] { color: var(--text); text-decoration-color: var(--brass); text-decoration-thickness: 2.5px; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(2.25rem, 1rem + 5vw, 5rem) var(--band); }
.hero .wrap { display: grid; gap: 2rem; }
.hero-top { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.5rem; }
/* The app's name is the site's name, then the game's: it breaks only between the two, and is sized so the first part
   fits the hero's text column at every width. */
.hero h1 { font-size: clamp(2.6rem, 1.7rem + 4vw, 4.25rem); }
.hero h1 .keep { white-space: nowrap; }
.hero-icon { width: 4.5rem; height: 4.5rem; border-radius: 22%; }
.promise {
  margin-top: 1.25rem; max-width: 22ch;
  font-family: var(--serif); font-weight: 600; font-size: clamp(1.45rem, 1.2rem + 1.2vw, 1.95rem); line-height: 1.28; color: var(--text);
}
.hero-more > p { max-width: 34rem; color: var(--text-soft); }
.soon {
  margin-top: 1.75rem; max-width: 30rem; padding: 1rem 1.25rem 1.05rem;
  background: var(--raised-2); border: 1.5px solid var(--brass); border-radius: 12px;
}
.soon-line { font-weight: 700; font-size: 1.25rem; line-height: 1.35; color: var(--text); }
.soon-note { margin-top: 0.3rem; font-size: 1.0625rem; color: var(--text-soft); }
.store-link {         /* a store address as a button; still a link, so still underlined */
  display: inline-block; margin: 0.9rem 0.75rem 0 0; padding: 0.7rem 1.2rem 0.75rem;
  background: var(--gold); color: var(--gold-ink); border: 2px solid var(--gold); border-radius: 10px;
  font-weight: 700; font-size: 1.125rem; line-height: 1.3;
}
.store-link:hover { background: var(--gold-soft); border-color: var(--gold-soft); color: var(--gold-ink); }
.plan img { width: 100%; }
.plan figcaption { margin-top: 1rem; max-width: 36rem; }
figcaption { font-size: 1rem; line-height: 1.5; color: var(--text-soft); }

@media (min-width: 62rem) {
  .hero .wrap {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-areas: "head plan" "more plan";
    grid-template-rows: auto 1fr;
    column-gap: clamp(2.5rem, 5vw, 4.5rem); row-gap: 1.5rem; align-items: start;
  }
  .hero-head { grid-area: head; }
  .hero-top .chip { display: none; }   /* the "Coming soon" box is already in view beside it */
  .hero-more { grid-area: more; }
  .plan { grid-area: plan; align-self: center; }
}

/* ---------- Bands (the page's sections) ---------- */
.band { padding-block: var(--band); border-top: 1px solid var(--line); }
.band-head { max-width: 42rem; margin-bottom: clamp(2rem, 1.2rem + 3vw, 3.25rem); }
.band-head p { margin-top: 1.1rem; color: var(--text-soft); font-size: 1.2rem; line-height: 1.55; }
.prose > * + * { margin-top: 1.1rem; }
.prose { max-width: 38rem; }

/* Phone screenshots: real screens, in a plain hairline frame */
.phone { display: block; border: 1px solid var(--line); border-radius: 1.35rem; overflow: hidden; background: var(--raised); }
.phone img { width: 100%; }
a.phone:hover { border-color: var(--brass); }
.shot figcaption { margin-top: 0.8rem; }
.shots-note { margin-top: 1.25rem; font-size: 1rem; color: var(--text-soft); }

/* How a case works */
.game-grid { display: grid; gap: 3rem; }
.rules { counter-reset: rule; max-width: 38rem; border-top: 1px solid var(--line); }
.rules li {
  counter-increment: rule; position: relative;
  padding: 1.1rem 0 1.15rem 3.4rem; border-bottom: 1px solid var(--line);
}
.rules li::before {
  content: counter(rule); position: absolute; left: 0; top: 1.05rem;
  width: 2.3rem; height: 2.3rem; border-radius: 50%; background: var(--raised-3);
  display: grid; place-items: center; padding-top: 0.15em;
  font-family: var(--mono); font-weight: 700; font-size: 1.15rem; line-height: 1; color: var(--rose);
}
.rules h3 { margin-bottom: 0.25rem; }
.rules p { color: var(--text-soft); }
.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 1rem; align-items: start; max-width: 36rem; }
@media (min-width: 62rem) {
  /* the rules beside the two screens, then the two paragraphs side by side under both */
  .game-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 3.5rem clamp(2.5rem, 5vw, 4.5rem); align-items: start; }
  .game-grid .rules { max-width: none; }
  .shots { gap: 1.5rem; max-width: none; }
  .game-grid .prose {
    grid-column: 1 / -1; max-width: none;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2.5rem, 5vw, 4.5rem);
  }
  .game-grid .prose > * + * { margin-top: 0; }
}

/* The packs */
.packs-grid { display: grid; gap: 3rem; }
.pack-list { display: grid; gap: 1.6rem 2.5rem; }
.pack { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.pack img { width: 5.5rem; height: 5.5rem; border-radius: 12px; border: 1px solid var(--line); }
.pack h3 { margin-bottom: 0.2rem; }
.pack p { color: var(--text-soft); line-height: 1.5; }
.pack .crimes { margin-top: 0.35rem; color: var(--gold); font-size: 1.0625rem; font-weight: 600; }
.home-shot { max-width: 17rem; }
.terms-note {
  margin-top: 2.75rem; max-width: 40rem; padding: 1.1rem 1.25rem; border-left: 3px solid var(--brass); background: var(--raised);
}
.terms-note p + p { margin-top: 0.6rem; }
@media (min-width: 48rem) {
  .packs-grid { grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: clamp(2.5rem, 5vw, 4.5rem); align-items: start; }
  .home-shot { max-width: none; }
}
@media (min-width: 66rem) {
  .packs-grid { grid-template-columns: minmax(0, 17rem) minmax(0, 1fr); }
  .pack-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Calm and fair */
.fair-grid { display: grid; gap: 3rem; }
.fair-list { display: grid; gap: 1.75rem; max-width: 38rem; }
.fair-list h3 { margin-bottom: 0.3rem; }
.fair-list p { color: var(--text-soft); }
.solved { max-width: 21rem; }
.solved img { width: 100%; }
.solved figcaption { margin-top: 0.8rem; }
@media (min-width: 48rem) {
  .fair-grid { grid-template-columns: minmax(0, 19rem) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 5.5rem); align-items: start; }
  .solved { order: -1; max-width: none; }
}

/* Languages: the five names, each in its own language, like the game's language picker */
.lang-names { display: flex; flex-wrap: wrap; gap: 0.2rem 1.4rem; margin-top: 0.7rem; }
.lang-names li { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; line-height: 1.4; color: var(--text); }

/* Books */
.shelf + .shelf { margin-top: 3.5rem; }
.shelf-head h3 { color: var(--text); font-size: 1.6rem; }
.shelf-head p { margin-top: 0.5rem; max-width: 40rem; color: var(--text-soft); }
.book-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1rem; margin-top: 1.75rem; }
.book-cover { border: 1px solid var(--line); border-radius: 3px; width: 100%; aspect-ratio: 440 / 569; }
.book h4 { margin-top: 0.85rem; }
.book p { margin-top: 0.3rem; font-size: 1rem; line-height: 1.5; color: var(--text-soft); }
.book .chip { margin-top: 0.7rem; }
.book .slot { display: block; margin-top: 0.6rem; font-weight: 700; }
@media (min-width: 36rem) { .book-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.25rem 1.5rem; } }
@media (min-width: 62rem) {
  .book-list { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  /* three books: their text takes the first two of the five columns, so the covers line up with the row below */
  .shelf-three { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: 1.5rem; align-items: start; }
  .shelf-three .shelf-head { grid-column: 1 / 3; padding-right: 1.5rem; }
  .shelf-three .book-list { grid-column: 3 / 6; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0; }
}

/* A book without a finished cover: a plain tile, clearly not a cover */
.cover-tile { display: flex; flex-direction: column; background: var(--raised-2); container-type: inline-size; }
.cover-tile svg { flex: 1 1 60%; width: 100%; min-height: 0; padding: 14% 16% 10%; }
.cover-tile-band {
  flex: 0 0 40%; display: flex; flex-direction: column; justify-content: center; gap: 0.35rem;
  padding: 0.5rem 0.6rem; background: var(--burgundy); border-top: 2px solid var(--brass); text-align: center;
}
.cover-tile-title { font-family: var(--serif); font-weight: 800; font-size: clamp(1rem, 11cqw, 1.5rem); line-height: 1.1; color: var(--text); }
.cover-tile-note { font-family: var(--mono); font-weight: 700; font-size: 1rem; line-height: 1.2; color: var(--text); }

/* How it is made */
.made { width: 100%; max-width: 56rem; border-collapse: collapse; border-top: 1px solid var(--line); }
.made th, .made td { text-align: left; vertical-align: top; padding: 1.1rem 1.5rem 1.15rem 0; border-bottom: 1px solid var(--line); }
.made thead th { font-family: var(--sans); font-weight: 600; font-size: 1rem; color: var(--text-soft); padding-block: 0.7rem; }
.made tbody th { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; line-height: 1.3; color: var(--text); width: 30%; }
.made .by { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.02em; color: var(--gold); width: 26%; }
.made td:last-child { color: var(--text-soft); padding-right: 0; }
@media (max-width: 47.99rem) {
  .made thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .made, .made tbody, .made tr, .made th, .made td { display: block; width: auto; }
  .made tr { padding: 1.1rem 0 1.15rem; border-bottom: 1px solid var(--line); }
  .made tbody th, .made tbody td, .made .by { padding: 0; border: 0; width: auto; }
  .made .by { margin: 0.15rem 0 0.4rem; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--raised-2); padding-block: 2.75rem 3rem; }
.footer-grid { display: grid; gap: 2rem; }
.footer-about { max-width: 30rem; color: var(--text-soft); }
.footer-about .brand { margin-bottom: 0.75rem; }
.footer-nav ul { display: grid; gap: 0.15rem; }
.footer-nav a { display: inline-block; padding-block: 0.4rem; font-weight: 600; }
.small-print { margin-top: 2.25rem; padding-top: 1.5rem; border-top: 1px solid var(--line); max-width: 52rem; font-size: 1rem; line-height: 1.55; color: var(--text-soft); }
.small-print p + p { margin-top: 0.6rem; }
@media (min-width: 48rem) {
  .footer-grid { grid-template-columns: minmax(0, 1fr) auto; gap: 4rem; }
}

/* ---------- Legal pages: a sheet of paper on the desk ---------- */
.legal-main { padding-block: clamp(1.25rem, 4vw, 3.5rem) var(--band); }
.sheet {
  width: min(100% - 2 * var(--gutter), 47rem); margin-inline: auto;
  padding: clamp(1.5rem, 0.6rem + 4.5vw, 4rem); padding-bottom: clamp(2rem, 1rem + 5vw, 4.5rem);
  background: var(--parchment); color: var(--ink); border-radius: 4px;
  font-weight: 450; font-size: 1.125rem; line-height: 1.7; letter-spacing: 0; color-scheme: light;
}
.sheet h1, .sheet h2, .sheet h3 { color: var(--crimson); }
.sheet h1 { font-size: clamp(2.4rem, 1.7rem + 3.4vw, 3.5rem); }
.sheet h2 { font-size: clamp(1.5rem, 1.3rem + 1vw, 1.85rem); line-height: 1.2; margin-top: 2.75rem; padding-top: 1.75rem; border-top: 1px solid #cbbfae; }
.sheet h3 { font-size: 1.25rem; margin-top: 1.75rem; }
.sheet p, .sheet ul, .sheet ol { margin-top: 1rem; }
.sheet ul { list-style: disc; padding-left: 1.4rem; }
.sheet ul li + li, .sheet ol li + li { margin-top: 0.45rem; }
.sheet strong { color: var(--ink); font-weight: 700; }
.sheet a { color: var(--crimson); }
.sheet a:hover { color: var(--ink); }
.sheet :focus-visible { outline-color: var(--crimson); }
.sheet ::selection { background: var(--crimson); color: var(--parchment); }
.updated time { white-space: nowrap; }
.updated { margin-top: 1rem; font-family: var(--mono); font-weight: 700; font-size: 1rem; letter-spacing: 0.02em; color: var(--ink); }
.sheet .lede { margin-top: 1.5rem; font-size: 1.2rem; line-height: 1.6; }
.summary { margin-top: 2rem; padding: 1.25rem 1.4rem 1.4rem; background: var(--manila); border: 1.5px solid var(--brass); border-radius: 8px; }
.summary h2 { margin-top: 0; padding-top: 0; border-top: 0; font-size: 1.35rem; }
.summary p { margin-top: 0.6rem; }
.contents { margin-top: 2.25rem; }
.contents h2 { margin-top: 0; padding-top: 0; border-top: 0; font-size: 1.2rem; }
.contents ol { list-style: decimal; padding-left: 1.6rem; margin-top: 0.6rem; }
.contents li { padding-block: 0.3rem; }
.contents li + li { margin-top: 0; }
.fill-in { margin-top: 1rem; padding: 1rem 1.2rem; border: 2px dashed var(--crimson); border-radius: 6px; }
.fill-in .label { display: block; color: var(--crimson); }
.fill-in p { margin-top: 0.4rem; }

/* ---------- 404 ---------- */
.lost { padding-block: clamp(3rem, 2rem + 8vw, 7rem); }
.lost .wrap { max-width: 40rem; }
.lost svg { width: 6.5rem; height: 6.5rem; margin-bottom: 2rem; }
.lost p { margin-top: 1.1rem; color: var(--text-soft); font-size: 1.2rem; }
.lost ul { margin-top: 1.75rem; display: grid; gap: 0.3rem; }
.lost li a { display: inline-block; padding-block: 0.4rem; font-weight: 700; }

/* ---------- Print: ink on white, nothing decorative ---------- */
@media print {
  :root {
    --page: #fff; --raised: #fff; --raised-2: #fff; --raised-3: #eee; --line: #999;
    --text: #000; --text-soft: #222; --rose: #000; --gold: #000; --parchment: #fff; --manila: #fff; --ink: #000; --crimson: #000;
    color-scheme: light;
  }
  body { font-size: 11.5pt; }
  .site-nav, .footer-nav, .skip, .contents, .shots-note { display: none; }
  .site-header, .site-footer { background: none; }
  .sheet { width: auto; padding: 0; border-radius: 0; }
  .legal-main, .band, .hero { padding-block: 1.5rem; }
  .chip-live { background: none; border-color: #000; color: #000; }
  .cover-tile-band { background: none; }
  a { text-decoration: underline; }
  h2, h3 { break-after: avoid; }
  li, tr, figure, .summary, .fill-in { break-inside: avoid; }
}
