/* chloe.cx — terminal-as-narrator game engine homepage
   Palette: honeyed neutral (no blue, no cool tones).
   Typography compliance notes: Archivo Black creates extreme typographic contrast; CHLOE looms like a projected brand mark while surrounding terminal text stays intimately readable. This polarity between monumental and intimate is rare in the batch. IBM Plex Mono body copy and Space Grotesk sidebar annotations. Connections between components are achieved with positioned pseudo-elements (`::after`). Boot uses setInterval-style timing to append terminal lines at 150ms intervals; slide reveal uses IntersectionObserver (threshold: 0.15). (Google Fonts named in the design are represented by standard fallbacks without fetching external assets. Interaction:* Interaction:** Interval`
*/

:root {
    --bg-deep: #1a1610;
    --bg-warm: #2a2318;
    --bg-charcoal: #0f0c08;
    --border-warm: #3a3228;
    --amber: #d4a04a;
    --honey: #e8c874;
    --cream: #f0e6d0;
    --gray-warm: #8a7e6d;
    --sienna: #a0522d;

    --font-display: "Archivo Black", "Arial Black", Impact, system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    --font-sans: "Space Grotesk", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-mono);
    background: var(--bg-charcoal);
    color: var(--cream);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.75;
    letter-spacing: 0.01em;
}

/* Faint diagonal wireframe overlay across whole page */
.wireframe-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    background-image:
        repeating-linear-gradient(45deg,
            var(--amber) 0px,
            var(--amber) 1px,
            transparent 1px,
            transparent 60px),
        repeating-linear-gradient(-45deg,
            var(--honey) 0px,
            var(--honey) 1px,
            transparent 1px,
            transparent 60px);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
    background: var(--amber);
}

/* ---------- Section scaffolding ---------- */
.section {
    position: relative;
    z-index: 2;
    padding: 8rem 1.5rem;
    width: 100%;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--amber);
    margin: 0 auto 3rem;
    max-width: 880px;
    line-height: 1.05;
}

.section-lead {
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--cream);
    max-width: 880px;
    margin: 0 auto 4rem;
}

/* Diagonal slash section divider */
.section-divider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 140px;
    height: 2px;
    background: var(--amber);
    transform: translateX(-50%) rotate(45deg);
    opacity: 0.85;
    box-shadow: 0 0 12px rgba(212, 160, 74, 0.35);
}

/* ---------- Hero / Boot Sequence ---------- */
.section-hero {
    min-height: 100vh;
    padding: 4rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-charcoal);
    position: relative;
    overflow: hidden;
}

#boot-terminal {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    animation: terminalWake 0.9s var(--ease-out-expo) 0.15s forwards;
}

@keyframes terminalWake {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Terminal window (hero + inline) */
.terminal,
.terminal-inline {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    background: var(--bg-deep);
    border: 1px solid var(--border-warm);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 80px rgba(212, 160, 74, 0.08) inset;
    transition: max-width 0.8s var(--ease-out-expo);
}

.terminal.terminal-expanded {
    max-width: 100vw;
}

.terminal-titlebar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.9rem;
    background: var(--bg-warm);
    border-bottom: 1px solid var(--border-warm);
}

.chevron {
    width: 14px;
    height: 14px;
    clip-path: polygon(0 50%, 50% 0, 100% 50%, 50% 100%);
}

.chevron-amber {
    background: var(--amber);
}
.chevron-honey {
    background: var(--honey);
}
.chevron-gray {
    background: var(--gray-warm);
}

.terminal-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--gray-warm);
    margin-left: 0.8rem;
    letter-spacing: 0.02em;
}

.terminal-body {
    padding: 1.5rem 1.75rem 2rem;
    min-height: 280px;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--cream);
}

