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

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

body {
  margin: 0;
  background:
    radial-gradient(120% 60% at 50% 0%, var(--glow) 0%, transparent 60%),
    var(--ink);
  background-color: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--white); }

/* sleeve stripes: red / white / red */
.stripe {
  height: 14px;
  background: linear-gradient(
    to bottom,
    var(--red) 0 6px,
    var(--white) 6px 9px,
    var(--red) 9px 14px
  );
}

.masthead {
  text-align: center;
  padding: 1.25rem 16px 0;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  color: var(--white);
  text-decoration: none;
}
.wordmark span { color: var(--red-bright); }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

/* --- hero --- */

.hero {
  text-align: center;
  padding: 2.25rem 0 2.5rem;
}

.stamp {
  display: inline-block;
  margin: 0 0 1.25rem;
  padding: 0.2rem 0.7rem;
  border: 2px solid var(--red-bright);
  border-radius: 3px;
  color: var(--red-bright);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.hero-label {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.25rem, 4.5vw, 1.75rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ticker {
  margin: 0.25rem 0 0.25rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 12.5vw, 7.5rem); /* room for $X,XXX,XXX.XX at 375px */
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--white);
  text-shadow: 0 4px 30px rgba(206, 17, 38, 0.45);
  white-space: nowrap;
}
.ticker .cents { color: var(--red-bright); }

.ticker-sub {
  margin: 0.5rem auto 0;
  max-width: 30ch;
  color: var(--text-muted);
}

/* --- countdown to the clock stop --- */

.countdown {
  margin: 1.75rem auto 0;
  max-width: 34rem;
  padding: 1rem 1rem 1.1rem;
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  background: var(--surface);
}

.cd-label {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--silver);
}

.cd-time {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 9vw, 3.25rem);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--white);
}
.cd-u {
  margin-left: 0.06em;
  font-size: 0.55em;
  color: var(--red-bright);
}
.countdown.urgent .cd-time { animation: pulse 1s ease-in-out infinite; color: var(--red-bright); }
.countdown.stopped .cd-time { color: var(--red-bright); text-transform: uppercase; letter-spacing: 0.08em; }

.cd-note {
  margin: 0.45rem auto 0;
  max-width: 40ch;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.cd-actions { margin-top: 0.75rem; }
.cd-btn {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: 600 0.82rem var(--font-body);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.cd-btn:hover,
.cd-btn:focus-visible { background: var(--accent); color: var(--ink); outline: none; }
.cd-btn[aria-pressed="true"] { border-color: var(--red-bright); color: var(--white); }

.mini-stats {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr; /* two or three tiles, depending on the state */
  gap: 0.6rem;
  margin: 2rem 0 0;
}

.mini {
  display: flex;
  flex-direction: column;
  padding: 0.8rem 0.4rem;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 8px;
}

.mini[hidden] { display: none; }

.mini-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.15rem, 4.8vw, 1.7rem);
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1.2;
}

.mini-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 0.2rem;
}

.season { margin: 1.75rem 0 0; }

.season-bar {
  height: 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--surface-line);
  overflow: hidden;
}

.season-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--red), var(--red-bright));
  border-radius: 6px 0 0 6px;
}

.season-caption {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.season-caption strong { color: var(--white); font-weight: 600; }

/* --- photo --- */

.photo {
  margin: 0 0 2.5rem;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1050 / 1315;
  border-radius: 10px;
  border: 1px solid var(--surface-line);
  filter: saturate(0.85);
}

.photo figcaption {
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.photo .credit { display: block; color: var(--silver); font-size: 0.78rem; }
.photo .credit a { color: var(--silver); }

/* --- equivalents --- */

.equiv {
  text-align: center;
  padding: 1.75rem 1rem;
  margin: 0 0 2.5rem;
  border-top: 1px solid var(--surface-line);
  border-bottom: 1px solid var(--surface-line);
}

.equiv h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--silver);
}

.equiv-line {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  line-height: 1.15;
  transition: opacity 0.35s ease;
}
.equiv-line.fading { opacity: 0; }
.equiv-num { color: var(--accent); font-variant-numeric: tabular-nums; }

