/*
 * Chembricks blog stylesheet. Self-contained: blog pages do not load the
 * homepage CSS. The token block and chrome primitives below are copied from
 * index.html so both look identical. If you edit a token or a shared rule in
 * either file, mirror the change in the other.
 *
 * Deliberate exception: header and .site-shell widths use --blog-col
 * (a focused reading column) instead of the homepage's --container, so the
 * blog header is narrower than the homepage header by design. Everything
 * else in the shared chrome stays mirrored.
 */

/* TOKENS-START (copied verbatim from index.html :root) */
:root {
    --bg: #0e1424;
    --surface: #0e1424;
    --surface-alt: #131d33;
    --text: #e6edf7;
    --muted: #8a9bb8;
    --accent: #22d3ee;
    --accent-light: #38bdf8;
    --accent-secondary: #a78bfa;
    --shadow-dark: rgb(4 8 18 / 0.66);
    --shadow-light: rgb(40 54 84 / 0.5);
    --extruded: 9px 9px 16px var(--shadow-dark), -9px -9px 16px var(--shadow-light);
    --extruded-hover: 12px 12px 20px rgb(4 8 18 / 0.72), -12px -12px 20px rgb(40 54 84 / 0.55);
    --extruded-small: 5px 5px 10px rgb(4 8 18 / 0.6), -5px -5px 10px rgb(40 54 84 / 0.45);
    --inset: inset 6px 6px 10px rgb(4 8 18 / 0.6), inset -6px -6px 10px rgb(40 54 84 / 0.45);
    --inset-deep: inset 10px 10px 20px rgb(4 8 18 / 0.7), inset -10px -10px 20px rgb(40 54 84 / 0.5);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --container: 1320px;
    --header-height: 84px;
    --transition: 300ms ease-out;
    --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
    color-scheme: dark;
}
/* TOKENS-END */

/* Blog-only tokens (not mirrored from index.html). --link carries text-colored
   accents so the light theme can swap in a darker, readable variant; raw cyan
   fails contrast on light backgrounds. */
:root {
    --link: var(--accent);
    --link-hover: var(--accent-light);
    --reading-scale: 1;
    /* Blog pages use their own column width. Wide enough on big screens to
       host a two-column reading layout (nav rail + article), capped so it
       never sprawls edge to edge. */
    --blog-col: min(92vw, 1240px);
}

/* Reader text-size steps, set via the reading-prefs widget */
html[data-fontsize="s"] {
    --reading-scale: 0.92;
}

html[data-fontsize="l"] {
    --reading-scale: 1.14;
}

html {
    scroll-behavior: smooth;
    background:
        radial-gradient(125% 85% at 80% -12%, rgba(34, 211, 238, 0.10), transparent 55%),
        radial-gradient(90% 75% at 4% 112%, rgba(167, 139, 250, 0.07), transparent 55%),
        var(--bg);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Geist", sans-serif;
    background: transparent;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Floating neumorphic orbs, copied from index.html */
body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    animation: float 8s ease-in-out infinite;
}

body::before {
    width: 420px;
    height: 420px;
    top: -120px;
    right: -120px;
    box-shadow: var(--extruded);
    opacity: 0.3;
}

body::after {
    width: 260px;
    height: 260px;
    left: -80px;
    bottom: 10%;
    box-shadow: var(--inset-deep);
    opacity: 0.18;
    animation-delay: -2.5s;
}

@keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Drifting background molecules, copied from index.html */
.bg-molecules {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.bg-mol {
    position: absolute;
    display: block;
    width: 120px;
    height: auto;
    color: var(--accent);
    opacity: 0.08;
    filter: drop-shadow(0 0 9px currentColor);
    will-change: transform;
    animation: molDrift 32s ease-in-out infinite;
}

.bg-mol--1 {
    top: 11%;
    left: 2%;
    width: 130px;
    color: #22d3ee;
    opacity: 0.18;
    animation-duration: 34s;
}

.bg-mol--2 {
    top: 58%;
    right: 2%;
    width: 150px;
    color: #a78bfa;
    opacity: 0.15;
    animation-duration: 28s;
    animation-delay: -7s;
}

.bg-mol--3 {
    bottom: 7%;
    left: 1.5%;
    width: 104px;
    color: #38bdf8;
    opacity: 0.17;
    animation-duration: 38s;
    animation-delay: -13s;
}

.bg-mol--4 {
    top: 26%;
    right: 2.5%;
    width: 92px;
    color: #22d3ee;
    opacity: 0.13;
    animation-duration: 31s;
    animation-delay: -4s;
}

@keyframes molDrift {
    0%,
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
    50% {
        transform: translate3d(0, -20px, 0) rotate(9deg);
    }
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

::selection {
    background: rgb(34 211 238 / 0.28);
    color: #ffffff;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
    border: 0;
    background: none;
    cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Hidden until focused via keyboard, then slides in over the header. */
.skip-link {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 100;
    padding: 10px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #031822;
    font-weight: 700;
    transform: translateY(-220%);
    transition: transform var(--transition);
}

.skip-link:focus {
    transform: none;
}

.site-shell {
    width: min(calc(100% - 32px), var(--blog-col));
    margin: 0 auto;
}

section,
footer {
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--extruded);
}

/* Header chrome, copied from index.html */
header {
    position: sticky;
    top: 18px;
    z-index: 50;
    width: min(calc(100% - 32px), var(--blog-col));
    margin: 18px auto 0;
    border-radius: 999px;
    background: rgb(14 20 36 / 0.85);
    box-shadow: var(--extruded);
    backdrop-filter: blur(12px);
}

.reading-progress {
    position: absolute;
    right: 24px;
    bottom: 0;
    left: 24px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light), var(--accent-secondary));
    box-shadow: 0 0 12px rgb(34 211 238 / 0.46);
    transform: scaleX(0);
    transform-origin: left center;
    will-change: transform;
}

nav {
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 20px 14px 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-height: 44px;
    font-family: "Geist Mono", monospace;
    font-weight: 600;
    letter-spacing: 0.16em;
    font-size: 0.84rem;
}

.brand-logo {
    display: block;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    filter: drop-shadow(0 4px 14px rgba(34, 211, 238, 0.28));
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 18px;
    margin-left: auto;
    border-radius: 999px;
    color: var(--text);
    box-shadow: var(--extruded-small);
    font-weight: 700;
    font-size: 0.95rem;
    transition: transform var(--transition), box-shadow var(--transition);
}

.nav-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--extruded-hover);
}

.nav-link[aria-current="page"] {
    color: var(--link);
}

.nav-cta {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 18px;
    border-radius: 999px;
    color: #031822;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    box-shadow: 0 10px 24px rgba(34, 211, 238, 0.22);
    font-weight: 700;
    font-size: 0.92rem;
    white-space: nowrap;
    transition: transform var(--transition), box-shadow var(--transition);
}

.nav-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(34, 211, 238, 0.30);
}

main {
    padding: 42px 0 28px;
}

h1,
h2,
h3 {
    font-family: "Geist", sans-serif;
    letter-spacing: -0.03em;
    color: var(--text);
}

/* Blog panels, textured like the homepage hero and loop panels */
.page-head,
.post {
    margin-top: 18px;
    padding: clamp(28px, 4vw, 56px);
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(72% 92% at 82% 8%, rgba(34, 211, 238, 0.10), transparent 60%),
        linear-gradient(rgba(140, 155, 184, 0.04) 1px, transparent 1px) 0 0 / 46px 46px,
        linear-gradient(90deg, rgba(140, 155, 184, 0.04) 1px, transparent 1px) 0 0 / 46px 46px,
        var(--surface);
}

.page-head {
    text-align: center;
}

