*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    /* Warm OKLCH palette */
    --bg: oklch(0.985 0.005 85);
    --bg-elevated: oklch(0.99 0.004 85);
    --surface: oklch(0.955 0.008 80);
    --surface-2: oklch(0.93 0.012 75);
    --ink: oklch(0.18 0.015 55);
    --ink-muted: oklch(0.45 0.012 55);
    --ink-faint: oklch(0.62 0.008 60);
    --line: oklch(0.88 0.008 75);
    --line-strong: oklch(0.78 0.01 70);
    --accent: oklch(0.55 0.135 45);
    --accent-soft: oklch(0.93 0.05 60);
    --accent-ink: oklch(0.42 0.13 45);
    --signal: oklch(0.7 0.16 145);

    /* Type */
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-article-heading: 'General Sans', var(--font-sans);
    --font-article-body: 'Quicksand', var(--font-sans);
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Rhythm */
    --site-header-height: 64px;
    --article-sticky-gap: 24px;
    --article-scroll-offset: 132px;

    /* Motion */
    --ease-out: cubic-bezier(0.2, 0, 0, 1);
    --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
}

@supports not (color: oklch(0 0 0)) {
    :root {
        --bg: #faf7f2;
        --bg-elevated: #fcfaf6;
        --surface: #f1ece4;
        --surface-2: #e8e1d5;
        --ink: #1f1b15;
        --ink-muted: #6b5f4f;
        --ink-faint: #9b8f7c;
        --line: #ddd5c4;
        --line-strong: #c4b9a3;
        --accent: #b6603c;
        --accent-soft: #f1e2d3;
        --accent-ink: #8a4423;
        --signal: #5ea562;
    }
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    font-feature-settings: "ss01", "cv11";
    line-height: 1.6;
    letter-spacing: -0.005em;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
    opacity: 0.045;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: multiply;
}

main, header, footer {
    position: relative;
    z-index: 2;
}

a { color: inherit; }
p, h1, h2, h3, h4 { margin: 0; }

::selection {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.skip-link {
    position: absolute;
    left: 16px;
    top: 12px;
    z-index: 20;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--bg);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transform: translateY(-140%);
    transition: transform 200ms var(--ease-out);
}

.skip-link:focus {
    transform: translateY(0);
    outline: none;
}

/* Floating pill header */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    justify-content: center;
    pointer-events: none;
    padding: 18px 16px 0;
    transition: padding-top 360ms var(--ease-spring);
}

.site-header.is-scrolled {
    padding-top: 12px;
}

.nav-pill {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    padding: 5px 10px 5px 4px;
    background: color-mix(in oklch, var(--bg-elevated) 70%, transparent);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border: 1px solid color-mix(in oklch, var(--line) 70%, transparent);
    border-radius: 999px;
    box-shadow:
        0 1px 0 color-mix(in oklch, var(--ink) 3%, transparent),
        0 12px 32px -24px color-mix(in oklch, var(--ink) 18%, transparent);
    transition:
        padding 380ms var(--ease-spring),
        background-color 280ms var(--ease-out),
        border-color 280ms var(--ease-out),
        box-shadow 380ms var(--ease-out),
        transform 380ms var(--ease-spring);
    will-change: transform;
}