.equiv-note {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--silver);
  transition: opacity 0.35s ease;
}
.equiv-note.fading { opacity: 0; }

/* --- open letter --- */

.letter {
  margin: 0 0 2.5rem;
}

.letter h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.7rem, 6vw, 2.4rem);
  line-height: 1.1;
  text-transform: uppercase;
}
.letter h2 span { display: block; color: var(--accent); }

.letter p { margin: 0 0 1rem; color: var(--text-muted); }

/* --- "previously on Hellebucks" --- */

.previously {
  margin: 0 0 2.5rem;
  padding: 1.1rem 1.15rem 1.15rem;
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  background: var(--surface);
}
.previously h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hellebucks);
}
.previously-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 0 0 0.75rem;
}
.previously-stats div { display: flex; flex-direction: column; }
.previously-stats b {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.15rem, 4.8vw, 1.6rem);
  line-height: 1.15;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}
.previously-stats span { font-size: 0.78rem; line-height: 1.3; color: var(--text-muted); }
.previously p { margin: 0; font-size: 0.92rem; color: var(--text-muted); }
.previously a { color: var(--hellebucks); }

/* --- honesty note --- */

.honesty {
  margin: 0 0 2.5rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  background: var(--surface);
}
.honesty h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.honesty p { margin: 0 0 0.6rem; font-size: 0.92rem; color: var(--text-muted); }
.honesty p:last-child { margin-bottom: 0; }

/* --- the celebration (celebrate.js) --- */

.goal-light {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: radial-gradient(circle at 50% 30%, rgba(211, 33, 60, 0.75), rgba(172, 22, 44, 0.35) 45%, transparent 75%);
  opacity: 0;
  animation: goal-light 0.6s ease-in-out 4;
}
@keyframes goal-light {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 60;
  pointer-events: none;
}

.stamp.slam { animation: slam 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@keyframes slam {
  0% { transform: scale(3.2) rotate(-12deg); opacity: 0; }
  60% { transform: scale(0.92) rotate(-1deg); opacity: 1; }
  100% { transform: scale(1) rotate(-2deg); opacity: 1; }
}

.ticker.thud { animation: thud 0.45s ease-out 0.3s; }
@keyframes thud {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 3px); }
  40% { transform: translate(5px, -2px); }
  60% { transform: translate(-3px, 1px); }
  80% { transform: translate(2px, 0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* --- share row (matches turnout_simulator) --- */

.share-section {
  margin: 0 0 2.5rem;
  text-align: center;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.share-label {
  flex-basis: 100%;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--silver);
  margin-bottom: 0.35rem;
}

.s-share {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: 1px solid var(--surface-line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--white);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.s-share:hover,
.s-share:focus-visible {
  background: var(--accent);
  color: var(--ink);
  outline: none;
}
.s-share svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }

.s-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.s-share:hover .s-tip,
.s-share:focus-visible .s-tip,
.s-share.copied .s-tip { opacity: 1; }

.share-hint {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: var(--silver);
}

/* --- footer --- */

.footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 16px 2.5rem;
  border-top: 1px solid var(--surface-line);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--silver);
}
.footer p { margin: 0 0 0.75rem; }
.footer a { color: var(--silver); }
.footer a:hover { color: var(--white); }
.footer strong { color: var(--text-muted); }

/* maker credit: the logo is a white knockout so it sits on the black */
.footer .maker {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: fit-content;
  margin: 1.75rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--surface-line);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.footer .maker:hover,
.footer .maker:focus-visible { opacity: 1; }
.maker-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--silver);
}
.maker img { height: 3.25rem; width: auto; display: block; }

/* --- toast (copy / share feedback) --- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 1rem);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 420px) {
  .stamp { font-size: 0.85rem; letter-spacing: 0.1em; }
  .mini-stats { gap: 0.4rem; }
  .mini-label { font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .equiv-line, .equiv-note, .toast { transition: none; }
  .stamp.slam, .ticker.thud, .countdown.urgent .cd-time { animation: none; }
}
