/* =============================================
   genpatsu.quest - Pop Art Zen Meditation
   ============================================= */

/* CSS Custom Properties */
:root {
    --deep-burgundy: #4A0E1B;
    --aged-rice-paper: #F5F0E8;
    --vermillion-pop: #C44536;
    --lichtenstein-yellow: #F2C744;
    --midnight-burgundy: #2D0A12;
    --twilight-mauve: #6B4C5A;
    --mountain-dust: #D4C4B0;

    --font-display: 'Libre Baskerville', serif;
    --font-body: 'Source Sans 3', sans-serif;
    --font-accent: 'Caveat', cursive;

    --elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --elastic-soft: cubic-bezier(0.34, 1.56, 0.64, 1);
    --elastic-settle: cubic-bezier(0.22, 1.2, 0.36, 1);
}

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

html {
    scroll-snap-type: y mandatory;
    overflow-x: hidden;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: var(--font-body);
    background: var(--deep-burgundy);
    color: var(--aged-rice-paper);
    overflow-x: hidden;
}

/* =============================================
   Scroll Container
   ============================================= */
.scroll-container {
    width: 100vw;
}

/* =============================================
   Panels - Full Viewport
   ============================================= */
.panel {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* Panel themes */
.panel[data-theme="dark"] {
    background-color: var(--deep-burgundy);
}

.panel[data-theme="light"] {
    background-color: var(--aged-rice-paper);
}

.panel[data-theme="dust"] {
    background-color: var(--mountain-dust);
}

.panel[data-theme="pop"] {
    background-color: var(--deep-burgundy);
}

.panel[data-theme="mauve"] {
    background-color: var(--deep-burgundy);
}

/* =============================================
   Horizon Split Panels
   ============================================= */
.panel-horizon {
    display: flex;
    flex-direction: column;
}

.panel-upper {
    flex: 0 0 61.8%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.panel-lower {
    flex: 0 0 38.2%;
    position: relative;
    overflow: hidden;
}

/* =============================================
   Centered Void Panels
   ============================================= */
.panel-void {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.void-center {
    width: 40vmin;
    height: 40vmin;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =============================================
   Benday Field Panel
   ============================================= */
.panel-benday {
    position: relative;
}

.benday-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, var(--vermillion-pop) 2px, transparent 2px);
    background-size: 12px 12px;
    opacity: 0.2;
    mix-blend-mode: multiply;
    z-index: 1;
    pointer-events: none;
}

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

/* =============================================
   Typography
   ============================================= */
.panel-title {
    font-family: var(--font-display);
    font-size: clamp(48px, 8vw, 96px);
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-align: center;
    color: var(--aged-rice-paper);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 1s var(--elastic);
}

.panel-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.title-dark {
    color: var(--deep-burgundy);
}

.title-pop {
    color: var(--lichtenstein-yellow);
    text-shadow: 3px 3px 0 var(--midnight-burgundy);
    font-size: clamp(56px, 10vw, 120px);
}

.title-final {
    font-size: clamp(64px, 12vw, 160px);
    color: var(--twilight-mauve);
}

.void-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(30px);
    z-index: 3;
    pointer-events: none;
}

.void-title.visible {
    transform: translate(-50%, -50%) translateY(0);
}

/* Annotations - handwritten */
.annotation {
    font-family: var(--font-accent);
    font-size: clamp(14px, 2vw, 18px);
    color: var(--vermillion-pop);
    position: absolute;
    opacity: 0;
    transform: rotate(-3deg);
    transition: opacity 0.6s ease 0.4s;
    pointer-events: none;
}

.annotation.visible {
    opacity: 1;
}

.annotation-1 {
    bottom: 15%;
    right: 10%;
    transform: rotate(-2deg);
}

.annotation-2 {
    bottom: 20%;
    left: 8%;
    transform: rotate(3deg);
}

.annotation-3 {
    top: 12%;
    right: 6%;
    transform: rotate(-4deg);
}

.annotation-4 {
    bottom: 25%;
    right: 12%;
    transform: rotate(2deg);
}

/* Panel 1 light text on dark */
#panel1 .annotation {
    color: var(--vermillion-pop);
}

/* =============================================
   Mountain SVGs
   ============================================= */
.mountain-svg {
    display: block;
}

.mountain-distant,
.mountain-layered,
.mountain-descent {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.mountain-explosive {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
}

.mountain-centered {
    width: 100%;
    height: 100%;
}

.mountain-question {
    width: 100%;
    height: 100%;
}

.mountain-final {
    width: 100%;
    height: 100%;
    opacity: 0.5;
}

/* Mountain ridge fills */
.mountain-ridge {
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Panel 1 - dark theme */
#panel0 .ridge-far {
    fill: var(--twilight-mauve);
    stroke: var(--midnight-burgundy);
    stroke-width: 2;
    opacity: 0.6;
}

#panel0 .ridge-mid {
    fill: var(--deep-burgundy);
    stroke: var(--midnight-burgundy);
    stroke-width: 3;
}