.post-kicker {
    color: var(--link);
    font-family: "Geist Mono", monospace;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* Lead word in a kicker, like the homepage's TRUST in the agentic loop */
.kicker-strong {
    color: #ffffff;
    text-shadow: 0 0 18px rgba(34, 211, 238, 0.48);
}

.page-head h1 {
    font-size: clamp(2.1rem, 4.5vw, 3.4rem);
    line-height: 1.02;
    margin-bottom: 12px;
}

/* Gradient-clipped headlines, copied from the homepage h1 */
.page-head h1,
.post h1 {
    background: linear-gradient(176deg, #ffffff 0%, #f4fafd 62%, #e6f3f9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 22px rgba(34, 211, 238, 0.1));
}

/* Fallback so the gradient-clipped headline is never invisible
   (Windows high-contrast / forced-colors strips the background). */
@media (forced-colors: active) {
    .page-head h1,
    .post h1 {
        color: CanvasText;
        -webkit-text-fill-color: CanvasText;
        background: none;
        filter: none;
    }
}

.page-lede {
    color: var(--muted);
    font-size: clamp(1rem, 0.7vw + 0.9rem, 1.15rem);
    max-width: 62ch;
    margin: 0 auto;
}

/* Article */
/* The article is a focused reading-width card, centered on the page, so the
   panel wraps its content instead of leaving wide empty textured margins. The
   panel width sets the reading measure; the inner wrapper just fills it. */
/* Narrow/medium screens: a single centered reading card. */
.post {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

.post-layout,
.post-main {
    min-width: 0;
}

/* The rail only exists on the two-column layout below. */
.post-rail {
    display: none;
}

/* Wide screens: two columns. A sticky "On this page" nav rail uses the extra
   width, the article body fills the main column with a readable text measure
   and full-width figures. */
/* The rail is injected by blog.js only when the article has two or more h2
   sections, so gating on :has(.post-rail) means the grid can never trap the
   article in the 210px track: short articles and no-JS readers get the
   centered single card instead. */
@media (min-width: 1100px) {
    .post:has(.post-rail) {
        max-width: none;
        /* overflow:hidden would break the sticky nav rail; the panel's rounded
           background does not need the clip. */
        overflow: visible;
    }

    .post-layout:has(.post-rail) {
        display: grid;
        grid-template-columns: 210px minmax(0, 1fr);
        gap: 56px;
        align-items: start;
    }

    .post-rail {
        display: block;
        position: sticky;
        top: 112px;
        align-self: start;
        max-height: calc(100vh - 140px);
        overflow-y: auto;
    }

    /* Readable text measure (~75 characters). Geist's wide glyphs make ch
       misleading here, so this is set in rem. Figures and code fill the
       column. */
    .post-layout:has(.post-rail) .post-body > * {
        max-width: 44rem;
    }

    .post-layout:has(.post-rail) .post-body > figure,
    .post-layout:has(.post-rail) .post-body > pre {
        max-width: none;
    }
}

.post-toc-title {
    font-family: "Geist Mono", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 12px;
}

.post-toc ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-left: 1px solid rgb(138 155 184 / 0.25);
}

.post-toc li {
    margin: 0;
}

.post-toc a {
    display: block;
    padding: 5px 0 5px 14px;
    margin-left: -1px;
    border-left: 2px solid transparent;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.35;
    text-decoration: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: color var(--transition), background var(--transition), text-shadow var(--transition);
}

.post-toc a:hover {
    color: var(--text);
}

.post-toc a.is-active {
    color: var(--link);
    border-left-color: var(--link);
    background: linear-gradient(90deg, rgb(34 211 238 / 0.1), transparent 86%);
    text-shadow: 0 0 16px rgb(34 211 238 / 0.24);
}

/* Anchored headings clear the sticky header when jumped to. */
.post-body h2 {
    scroll-margin-top: 110px;
}

.post h1 {
    font-size: clamp(2.1rem, 4.5vw, 3.2rem);
    line-height: 1.05;
    margin-bottom: 14px;
    overflow-wrap: anywhere;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    color: var(--muted);
    font-family: "Geist Mono", monospace;
    font-size: 0.85rem;
    margin-bottom: 30px;
}

/* Reader preferences widget: text size steps and the theme toggle */
.reading-prefs {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin: -14px 0 26px;
}

.reading-prefs-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    box-shadow: var(--inset);
}

.prefs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 700;
    transition: color var(--transition), box-shadow var(--transition);
}

