:root {
    --ink: #111827;
    --muted: #566074;
    --paper: #f4f1e8;
    --white: #ffffff;
    --yellow: #0073ba;
    --yellow-soft: #1684c8;
    --line: #62b6ea;
    --font-geist-sans: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-geist-mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
    scroll-padding-top: 2rem;
}
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-geist-sans), system-ui, sans-serif;
}
a {
    color: inherit;
}
code,
pre {
    font-family: var(--font-geist-mono), monospace;
}

.lesson-hero {
    position: relative;
    overflow: hidden;
    min-height: 760px;
    padding: 0 clamp(1.25rem, 5vw, 5rem) 5rem;
    background: radial-gradient(circle at 76% 26%, rgba(255, 224, 0, 0.2), transparent 22rem), var(--ink);
    color: var(--white);
}
.lesson-hero::after {
    position: absolute;
    right: -8rem;
    bottom: -12rem;
    width: 34rem;
    height: 34rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    content: "";
}
.lesson-nav {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}
.brand span {
    display: grid;
    width: 2.9rem;
    height: 2.9rem;
    border-radius: 50%;
    background: var(--yellow);
    color: var(--ink);
    font: 800 0.8rem/1 var(--font-geist-mono);
    place-items: center;
}
.brand strong {
    font-size: 0.95rem;
    letter-spacing: 0.04em;
}
.nav-links {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
}
.nav-links a {
    color: #d6d9e0;
    text-decoration: none;
}
.nav-links a:hover,
.nav-links a:focus-visible {
    color: var(--yellow);
}

.hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    align-items: center;
    grid-template-columns: minmax(0, 1.05fr) minmax(330px, 0.95fr);
    gap: clamp(3rem, 7vw, 7rem);
    max-width: 1280px;
    min-height: 640px;
    margin: 0 auto;
}
.eyebrow,
.section-number {
    margin: 0 0 1rem;
    color: #7d879b;
    font: 700 0.78rem/1.3 var(--font-geist-mono);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.eyebrow {
    color: var(--yellow);
}
.hero-copy h1 {
    max-width: 780px;
    margin: 0;
    font-size: clamp(3.5rem, 7vw, 6.9rem);
    letter-spacing: -0.065em;
    line-height: 0.96;
}
.hero-copy h1 em {
    color: var(--yellow);
    font-style: normal;
}
.hero-intro {
    max-width: 650px;
    margin: 2rem 0;
    color: #c7ccd6;
    font-size: clamp(1rem, 1.5vw, 1.22rem);
    line-height: 1.75;
}
.hero-intro code {
    color: var(--yellow);
}
.primary-link {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.15rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    text-decoration: none;
}
.primary-link span {
    color: var(--yellow);
    font-size: 1.2rem;
}

.hero-diagram {
    padding: 1.2rem;
    transform: rotate(2deg);
}
.diagram-window {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 1.3rem;
    background: #fafafa;
    color: var(--ink);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.38);
}
.diagram-fixed,
.diagram-sticky {
    display: flex;
    justify-content: center;
    padding: 0.65rem;
    font: 700 0.68rem/1 var(--font-geist-mono);
    letter-spacing: 0.08em;
}
.diagram-fixed {
    background: var(--yellow);
}
.diagram-hero {
    position: relative;
    display: grid;
    height: 210px;
    background: linear-gradient(135deg, #263247, #111827);
    color: white;
    font: 700 0.8rem var(--font-geist-mono);
    place-items: center;
}
.diagram-logo {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: grid;
    width: 3.5rem;
    height: 3.5rem;
    border: 2px solid var(--yellow);
    border-radius: 50%;
    color: var(--yellow);
    place-items: center;
}
.diagram-sticky {
    border-bottom: 1px solid #e5e7eb;
    background: white;
}
.diagram-content {
    padding: 1.4rem;
}
.diagram-content i {
    display: block;
    height: 7px;
    margin: 0.7rem 0;
    border-radius: 8px;
    background: #e5e7eb;
}
.diagram-content i:nth-child(2) {
    width: 78%;
}
.diagram-content i:nth-child(3) {
    width: 55%;
}

.section-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 7rem clamp(1.25rem, 5vw, 5rem);
}
.section-heading {
    max-width: 690px;
}
.section-heading h2,
.code-placeholder h2 {
    margin: 0;
    font-size: clamp(2.4rem, 4vw, 4.2rem);
    letter-spacing: -0.05em;
    line-height: 1.05;
}
.section-heading > p:last-child,
.code-placeholder > p:last-child {
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.75;
}
.concept-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 3.5rem;
}
.concept-card {
    display: flex;
    flex-direction: column;
    min-height: 330px;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.58);
}
.concept-card:nth-child(2) {
    background: var(--yellow);
}
.concept-topline {
    display: flex;
    justify-content: space-between;
    color: #7b8494;
    font: 700 0.72rem var(--font-geist-mono);
}
.concept-card:nth-child(2) .concept-topline {
    color: #403a00;
}
.concept-card h3 {
    margin: 3.4rem 0 0.8rem;
    font-size: 1.25rem;
}
.concept-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}
.concept-card:nth-child(2) p {
    color: #403a00;
}
.concept-card pre {
    margin: auto 0 0;
    padding-top: 1.5rem;
    color: #39445a;
    font-size: 0.72rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.preview-section {
    background: var(--white);
}
.preview-layout {
    display: grid;
    align-items: center;
    grid-template-columns: 0.75fr 1.25fr;
    gap: clamp(2rem, 6vw, 6rem);
    max-width: 1440px;
}
.try-list {
    display: grid;
    gap: 0.65rem;
    margin-top: 2rem;
    color: var(--muted);
    font: 600 0.83rem var(--font-geist-mono);
}
.browser-frame {
    overflow: hidden;
    border: 1px solid #cfd3da;
    border-radius: 1rem;
    background: white;
    box-shadow: 0 28px 80px rgba(17, 24, 39, 0.16);
}
.browser-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dfe2e7;
    background: #f1f3f6;
}
.browser-bar div {
    display: flex;
    gap: 0.35rem;
}
.browser-bar i {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    background: #b8bec9;
}
.browser-bar i:first-child {
    background: #ff6b63;
}
.browser-bar i:nth-child(2) {
    background: #ffcf4a;
}
.browser-bar i:nth-child(3) {
    background: #55c98b;
}
.browser-bar span {
    flex: 1;
    padding: 0.3rem 0.8rem;
    border-radius: 0.35rem;
    background: white;
    color: #8b93a1;
    font: 0.7rem var(--font-geist-mono);
}
.browser-frame iframe {
    display: block;
    width: 100%;
    height: 570px;
    border: 0;
}
.explanation-section .section-heading code,
.flex-section .section-heading code {
    color: #755f00;
}
.deep-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 3.5rem;
}
.deep-card {
    position: relative;
    overflow: hidden;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border: 1px solid var(--line);
    border-radius: 1.2rem;
    background: rgba(255, 255, 255, 0.62);
}
.deep-card::after {
    position: absolute;
    top: -3.5rem;
    right: -3.5rem;
    width: 9rem;
    height: 9rem;
    border: 1px solid rgba(17, 24, 39, 0.1);
    border-radius: 50%;
    content: "";
}
.deep-sticky {
    background: var(--yellow);
}
.deep-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font: 700 0.76rem var(--font-geist-mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.deep-label span {
    display: grid;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--ink);
    color: white;
    place-items: center;
}
.deep-card h3 {
    margin: 3rem 0 1rem;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    letter-spacing: -0.04em;
}
.deep-card > p {
    color: var(--muted);
    line-height: 1.75;
}
.deep-sticky > p {
    color: #403a00;
}
.deep-card dl {
    display: grid;
    gap: 0;
    margin: 2rem 0;
}
.deep-card dl div {
    display: grid;
    grid-template-columns: minmax(150px, 0.75fr) 1.25fr;
    gap: 1rem;
    padding: 0.9rem 0;
    border-top: 1px solid rgba(17, 24, 39, 0.12);
}
.deep-card dt,
.deep-card dd {
    margin: 0;
}
.deep-card dt {
    font-size: 0.8rem;
}
.deep-card dd {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}
.deep-sticky dd {
    color: #4a4300;
}
.warning-note {
    padding: 1rem 1.1rem;
    border-left: 3px solid var(--yellow);
    background: #111827;
    color: #e7eaf0;
    font-size: 0.86rem;
    line-height: 1.6;
}
.deep-sticky .warning-note {
    border-left-color: white;
}
.warning-note code {
    color: var(--yellow);
}

