/* Need It, Build It. Direction A, "Statement".
   Palette and type are fixed by DESIGN_BRIEF.md: use only the tokens below. */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-wdth.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("/assets/fonts/public-sans-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --midnight: #0E2A47;
  --paper: #F6F7F9;
  --signal: #2F6BFF;
  --progress: #FFB020;
  --slate: #5B667A;
  --alert: #D64545;

  --display: "Archivo", "Arial Black", sans-serif;
  --text: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 5vw, 96px);
  --measure: 36rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--midnight);
  font-family: var(--text);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
@media (min-width: 768px) { body { font-size: 1.125rem; } }

img { display: block; max-width: 100%; height: auto; }

h1, h2, h3 {
  font-family: var(--display);
  font-stretch: 125%;
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration-line: underline; text-decoration-color: var(--signal); text-decoration-thickness: 2px; text-underline-offset: 0.22em; }
a:hover { text-decoration-thickness: 3px; }

:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }

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

.num { font-variant-numeric: tabular-nums; }

.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: var(--gutter); top: -4rem; z-index: 10;
  background: var(--paper); color: var(--midnight); padding: 0.5rem 1rem;
}
.skip:focus { top: 0.75rem; }

.muted { color: var(--slate); }

/* ---------- masthead and footer ---------- */

.masthead-inner { height: 4rem; display: flex; align-items: center; }
.masthead.on-dark { background: var(--midnight); color: var(--paper); }

.wordmark {
  font-family: var(--display);
  font-stretch: 125%;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  margin: 0;
}

.footer { border-top: 1px solid var(--slate); padding-block: 2.5rem 3rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.75rem 2.5rem; }
.footer p { margin: 0; }

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

.hero { background: var(--midnight); color: var(--paper); }

.hero-inner {
  min-height: calc(100vh - 4rem);
  min-height: calc(100svh - 4rem);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 2.5rem;
  padding-block: 1.5rem 2.5rem;
}
.hero-idea .hero-inner { grid-template-rows: 1fr auto; min-height: clamp(30rem, 72svh, 48rem); }

.hero-main { align-self: end; }

/* The complaint and "Fixed." share one grid cell, so the swap causes no layout shift. */
.complaint {
  display: grid;
  margin: 0;
  max-width: 24ch;
  font-family: var(--display);
  font-stretch: 112%;
  font-size: clamp(1.25rem, 0.95rem + 1.4vw, 2.125rem);
  line-height: 1.2;
}
.complaint > span { grid-area: 1 / 1; }
.complaint-text { font-weight: 450; animation: fade-out 300ms ease-out 1400ms forwards; }
.complaint-fixed { font-weight: 700; opacity: 0; animation: fixed-in 450ms var(--ease) 1700ms forwards; }

.headline {
  font-size: clamp(2.75rem, 1.2rem + 7vw, 7.5rem);
  line-height: 0.98;
  font-weight: 680;
  animation: settle 600ms var(--ease) both;
}
.headline-visual, .headline .line { display: block; }
.complaint-static { margin-bottom: 1.5rem; font-weight: 450; }
.idea-why { padding-bottom: 0; }
.idea-why h2 { margin-bottom: 1rem; }
.headline-idea { font-size: clamp(2.25rem, 1rem + 5.2vw, 6rem); max-width: 17ch; }

.headline .rotator { display: grid; justify-items: start; }
.rotator .word { grid-area: 1 / 1; opacity: 0; visibility: hidden; }
.rotator .word[data-active] { opacity: 1; visibility: visible; }

.lede {
  max-width: var(--measure);
  margin-top: 1.75rem;
  font-size: 1.125rem;
  font-weight: 350;
}
@media (min-width: 768px) { .lede { font-size: 1.3125rem; } }

.hero-foot { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1.5rem 3rem; }
.hero-foot > p { margin: 0; }

.readout { max-width: var(--measure); width: 100%; font-variant-numeric: tabular-nums; }
.readout p { margin: 0; font-weight: 350; }
.readout .num { color: var(--progress); font-weight: 600; }

.bar { height: 4px; margin-top: 0.875rem; background: var(--slate); overflow: hidden; }
.bar span {
  display: block; height: 100%;
  background: var(--progress);
  transform-origin: left center;
  transform: scaleX(var(--fill));
  animation: bar-fill 600ms var(--ease) 250ms backwards;
}
[dir="rtl"] .bar span { transform-origin: right center; }

