/* ==========================================================================
   rust.quest - Holographic Oxidation Descent
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #0D0A0F;
    color: #E8E0F0;
    font-family: 'Bitter', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
    cursor: none;
}

/* --- Holographic Gradient Animation --- */
@keyframes holoRotate {
    0% { --holo-angle: 0deg; }
    100% { --holo-angle: 360deg; }
}

@property --holo-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes holoConicSpin {
    from { filter: hue-rotate(0deg); }
    to { filter: hue-rotate(360deg); }
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

@keyframes mandalaPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

@keyframes interferenceShift {
    0% { transform: translateX(0); }
    50% { transform: translateX(3px); }
    100% { transform: translateX(0); }
}

@keyframes particleDrift {
    from { transform: translateY(0); }
    to { transform: translateY(100vh); }
}

/* --- Scroll Depth Indicator --- */
#scroll-indicator {
    position: fixed;
    top: 0;
    right: 12px;
    width: 2px;
    height: 0%;
    background: linear-gradient(180deg, #FF6B9D, #00E5FF, #FFD93D, #C084FC, #FF6B9D);
    z-index: 100;
    transition: height 0.1s linear;
    box-shadow: 0 0 8px rgba(255, 107, 157, 0.4), 0 0 20px rgba(0, 229, 255, 0.2);
}

/* --- Cursor-Follow Holographic Orb --- */
#holo-orb {
    position: fixed;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #FF6B9D, #00E5FF, #FFD93D, #C084FC, #FF6B9D);
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 50;
    opacity: 0.6;
    filter: blur(2px);
    transform: translate(-50%, -50%);
    transition: opacity 0.3s;
    animation: holoConicSpin 12s linear infinite;
    box-shadow: 0 0 30px rgba(255, 107, 157, 0.3), 0 0 60px rgba(0, 229, 255, 0.15);
}

/* --- Particle Canvas --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 20;
    pointer-events: none;
}

/* --- Holographic Interference Lines --- */
#interference-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.08;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            #FF6B9D 3px,
            #FF6B9D 3.5px,
            transparent 3.5px,
            transparent 8px,
            #00E5FF 8px,
            #00E5FF 8.5px,
            transparent 8.5px,
            transparent 16px,
            #FFD93D 16px,
            #FFD93D 16.5px,
            transparent 16.5px,
            transparent 29px,
            #C084FC 29px,
            #C084FC 29.5px,
            transparent 29.5px,
            transparent 50px
        );
    animation: interferenceShift 6s ease-in-out infinite;
}

/* --- Strata (Sections) --- */
.stratum {
    position: relative;
    min-height: 150vh;
    overflow: hidden;
}

.stratum-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