.flex-section {
    background: var(--yellow);
}
.flex-layout {
    display: grid;
    align-items: center;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 6rem;
    padding-bottom: 4rem;
}
.flex-section .section-number {
    color: #665900;
}
.flex-section .section-heading > p:last-child {
    color: #403a00;
}
.flex-lab {
    overflow: hidden;
    border: 1px solid #282600;
    border-radius: 1rem;
    background: #171d2a;
    color: white;
    box-shadow: 14px 14px 0 rgba(17, 24, 39, 0.14);
}
.flex-code {
    display: grid;
    gap: 0.45rem;
    padding: 1.6rem;
    font: 0.82rem/1.5 var(--font-geist-mono);
}
.flex-code strong {
    padding-left: 1.5rem;
    color: var(--yellow);
    font-weight: 500;
}
.flex-demo {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 2.2rem 1rem;
    background: white;
    color: var(--ink);
}
.flex-demo span {
    padding: 0.7rem 1rem;
    border: 1px solid #d4d7dd;
    border-radius: 999px;
    font-weight: 650;
}
.flex-guides {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #eef0f3;
    color: #657086;
    font: 0.65rem var(--font-geist-mono);
}
.flex-guides i {
    width: 4rem;
    border-top: 1px dashed #7b8495;
}
.property-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding-top: 0;
}
.property-strip article {
    padding: 1.5rem;
    border-top: 1px solid #a48f00;
    border-right: 1px solid #a48f00;
}
.property-strip article:last-child {
    border-right: 0;
}
.property-strip code {
    font-size: 0.76rem;
    font-weight: 700;
}
.property-strip p {
    margin: 1rem 0 0;
    color: #4b4300;
    font-size: 0.88rem;
    line-height: 1.6;
}

.compare-section {
    max-width: 1280px;
}
.table-wrap {
    overflow-x: auto;
    margin-top: 3rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: white;
}
.table-wrap table {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
}
.table-wrap th,
.table-wrap td {
    padding: 1.2rem 1.4rem;
    border-bottom: 1px solid #e2e0d9;
}
.table-wrap thead th {
    background: #161d2a;
    color: white;
    font: 600 0.72rem var(--font-geist-mono);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.table-wrap tbody tr:last-child th,
.table-wrap tbody tr:last-child td {
    border-bottom: 0;
}
.table-wrap tbody th code {
    color: #161d2a;
}
.table-wrap td {
    color: var(--muted);
}
.yes,
.no {
    display: inline-flex;
    justify-content: center;
    min-width: 2.8rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font: 700 0.7rem var(--font-geist-mono);
}
.yes {
    background: #d7f7e2;
    color: #17623a;
}
.no {
    background: #ffe1df;
    color: #9b2922;
}
.flow-rule {
    display: grid;
    align-items: start;
    grid-template-columns: 0.35fr 1.65fr;
    gap: 2rem;
    margin-top: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
}
.flow-rule strong {
    font: 700 0.78rem var(--font-geist-mono);
    text-transform: uppercase;
}
.flow-rule p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}
.flow-rule code {
    color: #6d5a00;
    font-weight: 700;
}