.link-on-dark { color: var(--paper); font-weight: 600; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem;
  padding: 0.7em 1.4em;
  border: 0; border-radius: 2px;
  background: var(--signal); color: var(--paper);
  font-family: var(--display); font-stretch: 112%; font-weight: 700; font-size: 1.1875rem; line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { text-decoration: underline; text-decoration-color: currentColor; }

/* ---------- reading sections ---------- */

.reading { padding-block: clamp(4rem, 9vw, 8.5rem); }
.reading h2 { font-size: clamp(1.75rem, 1.15rem + 2.6vw, 3rem); margin-bottom: 2.25rem; }
.reading h3 { font-stretch: 112%; font-size: 1.3125rem; line-height: 1.25; margin-bottom: 0.5rem; }

.reading-alt { background: var(--midnight); color: var(--paper); }
.reading-alt a { color: var(--paper); }

@media (min-width: 960px) {
  .home .reading > .wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: 4rem; }
  .home .reading > .wrap > * { grid-column: 2; }
  .home .reading > .wrap > h2 { grid-column: 1; grid-row: 1 / span 3; }
}

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2.75rem; }
.step { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); column-gap: 1rem; max-width: 40rem; }
.step-num { font-family: var(--display); font-stretch: 125%; font-weight: 600; font-size: 2.5rem; line-height: 1; }
.step p { margin: 0; }

.aside { margin-top: 4rem; max-width: 40rem; }

.promises { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; max-width: 40rem; font-size: 1.1875rem; font-weight: 350; }
@media (min-width: 768px) { .promises { font-size: 1.3125rem; } }

.prose { max-width: 40rem; }
/* Text pages keep the page's left edge; only the line length is limited. */
.page .wrap.prose { max-width: 90rem; }
.page .wrap.prose > * { max-width: 44rem; }
.page h2 { font-size: 1.5rem; margin: 2.75rem 0 0.75rem; }
.headline-page { font-size: clamp(2.25rem, 1.2rem + 4vw, 4.5rem); margin-bottom: 1.5rem; }
.lede-light { font-size: 1.25rem; }

/* ---------- idea page ---------- */

.idea-grid { display: grid; gap: 3rem; }
@media (min-width: 960px) {
  .idea-grid { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); column-gap: 6rem; align-items: start; }
}

.visual { margin: 0; background: var(--midnight); }
.visual img { width: 100%; }

.price { font-family: var(--display); font-stretch: 112%; font-weight: 600; font-size: 1.375rem; line-height: 1.3; }
.price-label { display: block; font-family: var(--text); font-stretch: 100%; font-weight: 400; font-size: 0.9375rem; color: var(--slate); }
.join h2 { margin-top: 2.5rem; margin-bottom: 1.5rem; }

.field { margin-bottom: 1.5rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.5rem; line-height: 1.4; }
.field input, .field textarea {
  display: block; width: 100%;
  font: inherit; font-size: 1.0625rem;
  color: var(--midnight); background: var(--paper);
  border: 2px solid var(--slate); border-radius: 2px;
  padding: 0.7rem 0.85rem;
  transition: border-color 200ms ease-out;
}
.field textarea { resize: vertical; min-height: 6rem; }
.field input:focus-visible, .field textarea:focus-visible { border-color: var(--signal); outline-offset: 2px; }
.field [aria-invalid="true"] { border-color: var(--alert); }

/* Error text stays Midnight for contrast; the Alert colour marks it alongside. */
.error { margin: 0; font-size: 0.9375rem; font-weight: 600; }
.error:not(:empty) { margin-top: 0.5rem; padding-left: 0.75rem; border-left: 3px solid var(--alert); animation: fixed-in 250ms var(--ease); }

.signup .button { width: 100%; }
@media (min-width: 600px) { .signup .button { width: auto; } }

.status { font-weight: 600; margin: 1rem 0 0; }
.status:empty { display: none; }
.status-error:not(:empty) { margin: 0 0 1.5rem; padding-left: 0.75rem; border-left: 3px solid var(--alert); }
.note { margin-top: 1.25rem; font-size: 0.9375rem; color: var(--slate); }
.note a { color: var(--midnight); }

/* ---------- suggestion form ---------- */