.site-header.is-scrolled .nav-pill {
    padding: 4px 9px 4px 4px;
    background: color-mix(in oklch, var(--bg-elevated) 88%, transparent);
    border-color: color-mix(in oklch, var(--line) 95%, transparent);
    box-shadow:
        0 1px 0 color-mix(in oklch, var(--ink) 5%, transparent),
        0 18px 44px -22px color-mix(in oklch, var(--ink) 28%, transparent);
    transform: translateY(-1px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 3px 12px 3px 4px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: -0.012em;
    font-size: 14px;
    border-radius: 999px;
    transition: background-color 220ms var(--ease-out);
}

.brand:hover,
.brand:focus-visible {
    background: color-mix(in oklch, var(--surface) 55%, transparent);
    outline: none;
}

.brand-mark {
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 7px;
    background: var(--ink);
    color: var(--bg);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
}

.brand-name {
    overflow: hidden;
    white-space: nowrap;
    max-width: 220px;
    transition:
        max-width 380ms var(--ease-spring),
        opacity 260ms var(--ease-out),
        margin-right 380ms var(--ease-spring);
}

.nav-divider {
    width: 1px;
    height: 16px;
    margin: 0 8px 0 4px;
    background: color-mix(in oklch, var(--line-strong) 55%, transparent);
}

.nav-links {
    position: relative;
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    isolation: isolate;
}

.nav-indicator {
    position: absolute;
    z-index: 0;
    top: 50%;
    left: 0;
    width: 0;
    height: 30px;
    border-radius: 999px;
    background: var(--surface);
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    will-change: transform, width, left;
    transition:
        left 460ms var(--ease-spring),
        width 460ms var(--ease-spring),
        opacity 240ms var(--ease-out),
        background-color 260ms var(--ease-out);
}

.nav-links a {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 5px 14px;
    border-radius: 999px;
    color: var(--ink-muted);
    text-decoration: none;
    transition: color 220ms var(--ease-out);
}

.nav-links a:hover,
.nav-links a:focus-visible {
    color: var(--ink);
    outline: none;
}

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

@media (prefers-reduced-motion: reduce) {
    .nav-pill,
    .nav-indicator,
    .brand-name,
    .site-header {
        transition: none !important;
    }
}

/* Containers */
.hero,
.section {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

/* Hero */
.hero {
    padding: 140px 0 88px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-elevated);
    color: var(--ink-muted);
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--signal);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--signal) 22%, transparent);
}

.hero-name {
    margin-top: 32px;
    font-size: clamp(52px, 9vw, 116px);
    line-height: 0.94;
    letter-spacing: -0.04em;
    font-weight: 600;
    text-wrap: balance;
    color: var(--ink);
}

.hero-lead {
    max-width: 640px;
    margin-top: 28px;
    color: var(--ink-muted);
    font-size: clamp(18px, 1.65vw, 22px);
    line-height: 1.55;
    text-wrap: pretty;
}

.hero-lead a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
    background-image: linear-gradient(var(--ink), var(--ink));
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 100% 1.5px;
    padding-bottom: 1px;
    transition: background-size 220ms var(--ease-out), color 220ms var(--ease-out), background-image 220ms var(--ease-out);
}

.hero-lead a:hover,
.hero-lead a:focus-visible {
    color: var(--accent-ink);
    background-image: linear-gradient(var(--accent-ink), var(--accent-ink));
    background-size: 100% 2px;
    outline: none;
}

/* Section primitives */
.section {
    padding: 88px 0;
}

.section-header {
    margin-bottom: 36px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.section-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink-faint);
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.section-eyebrow::before {
    content: "";
    width: 28px;
    height: 1px;
    background: var(--line-strong);
}

h2 {
    font-size: clamp(28px, 3vw, 38px);
    line-height: 1.1;
    letter-spacing: -0.025em;
    font-weight: 600;
    text-wrap: balance;
    color: var(--ink);
}

/* App library */
.app-library {
    list-style: none;
    margin: 0;
    padding: 8px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 28px 12px;
    justify-items: center;
}

.app-library > li {
    width: 100%;
    display: flex;
    justify-content: center;
}

.app-tile {
    position: relative;
    appearance: none;
    border: 0;
    background: transparent;
    padding: 10px 6px 12px;
    border-radius: 18px;
    color: var(--ink);
    cursor: pointer;
    text-align: center;
    font: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 140px;
    transition: transform 220ms var(--ease-spring);
}

.app-tile-icon {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: var(--bg-elevated);
    box-shadow:
        0 1px 0 color-mix(in oklch, var(--ink) 6%, transparent),
        0 16px 32px -18px color-mix(in oklch, var(--ink) 28%, transparent);
    transition: transform 260ms var(--ease-spring), box-shadow 260ms var(--ease-out);
}

