/* ===== Custom Properties & Palette ===== */
:root {
    --polar-night: #0B0D1A;
    --ice-white: #F0F4FF;
    --boreal-green: #00E676;
    --magnetosphere-purple: #7C4DFF;
    --ionosphere-blue: #00BCD4;
    --solar-wind-pink: #FF4081;
    --frost-white: #E8EAF6;
    --twilight-gray: #5C6378;

    --aurora-main: linear-gradient(135deg, #00E676 0%, #00BCD4 35%, #7C4DFF 65%, #FF4081 100%);
    --cursor-x: 50%;
    --cursor-y: 50%;
}

/* Register animated angle property */
@property --aurora-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

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

html {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    background-color: var(--polar-night);
    color: var(--frost-white);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ===== Scroll Container ===== */
.scroll-container {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100vw;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.scroll-container::-webkit-scrollbar {
    display: none;
}

.scroll-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ===== Panel Base ===== */
.panel {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: 100vw;
    min-width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    scroll-snap-align: start;
    position: relative;
    background-color: var(--polar-night);
    overflow: hidden;
}

/* ===== Panel Numbers ===== */
.panel-number {
    position: absolute;
    top: 2rem;
    left: 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    color: var(--twilight-gray);
    opacity: 0.3;
    font-weight: 400;
    z-index: 10;
}

/* ===== Panel Dividers ===== */
.panel-divider {
    width: 4px;
    min-width: 4px;
    height: 100vh;
    flex-shrink: 0;
    background: var(--aurora-main);
    opacity: 0.6;
}

/* ===== Dot Fields ===== */
.dot-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.dot-field::before,
.dot-field::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--twilight-gray);
    opacity: 0.2;
    box-shadow:
        40px 60px 0 0 var(--twilight-gray),
        120px 30px 0 0 var(--twilight-gray),
        200px 90px 0 0 var(--twilight-gray),
        80px 150px 0 0 var(--twilight-gray),
        260px 120px 0 0 var(--twilight-gray),
        340px 50px 0 0 var(--twilight-gray),
        50px 250px 0 0 var(--twilight-gray),
        180px 200px 0 0 var(--twilight-gray),
        300px 180px 0 0 var(--twilight-gray),
        420px 70px 0 0 var(--twilight-gray),
        150px 320px 0 0 var(--twilight-gray),
        380px 280px 0 0 var(--twilight-gray);
}

.dot-field::after {
    top: auto;
    bottom: 0;
    right: 0;
    left: auto;
    box-shadow:
        -60px -80px 0 0 var(--twilight-gray),
        -140px -40px 0 0 var(--twilight-gray),
        -220px -110px 0 0 var(--twilight-gray),
        -100px -170px 0 0 var(--twilight-gray),
        -280px -140px 0 0 var(--twilight-gray),
        -360px -60px 0 0 var(--twilight-gray),
        -70px -260px 0 0 var(--twilight-gray),
        -200px -220px 0 0 var(--twilight-gray),
        -320px -200px 0 0 var(--twilight-gray),
        -440px -90px 0 0 var(--twilight-gray),
        -170px -340px 0 0 var(--twilight-gray),
        -400px -300px 0 0 var(--twilight-gray);
}

/* ===== Plus Markers ===== */
.panel::after {
    content: '+';
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: var(--ionosphere-blue);
    opacity: 0.25;
    z-index: 10;
}

/* ===== Orbit Lines ===== */
.orbit {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--ionosphere-blue);
    opacity: 0.1;
    pointer-events: none;
}

.orbit-1 {
    width: clamp(400px, 80vw, 750px);
    height: clamp(400px, 80vw, 750px);
    z-index: 2;
}

.orbit-2 {
    width: clamp(500px, 95vw, 900px);
    height: clamp(500px, 95vw, 900px);
    z-index: 2;
}

.orbit-3 {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.orbit-4 {
    width: 120px;
    height: 120px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ===== Keyframes ===== */
@keyframes aurora-rotate {
    from { --aurora-angle: 0deg; }
    to { --aurora-angle: 360deg; }
}

@keyframes blob-morph-1 {
    0%   { border-radius: 40% 60% 55% 45% / 60% 40% 45% 55%; }
    25%  { border-radius: 55% 45% 60% 40% / 45% 55% 40% 60%; }
    50%  { border-radius: 45% 55% 40% 60% / 55% 45% 60% 40%; }
    75%  { border-radius: 60% 40% 45% 55% / 40% 60% 55% 45%; }
    100% { border-radius: 40% 60% 55% 45% / 60% 40% 45% 55%; }
}

@keyframes blob-morph-2 {
    0%   { border-radius: 55% 45% 40% 60% / 40% 60% 55% 45%; }
    25%  { border-radius: 40% 60% 45% 55% / 55% 45% 60% 40%; }
    50%  { border-radius: 60% 40% 55% 45% / 45% 55% 40% 60%; }
    75%  { border-radius: 45% 55% 60% 40% / 60% 40% 45% 55%; }
    100% { border-radius: 55% 45% 40% 60% / 40% 60% 55% 45%; }
}

@keyframes blob-morph-3 {
    0%   { border-radius: 60% 40% 45% 55% / 45% 55% 60% 40%; }
    33%  { border-radius: 45% 55% 60% 40% / 60% 40% 45% 55%; }
    66%  { border-radius: 55% 45% 40% 60% / 40% 60% 55% 45%; }
    100% { border-radius: 60% 40% 45% 55% / 45% 55% 60% 40%; }
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); box-shadow: 0 0 50px rgba(0, 230, 118, 0.3); }
    50%      { transform: scale(1.08); box-shadow: 0 0 80px rgba(0, 230, 118, 0.5); }
}

