/* =========================================================================
   A Coast Running Out of Water — companion website stylesheet
   Palette: "Saltbush & slate" — cool-dry paper, ink hairlines, square
   corners, no drop-shadows. Depth comes from tone and hairlines, not blur.
   Identity: gulf-blue (water) vs wheat-gold (drought). See
   design/tokens.css and design/STYLE-GUIDE.md — the single source of truth.
   This file is the whole site's shared shell; every page loads it.
   ========================================================================= */

/* -------------------------------------------------------------------------
   TOKENS — inlined verbatim from design/tokens.css (kept out of website/
   at the repo root, so it cannot be deployed as a static asset).
   Keep this block IN SYNC with design/tokens.css by hand if it changes.
   ---------------------------------------------------------------------- */
:root {
  /* ---- Grounds & ink ---- */
  --paper:      #f5f2ea;   /* page / figure ground; pale limestone */
  --paper-2:    #ece7d9;   /* panels, legends, sidebars, low relief */
  --ink:        #232a2c;   /* headings, strong labels, outlines, rules */
  --ink-soft:   #4a4f4a;   /* secondary text, captions */
  --stone:      #8f897a;   /* neutral warm grey: hatch, minor lines, out-of-scope */

  /* ---- Gulf (PRIMARY) — water, salinity, the sea, wet ends ---- */
  --gulf:       #3a5a67;
  --gulf-deep:  #274550;
  --gulf-pale:  #9db2b8;

  /* ---- Gold (SECONDARY) — drought, sun, summer, calcrete, dry ends ---- */
  --gold:       #c79a4a;
  --gold-deep:  #a87e30;
  --gold-pale:  #e6d6ab;

  /* ---- Earth (ACCENT) — red-brown earth, rock, faults, emphasis, data-needed ---- */
  --earth:      #9c4a2b;
  --earth-deep: #7c3820;

  /* ---- Sage — vegetation, sclerophyll, habitat (silvery saltbush green) ---- */
  --sage:       #7e876b;
  --sage-deep:  #4e5842;
  --sage-pale:  #b3b7a2;

  /* ---- Lines ---- */
  --line: rgba(35, 42, 44, .24);  /* minor borders */
  --rule: #232a2c;                /* structural hairlines */

  /* ---- Type ---- */
  --serif: 'Spectral', Georgia, 'Times New Roman', serif;
  --sans:  'Archivo', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --figure-serif: Georgia, 'Times New Roman', serif;
  --figure-sans:  Helvetica, Arial, sans-serif;

  /* ---- Layout ---- */
  --wrap: 1180px;
  --measure: 66ch;
  --radius: 0;
  --shadow: none;

  /* ---- Site-only additions (not in design/tokens.css) ---- */
  --focus: var(--earth);
  --dur: .18s;
}

/* -------------------------------------------------------------------------
   RESET
   ---------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img, svg { max-width: 100%; height: auto; display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
figure { margin: 0; }
table { border-collapse: collapse; width: 100%; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* -------------------------------------------------------------------------
   BASE TYPOGRAPHY
   ---------------------------------------------------------------------- */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 380; line-height: 1.12; color: var(--ink); margin: 0 0 .5em; }
h1 { font-size: clamp(2.4rem, 5.6vw, 4.4rem); font-weight: 350; letter-spacing: -.01em; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); }
h3 { font-size: 1.28rem; font-weight: 460; }
h4 { font-family: var(--sans); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: .82rem; }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }
em, i { font-style: italic; }
strong, b { font-weight: 600; }
a { color: var(--gulf-deep); text-decoration-thickness: 1px; text-underline-offset: .16em; }
a:hover { color: var(--earth); }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}
hr.rule { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
blockquote { margin: 1.6em 0; padding-left: 1.4em; border-left: 3px solid var(--gold-deep); font-style: italic; color: var(--ink-soft); }

/* -------------------------------------------------------------------------
   LAYOUT HELPERS
   ---------------------------------------------------------------------- */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(20px, 4vw, 32px); }
