/* =========================================================================
   koyomi. — market seasonality almanac.
   Design language: warm neutrals, single amber accent, Geist / Geist Mono.
   Dark theme is the default surface.
   ========================================================================= */

/* ---- Fonts (self-hosted, offline-capable) ------------------------------ */
@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Regular.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Medium.ttf") format("truetype");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-SemiBold.ttf") format("truetype");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Regular.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Medium.ttf") format("truetype");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-SemiBold.ttf") format("truetype");
  font-weight: 600; font-style: normal; font-display: swap;
}

/* ---- Tokens ------------------------------------------------------------ */
:root {
  --n-0: #FFFFFF; --n-50: #FAFAF7; --n-100: #F2F2EE; --n-200: #E5E5E0;
  --n-300: #CCCCC4; --n-400: #999992; --n-500: #666660; --n-600: #4D4D47;
  --n-700: #33332E; --n-800: #1F1F1B; --n-900: #161614; --n-950: #111110;

  --amber-100: #F8E8C2; --amber-300: #E5C173; --amber-500: #C2853A;
  --amber-700: #8C5C1F; --amber-900: #5C3C12;

  --green: #4C9A58;   /* positive returns anchor */
  --red:   #C4574E;   /* negative returns anchor */

  --cy-top: #C4574E; --cy-bottom: #C2853A; --cy-recovery: #6B9A74; --cy-rally: #6E8FA3;

  --font-sans: "Geist", "Inter Tight", -apple-system, system-ui, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;

  --ease: cubic-bezier(0.2, 0, 0.2, 1);
  --d-fast: 120ms; --d-base: 200ms; --d-slow: 400ms;

  /* dark theme (default) */
  --bg: var(--n-950);
  --bg-card: var(--n-900);
  --bg-raised: var(--n-800);
  --bg-inset: #1B1B18;
  --fg: var(--n-50);
  --fg-1: var(--n-100);
  --fg-2: var(--n-300);
  --fg-3: var(--n-400);
  --fg-4: var(--n-500);
  --border: #26261F;
  --border-strong: #33332E;
  --accent: var(--amber-500);
  --accent-bright: var(--amber-300);
  --glow-halo: rgba(194, 133, 58, 0.05);
  --cell-text: 250, 250, 247;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 8px 28px -12px rgba(0,0,0,0.5);
}

:root[data-theme="light"] {
  --bg: var(--n-50);
  --bg-card: var(--n-0);
  --bg-raised: var(--n-100);
  --bg-inset: var(--n-100);
  --fg: var(--n-900);
  --fg-1: var(--n-700);
  --fg-2: var(--n-600);
  --fg-3: var(--n-500);
  --fg-4: var(--n-400);
  --border: var(--n-200);
  --border-strong: var(--n-300);
  --accent: var(--amber-700);
  --accent-bright: var(--amber-500);
  --glow-halo: rgba(194, 133, 58, 0.07);
  --cell-text: 22, 22, 20;
  --shadow-card: 0 1px 2px rgba(22,22,20,0.05), 0 4px 12px rgba(22,22,20,0.06);
}

/* ---- Base -------------------------------------------------------------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  transition: background var(--d-slow) var(--ease), color var(--d-slow) var(--ease);
}
body::before {
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(1100px 480px at 50% -8%, var(--glow-halo), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
select { font: inherit; }

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

/* ---- Header ------------------------------------------------------------ */
.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 40px 0 20px;
}
.brand-block { display: flex; flex-direction: column; gap: 6px; }
.wordmark {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 40px;
  letter-spacing: -0.04em;
  color: var(--fg);
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
}
.wordmark .dot { color: var(--accent); margin-left: -0.14em; animation: dotPulse 4.5s var(--ease) infinite; }
@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.tagline a { color: var(--fg-3); border-bottom: 1px dotted var(--fg-4); }
.tagline a:hover { color: var(--accent-bright); text-decoration: none; }

.header-meta { display: flex; align-items: center; gap: 12px; }
.updated-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  white-space: nowrap;
}
.updated-chip b { color: var(--fg-1); font-weight: 500; }
.theme-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--fg-3);
  transition: color var(--d-base) var(--ease), border-color var(--d-base) var(--ease), transform var(--d-base) var(--ease);
}
.theme-btn:hover { color: var(--accent-bright); border-color: var(--border-strong); transform: rotate(20deg); }
.theme-btn svg { width: 16px; height: 16px; }

/* ---- Deck (what this page answers) ------------------------------------- */
.deck {
  max-width: 78ch;
  font-size: 13px;
  line-height: 1.62;
  color: var(--fg-4);
  margin: 0 0 18px;
}
.deck b { color: var(--fg-2); font-weight: 600; }

/* ---- Horizontal scroll affordance -------------------------------------- */
/* The fade is applied only while there is content past the edge, so a row that
   fits looks untouched. Class toggled from JS on scroll/resize/render. */
.hscroll { --fade: 26px; }
.hscroll.fade-r {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - var(--fade)), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - var(--fade)), transparent);
}
.hscroll.fade-l {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fade));
          mask-image: linear-gradient(90deg, transparent, #000 var(--fade));
}
.hscroll.fade-l.fade-r {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fade),
    #000 calc(100% - var(--fade)), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 var(--fade),
    #000 calc(100% - var(--fade)), transparent);
}

/* ---- Market tabs ------------------------------------------------------- */
.market-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.market-tabs::-webkit-scrollbar { display: none; }
.market-tab {
  position: relative;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding: 12px 18px 14px;
  white-space: nowrap;
  transition: color var(--d-base) var(--ease);
}
.market-tab::after {
  content: "";
  position: absolute;
  left: 16px; right: 16px; bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--d-slow) var(--ease);
}
.market-tab:hover { color: var(--fg-1); }
.market-tab.active { color: var(--fg); }
.market-tab.active::after { transform: scaleX(1); }
.market-tab .soon {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--amber-700);
  border: 1px solid var(--amber-900);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 8px;
  vertical-align: 1px;
}
:root[data-theme="light"] .market-tab .soon { color: var(--amber-700); border-color: var(--amber-300); }
.market-tab[disabled] { cursor: default; opacity: 0.55; }
.market-tab[disabled]:hover { color: var(--fg-3); }

/* ---- View toggle (almanac / screener) ---------------------------------- */
.view-toggle {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 14px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-raised);
}
.view-toggle[hidden] { display: none; }
.view-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding: 6px 16px;
  border-radius: 999px;
  transition: color var(--d-base) var(--ease), background var(--d-base) var(--ease);
}
.view-btn:hover { color: var(--fg-1); }
.view-btn.active { color: var(--bg); background: var(--accent-bright); }

/* ---- Screener ---------------------------------------------------------- */
#screenerCard { display: none; }
body.screener-mode #screenerCard { display: block; }
body.screener-mode #main > *:not(#screenerCard) { display: none; }
body.screener-mode #groupBar,
body.screener-mode #assetBar { display: none; }
.screener-scroll { overflow-x: auto; }
.screener-table { width: 100%; border-collapse: collapse; min-width: 640px; font-variant-numeric: tabular-nums; }
.screener-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-4);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-strong);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.screener-table th.num { text-align: right; }
.screener-table th:hover { color: var(--fg-2); }
.screener-table th.sorted { color: var(--accent-bright); }
.screener-table td {
  font-size: 13px;
  color: var(--fg-2);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.screener-table td.num { text-align: right; font-family: var(--font-mono); }
.screener-table tbody tr { cursor: pointer; transition: background var(--d-base) var(--ease); }
.screener-table tbody tr:hover { background: var(--bg-raised); }
.screener-table tbody tr.cur { background: rgba(229, 193, 115, 0.06); }
.screener-table .scr-tick { font-weight: 600; color: var(--fg-1); letter-spacing: 0.03em; }
.screener-table .scr-sector { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); }
.screener-table .pos { color: var(--green); }
.screener-table .neg { color: var(--red); }

.scr-filter {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-1);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  min-width: 210px;
  outline: none;
  transition: border-color var(--d-base) var(--ease);
}
.scr-filter::placeholder { color: var(--fg-4); }
.scr-filter:focus { border-color: var(--accent); }

/* a sample too thin to be a distribution says so, and never silently */
.thin {
  color: var(--accent-bright);
  border-bottom: 1px dotted var(--amber-700);
  cursor: help;
}

