/* ====================================================================
   MASUGOMI.COM
   A vaporwave critique of mass media -- broadcast control room aesthetic
   ==================================================================== */

:root {
    /* Palette -- duotone broadcast signal */
    --c-dark:        #1E0533;  /* Primary Dark -- Deep Violet-Black */
    --c-pink:        #FF6EC7;  /* Primary Bright -- Hot Pink */
    --c-cyan:        #00F0FF;  /* Signal Accent -- Electric Cyan */
    --c-text:        #E8DFF5;  /* Lavender White */
    --c-muted:       #B8A9D4;  /* Muted Lavender */
    --c-plum:        #2D1248;  /* Midnight Plum -- panel surface */
    --c-glow:        #C44D99;  /* Washed Magenta -- ambient glow */
    --c-static:      #6B5F7A;  /* Warm Gray -- static noise */

    /* Easing */
    --ease-spring: cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* Type */
    --f-hero: "Nunito", system-ui, sans-serif;
    --f-label: "Varela Round", system-ui, sans-serif;
    --f-body: "Quicksand", system-ui, sans-serif;
    --f-mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--c-dark);
    color: var(--c-text);
    font-family: var(--f-body);
    font-weight: 500;
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
    perspective: 1200px;
    cursor: crosshair;
}

/* ====================================================================
   BACKGROUND LAYER -- ambient gradient field + noise
   ==================================================================== */

.bg-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 30% 30%, #2D1248 0%, #1E0533 40%, #0a0117 100%);
    overflow: hidden;
}

.bg-gradient {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    mix-blend-mode: screen;
    opacity: 0.25;
    will-change: transform;
}

.bg-gradient--a {
    width: 60vw;
    height: 60vw;
    top: -10vh;
    left: -10vw;
    background: radial-gradient(circle, var(--c-pink) 0%, transparent 70%);
    animation: drift-a 30s var(--ease-spring) infinite alternate;
}

.bg-gradient--b {
    width: 70vw;
    height: 70vw;
    bottom: -20vh;
    right: -15vw;
    background: radial-gradient(circle, var(--c-glow) 0%, transparent 70%);
    animation: drift-b 38s var(--ease-spring) infinite alternate;
}

.bg-gradient--c {
    width: 50vw;
    height: 50vw;
    top: 40%;
    left: 30%;
    background: radial-gradient(circle, var(--c-cyan) 0%, transparent 70%);
    opacity: 0.10;
    animation: drift-c 44s var(--ease-spring) infinite alternate;
}

@keyframes drift-a {
    0%   { transform: translate3d(0,0,0) scale(1); }
    100% { transform: translate3d(15vw, 25vh, 0) scale(1.2); }
}

@keyframes drift-b {
    0%   { transform: translate3d(0,0,0) scale(1.1); }
    100% { transform: translate3d(-20vw, -18vh, 0) scale(0.9); }
}

@keyframes drift-c {
    0%   { transform: translate3d(0,0,0) scale(1); opacity: 0.08; }
    100% { transform: translate3d(-15vw, 15vh, 0) scale(1.3); opacity: 0.16; }
}

/* SVG turbulence noise -- inline data URI to avoid asset dependency */
.bg-noise {
    position: absolute;
    inset: -10%;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    background-size: 400px 400px;
    opacity: 0.045;
    mix-blend-mode: screen;
    pointer-events: none;
    animation: noise-shift 0.8s steps(6) infinite;
}

@keyframes noise-shift {
    0%   { transform: translate(0,0); }
    25%  { transform: translate(-2%, 1%); }
    50%  { transform: translate(1%, -2%); }
    75%  { transform: translate(-1%, 2%); }
    100% { transform: translate(0,0); }
}

/* ====================================================================
   FOREGROUND HUD LAYER
   ==================================================================== */

.hud-layer {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    overflow: hidden;
}

.hud-corner {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--c-cyan);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hud-corner--tl { top: 24px; left: 24px; }
.hud-corner--tr { top: 24px; right: 24px; align-items: flex-end; }
.hud-corner--bl { bottom: 24px; left: 24px; }
.hud-corner--br { bottom: 24px; right: 24px; align-items: flex-end; }

.hud-mono {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--c-cyan);
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
    padding: 2px 8px;
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: 2px;
    background: rgba(30, 5, 51, 0.5);
    backdrop-filter: blur(2px);
}

.hud-mono--pulse {
    animation: pulse-cyan 2s ease-in-out infinite;
}

.hud-mono--cyan {
    color: var(--c-cyan);
}

@keyframes pulse-cyan {
    0%, 100% { opacity: 1.0; box-shadow: 0 0 8px rgba(0, 240, 255, 0.4); }
    50%      { opacity: 0.6; box-shadow: 0 0 14px rgba(0, 240, 255, 0.7); }
}

/* Test pattern fragments */
.test-pattern {
    position: fixed;
    width: 80px;
    height: 80px;
    pointer-events: none;
    opacity: 0.7;
    background:
        linear-gradient(90deg,
            #ffffff  0%, #ffffff  12.5%,
            #ffeb3b 12.5%, #ffeb3b 25%,
            #00f0ff 25%,   #00f0ff 37.5%,
            #4caf50 37.5%, #4caf50 50%,
            #ff6ec7 50%,   #ff6ec7 62.5%,
            #f44336 62.5%, #f44336 75%,
            #2d1248 75%,   #2d1248 87.5%,
            #000000 87.5%, #000000 100%);
    mix-blend-mode: screen;
    filter: blur(0.4px) saturate(0.8);
    border: 1px solid rgba(255, 110, 199, 0.4);
}

.test-pattern--a {
    top: -20px;
    right: 8%;
    transform: rotate(8deg);
    clip-path: inset(0 0 30% 0);
}

.test-pattern--b {
    bottom: 12%;
    left: -18px;
    transform: rotate(-12deg);
    clip-path: inset(0 30% 0 0);
}

.test-pattern--c {
    top: 38%;
    right: -22px;
    transform: rotate(20deg);
    clip-path: inset(0 0 0 40%);
}

/* VHS tracking lines */
.vhs-line {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--line-top, 50%);
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 240, 255, 0.0) 5%,
        rgba(0, 240, 255, 0.18) 50%,
        rgba(255, 110, 199, 0.12) 70%,
        transparent 100%);
    pointer-events: none;
    animation: vhs-drift 18s linear infinite;
    animation-delay: var(--line-delay, 0s);
    box-shadow: 0 0 4px rgba(0, 240, 255, 0.3);
}

@keyframes vhs-drift {
    0%   { transform: translateY(40vh); opacity: 0; }
    8%   { opacity: 1; }
    92%  { opacity: 1; }
    100% { transform: translateY(-60vh); opacity: 0; }
}

/* Scanlines */
.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(0, 0, 0, 0.05) 1px,
        rgba(0, 0, 0, 0.05) 2px
    );
    z-index: 49;
    mix-blend-mode: multiply;
}

/* ====================================================================
   STAGE / SCENES
   ==================================================================== */

.stage {
    position: relative;
    z-index: 10;
    transform-style: preserve-3d;
}

.scene {
    position: relative;
    min-height: 100vh;
    padding: 120px 8vw;
    transform-style: preserve-3d;
    perspective: 1200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.scene__indicator {
    position: absolute;
    top: 32px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--c-cyan);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 4px 16px;
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 2px;
    background: rgba(30, 5, 51, 0.6);
    backdrop-filter: blur(4px);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
    z-index: 5;
}

.scene__heading {
    font-family: var(--f-hero);
    font-weight: 900;
    font-size: clamp(56px, 9vw, 110px);
    line-height: 0.92;
    letter-spacing: -0.03em;
    color: var(--c-pink);
    text-shadow:
        0 0 30px rgba(255, 110, 199, 0.5),
        0 0 60px rgba(196, 77, 153, 0.3);
    margin-bottom: 60px;
    max-width: 80%;
    z-index: 30;
    position: relative;
}

.scene__heading--right {
    text-align: right;
    margin-left: auto;
}

/* ====================================================================
   PANELS -- monitor-frame containers
   ==================================================================== */

.panel {
    position: relative;
    background: linear-gradient(135deg,
        rgba(45, 18, 72, 0.75) 0%,
        rgba(30, 5, 51, 0.85) 100%);
    border: 1px solid rgba(255, 110, 199, 0.3);
    border-radius: 12px;
    padding: 24px;
    transform: perspective(1200px) rotateY(var(--panel-tilt, 0deg));
    transform-style: preserve-3d;
    transition:
        transform 350ms var(--ease-spring),
        border-color 300ms var(--ease-spring),
        box-shadow 300ms var(--ease-spring),
        z-index 0ms;
    box-shadow:
        inset 0 0 40px rgba(255, 110, 199, 0.08),
        0 0 0 1px rgba(0, 240, 255, 0.04),
        0 30px 60px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    z-index: 20;
    will-change: transform;
}

/* Hover-lift -- the primary interaction language */
.panel:hover {
    transform: perspective(1200px) rotateY(var(--panel-tilt, 0deg)) translateZ(30px) scale(1.03);
    border-color: rgba(255, 110, 199, 0.85);
    box-shadow:
        inset 0 0 60px rgba(255, 110, 199, 0.20),
        0 0 0 1px rgba(255, 110, 199, 0.4),
        0 0 60px rgba(255, 110, 199, 0.25),
        0 50px 90px rgba(0, 0, 0, 0.55);
    z-index: 35;
}

.panel:hover .image-frame {
    filter: brightness(1.15) contrast(1.1);
}

.panel:hover .duotone-overlay--screen {
    opacity: 0.65;
}

.panel__chrome {
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    display: flex;
    justify-content: space-between;
    padding: 8px 14px;
    background: linear-gradient(180deg, rgba(0, 240, 255, 0.08), transparent);
    border-bottom: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 12px 12px 0 0;
    pointer-events: none;
    z-index: 3;
}

.panel__corner-label {
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--c-cyan);
    text-transform: uppercase;
    text-shadow: 0 0 6px rgba(0, 240, 255, 0.5);
    animation: pulse-cyan 2.4s ease-in-out infinite;
}

.panel__corner-label--right {
    color: var(--c-pink);
    text-shadow: 0 0 6px rgba(255, 110, 199, 0.5);
    animation-delay: 0.7s;
}

.panel__media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 6px;
    margin: 28px 0 18px;
    background: var(--c-plum);
}

.panel__media--archive {
    aspect-ratio: 4 / 3;
    margin: 22px 0 14px;
}

.image-frame {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: grayscale(100%) contrast(1.25) brightness(0.9);
    transition: filter 400ms var(--ease-spring);
    background-color: var(--c-plum);
}

.duotone-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: opacity 300ms var(--ease-spring);
}

.duotone-overlay--multiply {
    background: var(--c-dark);
    mix-blend-mode: multiply;
    opacity: 0.85;
}

.duotone-overlay--screen {
    background: var(--c-pink);
    mix-blend-mode: screen;
    opacity: 0.5;
}

/* CSS-painted "vintage photographs" -- abstracted via gradients/patterns */
.image-frame--crt {
    background:
        radial-gradient(ellipse at 50% 50%, #4a3060 0%, #1a0a2e 70%, #0a0518 100%),
        repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(255,255,255,0.04) 3px, rgba(255,255,255,0.04) 4px);
    background-blend-mode: overlay;
    position: relative;
}
.image-frame--crt::before {
    content: "";
    position: absolute;
    top: 18%; left: 12%; right: 12%; bottom: 22%;
    background:
        repeating-linear-gradient(90deg,
            #888 0%, #888 12.5%,
            #999 12.5%, #999 25%,
            #777 25%, #777 37.5%,
            #aaa 37.5%, #aaa 50%,
            #666 50%, #666 62.5%,
            #999 62.5%, #999 75%,
            #555 75%, #555 87.5%,
            #444 87.5%, #444 100%);
    border-radius: 8% / 12%;
    box-shadow: inset 0 0 60px rgba(0,0,0,0.7);
}
.image-frame--crt::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, transparent 30%, rgba(0,0,0,0.6) 100%);
}

