:root {
    color-scheme: light;
    --ink: #080808;
    --muted: #565656;
    --paper: #ffffff;
    --soft: #f8f8f8;
    --rule: #6f6f6f;
    --hairline: #d6d6d6;
    --control: #ffffff;
    --control-hover: #eeeeee;
    --focus: #b43f2e;
    --gutter: clamp(1rem, 1.55vw, 2rem);
    --serif: Georgia, "Times New Roman", serif;
    --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --ink: #f1eee7;
        --muted: #b8b2a8;
        --paper: #11110f;
        --soft: #1d1c19;
        --rule: #81776d;
        --hairline: #3a3631;
        --control: #171613;
        --control-hover: #25231f;
        --focus: #d99172;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --ink: #f1eee7;
    --muted: #b8b2a8;
    --paper: #11110f;
    --soft: #1d1c19;
    --rule: #81776d;
    --hairline: #3a3631;
    --control: #171613;
    --control-hover: #25231f;
    --focus: #d99172;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.45;
}

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

a:hover,
a:focus-visible {
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
}

.site-header,
.section,
.site-footer {
    width: calc(100vw - (var(--gutter) * 2));
    margin-inline: auto;
}

.site-header {
    position: relative;
    min-height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    border-bottom: 2px solid var(--rule);
}

.brand {
    font-family: var(--serif);
    font-size: clamp(1.35rem, 1.55vw, 2rem);
    line-height: 1;
}

.nav,
.action-list,
.site-footer nav,
.timeline-list,
.path-list,
.resource-list,
pre {
    font-family: var(--mono);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(1.2rem, 3vw, 3.6rem);
    flex-wrap: wrap;
}

.nav a {
    font-size: clamp(0.7rem, 0.75vw, 0.88rem);
    font-weight: 700;
}

.theme-toggle {
    width: 2.35rem;
    height: 2.35rem;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--control);
    color: var(--ink);
    cursor: pointer;
    font: 700 1rem/1 var(--mono);
}

.theme-toggle:hover {
    background: var(--control-hover);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
}

.theme-toggle span {
    transform: translateY(-0.02em);
}

.section {
    border-bottom: 2px solid var(--rule);
}

.hero {
    min-height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(34rem, 1fr);
    gap: clamp(3rem, 6vw, 6rem);
    align-items: center;
    padding: clamp(2.5rem, 3.2vw, 3rem) 0;
}

.hero-copy {
    min-width: 0;
}

h1,
h2 {
    margin: 0;
    font-family: var(--serif);
    font-weight: 500;
    letter-spacing: 0;
}

h1 {
    max-width: 20ch;
    font-size: clamp(4.2rem, 4vw, 5.15rem);
    line-height: 0.98;
}

h2 {
    font-size: clamp(2rem, 2.2vw, 3.05rem);
    line-height: 1.03;
}

h3 {
    margin: 0;
    font-size: clamp(0.95rem, 0.92vw, 1.12rem);
    line-height: 1.22;
}

p,
ul {
    margin: 0;
}

.lede {
    max-width: 36rem;
    margin-top: 2rem;
    font-size: clamp(1.03rem, 1.05vw, 1.35rem);
    line-height: 1.42;
}

.action-list {
    display: grid;
    gap: 1rem;
    margin-top: 1.8rem;
    font-size: clamp(0.78rem, 0.8vw, 0.96rem);
    font-weight: 700;
}

.intro {
    display: grid;
    grid-template-columns: minmax(18rem, 0.52fr) minmax(0, 0.48fr);
    gap: clamp(3rem, 7vw, 7rem);
    padding: clamp(2rem, 3vw, 3.5rem) 0;
}

.intro h2 {
    max-width: 16ch;
}

.intro-copy {
    display: grid;
    gap: 1.25rem;
    max-width: 44rem;
    font-size: clamp(1rem, 1.02vw, 1.22rem);
    font-weight: 700;
    line-height: 1.5;
}

