/* Bode — joinbode.com
   Palette and type are lifted from the app so the two cannot drift:
   marine #2C5D82, brass #C4952F, ink #141E28, paper #E4E3DA.
   Serif for display, system sans for reading, mono for anything measured. */

:root {
  --ink:      #141E28;
  --paper:    #E4E3DA;
  --marine:   #2C5D82;
  --brass:    #C4952F;
  --rust:     #9E5539;

  --bg:        var(--paper);
  --surface:   #EFEDE4;
  --fg:        var(--ink);
  --fg-muted:  #56646F;
  --fg-faint:  #8B959C;
  --rule:      #C9C7BC;
  --accent:    #8A6A1C;

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

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

@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #0E161E;
    --surface:  #18232E;
    --fg:       #E2E4E1;
    --fg-muted: #9AA6AE;
    --fg-faint: #6B7880;
    --rule:     #26333F;
    --accent:   #D9AC4A;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}

/* ---------- masthead ---------- */
.masthead { padding-block: 1.75rem 0; }
.masthead img { display: block; width: 108px; height: auto; }

/* ---------- hero ---------- */
.hero { padding-block: clamp(3rem, 9vw, 6rem) clamp(2.5rem, 7vw, 4.5rem); }
.hero h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.3rem, 6.2vw, 4.1rem);
  line-height: 1.06; letter-spacing: -0.02em;
  margin: 0; max-width: 18ch; text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--accent); display: block; }
.hero p {
  margin: 1.5rem 0 0; max-width: var(--measure);
  font-size: clamp(1.0625rem, 2vw, 1.25rem); color: var(--fg-muted);
}

/* ---------- waitlist ---------- */
.signup { margin-top: 2.25rem; max-width: 30rem; }
.signup form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.signup input {
  flex: 1 1 14rem; min-width: 0;
  font-family: var(--sans); font-size: 1rem; color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: 4px;
  padding: 0.8rem 1rem;
}
.signup input::placeholder { color: var(--fg-faint); }
.signup button {
  font-family: var(--sans); font-size: 1rem; font-weight: 500;
  color: var(--bg); background: var(--fg);
  border: 1px solid var(--fg); border-radius: 4px;
  padding: 0.8rem 1.4rem; cursor: pointer;
}
.signup button:hover { opacity: 0.85; }
.signup .note { margin: 0.7rem 0 0; font-size: 0.8125rem; color: var(--fg-faint); }
.signup [data-waitlist-status] { margin: 0.7rem 0 0; font-size: 0.9375rem; }
.signup [data-waitlist-status][data-tone="ok"]   { color: var(--accent); }
.signup [data-waitlist-status][data-tone="bad"]  { color: var(--rust); }

/* ---------- sections ---------- */
section { padding-block: clamp(2.75rem, 7vw, 4.5rem); border-top: 1px solid var(--rule); }
.eyebrow {
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--fg-faint); margin: 0 0 0.9rem;
}
section h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.6rem, 3.6vw, 2.3rem); line-height: 1.15;
  letter-spacing: -0.015em; margin: 0; max-width: 20ch; text-wrap: balance;
}
section > .wrap > p { max-width: var(--measure); color: var(--fg-muted); margin: 1.1rem 0 0; }

/* ---------- grids ---------- */
.grid { display: grid; gap: 1.75rem; margin-top: 2.25rem; }
@media (min-width: 44rem) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 44rem) { .grid.two   { grid-template-columns: repeat(2, 1fr); } }

.card h3 {
  font-family: var(--sans); font-size: 1.0625rem; font-weight: 600;
  margin: 0 0 0.4rem; letter-spacing: -0.01em;
}
.card p { margin: 0; color: var(--fg-muted); font-size: 0.9375rem; }
.card .stat {
  font-family: var(--mono); font-size: 1.9rem; color: var(--marine);
  display: block; margin-bottom: 0.3rem; font-variant-numeric: tabular-nums;
}
.card .stat.up { color: var(--brass); }

