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

/* ---- Tokens: light (a copy editor's marked proof) ---- */
:root {
    --paper:      oklch(0.965 0.009 74);
    --sheet:      oklch(0.993 0.005 74);
    --ink:        oklch(0.275 0.013 262);
    --mid:        oklch(0.495 0.014 261);
    --hair:       oklch(0.862 0.024 256);
    --blue:       oklch(0.475 0.072 252);
    --mark:       oklch(0.465 0.180 30);
    --mark-deep:  oklch(0.410 0.175 30);
    --mark-wash:  oklch(0.465 0.180 30 / 0.11);
    --blue-wash:  oklch(0.475 0.072 252 / 0.12);
    --shadow:     oklch(0.30 0.028 264 / 0.15);

    --sans:  'Atkinson Hyperlegible Next', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --serif: 'Spectral', Georgia, 'Times New Roman', serif;
    --mono:  'Azeret Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* ---- Tokens: dark (graphite at the desk) ---- */
[data-theme="dark"] {
    --paper:      oklch(0.225 0.008 260);
    --sheet:      oklch(0.265 0.009 260);
    --ink:        oklch(0.930 0.006 250);
    --mid:        oklch(0.690 0.010 252);
    --hair:       oklch(0.380 0.020 258);
    --blue:       oklch(0.745 0.080 254);
    --mark:       oklch(0.660 0.180 24);
    --mark-deep:  oklch(0.730 0.165 24);
    --mark-wash:  oklch(0.660 0.180 24 / 0.22);
    --blue-wash:  oklch(0.745 0.080 254 / 0.20);
    --shadow:     oklch(0 0 0 / 0.46);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --paper:      oklch(0.225 0.008 260);
        --sheet:      oklch(0.265 0.009 260);
        --ink:        oklch(0.930 0.006 250);
        --mid:        oklch(0.690 0.010 252);
        --hair:       oklch(0.380 0.020 258);
        --blue:       oklch(0.745 0.080 254);
        --mark:       oklch(0.660 0.180 24);
        --mark-deep:  oklch(0.730 0.165 24);
        --mark-wash:  oklch(0.660 0.180 24 / 0.22);
        --blue-wash:  oklch(0.745 0.080 254 / 0.20);
        --shadow:     oklch(0 0 0 / 0.46);
    }
    :root:not([data-theme]) .theme-toggle-icon {
        border-color: transparent;
        box-shadow: inset -6px -3px 0 1px var(--mid);
        transform: rotate(-28deg);
    }
}

/* ---- Base ---- */
html { font-size: 17px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: var(--sans);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.6;
    overflow-x: hidden;
}

::selection { background: color-mix(in oklch, var(--ink) 13%, transparent); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 1px; }

a { color: inherit; }

.container {
    max-width: 64rem;
    margin: 0 auto;
    padding-inline: clamp(1.25rem, 5vw, 2.6rem);
}

.skip-link {
    position: absolute;
    top: -120%; left: 1.25rem;
    padding: 0.55rem 1rem;
    background: var(--ink); color: var(--paper);
    font-size: 0.8rem; text-decoration: none; border-radius: 3px;
    z-index: 100;
}
.skip-link:focus { top: 0.9rem; }

.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Nav ---- */
nav {
    display: flex; justify-content: space-between; align-items: center;
    max-width: 64rem; margin: 0 auto;
    padding: 1.15rem clamp(1.25rem, 5vw, 2.6rem);
}
.wordmark {
    font-family: var(--mono);
    font-size: 0.86rem; font-weight: 500;
    letter-spacing: -0.01em;
    text-decoration: none; color: var(--ink);
}
.wordmark .wm { color: var(--ink); }
.nav-right { display: flex; align-items: center; gap: clamp(1rem, 3vw, 1.6rem); }
.nav-links { display: flex; gap: clamp(1rem, 3vw, 1.6rem); list-style: none; }
.nav-links a {
    font-size: 0.84rem; color: var(--mid); text-decoration: none;
    padding: 0.4rem 0; transition: color 0.18s ease;
}
.nav-links a:hover { color: var(--ink); }

/* ---- Theme toggle ---- */
.theme-toggle {
    background: none; border: none; padding: 0.4rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    -webkit-appearance: none;
}
.theme-toggle-icon {
    display: block; width: 17px; height: 17px;
    border-radius: 50%; border: 2px solid var(--mid); background: transparent;
    transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
}
[data-theme="dark"] .theme-toggle-icon {
    border-color: transparent;
    box-shadow: inset -6px -3px 0 1px var(--mid);
    transform: rotate(-28deg);
}
.theme-toggle:hover .theme-toggle-icon { border-color: var(--ink); }
[data-theme="dark"] .theme-toggle:hover .theme-toggle-icon {
    border-color: transparent; box-shadow: inset -6px -3px 0 1px var(--ink);
}

