@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;600&family=IBM+Plex+Sans:wght@400;500;600;700&family=Newsreader:opsz,wght@6..72,500;6..72,600&display=swap');

/* The Gist SA Daily Brief — visual system.
   IBM Plex Sans for data and body, IBM Plex Mono for labels, Newsreader for the wordmark.
   Light palette on :root; dark overrides via media query and [data-theme]. */

:root {
  --bg: #eef1f6;
  --bg-2: #e6ebf3;
  --card: #ffffff;
  --ink: #14213d;
  --body: #33405c;
  --muted: #6a778f;
  --faint: #98a2b5;
  --line: #e4e8f0;
  --line-2: #d5dce8;
  --accent: #1f3a5f;
  --accent-2: #2f66e0;
  --link: #2f66e0;

  --callout: #ffffff;
  --callout-line: #e4e8f0;
  --callout-kick: #2f66e0;
  --radar: #e9ebef;
  --radar-line: #dadfe6;
  --radar-kick: #157f6e;
  --sa: #ffffff;
  --sa-line: #e4e8f0;
  --sa-kick: #9a6b1e;

  --up: #12844a;
  --up-soft: #e6f4ec;
  --down: #cf3b3b;
  --down-soft: #fbebeb;
  --flat: #8a94a6;

  --chip: #eef2f9;
  --chip-line: #dde5f1;

  --shadow: 0 1px 2px rgba(20, 27, 45, .05), 0 10px 26px rgba(20, 27, 45, .055);
  --radius: 14px;
  --maxw: 1160px;

  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --bg-2: #0f1626;
    --card: #141d30;
    --ink: #eaf0fb;
    --body: #c4cee0;
    --muted: #93a1b9;
    --faint: #6c7990;
    --line: #212c42;
    --line-2: #2c3952;
    --accent: #a9c4ff;
    --accent-2: #6f9cff;
    --link: #7aa4ff;

    --callout: #141d30;
    --callout-line: #212c42;
    --callout-kick: #82a8ff;
    --radar: #1b2437;
    --radar-line: #2b3650;
    --radar-kick: #47c2a8;
    --sa: #141d30;
    --sa-line: #212c42;
    --sa-kick: #d6a24a;

    --up: #32c47c;
    --up-soft: #10291c;
    --down: #f0645f;
    --down-soft: #2f1617;
    --flat: #7d8aa1;

    --chip: #1b2540;
    --chip-line: #2a3754;

    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  --bg: #0b1120;
  --bg-2: #0f1626;
  --card: #141d30;
  --ink: #eaf0fb;
  --body: #c4cee0;
  --muted: #93a1b9;
  --faint: #6c7990;
  --line: #212c42;
  --line-2: #2c3952;
  --accent: #a9c4ff;
  --accent-2: #6f9cff;
  --link: #7aa4ff;

  --callout: #121f38;
  --callout-line: #26385c;
  --callout-kick: #82a8ff;
  --radar: #0f2320;
  --radar-line: #1f463c;
  --radar-kick: #47c2a8;
  --sa: #241d10;
  --sa-line: #43371f;
  --sa-kick: #d6a24a;

  --up: #32c47c;
  --up-soft: #10291c;
  --down: #f0645f;
  --down-soft: #2f1617;
  --flat: #7d8aa1;

  --chip: #1b2540;
  --chip-line: #2a3754;

  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 26px; }

/* ---------- Placeholder ribbon ---------- */
.ribbon {
  background: repeating-linear-gradient(45deg, #f2b705, #f2b705 12px, #e0a800 12px, #e0a800 24px);
  color: #241c00; text-align: center; font-size: .8rem; font-weight: 700;
  padding: 7px 12px; font-family: var(--mono);
}

/* ---------- Archive ribbon ---------- */
.ribbon--archive {
  background: var(--callout); color: var(--accent); border-bottom: 1px solid var(--callout-line);
  text-align: center; font-size: .8rem; font-weight: 600; padding: 8px 12px; font-family: var(--sans);
}
.ribbon--archive a { color: var(--link); font-weight: 700; text-decoration: none; margin-left: 6px; }
.ribbon--archive a:hover { text-decoration: underline; }

/* ---------- Date navigation ---------- */
.date-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.date-nav-btn {
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  width: 26px; height: 26px; border-radius: 7px; cursor: pointer;
  font-size: .95rem; line-height: 1; display: grid; place-items: center;
  transition: background .15s ease, border-color .15s ease;
}
.date-nav-btn:hover:not(:disabled) { background: var(--bg-2); border-color: var(--accent-2); }
.date-nav-btn:disabled { opacity: .35; cursor: default; }
.date-input {
  font-family: var(--mono); font-size: .76rem; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-2); border-radius: 7px;
  padding: 3px 7px; height: 26px;
}
.date-latest-link {
  font-family: var(--mono); font-size: .64rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent-2); text-decoration: none; border: 1px solid var(--chip-line); background: var(--chip);
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}
.date-latest-link:hover { border-color: var(--accent-2); }

