/* Coast Advantage — web surface. Tokens mirror DESIGN.md exactly. */

:root {
  --ink: #111111;
  --ink-soft: #3A372F;
  --meta: #8A8577;
  --signal: #E8390E;
  --paper: #F7F5F0;
  --rule: #C9C4B6;
  --sea: #175E63;
  --on-sea: #A8D8D4;
  --sand: #E3A44C;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;

  --s-xs: 4px;
  --s-sm: 8px;
  --s-md: 16px;
  --s-lg: 24px;
  --s-xl: 48px;

  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --body: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: "Lora", Georgia, serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 400;
}

/* ---------- shell ---------- */

.shell { max-width: 1200px; margin: 0 auto; padding: 0 var(--s-lg); }
.column { max-width: 720px; margin: 0 auto; padding: 0 var(--s-lg); }

section { padding: var(--s-xl) 0; }

/* ---------- type voices ---------- */

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  color: var(--signal);
  margin: 0 0 var(--s-md);
}

h1 { font-size: clamp(2.75rem, 9vw, 4rem); line-height: 0.9; letter-spacing: -0.01em; }
h2 { font-size: clamp(2rem, 5.5vw, 2.5rem); line-height: 0.96; }
h3 { font-size: 1.75rem; line-height: 1.02; }
h4 {
  font-family: var(--body);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.12em;
  color: var(--meta);
  text-transform: uppercase;
  margin-bottom: var(--s-sm);
}

p { margin: 0 0 var(--s-md); }
p:last-child { margin-bottom: 0; }

a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--signal); }

.hook {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 0 0 var(--s-lg);
}

.label {
  font-family: var(--body);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--meta);
  margin: 0 0 var(--s-sm);
}
.label--signal { color: var(--signal); }

.figure {
  font-family: var(--display);
  font-weight: 900;
  font-size: 2.75rem;
  line-height: 0.9;
  color: var(--signal);
  display: block;
}

.catch strong { color: var(--signal); }

/* ---------- rules & dividers ---------- */

.divider { height: 1px; background: var(--rule); border: 0; margin: var(--s-lg) 0; }
.sheet-rule { height: 2px; background: var(--ink); border: 0; margin: 0; }

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

.masthead {
  border-bottom: 1px solid var(--rule);
  padding: var(--s-md) 0;
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 10;
}
.masthead .shell {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-md);
  flex-wrap: wrap;
}
.wordmark {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}
.masthead nav { display: flex; gap: var(--s-md); }
.masthead nav a {
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--meta);
  text-decoration: none;
}
.masthead nav a:hover { color: var(--ink); }

/* ---------- hero ---------- */

.hero { padding: var(--s-xl) 0 var(--s-lg); }
.hero .lede { font-size: 1.125rem; max-width: 34em; }
.hero-meta {
  display: flex;
  gap: var(--s-lg);
  flex-wrap: wrap;
  margin-top: var(--s-lg);
}
.hero-meta div { min-width: 8rem; }

/* ---------- site plate (the house image register — see DESIGN.md) ---------- */

.plate { margin: var(--s-xl) 0 0; }
.plate img {
  display: block;
  width: 100%;
  height: auto;
  border-top: 1.5px solid var(--ink);
  border-radius: 0;
}
.plate figcaption { margin: var(--s-sm) 0 0; }
.plate figcaption a { color: var(--meta); text-decoration-color: var(--rule); }
.plate figcaption a:hover { color: var(--ink); }

/* ---------- editions archive grid ---------- */

.editions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--s-xl) var(--s-lg);
  margin-top: var(--s-xl);
}
.edition-card {
  display: block;
  border-top: 1.5px solid var(--ink);
  padding-top: var(--s-md);
  text-decoration: none;
  color: var(--ink);
}
.edition-card-plate {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: var(--s-md);
}
/* Editions without a plate yet: DESIGN.md's approved photo-substitute tone. */
.edition-card-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  background: var(--sand);
  border-radius: var(--r-sm);
  margin-bottom: var(--s-md);
}
/* A grid of one reads as a broken grid. While a single edition exists it takes the full
   row as a two-column feature; the moment a second is added :only-child stops matching
   and both fall back to normal cards. Self-correcting, nothing to remember on publish. */
.edition-card:only-child {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-lg);
  align-items: start;
}
.edition-card:only-child .edition-card-plate,
.edition-card:only-child .edition-card-placeholder { margin-bottom: 0; }
.edition-card:only-child h3 { font-size: 2rem; }

.edition-card h3 { margin: var(--s-sm) 0 var(--s-sm); }
.edition-card p { font-size: 0.9375rem; }
/* .more-link shares the recipe: the archive card's version is a span inside a card-wide
   anchor, this one is a standalone link, and they should not drift apart visually. */
.edition-card-more,
.more-link {
  display: inline-block;
  margin-top: var(--s-sm);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--meta);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
}
.more-link { text-decoration: none; }
.more-link:hover { color: var(--signal); border-bottom-color: var(--signal); }
.edition-card:hover h3 { color: var(--ink); }
.edition-card:hover .edition-card-more { color: var(--signal); border-bottom-color: var(--signal); }
.edition-card:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; }
/* Element selector on purpose: .form-note sets margin:0 later in this file and would
   otherwise win on source order at equal specificity. */
p.archive-note { margin-top: var(--s-xl); }

/* One line above the grid telling a first-time visitor which card to open. Sits a step
   up from body copy so it reads as guidance rather than another paragraph of lede, and
   its link is inked rather than red: the grid's headlines already own the red here. */
