@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Azeret Mono";
  src: url("/assets/fonts/azeret-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Azeret Mono";
  src: url("/assets/fonts/azeret-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --paper: #fbfbf9;
  --ink: #0e0e0c;
  --mute: #8b8b83;
  --hair: #dedcd4;
  --red: #d5301b;
  --sans: "Instrument Sans", system-ui, sans-serif;
  --mono: "Azeret Mono", ui-monospace, monospace;
  --pad: clamp(1.1rem, 5vw, 3rem);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.12rem);
  line-height: 1.5;
  overflow-x: hidden;
}

#boom {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 99;
  background: var(--red);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.6rem 0.9rem;
}

main { max-width: 68rem; margin: 0 auto; padding: 0 var(--pad) 5rem; }

section { padding-block: clamp(3rem, 9vw, 6rem); }
section + section { border-top: 1px solid var(--hair); }

h1, h2 {
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.92;
  margin: 0;
}

h1 { font-size: clamp(3.2rem, 17vw, 9rem); }
h2 { font-size: clamp(1.9rem, 6vw, 3.2rem); margin-bottom: 0.8rem; }

p { margin: 0 0 1rem; max-width: 46ch; }

/* ------------------------------------------------------------------ bar */

.bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.9rem var(--pad);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--hair);
}

.wordmark { font-weight: 500; }
.ticker { color: var(--mute); }

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

.hero { padding-top: clamp(2rem, 6vw, 3.5rem); }

.lede {
  font-size: clamp(1.05rem, 3.6vw, 1.5rem);
  color: var(--mute);
  margin-top: 0.7rem;
}

.stage {
  margin: clamp(1rem, 4vw, 2rem) 0 0;
}

.stage svg {
  display: block;
  width: 100%;
  max-width: 40rem;
  height: auto;
  margin: 0 auto;
}

.ink-line { fill: none; stroke: var(--ink); }
.ink-fill { fill: var(--ink); stroke: none; }

/* ---------------------------------------------------------------- meter */

.meter { max-width: 40rem; margin: 0 auto; }

.readout {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  border-top: 2px solid var(--ink);
  padding-top: 0.7rem;
}

.count {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(2.4rem, 10vw, 4rem);
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.unit {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--mute);
}

.state {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--mute);
  margin: 0.35rem 0 1.4rem;
  min-height: 3.4em;
  max-width: none;
}

.state[data-mood="origin"] { color: var(--ink); }
.state[data-mood="waste"],
.state[data-mood="gone"] { color: var(--red); }

.bytes {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--mute);
  margin: 0.9rem 0 0;
  max-width: none;
}

/* --------------------------------------------------------------- slider */

#dial {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: ew-resize;
  display: block;
}

#dial::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--ink);
}
#dial::-moz-range-track {
  height: 2px;
  background: var(--ink);
}

#dial::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -12px;
  border-radius: 50%;
  background: var(--ink);
  border: 0;
}
#dial::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  border: 0;
}

#dial:focus-visible { outline: 2px solid var(--red); outline-offset: 6px; }
#dial:disabled { opacity: 0.35; cursor: default; }

.needs-js {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--red);
  margin: 0.2rem 0 0;
}

body[data-mounted] .needs-js { display: none; }

.scale {
  position: relative;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--mute);
}

.origin {
  position: absolute;
  left: var(--at, 55.6%);
  transform: translateX(-50%);
  white-space: nowrap;
  color: var(--ink);
}

.origin::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -0.75rem;
  width: 1px;
  height: 0.5rem;
  background: var(--ink);
}

.note { margin-top: clamp(2rem, 6vw, 3rem); color: var(--mute); }

/* -------------------------------------------------------------- verdict */

button {
  font: 500 0.85rem/1 var(--mono);
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: 0;
  padding: 1rem 1.3rem;
  cursor: pointer;
  min-height: 44px;
}

button:disabled { opacity: 0.45; cursor: default; }
button:hover:not(:disabled) { background: var(--red); }

.vote-out {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--mute);
  margin-top: 1rem;
  max-width: 44ch;
}

.hist { margin-top: 2rem; max-width: 40rem; }

.hist .bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 6rem;
  border-bottom: 1px solid var(--ink);
}

.hist i {
  flex: 1 1 0;
  min-height: 1px;
  background: var(--ink);
}

.hist i[data-mine="1"] { background: var(--red); }

.hist-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--mute);
  padding-top: 0.4rem;
}

/* ---------------------------------------------------------------- proof */

.proof {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 4vw, 3rem);
  max-width: 44rem;
  margin-top: 2.4rem;
}

.proof figure { margin: 0; }

.proof svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--hair);
}

.proof .proof-ink { fill: none; }
.proof figcaption {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding-top: 0.6rem;
}
.proof figcaption b { font-weight: 500; }
.proof figcaption span { color: var(--mute); }

/* --------------------------------------------------------------- plates */

.plate-row {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: 1fr;
  margin-bottom: 1.4rem;
}

.plate-row img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--hair);
}

/* ---------------------------------------------------------------- token */

.token h2 { font-family: var(--mono); font-size: clamp(1.6rem, 5vw, 2.4rem); }

.ca-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--mute);
  margin: 1.4rem 0 0.3rem;
}

.ca {
  font-family: var(--mono);
  font-size: clamp(0.72rem, 2.9vw, 0.95rem);
  word-break: break-all;
  line-height: 1.5;
}

.copy { margin-top: 0.6rem; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  margin-top: 2.4rem;
  font-family: var(--mono);
  font-size: 1rem;
}

.links a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 2px;
}

.links a:hover { color: var(--red); border-color: var(--red); }

footer {
  border-top: 1px solid var(--hair);
  padding-top: 2rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--mute);
}

footer p { max-width: none; }

/* ----------------------------------------------------------------- wide */

@media (min-width: 46rem) {
  .plate-row { grid-template-columns: 1.6fr 1fr; align-items: start; }
  .state { min-height: 2.9em; }
}

/* The hero has to fit one desktop screen, or the dial ends up below the fold
   and nobody ever finds the only control on the page. */
@media (min-width: 62rem) {
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 27rem) minmax(0, 1fr);
    grid-template-rows: auto auto auto 1fr;
    column-gap: clamp(2rem, 5vw, 4.5rem);
    align-items: start;
    min-height: calc(100vh - 8rem);
  }

  .hero h1 { grid-column: 1; grid-row: 1; font-size: clamp(4rem, 6vw, 5.6rem); }
  .hero .lede { grid-column: 1; grid-row: 2; margin-bottom: 2.2rem; }
  .hero .meter { grid-column: 1; grid-row: 3; margin: 0; }
  .hero .note { grid-column: 1; grid-row: 4; align-self: end; margin-top: 2.5rem; }

  .hero .stage {
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: center;
    margin: 0;
  }

  .hero .stage svg { max-width: min(40rem, 100%); }
}

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