.scr-empty-row td { border-bottom: none; }
.scr-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 40px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-4);
  text-align: center;
}
.scr-clear {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-bright);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
}
.scr-clear:hover { border-color: var(--accent); }

/* ---- Sector groups ----------------------------------------------------- */
.group-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.group-bar::-webkit-scrollbar { display: none; }
.group-bar[hidden] { display: none; }
.group-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: color var(--d-base) var(--ease), border-color var(--d-base) var(--ease);
}
.group-pill:hover { color: var(--fg-1); border-color: var(--border); }
.group-pill.active { color: var(--accent-bright); border-color: var(--accent); }
.group-pill .n { color: var(--fg-4); margin-left: 6px; font-size: 10px; }
.group-pill.active .n { color: var(--amber-700); }

/* ---- Asset pills ------------------------------------------------------- */
.asset-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  background: linear-gradient(var(--bg) 82%, transparent);
}
.asset-bar::-webkit-scrollbar { display: none; }
.asset-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--fg-3);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  white-space: nowrap;
  transition: all var(--d-base) var(--ease);
}
.asset-pill:hover { color: var(--fg-1); border-color: var(--border-strong); transform: translateY(-1px); }
.asset-pill.active {
  color: var(--n-950);
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  font-weight: 600;
}
.asset-pill .yng {
  font-size: 8.5px;
  color: var(--accent-bright);
  margin-left: 3px;
  vertical-align: super;
}
.asset-pill.active .yng { color: var(--amber-900); }
:root[data-theme="light"] .asset-pill.active { color: var(--n-0); background: var(--accent); border-color: var(--accent); }

/* ---- Cards ------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
  overflow: hidden;
  transition: background var(--d-slow) var(--ease), border-color var(--d-slow) var(--ease);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 22px 0;
}
.card-head h2 {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.card-head .sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-4);
  margin-top: 3px;
}
.card-body { padding: 18px 22px 22px; }
.card-tools { display: flex; gap: 8px; flex-wrap: wrap; }

/* reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.55s var(--ease), transform 0.55s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---- Buttons / toggles -------------------------------------------------- */
.tool-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--fg-3);
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-raised);
  transition: all var(--d-base) var(--ease);
}
.tool-btn:hover { color: var(--fg-1); border-color: var(--border-strong); }
.tool-btn.active { color: var(--n-950); background: var(--accent-bright); border-color: var(--accent-bright); }
:root[data-theme="light"] .tool-btn.active { color: var(--n-0); background: var(--accent); border-color: var(--accent); }

.year-select {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-1);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
}
.year-select:focus { border-color: var(--accent); }

/* ---- Hero: this month in history ---------------------------------------- */
.hero-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
}
.hero-month {
  padding: 26px 26px 26px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-bright);
}
.hero-month-name {
  font-family: var(--font-sans);
  font-size: 44px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.05;
}
.hero-month-sub { font-size: 13px; color: var(--fg-3); margin-bottom: 14px; }
.hero-keyline { display: flex; flex-direction: column; gap: 9px; margin-top: auto; }
.hero-kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hero-kv .k { font-size: 12.5px; color: var(--fg-3); }
.hero-kv .v { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--fg-1); }
.hero-kv .v.pos { color: var(--green); }
.hero-kv .v.neg { color: var(--red); }

/* live month-to-date row — visually apart from the historical stats */
.hero-live {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 10px;
  margin-bottom: 4px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.hero-live .k {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-bright);
}
.hero-live .v { font-family: var(--font-mono); font-size: 15px; font-weight: 600; font-style: italic; }
.hero-live .v.pos { color: var(--green); }
.hero-live .v.neg { color: var(--red); }

.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-bright);
  animation: nowPulse 2.2s var(--ease) infinite;
  vertical-align: baseline;
}
.updated-chip .live-dot { width: 5px; height: 5px; margin: 0 1px; }
.month-table .rowlab .live-dot { margin-right: 5px; }

.hero-next {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--fg-4);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 2px;
}
.hero-next b { color: var(--fg-2); font-weight: 500; }
.hero-next .pos { color: var(--green); }
.hero-next .neg { color: var(--red); }

