:root {
  --navy: #011167;
  --indigo: #271d57;
  --blue: #035e96;
  --blue-600: #024c7a;
  --cyan: #21a6c6;
  --yellow: #fded01;
  --ink: #141a33;
  --ink-2: #4a536b;
  --ink-3: #6e7a84;
  --line: #dcdfe8;
  --line-2: #eceef4;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --focus: 0 0 0 3px rgba(33, 166, 198, 0.45);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(1, 17, 103, 0.06), 0 4px 16px rgba(1, 17, 103, 0.06);
  --shadow-lg: 0 2px 4px rgba(1, 17, 103, 0.06), 0 18px 40px rgba(1, 17, 103, 0.1);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Plus Jakarta Sans', var(--font);
  --lead: 'Outfit', var(--font);
  --measure: 68ch;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.6 var(--font); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--navy); line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.015em; text-wrap: balance; }
p { margin: 0 0 1em; }
a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--blue-600); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
img { max-width: 100%; height: auto; display: block; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.shell { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; }

/* Brand bar and footer: same as the app */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px); background: var(--navy); color: #fff;
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; min-width: 0; }
.brand:hover { color: #fff; }
.brand img { height: 36px; width: auto; display: block; flex: none; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1rem; line-height: 1.15; display: flex; flex-direction: column; }
.brand-name small { font-family: var(--font); font-weight: 400; font-size: 0.75rem; opacity: 0.75; font-style: italic; }
.topnav { display: flex; gap: 4px; flex: none; }
.topnav a { color: rgba(255, 255, 255, 0.85); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: 0.95rem; }
.topnav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.topnav a.on { color: #fff; background: rgba(255, 255, 255, 0.14); }
.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding: 20px clamp(16px, 4vw, 40px); font-size: 0.8rem; color: var(--ink-3);
  border-top: 1px solid var(--line-2); background: var(--surface);
}
.footer a { color: inherit; }
.build { font-variant-numeric: tabular-nums; opacity: 0.7; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: var(--radius); border: 1px solid transparent;
  background: var(--blue); color: #fff; font: 600 1rem/1 var(--font); text-decoration: none; cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--blue-600); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-lg { min-height: 52px; padding: 14px 28px; font-size: 1.05rem; }
.btn-accent { background: var(--yellow); color: var(--navy); box-shadow: 0 2px 0 rgba(1, 17, 103, 0.15); }
.btn-accent:hover { background: #ffe600; color: var(--navy); }

/* Index */
.blog-wrap { max-width: 1120px; margin: 0 auto; padding: 32px 16px 64px; }
@media (min-width: 700px) { .blog-wrap { padding: 48px clamp(16px, 4vw, 40px) 80px; } }
.blog-head { margin-bottom: 28px; }
.blog-head h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); font-weight: 800; margin-bottom: 8px; }
.lede { font-family: var(--lead); font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem); color: var(--ink-2); max-width: 52ch; margin: 0; }
.kicker { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.74rem; font-weight: 600; color: var(--blue); margin: 0 0 8px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 0.86rem; color: var(--ink-3); }
.empty { color: var(--ink-2); padding: 32px 0; }

