/* =========================================================
   SYSTEMS PAGE
   Stacked full screen chapters. Each one slides over the
   one before it, which shrinks and darkens behind.
   ========================================================= */

:root {
    --ink: #111;
    --paper: #e0dfda;
    --line: rgba(17, 17, 17, 0.18);
    --line-d: rgba(224, 223, 218, 0.18);
    --red: #8a3b3b;
    --green: #2f5e3e;
}

body.sys { background: #0b0b0b; overflow-anchor: none; }

.header.solid { background: var(--paper); }

/* style.css styles every button; reset ours */
.sys main button,
.sys .rail button,
.drawer button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
    font-weight: inherit;
    text-align: left;
}

.eyebrow {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.25rem;
    text-transform: uppercase;
    opacity: 0.55;
}

.eyebrow.mt { margin-top: 2.2rem; }


/* =========================================================
   STACK + CHAPTERS
   ========================================================= */

.stack { position: relative; }

.chapter {
    --p: 0;
    position: sticky;
    top: 0;
    min-height: 100vh;
    overflow: hidden;
    transform-origin: 50% 0;
    transform: scale(calc(1 - var(--p) * 0.06));
    border-radius: 1.4rem 1.4rem 0 0;
    box-shadow: 0 -2rem 4rem rgba(0, 0, 0, 0.35);
}

.chapter::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #000;
    opacity: calc(var(--p) * 0.7);
    pointer-events: none;
    z-index: 20;
}

.chapter.light { background: var(--paper); color: var(--ink); }
.chapter.dark  { background: var(--ink);   color: var(--paper); }

.ch-inner {
    position: relative;
    padding: 18vh 12vw 14vh 8vw;
}

.ch-head { max-width: 860px; margin-bottom: 4.5rem; }

.ch-num {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 700;
    line-height: 0.8;
    opacity: 0.12;
    margin-bottom: -1.4rem;
}

.ch-head h2 {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.8rem, 3.6vw, 3rem);
    letter-spacing: 0.15rem;
    line-height: 1.2;
    position: relative;
}

.ch-head .eyebrow + h2 { margin-top: 1rem; }

.ch-lead {
    margin-top: 1.4rem;
    max-width: 680px;
    font-size: 1.02rem;
    line-height: 1.8;
    opacity: 0.75;
}

.ch-note {
    max-width: 720px;
    margin-top: 4rem;
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: clamp(1.1rem, 1.8vw, 1.45rem);
    line-height: 1.55;
    opacity: 0.85;
}

/* reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(36px);
    transition: opacity 0.9s ease, transform 0.9s ease;
}
.reveal.in { opacity: 1; transform: none; }


/* small "open answers" buttons */
.open-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
    padding: 1rem 1.6rem !important;
    border: 1px solid currentColor !important;
    font-size: 0.75rem !important;
    letter-spacing: 0.2rem;
    text-transform: uppercase;
    cursor: pointer;
    opacity: 0.85;
    transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
}
.open-btn span { font-size: 1rem; transition: transform 0.3s ease; }
.open-btn:hover { opacity: 1; }
.open-btn:hover span { transform: rotate(90deg); }
.light .open-btn:hover { background: var(--ink) !important; color: var(--paper) !important; }
.dark  .open-btn:hover { background: var(--paper) !important; color: var(--ink) !important; }

.open-btn.sm { margin-top: 0; padding: 0.6rem 1rem !important; font-size: 0.65rem !important; letter-spacing: 0.15rem; }
.open-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.8rem; }


/* Given / Assumed / Derived squares */
.sq {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    vertical-align: -0.05rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
    transition: background 0.5s ease, border-color 0.5s ease;
}
.sq.a { border: 1px dashed currentColor; background: transparent; }
.sq.g { border: 1px solid currentColor; background: currentColor; }
.sq.d {
    border: 1px solid currentColor;
    background: repeating-linear-gradient(135deg, currentColor 0 1px, transparent 1px 4px);
}
.sq.big { width: 2.4rem; height: 2.4rem; margin: 0 0 1.6rem; }


/* =========================================================
   HERO
   ========================================================= */

.hero { height: 100vh; border-radius: 0; box-shadow: none; }

.hero-img {
    position: absolute;
    inset: 0;
    background: url("Media/hero.jpg") center / cover no-repeat;
    transform: scale(1.08);
    transition: transform 2.4s ease;
}
.page-loaded .hero-img { transform: scale(1); }

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.25) 50%, rgba(0,0,0,0.1) 100%);
}

.hero-plot {
    position: absolute;
    right: 4vw;
    top: 50%;
    width: min(48vw, 640px);
    transform: translateY(-46%);
    z-index: 2;
    opacity: 0.9;
}
.hero.has-img .hero-plot { display: none; }

.hero-plot path, .hero-plot circle { fill: none; stroke: var(--paper); stroke-width: 1; }
.p-line  { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 2.6s ease forwards 0.4s; }
.p-dash  { stroke-dasharray: 6 6; opacity: 0; animation: fade 1s ease forwards 2.2s; }
.p-ghost { stroke-dasharray: 3 7; opacity: 0; animation: ghost 4s ease-in-out infinite 3s; }
.p-peg   { fill: var(--paper) !important; opacity: 0; animation: fade 0.6s ease forwards 2.4s; }
.p-q     { fill: var(--paper); font-family: 'Fraunces', serif; font-style: italic; font-size: 48px; opacity: 0; animation: fade 1.2s ease forwards 3.4s; }

