:root {
    color-scheme: dark;
    --bg: #111611;
    --surface: #1b211b;
    --surface-2: #232a22;
    --ink: #f1f1e8;
    --muted: #a9b2a6;
    --faint: #7f8a7c;
    --line: rgba(226, 239, 214, .13);
    --lime: #d0fb70;
    --lime-ink: #111611;
    --orange: #ed9868;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: light) {
    :root {
        color-scheme: light;
        --bg: #f3f0e6;
        --surface: #e9e5d9;
        --surface-2: #dfdacc;
        --ink: #20271f;
        --muted: #586254;
        --faint: #6f786a;
        --line: rgba(32, 39, 31, .14);
        --lime: #657b36;
        --lime-ink: #f3f0e6;
        --orange: #ae603e;
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

a:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--lime);
    outline-offset: 3px;
    border-radius: 6px;
}

.wrap {
    width: min(1080px, 100% - 32px);
    margin-inline: auto;
}

/* ------------------------------------------------ top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.topbar .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-block: 14px;
}

.brand {
    font-weight: 800;
    text-decoration: none;
    letter-spacing: -.01em;
}

.back {
    font-size: .9rem;
    color: var(--muted);
    text-decoration: none;
}

.back:hover {
    color: var(--ink);
}

/* ------------------------------------------------ hero */
.hero {
    padding: clamp(48px, 9vw, 96px) 0 40px;
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: clamp(32px, 5vw, 64px);
    align-items: center;
}

.kicker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin: 0 0 18px;
    font-family: var(--mono);
    font-size: .75rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--lime);
}

.live::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 25%, transparent);
}

h1 {
    margin: 0 0 18px;
    font-size: clamp(2.4rem, 6.4vw, 4.4rem);
    line-height: 1.02;
    letter-spacing: -.035em;
    font-weight: 800;
    text-wrap: balance;
}

h1 em {
    font-style: normal;
    color: var(--lime);
}

.lede {
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
    color: var(--muted);
    max-width: 38rem;
    margin: 0 0 28px;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.meta li {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: .82rem;
    color: var(--muted);
}

.paper {
    margin: 0;
    justify-self: center;
    width: min(100%, 400px);
}

.paper img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .45), 0 0 0 1px var(--line);
    transform: rotate(1.5deg);
}

.paper figcaption {
    margin-top: 16px;
    font-size: .8rem;
    color: var(--faint);
    text-align: center;
}

/* ------------------------------------------------ stats */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    margin: 24px 0 8px;
}

.stat {
    padding: 22px 20px;
    border-right: 1px solid var(--line);
}

.stat:last-child {
    border-right: 0;
}

.stat b {
    display: block;
    font-size: clamp(1.6rem, 3.4vw, 2.2rem);
    line-height: 1.1;
    letter-spacing: -.03em;
    color: var(--lime);
    font-variant-numeric: tabular-nums;
}

.stat span {
    font-size: .85rem;
    color: var(--muted);
}

.stats-note {
    font-size: .8rem;
    color: var(--faint);
    margin: 0 0 8px;
}

/* ------------------------------------------------ sections */
section {
    padding: clamp(48px, 7vw, 80px) 0 0;
}

.label {
    font-family: var(--mono);
    font-size: .75rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--orange);
    margin: 0 0 10px;
}

h2 {
    margin: 0 0 16px;
    font-size: clamp(1.7rem, 3.6vw, 2.4rem);
    line-height: 1.12;
    letter-spacing: -.025em;
    text-wrap: balance;
}

h3 {
    margin: 0 0 8px;
    font-size: 1.08rem;
    letter-spacing: -.01em;
}

p {
    margin: 0 0 16px;
}

.prose {
    max-width: 46rem;
    color: var(--muted);
}

.prose strong {
    color: var(--ink);
}

code {
    font-family: var(--mono);
    font-size: .85em;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--ink);
}

/* problem / approach */
.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 24px;
}

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

.card p,
.card li {
    color: var(--muted);
}

.card ul {
    margin: 0;
    padding-left: 1.1rem;
}

.card li+li {
    margin-top: 6px;
}

/* pipeline */
.pipeline {
    list-style: none;
    margin: 28px 0 0;
    padding: 0;
    display: grid;
    gap: 12px;
    counter-reset: step;
}

.pipeline li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 4px 18px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.pipeline li::before {
    content: counter(step, decimal-leading-zero);
    grid-row: span 2;
    font-family: var(--mono);
    font-size: 1.3rem;
    color: var(--lime);
    line-height: 1.4;
}

.pipeline h3 {
    margin: 0;
}

