/* Hazelbrook Press — public site.
   Layout: one calm column on squared puzzle paper; the code and the brand mark are drawn as crossword cells.
   Palette comes from the puzzler's desk: graphite, pencil yellow, squared paper, a cool brook teal for links. */
@font-face { font-family: "Bricolage"; src: url(/fonts/bricolage-grotesque-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url(/fonts/bricolage-grotesque-latin-800-normal.woff2) format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url(/fonts/atkinson-hyperlegible-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url(/fonts/atkinson-hyperlegible-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #f3f6f4;
  --surface: #ffffff;
  --ink: #1b2a2f;
  --ink-soft: #46575c;
  --line: #d3dbd7;
  --grid: #e3e9e6;
  --pencil: #f5b82e;
  --pencil-deep: #d99a0b;
  --on-pencil: #1b2a2f;
  --brook: #1a6770;
  --cell-dark: #1b2a2f;
  --bad: #a3261e;
  --bad-bg: #fbeceb;
  --good: #1d6b43;
  --good-bg: #e8f4ec;
  --display: "Bricolage", "Trebuchet MS", "Segoe UI", sans-serif;
  --body: "Atkinson", Verdana, "Segoe UI", sans-serif;
  --cell: 28px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12191c;
    --surface: #1a2428;
    --ink: #eaf0ed;
    --ink-soft: #a9b8b8;
    --line: #32434a;
    --grid: #1c272b;
    --pencil: #f5b82e;
    --pencil-deep: #ffd166;
    --on-pencil: #1b2a2f;
    --brook: #7fcbd3;
    --cell-dark: #eaf0ed;
    --bad: #ff9c94;
    --bad-bg: #3a1f1d;
    --good: #8fd6ac;
    --good-bg: #1b3326;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  color: var(--ink);
  font: 400 1.1875rem/1.55 var(--body); /* 19px: comfortable for older eyes */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brook); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { text-decoration-thickness: 2.5px; }
:focus-visible { outline: 3px solid var(--brook); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-weight: 800; font-size: clamp(2rem, 6.2vw, 3rem); }
h2 { font-weight: 800; font-size: clamp(1.4rem, 4vw, 1.75rem); }
h3 { font-weight: 600; font-size: 1.2rem; }
p { margin: 0; }

.wrap { width: 100%; max-width: 44rem; margin-inline: auto; padding-inline: max(20px, env(safe-area-inset-left, 0px)) max(20px, env(safe-area-inset-right, 0px)); }
.wrap.wide { max-width: 62rem; }
.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.stack.tight { gap: 0.6rem; }
.stack.loose { gap: 2.5rem; }

/* ---------- header ---------- */
.site-head { padding-block: 1.1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--ink); text-decoration: none; font: 800 1.2rem/1 var(--display); letter-spacing: -0.01em; }
.mark { display: grid; grid-template-columns: repeat(2, 15px); grid-template-rows: repeat(2, 15px); border: 2px solid var(--cell-dark); background: var(--cell-dark); gap: 2px; flex: none; }
.mark i { background: var(--surface); }
.mark i:nth-child(1) { background: var(--pencil); }
.mark i:nth-child(4) { background: var(--cell-dark); }

main { flex: 1; padding-block: 1rem 3.5rem; }

/* ---------- crossword cells ---------- */
.cells { display: inline-flex; border: 2px solid var(--cell-dark); background: var(--cell-dark); gap: 2px; }
.cells span { width: 2.1rem; height: 2.4rem; display: grid; place-items: center; background: var(--surface); font: 800 1.35rem/1 var(--display); color: var(--ink); }
.eyebrow { font: 700 0.875rem/1 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); display: flex; align-items: center; gap: 0.6rem; }
.eyebrow::before { content: ""; width: 0.85rem; height: 0.85rem; background: var(--pencil); border: 2px solid var(--cell-dark); flex: none; }
.hl { background: linear-gradient(transparent 62%, var(--pencil) 62%, var(--pencil) 92%, transparent 92%); padding-inline: 0.08em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
@media (prefers-color-scheme: dark) { .hl { background: none; color: var(--pencil); padding: 0; } }
.lede { font-size: 1.3rem; line-height: 1.45; color: var(--ink-soft); max-width: 34rem; }
.bonus-info .lede { font-size: 1.1875rem; }

/* ---------- sheets (the one raised surface on a page) ---------- */
.sheet { background: var(--surface); border: 2px solid var(--cell-dark); box-shadow: 6px 6px 0 var(--cell-dark); padding: 1.5rem; }
@media (min-width: 40rem) { .sheet { padding: 2rem; } }
@media (prefers-color-scheme: dark) { .sheet { box-shadow: 6px 6px 0 var(--line); border-color: var(--line); } }

/* ---------- forms ---------- */
label, .label { font-weight: 700; font-size: 1.0625rem; display: block; }
.field { display: flex; flex-direction: column; gap: 0.45rem; }
input[type="email"], input[type="text"], textarea {
  width: 100%; font: 400 1.25rem/1.3 var(--body); color: var(--ink); background: var(--surface);
  border: 2px solid var(--cell-dark); border-radius: 0; padding: 0.85rem 0.9rem; min-height: 3.5rem; appearance: none;
}
@media (prefers-color-scheme: dark) { input[type="email"], input[type="text"], textarea { border-color: var(--ink-soft); } }
textarea { min-height: 7rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-soft); opacity: 0.75; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem; width: 100%; min-height: 3.75rem; padding: 0.8rem 1.4rem;
  font: 800 1.25rem/1.15 var(--display); color: var(--on-pencil); background: var(--pencil); border: 2px solid #1b2a2f; border-radius: 0;
  cursor: pointer; text-decoration: none; text-align: center; box-shadow: 4px 4px 0 #1b2a2f; transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { background: var(--pencil-deep); }
@media (prefers-color-scheme: dark) { .btn { box-shadow: 4px 4px 0 var(--line); } .btn:hover { background: var(--pencil-deep); } }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #1b2a2f; }
.btn.plain { background: var(--surface); color: var(--ink); border-color: var(--cell-dark); font-size: 1.0625rem; min-height: 3.1rem; box-shadow: none; width: auto; }
.btn.plain:hover { background: var(--grid); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
.fine { font-size: 0.9375rem; line-height: 1.5; color: var(--ink-soft); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.note { padding: 0.9rem 1rem; border-left: 6px solid var(--bad); background: var(--bad-bg); color: var(--ink); font-weight: 700; }
.note.ok { border-color: var(--good); background: var(--good-bg); }
.or { text-align: center; }

/* ---------- bonus page ---------- */
.bonus-top { display: grid; gap: 1.25rem; align-items: start; grid-template-areas: "head" "info"; }
.bonus-top.has-cover { grid-template-columns: 5.5rem 1fr; grid-template-areas: "head head" "cover info"; }
.bonus-head { grid-area: head; }
.bonus-info { grid-area: info; min-width: 0; }
.cover { grid-area: cover; width: 100%; border: 2px solid var(--cell-dark); box-shadow: 4px 4px 0 var(--pencil); background: var(--surface); }
@media (min-width: 40rem) {
  .bonus-top.has-cover { grid-template-columns: 11rem 1fr; grid-template-areas: "cover head" "cover info"; column-gap: 2.25rem; grid-template-rows: auto 1fr; }
  .cover { box-shadow: 6px 6px 0 var(--pencil); }
}
.inside { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.inside li { display: flex; gap: 0.7rem; align-items: baseline; }
.inside li::before { content: ""; width: 0.8rem; height: 0.8rem; flex: none; border: 2px solid var(--cell-dark); background: var(--surface); translate: 0 0.05rem; }
.inside small { color: var(--ink-soft); font-size: 0.9375rem; white-space: nowrap; }

.files { display: flex; flex-direction: column; gap: 1rem; }
.files .btn { justify-content: space-between; text-align: left; }
.files .btn small { font: 400 0.9375rem/1 var(--body); white-space: nowrap; }

/* ---------- shelf of other books ---------- */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 1.5rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.shelf a { color: var(--ink); text-decoration: none; display: flex; flex-direction: column; gap: 0.6rem; }
.shelf img, .shelf .nocover { aspect-ratio: 2 / 3; width: 100%; object-fit: cover; border: 2px solid var(--cell-dark); background: var(--surface); }
.shelf .nocover { display: grid; place-items: center; padding: 0.75rem; font: 800 1rem/1.15 var(--display); text-align: center; }
.shelf b { font: 600 1rem/1.25 var(--display); }
.shelf span { font-size: 0.9375rem; color: var(--brook); text-decoration: underline; text-underline-offset: 3px; }
.shelf a:hover img, .shelf a:hover .nocover { box-shadow: 4px 4px 0 var(--pencil); }

/* ---------- choices (vote) ---------- */
.choices { display: flex; flex-wrap: wrap; gap: 0.6rem; }

details.quiet summary { cursor: pointer; font-weight: 700; color: var(--brook); text-decoration: underline; text-underline-offset: 3px; list-style: none; display: inline-block; padding-block: 0.4rem; }
details.quiet summary::-webkit-details-marker { display: none; }
details.quiet[open] summary { margin-bottom: 1rem; }

.rule { border: 0; border-top: 2px solid var(--line); margin: 0; }
.steps { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 0.5rem; }
.prose { display: flex; flex-direction: column; gap: 1rem; max-width: 38rem; }
.prose h2 { margin-top: 1rem; }

/* ---------- home ---------- */
.hero { display: grid; gap: 2rem; padding-block: 1.5rem 1rem; }
@media (min-width: 52rem) { .hero { grid-template-columns: 1.15fr 1fr; align-items: center; gap: 3rem; padding-block: 3rem 2rem; } }
.codebox input { font: 800 1.6rem/1 var(--display); letter-spacing: 0.3em; text-transform: uppercase; text-align: center; }
.codebox input::placeholder { letter-spacing: 0.3em; }

/* ---------- footer ---------- */
.site-foot { border-top: 2px solid var(--line); background: var(--paper); padding-block: 1.5rem 2rem; font-size: 0.9375rem; color: var(--ink-soft); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }
.site-foot a { color: var(--ink-soft); }