.suggest { margin-top: 2.5rem; }
.hint { margin: -0.25rem 0 0.5rem; font-size: 0.9375rem; color: var(--slate); }
fieldset.field { border: 0; padding: 0; margin-inline: 0; min-width: 0; }
fieldset.field legend { font-weight: 600; margin-bottom: 0.5rem; padding: 0; line-height: 1.4; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.choices .choice { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; font-weight: 400; cursor: pointer; }
.choices .choice input { width: 1.25rem; height: 1.25rem; accent-color: var(--signal); margin: 0; }
.step .step-link { margin-top: 0.75rem; font-weight: 600; }

/* The trap field: off-screen for people, still in the form for bots. */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- control panel ---------- */

.admin { padding-block: 2rem 5rem; }
.admin-bar { justify-content: space-between; gap: 1rem; }
.admin-page .footer { display: none; }
.admin .headline-page { margin-block: 1rem 2rem; }

.link-button {
  background: none; border: 0; padding: 0.25rem 0; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--midnight);
  text-decoration: underline; text-decoration-color: var(--signal); text-decoration-thickness: 2px; text-underline-offset: 0.22em;
}
.link-button.danger { text-decoration-color: var(--alert); }
.button-small { min-height: 2.75rem; font-size: 1rem; padding: 0.5em 1.1em; }

.panel { border-top: 1px solid var(--slate); padding-block: 1.75rem; }
.panel h2, .summary-heading { font-size: 1.375rem; margin: 0 0 1rem; display: inline; }
.panel > h2 { display: block; }
.panel > summary { cursor: pointer; list-style-position: outside; }
.panel[open] > summary { margin-bottom: 1rem; }

.readout-light { font-variant-numeric: tabular-nums; margin-bottom: 0.75rem; }
.bar-light { background: color-mix(in srgb, var(--slate) 35%, var(--paper)); max-width: 36rem; margin: 0 0 1rem; }
.bar-light span { animation: none; }
.small { font-size: 0.9375rem; }

.idea-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.idea { border: 1px solid color-mix(in srgb, var(--slate) 45%, var(--paper)); border-radius: 2px; background: var(--paper); }
.idea > details > summary { cursor: pointer; padding: 0.875rem 1rem; display: flex; flex-wrap: wrap; gap: 0.25rem 0.875rem; align-items: baseline; }
.idea-title { flex: 1 1 18rem; }
.idea-body { padding: 0 1rem 1.25rem; max-width: 48rem; }
.idea-problem { font-size: 1.125rem; }
.idea h3 { font-size: 1.0625rem; margin: 1.25rem 0 0.25rem; }

.stage { font-size: 0.875rem; font-weight: 600; white-space: nowrap; padding-left: 0.6rem; border-left: 4px solid var(--slate); }
.stage-continue, .stage-challenger, .stage-researching, .stage-testing, .stage-building, .stage-launched { border-color: var(--signal); }
.stage-error, .stage-waiting { border-color: var(--alert); }
.stage-new { border-color: var(--progress); }

.same-as { font-weight: 600; padding-left: 0.6rem; border-left: 4px solid var(--progress); }
.kv { margin: 0.75rem 0 0; }
.kv dt { font-weight: 600; font-size: 0.9375rem; }
.kv dd { margin: 0.125rem 0 0; white-space: pre-wrap; }

.actions, .note-form { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; margin-top: 1.25rem; }
.note-form textarea { flex: 1 1 18rem; }
.reply label, .admin .field label:not(.check) { display: block; font-weight: 600; margin: 0.75rem 0 0.375rem; }
.admin label.inline { font-weight: 600; }
.admin label.check { display: flex; gap: 0.6rem; align-items: center; font-weight: 400; }
.admin label.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--signal); }
.admin select, .admin input[type="text"], .admin input[type="number"], .admin textarea {
  font: inherit; font-size: 1rem; color: var(--midnight); background: var(--paper);
  border: 2px solid var(--slate); border-radius: 2px; padding: 0.5rem 0.65rem; max-width: 100%;
}
.admin textarea, .admin input[type="text"] { width: 100%; }
.admin .field { margin-bottom: 1rem; }
.history { margin-top: 1rem; }
.history ul { margin: 0.5rem 0 0; padding-left: 1.1rem; }

/* ---------- motion ---------- */

@keyframes settle { from { transform: translateY(0.12em); } to { transform: none; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fixed-in { from { opacity: 0; transform: translateY(0.2em); } to { opacity: 1; transform: none; } }
@keyframes bar-fill { from { transform: scaleX(0); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* Without motion, show the complaint and the answer one after the other. */
  .complaint { display: block; }
  .complaint > span { display: block; }
  .complaint-fixed { opacity: 1; margin-top: 0.4em; }
}