.pipeline p {
    margin: 0;
    color: var(--muted);
    font-size: .95rem;
}

/* grounding checks */
.checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
    margin-top: 28px;
}

.checks .card {
    padding: 20px;
}

.checks .card p {
    font-size: .92rem;
}

.tag {
    display: inline-block;
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--lime);
    margin-bottom: 8px;
}

.callout {
    margin-top: 20px;
    padding: 18px 22px;
    border-left: 3px solid var(--lime);
    background: var(--surface);
    border-radius: 0 14px 14px 0;
    color: var(--muted);
}

.callout strong {
    color: var(--ink);
}

/* delivery diagram */
.flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 28px 0 8px;
    font-family: var(--mono);
    font-size: .82rem;
}

.flow span {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.flow span.hot {
    border-color: var(--lime);
    color: var(--lime);
}

.flow i {
    font-style: normal;
    color: var(--faint);
}

/* tables */
.table-wrap {
    overflow-x: auto;
    margin-top: 24px;
    border: 1px solid var(--line);
    border-radius: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .93rem;
    min-width: 520px;
}

th,
td {
    text-align: left;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

tr:last-child td {
    border-bottom: 0;
}

th {
    font-size: .75rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--faint);
    font-weight: 600;
    background: var(--surface);
}

td {
    color: var(--muted);
}

td:first-child {
    color: var(--ink);
    font-weight: 600;
    white-space: nowrap;
}

/* stack chips */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}

.chips li {
    padding: 7px 13px;
    border-radius: 999px;
    background: var(--surface-2);
    font-size: .85rem;
}

/* decisions */
details {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    margin-top: 10px;
}

summary {
    cursor: pointer;
    padding: 16px 20px;
    font-weight: 700;
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: "+";
    font-family: var(--mono);
    color: var(--lime);
}

details[open] summary::after {
    content: "−";
}

details p {
    padding: 0 20px 18px;
    margin: 0;
    color: var(--muted);
}

/* closing */
.closing {
    margin: clamp(56px, 8vw, 96px) 0 0;
    padding: clamp(28px, 5vw, 48px);
    border-radius: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.closing h2 {
    margin: 0 0 6px;
}

.closing p {
    margin: 0;
    color: var(--muted);
    max-width: 34rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    display: inline-block;
    padding: .8rem 1.4rem;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
    transition: transform .18s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn.primary {
    background: var(--lime);
    color: var(--lime-ink);
}

.btn.ghost {
    border: 1px solid var(--line);
}

footer {
    padding: 48px 0 40px;
    color: var(--faint);
    font-size: .82rem;
}

@media (max-width: 860px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .paper {
        width: min(100%, 340px);
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat:nth-child(2) {
        border-right: 0;
    }

    .stat:nth-child(-n+2) {
        border-bottom: 1px solid var(--line);
    }

    .split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .pipeline li {
        grid-template-columns: 1fr;
    }

    .pipeline li::before {
        grid-row: auto;
    }
}

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

    .btn {
        transition: none;
    }

    .btn:hover {
        transform: none;
    }
}

/* ------------------------------------------------ shared additions */
.code-panel {
    margin: 0;
    width: 100%;
    background: #0b0f0b;
    color: #dfe8d6;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}

.code-panel .bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(226, 239, 214, .12);
    font-family: var(--mono);
    font-size: .75rem;
    color: #8f9a8b;
}

.code-panel .bar i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff5f57;
}

.code-panel .bar i:nth-child(2) { background: #febc2e; }
.code-panel .bar i:nth-child(3) { background: #28c840; margin-right: 8px; }

.code-panel pre {
    margin: 0;
    padding: 18px 20px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: .78rem;
    line-height: 1.7;
}

.code-panel .c { color: #7f8a7c; }
.code-panel .k { color: #d0fb70; }
.code-panel .s { color: #ed9868; }

.code-panel figcaption {
    padding: 0 20px 16px;
    font-size: .78rem;
    color: #8f9a8b;
}

.repos {
    list-style: none;
    margin: 24px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.repos li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 16px;
    align-items: baseline;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.repos a {
    font-family: var(--mono);
    font-weight: 500;
    color: var(--lime);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.repos a:hover { text-decoration: underline; }

.repos .vis {
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.repos p {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: .93rem;
}

.note {
    margin-top: 16px;
    font-size: .85rem;
    color: var(--faint);
}

.next {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 28px;
    font-size: .9rem;
}

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

.next a:hover { color: var(--ink); }

.repos li > span:first-child {
    font-family: var(--mono);
    font-weight: 500;
}
