/* ============================================================================
   MicroFutures — shared design system (hybrid-mezcal-bright)
   Single source of truth for site chrome + components. Injected via
   <link rel="stylesheet" href="/assets/site.css"> by partials/head.html.
   Served same-origin → style-src 'self' (no CSP hashes needed).
   ========================================================================== */

/* ── Tokens ────────────────────────────────────────────────────────────── */
:root {
  /* hybrid-mezcal-bright palette (see ~/projects/design/tokens/themes.json) */
  --background: #FAF7F2;
  --foreground: #1F2933;
  --accent: #3575A2;
  --accent-deep: #2A5E84;
  --accent-soft: #EBF4FB;
  --accent2: #EB8F2C;
  --accent2-soft: #FCF0E1;
  --muted: #F1EEE8;
  --muted-text: #66707A;
  --border: rgba(31, 41, 51, 0.12);
  --border-soft: rgba(31, 41, 51, 0.07);
  --success: #276124;
  --success-soft: #E8F2E7;
  --danger: #B0302F;
  --danger-soft: #F9EAEA;
  --brand-pop: #B0367F;
  --white: #FFFFFF;
  --card: #FFFFFF;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --radius-sm: 0.4rem;
  --radius: 0.75rem;
  --radius-lg: 1.1rem;
  --shadow-sm: 0 1px 2px rgba(31, 41, 51, 0.05);
  --shadow: 0 4px 16px rgba(31, 41, 51, 0.07);
  --shadow-lift: 0 10px 28px rgba(31, 41, 51, 0.11);

  --measure: 70ch;        /* long-form article width */
  --measure-wide: 1080px; /* hub / landing width */
}

/* ── Base ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.65;
  font-size: 1rem;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-pop); }

img, svg { max-width: 100%; height: auto; }

code, .mono { font-family: var(--font-mono); font-size: 0.92em; }

.skip-link { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.skip-link:focus {
  position: fixed; left: 1rem; top: 1rem; width: auto; height: auto; z-index: 100;
  background: var(--foreground); color: var(--white); padding: 0.5rem 1rem; border-radius: var(--radius-sm);
}

::selection { background: var(--accent2); color: var(--foreground); }

/* ── Site header ───────────────────────────────────────────────────────── */
header.site {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 247, 242, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: var(--measure-wide); margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap;
}

a.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--foreground); text-decoration: none;
  font-weight: 800; font-size: 1.12rem; letter-spacing: -0.02em;
}
a.brand:hover { color: var(--accent); }
a.brand .logomark { width: 26px; height: 26px; flex: none; }
a.brand em { font-style: normal; color: var(--accent); }

nav.site-nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
nav.site-nav a {
  color: var(--foreground); text-decoration: none;
  font-size: 0.92rem; font-weight: 600;
  padding: 0.35rem 0.7rem; border-radius: var(--radius-sm);
}
nav.site-nav a:hover { background: var(--muted); color: var(--accent); }
nav.site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-deep); }

/* ── Hero (landing pages) ──────────────────────────────────────────────── */
.hero {
  background:
    radial-gradient(1100px 420px at 85% -10%, var(--accent-soft) 0%, rgba(235, 244, 251, 0) 60%),
    radial-gradient(700px 320px at 0% 110%, var(--accent2-soft) 0%, rgba(252, 240, 225, 0) 55%),
    var(--background);
  border-bottom: 1px solid var(--border-soft);
}
.hero-inner {
  max-width: var(--measure-wide); margin: 0 auto;
  padding: 3.5rem 1.5rem 3rem;
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 2.5rem; align-items: center;
}
.hero h1 {
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.12;
  margin-bottom: 1rem;
}
.hero h1 .accent { color: var(--accent); }
.hero .lede { font-size: 1.13rem; color: var(--muted-text); max-width: 56ch; margin-bottom: 1.5rem; }
.hero .lede strong { color: var(--foreground); }
.hero-art { display: flex; justify-content: center; }
.hero-art svg { width: 100%; max-width: 430px; height: auto; }