/* ---------- Masthead ---------- */
.masthead { padding-top: 30px; }
.mast-grid {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  padding-bottom: 16px;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  line-height: 1.02;
  letter-spacing: -.015em;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}
.tagline {
  margin: 6px 0 0;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .02em;
  color: var(--muted);
}
.mast-meta { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; position: relative; }
.meta-date { font-weight: 600; font-size: .95rem; color: var(--ink); }
.meta-gen { font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.theme-toggle {
  margin-top: 8px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  width: 36px; height: 36px; border-radius: 9px; cursor: pointer;
  font-size: 1rem; display: grid; place-items: center; transition: background .15s ease, border-color .15s ease;
}
.theme-toggle:hover { background: var(--bg-2); border-color: var(--accent-2); }
.mast-rule { height: 3px; background: var(--ink); border-radius: 2px; }

/* ---------- Subnav ---------- */
.subnav { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.subnav-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 46px; flex-wrap: wrap; }
.subnav-links { display: flex; gap: 24px; }
.subnav-links a {
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: .86rem;
  padding: 12px 0; border-bottom: 2px solid transparent;
}
.subnav-links a:hover { border-bottom-color: var(--accent-2); color: var(--accent-2); }

/* ---------- Chips ---------- */
.chip {
  font-family: var(--mono); font-size: .64rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent); background: var(--chip); border: 1px solid var(--chip-line);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.chip--quiet { color: var(--muted); text-transform: none; letter-spacing: .01em; font-family: var(--sans); font-size: .72rem; }

/* ---------- Callouts ---------- */
.callouts { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; margin: 26px 0 6px; }
.callout {
  border-radius: var(--radius); padding: 18px 20px;
  background: var(--callout); border: 1px solid var(--callout-line);
}
.callout--radar { background: var(--radar); border-color: var(--radar-line); }
.callout--sa { background: var(--sa); border-color: var(--sa-line); margin-top: 18px; }
.kicker {
  display: inline-block; font-family: var(--mono); font-size: .68rem; text-transform: uppercase;
  letter-spacing: .1em; font-weight: 600; color: var(--callout-kick); margin-bottom: 7px;
}
.callout--radar .kicker { color: var(--radar-kick); }
.callout--sa .kicker { color: var(--sa-kick); }
.callout-body { margin: 0; font-size: 1.02rem; line-height: 1.6; color: var(--ink); }
.tk-num { font-weight: 700; }
.tk-num.up, .tk-num.down { white-space: nowrap; }
.callout--sa .callout-body { color: var(--body); font-size: .96rem; }

/* ---------- Section headers ---------- */
section { margin: 36px 0; }
.super-head { display: flex; align-items: baseline; gap: 14px; border-bottom: 2px solid var(--ink); padding-bottom: 9px; margin-bottom: 4px; flex-wrap: wrap; }
.super-head h2 {
  font-family: var(--sans); font-weight: 700; font-size: 1.05rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--accent); margin: 0;
}
.super-note { font-family: var(--mono); font-size: .74rem; color: var(--muted); }

.block-head {
  display: flex; align-items: baseline; gap: 12px; margin: 26px 0 12px;
  border-bottom: 1px solid var(--line-2); padding-bottom: 7px;
}
.block-head h3 {
  font-family: var(--sans); font-weight: 700; font-size: .82rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--accent); margin: 0; white-space: nowrap;
}
.block-head .note { font-family: var(--mono); font-size: .72rem; color: var(--muted); }

.caption { color: var(--muted); font-size: .86rem; margin: 0 0 16px; max-width: 74ch; line-height: 1.55; }
.caption strong { color: var(--body); font-weight: 600; }

