:root {
  --bg: #faf9f5;
  --surface: #f2f0e8;
  --surface-2: #e9e6db;
  --fg: #141413;
  --body: #262523;
  --muted: #62605b;
  --rule: #e2dfd5;
  --grid: #eae7dd;
  --grey: #94928b;
  --grey2: #d5d2c8;
  --accent: #c84b31;
  --accent-hover: #ae3c24;
  --accent-soft: #f6eae6;
  --teal: #0f766e;
  --teal-soft: #e6f4f2;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110;
    --surface: #1a1a18;
    --surface-2: #242320;
    --fg: #f0eee7;
    --body: #dad7ce;
    --muted: #9a988f;
    --rule: #2b2a27;
    --grid: #22211e;
    --grey: #7d7b74;
    --grey2: #3a3934;
    --accent: #e26d53;
    --accent-hover: #ec836b;
    --accent-soft: #2a1c18;
    --teal: #2dd4bf;
    --teal-soft: #132826;
  }
}

:root[data-theme="dark"] {
  --bg: #111110;
  --surface: #1a1a18;
  --surface-2: #242320;
  --fg: #f0eee7;
  --body: #dad7ce;
  --muted: #9a988f;
  --rule: #2b2a27;
  --grid: #22211e;
  --grey: #7d7b74;
  --grey2: #3a3934;
  --accent: #e26d53;
  --accent-hover: #ec836b;
  --accent-soft: #2a1c18;
  --teal: #2dd4bf;
  --teal-soft: #132826;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font: 17px/1.68 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Header & Navigation */
header.mast {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 24px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--rule);
}

header.mast a.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 13px;
  white-space: nowrap;
}

img.brand-mark {
  width: 26px;
  height: 26px;
  display: block;
  border-radius: 6px;
  flex: 0 0 26px;
}

header.mast nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  font-size: 12.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

header.mast nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

header.mast nav a:hover,
header.mast nav a[aria-current="page"] {
  color: var(--fg);
}

header.mast nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

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

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

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* Main Containers */
main {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px 92px;
}

main.article-main {
  max-width: 860px;
}

/* Typography */
h1, h2, h3, .serif {
  color: var(--fg);
}

h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 42px;
  line-height: 1.14;
  letter-spacing: -0.018em;
  margin: 44px 0 16px;
}

h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.24;
  margin: 54px 0 14px;
  letter-spacing: -0.012em;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 30px 0 8px;
  letter-spacing: -0.005em;
}

p, li {
  max-width: 68ch;
}

p {
  margin: 0 0 18px;
}

ul, ol {
  padding-left: 22px;
  margin: 0 0 22px;
}

li {
  margin: 9px 0;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
}

code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 1.5px 5px;
  border-radius: 4px;
  color: var(--fg);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
}

p.byline {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 22px;
  letter-spacing: 0.01em;
}

p.deck {
  font-size: 19.5px;
  line-height: 1.54;
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 66ch;
}

/* Buttons & Pills */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #faf9f5;
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #faf9f5;
}

.btn-secondary {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--rule);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--rule);
  font-weight: 600;
}

.pill-muted {
  background: var(--surface-2);
  color: var(--muted);
}

/* Landing Hero & Thesis */
.hero {
  padding: 44px 0 34px;
  border-bottom: 1px solid var(--rule);
}

.hero h1 {
  margin: 0 0 16px;
  font-size: 44px;
  max-width: 22ch;
}

.thesis-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}

.thesis-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 14.5px;
  line-height: 1.58;
}

.thesis-card strong {
  display: block;
  color: var(--fg);
  margin-bottom: 6px;
  font-size: 14px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Flagship Highlight Card */
.flagship-card {
  margin: 36px 0 0;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 8px;
}

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

.flagship-card h2 {
  border: none;
  padding: 0;
  margin: 6px 0 10px;
  font-size: 30px;
}

.flagship-card .stat-strip {
  margin: 20px 0 22px;
  background: var(--bg);
}

.mini-chart-box {
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  margin: 0 0 22px;
}

/* Stat Strip */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 24px 0 36px;
  padding: 18px 20px;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--rule);
}

.stat-strip div span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.stat-strip div strong {
  display: block;
  font-size: 24px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  margin: 3px 0;
}

.stat-strip div em {
  font-style: normal;
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
}

/* Research Pillars Grid */
.section-head {
  margin: 56px 0 20px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.section-head h2 {
  border: none;
  padding: 0;
  margin: 0 0 8px;
}

.section-head p {
  color: var(--muted);
  margin: 0;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 20px 0 16px;
}

.pillar-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}

.pillar-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
}

.pillar-card h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 20px;
  line-height: 1.25;
  margin: 0 0 10px;
}

.pillar-card p {
  font-size: 14.5px;
  line-height: 1.56;
  color: var(--muted);
  margin: 0;
}

/* Blog / Writing Entries */
.post-entry {
  padding: 28px 0;
  border-bottom: 1px solid var(--rule);
}