/* ---------- driver list, echoing the app ---------- */
.drivers { list-style: none; margin: 2rem 0 0; padding: 0; max-width: 34rem; }
.drivers li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding-block: 0.85rem; border-bottom: 1px solid var(--rule);
}
.drivers li:last-child { border-bottom: 0; }
.drivers .name { font-size: 0.9375rem; }
.drivers .detail {
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--fg-faint); display: block; margin-top: 2px;
}
.drivers .ticks { display: flex; gap: 3px; flex: none; }
.drivers .ticks i { width: 5px; height: 16px; border-radius: 1px; background: var(--rule); }
.drivers .ticks i.on { background: var(--marine); }

/* ---------- quiet block ---------- */
.quiet {
  margin-top: 2rem; padding: 1.4rem 1.5rem;
  border: 1px solid var(--rule); border-radius: 6px; max-width: 34rem;
}
.quiet p { margin: 0; color: var(--fg-muted); font-size: 0.9375rem; }
.quiet p + p { margin-top: 0.6rem; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--rule); padding-block: 2.5rem 3.5rem; }
footer .row { display: flex; flex-wrap: wrap; gap: 0.6rem 1.75rem; align-items: center; }
footer a, footer span {
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--fg-faint); text-decoration: none;
}
footer a:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Labels that exist for screen readers only. The inputs have placeholders,
   which are not labels — this is what makes the form actually announceable. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ============================================================
   Interactive demonstrations
   ============================================================ */

/* --- the live daylight figure --- */
.live {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.live-figure {
  font-family: var(--mono);
  font-size: 1.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.live-label {
  font-size: 0.875rem;
  color: var(--fg-muted);
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.live-label select {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 0 0.15rem 0.1rem;
  cursor: pointer;
}
.live-label select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.live-delta {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.live-delta.down { color: var(--marine); }
.live-delta.up { color: var(--accent); }

/* --- the logging scale --- */
.scale-demo {
  margin: 2rem 0 0;
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--surface);
  max-width: 34rem;
}
.scale-readout {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.scale-readout .num {
  font-family: var(--mono);
  font-size: 2.5rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
.scale-readout .word { font-family: var(--serif); font-size: 1.25rem; color: var(--fg-muted); }

/* The track carries the app's own ramp: marine to brass, no red, no green. */
.scale-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 52px;
  background: linear-gradient(to right,
    #1F4568 0 20%, #3D6B8A 20% 40%, #6E7E88 40% 60%, #A88F55 60% 80%, #C4952F 80% 100%);
  border-radius: 4px;
  border: 1px solid var(--rule);
  cursor: pointer;
  display: block;
}
.scale-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.scale-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 8px;
  height: 44px;
  border-radius: 3px;
  background: #F4F3EC;
  box-shadow: 0 1px 4px rgba(0,0,0,.45);
  cursor: grab;
}
.scale-input::-moz-range-thumb {
  width: 8px;
  height: 44px;
  border: 0;
  border-radius: 3px;
  background: #F4F3EC;
  box-shadow: 0 1px 4px rgba(0,0,0,.45);
  cursor: grab;
}
.scale-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 0.55rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.scale-note { margin: 0.9rem 0 0; font-size: 0.8125rem; color: var(--fg-faint); }

/* --- issued / quiet toggle --- */
.toggle-buttons { display: flex; gap: 0.5rem; margin: 1.75rem 0 1.25rem; flex-wrap: wrap; }
.toggle-buttons button {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}
.toggle-buttons button.on { border-color: var(--fg); color: var(--fg); background: var(--surface); }
.toggle-buttons button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.panel {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.5rem;
  background: var(--surface);
  max-width: 34rem;
}
.panel h3 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; margin: 0 0 0.5rem; }
.panel > p { margin: 0 0 1rem; color: var(--fg-muted); font-size: 0.9375rem; }
.checked { list-style: none; margin: 0; padding: 0; }
.checked li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.5rem 0; border-bottom: 1px solid var(--rule);
  font-size: 0.875rem;
}
.checked li:last-child { border-bottom: 0; }
.checked .k {
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--fg-faint);
}
.checked .v { font-family: var(--mono); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.panel .verdict {
  margin: 1rem 0 0;
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--fg-faint);
}

/* --- driver ticks fill on entry --- */
.drivers .ticks i { transition: background-color .45s ease; }
/* Staggered here rather than from a style attribute in the markup — the CSP
   sets style-src 'self', so inline style attributes are blocked in production. */
.drivers .ticks i:nth-child(1) { transition-delay: 0ms; }
.drivers .ticks i:nth-child(2) { transition-delay: 90ms; }
.drivers .ticks i:nth-child(3) { transition-delay: 180ms; }
.drivers .ticks i:nth-child(4) { transition-delay: 270ms; }
.drivers .ticks i:nth-child(5) { transition-delay: 360ms; }
.drivers:not(.shown) .ticks i.on { background: var(--rule); }

@media (prefers-reduced-motion: reduce) {
  .drivers .ticks i { transition: none; }
}

/* ============================================================
   Hold-out validation figure
   ============================================================ */

.holdout {
  margin: 2.25rem 0 0;
  padding: 1.75rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--surface);
  max-width: 40rem;
}