@keyframes draw  { to { stroke-dashoffset: 0; } }
@keyframes fade  { to { opacity: 1; } }
@keyframes ghost { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.7; } }

.hero-text {
    position: absolute;
    left: 8vw;
    bottom: 12vh;
    z-index: 3;
    max-width: 640px;
}

.hero-text .eyebrow { opacity: 0.75; margin-bottom: 1.4rem; }

.hero-text h1 {
    font-family: 'Cinzel', serif;
    font-size: clamp(3rem, 8vw, 7.2rem);
    letter-spacing: 0.5rem;
    line-height: 1;
}

.hero-quote {
    margin-top: 2rem;
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: clamp(1.1rem, 1.8vw, 1.5rem);
    line-height: 1.45;
}
.hero-quote small {
    display: block;
    margin-top: 0.5rem;
    font-family: 'Work Sans', sans-serif;
    font-style: normal;
    font-size: 0.72rem;
    letter-spacing: 0.15rem;
    text-transform: uppercase;
    opacity: 0.6;
}

.hero-lead { margin-top: 1.6rem; font-size: 0.95rem; line-height: 1.75; opacity: 0.75; max-width: 480px; }

.scroll-cue {
    position: absolute;
    right: 8vw;
    bottom: 12vh;
    z-index: 3;
    font-size: 0.65rem;
    letter-spacing: 0.25rem;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    opacity: 0.7;
    animation: nudge 2.4s ease-in-out infinite;
}
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }


/* =========================================================
   RAIL (step numbers, right side)
   ========================================================= */

.rail {
    position: fixed;
    right: 2.2vw;
    top: 44%;
    transform: translateY(-50%);
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: #fff;
    mix-blend-mode: difference;   /* readable on light and dark chapters */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}
.rail.show { opacity: 1; pointer-events: auto; }

.rail-item {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 0.8rem;
    padding: 0.3rem 0 !important;
    cursor: pointer;
}

.rail-num {
    font-family: 'Cinzel', serif;
    display: inline-flex;
    align-items: center;
    font-size: 0.78rem;
    letter-spacing: 0.1rem;
    opacity: 0.4;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.rail-num::before {
    content: "";
    display: inline-block;
    width: 0.6rem;
    height: 1px;
    margin-right: 0.5rem;
    background: currentColor;
    transition: width 0.4s ease;
}

.rail-label {
    font-size: 0.72rem;
    letter-spacing: 0.1rem;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.rail-item:hover .rail-label,
.rail-item:focus-visible .rail-label { opacity: 1; transform: none; }
.rail-item:hover .rail-num { opacity: 1; transform: scale(1.25); }

.rail-item.active .rail-num { opacity: 1; }
.rail-item.active .rail-num::before { width: 1.6rem; }
.rail-item.done .rail-num { opacity: 0.7; }


/* =========================================================
   LEDGER (bottom right counter)
   ========================================================= */

.ledger {
    position: fixed;
    right: 1.4vw;
    bottom: 2.4vh;
    z-index: 900;
    width: 9.6rem;
    padding: 0.85rem 0.9rem 0.8rem;
    background: rgba(224, 223, 218, 0.94);
    color: var(--ink);
    border: 1px solid var(--line);
    backdrop-filter: blur(6px);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.ledger.show { opacity: 1; transform: none; pointer-events: auto; }

.ledger-title { display: block; font-size: 0.6rem; letter-spacing: 0.2rem; text-transform: uppercase; opacity: 0.55; }

.ledger-dots { display: flex; flex-wrap: wrap; gap: 3px; margin: 0.6rem 0 0.7rem; }
.ledger-dots .sq { width: 0.55rem; height: 0.55rem; margin: 0; cursor: help; }
.ledger-dots .sq.flip { animation: flip 0.6s ease; }
@keyframes flip { 0% { transform: scale(1); } 40% { transform: scale(1.7); } 100% { transform: scale(1); } }

.ledger-counts { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.66rem; }
.ledger-counts span { display: flex; align-items: center; }
.ledger-counts .sq { width: 0.55rem; height: 0.55rem; margin-right: 0.3rem; }
.ledger-counts b { margin-left: auto; font-weight: 500; }

.ledger-done {
    max-height: 0;
    overflow: hidden;
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 0.82rem;
    line-height: 1.4;
    transition: max-height 0.6s ease, margin 0.6s ease;
}
.ledger.complete .ledger-done { max-height: 4rem; margin-top: 0.6rem; }
.ledger.complete { border-color: var(--ink); }


/* =========================================================
   01 SEEK AND SOLVE
   ========================================================= */

.halves { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); }

.half { padding: 2.6rem; position: relative; }
.half-dark { background: var(--ink); color: var(--paper); }

.half-img {
    height: clamp(200px, 32vh, 360px);
    width: 100%;
    margin-bottom: 2rem;
    background: #c9c8c2 center / cover no-repeat;
    filter: grayscale(20%);
}
.half-dark .half-img { background-color: #262626; }

.half h3 {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    letter-spacing: 0.15rem;
    margin: 0.8rem 0 0.8rem;
}

.half p { max-width: 420px; line-height: 1.75; opacity: 0.8; }

.w-row { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.6rem; }
.w-row li {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    letter-spacing: 0.15rem;
    padding: 0.4rem 0.9rem;
    border: 1px solid currentColor;
}

.layers { margin-top: 4.5rem; }
.layers ol { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 1.2rem; border-top: 1px solid var(--line); }
.layers li { padding: 1.2rem 1rem 0 0; font-size: 0.9rem; opacity: 0.4; position: relative; }
.layers li b { display: block; font-family: 'Cinzel', serif; font-size: 1.4rem; margin-bottom: 0.3rem; }
.layers li.now { opacity: 1; }
.layers li.now::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    width: 70%;
    height: 2px;
    background: var(--ink);
}


/* =========================================================
   02 GIVEN ASSUMED DERIVED
   ========================================================= */

.gad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line-d); border: 1px solid var(--line-d); }