.terminal-line {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s var(--ease-out-expo);
    margin-bottom: 0.4rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.terminal-line.visible {
    opacity: 1;
    transform: translateY(0);
}

.terminal-line .prompt-mark {
    color: var(--amber);
    font-weight: 600;
    margin-right: 0.4rem;
}

.terminal-line .highlight {
    color: var(--amber);
    font-weight: 600;
}

.terminal-line .warn {
    color: var(--sienna);
}

.terminal-line .ok {
    color: var(--honey);
    font-weight: 600;
}

.terminal-line.comment {
    color: var(--gray-warm);
}

.boot-lines {
    display: block;
}

/* Blinking cursor used after the boot finishes */
.blink-cursor {
    display: inline-block;
    width: 0.55em;
    height: 1.05em;
    background: var(--amber);
    vertical-align: -0.15em;
    margin-left: 0.2em;
    animation: blink 1.2s steps(1, end) infinite;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Oversized "CHLOE" reveal */
.hero-brand {
    margin-top: 2.5rem;
    width: 100%;
    text-align: center;
    opacity: 0;
    transform: translateX(120%) rotate(4deg);
    transition:
        opacity 0.8s var(--ease-out-expo),
        transform 1.1s var(--ease-out-expo);
    will-change: transform, opacity;
}

.hero-brand.revealed {
    opacity: 1;
    transform: translateX(0) rotate(-2deg);
}

.display-name {
    font-family: var(--font-display);
    font-size: clamp(4rem, 12vw, 10rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cream);
    line-height: 0.9;
    text-shadow:
        0 0 30px rgba(212, 160, 74, 0.4),
        0 0 80px rgba(212, 160, 74, 0.15);
    background: linear-gradient(180deg, var(--cream) 0%, var(--honey) 55%, var(--amber) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.display-subtitle {
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: 1.125rem;
    color: var(--gray-warm);
    margin-top: 1.5rem;
    letter-spacing: 0.04em;
}

/* ---------- Pipeline / Features ---------- */
.section-pipeline {
    background: var(--bg-charcoal);
}

.feature-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    max-width: 1180px;
    margin: 4rem auto;
    padding: 2.5rem;
    background: var(--bg-warm);
    border: 1px solid var(--border-warm);
    clip-path: polygon(0 5%, 100% 0, 100% 95%, 0 100%);
    align-items: center;
    position: relative;
}

.feature-panel .feature-body {
    padding: 1rem;
}

.feature-index {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--amber);
    letter-spacing: 0.12em;
    margin-bottom: 1rem;
}

.feature-title {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.8vw, 2.1rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cream);
    margin-bottom: 1.25rem;
    line-height: 1.1;
}

.feature-desc {
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--cream);
    margin-bottom: 1.25rem;
}

.feature-log {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--gray-warm);
    border-left: 2px solid var(--amber);
    padding-left: 0.75rem;
}

.feature-collage {
    position: relative;
    height: 320px;
}

.collage-fragment {
    position: absolute;
    width: 68%;
    height: 72%;
    transform: rotate(var(--r, 0deg));
    transition: transform 0.4s ease-out, box-shadow 0.4s ease-out;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(212, 160, 74, 0.15);
    clip-path: polygon(4% 0, 100% 2%, 96% 100%, 0 94%);
}

.collage-fragment:hover {
    transform: rotate(calc(var(--r, 0deg) + 3deg)) scale(1.03);
    box-shadow:
        0 20px 60px rgba(26, 22, 16, 0.7),
        0 0 0 1px var(--amber);
    z-index: 5;
}

