:root {
  --bg: #0b0c10;
  --bg-2: #131620;
  --card: #16181f;
  --ink: #f1f4f9;
  --muted: #a5abb8;
  --red: #a6453e;
  --blue: #3e526e;
  --gold: #8a6f47;
  --green: #3e5f4e;
  --line: #272b34;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(1200px 700px at 50% -200px, #1c222b 0, transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-color: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .hero-number, .card-big {
  font-family: "Archivo", system-ui, sans-serif;
  letter-spacing: -0.02em;
}

em { color: var(--gold); font-style: normal; font-weight: 700; }

section { padding: 5rem 1.5rem; max-width: 1000px; margin: 0 auto; }

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 900;
  text-align: center;
  margin-bottom: 2.5rem;
}
.section-title.small { font-size: 1.3rem; margin-bottom: 1.5rem; }

/* ===================== HERO ===================== */
.hero {
  text-align: center;
  padding: 6rem 1.5rem 5rem;
  max-width: 900px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.8rem;
  color: var(--blue);
  font-weight: 700;
  margin-bottom: 1rem;
}
.hero h1 {
  font-size: clamp(3rem, 12vw, 6.5rem);
  font-weight: 900;
  line-height: 0.95;
  background: linear-gradient(180deg, #f2f4f6, #aab0b8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline {
  font-size: clamp(1.05rem, 2.5vw, 1.4rem);
  color: var(--muted);
  max-width: 620px;
  margin: 1.5rem auto 0;
}
.hero-stat {
  margin: 3.5rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.hero-label { color: var(--muted); font-size: 1rem; }
.hero-number {
  font-size: clamp(5rem, 22vw, 12rem);
  font-weight: 900;
  line-height: 1;
  color: var(--red);
  text-shadow: 0 0 28px rgba(166, 69, 62, 0.2);
}
.hero-unit { font-size: 1.3rem; font-weight: 700; }
.hero-unit .per { display: block; color: var(--muted); font-weight: 400; font-size: 1rem; }
.hero-sub {
  margin: 2.5rem auto 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 1.05rem;
}
.hero-sub strong, .hero-sub #oneMuskValue { color: var(--ink); }
.scroll-cue {
  display: inline-block;
  margin-top: 3rem;
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid var(--line);
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  transition: background 0.2s;
}
.scroll-cue:hover { background: var(--card); }

/* ===================== CARDS ===================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: var(--shadow);
}
.card.highlight { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), var(--shadow); }
.card-big {
  font-size: clamp(2.6rem, 7vw, 3.6rem);
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}
.card.highlight .card-big { color: var(--red); }
.card-big .u { font-size: 1rem; color: var(--muted); font-weight: 600; margin-left: 0.4rem; letter-spacing: 0; }
.card h3 { margin: 0.6rem 0 0.8rem; font-size: 1.15rem; }
.card p { color: var(--muted); font-size: 0.98rem; }

/* ===================== CALCULATOR ===================== */
.calc { border-top: 1px solid var(--line); }
.calc-intro {
  text-align: center;
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto 3rem;
  font-size: 1.05rem;
}
.calc-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: var(--shadow);
}
.control { margin-bottom: 2rem; }
.control label { display: block; font-weight: 700; margin-bottom: 0.8rem; }
.slider-row { display: flex; align-items: center; gap: 1rem; }
.control-note { color: var(--muted); font-size: 0.85rem; margin-top: 0.5rem; }
input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--red), var(--blue));
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--red);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--red);
  cursor: pointer;
}
output {
  font-family: "Archivo", sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  min-width: 3.5rem;
  text-align: right;
  color: var(--gold);
}
.readout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  border-left: 1px solid var(--line);
  padding-left: 2rem;
}
.readout-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.readout-label { color: var(--muted); }
.readout-value { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 1.3rem; }
.readout-row.big .readout-value { font-size: 2.6rem; }
.readout-value.accent { color: var(--red); }
.readout-verdict {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--gold);
  font-weight: 600;
  font-style: italic;
}

/* ===================== TICKER ===================== */
.ticker-section { text-align: center; border-top: 1px solid var(--line); }
.ticker-copy { color: var(--muted); margin-bottom: 1rem; }
.ticker {
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  font-size: clamp(2.5rem, 9vw, 5rem);
  color: var(--green);
  text-shadow: 0 0 22px rgba(62, 95, 78, 0.18);
  font-variant-numeric: tabular-nums;
}
.ticker-sub { color: var(--muted); margin-top: 1rem; }
.ticker-sub strong { color: var(--ink); }

/* ===================== FOOTER ===================== */
.footer { border-top: 1px solid var(--line); text-align: center; }
.sources { max-width: 720px; margin: 0 auto 2rem; text-align: left; }
.source-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.s-label { color: var(--ink); font-weight: 600; font-size: 0.95rem; }
.s-pct {
  color: var(--blue); font-weight: 700; font-size: 0.78rem;
  margin-left: 0.35rem; font-family: "Archivo", sans-serif;
}
.s-val {
  color: var(--gold); font-family: "Archivo", sans-serif; font-weight: 700;
  white-space: nowrap; text-align: right;
}
.s-src { grid-column: 1 / -1; color: var(--muted); font-size: 0.8rem; }

