/* ==========================================================================
   Orchard Stories — shared stylesheet
   Design notes and token rationale live in the repo README.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -moz-text-size-adjust: none; -webkit-text-size-adjust: none; text-size-adjust: none; }
body, h1, h2, h3, p, figure, blockquote, dl, dd { margin: 0; }
ul[class], ol[class] { list-style: none; margin: 0; padding: 0; }
img, picture, svg { max-width: 100%; display: block; }
input, button, textarea, select { font: inherit; color: inherit; }

:root {
  --ground: #F7F8F6;
  --surface: #FFFFFF;
  --surface-sunk: #EEF1EE;
  --ink: #16211C;
  --ink-soft: #4A554E;
  --ink-faint: #78837C;
  --rule: #D8DED9;
  --rule-strong: #B9C2BB;
  --sage: #2E5E4E;
  --sage-soft: #E2ECE6;
  --harvest: #8A6410;
  --harvest-bright: #C9A227;
  --harvest-soft: #F5EDD6;
  --slate: #3F5F76;
  --slate-soft: #E4EBF0;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", ui-serif, Georgia, serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 62ch;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --spine: 12rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0E1512;
    --surface: #16211C;
    --surface-sunk: #121B17;
    --ink: #E3E9E4;
    --ink-soft: #A9B4AD;
    --ink-faint: #7C8880;
    --rule: #2A3831;
    --rule-strong: #3D4E45;
    --sage: #79AE96;
    --sage-soft: #1B2C25;
    --harvest: #E0B347;
    --harvest-bright: #E0B347;
    --harvest-soft: #2A2314;
    --slate: #92B2C7;
    --slate-soft: #16232C;
  }
}
:root[data-theme="dark"] {
  --ground: #0E1512;
  --surface: #16211C;
  --surface-sunk: #121B17;
  --ink: #E3E9E4;
  --ink-soft: #A9B4AD;
  --ink-faint: #7C8880;
  --rule: #2A3831;
  --rule-strong: #3D4E45;
  --sage: #79AE96;
  --sage-soft: #1B2C25;
  --harvest: #E0B347;
  --harvest-bright: #E0B347;
  --harvest-soft: #2A2314;
  --slate: #92B2C7;
  --slate-soft: #16232C;
}

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; text-wrap: balance; letter-spacing: -0.01em; }
a { color: var(--sage); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--harvest-bright);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip { position: absolute; left: -9999px; top: 0; background: var(--sage); color: var(--ground); padding: 0.6rem 1rem; z-index: 10; }
.skip:focus { left: 0.5rem; top: 0.5rem; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- structure ---------- */

.wrap { max-width: 76rem; margin: 0 auto; padding: 0 var(--gutter); }

.band { border-top: 1px solid var(--rule); }
.band-inner {
  display: grid;
  grid-template-columns: var(--spine) minmax(0, 1fr);
  gap: 0 3rem;
  padding: clamp(2.5rem, 5vw, 4.5rem) 0;
}
@media (max-width: 60rem) { .band-inner { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; } }

.marginal {
  font-family: var(--mono); font-size: 0.68rem; line-height: 1.5;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint);
  display: flex; flex-direction: column; gap: 0.5rem; padding-top: 0.55rem;
}
.marginal .rule-tick { width: 1.5rem; height: 1px; background: var(--rule-strong); }

.col { display: flex; flex-direction: column; gap: 1.5rem; }
.prose { max-width: var(--measure); display: flex; flex-direction: column; gap: 1rem; }
.prose p { color: var(--ink-soft); }
.prose strong { color: var(--ink); font-weight: 600; }

h2 { font-size: clamp(1.65rem, 3.2vw, 2.3rem); line-height: 1.15; }
h3 { font-size: 1.12rem; line-height: 1.3; }

/* ---------- masthead ---------- */

.masthead { display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; padding: 1.75rem 0 1.5rem; }
.wordmark { font-family: var(--serif); font-size: 1.2rem; letter-spacing: 0.02em; color: var(--ink); text-decoration: none; display: flex; align-items: baseline; gap: 0.6rem; }
.wordmark .glyph { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sage); border: 1px solid var(--rule-strong); border-radius: 999px; padding: 0.2rem 0.55rem; }
.navlinks { display: flex; gap: 1.5rem; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; }
.navlinks a { color: var(--ink-faint); text-decoration: none; }
.navlinks a:hover, .navlinks a[aria-current="page"] { color: var(--sage); }

/* ---------- buttons ---------- */

.btn {
  font-family: var(--sans); font-size: 0.95rem; font-weight: 500;
  padding: 0.72rem 1.35rem; border-radius: 3px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; display: inline-block;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--sage); color: var(--ground); border-color: var(--sage); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--sage); color: var(--sage); }
.ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* ---------- home: hero ---------- */

