/* Public page: ink-coloured hero over a paper body, journal-like styling.
   Colour is reserved for the data: orange price, green/red cost, grey band.
   The expert page keeps its dark dashboard look. */
:root {
  color-scheme: light;
  --bg: #fcfcfa;
  --ink: #15181d;          /* hero background */
  --panel: #ffffff;
  --border: #e3e3db;
  --border-strong: #c9c9bf;
  --text: #1c2024;
  --muted: #5b6470;
  --accent: #f7931a;       /* bitcoin orange: the price line */
  --accent-ink: #b16a00;   /* darker orange, readable as text on light bg */
  --ok: #1a9850;           /* cost below price: mining pays */
  --ko: #d73027;           /* cost above price: mining loses */
  --ok-hero: #3fca7f;      /* brighter variants for the dark hero */
  --ko-hero: #ff6b5c;
  --band: rgba(110, 122, 138, 0.20);
  --halving: #9aa3ad;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ---------------- Hero ---------------- */

.hero {
  /* Decorative mining-farm photo, almost swallowed by the ink: the text
     column sits on a near-solid gradient, the racks only show on the right,
     and the bottom fades back to solid so the sparkline stays crisp. */
  background-color: var(--ink);
  background-image:
    linear-gradient(100deg, rgba(21, 24, 29, 0.98), rgba(21, 24, 29, 0.92) 45%, rgba(21, 24, 29, 0.55)),
    linear-gradient(to top, rgba(21, 24, 29, 0.97), rgba(21, 24, 29, 0) 55%),
    url("/static/mining-hero.jpg");
  background-size: auto, auto, cover;
  background-position: center, center, right center;
  background-repeat: no-repeat;
  color: #f2efe7;
  position: relative;
  overflow: hidden;
}

.hero-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 20px 30px;
  position: relative;
  z-index: 2;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b8b2a4;
}

.btc-mark {
  color: var(--accent);
  font-size: 17px;
  font-weight: 700;
}

.lang-toggle a {
  display: inline-block;
  background: transparent;
  color: #b8b2a4;
  border: 1px solid #3b4048;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
}

.lang-toggle a + a { border-left: none; }

.lang-toggle a[aria-current="true"] {
  background: #f2efe7;
  color: var(--ink);
  border-color: #f2efe7;
}

/* Currency switch: same dark-hero pill styling as the language toggle, but a
   client-side preference so it stays <button> rather than an SSR link. */
.hero-toggles { display: flex; align-items: center; gap: 10px; }
.cur-toggle { display: flex; }

.cur-toggle button {
  background: transparent;
  color: #b8b2a4;
  border: 1px solid #3b4048;
  padding: 5px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
}

.cur-toggle button + button { border-left: none; }

.cur-toggle button[aria-pressed="true"] {
  background: #f2efe7;
  color: var(--ink);
  border-color: #f2efe7;
}

.kicker {
  margin: 52px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-size: clamp(34px, 6.2vw, 62px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.015em;
  max-width: 820px;
  color: #faf8f1;
}

.hero .tagline {
  max-width: 640px;
  color: #b3ad9f;
  font-size: 16.5px;
  margin: 20px 0 0;
}

.hero-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 56px;
  margin: 36px 0 0;
}

.fig-value {
  display: block;
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 58px);
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.fig-value.price { color: var(--accent); }
.fig-value.ok { color: var(--ok-hero); }
.fig-value.ko { color: var(--ko-hero); }

.fig-label {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8f8a7d;
}

.hero .ratio {
  margin: 30px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 17.5px;
  color: #cfc9bb;
  max-width: 640px;
}

.hero .ratio.ok strong { color: var(--ok-hero); font-style: normal; }
.hero .ratio.ko strong { color: var(--ko-hero); font-style: normal; }
.hero .ratio strong { color: #faf8f1; }
.ratio.hidden { display: none; }

#spark {
  display: block;
  width: 100%;
  height: 200px;
}