.prefs-btn:hover {
    color: var(--text);
}

.prefs-btn[aria-pressed="true"] {
    color: var(--text);
    box-shadow: var(--extruded-small);
}

/* The pressed shadow above outranks the global button:focus-visible ring in
   the cascade, so restate the ring here (combined, matching the email input
   pattern) or keyboard focus becomes invisible on the active button. */
.prefs-btn:focus-visible {
    box-shadow: var(--focus-ring);
}

.prefs-btn[aria-pressed="true"]:focus-visible {
    box-shadow: var(--focus-ring), var(--extruded-small);
}

.prefs-a {
    line-height: 1;
}

.prefs-a-s {
    font-size: 0.75rem;
}

.prefs-a-m {
    font-size: 0.95rem;
}

.prefs-a-l {
    font-size: 1.18rem;
}

.prefs-theme svg {
    width: 18px;
    height: 18px;
    display: block;
}

.prefs-theme .icon-moon {
    display: none;
}

html[data-theme="light"] .prefs-theme .icon-sun {
    display: none;
}

html[data-theme="light"] .prefs-theme .icon-moon {
    display: block;
}

.post-body p {
    font-size: calc(1.05rem * var(--reading-scale));
    line-height: 1.75;
    margin-bottom: 18px;
}

.post-body h2 {
    font-size: calc(clamp(1.45rem, 2.4vw, 1.9rem) * var(--reading-scale));
    margin: 38px 0 14px;
}

.post-body h3 {
    font-size: calc(1.2rem * var(--reading-scale));
    margin: 28px 0 10px;
}

.post-body ul,
.post-body ol {
    padding-left: 1.3em;
    margin-bottom: 18px;
}

.post-body li {
    font-size: calc(1.05rem * var(--reading-scale));
    line-height: 1.7;
    margin-bottom: 8px;
}

.post-body a {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-body a:hover {
    color: var(--link-hover);
}

.post-body blockquote,
.post-body .callout {
    margin: 24px 0;
    padding: 16px 22px;
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-md);
    background: var(--surface-alt);
}

.post-body blockquote p:last-child,
.post-body .callout p:last-child {
    margin-bottom: 0;
}

.post-body .callout--slogan {
    padding: 22px 26px;
    border-left: 0;
    border-top: 2px solid var(--accent);
    text-align: center;
    box-shadow: var(--inset);
}

.post-body .callout--slogan p {
    font-size: calc(clamp(1.12rem, 2.3vw, 1.45rem) * var(--reading-scale));
    letter-spacing: -0.015em;
}

.post-body code {
    font-family: "Geist Mono", monospace;
    font-size: 0.92em;
    background: var(--surface-alt);
    padding: 2px 7px;
    border-radius: 8px;
}

.post-body pre {
    background: var(--surface-alt);
    box-shadow: var(--inset);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    overflow-x: auto;
    margin: 24px 0;
    font-size: calc(1rem * var(--reading-scale));
    line-height: 1.6;
}

.post-body pre code {
    background: none;
    padding: 0;
}

.post-body figure {
    margin: 28px 0;
}

.figure-data > a {
    display: block;
    line-height: 0;
    border-radius: var(--radius-md);
}

.figure-data > a:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.figure-hint {
    display: none;
}