.post-entry:last-child {
  border-bottom: none;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.post-entry h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 26px;
  line-height: 1.24;
  margin: 0 0 10px;
}

.post-entry h3 a {
  color: var(--fg);
  text-decoration: none;
}

.post-entry h3 a:hover {
  color: var(--accent);
}

.post-entry p {
  color: var(--muted);
  font-size: 16px;
  margin: 0 0 14px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 2px 8px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--muted);
}

.read-more {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.about-box {
  margin-top: 44px;
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.about-box h2 {
  border: none;
  padding: 0;
  margin: 0 0 10px;
  font-size: 24px;
}

.about-box p {
  margin-bottom: 10px;
}

.about-box p.about-contact {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.deck-hero {
  margin-bottom: 22px;
}

.deck-flush {
  margin: 0;
}

.flagship-lead {
  margin-bottom: 0;
  color: var(--muted);
}

.mini-chart-title {
  margin-bottom: 8px;
}

.blog-hero {
  padding: 40px 0 26px;
  border-bottom: 1px solid var(--rule);
}

.blog-hero h1 {
  margin: 0 0 14px;
}

.post-title-lg {
  font-size: 30px;
}

.stat-strip-compact {
  margin: 18px 0;
}

.clip-flush {
  margin: 0;
}

.cta-note {
  font-size: 14.5px;
  color: var(--muted);
}

.cta-spaced {
  margin-top: 14px;
}

.callout-title {
  display: block;
  color: var(--fg);
  margin-bottom: 6px;
  font-size: 15px;
}

/* Article Specific Components */
.sub-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 0 0 26px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-size: 14px;
}

table {
  border-collapse: collapse;
  font-size: 14px;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

th, td {
  border-bottom: 1px solid var(--rule);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 600;
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td.n, th.n {
  text-align: right;
  white-space: nowrap;
}

.tw {
  overflow-x: auto;
  margin: 22px 0 30px;
}

.ledger-table {
  font-size: 13px;
}

.ledger-table th,
.ledger-table td {
  padding: 7px 8px;
}

.ledger-table code {
  font-size: 11.5px;
}

.ledger-table tr.summary-row td {
  border-top: 2px solid var(--rule);
  border-bottom: none;
  font-weight: 650;
  color: var(--fg);
  background: var(--surface);
}

.win-num {
  color: var(--accent);
  font-weight: 650;
}

figure {
  margin: 32px 0;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
}

figure.clip {
  padding: 0;
  background: transparent;
  border: none;
}

.ft {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--fg);
  margin-bottom: 12px;
  letter-spacing: -0.005em;
}

.leg, figure.clip figcaption {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.54;
  margin-top: 10px;
}

.sv {
  overflow-x: auto;
}

svg {
  width: 100%;
  height: auto;
  display: block;
}

svg text {
  font-family: var(--font-sans);
}

.tx { fill: var(--fg); }
.mu { fill: var(--muted); }
.ac-tx { fill: var(--accent); }
.tl-tx { fill: var(--teal); }
.grid { stroke: var(--grid); stroke-width: 1; }
.line-ac { stroke: var(--accent); stroke-width: 2.3; }
.dot-ac { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.dot-g { fill: var(--grey); stroke: var(--bg); stroke-width: 1.8; }
.conn { stroke: var(--grey2); stroke-width: 1.8; }
.bar-g2 { fill: var(--grey2); }
.bar-ac { fill: var(--accent); }

.k {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin: 0 5px 0 12px;
  vertical-align: middle;
}

.k:first-child { margin-left: 0; }
.k.g { background: var(--grey); }
.k.a { background: var(--accent); }

.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 26px 0;
}

video {
  width: 100%;
  height: auto;
  background: #000;
  border-radius: 6px;
  display: block;
  border: 1px solid var(--rule);
}

.note-card {
  margin: 26px 0;
  padding: 18px 22px;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 15px;
  line-height: 1.6;
}

.note-card b.title {
  display: block;
  color: var(--fg);
  margin-bottom: 6px;
  font-size: 15px;
}

.note-card p:last-child {
  margin-bottom: 0;
}

.cta-box {
  margin-top: 50px;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 6px;
}

.cta-box h3 {
  margin-top: 0;
  font-size: 22px;
  font-family: var(--font-serif);
  font-weight: 500;
}

.cta-box p:last-child {
  margin-bottom: 0;
}

/* Footer */
footer.foot {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 24px 56px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

footer.foot a {
  color: var(--muted);
  text-decoration: none;
}

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

/* Responsive */
@media (max-width: 780px) {
  .thesis-grid,
  .pillars-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  header.mast {
    flex-direction: column;
    align-items: flex-start;
  }
  h1, .hero h1 {
    font-size: 32px;
  }
  p.deck {
    font-size: 17.5px;
  }
  .stat-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .video-grid {
    grid-template-columns: 1fr;
  }
  .flagship-card {
    padding: 20px;
  }
}