.gad-card { background: var(--ink); padding: 2.4rem 2rem; }
.gad-card:nth-child(2) { transition-delay: 0.12s; }
.gad-card:nth-child(3) { transition-delay: 0.24s; }

.gad-card h3 { font-family: 'Cinzel', serif; font-size: 1.4rem; letter-spacing: 0.15rem; margin-bottom: 0.8rem; }
.gad-card p { line-height: 1.75; opacity: 0.75; font-size: 0.95rem; }

.eg {
    display: block;
    margin-top: 1.4rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line-d);
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 0.9rem;
    opacity: 0.7;
}

.flow-line {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-top: 3.5rem;
    font-size: 0.95rem;
}

.fl-node { display: flex; align-items: center; padding: 0.8rem 1.2rem; border: 1px dashed currentColor; }

.fl-split { display: flex; flex-direction: column; gap: 0.8rem; position: relative; padding-left: 2.4rem; }
.fl-split::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.9rem;
    bottom: 0.9rem;
    width: 1.2rem;
    border: 1px solid currentColor;
    border-right: none;
    opacity: 0.5;
}
.fl-split span { display: flex; align-items: center; }
.fl-split em { font-style: normal; font-size: 0.72rem; letter-spacing: 0.1rem; text-transform: uppercase; opacity: 0.5; margin-right: 1.2rem; min-width: 14rem; }


/* =========================================================
   03 THE MAP (layer 1 flowchart)
   ========================================================= */

.map { display: flex; flex-direction: column; gap: 0; max-width: 1100px; }

.m-bar, .m-box {
    display: flex !important;
    align-items: baseline;
    gap: 1.4rem;
    width: 100%;
    border: 1px solid var(--ink) !important;
    padding: 1.3rem 1.6rem !important;
    cursor: pointer;
    position: relative;
    transition: background 0.3s ease, color 0.3s ease;
}

.m-bar:hover, .m-box:hover { background: var(--ink) !important; color: var(--paper) !important; }

.m-k {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    letter-spacing: 0.2rem;
    min-width: 6rem;
}

.m-q { font-size: 0.9rem; line-height: 1.55; opacity: 0.75; flex: 1; }

.m-plus {
    font-style: normal;
    font-size: 1.1rem;
    margin-left: auto;
    transition: transform 0.3s ease;
}
.m-bar:hover .m-plus, .m-box:hover .m-plus { transform: rotate(90deg); }
.m-how:hover .m-plus { transform: translateY(3px); }

.m-pass {
    position: relative;
    align-self: center;
    padding: 1.6rem 0;
    font-size: 0.65rem;
    letter-spacing: 0.2rem;
    text-transform: uppercase;
    opacity: 0.55;
}
.m-pass::before, .m-pass::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 1px;
    height: 1.1rem;
    background: var(--ink);
}
.m-pass::before { top: 0; }
.m-pass::after { bottom: 0; }

.m-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-bottom: 2.4rem; position: relative; }
.m-cols::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -2.4rem;
    width: 1px;
    height: 2.4rem;
    background: var(--ink);
}

.m-col { display: flex; flex-direction: column; gap: 0.8rem; }
.m-col h4 {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    letter-spacing: 0.2rem;
    font-weight: 600;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--ink);
}

.m-box { flex-direction: column; gap: 0.4rem; padding: 1.1rem 1.2rem !important; border-color: var(--line) !important; }
.m-box .m-t { font-weight: 500; font-size: 0.95rem; }
.m-box .m-q { font-size: 0.82rem; }
.m-box .m-plus { position: absolute; top: 1rem; right: 1.1rem; }

.m-bar + .m-bar { margin-top: 2.4rem; }
.m-bar + .m-bar::before {
    content: "";
    position: absolute;
    left: 50%;
    top: calc(-2.4rem - 1px);
    width: 1px;
    height: 2.4rem;
    background: var(--ink);
}

.m-how { background: var(--ink) !important; color: var(--paper) !important; }
.m-how:hover { background: transparent !important; color: var(--ink) !important; }


/* =========================================================
   04 WHY (gate)
   ========================================================= */