.app-tile-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.app-tile-name {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-muted);
    letter-spacing: -0.005em;
    transition: color 200ms var(--ease-out);
}

.app-tile-dot {
    position: absolute;
    top: 6px;
    right: calc(50% - 56px);
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px color-mix(in oklch, var(--accent) 22%, transparent);
}

.app-tile:hover .app-tile-icon,
.app-tile:focus-visible .app-tile-icon {
    transform: translateY(-4px);
    box-shadow:
        0 1px 0 color-mix(in oklch, var(--ink) 8%, transparent),
        0 24px 40px -20px color-mix(in oklch, var(--ink) 34%, transparent);
}

.app-tile:hover .app-tile-name,
.app-tile:focus-visible .app-tile-name {
    color: var(--ink);
}

.app-tile:focus-visible {
    outline: none;
}

.app-tile:focus-visible .app-tile-icon {
    box-shadow:
        0 0 0 2px var(--bg),
        0 0 0 4px var(--accent),
        0 24px 40px -20px color-mix(in oklch, var(--ink) 34%, transparent);
}

.app-tile:active .app-tile-icon {
    transform: translateY(-1px) scale(0.97);
    transition-duration: 120ms;
}

/* App dialog */
.app-dialog {
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 24px;
    background: var(--bg-elevated);
    color: var(--ink);
    width: min(520px, calc(100% - 32px));
    max-height: calc(100dvh - 64px);
    box-shadow:
        0 1px 0 color-mix(in oklch, var(--ink) 8%, transparent),
        0 40px 80px -28px color-mix(in oklch, var(--ink) 36%, transparent),
        0 10px 28px -10px color-mix(in oklch, var(--ink) 20%, transparent);
    opacity: 0;
    transform: scale(0.96) translateY(10px);
    transition:
        opacity 220ms var(--ease-out),
        transform 280ms var(--ease-spring),
        overlay 220ms allow-discrete,
        display 220ms allow-discrete;
}

.app-dialog[open] {
    opacity: 1;
    transform: none;
}

@starting-style {
    .app-dialog[open] {
        opacity: 0;
        transform: scale(0.96) translateY(10px);
    }
}

.app-dialog::backdrop {
    background: color-mix(in oklch, var(--ink) 42%, transparent);
    backdrop-filter: blur(8px) saturate(0.9);
    -webkit-backdrop-filter: blur(8px) saturate(0.9);
    opacity: 0;
    transition:
        opacity 220ms var(--ease-out),
        overlay 220ms allow-discrete,
        display 220ms allow-discrete;
}

.app-dialog[open]::backdrop {
    opacity: 1;
}

@starting-style {
    .app-dialog[open]::backdrop {
        opacity: 0;
    }
}

.app-dialog article {
    position: relative;
    padding: 32px;
    max-height: calc(100dvh - 64px);
    overflow: auto;
    border-radius: 24px;
}

.app-dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    appearance: none;
    border: 0;
    background: var(--surface);
    color: var(--ink-muted);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.app-dialog-close:hover,
.app-dialog-close:focus-visible {
    background: var(--surface-2);
    color: var(--ink);
    outline: none;
}

.app-dialog-header {
    display: flex;
    gap: 18px;
    align-items: center;
    margin-bottom: 22px;
    padding-right: 40px;
}

.app-dialog-icon {
    width: 84px;
    height: 84px;
    border-radius: 20px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow:
        0 1px 0 color-mix(in oklch, var(--ink) 6%, transparent),
        0 10px 22px -10px color-mix(in oklch, var(--ink) 26%, transparent);
}

.app-dialog-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.app-dialog-header > div {
    min-width: 0;
}

.app-dialog-header h3 {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.022em;
    color: var(--ink);
    margin: 6px 0 4px;
}

.app-dialog-tagline {
    font-size: 14.5px;
    color: var(--ink-muted);
    line-height: 1.45;
    text-wrap: balance;
}

.app-dialog-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-muted);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.app-dialog-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ink-faint);
}

.app-dialog-status--active .app-dialog-status-dot {
    background: var(--accent);
}