#spark_cost { stroke: rgba(242, 239, 231, 0.30); stroke-width: 1.2; }
#spark_price {
  stroke: var(--accent);
  stroke-width: 1.8;
  filter: drop-shadow(0 0 7px rgba(247, 147, 26, 0.35));
}

/* ---------------- Body ---------------- */

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 44px;
}

main { margin-top: 30px; }

.chart-card {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 14px;
  position: relative;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.fig-caption {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.range-buttons { white-space: nowrap; }

.range-buttons button {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  padding: 4px 12px;
  font-size: 12.5px;
  cursor: pointer;
}

.range-buttons button + button { border-left: none; }

.range-buttons button.active {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
  font-weight: 600;
}

#chart { width: 100%; height: 440px; }

.status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  pointer-events: none;
}

.status.hidden { display: none; }
.status.error { color: var(--ko); }

.lognote {
  margin: 2px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.lognote.hidden { visibility: hidden; }

.fig-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 36px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.fig-notes.hidden { display: none; }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-right: 8px;
}

.stat-value {
  font-size: 13.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.ok { color: var(--ok); }
.ko { color: var(--ko); }

section.read, section.explain { margin-top: 40px; }

section > h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 14px;
}

section > h2::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  background: var(--accent);
  margin-bottom: 12px;
}

.legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.legend-list li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 14.5px;
  color: var(--muted);
}

.legend-list strong { color: var(--text); }

.chip {
  flex: 0 0 22px;
  height: 4px;
  border-radius: 2px;
  position: relative;
  top: -3px;
}

.chip-price { background: var(--accent); }
.chip-cost { background: linear-gradient(90deg, var(--ok) 0 50%, var(--ko) 50% 100%); }
.chip-band {
  background: var(--band);
  height: 12px;
  top: 1px;
  border: 1px solid rgba(110, 122, 138, 0.45);
}
.chip-halving {
  background: repeating-linear-gradient(90deg, var(--halving) 0 4px, transparent 4px 8px);
}

/* Three magazine-style columns separated by hairlines, no boxes. */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  counter-reset: card;
}

.card { padding: 0 20px; }
.card:first-child { padding-left: 0; }
.card:last-child { padding-right: 0; }
.card + .card { border-left: 1px solid var(--border); }

.card::before {
  counter-increment: card;
  content: counter(card, decimal-leading-zero);
  display: block;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: rgba(28, 32, 36, 0.18);
  margin-bottom: 10px;
}

.card h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 16.5px;
  font-weight: 700;
}

.card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

/* Call-to-action band: sends readers to the full methodology page. Ink band
   echoing the hero, with a one-line essential caveat kept inline. */
.cta {
  margin-top: 44px;
  background: var(--ink);
  color: #f2efe7;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px 36px;
  flex-wrap: wrap;
}

.cta-text { max-width: 600px; }

.cta h2 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 6px;
  color: #faf8f1;
}

.cta p {
  margin: 0;
  font-size: 14px;
  color: #b3ad9f;
}

.cta-link {
  flex: 0 0 auto;
  background: var(--accent);
  color: #15181d;
  font-weight: 650;
  font-size: 14px;
  letter-spacing: 0.01em;
  padding: 12px 22px;
  text-decoration: none;
  white-space: nowrap;
}

.cta-link:hover { background: #ffa733; }

footer {
  margin-top: 34px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
}

footer p { margin: 4px 0; }

footer a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
footer a:hover { color: var(--text); }
.foot-sep { color: var(--border-strong); margin: 0 8px; }

@media (max-width: 760px) {
  .kicker { margin-top: 36px; }
  .hero-figures { gap: 14px 32px; }
  #spark { height: 120px; }
  .cards { grid-template-columns: 1fr; }
  .card { padding: 0; }
  .card + .card {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 16px;
  }
  .cta { flex-direction: column; align-items: flex-start; }
  .cta-link { align-self: stretch; text-align: center; }
  #chart { height: 340px; }
}