.hero-right { display: flex; flex-direction: column; min-width: 0; }
.hero-table-wrap { padding: 20px 22px; overflow-x: auto; }

/* ---- Distribution strip -------------------------------------------------- */
/* Every closed instance of this calendar month as one dot on a shared axis. The
   median is a tick, the month in progress is a separate amber marker — it is the
   only element of the strip that is not a finished month, and it never moves the
   dots or the median. */
.dist {
  padding: 4px 22px 20px;
  margin-top: auto;
  border-top: 1px dashed var(--border);
  padding-top: 16px;
}
.dist[hidden] { display: none; }
.dist-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-4);
  margin-bottom: 14px;
}
.dist-n { color: var(--fg-3); letter-spacing: 0.06em; }
.dist-n.thin { border-bottom: 1px dotted var(--amber-700); }

.dist-track {
  position: relative;
  height: 22px;
  margin: 14px 7px 6px;
  border-radius: 999px;
  background: var(--bg-inset);
}
.dist-track::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 50%;
  height: 1px;
  background: var(--border-strong);
}
/* zero only exists where the spread actually crosses it */
.dist-zero {
  position: absolute;
  top: -2px; bottom: -2px;
  width: 1px;
  margin-left: -0.5px;
  background: var(--border-strong);
  cursor: help;
}
.dist-zero::after {
  content: "0";
  position: absolute;
  top: -13px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--fg-4);
}

.dist-dot {
  position: absolute;
  top: 50%;
  width: 9px; height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--fg-4);
  box-shadow: 0 0 0 1.5px var(--bg-card);
  cursor: help;
  animation: distIn 0.4s var(--ease) backwards;
  transition: transform var(--d-fast) var(--ease);
}
.dist-dot:hover { transform: scale(1.5); z-index: 3; }
.dist-dot.pos { background: var(--green); }
.dist-dot.neg { background: var(--red); }
@keyframes distIn { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }

.dist-med {
  position: absolute;
  top: 1px; bottom: 1px;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--fg-2);
  cursor: help;
  z-index: 2;
}
.dist-now {
  position: absolute;
  top: -3px; bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: var(--accent-bright);
  cursor: help;
  z-index: 4;
}
.dist-now::after {
  content: "";
  position: absolute;
  top: -5px; left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--accent-bright);
}

.dist-axis {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-4);
}
.dist-read { flex: 1; text-align: center; color: var(--fg-3); line-height: 1.5; }
.dist-read b { font-weight: 600; color: var(--fg-1); }
.dist-read b.pos { color: var(--green); }
.dist-read b.neg { color: var(--red); }
.dist-read .mut { color: var(--fg-4); }

.dist-key {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-4);
}
.dist-key .k { display: inline-flex; align-items: center; gap: 5px; }
.dist-key i.static { position: static; display: inline-block; animation: none; }
.dist-key i.dist-dot { width: 8px; height: 8px; margin: 0; box-shadow: none; }
.dist-key i.dist-med { width: 2px; height: 10px; margin: 0; top: auto; bottom: auto; }
.dist-key i.dist-now { width: 2px; height: 10px; margin: 0; top: auto; bottom: auto; }
.dist-key i.dist-now::after { display: none; }
.month-table { width: 100%; border-collapse: collapse; }
.month-table th, .month-table td {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-align: right;
  padding: 8px 10px;
  white-space: nowrap;
}
.month-table th {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-4);
  border-bottom: 1px solid var(--border);
}
.month-table td { color: var(--fg-2); border-bottom: 1px solid var(--border); }
.month-table tr:last-child td { border-bottom: none; }
.month-table .rowlab { text-align: left; color: var(--fg-3); font-size: 11.5px; }
.month-table td.pos { color: var(--green); font-weight: 500; }
.month-table td.neg { color: var(--red); font-weight: 500; }
.month-table th.cur-asset, .month-table td.cur-asset { background: var(--bg-raised); }
.month-table th.cur-asset { color: var(--accent-bright); }