/* Panel 3 - dust theme */
#panel2 .ridge-back {
    fill: var(--twilight-mauve);
    stroke: var(--midnight-burgundy);
    stroke-width: 2;
    opacity: 0.7;
}

#panel2 .ridge-front {
    fill: var(--deep-burgundy);
    stroke: var(--midnight-burgundy);
    stroke-width: 3;
}

/* Panel 5 - Benday pop theme */
#panel4 .ridge-bold-back {
    fill: var(--vermillion-pop);
    stroke: var(--midnight-burgundy);
    stroke-width: 4;
    opacity: 0.8;
}

#panel4 .ridge-bold-front {
    fill: var(--deep-burgundy);
    stroke: var(--midnight-burgundy);
    stroke-width: 4;
}

/* Panel 6 - mauve descent */
#panel5 .ridge-soft-far {
    fill: var(--twilight-mauve);
    stroke: var(--midnight-burgundy);
    stroke-width: 2;
    opacity: 0.5;
}

#panel5 .ridge-soft-mid {
    fill: var(--deep-burgundy);
    stroke: var(--midnight-burgundy);
    stroke-width: 3;
}

/* Panel 7 - ghost ridge */
.ridge-ghost {
    fill: var(--twilight-mauve);
    stroke: var(--midnight-burgundy);
    stroke-width: 1.5;
    opacity: 0.3;
}

/* Mountain peak - light panels */
.mountain-peak {
    fill: var(--deep-burgundy);
    stroke: var(--midnight-burgundy);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.9;
}

/* Atmospheric layers */
.atmo-layer {
    opacity: 0.15;
}

.atmo-1 {
    fill: var(--twilight-mauve);
}

.atmo-2 {
    fill: var(--mountain-dust);
    opacity: 0.1;
}

.atmo-3 {
    fill: var(--twilight-mauve);
    opacity: 0.12;
}

/* =============================================
   Reactor Silhouette
   ============================================= */
.reactor-silhouette {
    fill: var(--midnight-burgundy);
    stroke: var(--midnight-burgundy);
    stroke-width: 1.5;
    stroke-linecap: round;
    opacity: 0.85;
}

.reactor-building {
    fill: var(--midnight-burgundy);
    stroke: var(--midnight-burgundy);
    stroke-width: 1;
    opacity: 0.8;
}

.reactor-steam {
    fill: none;
    stroke: var(--twilight-mauve);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 4 3;
    opacity: 0.5;
}

/* =============================================
   Concentric Circles
   ============================================= */
.concentric-ring {
    fill: none;
    stroke: var(--deep-burgundy);
    stroke-width: 2;
    stroke-linecap: round;
    opacity: 0;
    transform-origin: center;
    transition: opacity 0.8s ease, transform 1.2s var(--elastic);
}

.concentric-ring.visible {
    opacity: 0.6;
}

.ring-1 { stroke-dasharray: 6 4; }
.ring-2 { stroke-dasharray: 8 5; stroke-width: 1.5; }
.ring-3 { stroke-dasharray: 10 6; stroke-width: 1; }

/* Dark panel concentric rings */
#panel3 .concentric-ring {
    stroke: var(--aged-rice-paper);
}

.ring-large-1 { stroke-dasharray: 8 4; stroke-width: 2.5; }
.ring-large-2 { stroke-dasharray: 10 6; stroke-width: 2; }
.ring-large-3 { stroke-dasharray: 14 8; stroke-width: 1.5; }
.ring-large-4 { stroke-dasharray: 18 10; stroke-width: 1; }

/* Pop panel concentric */
.concentric-pop {
    fill: none;
    stroke: var(--lichtenstein-yellow);
    stroke-width: 3;
    stroke-linecap: round;
    opacity: 0;
    transition: opacity 0.6s ease, transform 1s var(--elastic);
}

.concentric-pop.visible {
    opacity: 0.7;
}

.pop-1 { stroke-dasharray: 8 4; }
.pop-2 { stroke-dasharray: 12 6; stroke-width: 2.5; }
.pop-3 { stroke-dasharray: 16 8; stroke-width: 2; }

/* =============================================
   Steam / Cloud Animations
   ============================================= */
.steam-group {
    position: absolute;
    width: 60px;
    height: 150px;
    z-index: 3;
    pointer-events: none;
}

.steam-1 {
    bottom: 30%;
    left: 25%;
}

.steam-2 {
    bottom: 25%;
    left: 35%;
}

.steam-3 {
    bottom: 20%;
    right: 30%;
}

.steam-4 {
    bottom: 25%;
    left: 45%;
}

.steam-path {
    fill: none;
    stroke: var(--aged-rice-paper);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 6 4;
    opacity: 0.3;
    animation: steamRise 40s infinite linear;
}

.steam-delay-1 {
    animation-delay: -15s;
    opacity: 0.2;
}