.code-section {
    background: #111827;
    color: white;
}
.code-section .section-number {
    color: var(--yellow);
}
.code-section .section-heading > p:last-child {
    color: #aeb5c2;
}
.code-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 2rem;
    margin-bottom: 3rem;
}
.file-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
}
.file-links a {
    padding: 0.7rem 1rem;
    border: 1px solid #384257;
    border-radius: 999px;
    color: #d9dde5;
    font-size: 0.8rem;
    text-decoration: none;
}
.file-links a:hover,
.file-links a:focus-visible {
    border-color: var(--yellow);
    color: var(--yellow);
}
.code-explorer {
    overflow: hidden;
    border: 1px solid #374154;
    border-radius: 1rem;
    background: #171d2a;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.code-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-bottom: 1px solid #374154;
    background: #202838;
}
.code-tabs {
    display: flex;
    gap: 0.35rem;
}
.code-tabs button,
.copy-button {
    border: 0;
    border-radius: 0.5rem;
    font: 600 0.75rem var(--font-geist-mono);
    cursor: pointer;
}
.code-tabs button {
    padding: 0.7rem 1rem;
    background: transparent;
    color: #9da6b6;
}
.code-tabs button[aria-selected="true"] {
    background: var(--yellow);
    color: #111827;
}
.copy-button {
    padding: 0.7rem 1rem;
    background: #303a4e;
    color: white;
}
.copy-button:hover,
.copy-button:focus-visible {
    background: #3c485f;
}
.code-area {
    overflow: auto;
    max-height: 760px;
}
.code-area pre[class*="language-"] {
    margin: 0;
    border-radius: 0;
    background: #171d2a;
    font-size: 0.78rem;
    line-height: 1.65;
}
.code-area code[class*="language-"] {
    text-shadow: none;
}
.code-error {
    margin: 0;
    padding: 1rem;
    border-top: 1px solid #374154;
    color: #ffb4ad;
    font-size: 0.86rem;
}

.checklist {
    margin: 3rem 0 0;
    padding: 0;
    list-style: none;
}
.checklist li {
    display: grid;
    align-items: center;
    grid-template-columns: 4rem 1fr;
    border-top: 1px solid var(--line);
}
.checklist li:last-child {
    border-bottom: 1px solid var(--line);
}
.checklist span {
    color: #8a8f99;
    font: 700 0.72rem var(--font-geist-mono);
}
.checklist p {
    margin: 0;
    padding: 1.4rem 0;
    font-size: 1.05rem;
}
.checklist code {
    color: #705b00;
    font-weight: 700;
}
.lesson-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 2.5rem clamp(1.25rem, 5vw, 5rem);
    background: #111827;
    color: white;
}
.lesson-footer span {
    color: var(--yellow);
    font-weight: 750;
}
.lesson-footer p {
    margin: 0.35rem 0 0;
    color: #929bac;
    font-size: 0.8rem;
}
.lesson-footer a {
    color: white;
    font-size: 0.85rem;
    text-decoration: none;
}

@media (max-width: 980px) {
    .hero-grid,
    .preview-layout {
        grid-template-columns: 1fr;
    }
    .hero-grid {
        padding-top: 4rem;
    }
    .hero-diagram {
        max-width: 620px;
    }
    .concept-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .flex-layout {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    .property-strip {
        grid-template-columns: repeat(2, 1fr);
    }
    .property-strip article:nth-child(2) {
        border-right: 0;
    }
}
@media (max-width: 620px) {
    .nav-links {
        display: none;
    }
    .lesson-hero {
        min-height: auto;
    }
    .hero-grid {
        min-height: auto;
        padding-bottom: 2rem;
    }
    .hero-copy h1 {
        font-size: clamp(3rem, 17vw, 5rem);
    }
    .hero-diagram {
        padding: 0;
    }
    .concept-grid {
        grid-template-columns: 1fr;
    }
    .deep-grid {
        grid-template-columns: 1fr;
    }
    .deep-card dl div {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }
    .property-strip {
        grid-template-columns: 1fr;
    }
    .property-strip article {
        border-right: 0;
    }
    .flow-rule {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    .code-heading,
    .lesson-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    .file-links {
        justify-content: flex-start;
    }
    .code-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }
    .copy-button {
        width: 100%;
    }
    .checklist li {
        grid-template-columns: 2.8rem 1fr;
    }
    .browser-frame iframe {
        height: 480px;
    }
}

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