.gate {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    align-items: center;
    gap: 3rem;
    position: relative;
}

.gate-in p { margin-top: 0.8rem; font-family: 'Fraunces', serif; font-style: italic; font-size: 1.4rem; }

.gate-checks {
    list-style: none;
    border-left: 1px solid var(--paper);
    border-right: 1px solid var(--paper);
    padding: 0.4rem 2rem;
    position: relative;
}

.gate-checks::before, .gate-checks::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 3rem;
    height: 1px;
    background: var(--paper);
    opacity: 0.4;
}
.gate-checks::before { right: 100%; }
.gate-checks::after { left: 100%; }

.gate-checks li {
    display: flex;
    gap: 1.2rem;
    align-items: baseline;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--line-d);
}
.gate-checks li:last-child { border-bottom: none; }
.gate-checks b { font-family: 'Cinzel', serif; font-size: 0.95rem; letter-spacing: 0.12rem; min-width: 6.2rem; font-weight: 600; }
.gate-checks span { font-size: 0.88rem; opacity: 0.75; }

.gate-out { display: flex; flex-direction: column; gap: 0.5rem; }

.oc {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem !important;
    border: 1px solid var(--line-d) !important;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.oc::after { font-size: 0.75rem; opacity: 0.6; }
.oc.fwd::after  { content: "\2192"; }
.oc.wait::after { content: "\21BB"; }
.oc.stop::after { content: "\00D7"; }
.oc:hover { border-color: var(--paper) !important; }
.oc.active { background: var(--paper) !important; color: var(--ink) !important; border-color: var(--paper) !important; }

.gate-eg { margin-top: 2.6rem; padding: 1.6rem 2rem; border-left: 2px solid var(--paper); background: rgba(224,223,218,0.05); max-width: 760px; }
.gate-eg p { margin-top: 0.6rem; font-family: 'Fraunces', serif; font-style: italic; font-size: 1.2rem; transition: opacity 0.25s ease; }
.gate-eg p.swap { opacity: 0; }

.goal-sentence { margin-top: 4rem; }
.goal-sentence p {
    margin-top: 1rem;
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: clamp(1.4rem, 2.8vw, 2.4rem);
    line-height: 1.5;
}
.goal-sentence u { text-decoration-thickness: 1px; text-underline-offset: 0.3rem; }
.blank {
    display: inline-block;
    min-width: 7rem;
    padding: 0 0.6rem;
    border-bottom: 1px dashed currentColor;
    font-family: 'Work Sans', sans-serif;
    font-style: normal;
    font-size: 0.5em;
    letter-spacing: 0.2rem;
    text-transform: uppercase;
    text-align: center;
    opacity: 0.65;
    vertical-align: middle;
}
.goal-sentence small { display: block; margin-top: 1rem; font-size: 0.85rem; opacity: 0.6; }


/* =========================================================
   05 WHAT WHERE WHO
   ========================================================= */

.w-block {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 5vw;
    padding: 4rem 0;
    border-top: 1px solid var(--line);
}

.w-letter {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: clamp(2.4rem, 5vw, 4rem);
    letter-spacing: 0.3rem;
    line-height: 1;
    margin-bottom: 1.6rem;
}

.w-side p { line-height: 1.8; opacity: 0.8; margin-bottom: 1rem; max-width: 520px; }

.w-demo { background: rgba(17, 17, 17, 0.04); border: 1px solid var(--line); padding: 2rem; align-self: start; }

.seg { display: flex; margin-top: 1rem; border: 1px solid var(--ink); }
.seg button {
    flex: 1;
    padding: 0.7rem 0.6rem !important;
    font-size: 0.8rem;
    text-align: center !important;
    cursor: pointer;
    border-right: 1px solid var(--ink) !important;
    transition: background 0.3s ease, color 0.3s ease;
}
.seg button:last-child { border-right: none !important; }
.seg button:hover { background: rgba(17,17,17,0.08) !important; }
.seg button.active { background: var(--ink) !important; color: var(--paper) !important; }

.seg.wrap { flex-wrap: wrap; border: none; gap: 0.4rem; }
.seg.wrap button { flex: 0 0 auto; border: 1px solid var(--ink) !important; padding: 0.5rem 0.8rem !important; }

.serves-out { margin-top: 2rem; min-height: 7.5rem; }
.serves-out strong {
    display: block;
    margin-top: 0.6rem;
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.3rem, 2.2vw, 1.8rem);
    line-height: 1.3;
}
.serves-eg { display: block; margin-top: 0.4rem; font-size: 0.85rem; opacity: 0.6; }
.swapping { animation: swapIn 0.45s ease; }
@keyframes swapIn { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: none; } }

.demo-note { margin-top: 1.6rem; font-size: 0.82rem; line-height: 1.65; opacity: 0.6; }