/* ---- Hero ---- */
.hero {
    padding-top: clamp(1.5rem, 4vw, 3rem);
    padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.eyebrow {
    font-family: var(--mono);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.135em;
    color: var(--mid);
    margin-bottom: clamp(0.95rem, 2vw, 1.45rem);
}

.hero-headline {
    font-weight: 800;
    font-size: clamp(2.25rem, 1.15rem + 4.7vw, 4rem);
    line-height: 1.07;
    letter-spacing: -0.01em;
}
.hl-line { display: block; }
.hl-1 { color: var(--mid); }
.hl-2 { color: var(--ink); }
.hl-2 .crit { color: var(--mark); }

.hero-strap {
    margin-top: clamp(1.1rem, 2.5vw, 1.65rem);
    max-width: 40rem;
    font-size: clamp(1.05rem, 0.99rem + 0.3vw, 1.24rem);
    line-height: 1.55;
    color: var(--mid);
}

.deck-lead { color: var(--ink); font-weight: 500; }

.hero-modes {
    margin-top: clamp(1.4rem, 3vw, 2rem);
    display: flex; flex-wrap: wrap; align-items: baseline;
    gap: 0.5rem 1rem;
}
.modes-label { font-size: 0.92rem; font-weight: 500; color: var(--ink); }
.modes-list {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--mid);
    line-height: 1.7;
}
.modes-list .mode { color: var(--ink); }
.modes-list .mode-flag { color: var(--ink); font-weight: 600; }

.ic {
    font-family: var(--mono);
    font-size: 0.86em;
    background: color-mix(in oklch, var(--ink) 10%, transparent);
    color: var(--ink);
    padding: 0.1em 0.36em;
    border-radius: 3px;
}

.hero-cta {
    margin-top: clamp(1.6rem, 3.4vw, 2.2rem);
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 0.85rem 1.4rem;
}

/* ---- Buttons ---- */
.btn-primary {
    display: inline-flex; align-items: center;
    font-family: var(--sans); font-size: 0.88rem; font-weight: 500;
    padding: 0.72em 1.55em;
    background: var(--mark); color: var(--paper);
    text-decoration: none; border-radius: 3px;
    transition: background 0.18s ease, transform 0.08s ease;
}
[data-theme="dark"] .btn-primary { color: oklch(0.225 0.008 260); }
.btn-primary:hover { background: var(--mark-deep); }
.btn-primary:active { transform: translateY(1px); }

.btn-ghost {
    font-family: var(--sans); font-size: 0.88rem; font-weight: 500;
    color: var(--mid); text-decoration: none;
    transition: color 0.18s ease;
}
.btn-ghost:hover { color: var(--ink); }
.btn-ghost .arr { transition: transform 0.18s ease; display: inline-block; }
.btn-ghost:hover .arr { transform: translateX(3px); }

/* ---- Showpiece ---- */
.showpiece { margin-top: clamp(3rem, 7vw, 5.5rem); }

.show-cap {
    display: block;
    margin-bottom: clamp(1.1rem, 2.5vw, 1.7rem);
}
.show-kicker {
    display: block;
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--mid);
}
.show-title {
    display: block;
    margin-top: 0.55rem;
    font-weight: 600;
    font-size: clamp(1.35rem, 1.05rem + 1.3vw, 1.95rem);
    line-height: 1.2;
    letter-spacing: -0.018em;
    color: var(--ink);
}

.board { display: grid; gap: 1.4rem; }

@media (min-width: 62rem) {
    .board {
        grid-template-columns: 1fr auto 1fr;
        gap: clamp(1rem, 2vw, 1.9rem);
        align-items: start;
    }
}

.sheet {
    background: var(--sheet);
    border: 1px solid var(--hair);
    border-radius: 3px;
    padding: clamp(1.45rem, 3vw, 2.1rem);
    box-shadow: 0 1px 2px -1px var(--shadow), 0 16px 34px -20px var(--shadow);
}

.sheet-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 1.1rem;
    font-family: var(--mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.13em;
}
.sheet-tag { color: var(--mid); }
.sheet-meta { color: var(--mid); opacity: 0.72; letter-spacing: 0.08em; }

.doc {
    font-family: var(--serif);
    font-size: clamp(1rem, 0.97rem + 0.18vw, 1.12rem);
    line-height: 1.66;
    color: var(--ink);
}