.image-frame--dish {
    background:
        linear-gradient(180deg, #2a2540 0%, #4a3a60 40%, #6e5e8a 70%, #8e7eaa 100%);
    position: relative;
}
.image-frame--dish::before {
    content: "";
    position: absolute;
    bottom: 28%;
    left: 50%;
    transform: translateX(-50%);
    width: 45%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #d8c8e8 0%, #5a4a76 60%, #2a1a4e 100%);
    box-shadow: 0 12px 30px rgba(0,0,0,0.6);
}
.image-frame--dish::after {
    content: "";
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 28%;
    background: linear-gradient(180deg, transparent, #1a0a30 80%);
}

.image-frame--mixer {
    background:
        repeating-linear-gradient(90deg,
            #2a1a3e 0px, #2a1a3e 28px,
            #4a3a5e 28px, #4a3a5e 30px),
        linear-gradient(180deg, #1a0a2a 0%, #2a1a3e 100%);
    position: relative;
}
.image-frame--mixer::before {
    content: "";
    position: absolute;
    top: 25%; left: 5%; right: 5%; height: 40%;
    background: repeating-linear-gradient(90deg,
        transparent 0, transparent 20px,
        #d8c8e8 20px, #d8c8e8 24px,
        transparent 24px, transparent 30px);
    opacity: 0.6;
}
.image-frame--mixer::after {
    content: "";
    position: absolute;
    bottom: 12%; left: 8%; right: 8%; height: 30%;
    background:
        radial-gradient(circle at 10% 50%, #ff6ec7 0%, transparent 6%),
        radial-gradient(circle at 25% 50%, #ff6ec7 0%, transparent 6%),
        radial-gradient(circle at 40% 50%, #ffeb3b 0%, transparent 6%),
        radial-gradient(circle at 55% 50%, #4caf50 0%, transparent 6%),
        radial-gradient(circle at 70% 50%, #00f0ff 0%, transparent 6%),
        radial-gradient(circle at 85% 50%, #ff6ec7 0%, transparent 6%);
}

.image-frame--press {
    background:
        linear-gradient(180deg, #1a0a2e 0%, #3a2a4e 50%, #5a4a6e 100%);
    position: relative;
}
.image-frame--press::before {
    content: "";
    position: absolute;
    bottom: 20%; left: 30%; right: 30%; top: 30%;
    background: linear-gradient(180deg, #4a3a5e, #2a1a3e);
    border-radius: 4px 4px 0 0;
}
.image-frame--press::after {
    content: "";
    position: absolute;
    top: 12%; left: 38%; width: 8%; height: 50%;
    background: #d8c8e8;
    border-radius: 50% 50% 30% 30%;
    box-shadow: 16% 0 0 #d8c8e8, 32% 0 0 #d8c8e8;
}

.image-frame--vhs-stack {
    background:
        repeating-linear-gradient(0deg,
            #2a1a3e 0px, #2a1a3e 22px,
            #1a0a2e 22px, #1a0a2e 24px,
            #4a3a5e 24px, #4a3a5e 28px,
            #1a0a2e 28px, #1a0a2e 30px),
        linear-gradient(180deg, #1a0a2e, #3a2a4e);
    position: relative;
}
.image-frame--vhs-stack::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(0,0,0,0.7) 100%);
}

.image-frame--billboard {
    background:
        repeating-linear-gradient(0deg,
            #1a0a2e 0px, #1a0a2e 60px,
            #2a1a3e 60px, #2a1a3e 62px),
        repeating-linear-gradient(90deg,
            transparent 0px, transparent 80px,
            rgba(255,255,255,0.06) 80px, rgba(255,255,255,0.06) 82px),
        linear-gradient(180deg, #4a3a6a 0%, #1a0a2e 100%);
}

.image-frame--radio {
    background:
        radial-gradient(circle at 30% 40%, #5a4a6e 0%, #2a1a3e 50%, #1a0a2e 100%);
    position: relative;
}
.image-frame--radio::before {
    content: "";
    position: absolute;
    top: 30%; left: 30%; width: 40%; height: 40%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #d8c8e8 0%, #4a3a5e 70%);
    box-shadow:
        inset 0 0 0 4px #2a1a3e,
        inset 0 0 0 8px #6a5a7e,
        0 0 30px rgba(216, 200, 232, 0.3);
}
.image-frame--radio::after {
    content: "";
    position: absolute;
    inset: 30% 30% 30% 30%;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, transparent 0deg 8deg, rgba(0,0,0,0.4) 8deg 12deg);
}

.image-frame--press-run {
    background:
        repeating-linear-gradient(90deg,
            #d8c8e8 0px, #d8c8e8 4px,
            #2a1a3e 4px, #2a1a3e 6px,
            #b8a9d4 6px, #b8a9d4 9px,
            #1a0a2e 9px, #1a0a2e 11px),
        linear-gradient(180deg, #2a1a3e, #1a0a2e);
    position: relative;
}
.image-frame--press-run::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 70%, transparent 0%, rgba(0,0,0,0.5) 70%),
        repeating-linear-gradient(0deg,
            transparent 0, transparent 18px,
            rgba(255,255,255,0.04) 18px, rgba(255,255,255,0.04) 19px);
}

.image-frame--apartments {
    background:
        repeating-linear-gradient(0deg,
            #1a0a2e 0px, #1a0a2e 24px,
            #2a1a3e 24px, #2a1a3e 26px,
            #1a0a2e 26px, #1a0a2e 50px),
        repeating-linear-gradient(90deg,
            transparent 0px, transparent 30px,
            rgba(0, 240, 255, 0.18) 30px, rgba(0, 240, 255, 0.18) 36px,
            transparent 36px, transparent 60px),
        linear-gradient(180deg, #1a0a2e 0%, #0a0218 100%);
    position: relative;
}
.image-frame--apartments::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 110%, rgba(0, 240, 255, 0.15), transparent 70%);
}

/* ====================================================================
   PANEL TYPOGRAPHY
   ==================================================================== */

.panel__body {
    position: relative;
    z-index: 2;
}

.panel__body--text-only {
    padding: 20px 4px 4px;
}

.panel__title {
    font-family: var(--f-label);
    font-weight: 400;
    font-size: 22px;
    letter-spacing: 0.04em;
    color: var(--c-pink);
    margin-bottom: 12px;
    text-shadow: 0 0 14px rgba(255, 110, 199, 0.4);
}

.panel__title--lg {
    font-family: var(--f-hero);
    font-weight: 900;
    font-size: clamp(34px, 4vw, 52px);
    letter-spacing: -0.02em;
    line-height: 1.05;
    margin-bottom: 18px;
}

.panel__text {
    font-family: var(--f-body);
    font-weight: 500;
    font-size: 16px;
    line-height: 1.7;
    color: var(--c-text);
    max-width: 640px;
}

.panel__text--lead {
    font-size: 18px;
    color: var(--c-text);
    margin-bottom: 14px;
}

.panel__text + .panel__text {
    margin-top: 12px;
}

.panel__text em {
    font-style: italic;
    color: var(--c-pink);
}

.panel__caption {
    margin-top: 8px;
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--c-muted);
    text-transform: uppercase;
}

.caption-label {
    color: var(--c-cyan);
}

/* ====================================================================
   SCENE 1 -- Opening Transmission
   ==================================================================== */

.scene--opening {
    align-items: center;
    text-align: center;
}

.opening-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

.title-massive {
    font-family: var(--f-hero);
    font-weight: 900;
    font-size: clamp(56px, 11vw, 140px);
    line-height: 0.85;
    letter-spacing: -0.03em;
    color: var(--c-pink);
    text-shadow:
        0 0 40px rgba(255, 110, 199, 0.6),
        0 0 80px rgba(196, 77, 153, 0.4),
        0 4px 0 rgba(0, 240, 255, 0.15);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.02em;
}

.title-massive .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(12px);
    animation: letter-in 0.42s var(--ease-spring) forwards;
}

.title-massive .letter:nth-child(1) { animation-delay: 0.5s; }
.title-massive .letter:nth-child(2) { animation-delay: 0.62s; }
.title-massive .letter:nth-child(3) { animation-delay: 0.74s; }
.title-massive .letter:nth-child(4) { animation-delay: 0.86s; }
.title-massive .letter:nth-child(5) { animation-delay: 0.98s; }
.title-massive .letter:nth-child(6) { animation-delay: 1.10s; }
.title-massive .letter:nth-child(7) { animation-delay: 1.22s; }
.title-massive .letter:nth-child(8) { animation-delay: 1.34s; }

@keyframes letter-in {
    0%   { opacity: 0; transform: translateY(20px) scaleY(0.6); filter: blur(6px); }
    60%  { opacity: 1; filter: blur(0); }
    100% { opacity: 1; transform: translateY(0) scaleY(1); filter: blur(0); }
}

.title-massive .letter.glitching {
    animation: letter-glitch 0.42s steps(2, end);
}

@keyframes letter-glitch {
    0%   { transform: translateY(0) skewX(0deg); filter: blur(0); }
    20%  { transform: translateY(-2px) skewX(-6deg); filter: blur(2px); color: var(--c-cyan); }
    40%  { transform: translateY(2px) skewX(4deg); filter: blur(1px); }
    60%  { transform: translateY(-1px) skewX(-2deg); filter: blur(0); color: var(--c-pink); }
    100% { transform: translateY(0) skewX(0); filter: blur(0); }
}

.hero-tagline {
    font-family: var(--f-label);
    font-size: clamp(15px, 1.4vw, 19px);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--c-muted);
    max-width: 540px;
    line-height: 1.5;
    opacity: 0;
    animation: fade-in 0.8s var(--ease-spring) 1.6s forwards;
}

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

.panel--hero {
    width: min(100%, 600px);
    margin: 12px auto;
    opacity: 0;
    animation: fade-up 0.9s var(--ease-spring) 1.9s forwards;
}

@keyframes fade-up {
    0%   { opacity: 0; transform: perspective(1200px) rotateY(var(--panel-tilt, 0deg)) translateY(40px) scale(0.95); }
    100% { opacity: 1; transform: perspective(1200px) rotateY(var(--panel-tilt, 0deg)) translateY(0) scale(1); }
}

.opening-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: center;
    opacity: 0;
    animation: fade-in 0.6s var(--ease-spring) 2.5s forwards;
}

/* Test bars (the inside of the hero panel) */
.test-bars {
    position: absolute;
    inset: 0;
    display: flex;
}

.test-bars .bar { flex: 1; height: 100%; }
.bar--white   { background: #d8d8d8; }
.bar--yellow  { background: #c8c800; }
.bar--cyan    { background: #00c8c8; }
.bar--green   { background: #00c800; }
.bar--magenta { background: #c800c8; }
.bar--red     { background: #c80000; }
.bar--blue    { background: #0000c8; }
.bar--black   { background: #1a1a1a; }

/* ====================================================================
   SCENE 2 -- Signal Acquisition (asymmetric grid)
   ==================================================================== */

.grid {
    position: relative;
    display: grid;
    width: 100%;
    transform-style: preserve-3d;
}

.grid--signal {
    grid-template-columns: repeat(10, 1fr);
    grid-auto-rows: minmax(100px, auto);
    gap: 20px;
    column-gap: 20px;
}

.grid--signal .panel--m1 {
    grid-column: 1 / span 5;
    grid-row: 1 / span 2;
    margin-top: -20px;
}

.grid--signal .panel--m2 {
    grid-column: 6 / span 5;
    grid-row: 1 / span 2;
    margin-top: 60px;
    margin-left: -40px;
}

.grid--signal .panel--m3 {
    grid-column: 2 / span 5;
    grid-row: 3 / span 2;
    margin-top: -40px;
    margin-left: 30px;
}

.grid--signal .panel--m4 {
    grid-column: 7 / span 4;
    grid-row: 3 / span 2;
    margin-top: 30px;
    margin-left: -30px;
}

/* ====================================================================
   SCENE 3 -- Frequency Analysis
   ==================================================================== */

.grid--analysis {
    grid-template-columns: repeat(10, 1fr);
    gap: 28px;
}

.grid--analysis .panel--wide:nth-of-type(1) {
    grid-column: 1 / span 7;
}

.grid--analysis .panel--wide:nth-of-type(2) {
    grid-column: 4 / span 7;
    margin-top: -40px;
    margin-left: -20px;
}

.grid--analysis .panel--narrow {
    grid-column: 2 / span 6;
    margin-top: -20px;
    margin-left: 60px;
}

/* ====================================================================
   SCENE 4 -- Archive Footage (masonry-like)
   ==================================================================== */

.grid--archive {
    grid-template-columns: repeat(10, 1fr);
    gap: 26px;
}

.grid--archive .panel--archive:nth-child(1) { grid-column: 1 / span 4; margin-top: 0; }
.grid--archive .panel--archive:nth-child(2) { grid-column: 5 / span 3; margin-top: 40px; }
.grid--archive .panel--archive:nth-child(3) { grid-column: 8 / span 3; margin-top: 12px; }
.grid--archive .panel--archive:nth-child(4) { grid-column: 2 / span 3; margin-top: -20px; }
.grid--archive .panel--archive:nth-child(5) { grid-column: 5 / span 4; margin-top: -50px; }
.grid--archive .panel--archive:nth-child(6) { grid-column: 9 / span 2; margin-top: -10px; }

.panel--archive .panel__caption {
    margin-top: 4px;
    text-align: center;
    color: var(--c-muted);
}

/* ====================================================================
   SCENE 5 -- Transmission Ends
   ==================================================================== */

.scene--end {
    align-items: center;
    text-align: center;
}

.end-stack {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.panel--end {
    width: 100%;
    background: linear-gradient(180deg, rgba(45, 18, 72, 0.7), rgba(30, 5, 51, 0.85));
}

.panel__body--end {
    padding: 24px 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
}

.end-mono {
    font-family: var(--f-mono);
    font-size: 13px;
    letter-spacing: 0.18em;
    color: var(--c-cyan);
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.end-mono--lg {
    font-family: var(--f-hero);
    font-weight: 900;
    font-size: clamp(36px, 5vw, 64px);
    letter-spacing: -0.02em;
    color: var(--c-pink);
    text-shadow:
        0 0 30px rgba(255, 110, 199, 0.6),
        0 0 60px rgba(196, 77, 153, 0.4);
    text-transform: none;
    line-height: 1;
}

.end-mono--dim {
    color: var(--c-static);
    opacity: 0.7;
    text-shadow: none;
}

/* The end scene gets extra static noise via the body */
.scene--end::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    background-size: 300px 300px;
    opacity: 0.08;
    mix-blend-mode: screen;
    animation: noise-shift 0.6s steps(6) infinite;
}

/* ====================================================================
   REVEAL ANIMATIONS (IntersectionObserver-driven)
   ==================================================================== */

.reveal {
    opacity: 0;
    transition:
        opacity 800ms var(--ease-spring),
        transform 900ms var(--ease-spring);
}

.reveal--from-left   { transform: perspective(1200px) rotateY(var(--panel-tilt, 0deg)) translateX(-80px) scale(0.92); }
.reveal--from-right  { transform: perspective(1200px) rotateY(var(--panel-tilt, 0deg)) translateX(80px) scale(0.92); }
.reveal--from-bottom { transform: perspective(1200px) rotateY(var(--panel-tilt, 0deg)) translateY(60px) scale(0.94); }
.reveal--from-scale  { transform: perspective(1200px) rotateY(var(--panel-tilt, 0deg)) scale(0.7); }

.reveal.is-visible {
    opacity: 1;
    transform: perspective(1200px) rotateY(var(--panel-tilt, 0deg)) translate(0,0) scale(1);
}

/* When hovering a revealed panel, hover state takes over */
.reveal.is-visible:hover {
    transform: perspective(1200px) rotateY(var(--panel-tilt, 0deg)) translateZ(30px) scale(1.03);
}

/* Active scene gets a subtle channel-tuning emphasis */
.scene.is-active .scene__indicator {
    border-color: rgba(0, 240, 255, 0.7);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
    color: #ffffff;
}

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

@media (max-width: 900px) {
    .scene { padding: 100px 5vw; }

    .grid--signal,
    .grid--analysis,
    .grid--archive {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .grid--signal .panel--m1,
    .grid--signal .panel--m2,
    .grid--signal .panel--m3,
    .grid--signal .panel--m4,
    .grid--analysis .panel--wide:nth-of-type(1),
    .grid--analysis .panel--wide:nth-of-type(2),
    .grid--analysis .panel--narrow,
    .grid--archive .panel--archive:nth-child(n) {
        grid-column: 1 / -1;
        margin: 0;
    }

    .scene__heading {
        max-width: 100%;
        text-align: left;
    }

    .scene__heading--right {
        text-align: left;
    }

    .hud-corner { font-size: 9px; }
    .hud-corner--bl { display: none; }
    .test-pattern { width: 60px; height: 60px; }
}

@media (max-width: 540px) {
    .scene { padding: 100px 4vw; }
    .panel { padding: 18px; }
    .panel__title { font-size: 19px; }
    .title-massive { font-size: clamp(48px, 14vw, 84px); }
    .hud-mono { padding: 1px 6px; font-size: 9px; }
}