.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-block; background: var(--accent); color: var(--white);
  padding: 0.6rem 1.25rem; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 0.97rem; text-decoration: none;
  border: 1px solid var(--accent);
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn:hover { background: var(--accent-deep); color: var(--white); transform: translateY(-1px); }
.btn.btn-secondary { background: transparent; color: var(--accent-deep); border-color: var(--accent); }
.btn.btn-secondary:hover { background: var(--accent-soft); transform: translateY(-1px); }
.btn.btn-pop { background: var(--accent2); border-color: var(--accent2); color: var(--foreground); }
.btn.btn-pop:hover { background: var(--brand-pop); border-color: var(--brand-pop); color: var(--white); }

/* ── Sections / layout ─────────────────────────────────────────────────── */
.section { max-width: var(--measure-wide); margin: 0 auto; padding: 2.75rem 1.5rem; }
.section + .section { border-top: 1px solid var(--border-soft); }

.eyebrow {
  display: inline-block; font-size: 0.78rem; font-weight: 800;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--accent2); margin-bottom: 0.5rem;
}
.section > h2, .section-head h2 {
  font-size: clamp(1.45rem, 3vw, 1.9rem); font-weight: 800; letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section-head p { color: var(--muted-text); max-width: 64ch; }
.section-head .more { font-weight: 700; font-size: 0.95rem; white-space: nowrap; text-decoration: none; }
.section-head .more:hover { text-decoration: underline; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.1rem; }
.card-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem 1.3rem;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 0.5rem;
  position: relative;
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
a.card { text-decoration: none; color: inherit; }
.card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); border-color: rgba(53, 117, 162, 0.35); }

.card .icon-chip {
  width: 42px; height: 42px; border-radius: 0.6rem;
  background: var(--accent-soft); color: var(--accent-deep);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 0.35rem;
}
.card .icon-chip.pop { background: var(--accent2-soft); color: var(--accent2); }
.card .icon-chip svg { width: 22px; height: 22px; }

.card h3 { font-size: 1.05rem; font-weight: 750; letter-spacing: -0.01em; line-height: 1.3; }
.card h3 a { color: var(--foreground); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
a.card:hover h3 { color: var(--accent); }
.card p { font-size: 0.92rem; color: var(--muted-text); line-height: 1.55; }
.card .card-kicker {
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent2);
}
.card .card-stat { font-family: var(--font-mono); font-weight: 700; font-size: 1.45rem; color: var(--accent-deep); letter-spacing: -0.02em; }
.card .card-foot { margin-top: auto; padding-top: 0.5rem; font-weight: 700; font-size: 0.88rem; color: var(--accent); }

/* ── Data strip (daily levels on home) ─────────────────────────────────── */
.strip {
  background: var(--foreground); color: var(--background);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}