.hero-lite { padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(1.75rem, 3vw, 2.5rem); }
.hero-lite h1 {
  font-size: clamp(1.9rem, 4.6vw, 3.1rem); line-height: 1.08;
  letter-spacing: -0.02em; max-width: 20ch;
}
.hero-lite p { margin-top: 0.85rem; font-size: 1.08rem; color: var(--ink-soft); max-width: 46ch; }

/* ---------- home: the shelf ---------- */

/* Three across, capped — six cards land as a tidy 3×2, and the cap stops covers
   sprawling on wide screens so most of the shelf stays in view at once. */
.shelf {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.25rem, 3vw, 2.25rem);
  max-width: 58rem;
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 48rem) { .shelf { grid-template-columns: repeat(2, 1fr); } }

.book { display: flex; flex-direction: column; gap: 0.6rem; text-decoration: none; color: inherit; }

/* Square trim — the house format is a standard square picture book (8.5in).
   Placeholders and real cover art share the ratio, so swapping an <img> in
   changes nothing structurally. */
.cover {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: var(--surface-sunk);
  overflow: hidden; position: relative;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }

/* Covers with real art carry their own hand-lettered title, painted into the illustration
   the way a printed picture book does. An earlier version typeset the title over the art in
   CSS and it read as a stock image with a caption bar. The title now lives in the artwork;
   the alt text carries it for screen readers and search. */
.cover.art { display: block; }

/* Placeholder composition echoes the real cover: title up top, mark at the foot,
   a soft warm ground standing in for the illustration. */
.cover.ph {
  padding: 1.4rem 1.1rem 0.9rem;
  display: flex; flex-direction: column; justify-content: space-between;
  text-align: center;
  background-image: radial-gradient(120% 80% at 50% 115%, rgba(0,0,0,0.07), transparent 60%);
}
.cover.ph .ctitle {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.05rem, 1.85vw, 1.4rem); line-height: 1.15;
  letter-spacing: -0.01em; color: var(--ink);
}
.cover.ph .cmark {
  font-family: var(--mono); font-size: 0.54rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-faint);
}

/* Per-title grounds, so a shelf of placeholders still reads as a set
   rather than five copies of the same card. */