.app-dialog-body {
    color: var(--ink-muted);
    font-size: 15.5px;
    line-height: 1.65;
    text-wrap: pretty;
}

.app-dialog-body p {
    margin: 0 0 12px;
}

.app-dialog-body p:last-child {
    margin-bottom: 0;
}

.app-dialog-actions {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
}

.app-dialog-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 12px;
    background: var(--ink);
    color: var(--bg);
    font-weight: 500;
    text-decoration: none;
    font-size: 14.5px;
    transition: transform 220ms var(--ease-spring);
}

.app-dialog-cta:hover,
.app-dialog-cta:focus-visible {
    transform: translate(2px, -2px);
    outline: none;
}

.app-dialog-cta i {
    font-size: 14px;
    line-height: 1;
}

/* Writing teaser list (home) + post list (blog index) */
.writing-list {
    display: flex;
    flex-direction: column;
}

.writing-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr) 24px;
    align-items: baseline;
    gap: 24px;
    padding: 22px 0;
    border-top: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
    transition: padding 220ms var(--ease-out);
}

.writing-row:last-child {
    border-bottom: 1px solid var(--line);
}

.writing-row:hover,
.writing-row:focus-visible {
    padding-left: 14px;
    outline: none;
}

.writing-date {
    color: var(--ink-faint);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    text-transform: uppercase;
}

.writing-title {
    font-size: 18px;
    line-height: 1.4;
    color: var(--ink);
    font-weight: 500;
    letter-spacing: -0.012em;
    text-wrap: balance;
    transition: color 200ms var(--ease-out);
}

.writing-row:hover .writing-title,
.writing-row:focus-visible .writing-title {
    color: var(--accent-ink);
}

.writing-arrow {
    display: inline-flex;
    align-items: center;
    color: var(--ink-faint);
    font-size: 18px;
    line-height: 1;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out), color 220ms var(--ease-out);
}

.writing-row:hover .writing-arrow,
.writing-row:focus-visible .writing-arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--accent-ink);
}

.writing-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    color: var(--ink-muted);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color 200ms var(--ease-out), gap 200ms var(--ease-out);
}

.writing-cta i,
.article-body .back-link i {
    font-size: 16px;
    line-height: 1;
}

.writing-cta:hover,
.writing-cta:focus-visible {
    color: var(--ink);
    gap: 12px;
    outline: none;
}

/* Blog index page */
.blog-header h1 {
    font-size: clamp(40px, 6vw, 68px);
    line-height: 1.0;
    letter-spacing: -0.035em;
    font-weight: 600;
    margin-top: 6px;
}

.blog-header p {
    margin-top: 20px;
    max-width: 540px;
    color: var(--ink-muted);
    font-size: 18px;
    text-wrap: pretty;
}

.post-list {
    margin-top: 56px;
    display: flex;
    flex-direction: column;
}

.post-row {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 32px;
    padding: 40px 0;
    border-top: 1px solid var(--line);
}

.post-row:last-child {
    border-bottom: 1px solid var(--line);
}

.post-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--ink-faint);
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}

.post-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.post-content h2 {
    font-size: clamp(22px, 2.3vw, 28px);
    line-height: 1.22;
    letter-spacing: -0.02em;
    font-weight: 600;
}

.post-title-link {
    color: var(--ink);
    text-decoration: none;
    background-image: linear-gradient(var(--ink), var(--ink));
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0 1.5px;
    padding-bottom: 2px;
    transition: background-size 260ms var(--ease-out), color 220ms var(--ease-out), background-image 220ms var(--ease-out);
}

.post-title-link:hover,
.post-title-link:focus-visible {
    color: var(--accent-ink);
    background-image: linear-gradient(var(--accent-ink), var(--accent-ink));
    background-size: 100% 2px;
    outline: none;
}

.post-excerpt {
    color: var(--ink-muted);
    font-size: 17px;
    line-height: 1.6;
    max-width: 66ch;
    text-wrap: pretty;
}

