:root {
  --bg: #EEF4EF;
  --surface: #FFFFFF;
  --ink: #14261B;
  --muted: #4A6052;
  --line: #CDDCD1;
  --pcb: #137140;
  --pcb-deep: #0B4628;
  --heading: #0B4628;
  --gold: #E2A72A;
  --gold-shadow: #A87612;
  --gold-ink: #3A2A05;
  --chip: #1E2421;
  --danger: #B3261E;
  --tint: #E2EFE5;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1D15;
    --surface: #16281D;
    --ink: #E7F1E9;
    --muted: #9DB5A5;
    --line: #2A4434;
    --pcb: #1E8C51;
    --pcb-deep: #0E5A33;
    --heading: #8FD9AC;
    --gold: #F0B63E;
    --gold-shadow: #A87612;
    --gold-ink: #2E2104;
    --chip: #101412;
    --danger: #FF8A80;
    --tint: #1D3527;
    color-scheme: dark;
  }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  color: var(--heading);
  line-height: 1.1;
  margin: 0 0 0.5em;
}

h2 { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 800; letter-spacing: -0.01em; }
h3 { font-size: 1.3rem; font-weight: 700; }

a { color: var(--pcb); text-underline-offset: 3px; }
@media (prefers-color-scheme: dark) { a { color: var(--heading); } }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.brand-name span { color: var(--muted); font-weight: 400; }
.brand-mark { width: 30px; height: 30px; }
.brand-mark .chip-static { fill: var(--chip); }

.header-link { font-size: 0.95rem; font-weight: 700; white-space: nowrap; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 40px 20px 32px;
}

