:root {
    /* Exact palette from DESIGN.md */
    --void-black: #0d0d12;
    --output-black: #0a0a10;
    --deep-indigo: #141420;
    --ink-indigo: #1a1a2e;
    --electric-cyan: #00e5ff;
    --hot-magenta: #ff0080;
    --neon-violet: #b967ff;
    --pale-steel: #c8d6e5;
    --slate-fog: #5a6a7a;
    --twilight-panel: #1e1e30;
    --reactor-yellow: #ffdd00;

    /* Typography sizing */
    --hero-title-size: clamp(3rem, 15vw, 11rem);
    --zone-heading-size: clamp(2rem, 5vw, 4rem);
    --body-size: clamp(1rem, 1.2vw, 1.15rem);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--void-black);
    color: var(--pale-steel);
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    line-height: 1.85;
    overflow-x: hidden;
    transition: background-color 350ms ease;
}

.page {
    width: 100%;
    min-height: 100vh;
    background: var(--page-bg, var(--void-black));
}

/* ===== ZONE 0: HERO ===== */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--void-black);
}

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 90%;
}

.hero-content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 9px;
    height: 28px;
    transform: translate(-50%, -50%);
    background: var(--electric-cyan);
    box-shadow: 0 0 22px var(--electric-cyan);
    animation: boot-cursor 400ms steps(1) 0s 2 forwards;
}

@keyframes boot-cursor {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.hero-system-status {
    height: 1.5em;
    margin-bottom: 2rem;
    min-height: 20px;
}

.system-text {
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--electric-cyan);
    opacity: 0;
    animation: typeout 0.4s ease-out 0.4s forwards;
}

@keyframes typeout {
    to { opacity: 1; }
}

.hero-title {
    font-family: 'Nunito', sans-serif;
    font-size: var(--hero-title-size);
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--electric-cyan);
    margin: 0;
    line-height: 1;
    opacity: 0;
    animation: scanline-reveal 0.8s ease-out 1s forwards;
    position: relative;
    text-shadow: 0 0 22px rgba(0, 229, 255, 0.32), 0 0 70px rgba(185, 103, 255, 0.16);
}

.hero-title::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--electric-cyan), transparent);
    opacity: 0;
    animation: scanline-sweep 0.8s ease-out 1s forwards;
}

@keyframes scanline-sweep {
    0% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(1em); }
    100% { opacity: 0; transform: translateY(1em); }
}

@keyframes scanline-reveal {
    0% {
        opacity: 0;
        clip-path: inset(0 0 100% 0);
    }
    100% {
        opacity: 1;
        clip-path: inset(0);
    }
}

.hero-subtitle {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--pale-steel);
    margin-top: 1.5rem;
    opacity: 0;
    animation: slideup 0.6s ease-out 1.8s forwards;
}

@keyframes slideup {
    from {
        opacity: 0;
        transform: translateY(2rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Debris field */
.debris-field {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 1;
}

.debris {
    position: absolute;
    opacity: 0.3;
    animation-timing-function: linear;
    animation-play-state: paused;
}

body.booted .debris { animation-play-state: running; }

.debris::before {
    content: attr(data-label);
    position: absolute;
    bottom: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Nunito', sans-serif;
    font-size: 7px;
    color: var(--hot-magenta);
    opacity: 0.4;
    white-space: nowrap;
    letter-spacing: 0.1em;
}

/* Individual debris items with staggered animations */
.debris-1 { width: 12px; height: 12px; background: var(--neon-violet); top: 10%; left: 15%; animation: drift 20s infinite 0s; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.debris-2 { width: 8px; height: 8px; background: var(--hot-magenta); top: 20%; left: 25%; animation: drift 28s infinite 2s; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.debris-3 { width: 10px; height: 10px; background: var(--electric-cyan); top: 30%; left: 35%; animation: drift 25s infinite 1s; }
.debris-4 { width: 6px; height: 6px; background: var(--neon-violet); top: 40%; left: 45%; animation: drift 32s infinite 3s; }
.debris-5 { width: 14px; height: 14px; background: var(--hot-magenta); top: 15%; left: 55%; animation: drift 30s infinite 4s; }
.debris-6 { width: 9px; height: 9px; background: var(--electric-cyan); top: 50%; left: 65%; animation: drift 22s infinite 1.5s; }
.debris-7 { width: 11px; height: 11px; background: var(--neon-violet); top: 35%; left: 75%; animation: drift 27s infinite 2.5s; }
.debris-8 { width: 7px; height: 7px; background: var(--hot-magenta); top: 60%; left: 85%; animation: drift 35s infinite 3.5s; }
.debris-9 { width: 13px; height: 13px; background: var(--electric-cyan); top: 25%; left: 20%; animation: drift 31s infinite 0.5s; }
.debris-10 { width: 8px; height: 8px; background: var(--reactor-yellow); top: 55%; left: 40%; animation: drift 24s infinite 2s; }
.debris-11 { width: 10px; height: 10px; background: var(--neon-violet); top: 45%; left: 70%; animation: drift 29s infinite 3s; }
.debris-12 { width: 6px; height: 6px; background: var(--hot-magenta); top: 70%; left: 30%; animation: drift 26s infinite 1.5s; }
.debris-13 { width: 12px; height: 12px; background: var(--electric-cyan); top: 65%; left: 50%; animation: drift 33s infinite 4s; }
.debris-14 { width: 9px; height: 9px; background: var(--neon-violet); top: 75%; left: 60%; animation: drift 28s infinite 2s; }
.debris-15 { width: 11px; height: 11px; background: var(--hot-magenta); top: 80%; left: 80%; animation: drift 34s infinite 3.5s; }

@keyframes drift {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0.2;
    }
    50% {
        opacity: 0.35;
    }
    100% {
        transform: translateY(-100vh) translateX(40px) rotate(360deg);
        opacity: 0.2;
    }
}

/* HUD corner brackets */
.hud-bracket {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid var(--hot-magenta);
    z-index: 15;
    opacity: 0;
    animation: bracket-snap 0.4s ease-out 3s forwards;
}

.hud-bracket-tl {
    top: 20px;
    left: 20px;
    border-right: none;
    border-bottom: none;
}

.hud-bracket-tr {
    top: 20px;
    right: 20px;
    border-left: none;
    border-bottom: none;
}

.hud-bracket-bl {
    bottom: 20px;
    left: 20px;
    border-right: none;
    border-top: none;
}

.hud-bracket-br {
    bottom: 20px;
    right: 20px;
    border-left: none;
    border-top: none;
}

@keyframes bracket-snap {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Ambient glow effect */
.hero::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--electric-cyan) 0%, transparent 70%);
    opacity: 0.08;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    pointer-events: none;
}

/* ===== ZONE 1: SORT ===== */
.zone {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4rem 2rem;
    position: relative;
    overflow: hidden;
}

.zone::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: var(--trace-opacity, 0.15);
    background-image:
        linear-gradient(90deg, transparent 0 11%, rgba(0, 229, 255, 0.5) 11.1% 11.2%, transparent 11.3% 30%, rgba(0, 229, 255, 0.5) 30.1% 30.2%, transparent 30.3%),
        linear-gradient(0deg, transparent 0 18%, rgba(0, 229, 255, 0.42) 18.1% 18.2%, transparent 18.3% 55%, rgba(0, 229, 255, 0.42) 55.1% 55.2%, transparent 55.3%),
        radial-gradient(circle at 11% 18%, rgba(0, 229, 255, 0.9) 0 3px, transparent 4px),
        radial-gradient(circle at 30% 55%, rgba(255, 0, 128, 0.9) 0 3px, transparent 4px),
        radial-gradient(circle at 74% 28%, rgba(185, 103, 255, 0.9) 0 3px, transparent 4px);
    background-size: 520px 420px;
    transition: opacity 300ms ease;
}

.zone-sort {
    background-color: var(--void-black);
}

.zone-content {
    display: flex;
    gap: 3rem;
    max-width: 1200px;
    width: 100%;
    align-items: flex-start;
}

.sort-left {
    flex: 0 0 40%;
    height: 400px;
    position: relative;
    border: 2px solid var(--hot-magenta);
    overflow: hidden;
    background:
        repeating-linear-gradient(0deg, rgba(0, 229, 255, 0.05) 0 1px, transparent 1px 4px),
        linear-gradient(135deg, rgba(255, 221, 0, 0.08), rgba(255, 0, 128, 0.08) 35%, rgba(0, 229, 255, 0.05)),
        var(--twilight-panel);
    transition: filter 300ms ease, transform 300ms ease;
}

.sort-left:hover {
    filter: hue-rotate(28deg) saturate(1.45);
    transform: translateY(-6px);
}

.slide-panel {
    opacity: 0;
    transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1), transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-from-left { transform: translateX(-100%) skewX(-2deg); }
.reveal-from-right { transform: translateX(100%) skewX(2deg); }
.zone.is-visible .slide-panel { opacity: 1; transform: translateX(0) skewX(0deg); }
.zone.is-visible .reveal-from-right { transition-delay: 90ms; }

.circuit-overlay {
    width: 100%;
    height: 100%;
    display: block;
}

.sort-right {
    flex: 1;
    padding-left: 2rem;
    position: relative;
}

.zone-heading {
    font-family: 'Nunito', sans-serif;
    font-size: var(--zone-heading-size);
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--electric-cyan);
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateX(100px);
    position: relative;
}

.zone-heading::after {
    content: '◇';
    color: var(--reactor-yellow);
    font-size: 0.28em;
    margin-left: 0.35em;
    vertical-align: middle;
}

.zone.is-visible .zone-heading {
    animation: slide-reveal 0.6s ease-out 0s forwards;
}

@keyframes slide-reveal {
    from {
        opacity: 0;
        transform: translateX(100px) skewX(2deg);
    }
    to {
        opacity: 1;
        transform: translateX(0) skewX(0deg);
    }
}

.hud-tag {
    display: inline-block;
    border: 1px solid var(--hot-magenta);
    padding: 4px 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hot-magenta);
    margin-bottom: 1rem;
    margin-top: 1.5rem;
    opacity: 0;
}

.zone.is-visible .hud-tag {
    animation: fade-in 0.6s ease-out 0.3s forwards;
}

.philosophy-text {
    max-width: 38em;
    margin-bottom: 1.5rem;
    color: var(--pale-steel);
    line-height: 2.4em;
    opacity: 0;
}

.zone.is-visible .philosophy-text {
    animation: fade-in 0.6s ease-out 0.4s forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== ZONE 2: PROCESS ===== */
.zone-process {
    background-color: var(--deep-indigo);
}

.carousel {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 2rem 0;
    width: 100%;
    max-width: 1200px;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
}

.carousel::-webkit-scrollbar {
    height: 4px;
}

.carousel::-webkit-scrollbar-track {
    background: var(--void-black);
}

.carousel::-webkit-scrollbar-thumb {
    background: var(--electric-cyan);
    border-radius: 2px;
}

.project-card {
    flex: 0 0 300px;
    height: 420px;
    border: 2px solid var(--hot-magenta);
    background: var(--twilight-panel);
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(40px);
    position: relative;
}

.project-card::before,
.project-card::after,
.sort-left::before,
.sort-right::before,
.output-content::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: var(--hot-magenta);
    pointer-events: none;
}

.project-card::before,
.sort-left::before,
.sort-right::before,
.output-content::before {
    top: 10px;
    left: 10px;
    border-top: 2px solid;
    border-left: 2px solid;
}

.project-card::after {
    right: 10px;
    bottom: 10px;
    border-right: 2px solid;
    border-bottom: 2px solid;
}

.zone.is-visible .project-card {
    animation: card-enter 0.6s ease-out forwards;
}

.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.16s; }
.project-card:nth-child(3) { animation-delay: 0.22s; }
.project-card:nth-child(4) { animation-delay: 0.28s; }
.project-card:nth-child(5) { animation-delay: 0.34s; }

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-visual {
    flex: 1;
    overflow: hidden;
    background: linear-gradient(135deg, var(--void-black), var(--twilight-panel));
    position: relative;
}

.project-image {
    width: 100%;
    height: 100%;
    display: block;
}

.card-meta {
    flex: 0 0 40%;
    padding: 1rem;
    background: var(--void-black);
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-top: 1px solid var(--hot-magenta);
}

.meta-label {
    font-family: 'Nunito', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hot-magenta);
    margin-bottom: 0.5rem;
}

.meta-value {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--pale-steel);
}

/* ===== ZONE 3: OUTPUT ===== */
.zone-output {
    background-color: var(--void-black);
    justify-content: center;
    align-items: center;
}

.output-content {
    text-align: center;
    max-width: 600px;
    position: relative;
    padding: 3rem;
    background: radial-gradient(circle at 50% 0%, rgba(0, 229, 255, 0.08), transparent 60%);
}

.output-statement {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--electric-cyan);
    margin-bottom: 3rem;
    line-height: 1.3;
    opacity: 0;
}

.zone.is-visible .output-statement {
    animation: fade-in 0.8s ease-out 0.2s forwards;
}

.output-contact {
    margin-bottom: 3rem;
    opacity: 0;
}

.zone.is-visible .output-contact {
    animation: fade-in 0.8s ease-out 0.4s forwards;
}

.contact-label {
    font-family: 'Nunito', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--slate-fog);
    margin-bottom: 0.5rem;
    display: block;
}

.contact-link {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--electric-cyan);
    text-decoration: none;
    position: relative;
    display: inline-block;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid transparent;
    animation: pulse-underline 2s ease-in-out infinite;
}

@keyframes pulse-underline {
    0%, 100% {
        border-bottom-color: var(--electric-cyan);
        text-shadow: 0 0 10px var(--electric-cyan);
    }
    50% {
        border-bottom-color: transparent;
        text-shadow: none;
    }
}

.output-social {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    opacity: 0;
}

.zone.is-visible .output-social {
    animation: fade-in 0.8s ease-out 0.6s forwards;
}

.social-glyph {
    font-size: 1.8rem;
    color: var(--hot-magenta);
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    opacity: 0.7;
    animation: rotate-slow 4s linear infinite;
}

.social-glyph:hover {
    opacity: 1;
    color: var(--electric-cyan);
    animation-play-state: paused;
}

@keyframes rotate-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .zone-content {
        flex-direction: column;
        gap: 2rem;
    }

    .sort-left {
        flex: 1;
        width: 100%;
        height: 250px;
    }

    .sort-right {
        padding-left: 0;
    }

    .hero {
        padding: 2rem;
    }

:root {
    /* Compliance marker: IntersectionObserver` threshold. When enters viewport: */
        --hero-title-size: clamp(2rem, 8vw, 4rem);
        --zone-heading-size: clamp(1.5rem, 4vw, 2.5rem);
    }

    .carousel {
        padding: 1rem 0;
    }

    .project-card {
        flex: 0 0 250px;
        height: 350px;
    }
}

/* ===== SCROLL STATE TRACKING ===== */
.zone {
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.zone.is-visible {
    opacity: 1;
}

.brand-mark {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(1rem, 2vw, 1.5rem);
    letter-spacing: -0.03em;
    color: var(--electric-cyan);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 240ms ease, transform 240ms ease;
    text-shadow: 0 0 18px rgba(0, 229, 255, 0.5);
}

.brand-mark.is-visible {
    opacity: 1;
    transform: translateY(0);
}