.tags { margin-top: 1.6rem; border-top: 1px solid var(--line); }
.tags div { display: grid; grid-template-columns: 8rem 1fr; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.tags dt { font-size: 0.68rem; letter-spacing: 0.15rem; text-transform: uppercase; opacity: 0.55; align-self: center; }
.tags dd { font-size: 0.98rem; font-weight: 500; }

.tags-result { display: flex; flex-wrap: wrap; gap: 0.6rem 2rem; margin-top: 1.2rem; font-size: 0.78rem; opacity: 0.75; }
.tags-result b { font-weight: 500; margin-left: 0.4rem; }

.weights { display: flex; height: 3.2rem; margin-top: 1rem; border: 1px solid var(--ink); }
.weights span {
    flex: 0 0 var(--w);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 0.8rem;
    font-size: 0.72rem;
    letter-spacing: 0.05rem;
    border-right: 1px solid var(--ink);
}
.weights span:first-child { background: var(--ink); color: var(--paper); }
.weights span:nth-child(2) { background: rgba(17,17,17,0.25); }
.weights span:last-child { border-right: none; }
.weights b { font-size: 0.95rem; font-weight: 500; }

.own { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 1rem; }
.own div { background: var(--paper); padding: 0.9rem; }
.own b { display: block; font-size: 0.85rem; font-weight: 500; }
.own span { font-size: 0.78rem; opacity: 0.65; }


/* =========================================================
   06 WHEN (two clocks)
   ========================================================= */

.clocks { color: var(--paper); }
.clock-svg { width: 100%; max-width: 1100px; height: auto; overflow: visible; }

.c-proj, .c-build { stroke: currentColor; stroke-width: 1.5; }
.c-proj  { stroke-dasharray: 460; stroke-dashoffset: 460; }
.c-build { stroke-dasharray: 460; stroke-dashoffset: 460; }
.c-loop  { fill: none; stroke: currentColor; stroke-width: 1; stroke-dasharray: 5 6; opacity: 0; }
.clocks.in .c-proj  { animation: draw 1.4s ease forwards 0.3s; }
.clocks.in .c-build { animation: draw 1.4s ease forwards 1.5s; }
.clocks.in .c-loop  { animation: fade 1s ease forwards 2.8s; }

.c-dot { fill: var(--ink); stroke: currentColor; stroke-width: 1.5; }
.c-dot.big { fill: currentColor; }
.c-ticks line { stroke: currentColor; opacity: 0.5; }
.c-t { fill: currentColor; font-family: 'Work Sans', sans-serif; font-size: 15px; text-anchor: middle; }
.c-t.s { font-size: 13px; opacity: 0.6; }
.c-t.b { font-family: 'Cinzel', serif; font-size: 18px; letter-spacing: 3px; }
.c-h { fill: currentColor; font-family: 'Cinzel', serif; font-size: 14px; letter-spacing: 5px; text-anchor: middle; opacity: 0.45; }

.when-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; margin-top: 3rem; }
.when-grid div { border-top: 1px solid var(--line-d); padding-top: 1.2rem; }
.when-grid div:nth-child(2) { transition-delay: 0.12s; }
.when-grid div:nth-child(3) { transition-delay: 0.24s; }
.when-grid b { font-family: 'Cinzel', serif; letter-spacing: 0.12rem; font-weight: 600; }
.when-grid p { margin-top: 0.5rem; font-size: 0.9rem; line-height: 1.7; opacity: 0.7; }


/* =========================================================
   07 PROBLEM STATEMENT
   ========================================================= */

.equation { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.2rem; }
.equation div { border: 1px solid var(--ink); padding: 1rem 1.3rem; min-width: 8rem; }
.equation span { display: block; font-size: 0.62rem; letter-spacing: 0.15rem; text-transform: uppercase; opacity: 0.55; }
.equation b { display: block; margin-top: 0.3rem; font-family: 'Cinzel', serif; font-size: 1.3rem; letter-spacing: 0.1rem; }
.equation i { font-style: normal; font-size: 1.4rem; opacity: 0.4; }
.equation .eq-still { border-style: dashed; }
.equation .eq-still b { font-family: 'Work Sans', sans-serif; }
.equation .eq-out { background: var(--ink); color: var(--paper); }

.still { margin-top: 4rem; max-width: 900px; }
.still ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0 1.6rem; min-height: 2rem; }
.still li { display: flex; align-items: center; padding: 0.45rem 0.8rem; border: 1px dashed var(--ink); font-size: 0.82rem; transition: opacity 0.5s ease, border-color 0.5s ease; }
.still li .sq { width: 0.55rem; height: 0.55rem; }
.still li.off { opacity: 0.35; border-style: solid; border-color: var(--line); text-decoration: line-through; }
.still p { font-family: 'Fraunces', serif; font-style: italic; font-size: 1.15rem; opacity: 0.8; }


/* =========================================================
   08 HOW
   ========================================================= */

.how-title {
    font-size: clamp(5rem, 16vw, 13rem) !important;
    letter-spacing: 1.2rem !important;
    line-height: 0.95 !important;
}

.stages { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--paper); }
.stages li { padding: 1.6rem 1.6rem 0 0; position: relative; }
.stages li:nth-child(2) { transition-delay: 0.1s; }
.stages li:nth-child(3) { transition-delay: 0.2s; }
.stages li:nth-child(4) { transition-delay: 0.3s; }
.stages li::before { content: ""; position: absolute; top: -5px; left: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); border: 1px solid var(--paper); }
.stages li.on::before { background: var(--paper); }
.stages b { font-family: 'Cinzel', serif; font-size: 2.2rem; opacity: 0.25; }
.stages h3 { font-family: 'Cinzel', serif; font-size: 1.2rem; letter-spacing: 0.12rem; margin-top: 0.3rem; }
.stages p { font-size: 0.88rem; opacity: 0.7; margin-top: 0.3rem; }