.post-body figure img {
    width: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--extruded-small), 0 0 0 1px rgba(34, 211, 238, 0.18);
}

.post-body figcaption {
    color: var(--muted);
    font-size: calc(0.9rem * var(--reading-scale));
    text-align: center;
    margin-top: 10px;
}

.post-body hr {
    border: 0;
    height: 1px;
    background: rgb(138 155 184 / 0.25);
    margin: 34px 0;
}

.post-footer-nav {
    margin-top: 30px;
}

/* Article callout: styled with blockquote (see the .post-body blockquote
   rule above). */

/* Closing call-to-action panel; the button shares the .subscribe-button
   ruleset below. */
.post-cta {
    margin: 34px 0;
    padding: 22px 26px;
    border-radius: var(--radius-lg);
    background: var(--surface-alt);
    box-shadow: var(--extruded-small);
}

.post-cta p {
    margin-bottom: 14px;
}

.post-cta-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

/* Anchor-specific extras on top of the shared .subscribe-button recipe. */
.post-body .post-cta-button {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.post-body .post-cta-button:hover {
    color: #031822;
}

.post-body .post-cta-actions .pill-link {
    color: var(--text);
    text-decoration: none;
}

/* Signoff */
.post-sign {
    color: var(--muted);
    font-style: italic;
    margin-top: 30px;
}

/* Data tables: wrap in .table-wrap so wide tables scroll on small screens
   instead of stretching the page. */
.post-body .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 24px 0;
    border-radius: var(--radius-md);
    box-shadow: var(--inset);
    scrollbar-color: var(--link) transparent;
    scrollbar-width: thin;
}

.post-body table {
    border-collapse: collapse;
    width: 100%;
    min-width: 560px;
}

.post-body th {
    font-family: "Geist Mono", monospace;
    font-size: calc(0.78rem * var(--reading-scale));
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid rgb(138 155 184 / 0.35);
}

.post-body td {
    padding: 10px 14px;
    font-size: calc(0.95rem * var(--reading-scale));
    border-bottom: 1px solid rgb(138 155 184 / 0.18);
}

.post-body th.num,
.post-body td.num {
    text-align: right;
}

.post-body td.num {
    font-family: "Geist Mono", monospace;
    font-variant-numeric: tabular-nums;
}

.post-body .table-note {
    color: var(--muted);
    font-size: calc(0.85rem * var(--reading-scale));
    margin-top: 10px;
}

/* Audited campaign traces stay readable and accessible at every viewport
   instead of baking dense text into an image. */
.trace-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin: 26px 0 32px;
}

.trace-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    padding: 24px;
    border: 1px solid rgb(138 155 184 / 0.2);
    border-radius: var(--radius-lg);
    background: var(--surface-alt);
    box-shadow: var(--extruded-small);
}

.trace-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-secondary), transparent);
    box-shadow: 0 0 12px rgb(167 139 250 / 0.42);
}

.trace-card--physics::before {
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    box-shadow: 0 0 12px rgb(34 211 238 / 0.44);
}

.post-body .trace-eyebrow {
    margin-bottom: 4px;
    color: var(--muted);
    font-family: "Geist Mono", monospace;
    font-size: calc(0.76rem * var(--reading-scale));
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.post-body .trace-card h3 {
    margin: 0 0 20px;
    font-size: calc(1.18rem * var(--reading-scale));
    line-height: 1.3;
}

.post-body .trace-steps {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.post-body .trace-step {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    margin: 0;
    padding: 0 0 18px;
}

.post-body .trace-step:last-child {
    padding-bottom: 0;
}

.trace-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--accent-secondary);
    background: var(--surface);
    box-shadow: var(--inset);
    font-family: "Geist Mono", monospace;
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.trace-card--physics .trace-step-number {
    color: var(--link);
}

.post-body .trace-step p {
    min-width: 0;
    margin: 0;
    padding-top: 3px;
    font-size: calc(0.94rem * var(--reading-scale));
    line-height: 1.58;
}

.post-body .trace-card code {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.post-body .trace-caveat {
    margin: 20px 0 0;
    padding-top: 16px;
    border-top: 1px solid rgb(138 155 184 / 0.24);
    color: var(--muted);
    font-size: calc(0.86rem * var(--reading-scale));
    line-height: 1.55;
}

/* Blog index cards */
.post-list {
    display: grid;
    gap: 24px;
    max-width: 860px;
    margin: 38px auto 0;
    text-align: left;
}

.post-card {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--extruded-small);
    transition: transform var(--transition), box-shadow var(--transition);
}

/* Accent top line, like the homepage metric cards. z-index keeps it above the
   preview image. */
.post-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    z-index: 1;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.5);
}