.code-card {
    min-width: 0;
    background: var(--soft);
    border: 1px solid var(--hairline);
}

.hero-panel {
    align-self: center;
}

pre {
    margin: 0;
    padding: clamp(1rem, 1.35vw, 1.7rem);
    overflow: auto;
    white-space: pre;
    font-size: clamp(0.78rem, 0.78vw, 1rem);
    line-height: 1.55;
}

.core {
    display: grid;
    grid-template-columns: minmax(18rem, 0.36fr) minmax(0, 1fr);
    gap: clamp(4rem, 8vw, 8rem);
    align-items: start;
    padding: clamp(1.45rem, 1.8vw, 2.25rem) 0;
}

.core p {
    max-width: 32rem;
    margin-top: 1.5rem;
    font-size: clamp(0.9rem, 0.88vw, 1.08rem);
    font-weight: 700;
    line-height: 1.48;
}

.core pre {
    padding: 0.75rem 1rem;
    font-size: clamp(0.72rem, 0.66vw, 0.86rem);
    line-height: 1.35;
}

.layer-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1rem, 2vw, 2rem);
}

.layer-list article,
.component-grid article {
    min-width: 0;
    border-top: 1px solid var(--rule);
    padding-top: 1rem;
}

.layer-list p,
.component-grid p,
.guide-section p {
    color: var(--muted);
    font-size: clamp(0.88rem, 0.86vw, 1.04rem);
    font-weight: 700;
    line-height: 1.42;
}

.layer-list h3,
.component-grid h3 {
    margin-bottom: 0.62rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(2.25rem, 5vw, 6rem);
    padding: clamp(1.1rem, 1.45vw, 1.8rem) 0 clamp(1.55rem, 2vw, 2.35rem);
}

.feature-grid article {
    min-width: 0;
}

.feature-grid h2 {
    margin-bottom: 1rem;
}

.feature-grid p,
.resource-list span {
    color: var(--muted);
}

.feature-grid article > p {
    max-width: 24rem;
    margin-bottom: 1rem;
    font-size: clamp(0.86rem, 0.82vw, 1.02rem);
    font-weight: 700;
    line-height: 1.38;
}

.path-list,
.resource-list {
    list-style: none;
    padding: 0;
}

.path-list {
    display: grid;
    gap: 0.14rem;
    margin: 0.85rem 0 1rem;
    font-size: clamp(0.78rem, 0.78vw, 0.96rem);
    line-height: 1.45;
}

.feature-grid article > a,
.resource-list a {
    display: inline-block;
    font-weight: 700;
}

.terminal {
    margin: 0.45rem 0 0.55rem;
    border: 1px solid var(--hairline);
    background: var(--soft);
}

.terminal pre {
    padding: 0.85rem;
    font-size: clamp(0.62rem, 0.62vw, 0.76rem);
    line-height: 1.32;
}

.schema-link {
    margin-bottom: 1.6rem;
    overflow: visible;
    white-space: nowrap;
    font-size: clamp(0.46rem, 0.46vw, 0.56rem);
    font-weight: 700;
}

.timeline-list {
    display: grid;
    gap: 0.45rem;
    margin: 1.1rem 0 1.45rem;
    font-size: clamp(0.68rem, 0.7vw, 0.84rem);
    line-height: 1.35;
}

.timeline-list p {
    color: var(--ink);
}

.timeline-list span {
    display: inline-block;
    margin-right: 1rem;
}

.resource-list {
    display: grid;
    gap: 0.62rem;
    margin-bottom: 1.3rem;
    font-size: clamp(0.72rem, 0.74vw, 0.9rem);
    line-height: 1.25;
}

.resource-list li {
    display: grid;
    gap: 0.12rem;
}

.page-hero {
    padding: clamp(3rem, 5vw, 5rem) 0 clamp(2.4rem, 4vw, 4rem);
}

.page-hero h1 {
    max-width: 13ch;
}