.hero h1 {
  font-size: clamp(3rem, 11vw, 6.5rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.92;
  margin: 0;
}

/* gold contact strip under the headline */
.hero h1::after {
  content: "";
  display: block;
  width: min(440px, 80%);
  height: 16px;
  margin: 26px auto 0;
  background: repeating-linear-gradient(90deg, var(--gold) 0 7px, transparent 7px 11px);
  border-radius: 2px;
}

.lede {
  max-width: 30em;
  margin: 24px auto 0;
  font-size: clamp(1.1rem, 2.4vw, 1.3rem);
}

.detect {
  max-width: 36em;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 0.98rem;
}
.detect:empty { display: none; }

/* ---------- Donate box ---------- */
.donate {
  max-width: 800px;
  margin: 0 auto;
  padding: clamp(20px, 4.5vw, 40px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
}
@media (max-width: 760px) {
  .donate { margin: 0 12px; }
}

.stick-wrap { margin-bottom: 30px; }
#stick { display: block; width: 100%; height: auto; overflow: visible; }

.board { fill: var(--pcb); }
.pin { fill: var(--gold); }
.notch { fill: var(--surface); }

.silk {
  fill: rgba(255, 255, 255, 0.72);
  font-family: "Atkinson Hyperlegible", system-ui, sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.socket {
  fill: none;
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.chip {
  fill: var(--chip);
  stroke: transparent;
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  transition: stroke 0.2s ease, transform 0.8s cubic-bezier(.5, -0.3, .7, 1), opacity 0.8s ease;
}
.chip.lit { stroke: var(--gold); }
.chip.gone { transform: translateY(-150px) rotate(-10deg) scale(0.85); opacity: 0; }

/* form */
#state-form { display: grid; gap: 22px; }

.sizes { border: 0; margin: 0; padding: 0; min-width: 0; }
.sizes legend, .field label {
  display: block;
  font-weight: 700;
  margin-bottom: 10px;
  padding: 0;
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 8px;
}

.size { position: relative; cursor: pointer; }
.size input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.size span {
  display: block;
  padding: 12px 0;
  text-align: center;
  font-weight: 700;
  border: 2px solid var(--line);
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.size:hover span { border-color: var(--pcb); }
.size input:checked + span { background: var(--pcb); border-color: var(--pcb); color: #fff; }
.size input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

.field select {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 10px;
}

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
}
.consent input {
  flex: none;
  width: 22px; height: 22px;
  margin: 2px 0 0;
  accent-color: var(--pcb);
}

.warn, .error { margin: 0; font-weight: 700; }
.warn { color: var(--muted); }
.error { color: var(--danger); }
.warn:empty, .error:empty { display: none; }

.upload-btn {
  width: 100%;
  padding: 18px 20px;
  font-family: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 800;
  color: var(--gold-ink);
  background: var(--gold);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 5px 0 var(--gold-shadow);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
.upload-btn:hover { filter: brightness(1.06); }
.upload-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--gold-shadow); }

.ghost-btn {
  width: 100%;
  padding: 16px 20px;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.ghost-btn:hover { border-color: var(--pcb); }

.fine {
  margin: 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

/* progress */
#state-progress { display: grid; gap: 14px; }
#state-progress[hidden], #state-done[hidden], #state-form[hidden] { display: none; }

.status { margin: 0; font-weight: 700; font-size: 1.1rem; min-height: 1.6em; }

.bar {
  height: 24px;
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(-45deg, var(--pcb) 0 12px, var(--pcb-deep) 12px 24px);
  background-size: 34px 34px;
  animation: stripes 0.9s linear infinite;
}
@keyframes stripes { to { background-position: 34px 0; } }

.progress-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

/* done */
#state-done { display: grid; gap: 18px; }
#state-done h3 { font-size: clamp(1.7rem, 4vw, 2.2rem); font-weight: 800; margin: 0; }
#state-done h3:focus { outline: none; }
.done-msg { margin: 0; font-size: 1.1rem; }

.receipt {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 0;
  padding: 18px 0;
  border-top: 2px dashed var(--line);
  border-bottom: 2px dashed var(--line);
}
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; text-align: right; font-weight: 700; }

.done-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 520px) { .done-actions { grid-template-columns: 1fr; } }

.share-note { margin: 0; color: var(--muted); text-align: center; }
.share-note:empty { display: none; }

/* ---------- Appeal ---------- */
.appeal {
  max-width: 960px;
  margin: 88px auto 0;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 56px;
}
@media (max-width: 780px) { .appeal { grid-template-columns: 1fr; gap: 40px; } }

.appeal-goal > p { max-width: 32em; margin: 0 0 22px; }

.goal {
  height: 30px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
}
.goal-fill {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(90deg, var(--gold) 0 7px, var(--gold-shadow) 7px 9px);
  transition: width 1.2s ease;
}
.goal-pct { margin: 8px 0 22px; color: var(--muted); font-size: 0.95rem; }

.totals { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.totals p { margin: 0; color: var(--muted); }
.totals strong {
  display: block;
  font-family: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.feed { list-style: none; margin: 0; padding: 0; }
.feed li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  animation: arrive 0.45s ease;
}
.feed li.you {
  background: var(--tint);
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 8px;
  font-weight: 700;
}
.feed .amt { font-weight: 700; color: var(--heading); white-space: nowrap; }
@keyframes arrive { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Stories ---------- */
.stories {
  max-width: 960px;
  margin: 88px auto 0;
  padding: 0 20px;
}
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
  margin-top: 8px;
}
.stories figure {
  margin: 0;
  padding-left: 18px;
  border-left: 5px solid var(--gold);
}
.stories blockquote { margin: 0 0 12px; font-size: 1.12rem; }
.stories figcaption { color: var(--muted); font-size: 0.95rem; }

/* ---------- FAQ ---------- */
.faq {
  max-width: 720px;
  margin: 88px auto 0;
  padding: 0 20px;
}
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  padding: 16px 0;
  font-weight: 700;
  cursor: pointer;
  list-style-position: inside;
}
.faq details p { margin: 0 0 18px; max-width: 38em; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 96px;
  padding: 36px 20px 48px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}
.site-footer p { margin: 4px auto; max-width: 40em; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chip { transition: opacity 0.3s ease; }
  .chip.gone { transform: none; }
  .bar-fill { animation: none; }
  .feed li { animation: none; }
  .goal-fill { transition: none; }
}