.narrow { max-width: 720px; }
.measure { max-width: var(--measure); }
.center { text-align: center; margin-left: auto; margin-right: auto; }
.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;
}
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: var(--paper); padding: .8em 1.4em; font-family: var(--sans); font-weight: 600;
}
.skip:focus { left: 0; }

/* -------------------------------------------------------------------------
   EYEBROWS, LEADS, KICKERS
   ---------------------------------------------------------------------- */
.eyebrow {
  font-family: var(--sans); font-weight: 600; text-transform: uppercase;
  letter-spacing: .16em; font-size: .72rem; color: var(--gulf-deep);
  margin: 0 0 .9em; display: block;
}
.eyebrow.on-gold { color: var(--gold-deep); }
.eyebrow.on-earth { color: var(--earth); }
.eyebrow.on-ink { color: var(--gold-pale); }
.lead { font-size: 1.2rem; line-height: 1.55; color: var(--ink-soft); }
.fine { font-family: var(--sans); font-size: .82rem; color: var(--ink-soft); }
.refrain { font-style: italic; }

/* -------------------------------------------------------------------------
   BUTTONS / LINKS
   ---------------------------------------------------------------------- */
.btn {
  display: inline-block; font-family: var(--sans); font-weight: 600; font-size: .82rem;
  letter-spacing: .08em; text-transform: uppercase; padding: 1em 1.7em; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; transition: background var(--dur), color var(--dur), border-color var(--dur);
  text-align: center; text-decoration: none;
}
.btn-primary { background: var(--gulf); color: var(--paper); border-color: var(--gulf); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-ghost { border-color: var(--rule); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.cta { display: flex; gap: .9rem; flex-wrap: wrap; align-items: center; }
.cta.center { justify-content: center; }
.rule-link {
  display: inline-block; font-family: var(--sans); font-weight: 600; letter-spacing: .05em;
  font-size: .85rem; text-transform: uppercase; color: var(--ink); text-decoration: none;
  border-bottom: 2px solid var(--gold-deep); padding-bottom: 3px;
}
.rule-link:hover { color: var(--earth); border-color: var(--earth); }

/* -------------------------------------------------------------------------
   HEADER / NAV
   ---------------------------------------------------------------------- */
.site-head {
  position: sticky; top: 0; z-index: 80; background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 1rem; }
.brand {
  font-family: var(--sans); font-weight: 600; font-size: .82rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand:hover { color: var(--gulf-deep); }
.nav { display: flex; align-items: center; }
.nav a {
  font-family: var(--sans); color: var(--ink-soft); font-size: .74rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; margin-left: 22px; text-decoration: none; white-space: nowrap;
}
.nav a:hover { color: var(--earth); }
.nav a[aria-current="page"] { color: var(--gulf-deep); border-bottom: 2px solid var(--gulf-deep); padding-bottom: 3px; }

/* Mobile disclosure menu — <details>/<summary>, works with zero JS;
   site.js only adds the "close on link click / outside click" polish. */
.mnav { display: none; position: relative; }
.mnav summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .55rem;
  font-family: var(--sans); font-weight: 600; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink); padding: .5rem .9rem; border: 1px solid var(--rule); background: var(--paper); user-select: none;
}
.mnav summary::-webkit-details-marker { display: none; }
.mnav summary::marker { content: ""; }
.mnav summary .bars { position: relative; display: inline-block; width: 16px; height: 2px; background: var(--ink); }
.mnav summary .bars::before, .mnav summary .bars::after {
  content: ""; position: absolute; left: 0; width: 16px; height: 2px; background: var(--ink);
}
.mnav summary .bars::before { top: -5px; }
.mnav summary .bars::after { top: 5px; }
.mnav[open] summary { background: var(--ink); color: var(--paper); }
.mnav[open] summary .bars, .mnav[open] summary .bars::before, .mnav[open] summary .bars::after { background: var(--paper); }
.mnav .sheet {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; z-index: 90;
  background: var(--paper); border: 1px solid var(--rule); padding: .4rem; display: flex; flex-direction: column;
}
.mnav .sheet a { font-family: var(--sans); padding: .8rem 1rem; color: var(--ink); font-weight: 500; font-size: .98rem; text-decoration: none; }
.mnav .sheet a:hover { background: var(--paper-2); }
.mnav .sheet a[aria-current="page"] { color: var(--gulf-deep); font-weight: 700; }
.mnav .sheet .sep { height: 1px; background: var(--line); margin: .4rem .6rem; }
@media (max-width: 1020px) { .nav { display: none; } .mnav { display: block; } }
@media (max-width: 860px) { .brand { font-size: .7rem; letter-spacing: .1em; } }
@media (max-width: 480px) {
  .brand { font-size: .62rem; letter-spacing: .05em; white-space: normal; max-width: 58vw; line-height: 1.3; }
  .site-head .wrap { min-height: 0; padding-top: .9rem; padding-bottom: .9rem; }
}

/* -------------------------------------------------------------------------
   SECTION RHYTHM
   ---------------------------------------------------------------------- */
section { padding: 5.2rem 0; }
.section-tight { padding: 3.4rem 0; }
.section-tan { background: var(--paper-2); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.section-ink { background: var(--ink); color: var(--paper); }
.section-ink h1, .section-ink h2, .section-ink h3 { color: var(--paper); font-weight: 360; }
.section-ink .lead { color: var(--gold-pale); }
.section-ink a:not(.btn) { color: var(--gold-pale); }
.section-ink a:not(.btn):hover { color: var(--paper); }

.section-hd { margin-bottom: 2.4rem; }
.section-hd.split { display: flex; align-items: baseline; justify-content: space-between; gap: 2rem; flex-wrap: wrap; border-bottom: 1px solid var(--rule); padding-bottom: 1rem; }

/* -------------------------------------------------------------------------
   HERO
   ---------------------------------------------------------------------- */
.hero { border-bottom: 1px solid var(--rule); background: var(--paper); }
.hero .wrap { padding-top: clamp(2.6rem, 6vw, 4.6rem); padding-bottom: clamp(2.6rem, 6vw, 4.6rem); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(2rem, 4vw, 3.6rem); align-items: center; }
.hero h1 { margin-bottom: .28em; }
.hero .subtitle { font-family: var(--serif); font-style: italic; color: var(--ink-soft); font-size: clamp(1.05rem, 1.6vw, 1.3rem); max-width: 46ch; margin: 0 0 1.1em; }
.hero .refrain-line { font-family: var(--serif); font-style: italic; color: var(--gulf-deep); font-size: 1.15rem; margin: 0 0 1.8em; }
.hero .working-note { font-family: var(--sans); font-size: .78rem; color: var(--stone); letter-spacing: .02em; margin-top: 1.4em; }
.hero-figure { border: 1px solid var(--rule); background: var(--paper-2); padding: 10px; }
.hero-figure figcaption { font-family: var(--sans); font-size: .74rem; color: var(--ink-soft); letter-spacing: .02em; padding: .7em .2em 0; }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-figure { order: -1; max-width: 420px; margin: 0 auto; }
}

/* -------------------------------------------------------------------------
   POSITIONING / REFRAIN BAND (ink-ground statement)
   ---------------------------------------------------------------------- */
.pos-band { background: var(--ink); color: var(--paper); text-align: center; padding: clamp(3.2rem, 7vw, 5rem) 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.pos-band .wrap { max-width: 860px; }
.pos-band .statement { font-family: var(--serif); font-weight: 330; line-height: 1.16; color: var(--paper); font-size: clamp(1.7rem, 4vw, 2.7rem); margin: 0 0 .6em; }
.pos-band .statement em { font-style: italic; color: var(--gold-pale); }
.pos-band p { color: #cfd6d2; font-size: 1.08rem; line-height: 1.6; max-width: 62ch; margin: 1.1em auto 0; }

/* -------------------------------------------------------------------------
   EDITORIAL INTRO GRID (kicker + lead) — used by "the idea"
   ---------------------------------------------------------------------- */
.edit-grid { display: grid; grid-template-columns: 1fr 2.3fr; gap: 52px; align-items: start; }
.kicker { border-top: 2px solid var(--rule); padding-top: 14px; }
.kicker h2 { font-family: var(--sans); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; font-size: .82rem; line-height: 1.55; color: var(--ink); margin: 0; }
.edit-lead { font-size: clamp(1.3rem, 2vw, 1.6rem); line-height: 1.48; font-weight: 380; margin: 0 0 .9em; }
.dropcap { float: left; font-size: 4rem; line-height: .72; padding: .06em .12em 0 0; font-weight: 420; color: var(--earth); }
@media (max-width: 860px) { .edit-grid { grid-template-columns: 1fr; gap: 26px; } }

/* -------------------------------------------------------------------------
   THE FOUR FORCES — numbered braid list
   ---------------------------------------------------------------------- */
.braid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 2.6rem; border: 1px solid var(--rule); background: var(--rule); }
.braid-item { background: var(--paper); padding: 1.8rem 1.7rem 2rem; display: flex; flex-direction: column; }
.braid-item .num { font-family: var(--serif); font-style: italic; font-size: 1.7rem; color: var(--gold-deep); margin-bottom: .5rem; }
.braid-item h3 { margin-bottom: .4em; }
.braid-item p { font-family: var(--sans); font-size: .92rem; line-height: 1.55; color: var(--ink-soft); margin: 0; }
.braid-item.rock .num { color: var(--earth); }
.braid-item.drought .num { color: var(--gold-deep); }
.braid-item.gradient .num { color: var(--gulf-deep); }
.braid-item.people .num { color: var(--sage-deep); }
@media (max-width: 900px) { .braid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .braid { grid-template-columns: 1fr; } }

/* -------------------------------------------------------------------------
   FIGURE PLATES — the shared container for showing an SVG figure
   full-bleed with a caption. Two sizes: .plate (grid item) and
   .figure-plate (single full-width showcase, e.g. the gradient teaser).
   ---------------------------------------------------------------------- */
.figure-plate { margin-top: 2.4rem; }
.figure-plate .frame { border: 1px solid var(--rule); background: var(--paper); padding: clamp(10px, 2vw, 22px); }
.figure-plate .frame img, .figure-plate .frame svg { width: 100%; height: auto; display: block; }
.figure-plate figcaption { margin-top: 1rem; display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.figure-plate .pl { font-family: var(--sans); letter-spacing: .14em; text-transform: uppercase; font-size: .66rem; color: var(--earth); white-space: nowrap; }
.figure-plate .cap { font-style: italic; color: var(--ink-soft); font-size: .98rem; line-height: 1.5; }

.plate-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.plate figure { margin: 0; }
.plate .frame { border: 1px solid var(--rule); background: var(--paper); padding: 12px; }
.plate .frame img, .plate .frame svg { width: 100%; }
.plate figcaption { margin-top: 14px; }
.plate .pl { font-family: var(--sans); letter-spacing: .14em; text-transform: uppercase; font-size: .62rem; color: var(--earth); display: block; margin-bottom: .3em; }
.plate .cap { font-style: italic; color: var(--ink-soft); font-size: .92rem; line-height: 1.45; }
@media (max-width: 900px) { .plate-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .plate-grid { grid-template-columns: 1fr; } }

/* Two-column figure + text row (used to pair a figure with prose) */
.story-row { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.story-row .frame { border: 1px solid var(--rule); background: var(--paper); padding: 12px; }
.story-row img, .story-row svg { width: 100%; }
@media (max-width: 860px) { .story-row { grid-template-columns: 1fr; gap: 28px; } }

/* -------------------------------------------------------------------------
   CARDS / GRIDS — acts glance, chapter cards, generic content grid
   ---------------------------------------------------------------------- */
.grid { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.card { background: var(--paper); padding: 1.8rem 1.8rem 2rem; text-decoration: none; color: inherit; display: flex; flex-direction: column; position: relative; }
.card:hover { background: var(--paper-2); }
.card .bar { height: 5px; margin: -1.8rem -1.8rem 1.6rem; }
.card .tag { font-family: var(--serif); font-style: italic; color: var(--stone); margin: 0 0 .7rem; font-size: .98rem; }
.card h3 { margin-bottom: .3em; }
.card p:not(.tag) { color: var(--ink-soft); font-size: .95rem; margin: 0; }
.card .chapters { font-family: var(--sans); font-size: .78rem; color: var(--stone); margin-top: 1rem; letter-spacing: .02em; }

/* -------------------------------------------------------------------------
   CALLOUT / STATUS LINE
   ---------------------------------------------------------------------- */
.callout { background: var(--paper-2); border-left: 3px solid var(--earth); padding: 1.4rem 1.7rem; }
.status-line { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.status-dot { width: 11px; height: 11px; background: var(--gold-deep); flex: 0 0 auto; border: 1px solid var(--ink); }
.status-line p { margin: 0; color: var(--ink-soft); font-size: 1rem; }
.status-line strong { color: var(--ink); }

/* -------------------------------------------------------------------------
   NEWSLETTER / JOIN BAND
   ---------------------------------------------------------------------- */
.join-band { background: var(--paper-2); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); text-align: center; }
.join-band .wrap { max-width: 720px; }
.join-band .badge { display: inline-block; font-family: var(--sans); font-weight: 600; font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gulf-deep); border: 1px solid var(--line); padding: .5em .9em; margin: 0 0 1.6em; }
.join-band h2 { margin-bottom: .3em; }
.join-band .lead { max-width: 52ch; margin: 0 auto 2rem; }

/* -------------------------------------------------------------------------
   PAGE HERO (interior pages — the-book, the-gradient, about, etc.)
   ---------------------------------------------------------------------- */
.page-hero { background: var(--paper); border-bottom: 1px solid var(--rule); padding: clamp(3rem, 6vw, 4.5rem) 0 3rem; }
.page-hero .eyebrow { color: var(--earth); }
.page-hero h1 { margin-bottom: .32em; }
.prose p { max-width: 68ch; }
.prose h2 { margin-top: 1.8em; }
.prose h2 + p, .prose h3 + p { margin-top: 0; }

/* -------------------------------------------------------------------------
   FOOTER
   ---------------------------------------------------------------------- */
.site-foot { background: var(--ink); color: #c7cbc4; padding: 3.4rem 0 2.6rem; font-family: var(--sans); font-size: .85rem; }
.site-foot a { color: #d8dbd4; text-decoration: none; }
.site-foot a:hover { color: var(--paper); text-decoration: underline; }
.foot-grid { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2rem; align-items: start; }
.foot-brand { font-family: var(--serif); font-size: 1.1rem; color: var(--paper); }
.foot-links { display: grid; grid-template-columns: repeat(2, minmax(130px, auto)); gap: .5rem 2.5rem; }
.foot-links a { font-size: .8rem; letter-spacing: .03em; }
.foot-note { margin-top: 2.4rem; padding-top: 1.4rem; border-top: 1px solid rgba(245, 242, 234, .16); color: #9a9d95; font-size: .78rem; letter-spacing: .01em; }
.foot-note a { color: #b9bcb3; }
.foot-credit { margin-top: .6rem; }

/* -------------------------------------------------------------------------
   REVEAL ON SCROLL (progressive enhancement — see site.js)
   ---------------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }
