/* ============================================
   ppzz.ee — Cinematic Fever-Dream
   ============================================ */

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

:root {
    --magenta: #ff2d6f;
    --chartreuse: #b8ff2d;
    --sapphire: #2d47ff;
    --bg-deep: #0d0a1a;
    --bg-surface: #1a0f2e;
    --text-primary: #f5f0ff;
    --tangerine: #ff8c2d;
    --cyan: #2dffe8;
}

html {
    scroll-behavior: auto;
}

body {
    font-family: 'Commissioner', sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Progress Bar ---- */
#progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: var(--magenta);
    z-index: 10000;
    will-change: width;
}

/* ---- Scanlines Overlay ---- */
#scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        transparent 0px,
        transparent 2px,
        rgba(13, 10, 26, 0.15) 2px,
        rgba(13, 10, 26, 0.15) 4px
    );
}

/* ---- Data Fragments ---- */
.data-frag {
    position: absolute;
    font-family: 'Commissioner', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.15;
    color: var(--text-primary);
    pointer-events: none;
    z-index: 2;
}

/* ---- Circuit Traces ---- */
.circuit-trace {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    opacity: 0.2;
    transition: opacity 0.6s;
}
.circuit-trace.visible {
    opacity: 0.8;
}
.ct-1 {
    top: 0; right: 0;
    width: 1px; height: 40%;
    background: var(--cyan);
    border-right: 1px solid var(--cyan);
}
.ct-1::after {
    content: '';
    position: absolute;
    bottom: 0; right: 0;
    width: 80px; height: 1px;
    background: var(--cyan);
}
.ct-2 {
    bottom: 10%; left: 0;
    width: 120px; height: 1px;
    background: var(--cyan);
}
.ct-2::after {
    content: '';
    position: absolute;
    right: 0; top: 0;
    width: 1px; height: 60px;
    background: var(--cyan);
}
.ct-3 {
    top: 20%; right: 5%;
    width: 1px; height: 200px;
    background: var(--cyan);
}
.ct-3::after {
    content: '';
    position: absolute;
    bottom: 0; right: 0;
    width: 60px; height: 1px;
    background: var(--cyan);
}
.ct-4 {
    bottom: 15%; left: 3%;
    width: 100px; height: 1px;
    background: var(--cyan);
}
.ct-4::after {
    content: '';
    position: absolute;
    left: 0; top: 0;
    width: 1px; height: 80px;
    background: var(--cyan);
}

/* ---- Watermark Numerals ---- */
.watermark-numeral {
    position: absolute;
    font-family: 'Commissioner', sans-serif;
    font-weight: 800;
    font-size: clamp(200px, 30vw, 400px);
    color: var(--bg-surface);
    z-index: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    line-height: 1;
    user-select: none;
}

/* ============================
   OVERTURE
   ============================ */
#overture {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-deep);
    contain: layout paint;
}

/* Countdown Circles */
.countdown-circles {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid;
    will-change: transform, opacity;
}
.ring-1 {
    width: 100vmin; height: 100vmin;
    border-color: var(--magenta);
    animation: pulse-ring 3s ease-in-out infinite 0s;
}
.ring-2 {
    width: 80vmin; height: 80vmin;
    border-color: var(--chartreuse);
    animation: pulse-ring 3s ease-in-out infinite 0.3s;
}
.ring-3 {
    width: 60vmin; height: 60vmin;
    border-color: var(--sapphire);
    animation: pulse-ring 3s ease-in-out infinite 0.6s;
}
.ring-4 {
    width: 40vmin; height: 40vmin;
    border-color: var(--tangerine);
    animation: pulse-ring 3s ease-in-out infinite 0.9s;
}
.ring-5 {
    width: 20vmin; height: 20vmin;
    border-color: var(--cyan);
    animation: pulse-ring 3s ease-in-out infinite 1.2s;
}

@keyframes pulse-ring {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.08); opacity: 1; }
}

/* Hero Title with RGB split */
.hero-title {
    position: relative;
    z-index: 3;
    font-size: clamp(6rem, 15vw, 14rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    line-height: 1;
    display: flex;
}

.char-wrap {
    position: relative;
    display: inline-block;
}

.ch {
    position: relative;
    display: inline-block;
    color: var(--text-primary);
}

/* RGB layers via pseudo-elements */
.ch::before,
.ch::after {
    content: attr(data-char);
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}
.ch::before {
    color: var(--magenta);
    opacity: 0.7;
    animation: glitch-jitter-r 2s steps(2) infinite;
}
.ch::after {
    color: var(--cyan);
    opacity: 0.7;
    animation: glitch-jitter-b 2.3s steps(2) infinite;
}

@keyframes glitch-jitter-r {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-4px, 1px); }
    40% { transform: translate(3px, -2px); }
    60% { transform: translate(-2px, 3px); }
    80% { transform: translate(5px, -1px); }
    100% { transform: translate(0, 0); }
}

@keyframes glitch-jitter-b {
    0% { transform: translate(0, 0); }
    25% { transform: translate(4px, 2px); }
    50% { transform: translate(-3px, -1px); }
    75% { transform: translate(2px, -3px); }
    100% { transform: translate(0, 0); }
}

/* ============================
   ACT I — THE BALLROOM
   ============================ */
#act-one {
    position: relative;
    width: 100%;
    height: 200vh;
    overflow: hidden;
    contain: layout paint;
}

.panoramic-wrapper {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.panoramic-inner {
    display: flex;
    width: 300vw;
    height: 100vh;
    will-change: transform;
}

.panel {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.panel-magenta {
    background: linear-gradient(135deg, #1a0f2e 0%, #3a0f2e 40%, #0d0a1a 100%);
}
.panel-magenta .act-title { color: var(--magenta); }
.panel-magenta .geo-diamond {
    position: absolute;
    width: 200px; height: 200px;
    border: 2px solid var(--magenta);
    transform: rotate(45deg);
    top: 15%; right: 15%;
    opacity: 0.4;
}
.panel-magenta .geo-circle-accent {
    position: absolute;
    width: 100px; height: 100px;
    border-radius: 50%;
    border: 1px solid var(--tangerine);
    bottom: 20%; left: 10%;
    opacity: 0.3;
}

.panel-chartreuse {
    background: linear-gradient(135deg, #0d0a1a 0%, #1a2e0f 40%, #0d0a1a 100%);
}
.panel-chartreuse .act-title { color: var(--chartreuse); }
.panel-chartreuse .geo-square {
    position: absolute;
    width: 150px; height: 150px;
    border: 2px solid var(--chartreuse);
    top: 20%; left: 12%;
    opacity: 0.4;
}
.panel-chartreuse .geo-line-cluster {
    position: absolute;
    width: 80px; height: 200px;
    border-left: 1px solid var(--chartreuse);
    border-right: 1px solid var(--chartreuse);
    bottom: 15%; right: 20%;
    opacity: 0.25;
}
.panel-chartreuse .geo-line-cluster::after {
    content: '';
    position: absolute;
    left: 50%; top: 0;
    width: 1px; height: 100%;
    background: var(--chartreuse);
    opacity: 0.5;
}

.panel-sapphire {
    background: linear-gradient(135deg, #0d0a1a 0%, #0f1a3e 40%, #0d0a1a 100%);
}
.panel-sapphire .act-title { color: var(--sapphire); }
.panel-sapphire .geo-triangle {
    position: absolute;
    width: 0; height: 0;
    border-left: 100px solid transparent;
    border-right: 100px solid transparent;
    border-bottom: 170px solid transparent;
    border-bottom-color: rgba(45, 71, 255, 0.15);
    top: 10%; right: 10%;
}
.panel-sapphire .geo-dots {
    position: absolute;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    bottom: 30%; left: 15%;
    opacity: 0.4;
    box-shadow:
        20px 0 0 var(--cyan),
        40px 0 0 var(--cyan),
        60px 0 0 var(--cyan),
        0 20px 0 var(--cyan),
        20px 20px 0 var(--cyan),
        40px 20px 0 var(--cyan),
        60px 20px 0 var(--cyan);
}

.panel-title-wrap {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 680px;
    padding: 0 2rem;
}

.act-title {
    font-weight: 500;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.panel-text {
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    opacity: 0.8;
}

/* ============================
   INTERMISSION
   ============================ */
#intermission {
    position: relative;
    width: 100%;
    height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
    overflow: hidden;
    contain: layout paint;
}

.intermission-text {
    font-weight: 300;
    font-size: 14px;
    letter-spacing: 0.02em;
    line-height: 1.75;
    color: var(--text-primary);
    text-align: center;
    max-width: 680px;
    padding: 0 2rem;
    opacity: 0;
}

.intermission-text.revealed {
    opacity: 1;
    transition: opacity 2s ease;
}

/* ============================
   ACT II — GLITCH BALLROOM
   ============================ */
#act-two {
    position: relative;
    width: 100%;
    height: 150vh;
    overflow: hidden;
    background: var(--bg-deep);
    contain: layout paint;
}

.glitch-container {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4rem;
}

.glitch-panel {
    position: relative;
    width: 80vw;
    max-width: 900px;
    height: 20vh;
    overflow: hidden;
}

.glitch-band {
    position: absolute;
    left: 0;
    width: 100%;
    will-change: transform;
}

.gp-magenta { background: linear-gradient(135deg, #3a0f2e, #1a0f2e); }
.gp-magenta .glitch-band { background: linear-gradient(90deg, rgba(255,45,111,0.3), rgba(255,140,45,0.15)); }
.gp-chartreuse { background: linear-gradient(135deg, #1a2e0f, #0d0a1a); }
.gp-chartreuse .glitch-band { background: linear-gradient(90deg, rgba(184,255,45,0.3), rgba(45,255,232,0.15)); }
.gp-sapphire { background: linear-gradient(135deg, #0f1a3e, #0d0a1a); }
.gp-sapphire .glitch-band { background: linear-gradient(90deg, rgba(45,71,255,0.3), rgba(45,255,232,0.15)); }

.gp-magenta .glitch-band:nth-child(odd),
.gp-chartreuse .glitch-band:nth-child(odd),
.gp-sapphire .glitch-band:nth-child(odd) {
    mix-blend-mode: difference;
}

.glitch-text-debris {
    position: absolute;
    font-weight: 800;
    font-size: clamp(1.5rem, 3vw, 3rem);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    z-index: 3;
    opacity: 0.5;
    will-change: transform;
}

.gp-magenta .glitch-text-debris { color: var(--magenta); top: 20%; left: 10%; }
.gp-magenta .gd-2 { color: var(--tangerine); top: 55%; right: 15%; left: auto; font-size: clamp(1rem, 2vw, 2rem); }
.gp-chartreuse .glitch-text-debris { color: var(--chartreuse); top: 15%; right: 10%; left: auto; }
.gp-chartreuse .gd-2 { color: var(--cyan); top: 60%; left: 8%; right: auto; font-size: clamp(1rem, 2vw, 2rem); }
.gp-sapphire .glitch-text-debris { color: var(--sapphire); top: 25%; left: 15%; }
.gp-sapphire .gd-2 { color: var(--magenta); top: 50%; right: 12%; left: auto; font-size: clamp(1rem, 2vw, 2rem); }

/* ============================
   CREDITS
   ============================ */
#credits {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-deep);
    contain: layout paint;
}

#pixel-rain {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.credits-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.credits-roll {
    text-align: center;
    will-change: transform;
    animation: credits-scroll 60s linear infinite;
    padding: 100vh 0;
}

@keyframes credits-scroll {
    0% { transform: translateY(100%); }
    100% { transform: translateY(-100%); }
}

.credits-line {
    margin-bottom: 0.5rem;
}

.credits-heading {
    font-weight: 800;
    font-size: clamp(3rem, 6vw, 5rem);
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 3rem;
}

.credits-role {
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.6;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.credits-name {
    font-weight: 500;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.credits-spacer {
    height: 2rem;
}

/* ============================
   Spring Reveal (initial state)
   ============================ */
.spring-reveal {
    opacity: 0;
    transform: translateY(30px);
    will-change: transform, opacity;
}