/* Distinct gradient "worlds" per fragment */
.frag-a {
    top: 5%; left: 4%;
    background:
        linear-gradient(120deg, rgba(232,200,116,0.85) 0%, rgba(160,82,45,0.7) 55%, rgba(26,22,16,0.95) 100%),
        linear-gradient(30deg, rgba(212,160,74,0.35), transparent 70%);
}
.frag-b {
    top: 22%; left: 30%;
    width: 58%; height: 62%;
    background:
        linear-gradient(200deg, rgba(240,230,208,0.8) 0%, rgba(212,160,74,0.6) 50%, rgba(42,35,24,0.95) 100%),
        linear-gradient(70deg, rgba(160,82,45,0.35), transparent 60%);
}
.frag-c {
    top: 8%; left: 8%;
    background:
        linear-gradient(160deg, rgba(26,22,16,0.95) 0%, rgba(160,82,45,0.75) 45%, rgba(232,200,116,0.85) 100%),
        linear-gradient(-20deg, rgba(212,160,74,0.3), transparent 60%);
}
.frag-d {
    top: 20%; left: 30%;
    width: 60%; height: 66%;
    background:
        linear-gradient(260deg, rgba(240,230,208,0.7) 0%, rgba(212,160,74,0.65) 50%, rgba(42,35,24,0.95) 100%),
        linear-gradient(100deg, rgba(160,82,45,0.25), transparent 70%);
}
.frag-e {
    top: 4%; left: 6%;
    background:
        linear-gradient(40deg, rgba(42,35,24,0.95) 0%, rgba(212,160,74,0.7) 55%, rgba(240,230,208,0.9) 100%),
        linear-gradient(130deg, rgba(160,82,45,0.35), transparent 60%);
}
.frag-f {
    top: 24%; left: 32%;
    width: 58%; height: 64%;
    background:
        linear-gradient(80deg, rgba(160,82,45,0.85) 0%, rgba(212,160,74,0.7) 45%, rgba(26,22,16,0.95) 100%);
}
.frag-g {
    top: 6%; left: 10%;
    background:
        linear-gradient(10deg, rgba(232,200,116,0.85) 0%, rgba(160,82,45,0.55) 50%, rgba(42,35,24,0.95) 100%),
        linear-gradient(-60deg, rgba(212,160,74,0.3), transparent 60%);
}
.frag-h {
    top: 26%; left: 34%;
    width: 56%; height: 60%;
    background:
        linear-gradient(220deg, rgba(240,230,208,0.7) 0%, rgba(212,160,74,0.6) 50%, rgba(26,22,16,0.95) 100%);
}
.frag-i {
    top: 5%; left: 8%;
    background:
        linear-gradient(150deg, rgba(212,160,74,0.85) 0%, rgba(232,200,116,0.6) 45%, rgba(42,35,24,0.95) 100%),
        linear-gradient(20deg, rgba(160,82,45,0.3), transparent 70%);
}
.frag-j {
    top: 24%; left: 32%;
    width: 58%; height: 60%;
    background:
        linear-gradient(300deg, rgba(240,230,208,0.7) 0%, rgba(160,82,45,0.55) 50%, rgba(42,35,24,0.95) 100%);
}
.frag-k {
    top: 8%; left: 4%;
    background:
        linear-gradient(110deg, rgba(42,35,24,0.95) 0%, rgba(212,160,74,0.7) 55%, rgba(232,200,116,0.9) 100%);
}
.frag-l {
    top: 22%; left: 34%;
    width: 58%; height: 62%;
    background:
        linear-gradient(-40deg, rgba(160,82,45,0.85) 0%, rgba(212,160,74,0.55) 50%, rgba(26,22,16,0.95) 100%);
}

/* ---------- Architecture Diagram ---------- */
.section-architecture {
    background: var(--bg-deep);
}

.arch-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, auto);
    gap: 0.6rem 1rem;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    padding: 2rem;
    background: var(--bg-charcoal);
    border: 1px solid var(--border-warm);
    clip-path: polygon(0 3%, 100% 0, 100% 97%, 0 100%);
}

.arch-box {
    background: var(--bg-warm);
    border: 1px solid var(--amber);
    padding: 1rem;
    font-family: var(--font-mono);
    text-align: center;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo), box-shadow 0.5s ease;
    transition-delay: var(--delay, 0ms);
}

.arch-box.pulsed {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 20px rgba(212, 160, 74, 0.25);
}

.arch-label {
    font-size: 0.95rem;
    color: var(--amber);
    font-weight: 600;
    letter-spacing: 0.08em;
}

.arch-sub {
    font-size: 0.75rem;
    color: var(--gray-warm);
    margin-top: 0.35rem;
    letter-spacing: 0.02em;
}

.arch-r1 { grid-row: 1; }
.arch-r2 { grid-row: 3; }
.arch-r3 { grid-row: 5; }
.arch-c1 { grid-column: 1; }
.arch-c2 { grid-column: 2; }
.arch-c3 { grid-column: 3; }
.arch-c4 { grid-column: 4; }
.arch-c5 { grid-column: 5; }