/* collapsible category group */
.source-group { border-bottom: 1px solid var(--line); }
.source-group summary {
  padding: 0.85rem 0; cursor: pointer; list-style: none;
  color: var(--blue); font-weight: 700; font-size: 0.95rem;
  display: flex; align-items: center; gap: 0.55rem;
}
.source-group summary::-webkit-details-marker { display: none; }
.source-group summary::before {
  content: "▸"; display: inline-block; transition: transform 0.2s; color: var(--muted);
}
.source-group[open] summary::before { transform: rotate(90deg); }
.source-cats {
  margin: 0 0 0.6rem 0.4rem;
  padding-left: 1rem;
  border-left: 2px solid var(--line);
}
.source-cats .source-row { border-bottom: 1px dashed var(--line); }
.source-cats .source-row:last-child { border-bottom: none; }
.disclaimer { color: var(--muted); font-size: 0.85rem; max-width: 640px; margin: 0 auto; }
.updated { color: var(--muted); font-size: 0.8rem; margin-top: 1.5rem; opacity: 0.7; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 720px) {
  .calc-body { grid-template-columns: 1fr; }
  .readout { border-left: none; border-top: 1px solid var(--line); padding-left: 0; padding-top: 2rem; }
  section { padding: 3.5rem 1.25rem; }
}

/* ===================== RULER STRIP ===================== */
.ruler-section { border-top: 1px solid var(--line); text-align: center; }
.ruler-lead { color: var(--muted); max-width: 620px; margin: -1.5rem auto 1.5rem; }
.legend {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 1rem; border: 1px solid var(--line);
  border-radius: 999px; color: var(--muted); margin-bottom: 1.5rem;
}
.legend .swatch {
  position: relative; width: 2.4rem; height: 0.85rem; background: transparent;
  border-left: 2px solid var(--muted); border-right: 2px solid var(--muted); border-radius: 0;
}
.legend .swatch::before {
  content: ""; position: absolute; top: 50%; left: 0; right: 0;
  height: 2px; background: var(--muted); transform: translateY(-50%);
}
.legend strong { color: var(--ink); }

.swipe-hint { color: var(--blue); font-weight: 600; margin-bottom: 0.8rem; font-size: 0.95rem; }
.swipe-hint .arrow { display: inline-block; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%,100% { transform: translateX(0); } 50% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .swipe-hint .arrow { animation: none; } }

.ruler-viewport {
  overflow-x: auto; overflow-y: hidden;
  border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(180deg, #14161d, #0b0c10);
  box-shadow: var(--shadow); text-align: left;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: var(--blue) var(--card);
}
.ruler-track { --unit: 200px; position: relative; padding: 2rem 4rem 2.5rem 1.5rem; min-width: max-content; }

.gridline { position: absolute; top: 3.2rem; bottom: 1.5rem; width: 1px; background: var(--line); }
.gridline.whole { background: #2b303a; }

.axis { position: relative; height: 2.6rem; margin-bottom: 0.5rem; }
.tick { position: absolute; top: 0; }
.tick .mark { width: 1px; height: 0.7rem; background: var(--muted); }
.tick .num {
  font-family: "Archivo", sans-serif; font-weight: 700;
  font-size: 0.8rem; color: var(--muted); white-space: nowrap;
  margin-top: 0.2rem; transform: translateX(-2px);
}

.r-item { position: relative; margin: 1.4rem 0; }
/* column is exactly the bar's width, so the label can only stick that far */
.r-col { position: relative; }
/* label pins to the left while its bar is in view, then falls off with it */
.r-caption {
  position: sticky; left: 1.5rem; z-index: 5;
  width: fit-content; white-space: nowrap;
  font-weight: 700; margin-bottom: 0.5rem; font-size: 1rem;
}
.r-caption .sub { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.r-barwrap { display: flex; align-items: center; gap: 0.8rem; }
.r-bar {
  height: 2.6rem; width: 100%; border-radius: 6px; min-width: 3px;
  background: var(--gold); box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  cursor: help; transition: filter 0.15s;
}
.r-bar:hover { filter: brightness(1.15); }
.r-tip {
  position: absolute; z-index: 30; pointer-events: none; display: none;
  transform: translate(-50%, -100%);
  background: #1e2129; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,0.55);
}
.r-tip .tip-main { display: block; font-family: "Archivo", sans-serif; font-weight: 800; color: var(--ink); font-size: 0.95rem; }
.r-tip .tip-sub { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 1px; }
.r-bar.red { background: linear-gradient(90deg, #7a332e, var(--red)); }
.r-bar.gold { background: linear-gradient(90deg, #6a5638, var(--gold)); }
.r-bar.blue { background: linear-gradient(90deg, #2f4054, var(--blue)); }
.r-bar.max { background: repeating-linear-gradient(45deg, #2c4739, #2c4739 11px, #3e5f4e 11px, #3e5f4e 22px); }
.r-value { font-family: "Archivo", sans-serif; font-weight: 800; white-space: nowrap; color: var(--ink); }

@media (max-width: 700px) { .ruler-track { --unit: 120px; } }