.strip[hidden] { display: none; }
.strip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.strip-head h2 { font-size: 1.02rem; font-weight: 750; color: var(--white); letter-spacing: -0.01em; }
.strip-head .asof { font-size: 0.8rem; color: rgba(250, 247, 242, 0.65); font-family: var(--font-mono); }
.strip-head .asof.stale { color: var(--accent2); }
.strip-rows { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.level-chip {
  background: rgba(250, 247, 242, 0.08); border: 1px solid rgba(250, 247, 242, 0.16);
  border-radius: 0.55rem; padding: 0.45rem 0.75rem;
  display: flex; flex-direction: column; min-width: 108px;
}
.level-chip .price { font-family: var(--font-mono); font-weight: 700; font-size: 1.02rem; color: var(--white); }
.level-chip .tag { font-size: 0.72rem; letter-spacing: 0.03em; color: rgba(250, 247, 242, 0.7); }
.level-chip.res .price { color: #F0A857; }
.level-chip.sup .price { color: #7FC47C; }
.strip-foot { margin-top: 0.8rem; font-size: 0.82rem; color: rgba(250, 247, 242, 0.6); }
.strip-foot a { color: rgba(250, 247, 242, 0.85); }
.strip-foot a:hover { color: var(--accent2); }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); margin: 1rem 0 1.5rem; box-shadow: var(--shadow-sm); }
.table-wrap table { margin: 0; border: 0; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 1rem 0 1.5rem; }
th {
  background: var(--muted); color: var(--foreground);
  padding: 0.6rem 0.85rem; text-align: left; font-weight: 750;
  font-size: 0.84rem; letter-spacing: 0.02em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: rgba(241, 238, 232, 0.45); }
td .asof, .asof-note { color: var(--muted-text); font-size: 0.78rem; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Article (learn pages) ─────────────────────────────────────────────── */
article.pillar, main.article { max-width: var(--measure); margin: 0 auto; padding: 2.5rem 1.5rem 3.5rem; }

nav.breadcrumb { font-size: 0.85rem; color: var(--muted-text); margin-bottom: 1.25rem; }
nav.breadcrumb a { color: var(--muted-text); }
nav.breadcrumb a:hover { color: var(--accent); }
nav.breadcrumb span[aria-current="page"] { color: var(--foreground); font-weight: 600; }

article.pillar h1, main.article h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.5rem); font-weight: 800;
  letter-spacing: -0.025em; line-height: 1.15; margin-bottom: 1rem;
}
.byline { font-size: 0.875rem; color: var(--muted-text); margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.byline strong { color: var(--foreground); font-weight: 600; }

article.pillar h2, main.article h2 { font-size: 1.45rem; font-weight: 750; margin: 2.25rem 0 0.75rem; letter-spacing: -0.015em; }
article.pillar h3, main.article h3 { font-size: 1.1rem; font-weight: 700; margin: 1.5rem 0 0.5rem; color: var(--accent-deep); }
article.pillar p, main.article p { margin-bottom: 1rem; }
article.pillar ul, article.pillar ol, main.article ul, main.article ol { padding-left: 1.5rem; margin-bottom: 1.25rem; }
article.pillar li, main.article li { margin-bottom: 0.4rem; }

p.lede { color: var(--muted-text); margin-bottom: 2rem; font-size: 1.05rem; }

/* Learn hub pillar list */
ul.pillar-list { list-style: none; padding: 0; margin: 0 0 1rem; }
li.pillar { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.3rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }
li.pillar.pending { opacity: 0.65; background: transparent; box-shadow: none; }
li.pillar h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.3rem; }
li.pillar h3 a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }
li.pillar h3 a:hover { color: var(--brand-pop); }
li.pillar.pending h3 { color: var(--muted-text); }
li.pillar p { font-size: 0.92rem; color: var(--muted-text); margin: 0; }
li.pillar .module-tag { display: inline-block; font-size: 0.72rem; font-weight: 700; color: var(--accent2); margin-bottom: 0.4rem; letter-spacing: 0.04em; text-transform: uppercase; }

figure.diagram { margin: 1.5rem 0 2rem; text-align: center; }
figure.diagram svg { max-width: 100%; height: auto; }
figure.diagram figcaption { font-size: 0.82rem; color: var(--muted-text); margin-top: 0.5rem; }