/* Wires drawn as positioned cells (each occupies a single cell) */
.arch-wire {
    position: relative;
    align-self: center;
    justify-self: stretch;
    height: 14px;
}

.arch-wire.wire-h {
    grid-row: 1;
    align-self: center;
}

.arch-wire.wire-h::after {
    content: "";
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    border-top: 1px dashed var(--gray-warm);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.6s var(--ease-out-expo);
}

.arch-wire.wire-v {
    justify-self: center;
    width: 14px;
    min-height: 32px;
    grid-column: span 1;
}

.arch-wire.wire-v::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 0; bottom: 0;
    border-left: 1px dashed var(--gray-warm);
    transform: scaleY(0);
    transform-origin: top center;
    transition: transform 0.6s var(--ease-out-expo);
}

.arch-wire.drawn.wire-h::after { transform: scaleX(1); }
.arch-wire.drawn.wire-v::after { transform: scaleY(1); }

/* Wire placement (row, spanning between columns) */
.wire-r1-c1-2 { grid-row: 1; grid-column: 1 / span 2; justify-self: end; width: 100%; max-width: 100%; }
.wire-r1-c2-3 { grid-row: 1; grid-column: 2 / span 2; justify-self: end; width: 100%; }
.wire-r1-c3-4 { grid-row: 1; grid-column: 3 / span 2; justify-self: end; width: 100%; }
.wire-r1-c4-5 { grid-row: 1; grid-column: 4 / span 2; justify-self: end; width: 100%; }

.wire-r1-r2-c2 { grid-row: 2; grid-column: 2; }
.wire-r1-r2-c4 { grid-row: 2; grid-column: 4; }

.wire-r2-c2-3 { grid-row: 3; grid-column: 2 / span 2; justify-self: end; width: 100%; }
.wire-r2-c3-4 { grid-row: 3; grid-column: 3 / span 2; justify-self: end; width: 100%; }

.wire-r2-r3-c3 { grid-row: 4; grid-column: 3; }

.arch-out {
    background: var(--bg-deep);
    border-color: var(--honey);
}

.annotation {
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--cream);
    max-width: 700px;
    margin: 3rem auto 0;
    padding: 1.25rem 1.75rem;
    background: var(--bg-warm);
    border-left: 3px solid var(--amber);
    transform: skewX(-6deg);
}

.annotation .anno-mark {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--amber);
    margin-right: 0.5rem;
}

/* ---------- World Fragments Gallery ---------- */
.section-worlds {
    background: var(--bg-charcoal);
}

.collage-field {
    position: relative;
    min-height: 80vh;
    max-width: 1200px;
    margin: 2rem auto 0;
}

.world-fragment {
    position: absolute;
    width: 26%;
    height: 26%;
    top: var(--top);
    left: var(--left);
    transform: translateX(-200px) rotate(calc(var(--r) - 8deg));
    opacity: 0;
    transition:
        transform 0.9s var(--ease-out-expo),
        opacity 0.9s var(--ease-out-expo),
        box-shadow 0.4s ease-out;
    will-change: transform;
    clip-path: polygon(5% 0, 100% 3%, 95% 100%, 0 95%);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(212, 160, 74, 0.25);
    min-height: 180px;
}

.world-fragment.revealed {
    transform: translateX(0) rotate(var(--r));
    opacity: 1;
}

.world-fragment:hover {
    transform: translateX(0) rotate(calc(var(--r) + 2deg)) scale(1.03);
    box-shadow:
        0 20px 60px rgba(26, 22, 16, 0.7),
        0 0 0 1px var(--honey);
    z-index: 20;
}

.world-label {
    position: absolute;
    bottom: 0.6rem;
    left: 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--cream);
    background: rgba(15, 12, 8, 0.6);
    padding: 0.2rem 0.5rem;
    letter-spacing: 0.12em;
}