.families-head { margin-top: 5rem; max-width: 680px; }
.families-head p { margin-top: 0.8rem; line-height: 1.75; opacity: 0.75; }

.families { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 1px; margin-top: 2rem; background: var(--line-d); border: 1px solid var(--line-d); }
.fam { background: var(--ink); padding: 1.8rem 1.6rem; }
.fam h3 { font-family: 'Cinzel', serif; font-size: 1.1rem; letter-spacing: 0.12rem; margin: 1rem 0 0.6rem; }
.fam p { font-size: 0.85rem; line-height: 1.65; opacity: 0.6; }
.fam.main { background: var(--paper); color: var(--ink); }
.fam.main h3 { font-size: 1.6rem; }
.fam.main p { opacity: 0.8; font-size: 0.92rem; }

.status {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    font-size: 0.6rem;
    letter-spacing: 0.15rem;
    text-transform: uppercase;
    border: 1px solid currentColor;
    opacity: 0.6;
}
.status.live { background: var(--green); border-color: var(--green); color: #fff; opacity: 1; }


/* =========================================================
   09 FEASIBILITY
   ========================================================= */

.engine ol { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 1.2rem; }
.engine li {
    position: relative;
    padding: 1.2rem 1.6rem 1.2rem 1.2rem;
    border: 1px solid var(--ink);
    margin-right: -1px;
}
.engine li::after {
    content: "\2192";
    position: absolute;
    right: -0.55rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: var(--paper);
    font-size: 0.9rem;
    line-height: 1;
}
.engine li:last-child::after { display: none; }
.engine b { display: block; font-family: 'Cinzel', serif; font-size: 1rem; letter-spacing: 0.1rem; }
.engine span { display: block; margin-top: 0.4rem; font-size: 0.78rem; line-height: 1.5; opacity: 0.65; }
.engine > p { margin-top: 1.4rem; max-width: 640px; line-height: 1.75; opacity: 0.8; }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; margin-top: 3.5rem; }
.modes div { border-top: 2px solid var(--ink); padding-top: 1rem; }
.modes div:nth-child(2) { border-top-style: dashed; }
.modes div:nth-child(3) { border-top: 1px solid var(--line); }
.modes b { font-family: 'Cinzel', serif; letter-spacing: 0.1rem; }
.modes span { display: block; margin-top: 0.4rem; font-size: 0.85rem; opacity: 0.7; }

.scen { margin-top: 4.5rem; max-width: 1000px; }
.scen-calc { margin: 0.8rem 0 1.4rem; font-family: 'Fraunces', serif; font-style: italic; font-size: 1.05rem; opacity: 0.8; }
.scen-rows { position: relative; padding-right: 3rem; }
.scen-row { display: grid; grid-template-columns: 13rem 1fr; gap: 1.5rem; align-items: center; padding: 1.2rem 0; border-bottom: 1px solid var(--line); }
.scen-name { font-size: 0.88rem; font-weight: 500; }
.scen-name small { display: block; margin-top: 0.2rem; font-size: 0.75rem; font-weight: 400; }
.scen-name .short { color: var(--red); }
.scen-name .fits { color: var(--green); }
.scen-bars { display: flex; flex-direction: column; gap: 0.35rem; position: relative; }

.bar { height: 2rem; position: relative; width: 0; transition: width 1.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.scen.in .bar { width: var(--v); }
.bar span { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); font-size: 0.74rem; white-space: nowrap; }
.bar.beds { background: var(--ink); color: var(--paper); }
.scen-row + .scen-row .bar { transition-delay: 0.3s; }

/* the requested 500 beds line: 500 / 703 of the bar area */
.scen-limit {
    position: absolute;
    top: 0.4rem;
    bottom: 0;
    left: calc(13rem + 1.5rem + (100% - 13rem - 1.5rem - 3rem) * 0.711);
    border-left: 1px dashed var(--red);
    pointer-events: none;
}
.scen-limit span { position: absolute; top: -1.3rem; left: -2.4rem; font-size: 0.62rem; letter-spacing: 0.1rem; text-transform: uppercase; white-space: nowrap; color: var(--red); }

.warns { margin-top: 3.5rem; }
.warns ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.warns li { padding: 0.45rem 0.85rem; font-size: 0.8rem; border: 1px solid var(--red); color: var(--red); }
.warns li::before { content: "!"; font-weight: 500; margin-right: 0.5rem; }

.status.prog { border-color: var(--ink); background: transparent; opacity: 1; }