/* ---------- Tiles ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 15px; }
.grid--currencies { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) {
  .grid--currencies { grid-template-columns: 1fr; }
}
.tile, .panel, .stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tile { padding: 17px 19px 16px; display: flex; flex-direction: column; }
.tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.tile-label {
  font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600; line-height: 1.3;
}
.tile-unit { display: block; font-size: .62rem; color: var(--faint); letter-spacing: .04em; margin-top: 2px; }
.value { font-size: 1.85rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; color: var(--ink); }
.value-sub { font-size: .92rem; color: var(--muted); font-weight: 600; margin-top: 2px; }

.chg-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 9px; }
.chg-today { font-weight: 700; font-size: .92rem; }
.chg-today .lbl { color: var(--muted); font-weight: 500; }
.chg-30 { font-size: .8rem; color: var(--muted); font-weight: 500; white-space: nowrap; }
.chg-30 b { font-weight: 700; }

.divider { border-top: 1px dashed var(--line-2); margin: 11px 0 8px; }
.ctx { font-size: .8rem; color: var(--muted); }
.ctx .lbl { color: var(--faint); }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }

.spark { width: 88px; height: 26px; display: block; }
.spark polyline { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.s-up { stroke: var(--up); } .s-down { stroke: var(--down); } .s-flat { stroke: var(--flat); }
.tag-indicative {
  font-family: var(--mono); font-size: .58rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--faint); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px;
}
.pill-note { font-size: .72rem; color: var(--faint); margin-top: 4px; }

/* ---------- Panels ---------- */
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.panel { padding: 18px 20px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h4 { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.panel-big { display: flex; align-items: baseline; gap: 9px; margin-bottom: 12px; }
.panel-big .pv { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1; }
.panel-big .pu { font-size: .82rem; color: var(--muted); font-weight: 600; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.row .k { color: var(--muted); font-size: .84rem; }
.row .v { font-weight: 700; font-size: .92rem; text-align: right; color: var(--ink); }
.row .v small { font-weight: 500; color: var(--muted); font-size: .76rem; margin-left: 4px; }
.consensus { margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--line-2); font-size: .82rem; color: var(--muted); line-height: 1.5; }
.consensus b { color: var(--body); font-weight: 600; }

.sa-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 15px; }
.stat { padding: 17px 19px; display: flex; flex-direction: column; }
.stat .value { font-size: 1.55rem; }
.stat .note { font-size: .76rem; color: var(--faint); margin-top: 8px; line-height: 1.45; }

/* ---------- Radar ---------- */
.radar-list { display: flex; flex-direction: column; gap: 15px; }
.radar-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 19px 22px; }
.radar-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; flex-wrap: wrap; }
.lane-tag {
  font-family: var(--mono); font-size: .64rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent-2); background: var(--chip); border: 1px solid var(--chip-line); padding: 3px 9px; border-radius: 999px;
}
.date-badge { font-family: var(--mono); font-size: .74rem; color: var(--muted); font-weight: 600; }
.radar-item h4 { margin: 0 0 7px; font-size: 1.16rem; line-height: 1.3; color: var(--ink); font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
.radar-item p { margin: 0 0 11px; color: var(--body); font-size: .95rem; line-height: 1.62; }
.radar-sources { display: flex; gap: 8px; flex-wrap: wrap; }
.radar-sources a {
  font-family: var(--mono); font-size: .74rem; font-weight: 500; color: var(--link); text-decoration: none;
  border: 1px solid var(--line-2); border-radius: 7px; padding: 3px 10px;
}
.radar-sources a:hover { border-color: var(--accent-2); background: var(--chip); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--card); margin-top: 44px; padding: 24px 0 46px; }
.foot-label { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); margin-right: 6px; }
.foot-sources, .foot-note { font-size: .82rem; color: var(--muted); margin: 0 0 8px; }
.foot-disclaimer { font-size: .78rem; color: var(--faint); margin: 6px 0 0; max-width: 82ch; line-height: 1.5; }

.load-error { max-width: var(--maxw); margin: 20px auto; padding: 14px 18px; background: var(--down-soft); border: 1px solid var(--down); color: var(--down); border-radius: var(--radius); font-weight: 600; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .tile, .panel, .stat, .radar-item, .callout { animation: rise .38s ease both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .callouts { grid-template-columns: 1fr; }
  .panels { grid-template-columns: 1fr; }
  .sa-mini { grid-template-columns: 1fr; }
  .mast-grid { align-items: flex-start; }
  .wordmark { font-size: 1.9rem; }
}