.holdout-head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.holdout-figure {
  font-family: var(--mono);
  font-size: 2.5rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--marine);
  /* The figure is recomputed on switch; ease it so the change is legible. */
  transition: color .3s ease;
}
.holdout-caption { font-size: 0.9375rem; color: var(--fg-muted); flex: 1 1 14rem; }

.holdout-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  gap: 3px;
}
.ho-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  opacity: 1;
  transition: opacity .45s cubic-bezier(.4, 0, .2, 1), transform .45s cubic-bezier(.4, 0, .2, 1);
}
.ho-cell.dim { opacity: 0.14; }

/* Tuesdays carry a ring so the claim is visible in the grid itself. */
.ho-cell.tue {
  box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 1.5px var(--fg);
}
.ho-cell.tue.dim { box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 1.5px var(--rule); }

/* Stagger in on first sight, along the diagonal. */
.holdout-grid:not(.in) .ho-cell { opacity: 0; transform: translateY(6px); }
.holdout-grid.in .ho-cell { transition-delay: calc(var(--d, 0) * 9ms); }

.holdout-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.holdout-steps { display: flex; gap: 0.5rem; margin: 1.4rem 0 0; flex-wrap: wrap; }
.holdout-steps button {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}
.holdout-steps button .n {
  font-size: 0.625rem;
  width: 1.15rem; height: 1.15rem;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: .65;
}
.holdout-steps button:hover { border-color: var(--fg-muted); color: var(--fg); }
.holdout-steps button.on {
  border-color: var(--fg);
  color: var(--fg);
  background: var(--bg);
}
.holdout-steps button.on .n { opacity: 1; border-color: var(--accent); color: var(--accent); }
.holdout-steps button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.holdout-note {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  color: var(--fg-muted);
  min-height: 2.6em; /* reserve the taller of the two, so nothing jumps on switch */
}

/* ============================================================
   Ambient counter
   ============================================================ */

.counter-line {
  margin: 2rem 0 0;
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.counter {
  font-family: var(--mono);
  font-size: 1.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.counter-label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

/* ============================================================
   Section entrances — deliberately small
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .6s cubic-bezier(.4, 0, .2, 1), transform .6s cubic-bezier(.4, 0, .2, 1);
}
.reveal.seen { opacity: 1; transform: none; }
/* Without JS nothing is hidden — .reveal is only ever added by script. */

@media (prefers-reduced-motion: reduce) {
  .ho-cell,
  .holdout-grid.in .ho-cell,
  .reveal { transition: none; transform: none; opacity: 1; }
  .holdout-grid:not(.in) .ho-cell { opacity: 1; transform: none; }
}

/* ============================================================
   Masthead lockup — inline so the sun can answer to the reader
   ============================================================ */

.lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
}
.lockup-mark { display: block; overflow: visible; }
#lockup-sun {
  /* Eased so dragging the scale moves the sun smoothly rather than snapping. */
  transition: cy .35s cubic-bezier(.34, .8, .3, 1), fill .35s ease;
}
.lockup-word {
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.lockup:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }

/* ============================================================
   Where the reader's number sits against everyone else
   ============================================================ */

.scale-compare {
  margin: 0.9rem 0 0;
  font-size: 0.9375rem;
  color: var(--fg-muted);
  min-height: 2.8em;      /* holds the taller wording so nothing jumps */
  transition: color .25s ease;
}
.scale-compare.up { color: var(--accent); }
.scale-compare.down { color: var(--marine); }
.scale-compare.level { color: var(--fg-muted); }

@media (prefers-reduced-motion: reduce) {
  #lockup-sun { transition: none; }
  .scale-compare { transition: none; }
}