.bench { margin-top: 3.5rem; max-width: 900px; }
.bench ul { list-style: none; margin-top: 1rem; border-top: 1px solid var(--ink); }
.bench li { display: grid; grid-template-columns: 1fr 9rem 10rem; gap: 1rem; align-items: center; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.bench b { font-weight: 500; font-size: 0.92rem; }
.bench .status { justify-self: start; }
.bench time { font-size: 0.8rem; opacity: 0.6; }


/* =========================================================
   10 HOW I GOT HERE
   ========================================================= */

.story { list-style: none; max-width: 900px; }
.story > li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem; padding: 2rem 0; border-top: 1px solid var(--line-d); }
.story > li:last-child { border-bottom: 1px solid var(--line-d); }
.story > li > b { font-family: 'Cinzel', serif; font-size: 1.6rem; opacity: 0.35; line-height: 1.2; }
.story h3 { font-size: 1.05rem; font-weight: 500; letter-spacing: 0.05rem; margin-bottom: 0.5rem; }
.story p { font-size: 0.92rem; line-height: 1.7; opacity: 0.75; }

.moved { list-style: none; margin-top: 0.6rem; }
.moved li { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; align-items: baseline; padding: 0.5rem 0; }
.moved s {
    text-decoration: none;
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 1.15rem;
    background: linear-gradient(currentColor, currentColor) 0 55% / 0 1px no-repeat;
    transition: background-size 0.8s ease;
}
.moved span { font-size: 0.8rem; letter-spacing: 0.08rem; opacity: 0; transform: translateX(-6px); transition: opacity 0.6s ease, transform 0.6s ease; }
.moved span::before { content: "\2192  "; white-space: pre; }
.story li.in .moved s { background-size: 100% 1px; opacity: 0.55; }
.story li.in .moved span { opacity: 0.75; transform: none; }
.moved li:nth-child(1) s, .moved li:nth-child(1) span { transition-delay: 0.3s; }
.moved li:nth-child(2) s, .moved li:nth-child(2) span { transition-delay: 0.6s; }
.moved li:nth-child(3) s, .moved li:nth-child(3) span { transition-delay: 0.9s; }
.moved li:nth-child(4) s, .moved li:nth-child(4) span { transition-delay: 1.2s; }
.moved li:nth-child(5) s, .moved li:nth-child(5) span { transition-delay: 1.5s; }