.post-card:nth-child(2)::before {
    background: linear-gradient(90deg, transparent, var(--accent-secondary), transparent);
    box-shadow: 0 0 12px rgb(167 139 250 / 0.42);
}

/* Full-width banner. The article images are wide, information-dense figures,
   so show each one whole at its natural aspect rather than cropping it. */
.post-card-media {
    overflow: hidden;
    background: var(--surface-alt);
    border-bottom: 1px solid rgb(34 211 238 / 0.14);
    line-height: 0;
}

.post-card-media img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform var(--transition);
}

.post-card:hover .post-card-media img {
    transform: scale(1.02);
}

.post-card-body {
    padding: 22px 26px 24px;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--extruded-hover);
}

.post-card:focus-visible {
    box-shadow: var(--focus-ring), var(--extruded-hover);
}

.post-card time {
    color: var(--muted);
    font-family: "Geist Mono", monospace;
    font-size: 0.82rem;
}

.post-card h2 {
    font-size: 1.35rem;
    margin: 8px 0 10px;
}

.post-card p {
    color: var(--muted);
    font-size: 0.98rem;
    margin-bottom: 12px;
}

.post-card .read-more {
    color: var(--link);
    font-weight: 700;
    font-size: 0.92rem;
}

/* Subscribe box */
.subscribe-box {
    max-width: 640px;
    margin: 44px auto 0;
    padding: 26px 28px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--inset);
    text-align: center;
}

.subscribe-box h2 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.subscribe-box > p {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.subscribe-form {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.subscribe-form input[type="email"] {
    flex: 1 1 220px;
    max-width: 340px;
    min-height: 48px;
    padding: 12px 18px;
    border: 0;
    border-radius: 999px;
    background: rgb(10 16 30 / 0.55);
    box-shadow: var(--inset);
    color: var(--text);
    font: inherit;
}

.subscribe-form input[type="email"]::placeholder {
    color: var(--muted);
}

.subscribe-form input[type="email"]:focus-visible {
    box-shadow: var(--focus-ring), var(--inset);
}

.subscribe-button,
.post-body .post-cta-button {
    min-height: 48px;
    padding: 12px 22px;
    border-radius: 999px;
    color: #031822;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    box-shadow: 0 16px 34px rgba(34, 211, 238, 0.24), var(--extruded-small);
    font-weight: 800;
    line-height: 1.15;
    transition: transform var(--transition), box-shadow var(--transition);
}

.subscribe-button:hover,
.post-body .post-cta-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 42px rgba(34, 211, 238, 0.30), var(--extruded-hover);
}

.subscribe-note {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 12px;
}

/* Compact signup on the blog index: keep it central but small, so it does not
   push the articles down. The end-of-article boxes keep the fuller version. */
.page-head .subscribe-box {
    max-width: 560px;
    margin-top: 22px;
    padding: 16px 24px;
}

.page-head .subscribe-box h2 {
    font-size: 1.12rem;
    margin-bottom: 12px;
}

.page-head .subscribe-box .subscribe-note {
    margin-top: 10px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Footer chrome, copied from index.html */
.pill-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 999px;
    box-shadow: var(--extruded-small);
    color: var(--text);
    font-weight: 700;
    transition: transform var(--transition), box-shadow var(--transition);
}

.pill-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--extruded-hover);
}