.start-here {
  margin: var(--s-lg) 0 0;
  font-size: 1.0625rem;
}
.start-here a { font-weight: 500; }

/* ---------- number poster ---------- */

.posters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-md);
  margin-top: var(--s-lg);
}
.poster {
  background: var(--paper);
  border-top: 1.5px solid var(--ink);
  padding: var(--s-lg) 0 0;
}
.poster .n {
  font-family: var(--display);
  font-weight: 900;
  font-size: 3.5rem;
  line-height: 1;
  color: var(--signal);
  display: block;
}
.poster p { font-size: 0.9375rem; margin-top: var(--s-sm); }

/* ---------- format list ---------- */

.format { counter-reset: part; }
.format-row {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: var(--s-md);
  padding: var(--s-lg) 0;
  border-top: 1px solid var(--rule);
  align-items: start;
}
.format-row:last-child { border-bottom: 1px solid var(--rule); }
.format-row .num {
  font-family: var(--display);
  font-weight: 900;
  font-size: 2.75rem;
  line-height: 0.9;
  color: var(--signal);
}
.format-row h3 { margin-bottom: var(--s-xs); }
/* Timeline variant: a four-digit year needs a wider first column than 01–04 does. */
.format-row--year { grid-template-columns: 7rem 1fr; }

/* ---------- history block (the one dark object) ---------- */

.history {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-sm);
  padding: var(--s-md);
  margin: var(--s-lg) 0;
}
.history .label { color: var(--signal); }
.history p {
  font-family: var(--serif);
  font-style: italic;
  line-height: 1.5;
  color: var(--paper);
  margin: 0;
}
.history strong { font-style: normal; font-weight: 700; }

/* ---------- read next ---------- */

/* Where a finished edition sends the reader. Hairline-separated like every other
   briefing row, links set in body type rather than display type so it stays quieter
   than the briefs above it and than the signup below it. */
.read-next { border-top: 1px solid var(--rule); }
.read-next-list { list-style: none; margin: 0; padding: 0; }
.read-next-list li { margin-bottom: var(--s-lg); }
.read-next-list li:last-child { margin-bottom: var(--s-md); }
.read-next-list .label { margin-bottom: var(--s-xs); }
.read-next-list a { font-weight: 500; }

/* ---------- signup ---------- */

.signup { border-top: 2px solid var(--ink); padding-top: var(--s-xl); }
.signup-form {
  display: flex;
  gap: var(--s-sm);
  flex-wrap: wrap;
  margin: var(--s-lg) 0 var(--s-sm);
  max-width: 32rem;
}
.signup-form input[type="email"] {
  flex: 1 1 16rem;
  font-family: var(--body);
  font-size: 1rem;
  padding: 12px var(--s-md);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: var(--r-sm);
  color: var(--ink);
}
.signup-form input[type="email"]::placeholder { color: var(--meta); }
.signup-form input[type="email"]:focus {
  outline: 2px solid var(--signal);
  outline-offset: 1px;
}
.cta {
  font-family: var(--body);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--r-sm);
  padding: 12px var(--s-lg);
  cursor: pointer;
}
.cta:hover { background: var(--ink-soft); border-color: var(--ink-soft); }
.cta:disabled { opacity: 0.5; cursor: default; }
.form-note { font-size: 0.8125rem; color: var(--meta); margin: 0; }
.form-status { font-size: 0.9375rem; margin: var(--s-sm) 0 0; min-height: 1.5em; }
.form-status[data-state="ok"] { color: var(--ink); font-weight: 500; }
.form-status[data-state="err"] { color: var(--signal); }

/* ---------- edition sample ---------- */

.edition-tab {
  display: inline-block;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: var(--s-xs) var(--s-sm);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: var(--s-md);
}

.brief { padding: var(--s-xl) 0; border-top: 1px solid var(--rule); }
.brief:first-of-type { border-top: 0; }
.brief ul { margin: 0 0 var(--s-md); padding-left: 1.1rem; }
.brief li { margin-bottom: var(--s-sm); }

.pull {
  display: flex;
  align-items: baseline;
  gap: var(--s-md);
  margin: var(--s-lg) 0;
}
.pull .figure { flex: 0 0 auto; }
.pull p { font-size: 0.9375rem; margin: 0; }

table { width: 100%; border-collapse: collapse; margin: var(--s-md) 0 var(--s-lg); font-size: 0.9375rem; }
th, td { text-align: left; padding: var(--s-sm) var(--s-sm) var(--s-sm) 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--meta);
}

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

footer {
  border-top: 1px solid var(--rule);
  padding: var(--s-lg) 0 var(--s-xl);
  font-size: 0.8125rem;
  color: var(--meta);
}
footer a { color: var(--meta); }

@media (max-width: 640px) {
  .shell, .column { padding: 0 var(--s-md); }
  section { padding: var(--s-lg) 0; }
  .masthead .shell { align-items: flex-start; }
  .masthead nav { width: 100%; overflow-x: auto; padding-bottom: var(--s-xs); }
  .posters { grid-template-columns: 1fr; }
  .format-row { grid-template-columns: 2.5rem 1fr; }
  .format-row .num { font-size: 2rem; }
  .format-row--year { grid-template-columns: 5rem 1fr; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* The single-edition feature card is two columns on wider screens; at phone width
     that squeezes the plate to a thumbnail and wraps the headline three ways. */
  .edition-card:only-child { grid-template-columns: 1fr; gap: var(--s-md); }
  .edition-card:only-child h3 { font-size: 1.75rem; }
  .editions { gap: var(--s-lg); }
}