/* --- Oxidation Map Textures --- */
.oxidation-map {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.oxidation-map-0 {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(255, 159, 67, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(255, 107, 157, 0.06) 0%, transparent 50%);
}

.oxidation-map-1 {
    background:
        radial-gradient(ellipse at 20% 30%, rgba(255, 159, 67, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 70%, rgba(255, 107, 157, 0.1) 0%, transparent 45%),
        radial-gradient(ellipse at 80% 20%, rgba(192, 132, 252, 0.08) 0%, transparent 40%),
        conic-gradient(from 45deg at 50% 50%, rgba(255, 107, 157, 0.05), rgba(0, 229, 255, 0.05), rgba(255, 217, 61, 0.05), rgba(192, 132, 252, 0.05), rgba(255, 107, 157, 0.05));
}

.oxidation-map-2 {
    background:
        radial-gradient(ellipse at 40% 50%, rgba(192, 132, 252, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 75% 30%, rgba(0, 229, 255, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 20% 80%, rgba(255, 159, 67, 0.12) 0%, transparent 50%),
        conic-gradient(from 120deg at 50% 50%, rgba(255, 107, 157, 0.08), rgba(0, 229, 255, 0.08), rgba(255, 217, 61, 0.08), rgba(192, 132, 252, 0.08), rgba(255, 107, 157, 0.08));
}

.oxidation-map-3 {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(192, 132, 252, 0.2) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 30%, rgba(0, 229, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(255, 107, 157, 0.15) 0%, transparent 50%),
        conic-gradient(from 200deg at 50% 50%, rgba(255, 107, 157, 0.15), rgba(0, 229, 255, 0.15), rgba(255, 217, 61, 0.15), rgba(192, 132, 252, 0.15), rgba(255, 107, 157, 0.15));
}

/* --- Stratum Backgrounds --- */
.stratum-0-bg {
    background-color: #0D0A0F;
}

.stratum-1-bg {
    background: linear-gradient(180deg, #0D0A0F 0%, #1A1225 100%);
}

.stratum-2-bg {
    background: linear-gradient(180deg, #1A1225 0%, #0D0A0F 50%, #1A1225 100%);
}

.stratum-3-bg {
    background: linear-gradient(180deg, #1A1225 0%, #0D0A0F 100%);
}

/* --- Stratum Content --- */
.stratum-content {
    position: relative;
    z-index: 10;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 5vw;
}

/* --- STRATUM 0: Surface --- */
.stratum-0 {
    display: flex;
    align-items: center;
    justify-content: center;
}

.stratum-0-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding-top: 20vh;
}

.title-rust {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(5rem, 18vw, 14rem);
    letter-spacing: 0.06em;
    line-height: 1;
    background: conic-gradient(from 0deg, #FF6B9D, #00E5FF, #FFD93D, #C084FC, #FF6B9D);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: holoConicSpin 12s linear infinite;
    text-shadow: none;
    position: relative;
}

.letter {
    display: inline-block;
    transition: opacity 1.2s ease, transform 1.2s ease, filter 1s ease;
}

.letter.dissolving {
    opacity: 0;
    transform: translateY(-30px) scale(0.8);
    filter: blur(8px);
}

.subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #C084FC;
    margin-top: 3rem;
    opacity: 0;
    transition: opacity 1.5s ease 0.5s;
    text-shadow: 0 0 10px rgba(192, 132, 252, 0.3), 0 0 30px rgba(192, 132, 252, 0.15);
}

.subtitle.visible {
    opacity: 1;
}

/* --- Transition Zones --- */
.transition-zone {
    height: 20vh;
    position: relative;
    z-index: 5;
}

.transition-01 {
    background: linear-gradient(180deg,
        #0D0A0F 0%,
        rgba(255, 107, 157, 0.03) 30%,
        rgba(0, 229, 255, 0.03) 50%,
        rgba(192, 132, 252, 0.03) 70%,
        #1A1225 100%
    );
}

.transition-12 {
    background: linear-gradient(180deg,
        #1A1225 0%,
        rgba(0, 229, 255, 0.05) 30%,
        rgba(255, 217, 61, 0.04) 50%,
        rgba(255, 107, 157, 0.05) 70%,
        #1A1225 100%
    );
}

.transition-23 {
    background: linear-gradient(180deg,
        #1A1225 0%,
        rgba(192, 132, 252, 0.06) 30%,
        rgba(255, 107, 157, 0.05) 50%,
        rgba(0, 229, 255, 0.06) 70%,
        #0D0A0F 100%
    );
}

/* --- Panels --- */
.panel {
    max-width: 55%;
    padding: 2.5rem 3rem;
    margin-bottom: 8vh;
    position: relative;
    border: 1px solid rgba(192, 132, 252, 0.15);
    background: rgba(13, 10, 15, 0.7);
    backdrop-filter: blur(4px);
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel.revealed {
    opacity: 1;
    transform: translateX(0) rotate(var(--panel-rotation, 0deg));
}

.panel-left {
    margin-left: 30%;
    --panel-rotation: 2deg;
}

.panel-left.panel-oxidation-2 {
    --panel-rotation: -1deg;
    margin-top: 10vh;
}

.panel-right {
    margin-left: auto;
    margin-right: 30%;
    transform: translateX(60px);
    --panel-rotation: -1.5deg;
}

.panel-right.revealed {
    transform: translateX(0) rotate(var(--panel-rotation, 0deg));
}

.panel::before {
    content: '';
    position: absolute;
    inset: -1px;
    border: 1px solid transparent;
    background: conic-gradient(from 0deg, #FF6B9D, #00E5FF, #FFD93D, #C084FC, #FF6B9D) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: holoConicSpin 12s linear infinite;
    opacity: 0.4;
    pointer-events: none;
}

.panel-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #00E5FF;
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.panel-heading {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: 0.04em;
    color: #E8E0F0;
    margin-bottom: 1.2rem;
    line-height: 1.2;
}

.panel-text {
    font-family: 'Bitter', serif;
    font-weight: 400;
    color: #E8E0F0;
    opacity: 0.9;
}

/* --- Glow Text (Stratum 2) --- */
.glow-text {
    text-shadow:
        0 0 10px rgba(255, 107, 157, 0.3),
        0 0 30px rgba(255, 107, 157, 0.15),
        0 0 60px rgba(255, 107, 157, 0.08);
    animation: glowPulse 3s ease-in-out infinite;
}

.panel-refraction-1 .glow-text {
    text-shadow:
        0 0 10px rgba(255, 107, 157, 0.3),
        0 0 30px rgba(255, 107, 157, 0.15),
        0 0 60px rgba(255, 107, 157, 0.08);
}

.panel-refraction-2 .glow-text {
    text-shadow:
        0 0 10px rgba(0, 229, 255, 0.3),
        0 0 30px rgba(0, 229, 255, 0.15),
        0 0 60px rgba(0, 229, 255, 0.08);
}

.panel-refraction-3 .glow-text {
    text-shadow:
        0 0 10px rgba(255, 217, 61, 0.3),
        0 0 30px rgba(255, 217, 61, 0.15),
        0 0 60px rgba(255, 217, 61, 0.08);
}

/* --- Stratum 1 Layout --- */
.stratum-1-content {
    padding-top: 25vh;
    padding-bottom: 20vh;
}

/* --- Stratum 2 Layout --- */
.stratum-2 {
    min-height: 180vh;
}

.stratum-2-content {
    padding-top: 20vh;
    padding-bottom: 20vh;
    display: flex;
    flex-direction: column;
    gap: 5vh;
}

.panel-refraction-1 {
    --panel-rotation: -2deg;
    max-width: 50%;
}

.panel-refraction-2 {
    --panel-rotation: 1.5deg;
    max-width: 50%;
}

.panel-refraction-3 {
    --panel-rotation: -1deg;
    max-width: 50%;
}

/* --- Circuit Rust SVG Overlays --- */
.circuit-rust-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0.12;
}

.circuit-svg {
    width: 100%;
    height: 100%;
}

.circuit-trace {
    fill: none;
    stroke: url(#holoGradInline);
    stroke-width: 1.5;
    stroke-linecap: round;
}

.circuit-trace.broken {
    stroke-dasharray: 8 4;
    opacity: 0.6;
}

.rust-bloom {
    fill: rgba(255, 159, 67, 0.15);
    stroke: #FF9F43;
    stroke-width: 0.5;
    opacity: 0.4;
}

/* Inline holographic gradient for circuit traces */
.circuit-rust-1 .circuit-trace,
.circuit-rust-2 .circuit-trace {
    stroke: #C084FC;
}

.circuit-rust-1 .circuit-trace:nth-child(odd),
.circuit-rust-2 .circuit-trace:nth-child(odd) {
    stroke: #00E5FF;
}

/* --- Circuit Dividers --- */
.circuit-divider {
    width: 60%;
    margin: 2vh auto;
    opacity: 0.3;
}

.divider-svg {
    width: 100%;
    height: 30px;
}

.circuit-trace-divider {
    fill: none;
    stroke: #C084FC;
    stroke-width: 1;
    stroke-linecap: round;
}

.circuit-trace-divider.broken {
    stroke-dasharray: 5 3;
    stroke: #FF6B9D;
    opacity: 0.6;
}

.rust-bloom-sm {
    fill: rgba(255, 159, 67, 0.25);
    stroke: rgba(255, 159, 67, 0.4);
    stroke-width: 0.5;
}

/* --- STRATUM 3: Transcendence --- */
.stratum-3 {
    min-height: 120vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stratum-3-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

/* --- Mandala --- */
.mandala-container {
    width: clamp(300px, 50vw, 550px);
    height: clamp(300px, 50vw, 550px);
    margin: 0 auto;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.mandala-container.revealed {
    opacity: 1;
    transform: scale(1);
}

.mandala-svg {
    width: 100%;
    height: 100%;
    animation: mandalaRotate 60s linear infinite;
}

.mandala-ring {
    fill: none;
    stroke-width: 1;
    stroke: #C084FC;
    opacity: 0.5;
}

.ring-outer {
    stroke: #FF6B9D;
    opacity: 0.4;
}

.ring-outer-2 {
    stroke: #00E5FF;
    opacity: 0.3;
    stroke-dasharray: 12 4;
}

.mandala-circuit {
    fill: none;
    stroke: #FFD93D;
    stroke-width: 1.5;
    opacity: 0.6;
}

.mandala-geo {
    fill: none;
    stroke-width: 1;
    opacity: 0.35;
}

.geo-1 {
    stroke: #FF6B9D;
}

.geo-2 {
    stroke: #00E5FF;
}

.geo-3 {
    stroke: #FFD93D;
}

.mandala-trace {
    stroke: rgba(192, 132, 252, 0.2);
    stroke-width: 0.5;
}

.mandala-center {
    fill: none;
    stroke: #FF6B9D;
    stroke-width: 2;
    animation: mandalaPulse 3s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(255, 107, 157, 0.4)) drop-shadow(0 0 30px rgba(255, 107, 157, 0.2));
}

.mandala-center-inner {
    fill: #FFD93D;
    opacity: 0.8;
    filter: drop-shadow(0 0 8px rgba(255, 217, 61, 0.5));
}

/* --- Closing Text --- */
.closing-text {
    font-family: 'Bitter', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: #E8E0F0;
    margin-top: 6vh;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.5s ease 0.3s, transform 1.5s ease 0.3s;
    text-shadow:
        0 0 10px rgba(192, 132, 252, 0.3),
        0 0 30px rgba(192, 132, 252, 0.15),
        0 0 60px rgba(192, 132, 252, 0.08);
}

.closing-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Mono Accent Utility --- */
.mono-accent {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .title-rust,
    #holo-orb,
    .panel::before {
        animation: none;
    }

    .mandala-svg {
        animation: none;
    }

    .mandala-center {
        animation: none;
    }

    .glow-text {
        animation: none;
    }

    #interference-lines {
        animation: none;
    }

    .letter {
        transition: none;
    }

    .panel {
        transition-duration: 0.01s;
    }

    .closing-text,
    .mandala-container,
    .subtitle {
        transition-duration: 0.01s;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .panel {
        max-width: 85%;
        margin-left: 7.5% !important;
        margin-right: 7.5% !important;
        padding: 1.5rem 2rem;
    }

    .panel-left,
    .panel-right {
        --panel-rotation: 0deg;
    }

    .panel-refraction-1,
    .panel-refraction-2,
    .panel-refraction-3 {
        max-width: 85%;
    }

    .circuit-divider {
        width: 80%;
    }

    .title-rust {
        font-size: clamp(3rem, 15vw, 6rem);
    }

    #holo-orb {
        display: none;
    }

    body {
        cursor: auto;
    }
}