.lead { margin-bottom: 32px; }
.lead-link {
  display: grid; text-decoration: none; color: inherit; background: var(--surface);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); transition: box-shadow 0.2s, transform 0.2s;
}
.lead-link:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); color: inherit; }
.lead-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--line-2); }
.lead-body { padding: 24px 20px 28px; }
.lead-body h2 { font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.4rem); font-weight: 800; margin-bottom: 12px; }
.lead-body .dek { font-family: var(--lead); font-size: 1.1rem; color: var(--ink-2); max-width: 60ch; }
@media (min-width: 900px) {
  .lead-link { grid-template-columns: 1.35fr 1fr; align-items: center; }
  .lead-img { height: 100%; min-height: 380px; aspect-ratio: auto; }
  .lead-body { padding: 40px 44px; }
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.filters a {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 0.92rem; min-height: 40px; display: inline-flex; align-items: center;
}
.filters a:hover { border-color: var(--blue); color: var(--blue); }
.filters a[aria-current='page'] { background: var(--navy); border-color: var(--navy); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 24px; }
.card-link {
  display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit;
  background: var(--surface); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); transition: box-shadow 0.2s, transform 0.2s;
}
.card-link:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); color: inherit; }
.card-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--line-2); }
.ph { background: linear-gradient(135deg, var(--navy), var(--blue) 60%, var(--cyan)); }
.card-body { padding: 18px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { font-size: 1.18rem; font-weight: 700; margin-bottom: 8px; }
.card-body .dek { color: var(--ink-2); font-size: 0.97rem; flex: 1; }

.cta {
  margin: 56px 0 0; padding: 28px 24px; border-radius: 18px; color: #fff;
  background: radial-gradient(900px 300px at 90% -20%, rgba(33, 166, 198, 0.45), transparent 60%), linear-gradient(150deg, var(--navy), var(--indigo));
  display: flex; flex-direction: column; gap: 18px; align-items: flex-start;
}
.cta h2 { color: #fff; font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.7rem); margin-bottom: 6px; }
.cta p { margin: 0; color: rgba(255, 255, 255, 0.82); max-width: 52ch; }
@media (min-width: 760px) { .cta { flex-direction: row; align-items: center; justify-content: space-between; padding: 36px 40px; } }

/* Post */
.post { padding: 0 0 8px; }
.post-head { max-width: 820px; margin: 0 auto; padding: 32px 16px 24px; }
@media (min-width: 700px) { .post-head { padding: 56px 24px 32px; } }
.crumbs { display: flex; gap: 8px; font-size: 0.88rem; color: var(--ink-3); margin-bottom: 18px; flex-wrap: wrap; }
.crumbs a { color: var(--blue); text-decoration: none; font-weight: 500; }
.crumbs a:hover { text-decoration: underline; }
.post-head h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.25rem); font-weight: 800; line-height: 1.1; margin-bottom: 16px; }
.post-dek { font-family: var(--lead); font-size: clamp(1.12rem, 1.02rem + 0.5vw, 1.35rem); line-height: 1.5; color: var(--ink-2); margin-bottom: 20px; }
.post-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 0.92rem; color: var(--ink-3); margin: 0; }
.post-meta .author { color: var(--ink); font-weight: 600; }
.post-hero { max-width: 1200px; margin: 0 auto 8px; padding: 0; }
.hero-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--line-2); }
@media (min-width: 1240px) { .hero-img { border-radius: 18px; } }

.post-grid { max-width: 1120px; margin: 0 auto; padding: 32px 16px 0; display: grid; gap: 32px; }
@media (min-width: 1100px) { .post-grid { grid-template-columns: 220px minmax(0, var(--measure)); justify-content: center; gap: 56px; padding-top: 48px; } }
.toc { display: none; }
@media (min-width: 1100px) {
  .toc { display: block; position: sticky; top: 96px; align-self: start; font-size: 0.9rem; }
  .toc p { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.72rem; font-weight: 600; color: var(--ink-3); margin-bottom: 10px; }
  .toc ol { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
  .toc li { margin: 0 0 10px; }
  .toc a { color: var(--ink-2); text-decoration: none; line-height: 1.35; display: block; }
  .toc a:hover { color: var(--blue); }
}

.prose { max-width: var(--measure); margin: 0 auto; width: 100%; font-size: 1.09rem; line-height: 1.75; }
.prose > * + * { margin-top: 0; }
.prose p { margin: 0 0 1.25em; }
.prose h2 { font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.75rem); font-weight: 800; margin: 2em 0 0.6em; }
.prose h3 { font-size: 1.25rem; font-weight: 700; margin: 1.8em 0 0.5em; }
.prose h4 { font-size: 1.08rem; font-weight: 700; margin: 1.6em 0 0.4em; }
.prose ul, .prose ol { margin: 0 0 1.4em; padding-left: 1.3em; }
.prose li { margin: 0 0 0.5em; padding-left: 0.2em; }
.prose li::marker { color: var(--blue); font-weight: 600; }
.prose strong { color: var(--navy); font-weight: 600; }
.prose blockquote {
  margin: 1.8em 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--yellow);
  font-family: var(--display); font-size: 1.2rem; line-height: 1.5; color: var(--navy); font-weight: 600;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.5em 0; }