.cover.tint-cream { background-color: #F2E7CE; }
.cover.tint-blue  { background-color: #DCE5EA; }
.cover.tint-sand  { background-color: #F0E6D4; }
.cover.tint-green { background-color: #DFE9DC; }
.cover.tint-mauve { background-color: #E5DEE6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cover.tint-cream { background-color: #2C2617; }
  :root:not([data-theme="light"]) .cover.tint-blue  { background-color: #1B2831; }
  :root:not([data-theme="light"]) .cover.tint-sand  { background-color: #2A2519; }
  :root:not([data-theme="light"]) .cover.tint-green { background-color: #1B2A22; }
  :root:not([data-theme="light"]) .cover.tint-mauve { background-color: #262130; }
}
:root[data-theme="dark"] .cover.tint-cream { background-color: #2C2617; }
:root[data-theme="dark"] .cover.tint-blue  { background-color: #1B2831; }
:root[data-theme="dark"] .cover.tint-sand  { background-color: #2A2519; }
:root[data-theme="dark"] .cover.tint-green { background-color: #1B2A22; }
:root[data-theme="dark"] .cover.tint-mauve { background-color: #262130; }

.book-meta { display: flex; flex-direction: column; gap: 0.15rem; }
.book-title { font-family: var(--serif); font-size: 1rem; line-height: 1.25; color: var(--ink); }
.book-sit { font-size: 0.86rem; color: var(--ink-soft); line-height: 1.4; }
.book-status {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); margin-top: 0.2rem;
}
.book-status.is-production { color: var(--sage); }
.book-maker { font-size: 0.8rem; color: var(--ink-faint); font-style: italic; }

/* the ask card, styled as part of the shelf */
.book.ask .cover {
  background: transparent;
  background-image: none;
  border-style: dashed;
  border-color: var(--harvest);
}
/* auto margins centre the title while the foot mark stays on the baseline
   the other covers use — space-between alone would pin it to the top. */
.book.ask .cover .ctitle { font-style: italic; color: var(--harvest); margin: auto 0; }

/* ---------- home: request ---------- */

.request { max-width: 46rem; display: flex; flex-direction: column; gap: 1rem; }
.request .examples { font-size: 0.9rem; color: var(--ink-faint); line-height: 1.7; }
.request .examples strong { color: var(--ink-soft); font-weight: 500; }

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field + .field { margin-top: 1rem; }
.field label { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-faint); }
.field input, .field select, .field textarea {
  font-family: var(--sans); font-size: 0.95rem; padding: 0.6rem 0.7rem;
  border: 1px solid var(--rule-strong); border-radius: 3px;
  background: var(--surface); color: var(--ink); width: 100%;
}
.field textarea { min-height: 6rem; resize: vertical; }
.form-note { font-size: 0.85rem; color: var(--ink-faint); }
.submit-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 0.4rem; }
.stub { font-family: var(--mono); font-size: 0.72rem; color: var(--harvest); letter-spacing: 0.04em; }

/* ---------- doors ---------- */

.doors { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
@media (max-width: 52rem) { .doors { grid-template-columns: 1fr; } }
.door { background: var(--surface); padding: 1.5rem 1.35rem; display: flex; flex-direction: column; gap: 0.7rem; }
.door .eyebrow { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-faint); }
.door p { font-size: 0.93rem; color: var(--ink-soft); }
.door .door-link { font-size: 0.9rem; margin-top: auto; padding-top: 0.4rem; }

/* ---------- pilot page ---------- */

.slots { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-soft); }
.slot-row { display: flex; gap: 0.4rem; }
.slot { width: 0.85rem; height: 0.85rem; border-radius: 999px; border: 1.5px solid var(--harvest); background: transparent; }
.slot.taken { background: var(--harvest); }

.chart { border: 1px solid var(--rule-strong); background: var(--surface); border-radius: 4px; overflow: hidden; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--rule); background: var(--surface-sunk); font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.chart-head .weight { color: var(--ink); }
.chart-body { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 46rem) { .chart-body { grid-template-columns: 1fr; } }
.chart-cell { padding: 1.35rem 1.25rem; }
.chart-cell + .chart-cell { border-left: 1px solid var(--rule); }
@media (max-width: 46rem) { .chart-cell + .chart-cell { border-left: none; border-top: 1px solid var(--rule); } }
.chart-cell h3 { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sage); font-weight: 600; margin-bottom: 0.9rem; }
.chart-foot { border-top: 1px solid var(--rule); padding: 0.85rem 1.25rem; background: var(--harvest-soft); font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.05em; color: var(--ink); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.ticklist { display: flex; flex-direction: column; gap: 0.7rem; }
.ticklist li { display: grid; grid-template-columns: 1.1rem 1fr; gap: 0.6rem; font-size: 0.95rem; color: var(--ink-soft); line-height: 1.5; }
.ticklist li::before { content: ""; width: 7px; height: 7px; margin-top: 0.5rem; border-radius: 1px; background: var(--sage); }
.ticklist.open li::before { background: transparent; border: 1.5px solid var(--rule-strong); }

.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
@media (max-width: 52rem) { .stages { grid-template-columns: 1fr; } }
.stage { background: var(--surface); padding: 1.35rem 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }
.stage-no { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em; color: var(--harvest); }
.stage p { font-size: 0.93rem; color: var(--ink-soft); }
.stage .dur { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-faint); letter-spacing: 0.06em; }

.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; min-width: 34rem; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-faint); font-weight: 500; background: var(--surface-sunk); }
tbody tr:last-child td { border-bottom: none; }
td.src { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-faint); white-space: nowrap; }
td.what { color: var(--ink); }
td.note { color: var(--ink-soft); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
@media (max-width: 52rem) { .stats { grid-template-columns: 1fr; } }
.stat { background: var(--surface); padding: 1.4rem 1.25rem; display: flex; flex-direction: column; gap: 0.55rem; }
.stat .fig { font-family: var(--serif); font-size: clamp(2rem, 4vw, 2.6rem); line-height: 1; color: var(--slate); font-variant-numeric: tabular-nums; }
.stat p { font-size: 0.92rem; color: var(--ink-soft); }
.stat a { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em; color: var(--slate); text-decoration: none; border-bottom: 1px solid var(--rule-strong); align-self: flex-start; padding-bottom: 1px; }
.stat a:hover { border-color: var(--slate); }

.callout { border-left: 3px solid var(--slate); background: var(--slate-soft); padding: 1.1rem 1.25rem; border-radius: 0 3px 3px 0; max-width: var(--measure); display: flex; flex-direction: column; gap: 0.6rem; }
.callout h3 { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--slate); }
.callout p { font-size: 0.95rem; color: var(--ink-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; max-width: 58rem; }
.chip { font-size: 0.88rem; padding: 0.45rem 0.8rem; border: 1px solid var(--rule-strong); border-radius: 999px; color: var(--ink-soft); background: var(--surface); }
.chip.lead { border-color: var(--sage); color: var(--sage); background: var(--sage-soft); }
.chip.open { border-style: dashed; border-color: var(--harvest); color: var(--harvest); background: transparent; }

/* ---------- footer ---------- */

.foot { border-top: 1px solid var(--rule); padding: 2.5rem 0 3.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
.foot-row { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; align-items: baseline; }
.foot p { font-size: 0.88rem; color: var(--ink-faint); max-width: 50ch; }
.privacy { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--ink-soft); border: 1px dashed var(--rule-strong); padding: 0.7rem 0.9rem; border-radius: 3px; max-width: 46rem; }