/* ---- Stats grid --------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.stat {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px 13px;
  text-align: center;
  transition: transform var(--d-base) var(--ease), border-color var(--d-base) var(--ease);
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.15;
}
.stat-value.pos { color: var(--green); }
.stat-value.neg { color: var(--red); }
.stat-value.amber { color: var(--accent-bright); }
.stat-label { font-size: 12px; color: var(--fg-3); margin-top: 4px; }
.stat-sub { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-4); margin-top: 1px; }

/* ---- Heatmap ------------------------------------------------------------ */
.heatmap-scroll { overflow-x: auto; padding-bottom: 6px; }
.heatmap {
  display: grid;
  grid-template-columns: 86px 52px repeat(12, minmax(56px, 1fr)) 60px;
  gap: 3px;
  min-width: 900px;
}
.heatmap.no-cycles { grid-template-columns: 52px repeat(12, minmax(56px, 1fr)) 60px; min-width: 820px; }
.hm-head {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-4);
  text-align: center;
  padding: 6px 2px;
}
.hm-head.hl { color: var(--accent-bright); }
.hm-cycle, .hm-year, .hm-gr {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  border-radius: 6px;
  padding: 0 4px;
  min-height: 34px;
}
.hm-cycle {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color var(--d-fast) var(--ease), filter var(--d-fast) var(--ease);
}
.hm-cycle:hover { border-color: var(--border-strong); }
.hm-cycle.cy-top      { color: var(--cy-top);      background: color-mix(in srgb, var(--cy-top) 12%, transparent); }
.hm-cycle.cy-bottom   { color: var(--cy-bottom);   background: color-mix(in srgb, var(--cy-bottom) 12%, transparent); }
.hm-cycle.cy-recovery { color: var(--cy-recovery); background: color-mix(in srgb, var(--cy-recovery) 12%, transparent); }
.hm-cycle.cy-rally    { color: var(--cy-rally);    background: color-mix(in srgb, var(--cy-rally) 12%, transparent); }
.hm-year {
  font-weight: 500;
  color: var(--fg-2);
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}
.hm-year:hover { color: var(--fg); border-color: var(--border-strong); }
.hm-year.halving { color: var(--accent-bright); }
.hm-year.hl { color: var(--accent-bright); }
.hm-gr { font-size: 10.5px; color: var(--fg-4); letter-spacing: 0.02em; }
.hm-gr .g { color: var(--green); font-weight: 500; }
.hm-gr .r { color: var(--red); font-weight: 500; }

.hm-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border-radius: 6px;
  min-height: 34px;
  cursor: default;
  animation: cellIn 0.45s var(--ease) backwards;
  transition: transform var(--d-fast) var(--ease), box-shadow var(--d-fast) var(--ease), opacity var(--d-base) var(--ease), filter var(--d-base) var(--ease);
}
@keyframes cellIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
.hm-cell:hover {
  transform: scale(1.12);
  z-index: 5;
  box-shadow: 0 4px 16px rgba(0,0,0,0.45), 0 0 0 1.5px var(--fg-4);
}
.hm-cell.null { background: var(--bg-inset); color: var(--fg-4); }
.hm-cell.halving-month {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.hm-cell.halving-month::after {
  content: "";
  position: absolute;
  top: 3px; right: 3px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent-bright);
}
.hm-cell.now {
  box-shadow: inset 0 0 0 1.5px var(--accent);
  overflow: visible;
}
.hm-cell.now::before {
  content: "";
  position: absolute;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-bright);
  animation: nowPulse 2.2s var(--ease) infinite;
}
/* month-in-progress: value shown, dot moves to the corner, italic value */
.hm-cell.mtd { font-style: italic; }
.hm-cell.now.mtd::before {
  width: 5px; height: 5px;
  top: -2px; right: -2px;
  left: auto;
}
@keyframes nowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 193, 115, 0.5); }
  50% { box-shadow: 0 0 0 7px rgba(229, 193, 115, 0); }
}
.row-dim { opacity: 0.22; filter: saturate(0.4); }
.row-lit { opacity: 1; }
.summary-row { border-top: 2px solid transparent; }
.hm-divider { grid-column: 1 / -1; height: 6px; }