@keyframes panel-enter-blob {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

@keyframes panel-enter-text {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes composition-reveal {
    from { clip-path: inset(50%); opacity: 0; }
    to   { clip-path: inset(0%); opacity: 1; }
}

@keyframes strip-morph {
    0%, 100% { border-radius: 40% 60% 55% 45% / 60% 40% 45% 55%; }
    33%      { border-radius: 55% 45% 60% 40% / 45% 55% 40% 60%; }
    66%      { border-radius: 60% 40% 45% 55% / 40% 60% 55% 45%; }
}

/* ===== PANEL 1: Entry ===== */
.panel-1 {
    z-index: 1;
}

.blob-hero {
    width: clamp(300px, 70vw, 600px);
    height: clamp(300px, 70vw, 600px);
    border-radius: 40% 60% 55% 45% / 60% 40% 45% 55%;
    background: conic-gradient(from var(--aurora-angle), #00E676, #00BCD4, #7C4DFF, #FF4081, #00E676);
    animation:
        blob-morph-1 15s ease-in-out infinite,
        aurora-rotate 12s linear infinite;
    box-shadow: 0 0 80px rgba(0, 230, 118, 0.3), 0 0 160px rgba(124, 77, 255, 0.15);
    z-index: 3;
    transition: transform 0.3s ease-out;
    will-change: transform, border-radius;
}

.domain-name {
    position: absolute;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(4rem, 12vw, 10rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--frost-white);
    mix-blend-mode: difference;
    text-align: center;
    z-index: 10;
    pointer-events: none;
    line-height: 1;
}

/* ===== PANEL 2: Statement ===== */
.panel-2 {
    flex-direction: row;
}

.panel-2-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: 100%;
}

.blob-cluster {
    width: 33.33%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.blob {
    position: absolute;
    background: conic-gradient(from var(--aurora-angle), #00E676, #00BCD4, #7C4DFF, #FF4081, #00E676);
    animation: aurora-rotate 12s linear infinite;
    box-shadow: 0 0 30px rgba(0, 230, 118, 0.2);
    opacity: 0.8;
    transition: transform 0.3s ease-out;
    will-change: transform, border-radius;
}

.blob-cluster-1 {
    width: 150px;
    height: 150px;
    border-radius: 40% 60% 55% 45% / 60% 40% 45% 55%;
    top: 25%;
    left: 20%;
    animation: blob-morph-1 8s ease-in-out infinite, aurora-rotate 12s linear infinite;
}

.blob-cluster-2 {
    width: 120px;
    height: 120px;
    border-radius: 55% 45% 60% 40% / 45% 55% 40% 60%;
    top: 45%;
    left: 45%;
    animation: blob-morph-2 10s ease-in-out infinite, aurora-rotate 12s linear infinite;
    animation-delay: -2s;
}

.blob-cluster-3 {
    width: 100px;
    height: 100px;
    border-radius: 60% 40% 45% 55% / 40% 60% 55% 45%;
    top: 60%;
    left: 25%;
    animation: blob-morph-3 12s ease-in-out infinite, aurora-rotate 12s linear infinite;
    animation-delay: -4s;
}

.statement-text {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 6rem 0 4rem;
}

.statement-text p {
    font-family: 'Inter', sans-serif;
    font-size: clamp(0.85rem, 1.2vw, 1.1rem);
    font-weight: 300;
    letter-spacing: 0.02em;
    line-height: 1.8;
    color: var(--frost-white);
    max-width: 520px;
}

/* ===== PANEL 3: Gallery ===== */
.panel-3 {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-container {
    width: 80%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-blob {
    width: 100%;
    height: 100%;
    border-radius: 40% 60% 55% 45% / 60% 40% 45% 55%;
    background: rgba(0, 230, 118, 0.05);
    border: 1px solid rgba(0, 188, 212, 0.2);
    animation: blob-morph-1 14s ease-in-out infinite;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2rem;
    padding: 4rem;
    position: relative;
    overflow: hidden;
}

.composition {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    opacity: 0;
    clip-path: inset(50%);
}

.composition.visible {
    animation: composition-reveal 0.8s ease-in-out forwards;
}

.composition-1.visible { animation-delay: 0.1s; }
.composition-2.visible { animation-delay: 0.3s; }
.composition-3.visible { animation-delay: 0.5s; }
.composition-4.visible { animation-delay: 0.7s; }

/* Geometric shapes */
.geo-circle {
    position: absolute;
    border-radius: 50%;
    mix-blend-mode: screen;
}

.geo-c1 {
    width: 80px;
    height: 80px;
    background: rgba(0, 230, 118, 0.25);
    border: 1px solid rgba(0, 188, 212, 0.3);
}

.geo-c2 {
    width: 60px;
    height: 60px;
    background: rgba(124, 77, 255, 0.2);
    border: 1px solid rgba(124, 77, 255, 0.3);
    transform: translate(25px, -15px);
}

.geo-c3 {
    width: 45px;
    height: 45px;
    background: rgba(255, 64, 129, 0.15);
    border: 1px solid rgba(255, 64, 129, 0.25);
    transform: translate(-20px, 20px);
}

.geo-rect {
    position: absolute;
    background: var(--ionosphere-blue);
    mix-blend-mode: screen;
}

.geo-r1 {
    width: 70px;
    height: 35px;
    opacity: 0.25;
    transform: rotate(25deg);
}

.geo-r2 {
    width: 50px;
    height: 25px;
    opacity: 0.18;
    transform: rotate(-20deg) translate(30px, 15px);
}

.geo-diamond {
    position: absolute;
    width: 40px;
    height: 40px;
    background: var(--magnetosphere-purple);
    opacity: 0.2;
    transform: rotate(45deg) translate(-10px, 25px);
    mix-blend-mode: screen;
}

.geo-triangle {
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom: 70px solid var(--solar-wind-pink);
    opacity: 0.35;
    mix-blend-mode: screen;
}

.geo-tri-sm {
    position: absolute;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-bottom: 45px solid var(--magnetosphere-purple);
    opacity: 0.25;
    transform: translate(20px, -10px) rotate(15deg);
}

.geo-hexagon {
    width: 80px;
    height: 80px;
    background: conic-gradient(from var(--aurora-angle), #00E676, #00BCD4, #7C4DFF, #FF4081);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    opacity: 0.45;
    animation: aurora-rotate 12s linear infinite;
}

/* ===== PANEL 4: Rhythm ===== */
.panel-4 {
    display: flex;
    align-items: center;
    justify-content: center;
}

.morse-line {
    position: absolute;
    top: 50%;
    left: 5%;
    width: 90%;
    height: 1px;
    background: repeating-linear-gradient(
        90deg,
        var(--ionosphere-blue) 0px,
        var(--ionosphere-blue) 12px,
        transparent 12px,
        transparent 20px,
        var(--ionosphere-blue) 20px,
        var(--ionosphere-blue) 24px,
        transparent 24px,
        transparent 36px
    );
    opacity: 0.15;
    z-index: 1;
}

.rhythm-sequence {
    display: flex;
    gap: 2.5vw;
    height: 60%;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.rhythm-strip {
    width: clamp(60px, 12vw, 100px);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: conic-gradient(from var(--aurora-angle), #00E676, #00BCD4, #7C4DFF, #FF4081, #00E676);
    box-shadow: 0 0 25px rgba(0, 230, 118, 0.15);
    animation:
        strip-morph 10s ease-in-out infinite,
        aurora-rotate 12s linear infinite;
    border-radius: 40% 60% 55% 45% / 60% 40% 45% 55%;
}

.strip-1 { animation-delay: 0s, 0s; }
.strip-2 { animation-delay: -1.5s, -2s; }
.strip-3 { animation-delay: -3s, -4s; }
.strip-4 { animation-delay: -4.5s, -6s; }
.strip-5 { animation-delay: -6s, -8s; }
.strip-6 { animation-delay: -7.5s, -10s; }

.rhythm-glyph {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--frost-white);
    mix-blend-mode: difference;
    font-weight: 400;
    user-select: none;
}

/* ===== PANEL 5: Depth ===== */
.panel-5 {
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
}

.depth-container {
    position: relative;
    width: 70%;
    height: 70%;
    transform-style: preserve-3d;
}

.depth-blob {
    position: absolute;
    background: conic-gradient(from var(--aurora-angle), #00E676, #00BCD4, #7C4DFF, #FF4081, #00E676);
    animation: aurora-rotate 12s linear infinite;
    box-shadow: 0 0 40px rgba(0, 230, 118, 0.2);
    transition: transform 0.3s ease-out;
    will-change: transform;
}

.depth-1 {
    width: 220px;
    height: 220px;
    border-radius: 40% 60% 55% 45% / 60% 40% 45% 55%;
    top: 5%;
    left: 5%;
    opacity: 0.9;
    z-index: 1;
    animation: blob-morph-1 8s ease-in-out infinite, aurora-rotate 12s linear infinite;
}

.depth-2 {
    width: 190px;
    height: 190px;
    border-radius: 55% 45% 60% 40% / 45% 55% 40% 60%;
    top: 18%;
    left: 22%;
    opacity: 0.7;
    z-index: 2;
    animation: blob-morph-2 10s ease-in-out infinite, aurora-rotate 12s linear infinite;
    animation-delay: -2s;
}

.depth-3 {
    width: 160px;
    height: 160px;
    border-radius: 60% 40% 45% 55% / 40% 60% 55% 45%;
    top: 30%;
    left: 38%;
    opacity: 0.55;
    z-index: 3;
    animation: blob-morph-3 12s ease-in-out infinite, aurora-rotate 12s linear infinite;
    animation-delay: -4s;
}

.depth-4 {
    width: 130px;
    height: 130px;
    border-radius: 45% 55% 40% 60% / 55% 45% 60% 40%;
    top: 40%;
    left: 54%;
    opacity: 0.4;
    z-index: 4;
    animation: blob-morph-1 14s ease-in-out infinite, aurora-rotate 12s linear infinite;
    animation-delay: -6s;
}

.depth-5 {
    width: 100px;
    height: 100px;
    border-radius: 55% 45% 60% 40% / 45% 55% 40% 60%;
    top: 50%;
    left: 68%;
    opacity: 0.3;
    z-index: 5;
    animation: blob-morph-2 16s ease-in-out infinite, aurora-rotate 12s linear infinite;
    animation-delay: -8s;
}

/* ===== PANEL 6: Close ===== */
.panel-6 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.close-blob {
    width: 120px;
    height: 120px;
    border-radius: 40% 60% 55% 45% / 60% 40% 45% 55%;
    background: conic-gradient(from var(--aurora-angle), #00E676, #00BCD4, #7C4DFF, #FF4081, #00E676);
    animation:
        pulse-glow 3s ease-in-out infinite,
        blob-morph-1 10s ease-in-out infinite,
        aurora-rotate 12s linear infinite;
    box-shadow: 0 0 60px rgba(0, 230, 118, 0.4);
}

.close-domain {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--twilight-gray);
    text-align: center;
}

/* ===== Progress Bar ===== */
.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--aurora-main);
    width: 0%;
    z-index: 1000;
    transition: width 0.15s ease-out;
}

/* ===== Cursor Glow ===== */
.cursor-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 500;
    background: radial-gradient(
        circle 300px at var(--cursor-x) var(--cursor-y),
        rgba(0, 230, 118, 0.12) 0%,
        transparent 70%
    );
    transition: background 0.1s ease-out;
}

/* ===== Grid Trace ===== */
.grid-trace {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

/* ===== Panel Enter Animations ===== */
.panel.entering .blob-hero,
.panel.entering .blob,
.panel.entering .close-blob {
    animation-name: panel-enter-blob, blob-morph-1, aurora-rotate;
    animation-duration: 0.6s, 15s, 12s;
    animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1), ease-in-out, linear;
    animation-fill-mode: forwards, none, none;
    animation-iteration-count: 1, infinite, infinite;
}

.panel.entering .statement-text p,
.panel.entering .close-domain,
.panel.entering .domain-name {
    animation: panel-enter-text 0.4s ease-in-out 0.2s both;
}

.panel.entering .composition {
    animation: composition-reveal 0.8s ease-in-out both;
}

/* ===== Responsive: Vertical on Mobile ===== */
@media (max-width: 768px) {
    .scroll-container {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        scroll-snap-type: y mandatory;
    }

    .panel {
        width: 100vw;
        min-width: 100vw;
        height: 100vh;
        scroll-snap-align: start;
    }

    .panel-divider {
        width: 100%;
        min-width: 100%;
        height: 4px;
        min-height: 4px;
    }

    .blob-hero {
        width: clamp(200px, 55vw, 350px);
        height: clamp(200px, 55vw, 350px);
    }

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

    /* Panel 2 stacks vertically */
    .panel-2 {
        flex-direction: column;
    }

    .panel-2-inner {
        flex-direction: column;
    }

    .blob-cluster {
        width: 100%;
        height: 40%;
    }

    .blob-cluster-1 { width: 100px; height: 100px; top: 20%; left: 30%; }
    .blob-cluster-2 { width: 80px; height: 80px; top: 40%; left: 55%; }
    .blob-cluster-3 { width: 65px; height: 65px; top: 55%; left: 35%; }

    .statement-text {
        padding: 2rem;
        justify-content: center;
    }

    .gallery-blob {
        padding: 2rem;
        gap: 1rem;
    }

    .rhythm-sequence {
        gap: 1.5vw;
    }

    .rhythm-strip {
        width: clamp(45px, 10vw, 70px);
    }

    .depth-container {
        width: 85%;
        height: 60%;
    }

    .depth-1 { width: 140px; height: 140px; }
    .depth-2 { width: 120px; height: 120px; }
    .depth-3 { width: 100px; height: 100px; }
    .depth-4 { width: 85px; height: 85px; }
    .depth-5 { width: 70px; height: 70px; }

    .cursor-glow {
        display: none;
    }

    .grid-trace {
        display: none;
    }

    .progress-bar {
        bottom: auto;
        top: 0;
    }

    .orbit { display: none; }
}

/* ===== Extra Small ===== */
@media (max-width: 480px) {
    .panel-number {
        top: 1rem;
        left: 1rem;
        font-size: 0.55rem;
    }

    .blob-hero {
        width: clamp(160px, 50vw, 280px);
        height: clamp(160px, 50vw, 280px);
    }

    .domain-name {
        font-size: clamp(1.8rem, 8vw, 3.5rem);
    }

    .statement-text {
        padding: 1.5rem;
    }

    .statement-text p {
        font-size: 0.85rem;
    }

    .gallery-blob {
        padding: 1.5rem;
        gap: 0.75rem;
    }

    .rhythm-sequence {
        gap: 0.8vw;
        height: 50%;
    }

    .rhythm-strip {
        width: clamp(35px, 8vw, 55px);
    }

    .rhythm-glyph {
        font-size: clamp(1rem, 2.5vw, 1.5rem);
    }

    .close-blob {
        width: 80px;
        height: 80px;
    }

    .close-domain {
        font-size: 0.6rem;
    }
}