/* editor's marks, drawn-in oxblood underline, animatable via background-size */
.flag {
    --thk: 0.115em;
    background-image: linear-gradient(var(--mark), var(--mark));
    background-repeat: no-repeat;
    background-size: 100% var(--thk);
    background-position: 0 100%;
    padding-bottom: 0.06em;
    transition: background-color 0.16s ease;
}
.flag.lit {
    background-color: color-mix(in oklch, var(--mark) 15%, transparent);
}
.ref {
    font-family: var(--mono);
    font-size: 0.58em;
    font-weight: 500;
    color: var(--mark);
    vertical-align: 0.7em;
    margin-left: 0.12em;
}

.notes {
    margin-top: 1.25rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--hair);
    list-style: none;
    display: grid;
    gap: 0.5rem;
}
.notes li {
    display: flex;
    gap: 0.6rem;
    font-family: var(--mono);
    font-size: 0.775rem;
    line-height: 1.45;
    color: var(--mid);
    padding: 0.13rem 0.4rem;
    margin-inline: -0.4rem;
    border-radius: 3px;
    transition: background-color 0.16s ease;
}
.notes li.lit {
    background-color: var(--blue-wash);
}
.note-n { color: var(--blue); font-weight: 600; flex-shrink: 0; }

.sharp-mark {
    margin-top: 1.25rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--hair);
    font-family: var(--mono);
    font-size: 0.745rem;
    color: var(--mid);
}
.sharp-mark::before { content: "\2713\00a0\00a0"; }

.transform {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
}
@media (min-width: 62rem) {
    .transform { align-self: center; padding-block: 0.5rem; }
}
.t-cmd {
    font-family: var(--mono);
    font-size: 0.79rem;
    font-weight: 500;
    color: var(--ink);
    background: color-mix(in oklch, var(--ink) 10%, transparent);
    padding: 0.34rem 0.62rem;
    border-radius: 3px;
    white-space: nowrap;
}
.t-arrow { line-height: 1; color: var(--mid); }
.t-arrow::before { content: "\2193"; font-size: 1.45rem; }
@media (min-width: 62rem) {
    .t-arrow::before { content: "\2192"; }
}
.t-cap {
    font-family: var(--mono);
    font-size: 0.66rem;
    color: var(--mid);
    text-align: center;
    max-width: 9rem;
    line-height: 1.4;
}

/* ---- Sections (numbered blocks) ---- */
.block {
    padding-block: clamp(3.5rem, 8vw, 6.5rem);
}

.block-meta {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
.block-num {
    font-family: var(--mono);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--blue);
}
.block-line {
    flex: 1;
    height: 1px;
    background: var(--hair);
}
.block-kicker {
    font-family: var(--mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--mid);
}
.block-title {
    margin-top: 1.4rem;
    font-weight: 700;
    font-size: clamp(1.7rem, 1rem + 2.6vw, 2.6rem);
    line-height: 1.13;
    letter-spacing: -0.012em;
    max-width: 22ch;
}
.block-intro {
    margin-top: 1rem;
    max-width: 44rem;
    font-size: clamp(1rem, 0.97rem + 0.2vw, 1.12rem);
    line-height: 1.55;
    color: var(--mid);
}

.principles {
    margin-top: clamp(2.25rem, 5vw, 3.75rem);
}
.principle {
    display: grid;
    gap: 0.5rem 2.5rem;
    padding-block: clamp(1.4rem, 3vw, 2rem);
    border-top: 1px solid var(--hair);
}
.principle:last-child {
    border-bottom: 1px solid var(--hair);
}
@media (min-width: 54rem) {
    .principle { grid-template-columns: minmax(0, 15rem) 1fr; }
}
.principle-title {
    font-weight: 600;
    font-size: 1.16rem;
    line-height: 1.3;
    color: var(--ink);
}
.principle-n {
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--mid);
    margin-right: 0.55rem;
}
.principle-body {
    font-size: 0.96rem;
    line-height: 1.62;
    color: var(--mid);
    max-width: 40rem;
}

.mode-feature {
    margin-top: clamp(2.25rem, 5vw, 3.5rem);
    background: var(--sheet);
    border: 1px solid var(--hair);
    border-radius: 4px;
    padding: clamp(1.5rem, 3.5vw, 2.4rem);
}
.mode-feature-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}
.mode-feature-name {
    font-family: var(--mono);
    font-size: 1.18rem;
    font-weight: 500;
    color: var(--ink);
}
.mode-feature-desc {
    margin-top: 0.85rem;
    font-size: 1.04rem;
    line-height: 1.6;
    color: var(--ink);
    max-width: 46rem;
}