/* heatmap legend */
.hm-legend {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.hm-scale { display: flex; align-items: center; gap: 8px; }
.hm-scale .bar {
  width: 160px; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg,
    rgba(196,87,78,0.95), rgba(196,87,78,0.25),
    var(--bg-inset),
    rgba(76,154,88,0.25), rgba(76,154,88,0.95));
}
.hm-scale span, .hm-key span {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-4);
  letter-spacing: 0.04em;
}
.hm-key { display: flex; align-items: center; gap: 7px; }
.hm-key .dot {
  width: 10px; height: 10px; border-radius: 3px;
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

/* ---- Quarterly table ---------------------------------------------------- */
.q-scroll { overflow-x: auto; max-height: 420px; overflow-y: auto; }
.q-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.q-table th {
  position: sticky; top: 0;
  background: var(--bg-card);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-4);
  text-align: right;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-strong);
  z-index: 2;
}
.q-table th small { display: block; font-size: 9px; color: var(--fg-4); text-transform: none; letter-spacing: 0.04em; }
.q-table td {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-align: right;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-2);
  white-space: nowrap;
}
.q-table th:first-child, .q-table td:first-child { text-align: left; }
.q-table .pos { color: var(--green); }
.q-table .neg { color: var(--red); }
.q-table .mut { color: var(--fg-4); }
.q-table .q-year { color: var(--fg-1); font-weight: 500; }
.q-table tr:hover td { background: var(--bg-raised); }
.q-table tr.agg td {
  border-top: 1px solid var(--border-strong);
  border-bottom: none;
  background: var(--bg-raised);
  font-weight: 600;
}
/* current quarter (column) + current year (row) — the "you are here" of the table */
.q-table th.cur-q { color: var(--accent-bright); }
.q-table td.cur-q { background: rgba(229, 193, 115, 0.06); }
.q-table tr.cur-year > td { background: rgba(229, 193, 115, 0.05); }
.q-table tr.cur-year .q-year { color: var(--accent-bright); font-weight: 600; }
.q-table tr.cur-year td.cur-q { background: rgba(229, 193, 115, 0.12); }

/* ---- Charts row --------------------------------------------------------- */
.charts-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
}
.charts-row .card { margin-bottom: 0; }
.chart-box { position: relative; height: 300px; }

/* ---- Comparison --------------------------------------------------------- */
.cmp-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmp-tools .vs { font-family: var(--font-mono); font-size: 11px; color: var(--fg-4); }
.cycle-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.cycle-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--fg-3);
  background: var(--bg-raised);
  transition: all var(--d-base) var(--ease);
}
.cycle-btn:hover { border-color: var(--cyc, var(--border-strong)); color: var(--fg-1); }
.cycle-btn.active {
  color: var(--bg);
  background: var(--cyc, var(--accent));
  border-color: var(--cyc, var(--accent));
}

/* ---- Cycle strip (position in 4-year cycle) ------------------------------ */
.cycle-strip { display: flex; flex-direction: column; gap: 14px; }
.cycle-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.cycle-seg {
  position: relative;
  border-radius: 10px;
  padding: 14px 16px 12px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  overflow: hidden;
  transition: border-color var(--d-base) var(--ease);
}
.cycle-seg::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--cyc);
}
.cycle-seg h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyc);
  margin-bottom: 4px;
}
.cycle-seg p { font-size: 12.5px; color: var(--fg-3); line-height: 1.45; }
.cycle-seg .years {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--fg-4);
  margin-top: 8px;
}
.cycle-seg .seg-stat {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
}
.cycle-seg .seg-stat b { font-weight: 600; color: var(--fg-1); }
.cycle-seg .seg-stat b.pos { color: var(--green); }
.cycle-seg .seg-stat b.neg { color: var(--red); }
.cycle-seg .seg-stat .n { color: var(--fg-4); font-size: 10px; }
.cycle-credit .credit-lead { color: var(--fg-3); }
.cycle-seg.current { border-color: var(--cyc); box-shadow: 0 0 0 1px var(--cyc), 0 8px 24px -12px var(--cyc); }
.cycle-seg .you-are-here {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-top: 8px;
}
.cycle-seg .you-are-here::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-bright);
  animation: nowPulse 2.2s var(--ease) infinite;
}
.cycle-credit { font-size: 11.5px; color: var(--fg-4); }

