:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --canvas: #f8fafc;
  --surface: #fff;
  --surface-hover: #f1f5f9;
  --heading: #0f172a;
  --body: #334155;
  --muted: #64748b;
  --border: rgba(0, 0, 0, .08);
  --accent: #b62b3f;
  --accent-strong: #d9475c;
}

:root.dark {
  color-scheme: dark;
  --canvas: #030712;
  --surface: #0f172a;
  --surface-hover: #1e293b;
  --heading: #f8fafc;
  --body: #cbd5e1;
  --muted: #94a3b8;
  --border: rgba(255, 255, 255, .12);
  --accent: #fb8291;
  --accent-strong: #d9475c;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--body); }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
.skip-link { position: absolute; z-index: 60; top: -5rem; left: 1rem; padding: .7rem 1rem; background: var(--surface); border-radius: .75rem; }
.skip-link:focus { top: 1rem; }

.site-header { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--border); background: var(--surface); }
.nav-shell { max-width: 1152px; min-height: 73px; margin: auto; padding: .9rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }
.brand { display: inline-flex; flex: 0 0 auto; align-items: center; }
.brand img { display: block; width: auto; height: 40px; max-width: 190px; object-fit: contain; }
.brand .logo-dark, .dark .brand .logo-light { display: none; }
.dark .brand .logo-dark { display: block; }
.site-nav, .header-actions { display: flex; align-items: center; gap: 1.5rem; }
.site-nav a { color: var(--muted); font-size: .875rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--heading); }
.header-actions { gap: .7rem; }
.header-actions a, .theme-toggle { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: .75rem; background: var(--surface); color: var(--heading); font: inherit; font-size: .875rem; font-weight: 600; text-decoration: none; }
.header-actions a { padding: 0 1rem; white-space: nowrap; }
.header-actions a:hover, .theme-toggle:hover { background: var(--surface-hover); }
.theme-toggle { width: 40px; padding: 0; cursor: pointer; }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .sun-icon, .dark .theme-toggle .moon-icon { display: none; }
.dark .theme-toggle .sun-icon { display: block; }

.shell { max-width: 840px; margin: 0 auto; padding: 4rem 1.25rem 6rem; }
.eyebrow { margin: 0 0 .85rem; color: var(--accent); font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3 { color: var(--heading); font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif; font-weight: 600; letter-spacing: -.025em; }
h1 { margin: 0 0 1.1rem; font-size: clamp(2.2rem, 5vw, 3.25rem); line-height: 1.15; }
h2 { margin: 2.7rem 0 1rem; font-size: 1.75rem; }
h3 { margin: 2rem 0 .8rem; font-size: 1.35rem; }
p, li { font-size: 1.02rem; line-height: 1.75; }
p { margin: 1rem 0; }
.deck { color: var(--body); font-size: 1.2rem; line-height: 1.7; }
.byline, .caption { color: var(--muted); font-size: .9rem; }
.article-back { display: inline-block; margin-bottom: 2rem; font-size: .875rem; font-weight: 600; text-decoration: none; }
figure { margin: 2rem 0; }
figure img, .article-body img { display: block; width: 100%; height: auto; border-radius: 1rem; }
.article-body img { margin: 1.8rem 0 .5rem; }
.article-body p:has(> img) + p > em { color: var(--muted); font-size: .9rem; }
.article-body a { overflow-wrap: anywhere; }
blockquote { margin-left: 0; padding: .1rem 0 .1rem 1.2rem; border-left: 4px solid var(--accent-strong); color: var(--body); }
.article-body pre { max-width: 100%; overflow-x: auto; padding: 1rem; border-radius: .75rem; background: var(--surface); }

.journal-intro { max-width: 700px; }
.article-list { display: grid; gap: 1.25rem; margin: 2.5rem 0 0; padding: 0; list-style: none; }
.article-card { overflow: hidden; border: 1px solid var(--border); border-radius: 1.5rem; background: var(--surface); }
.article-card.has-image { display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr); }
.article-card img { display: block; width: 100%; height: 100%; min-height: 190px; object-fit: cover; }
.article-card-content { padding: 1.5rem; }
.article-card h2 { margin: .2rem 0 .6rem; font-size: 1.5rem; }
.article-card h2 a { color: var(--heading); text-decoration: none; }
.article-card h2 a:hover { color: var(--accent); }
.article-card p { margin: 0; color: var(--muted); }
.article-card .read-link { display: inline-block; margin-top: 1.25rem; font-size: .9rem; font-weight: 600; text-decoration: none; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-shell { max-width: 1152px; margin: auto; padding: 2rem 1.25rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .8rem; }
.footer-shell nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-shell a { color: var(--muted); text-decoration: none; }
.footer-shell a:hover { color: var(--heading); }

@media (max-width: 900px) { .site-nav { display: none; } }
@media (max-width: 640px) {
  .nav-shell { min-height: 65px; gap: .5rem; padding: .75rem 1rem; }
  .brand img { height: 34px; max-width: 150px; }
  .header-actions { gap: .5rem; }
  .header-actions a { padding: 0 .8rem; }
  .shell { padding-top: 3rem; }
  .article-card.has-image { display: block; }
  .article-card img { height: 220px; }
}