footer {
    margin: 34px 0 40px;
    padding: 22px 28px;
}

.footer-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.footer-logo {
    display: block;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

.footer-brand strong {
    font-family: "Geist Mono", monospace;
    font-weight: 600;
    letter-spacing: 0.14em;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-email {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--muted);
    box-shadow: var(--inset);
    font-size: 0.96rem;
    transition: color var(--transition), transform var(--transition);
}

.footer-email:hover {
    color: var(--text);
    transform: translateY(-1px);
}

/* Responsive, mirroring index.html breakpoints */
@media (max-width: 900px) {
    .trace-pair {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 840px) {
    header {
        border-radius: 28px;
    }

    nav {
        padding-left: 18px;
        padding-right: 18px;
    }
}

@media (max-width: 640px) {
    .site-shell,
    header {
        width: min(calc(100% - 20px), var(--blog-col));
    }

    header {
        top: 10px;
        margin-top: 10px;
    }

    nav {
        min-height: 60px;
        padding: 14px;
        justify-content: center;
    }

    .nav-cta,
    .nav-link {
        display: none;
    }

    main {
        padding-top: 28px;
    }

    section,
    footer {
        border-radius: 28px;
    }

    .page-head,
    .post {
        padding: 26px 22px 28px;
    }

    .trace-card {
        padding: 20px 18px;
        border-radius: var(--radius-md);
    }

    .post-body .trace-step {
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 10px;
    }

    .trace-step-number {
        width: 34px;
        height: 34px;
    }

    /* Dense evidence figures need a readable type floor on phones. Keep the
       figure at article width and let readers swipe, or tap through to the
       native-resolution asset. */
    .post-body figure.figure-data {
        margin-left: -22px;
        margin-right: -22px;
        padding-bottom: 10px;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-color: var(--accent) var(--surface-alt);
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .figure-data .figure-hint {
        display: block;
        position: sticky;
        left: 0;
        width: max-content;
        z-index: 2;
        margin: 0 22px 9px;
        padding: 5px 9px;
        border-radius: 999px;
        color: var(--text);
        background: var(--surface-alt);
        box-shadow: var(--inset);
        font-family: "Geist Mono", monospace;
        font-size: 0.72rem;
        line-height: 1.4;
    }

    .figure-data > a,
    .figure-data > figcaption {
        display: block;
        width: 760px;
        max-width: none;
        margin-left: 22px;
    }

    .post-body .figure-data > a img {
        width: 760px;
        max-width: none;
    }

    .figure-data > figcaption {
        padding-right: 22px;
        text-align: left;
    }

    .reading-prefs {
        justify-content: flex-start;
        margin-top: -6px;
    }

    .subscribe-form input[type="email"] {
        max-width: 100%;
    }

    .footer-links {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .footer-layout {
        align-items: stretch;
    }
}

/* Staggered entrance, matching the homepage hero */
@media (prefers-reduced-motion: no-preference) {
    .post-kicker,
    .page-head h1,
    .post h1,
    .post-meta,
    .page-lede {
        opacity: 0;
        animation: heroRise 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .post-kicker {
        animation-delay: 0.1s;
    }

    .page-head h1,
    .post h1 {
        animation-delay: 0.16s;
    }

    .post-meta,
    .page-lede {
        animation-delay: 0.3s;
    }

    .post-card {
        opacity: 0;
        animation: heroRise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .post-card:nth-child(1) {
        animation-delay: 0.38s;
    }

    .post-card:nth-child(2) {
        animation-delay: 0.48s;
    }

    .post-card:nth-child(3) {
        animation-delay: 0.58s;
    }
}

@keyframes heroRise {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1024px) {
    /* Centered layout has no usable gutters below this width, matching index.html. */
    .bg-molecules {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    body::before,
    body::after,
    .bg-mol {
        animation: none;
    }
}

/* ============================================================
   Light reading theme, applied via html[data-theme="light"]
   (set by the head snippet + reading-prefs widget).
   Contrast-checked: text 13.7:1, muted 4.6:1, links 5.05:1.
   ============================================================ */
html[data-theme="light"] {
    --bg: #e9eef6;
    --surface: #e9eef6;
    --surface-alt: #dfe7f2;
    --text: #16213a;
    --muted: #5b6b86;
    /* accent tokens stay cyan: they paint gradients with dark text and
       decorative lines, both fine on light. Text accents use --link. */
    --shadow-dark: rgb(148 163 190 / 0.55);
    --shadow-light: rgb(255 255 255 / 0.9);
    --extruded-hover: 12px 12px 20px rgb(148 163 190 / 0.62), -12px -12px 20px rgb(255 255 255 / 0.95);
    --extruded-small: 5px 5px 10px rgb(148 163 190 / 0.5), -5px -5px 10px rgb(255 255 255 / 0.85);
    --inset: inset 6px 6px 10px rgb(148 163 190 / 0.5), inset -6px -6px 10px rgb(255 255 255 / 0.85);
    --inset-deep: inset 10px 10px 20px rgb(148 163 190 / 0.58), inset -10px -10px 20px rgb(255 255 255 / 0.9);
    --link: #0c6e82;
    --link-hover: #095e70;
    --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--link);
    color-scheme: light;
}

html[data-theme="light"] {
    background:
        radial-gradient(125% 85% at 80% -12%, rgba(34, 211, 238, 0.14), transparent 55%),
        radial-gradient(90% 75% at 4% 112%, rgba(167, 139, 250, 0.10), transparent 55%),
        var(--bg);
}

html[data-theme="light"] ::selection {
    background: rgb(34 211 238 / 0.4);
    color: #0b1020;
}

html[data-theme="light"] header {
    background: rgb(233 238 246 / 0.85);
}

/* The brand mark SVG has a hardcoded white fill; invert it dark on light.
   Invert first so the cyan drop shadow keeps its own color. */
html[data-theme="light"] .brand-logo {
    filter: invert(0.86) drop-shadow(0 4px 14px rgba(34, 211, 238, 0.3));
}

html[data-theme="light"] .footer-logo {
    filter: invert(0.86);
}

html[data-theme="light"] .page-head,
html[data-theme="light"] .post {
    background:
        radial-gradient(72% 92% at 82% 8%, rgba(34, 211, 238, 0.08), transparent 60%),
        linear-gradient(rgba(22, 33, 58, 0.05) 1px, transparent 1px) 0 0 / 46px 46px,
        linear-gradient(90deg, rgba(22, 33, 58, 0.05) 1px, transparent 1px) 0 0 / 46px 46px,
        var(--surface);
}

html[data-theme="light"] .kicker-strong {
    color: #16213a;
    text-shadow: 0 0 18px rgba(34, 211, 238, 0.3);
}

html[data-theme="light"] .page-head h1,
html[data-theme="light"] .post h1 {
    background: linear-gradient(176deg, #101a30 0%, #1b2a4c 62%, #123249 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 22px rgba(34, 211, 238, 0.14));
}

html[data-theme="light"] .subscribe-form input[type="email"] {
    background: rgb(255 255 255 / 0.66);
}

html[data-theme="light"] .post-card::before {
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.35);
}

html[data-theme="light"] .post-body hr {
    background: rgb(22 33 58 / 0.16);
}

html[data-theme="light"] .post-body th {
    border-bottom-color: rgb(22 33 58 / 0.28);
}

html[data-theme="light"] .post-body td {
    border-bottom-color: rgb(22 33 58 / 0.14);
}