.mode-group {
    margin-top: clamp(2rem, 4vw, 3rem);
}
.mode-group-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--mid);
    padding-bottom: 0.7rem;
}
.mode-row {
    display: grid;
    gap: 0.3rem 1.75rem;
    padding-block: 1rem;
    border-top: 1px solid var(--hair);
}
.mode-group:last-of-type .mode-row:last-child {
    border-bottom: 1px solid var(--hair);
}
@media (min-width: 48rem) {
    .mode-row {
        grid-template-columns: 9rem 1fr;
        align-items: baseline;
    }
}
.mode-name {
    font-family: var(--mono);
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--ink);
}
.mode-desc {
    font-size: 0.93rem;
    line-height: 1.6;
    color: var(--mid);
}

.mode-suggest {
    margin-top: clamp(2rem, 4vw, 2.75rem);
    font-size: 0.92rem;
    color: var(--mid);
}
.mode-suggest a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--mid);
    transition: border-color 0.18s ease;
}
.mode-suggest a:hover { border-bottom-color: var(--ink); }

@media (prefers-reduced-motion: no-preference) {
    .js .r {
        opacity: 0;
        transform: translateY(16px);
        transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .js .r.in {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Slop Test rubric (03) ---- */
.rubric {
    margin-top: clamp(2.25rem, 5vw, 3.5rem);
}
.rubric-list {
    list-style: none;
}
.rubric-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 0.8rem;
    align-items: start;
    padding-block: 0.95rem;
    border-top: 1px solid var(--hair);
}
.check {
    width: 1.05rem;
    height: 1.05rem;
    margin-top: 0.06rem;
    border: 1.5px solid var(--mid);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.check::after {
    content: "\2713";
    color: var(--ink);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}
.rubric-head {
    display: block;
    line-height: 1.35;
}
.rubric-n {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--mid);
    margin-right: 0.5rem;
}
.rubric-crit {
    font-weight: 600;
    font-size: 1rem;
    color: var(--ink);
}
.rubric-guide {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--mid);
}

/* ---- Install steps (04) ---- */
.steps {
    list-style: none;
}
.step {
    margin-top: clamp(2rem, 4vw, 3rem);
}
.step:first-child {
    margin-top: clamp(2.25rem, 5vw, 3.5rem);
}
.step-head {
    display: flex;
    align-items: baseline;
    gap: 0.85rem;
}
.step-n {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--mid);
}
.step-title {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--ink);
}
.step-text {
    margin-top: 0.55rem;
    max-width: 40rem;
    font-size: 0.96rem;
    line-height: 1.6;
    color: var(--mid);
}
.code {
    margin-top: 1.1rem;
    background: var(--sheet);
    border: 1px solid var(--hair);
    border-radius: 4px;
    padding: clamp(1rem, 2.5vw, 1.35rem);
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.85;
    color: var(--ink);
    white-space: pre;
    overflow-x: auto;
}
.code .comment { color: var(--mid); }
.code .cmd { color: var(--ink); font-weight: 500; }

/* ---- Footer ---- */
footer {
    border-top: 1px solid var(--hair);
    padding: 1.75rem 0;
}
.footer-inner {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 0.75rem;
}
.footer-text { font-family: var(--mono); font-size: 0.74rem; color: var(--mid); }
.footer-links { display: flex; gap: 1.3rem; list-style: none; }
.footer-links a {
    font-size: 0.78rem; color: var(--mid); text-decoration: none;
    transition: color 0.18s ease;
}
.footer-links a:hover { color: var(--ink); }

/* ---- Motion ---- */
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }

    .reveal {
        animation: rise 0.62s cubic-bezier(0.22, 1, 0.36, 1) both;
    }
    @keyframes rise {
        from { opacity: 0; transform: translateY(15px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* hero entrance, staggered */
    .eyebrow.reveal     { animation-delay: 0.03s; }
    .hl-1.reveal        { animation-delay: 0.10s; }
    .hl-2.reveal        { animation-delay: 0.18s; }
    .hero-strap.reveal  { animation-delay: 0.28s; }
    .hero-modes.reveal  { animation-delay: 0.37s; }
    .hero-cta.reveal    { animation-delay: 0.45s; }
    .show-cap.reveal    { animation-delay: 0.52s; }
    .sheet-draft.reveal { animation-delay: 0.60s; }
    .transform.reveal   { animation-delay: 0.72s; }
    .sheet-sharp.reveal { animation-delay: 0.78s; }

    .flag {
        animation: draw 0.52s cubic-bezier(0.22, 1, 0.36, 1) both;
        animation-delay: 1.3s;
    }
    .flag[data-ref="1"] { animation-delay: 1.35s; }
    .flag[data-ref="2"] { animation-delay: 1.45s; }
    .flag[data-ref="3"] { animation-delay: 1.55s; }
    .flag[data-ref="4"] { animation-delay: 1.65s; }
    @keyframes draw {
        from { background-size: 0% var(--thk); }
        to   { background-size: 100% var(--thk); }
    }
}
