/* Light-first, dark by toggle. Near-black on warm off-white; pure #000/#fff
   nowhere. Colour appears in exactly three ramp-driven places (numeral,
   track, chart price series) plus the red/green 24h stat — nothing else on
   the page is coloured. */

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/outfit-latin-var.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin-var.woff2") format("woff2");
}

:root[data-theme="light"] {
  --bg: #faf9f7;
  --fg: #1c1b19;
  --muted: #807b73;
  --hairline: #e5e2db;
  --halo-opacity: 0.07;   /* light mode: faint tint wash, never a bloom */
}

:root[data-theme="dark"] {
  --bg: #131311;
  --fg: #eceae4;
  --muted: #8f8b82;
  --hairline: #2a2925;
  --halo-opacity: 0.2;    /* dark mode: the glow is the Huly quality */
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* ---- top bar (scrolls away, not sticky) ------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 24px;
}

.wordmark {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
}

#theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, box-shadow 0.2s;
}

#theme-toggle:hover {
  color: var(--fg);
  box-shadow: 0 0 12px 0 color-mix(in srgb, var(--fg) 12%, transparent);
}

/* The icon shows the mode you are currently in: sun in light, moon in dark.
   Keying it off data-theme rather than a click handler means it is correct on
   the very first paint, including when the theme comes from localStorage or
   the system preference. */
#theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] #theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] #theme-toggle .icon-moon {
  display: block;
}

/* ---- staleness banner ------------------------------------------------- */

.banner {
  background: var(--hairline);
  color: var(--fg);
  font-size: 13px;
  text-align: center;
  padding: 10px 24px;
}

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

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  text-align: center;
  padding: clamp(40px, 8vh, 88px) 0 8px;
}

h1 {
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  font-size: clamp(44px, 7vw, 64px);
  letter-spacing: -0.02em;
  line-height: 0.95;
  margin-bottom: 24px;
}

.intro {
  color: var(--muted);
  max-width: 60ch;
  margin: 0 auto 14px;
}

.unavailable {
  text-align: center;
  color: var(--muted);
  padding: 80px 0 120px;
}

/* ---- the value and the track ------------------------------------------ */

.value-section {
  text-align: center;
  padding: clamp(24px, 5vh, 56px) 0 8px;
}

.value-wrap {
  position: relative;
  display: inline-block;
}

.value {
  /* Rendered at its final position and colour on load — no count-up. */
  position: relative;
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: clamp(96px, 20vw, 120px);
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  z-index: 1;
}

.value-halo {
  position: absolute;
  inset: -48px -72px;
  background: radial-gradient(closest-side,
              var(--halo-color, transparent), transparent 72%);
  opacity: var(--halo-opacity);
  pointer-events: none;
}

/* One subtle ambient shimmer on the value, dark mode only. */
@keyframes shimmer {
  0%, 100% { opacity: var(--halo-opacity); }
  50% { opacity: calc(var(--halo-opacity) * 1.6); }
}

:root[data-theme="dark"] .value-halo {
  animation: shimmer 7s ease-in-out infinite;
}

.track {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  margin: 28px auto 0;
}

.track-end {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.track-rail {
  position: relative;
  flex: 1;
  height: 14px;
  display: flex;
  align-items: center;
}

.track-bar {
  width: 100%;
  height: 3px;
  border-radius: 2px;
  /* The gradient itself is set from JS off the same ramp as the numeral. */
}

.track-marker {
  /* The whole track is coloured, so the marker cannot rely on hue: a solid
     disc in the page foreground with a ring — shape contrast, not colour. */
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--fg);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--fg);
  transform: translate(-50%, -50%);
}

.updated {
  font-size: 13px;
  color: var(--muted);
  margin-top: 18px;
}

/* ---- stats ------------------------------------------------------------ */

.stats {
  display: flex;
  justify-content: center;
  gap: clamp(32px, 7vw, 88px);
  padding: clamp(32px, 6vh, 56px) 0;
  text-align: center;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-figure {
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---- chart ------------------------------------------------------------ */

.chart-section {
  padding-bottom: 24px;
}

.chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 0 14px;
}

.pill-group {
  display: flex;
  gap: 4px;
}

.pill {
  font-family: "Inter", sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.pill:hover {
  color: var(--fg);
  box-shadow: 0 0 10px 0 color-mix(in srgb, var(--fg) 10%, transparent);
}

.pill.active {
  color: var(--bg);
  background: var(--fg);
}

.chart {
  width: 100%;
  height: 420px;
}

/* ---- about ------------------------------------------------------------ */

.about {
  max-width: 62ch;
  margin: 0 auto;
  padding: clamp(40px, 8vh, 72px) 0;
  color: var(--muted);
}

.about h2 {
  font-family: "Outfit", sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  margin: 28px 0 8px;
}

.about h2:first-child { margin-top: 0; }

.about code {
  font-size: 13px;
  background: var(--hairline);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ---- footer (Huly-style: muted, airy, nothing boxed) ------------------ */

footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 96px 24px 72px;
  font-size: 13px;
  color: var(--muted);
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--fg);
  text-decoration: underline;
}

.footer-sep { color: var(--hairline); }

/* ---- scroll reveals --------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}

/* ---- mobile (designed at 375px first, then loosened) ------------------ */

@media (max-width: 640px) {
  .stats {
    flex-direction: column;
    gap: 24px;
  }

  .chart { height: 300px; }

  .chart-controls { justify-content: center; }
}