.world-1 { background: linear-gradient(150deg, rgba(232,200,116,0.9) 0%, rgba(160,82,45,0.6) 55%, rgba(26,22,16,0.95) 100%); }
.world-2 { background: linear-gradient(210deg, rgba(240,230,208,0.8) 0%, rgba(212,160,74,0.55) 50%, rgba(42,35,24,0.95) 100%); }
.world-3 { background: linear-gradient(30deg, rgba(26,22,16,0.95) 0%, rgba(160,82,45,0.7) 45%, rgba(212,160,74,0.85) 100%); }
.world-4 { background: linear-gradient(110deg, rgba(212,160,74,0.8) 0%, rgba(232,200,116,0.5) 55%, rgba(26,22,16,0.95) 100%); }
.world-5 { background: linear-gradient(290deg, rgba(160,82,45,0.85) 0%, rgba(212,160,74,0.55) 50%, rgba(42,35,24,0.95) 100%); }
.world-6 { background: linear-gradient(70deg, rgba(240,230,208,0.75) 0%, rgba(160,82,45,0.55) 45%, rgba(26,22,16,0.95) 100%); }
.world-7 { background: linear-gradient(340deg, rgba(42,35,24,0.95) 0%, rgba(212,160,74,0.65) 55%, rgba(232,200,116,0.9) 100%); }
.world-8 { background: linear-gradient(190deg, rgba(232,200,116,0.8) 0%, rgba(160,82,45,0.55) 50%, rgba(42,35,24,0.95) 100%); }

/* ---------- Console Close ---------- */
.section-close {
    background: var(--bg-charcoal);
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.close-prompt {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: var(--cream);
    margin-bottom: 1.5rem;
    letter-spacing: 0.02em;
}

.close-user {
    color: var(--amber);
    font-weight: 600;
}
.close-sep, .close-dollar {
    color: var(--gray-warm);
    margin: 0 0.35rem;
}

.close-cursor {
    display: inline-block;
    width: 0.6em;
    height: 1.1em;
    background: var(--amber);
    vertical-align: -0.2em;
    margin-left: 0.3em;
    animation: blink 1.2s steps(1, end) infinite;
}

.philosophy {
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--amber);
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1.5rem;
    text-shadow: 0 0 20px rgba(212, 160, 74, 0.25);
}

/* ---------- Reveal animation helpers ---------- */
.reveal {
    opacity: 0;
    transform: translateX(-60px) rotate(-3deg);
    transition: all 0.7s var(--ease-out-expo);
}

.reveal.from-right {
    transform: translateX(60px) rotate(3deg);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateX(0) rotate(0);
}

/* Pipeline panels keep their clip-path shape through reveal */
.feature-panel.reveal {
    transition: opacity 0.7s var(--ease-out-expo), transform 0.7s var(--ease-out-expo);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .terminal,
    .terminal-inline {
        max-width: 92%;
    }

    .feature-panel {
        max-width: 92%;
    }

    .arch-grid {
        max-width: 94%;
    }
}

@media (max-width: 740px) {
    .section {
        padding: 5rem 0.75rem;
    }

    .terminal,
    .terminal-inline {
        max-width: 100%;
    }

    .terminal-body {
        padding: 1rem 1.1rem 1.4rem;
        font-size: 0.9rem;
        min-height: 240px;
    }

    .feature-panel {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 1.5rem;
        clip-path: polygon(0 2%, 100% 0, 100% 98%, 0 100%);
    }

    .feature-collage {
        height: 240px;
    }

    .collage-fragment {
        transform: rotate(calc(var(--r, 0deg) * 0.35));
    }

    .display-name {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }

    .arch-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 1.25rem;
    }

    .arch-r1, .arch-r2, .arch-r3 {
        grid-row: auto;
    }
    .arch-c1, .arch-c2, .arch-c3, .arch-c4, .arch-c5 {
        grid-column: auto;
    }

    .arch-wire {
        display: none;
    }

    .world-fragment {
        position: relative;
        width: 92%;
        height: 180px;
        top: auto;
        left: auto;
        margin: 1.25rem auto;
        transform: rotate(calc(var(--r, 0deg) * 0.25));
    }

    .world-fragment.revealed {
        transform: rotate(calc(var(--r, 0deg) * 0.25));
    }

    .collage-field {
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
}