.prose code { font-size: 0.9em; background: var(--line-2); padding: 0.1em 0.35em; border-radius: 4px; }
.prose > p:first-child::first-letter {
  float: left; font-family: var(--display); font-weight: 800; color: var(--navy);
  font-size: 3.6em; line-height: 0.85; padding: 0.06em 0.1em 0 0;
}

/* Charts */
.chart { margin: 2.2em 0; padding: 20px 16px 16px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; }
.chart-title { font-family: var(--display); font-weight: 700; color: var(--navy); font-size: 1.02rem; line-height: 1.35; margin-bottom: 10px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; font-family: var(--font); }
.chart .gl { stroke: var(--line-2); stroke-width: 1; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .val { fill: var(--ink); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .label { fill: var(--ink-2); font-size: 12px; font-weight: 500; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart path:hover, .chart .dot:hover { opacity: 0.85; }
.chart-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 8px; padding: 0; font-size: 0.86rem; color: var(--ink-2); }
.chart-legend li { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 0; }
.chart-legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.chart-legend .key.line { height: 3px; width: 18px; border-radius: 2px; }
.chart-legend .key.c0 { background: #035e96; }
.chart-legend .key.c1 { background: #21a6c6; }
.chart-legend .key.c2 { background: #7b61c9; }
.chart-source { font-size: 0.82rem; color: var(--ink-3); margin: 10px 0 0 !important; line-height: 1.4; }
.chart-source a { color: var(--ink-2); }
.chart-data { margin-top: 8px; font-size: 0.88rem; line-height: 1.4; }
.chart-data summary { cursor: pointer; color: var(--blue); font-weight: 500; min-height: 32px; display: inline-flex; align-items: center; }
.table-scroll { overflow-x: auto; margin-top: 8px; }
.chart-data table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.chart-data th, .chart-data td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line-2); }
.chart-data thead th { color: var(--ink-2); font-weight: 600; }

/* Video facade */
.video { margin: 2.2em 0; }
.yt { position: relative; display: block; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.yt img { width: 100%; height: 100%; object-fit: cover; opacity: 0.92; transition: opacity 0.2s; }
.yt:hover img { opacity: 1; }
.yt-play { position: absolute; inset: 0; display: grid; place-items: center; }
.yt-play svg { filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35)); transition: transform 0.15s; }
.yt:hover .yt-play svg { transform: scale(1.08); }
.yt-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 14px; display: block; }
.video figcaption { font-size: 0.88rem; color: var(--ink-3); margin-top: 8px; }

/* Post end matter */
.sources { margin-top: 2.6em; padding-top: 1.4em; border-top: 1px solid var(--line); }
.sources h2 { font-size: 1rem !important; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin: 0 0 0.8em !important; }
.sources ol { font-size: 0.93rem; line-height: 1.5; padding-left: 1.4em; }
.sources li::marker { color: var(--ink-3); font-weight: 400; }
.src-date { color: var(--ink-3); font-size: 0.86rem; white-space: nowrap; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0 !important; margin: 1.6em 0 !important; }
.tags li { margin: 0; padding: 0; }
.tags a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-size: 0.88rem;
}
.tags a:hover { border-color: var(--blue); color: var(--blue); }
.share { font-size: 0.92rem; color: var(--ink-3); }
.related { margin-top: 56px; }
.related h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 20px; }
.narrow-404 { text-align: center; padding-top: 96px; padding-bottom: 96px; }

@media (max-width: 560px) {
  .brand img { height: 30px; }
  .topnav a { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@media print {
  .topbar, .footer, .cta, .related, .share, .toc, .tags { display: none; }
  body { background: #fff; }
}
