/* ==========================================================================
   Base Design Tokens & Resets
   ========================================================================== */
:root {
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --color-bg: #ffffff;
    --color-text: #171717;
    --color-text-muted: #555555;
    --color-border: #e5e5e5;
    --color-border-light: #eeeeee;
    --color-code-bg: #f6f6f6;
    --color-note-bg: #f7f7f7;
    --color-accent: #111111;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Shared Shell: Header & Navigation
   ========================================================================== */
header {
    border-bottom: 1px solid var(--color-border);
    padding: 14px max(24px, calc((100% - 1050px) / 2));
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--color-bg);
    z-index: 10;
    flex-shrink: 0;
}

header > a {
    font-weight: 700;
    color: var(--color-accent);
    text-decoration: none;
    letter-spacing: -0.01em;
}

nav {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: center;
}

nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.15s ease;
}

nav a:hover {
    color: var(--color-accent);
}

nav a.active {
    color: var(--color-accent);
    font-weight: 600;
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 2px;
}

/* ==========================================================================
   Main Content Layout (Full-Viewport Centered Card)
   ========================================================================== */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
}

.hero {
    padding-bottom: 30px;
}

/* ==========================================================================
   Typography (Calibrated for Zero-Scroll Viewport Presentation)
   ========================================================================== */
.eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #666666;
    margin: 0 0 6px;
}

h1 {
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    line-height: 1.2;
    letter-spacing: -0.025em;
    margin: 8px 0 16px;
    color: var(--color-accent);
}

h2 {
    font-size: 1.15rem;
    margin-top: 18px;
    margin-bottom: 8px;
    line-height: 1.3;
    letter-spacing: -0.015em;
    color: var(--color-accent);
}

p {
    max-width: 760px;
    color: var(--color-text-muted);
    margin: 0 0 12px;
    font-size: 1.02rem;
    line-height: 1.6;
}

ul {
    margin: 0 0 12px;
    padding-left: 20px;
}

li {
    margin: 6px 0;
    color: var(--color-text-muted);
    font-size: 0.98rem;
}

/* ==========================================================================
   Components: Multi-Column Side-by-Side Grids (.flow-2, .flow-3)
   ========================================================================== */
.flow, .flow-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 12px 0 16px;
}

.flow-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 12px 0 16px;
}

.flow h2, .flow-2 h2, .flow-3 h2 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1rem;
}

.flow pre, .flow-2 pre, .flow-3 pre {
    margin: 0;
    width: 100%;
    max-width: none;
}

/* ==========================================================================
   Components: Code Blocks, Notes, Buttons
   ========================================================================== */
pre {
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 14px 16px;
    overflow: auto;
    font: 13.5px / 1.5 var(--font-mono);
    white-space: pre-wrap;
    max-width: 760px;
}

.caption {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
}

.button {
    display: inline-block;
    align-self: flex-start;
    margin-top: 10px;
    padding: 9px 18px;
    border: 1px solid var(--color-accent);
    border-radius: 7px;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.button:hover {
    background: var(--color-accent);
    color: #ffffff;
}

.note {
    margin: 18px 0;
    padding: 14px 18px;
    border-left: 3px solid var(--color-accent);
    background: var(--color-note-bg);
    border-radius: 0 8px 8px 0;
    max-width: 760px;
    font-size: 0.98rem;
}

.next {
    border-top: 1px solid var(--color-border-light);
    margin-top: 24px;
    padding-top: 16px;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 750px) {
    body {
        min-height: auto;
    }

    header {
        display: block;
    }

    nav {
        margin-top: 12px;
    }

    main {
        justify-content: flex-start;
        padding-top: 24px;
    }

    .flow, .flow-2, .flow-3 {
        grid-template-columns: 1fr;
    }
}