.tldr {
  background: var(--accent-soft); border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem; margin: 1.25rem 0 2rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.tldr p { margin-bottom: 0.5rem; }
.tldr p:last-child { margin-bottom: 0; }
.tldr strong { color: var(--accent-deep); }

.callout {
  background: var(--muted); border-left: 4px solid var(--accent2);
  padding: 0.9rem 1.15rem; margin: 1.25rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 0.95rem;
}
.callout strong { color: var(--accent2); }
.callout.info { background: var(--accent-soft); border-left-color: var(--accent); }
.callout.info strong { color: var(--accent-deep); }

.faq dt { font-weight: 750; margin-top: 1.25rem; margin-bottom: 0.4rem; }
.faq dd { margin-bottom: 0.5rem; padding-left: 0; color: var(--foreground); }

.cta {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.4rem; margin: 2.5rem 0 1rem; text-align: center; box-shadow: var(--shadow-sm);
}
.cta p { margin-bottom: 0.75rem; font-weight: 600; }
.cta a.btn { margin: 0 0.25rem; }

ul.source-list { list-style: none; padding: 0; margin: 1rem 0 1.5rem; font-size: 0.9rem; }
ul.source-list li { padding: 0.55rem 0 0.55rem 1.1rem; border-bottom: 1px solid var(--border-soft); position: relative; }
ul.source-list li::before { content: "\203A"; position: absolute; left: 0; color: var(--accent2); font-weight: 700; }
ul.source-list .pub { color: var(--muted-text); font-size: 0.82rem; }

/* ── Calculator widgets ────────────────────────────────────────────────── */
.calc {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem 1.4rem; margin: 1.5rem 0 2rem; box-shadow: var(--shadow);
}
.calc h2, .calc h3 { margin: 0 0 1rem; font-size: 1.15rem; font-weight: 750; }
.calc .calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem 1rem; margin-bottom: 1.1rem; }
.calc label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--muted-text); margin-bottom: 0.3rem; }
.calc input, .calc select {
  width: 100%; padding: 0.55rem 0.7rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--background); color: var(--foreground);
  font-family: var(--font-mono); font-size: 1rem;
}
.calc input:focus, .calc select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.calc select { font-family: var(--font-sans); font-weight: 600; }
.calc-result {
  background: var(--accent-soft); border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem; display: flex; flex-wrap: wrap; gap: 1rem 2rem;
}
.calc-result .res { display: flex; flex-direction: column; }
.calc-result .res .label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-text); }
.calc-result .res output, .calc-result .res .value { font-family: var(--font-mono); font-weight: 700; font-size: 1.35rem; color: var(--accent-deep); }
.calc-result .res .value.pos, .calc-result .res output.pos { color: var(--success); }
.calc-result .res .value.neg, .calc-result .res output.neg { color: var(--danger); }
.calc-note { font-size: 0.8rem; color: var(--muted-text); margin-top: 0.75rem; }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; font-size: 0.74rem; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.18rem 0.6rem; border-radius: 2rem;
}
.badge.blue { background: var(--accent-soft); color: var(--accent-deep); }
.badge.orange { background: var(--accent2-soft); color: #B06010; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.red { background: var(--danger-soft); color: var(--danger); }

.pdt-badge {
  display: inline-block; background: var(--accent2); color: var(--foreground);
  font-weight: 700; font-size: 0.9rem; padding: 0.35rem 0.85rem;
  border-radius: 2rem; letter-spacing: 0.01em; text-decoration: none;
}
a.pdt-badge:hover { background: var(--brand-pop); color: var(--white); }

/* ── Disclaimer ────────────────────────────────────────────────────────── */
.disclaimer {
  background: var(--muted); border-left: 3px solid var(--muted-text);
  padding: 0.9rem 1.15rem; margin: 2.5rem auto 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.82rem; color: var(--muted-text); line-height: 1.55;
  max-width: var(--measure-wide);
}
article.pillar .disclaimer, main.article .disclaimer { max-width: none; margin-left: 0; margin-right: 0; }
.disclaimer strong { color: var(--foreground); }
body > .disclaimer { margin-left: 1.5rem; margin-right: 1.5rem; }
@media (min-width: 1128px) { body > .disclaimer { margin-left: auto; margin-right: auto; } }

/* ── Site footer ───────────────────────────────────────────────────────── */
footer.site {
  background: var(--muted); border-top: 1px solid var(--border);
  margin-top: 3rem; padding: 2.5rem 1.5rem 2rem;
  font-size: 0.875rem; color: var(--muted-text);
}
.footer-inner { max-width: var(--measure-wide); margin: 0 auto; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1.5rem 2rem; margin-bottom: 2rem; }
.footer-cols h2 { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--foreground); margin-bottom: 0.6rem; }
.footer-cols ul { list-style: none; padding: 0; }
.footer-cols li { margin-bottom: 0.35rem; }
.footer-cols a { color: var(--muted-text); text-decoration: none; }
.footer-cols a:hover { color: var(--accent); text-decoration: underline; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 1.25rem; text-align: center; }
.footer-bottom p { margin-bottom: 0.4rem; }
.footer-bottom a { color: var(--accent); }

/* ── Utilities ─────────────────────────────────────────────────────────── */
.center { text-align: center; }
.muted { color: var(--muted-text); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; padding: 2.5rem 1.25rem 2.25rem; gap: 1.75rem; }
  .hero-art { order: -1; }
  .hero-art svg { max-width: 320px; }
}

@media (max-width: 600px) {
  .site-header-inner { padding: 0.6rem 1rem; }
  nav.site-nav a { padding: 0.3rem 0.5rem; font-size: 0.88rem; }
  .section { padding: 2rem 1rem; }
  article.pillar, main.article { padding-left: 1rem; padding-right: 1rem; }
  body > .disclaimer { margin-left: 1rem; margin-right: 1rem; }
  .strip-rows { gap: 0.45rem; }
  .level-chip { min-width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .btn { transition: none; }
}