.notes { margin-top: 4rem; display: none; }
.notes.has-notes { display: block; }
.notes-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; margin-top: 1.2rem; }
.notes figure { display: none; cursor: zoom-in; }
.notes figure.ok { display: block; }
.notes-img { aspect-ratio: 3 / 4; background: #222 center / cover no-repeat; filter: grayscale(20%); transition: filter 0.4s ease; }
.notes figure:hover .notes-img { filter: none; }
.notes figcaption { margin-top: 0.6rem; font-size: 0.75rem; line-height: 1.5; opacity: 0.6; }

.lightbox {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(10,10,10,0.94);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 4vh 4vw;
    opacity: 0; visibility: hidden; transition: opacity 0.4s ease, visibility 0.4s ease;
    cursor: zoom-out;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox img { max-width: 100%; max-height: 86vh; object-fit: contain; }
.lightbox p { margin-top: 1rem; color: var(--paper); font-size: 0.8rem; opacity: 0.7; }

.sources { margin-top: 4rem; max-width: 760px; }
.sources ul { list-style: none; margin: 1rem 0 1.4rem; }
.sources li { padding: 0.6rem 0; border-bottom: 1px solid var(--line-d); font-size: 0.88rem; opacity: 0.8; }
.sources p { font-family: 'Fraunces', serif; font-style: italic; opacity: 0.8; }


/* =========================================================
   END: TYPOLOGIES + FOOTER
   ========================================================= */

.end .ch-inner { padding-bottom: 10vh; }

.typos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; }
.typo:nth-child(2) { transition-delay: 0.1s; }
.typo:nth-child(3) { transition-delay: 0.2s; }
.typo:nth-child(4) { transition-delay: 0.3s; }

.typo-img {
    aspect-ratio: 4 / 3;
    background: #c9c8c2 center / cover no-repeat;
    margin-bottom: 1rem;
    filter: grayscale(10%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.typo-img span { font-family: 'Cinzel', serif; text-align: center; letter-spacing: 0.15rem; opacity: 0.6; }
.typo.app .typo-img { background: transparent; border: 1px dashed var(--ink); }
.typo h3 { font-family: 'Cinzel', serif; font-size: 1.15rem; letter-spacing: 0.12rem; margin-top: 0.8rem; }
.typo.soon .typo-img { filter: grayscale(100%); opacity: 0.55; }
.typo.soon h3 { opacity: 0.55; }
.typo.link { color: inherit; text-decoration: none; }
.typo.link .typo-img { transition: transform 0.6s ease, filter 0.6s ease; }
.typo.link:hover .typo-img { transform: scale(1.03); filter: none; }
.typo .arrow { display: inline-block; transition: transform 0.3s ease; }
.typo.link:hover .arrow { transform: translateX(5px); }

.end .footer-contact { border-radius: 0; }
.sys .footer-contact button {
    background: var(--paper) !important;
    color: var(--ink) !important;
    padding: 0.8rem 1.5rem !important;
    font-weight: 500 !important;
}


/* =========================================================
   DRAWER (layer 2)
   ========================================================= */

body.drawer-open { overflow: hidden; }

.drawer { position: fixed; inset: 0; z-index: 2000; visibility: hidden; }
.drawer.open { visibility: visible; }

.drawer-back { position: absolute; inset: 0; background: rgba(0,0,0,0.55); opacity: 0; transition: opacity 0.5s ease; }
.drawer.open .drawer-back { opacity: 1; }

.drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(620px, 94vw);
    background: var(--paper);
    color: var(--ink);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 5rem 3rem 4rem;
    transform: translateX(100%);
    transition: transform 0.65s cubic-bezier(0.77, 0, 0.18, 1);
}
.drawer.open .drawer-panel { transform: none; }

.drawer-close {
    position: absolute !important;
    top: 1.4rem;
    right: 1.6rem;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    background: var(--ink) !important;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.drawer-close:hover { transform: rotate(90deg); }
.drawer-close span { position: absolute; top: 50%; left: 50%; width: 1rem; height: 1px; background: var(--paper); }
.drawer-close span:first-child { transform: translate(-50%, -50%) rotate(45deg); }
.drawer-close span:last-child  { transform: translate(-50%, -50%) rotate(-45deg); }

.drawer-panel h3 { font-family: 'Cinzel', serif; font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: 0.15rem; line-height: 1.2; margin: 0.8rem 0 1.6rem; }

.drawer-body { font-size: 0.92rem; line-height: 1.75; }
.drawer-body > * + * { margin-top: 1rem; }
.drawer-body h4 { margin-top: 2.2rem; font-size: 0.68rem; letter-spacing: 0.22rem; text-transform: uppercase; font-weight: 500; opacity: 0.6; }
.drawer-body ul, .drawer-body ol { padding-left: 1.2rem; }
.drawer-body li { margin: 0.35rem 0; }
.drawer-body .eg { border-top-color: var(--line); }
.drawer-body .note { padding: 1rem 1.2rem; border-left: 2px solid var(--ink); background: rgba(17,17,17,0.05); }

.drawer-body table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.drawer-body th, .drawer-body td { text-align: left; vertical-align: top; padding: 0.55rem 0.6rem 0.55rem 0; border-bottom: 1px solid var(--line); }
.drawer-body th { font-size: 0.6rem; letter-spacing: 0.15rem; text-transform: uppercase; font-weight: 500; opacity: 0.55; }
.drawer-body .tw { overflow-x: auto; }

.drawer-body .tg { display: inline-flex; align-items: center; white-space: nowrap; }
.drawer-body .tg .sq { width: 0.55rem; height: 0.55rem; margin-right: 0.35rem; }


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {
    .gate { grid-template-columns: 1fr; gap: 2rem; }
    .gate-checks::before, .gate-checks::after { display: none; }
    .families { grid-template-columns: 1fr 1fr; }
    .fam.main { grid-column: 1 / -1; }
    .engine ol { grid-template-columns: 1fr; }
    .engine li { margin: 0 0 -1px 0; }
    .engine li::after { content: "\2193"; right: auto; left: 1.2rem; top: auto; bottom: -0.6rem; transform: none; }
    .typos, .notes-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
    .ch-inner { padding: 14vh calc(7vw + 1.8rem) 12vh 7vw; }
    .rail { right: 0.8rem; top: 42%; gap: 0; }
    .rail-item { padding: 0.15rem 0 !important; }
    .rail-num { font-size: 0.62rem; }
    .rail-num::before { width: 0; margin-right: 0.3rem; }
    .rail-item.active .rail-num::before { width: 0.8rem; }
    .rail-label { display: none; }
    .halves, .gad-grid, .w-block, .when-grid, .modes { grid-template-columns: 1fr; }
    .m-cols { grid-template-columns: 1fr; }
    .layers ol, .stages { grid-template-columns: 1fr 1fr; gap: 1.5rem 0; }
    .flow-line { flex-direction: column; align-items: flex-start; }
    .fl-split em { min-width: 0; }
    .ledger { width: auto; left: 0.8rem; right: 0.8rem; bottom: 0.8rem; padding: 0.55rem 0.8rem; }
    .ledger-dots, .ledger-title { display: none; }
    .ledger-counts { flex-direction: row; justify-content: space-between; }
    .ledger-counts b { margin-left: 0.25rem; }
    .hero-plot { width: 80vw; right: -6vw; top: 30%; opacity: 0.45; }
    .scroll-cue { display: none; }
    .scen-row { grid-template-columns: 1fr; gap: 0.6rem; }
    .scen-limit { display: none; }
    .bench li { grid-template-columns: 1fr auto; }
    .bench time { grid-column: 1 / -1; }
    .footer-top { flex-direction: column; gap: 3rem; }
    .contact-right { text-align: left; }
    form { align-items: flex-start; }
}

@media (max-width: 600px) {
    .typos, .families, .own { grid-template-columns: 1fr; }
    .m-bar { flex-direction: column; gap: 0.4rem; }
    .m-bar .m-plus { position: absolute; top: 1.2rem; right: 1.2rem; }
    .equation i { display: none; }
    .tags div { grid-template-columns: 6.5rem 1fr; }
    .drawer-panel { padding: 4.5rem 1.4rem 3rem; }
    nav a { margin-left: 1rem; font-size: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
    .chapter { position: relative; transform: none; }
    .chapter::after { display: none; }
    .reveal { opacity: 1; transform: none; transition: none; }
}

a.typo { display: block; color: inherit; text-decoration: none; }