.guide-section {
    display: grid;
    grid-template-columns: minmax(18rem, 0.36fr) minmax(0, 1fr);
    gap: clamp(3rem, 7vw, 7rem);
    align-items: start;
    padding: clamp(1.8rem, 2.6vw, 3.2rem) 0;
}

.guide-section h2 {
    margin-bottom: 1.25rem;
}

.component-detail {
    padding: clamp(1.8rem, 2.6vw, 3.2rem) 0;
}

.component-detail h2 {
    margin-bottom: clamp(1.4rem, 2vw, 2.4rem);
}

.component-reference {
    display: grid;
    gap: clamp(1.8rem, 3vw, 3.5rem);
}

.component-example {
    display: grid;
    grid-template-columns: minmax(16rem, 0.34fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
    min-width: 0;
    border-top: 1px solid var(--rule);
    padding-top: clamp(1.2rem, 1.6vw, 2rem);
}

.component-example > div:first-child {
    min-width: 0;
}

.component-example .code-card pre {
    max-height: 32rem;
    font-size: clamp(0.68rem, 0.7vw, 0.86rem);
    line-height: 1.42;
}

.component-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(1.2rem, 2.6vw, 3rem);
}

.full-example {
    padding: clamp(1.8rem, 2.6vw, 3.2rem) 0;
}

.full-example-heading {
    display: grid;
    grid-template-columns: minmax(16rem, 0.34fr) minmax(0, 0.66fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
    margin-bottom: clamp(1.4rem, 2vw, 2.4rem);
}

.full-example-heading p {
    max-width: 48rem;
    color: var(--muted);
    font-size: clamp(0.95rem, 0.95vw, 1.14rem);
    font-weight: 700;
    line-height: 1.46;
}

.full-example .code-card pre {
    max-height: 72rem;
    font-size: clamp(0.66rem, 0.68vw, 0.84rem);
    line-height: 1.4;
}

.terminal-large {
    margin: 0;
}

.terminal-large pre {
    font-size: clamp(0.82rem, 0.82vw, 1rem);
    line-height: 1.5;
}

.site-footer {
    min-height: 4.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    font-family: var(--mono);
    font-size: clamp(0.68rem, 0.7vw, 0.84rem);
}

.site-footer nav {
    display: flex;
    align-items: center;
    gap: clamp(0.8rem, 1.55vw, 2rem);
}

@media (min-width: 1600px) {
    .hero {
        grid-template-columns: minmax(0, 1.08fr) minmax(44rem, 0.92fr);
    }

    .core {
        grid-template-columns: minmax(24rem, 0.32fr) minmax(0, 1fr);
    }
}

@media (max-width: 1120px) {
    .hero,
    .core,
    .feature-grid,
    .intro,
    .guide-section,
    .component-example,
    .full-example-heading {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
        gap: 3rem;
    }

    h1 {
        font-size: clamp(4rem, 12vw, 7rem);
    }

    .feature-grid {
        gap: 3rem;
    }

    .layer-list,
    .component-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    :root {
        --gutter: 1rem;
    }

    body {
        font-size: 15px;
    }

    .site-header,
    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        padding: 1rem 0;
    }

    .theme-toggle {
        position: absolute;
        top: 1rem;
        right: 0;
    }

    .nav {
        justify-content: flex-start;
        gap: 0.8rem 1rem;
    }

    .hero {
        padding: 3rem 0;
    }

    h1 {
        font-size: clamp(3.5rem, 18vw, 5.8rem);
    }

    pre {
        white-space: pre-wrap;
        word-break: break-word;
    }

    .schema-link {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .layer-list,
    .component-grid {
        grid-template-columns: 1fr;
    }

    .feature-grid,
    .component-reference,
    .component-grid {
        gap: 4.25rem;
    }

    .feature-grid article > a,
    .resource-list + a {
        margin-top: 0.65rem;
    }

    .component-example,
    .guide-section,
    .full-example {
        padding-top: 2.6rem;
        padding-bottom: 2.6rem;
    }

    .site-footer nav {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}