/* ---- Halving timeline ---------------------------------------------------- */
.timeline-scroll { overflow-x: auto; padding: 4px 0 10px; }
.timeline {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 14px;
  min-width: 860px;
  padding-top: 26px;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 10px; left: 8%; right: 8%;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--amber-700) 12%, var(--amber-700) 88%, transparent);
}
.tl-item { position: relative; text-align: center; }
.tl-item::before {
  content: "";
  position: absolute;
  top: -22px; left: 50%;
  transform: translateX(-50%);
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
.tl-item.projected::before { background: var(--bg-card); border: 2px solid var(--accent); }
.tl-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px 12px;
  transition: transform var(--d-base) var(--ease), border-color var(--d-base) var(--ease);
}
.tl-item:hover .tl-card { transform: translateY(-3px); border-color: var(--amber-900); }
.tl-label { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-bright); }
.tl-date { font-size: 14px; font-weight: 600; color: var(--fg); margin-top: 3px; }
.tl-block { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-4); margin-top: 2px; }
.tl-reward { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-2); margin-top: 8px; }
.tl-reward .old { color: var(--fg-4); text-decoration: line-through; }
.tl-reward .arrow { color: var(--accent); margin: 0 4px; }
.tl-top { font-size: 11px; color: var(--fg-3); margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--border); }
.tl-top b { color: var(--fg-1); font-weight: 600; }
.tl-proj {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber-300);
  border: 1px solid var(--amber-900);
  border-radius: 999px;
  padding: 2px 8px;
  margin-top: 8px;
}

/* ---- Tooltip ------------------------------------------------------------ */
.tooltip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 13px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(4px) scale(0.97);
  transition: opacity var(--d-fast) var(--ease), transform var(--d-fast) var(--ease);
}
.tooltip.on { opacity: 1; transform: none; }
.tooltip .tt-title { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-3); }
.tooltip .tt-value { font-family: var(--font-mono); font-size: 16px; font-weight: 600; margin-top: 2px; }
.tooltip .tt-value.pos { color: var(--green); }
.tooltip .tt-value.neg { color: var(--red); }
.tooltip .tt-extra { font-size: 11px; color: var(--fg-4); margin-top: 3px; }

/* ---- Transient notice ---------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 14px);
  z-index: 120;
  max-width: min(560px, calc(100vw - 32px));
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--fg-1);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 14px 36px rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity var(--d-base) var(--ease), transform var(--d-base) var(--ease);
}
.toast[hidden] { display: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---- Footer -------------------------------------------------------------- */
.footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer .method { font-size: 12px; color: var(--fg-4); max-width: 760px; line-height: 1.6; }
.footer .row { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.footer .brand {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--fg-2);
}
.footer .brand a { color: var(--fg-2); }
.footer .brand a:hover { color: var(--accent-bright); text-decoration: none; }
.footer .brand .dot { color: var(--accent); }
.footer .fine { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--fg-4); }

/* ---- Loading ------------------------------------------------------------- */
.loading {
  display: grid;
  place-items: center;
  min-height: 180px;
}
.spinner {
  width: 26px; height: 26px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* swipe hint — only where horizontal scroll exists on small screens */
.swipe-hint {
  display: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-4);
  padding-top: 6px;
}

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 980px) {
  .charts-row { grid-template-columns: 1fr; gap: 20px; }
  .charts-row .card { margin-bottom: 0; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-month { border-right: none; border-bottom: 1px solid var(--border); }
}
@media (max-width: 760px) {
  /* the read wraps under the axis ends rather than squeezing them off-screen */
  .dist-axis { flex-wrap: wrap; justify-content: space-between; }
  .dist-read { order: 3; flex-basis: 100%; text-align: left; margin-top: 6px; }
}
@media (max-width: 620px) {
  .wrap { padding: 0 14px 48px; }
  .header { padding: 26px 0 16px; flex-wrap: wrap; }
  .wordmark { font-size: 32px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-month-name { font-size: 36px; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .cycle-track { grid-template-columns: 1fr 1fr; }
  .chart-box { height: 260px; }
  .swipe-hint { display: block; }
  .month-table th, .month-table td { font-size: 11px; padding: 7px 7px; }
  .deck { font-size: 12.5px; margin-bottom: 14px; }
  .dist { padding-left: 16px; padding-right: 16px; }
  .scr-filter { min-width: 0; width: 100%; }
  .card-head .card-tools { flex: 1; }
}

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