.steam-delay-2 {
    animation-delay: -28s;
    opacity: 0.25;
}

@keyframes steamRise {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0.3;
    }
    25% {
        transform: translateY(-30px) translateX(5px);
        opacity: 0.25;
    }
    50% {
        transform: translateY(-60px) translateX(-3px);
        opacity: 0.2;
    }
    75% {
        transform: translateY(-90px) translateX(4px);
        opacity: 0.15;
    }
    100% {
        transform: translateY(-120px) translateX(0);
        opacity: 0;
    }
}

/* Dust/mauve theme steam */
#panel2 .steam-path,
#panel5 .steam-path {
    stroke: var(--twilight-mauve);
    opacity: 0.25;
}

/* =============================================
   Scroll Progress Indicator
   ============================================= */
.scroll-progress {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    height: 60vh;
}

.progress-track {
    position: relative;
    width: 2px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.progress-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 0%;
    background: var(--deep-burgundy);
    transition: height 0.5s var(--elastic-settle);
}

.progress-track::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 100%;
    background: var(--twilight-mauve);
    opacity: 0.3;
}

.progress-node {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--twilight-mauve);
    opacity: 0.4;
    position: relative;
    z-index: 2;
    transition: transform 0.5s var(--elastic), opacity 0.3s ease, background-color 0.3s ease;
}

.progress-node.active {
    background: var(--vermillion-pop);
    opacity: 1;
    animation: nodePulse 2s infinite var(--elastic);
}

@keyframes nodePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(196, 69, 54, 0.4);
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 0 6px rgba(196, 69, 54, 0);
    }
}

/* =============================================
   Panel Entry Animations
   ============================================= */
.panel-content-enter {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 1s var(--elastic);
}

.panel-content-enter.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Concentric ring expansion */
.concentric-ring.expand {
    transform: scale(1);
}

.concentric-ring.expand.ring-1,
.concentric-ring.expand.ring-large-1 {
    transition-delay: 0s;
}

.concentric-ring.expand.ring-2,
.concentric-ring.expand.ring-large-2 {
    transition-delay: 0.15s;
}

.concentric-ring.expand.ring-3,
.concentric-ring.expand.ring-large-3 {
    transition-delay: 0.3s;
}

.concentric-ring.expand.ring-large-4 {
    transition-delay: 0.45s;
}

.concentric-pop.expand.pop-1 {
    transition-delay: 0s;
}

.concentric-pop.expand.pop-2 {
    transition-delay: 0.15s;
}

.concentric-pop.expand.pop-3 {
    transition-delay: 0.3s;
}

/* =============================================
   Responsive - Below 768px
   ============================================= */
@media (max-width: 768px) {
    .panel-upper {
        flex: 0 0 50%;
    }

    .panel-lower {
        flex: 0 0 50%;
    }

    .panel-title {
        font-size: clamp(36px, 8vw, 64px);
    }

    .title-pop {
        font-size: clamp(42px, 10vw, 80px);
    }

    .void-center {
        width: 30vw;
        height: 30vw;
    }

    /* Progress moves to bottom horizontal */
    .scroll-progress {
        right: auto;
        top: auto;
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
        height: auto;
        width: 60vw;
    }

    .progress-track {
        width: 100%;
        height: 2px;
        flex-direction: row;
    }

    .progress-line {
        top: 50%;
        left: 0;
        transform: translateY(-50%);
        width: 0%;
        height: 2px;
    }

    .progress-track::before {
        top: 50%;
        left: 0;
        transform: translateY(-50%);
        width: 100%;
        height: 1px;
    }

    .annotation {
        font-size: 14px;
    }

    .steam-group {
        width: 40px;
        height: 100px;
    }

    .benday-overlay {
        background-size: 8px 8px;
    }
}

/* =============================================
   Mountain Ridge Divider Transitions
   ============================================= */
.panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 5;
    pointer-events: none;
}

/* Dark to light transition */
#panel0::after {
    background: linear-gradient(to bottom,
        transparent 0%,
        var(--aged-rice-paper) 100%
    );
}

/* Light to dust transition */
#panel1::after {
    background: linear-gradient(to bottom,
        transparent 0%,
        var(--mountain-dust) 100%
    );
}

/* Dust to dark transition */
#panel2::after {
    background: linear-gradient(to bottom,
        transparent 0%,
        var(--deep-burgundy) 100%
    );
}

/* Dark to pop transition */
#panel3::after {
    background: linear-gradient(to bottom,
        transparent 0%,
        var(--deep-burgundy) 100%
    );
    opacity: 0;
}

/* Pop to mauve transition */
#panel4::after {
    background: linear-gradient(to bottom,
        transparent 0%,
        var(--deep-burgundy) 100%
    );
}

/* Mauve to dark final */
#panel5::after {
    background: linear-gradient(to bottom,
        transparent 0%,
        var(--deep-burgundy) 100%
    );
}

.panel-final::after {
    display: none;
}