.post-content img {
    display: block;
    width: 100%;
    height: auto;
    margin: 10px 0 0;
    border-radius: 12px;
    background: var(--surface);
    outline: 1px solid rgba(0, 0, 0, 0.08);
    outline-offset: -1px;
}

/* Footer */
.site-footer {
    --footer-bg: #2c2827;
    --footer-ink: oklch(0.88 0.012 75);
    --footer-ink-muted: oklch(0.7 0.012 70);
    --footer-ink-faint: oklch(0.58 0.012 70);
    --footer-surface: oklch(0.27 0.012 55);
    margin-top: 72px;
    color: var(--footer-ink-muted);
    font-size: 14px;
    container-type: inline-size;
    background: linear-gradient(to bottom, transparent 56.27cqw, var(--footer-bg) 56.27cqw);
}

.site-footer-skyline {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    pointer-events: none;
    user-select: none;
}

.js .site-footer-skyline-wrap {
    width: 100%;
    aspect-ratio: 1672 / 941;
    overflow: hidden;
    background: linear-gradient(to bottom, transparent 80%, var(--footer-bg) 80%);
}

.js .site-footer-skyline-wrap .site-footer-skyline {
    will-change: transform;
}

.site-footer-inner {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.site-footer-left {
    color: var(--footer-ink-faint);
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.site-footer-links {
    display: flex;
    gap: 2px;
}

.site-footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--footer-ink-muted);
    text-decoration: none;
    font-weight: 500;
    transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.site-footer-links a i {
    font-size: 16px;
    line-height: 1;
}

.site-footer-links a:hover,
.site-footer-links a:focus-visible {
    color: var(--footer-ink);
    background: var(--footer-surface);
    outline: none;
}

/* Article layout */
.blog-layout {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(0, 680px) minmax(140px, 220px);
    justify-content: center;
    align-items: start;
    column-gap: clamp(28px, 4vw, 56px);
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 100px 0 96px;
}

.sidebar {
    grid-column: 1;
    width: 100%;
    min-width: 0;
}

.article-body {
    grid-column: 2;
    width: 100%;
    max-width: 680px;
    min-width: 0;
    font-family: var(--font-article-body);
    font-weight: 500;
    letter-spacing: 0;
}

.article-body .back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 36px;
    color: var(--ink-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: color 160ms var(--ease-out), gap 200ms var(--ease-out);
}

.back-link:hover,
.back-link:focus-visible {
    color: var(--ink);
    gap: 14px;
    outline: none;
}

.article-header {
    margin-bottom: 56px;
}

.article-meta {
    display: grid;
    gap: 4px;
    margin-top: 18px;
}

.article-meta-date,
.article-meta-author {
    margin: 0;
}

.article-meta-date {
    color: var(--ink-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}

.article-meta-author {
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.article-header h1 {
    margin: 0;
    font-family: var(--font-article-heading);
    font-size: clamp(32px, 4.6vw, 54px);
    line-height: 1.05;
    letter-spacing: 0;
    font-weight: 500;
    text-wrap: balance;
    color: var(--ink);
}

.article-header .lead {
    margin-top: 24px;
    font-family: var(--font-article-body);
    font-size: clamp(18px, 1.5vw, 22px);
    line-height: 1.55;
    font-weight: 500;
    color: var(--ink-muted);
    text-wrap: pretty;
}

.article-header img {
    display: block;
    width: 100%;
    height: auto;
    margin: 40px 0 0;
    border-radius: 14px;
    background: var(--surface);
    outline: 1px solid rgba(0, 0, 0, 0.08);
    outline-offset: -1px;
}

/* Article content */
.article-content {
    font-family: var(--font-article-body);
    font-size: 17px;
    line-height: 1.75;
    font-weight: 500;
    letter-spacing: 0;
}

.article-content img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    background: var(--surface);
    outline: 1px solid rgba(0, 0, 0, 0.08);
    outline-offset: -1px;
    margin: 24px 0;
}

.article-content h2 {
    font-family: var(--font-article-heading);
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: 0;
    font-weight: 500;
    margin-top: 64px;
    margin-bottom: 20px;
    color: var(--ink);
    scroll-margin-top: calc(var(--article-scroll-offset) + 16px);
}

.article-content h3 {
    font-family: var(--font-article-heading);
    font-size: 20px;
    line-height: 1.3;
    letter-spacing: 0;
    font-weight: 500;
    margin-top: 44px;
    margin-bottom: 16px;
    color: var(--ink);
    text-wrap: balance;
    scroll-margin-top: calc(var(--article-scroll-offset) + 16px);
}

.article-content p {
    margin-bottom: 22px;
    color: var(--ink);
    overflow-wrap: anywhere;
    text-wrap: pretty;
}

.article-content ul,
.article-content ol {
    margin-bottom: 24px;
    padding-left: 24px;
    color: var(--ink);
}

.article-content li {
    margin-bottom: 10px;
    overflow-wrap: anywhere;
}

.article-content li::marker {
    color: var(--ink-faint);
}

.table-scroll {
    margin: 32px 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.article-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.table-scroll > table {
    margin: 0;
    border: none;
    border-radius: 0;
    min-width: 100%;
}

.article-content th,
.article-content td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.article-content tr:last-child th,
.article-content tr:last-child td {
    border-bottom: none;
}

.article-content th {
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    font-size: 11.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.article-content td {
    color: var(--ink-muted);
}

.article-content a {
    color: var(--ink);
    text-decoration-color: color-mix(in oklch, var(--ink-faint) 70%, transparent);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
    transition: color 200ms var(--ease-out), text-decoration-color 200ms var(--ease-out);
}

.article-content a:hover,
.article-content a:focus-visible {
    color: var(--accent-ink);
    text-decoration-color: var(--accent-ink);
    outline: none;
}

.article-content code {
    padding: 1.5px 6px;
    border-radius: 5px;
    background: var(--surface);
    color: var(--accent-ink);
    font-family: var(--font-mono);
    font-size: 13.5px;
    overflow-wrap: anywhere;
}

.tldr {
    background: var(--surface);
    padding: 22px 26px;
    border-radius: 14px;
    margin-bottom: 40px;
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink-muted);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
}

.tldr strong {
    color: var(--ink);
    font-weight: 600;
}

.article-body blockquote {
    margin: 32px 0;
    padding: 4px 0 4px 22px;
    border-left: 2px solid var(--line-strong);
    color: var(--ink-muted);
    font-size: 17px;
    line-height: 1.65;
    font-style: italic;
    overflow-wrap: anywhere;
}

.article-body pre {
    margin: 24px 0;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 13px;
    line-height: 1.65;
    font-family: var(--font-mono);
}

.article-body pre code {
    background: none;
    padding: 0;
    color: var(--ink);
    font-size: inherit;
    overflow-wrap: normal;
    word-break: normal;
    white-space: inherit;
}

/* Sidebar TOC */
.sidebar-sticky {
    position: sticky;
    top: calc(var(--site-header-height) + var(--article-sticky-gap));
    max-height: calc(100svh - var(--site-header-height) - (var(--article-sticky-gap) * 2));
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

.sidebar-label {
    color: var(--ink-faint);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 14px;
    padding-left: 12px;
}

.section-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 1px solid var(--line);
}

.section-nav a {
    display: flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 12px;
    margin-left: -1px;
    border-left: 1px solid transparent;
    color: var(--ink-faint);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.45;
    text-decoration: none;
    text-wrap: pretty;
    transition: color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.section-nav a:hover,
.section-nav a:focus-visible {
    color: var(--ink);
    border-left-color: var(--ink-muted);
    outline: none;
}

.section-nav a.active,
.section-nav a[aria-current="location"] {
    color: var(--ink);
    border-left-color: var(--accent);
    border-left-width: 2px;
    font-weight: 600;
}

/* GSAP reveal helpers — only hide when JS is enabled */
.js .js-reveal {
    opacity: 0;
    transform: translateY(14px);
}

.js .js-reveal-ready {
    will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
    .js .js-reveal {
        opacity: 1;
        transform: none;
    }
    html { scroll-behavior: auto !important; }
}

/* Responsive */
@media (max-width: 900px) {
    .hero { padding: 112px 0 64px; }
    .section { padding: 64px 0; }
    .app-library { gap: 24px 8px; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
    .app-tile-icon { width: 84px; height: 84px; border-radius: 20px; }
    .app-tile-dot { right: calc(50% - 50px); }
    .app-dialog article { padding: 24px; }
    .app-dialog-header { gap: 14px; }
    .app-dialog-icon { width: 72px; height: 72px; border-radius: 18px; }
    .app-dialog-header h3 { font-size: 22px; }
    .post-row { grid-template-columns: 1fr; gap: 14px; padding: 28px 0; }
    .blog-layout {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 92px 0 64px;
    }
    .sidebar { grid-column: 1; order: 1; }
    .article-body { grid-column: 1; order: 2; }
    .sidebar-sticky {
        position: relative;
        top: 0;
        max-height: none;
        padding: 12px 14px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--bg-elevated);
        overflow: visible;
    }
    .sidebar-label {
        padding-left: 0;
        margin-bottom: 10px;
    }
    .section-nav {
        flex-direction: row;
        gap: 4px;
        overflow-x: auto;
        scrollbar-width: none;
        border-left: none;
        border-bottom: 1px solid var(--line);
        padding-bottom: 6px;
    }
    .section-nav::-webkit-scrollbar { display: none; }
    .section-nav a {
        flex: 0 0 auto;
        max-width: min(75vw, 240px);
        white-space: nowrap;
        margin-left: 0;
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 6px 10px;
    }
    .section-nav a.active,
    .section-nav a[aria-current="location"] {
        border-left: none;
        border-bottom-color: var(--accent);
    }
    .writing-row { grid-template-columns: 90px minmax(0, 1fr) 24px; gap: 14px; }
}

@media (max-width: 640px) {
    .hero { padding: 96px 0 40px; }
    .section { padding: 48px 0; }
    .site-header { padding: 12px 12px 0; }
    .site-header.is-scrolled { padding-top: 8px; }
    .brand-name {
        max-width: 0;
        opacity: 0;
        margin-right: -10px;
    }
    .nav-divider { margin: 0 4px 0 2px; }
    .site-footer { margin-top: 56px; }
    .site-footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px 0 32px;
    }
    .site-footer-links { flex-wrap: wrap; }
    .site-footer-links a { min-height: 44px; padding: 10px 12px; }
    .writing-row {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 18px 0;
    }
    .writing-row:hover,
    .writing-row:focus-visible { padding-left: 0; }
    .writing-arrow { display: none; }
    .article-body,
    .sidebar {
        max-width: calc(100vw - 24px);
    }
    .article-header,
    .article-content {
        width: 100%;
        max-width: calc(100vw - 24px);
        min-width: 0;
    }
    .article-header > *,
    .article-content > * {
        max-width: 100%;
    }
    .article-header { margin-bottom: 36px; }
    .article-header h1 {
        overflow-wrap: anywhere;
        text-wrap: pretty;
    }
    .article-header .lead { margin-top: 16px; }
    .article-header img { margin-top: 28px; border-radius: 10px; }
    .article-content { font-size: 16px; }
    .article-content h2 { font-size: 22px; margin-top: 48px; }
    .article-content h3 { font-size: 18px; margin-top: 32px; }
    .article-body pre { padding: 14px 16px; font-size: 12.5px; }
    .hero, .section {
        width: min(1120px, calc(100% - 24px));
    }
    .site-footer-inner {
        width: min(1120px, calc(100% - 24px));
    }
    .blog-layout {
        width: min(1120px, calc(100% - 24px));
        padding: 80px 0 56px;
    }
}

@media (max-width: 420px) {
    .hero-name { font-size: 44px; }
    .blog-header h1 { font-size: 38px; }
    .article-header h1 { font-size: 28px; }
    .post-content h2 { font-size: 20px; }
    .app-dialog-header h3 { font-size: 20px; }
}
