/* ================================================
   lunge.dev - Horizontal Temple Walk
   Japanese "ma" concept, aurora gradient mesh,
   candlelit atmospheric navigation
   ================================================ */

/* --- Design Color Reference ---
   Aurora Rose:   #A04070
   Aurora Teal:   #40A080
   Aurora Gold:   #D4A84B
   Aurora Violet: #6040A0
   Candle Amber:  #FFB84D
   Fonts: Libre Baskerville, Noto Sans JP, Shippori Mincho
   -------------------------------- */

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

html, body {
    height: 100%;
    overflow: hidden;
    background: #1A1410;
    color: #E8DCC8;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 300;
    font-size: clamp(14px, 1vw, 17px);
    line-height: 2.0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

/* --- Panels --- */
.panel {
    position: relative;
    min-width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Panel backgrounds */
.panel-1 {
    background-color: #1A1410;
}

.panel-2 {
    background-color: #2A1A0A;
}

.panel-3 {
    background-color: #0A1A2A;
}

.panel-4 {
    background-color: #1A0A1A;
}

.panel-5 {
    background-color: #0A1A18;
}

.panel-6 {
    background-color: #0A0A2A;
}

/* --- Aurora Mesh Backgrounds --- */
.aurora-mesh {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.aurora-mesh-1 {
    background:
        radial-gradient(ellipse at 30% 70%, rgba(160, 64, 112, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 40%, rgba(64, 160, 128, 0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 90%, rgba(212, 168, 75, 0.10) 0%, transparent 40%);
    animation: meshShift1 12s ease-in-out infinite alternate;
}

.aurora-mesh-2 {
    background:
        radial-gradient(ellipse at 20% 80%, rgba(160, 64, 112, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 30%, rgba(64, 160, 128, 0.10) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 50%, rgba(212, 168, 75, 0.15) 0%, transparent 45%),
        radial-gradient(ellipse at 80% 70%, rgba(96, 64, 160, 0.08) 0%, transparent 50%);
    animation: meshShift2 14s ease-in-out infinite alternate;
}

.aurora-mesh-3 {
    background:
        radial-gradient(ellipse at 60% 20%, rgba(64, 160, 128, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 25% 75%, rgba(96, 64, 160, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 60%, rgba(160, 64, 112, 0.08) 0%, transparent 45%),
        radial-gradient(ellipse at 40% 40%, rgba(212, 168, 75, 0.06) 0%, transparent 60%);
    animation: meshShift3 16s ease-in-out infinite alternate;
}

.aurora-mesh-4 {
    background:
        radial-gradient(ellipse at 40% 30%, rgba(160, 64, 112, 0.14) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 80%, rgba(96, 64, 160, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 20% 60%, rgba(64, 160, 128, 0.08) 0%, transparent 45%),
        radial-gradient(ellipse at 60% 50%, rgba(212, 168, 75, 0.06) 0%, transparent 50%);
    animation: meshShift4 13s ease-in-out infinite alternate;
}

.aurora-mesh-5 {
    background:
        radial-gradient(ellipse at 50% 70%, rgba(64, 160, 128, 0.14) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 20%, rgba(160, 64, 112, 0.08) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 40%, rgba(96, 64, 160, 0.10) 0%, transparent 45%),
        radial-gradient(ellipse at 15% 85%, rgba(212, 168, 75, 0.12) 0%, transparent 50%);
    animation: meshShift5 15s ease-in-out infinite alternate;
}

.aurora-mesh-6 {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(160, 64, 112, 0.18) 0%, transparent 45%),
        radial-gradient(ellipse at 30% 30%, rgba(64, 160, 128, 0.16) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(96, 64, 160, 0.14) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 50%, rgba(212, 168, 75, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 40% 60%, rgba(255, 184, 77, 0.10) 0%, transparent 40%);
    animation: meshShift6 10s ease-in-out infinite alternate;
}

/* Aurora mesh animations */
@keyframes meshShift1 {
    0% { background-position: 0% 0%, 0% 0%, 0% 0%; }
    100% { background-position: 5% -5%, -3% 4%, 4% -3%; }
}

@keyframes meshShift2 {
    0% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    100% { background-position: -4% 6%, 5% -3%, -3% 5%, 4% -4%; }
}

@keyframes meshShift3 {
    0% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    100% { background-position: 6% -4%, -5% 3%, 3% -6%, -4% 5%; }
}

@keyframes meshShift4 {
    0% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    100% { background-position: -3% 5%, 4% -5%, -6% 3%, 5% -4%; }
}

@keyframes meshShift5 {
    0% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    100% { background-position: 5% -3%, -4% 6%, 3% -5%, -5% 4%; }
}

@keyframes meshShift6 {
    0% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    100% { background-position: -5% 5%, 4% -4%, -3% 6%, 5% -3%, -4% 4%; }
}

/* --- Panel Content --- */
.panel-content {
    position: relative;
    z-index: 2;
    max-width: 400px;
    text-align: center;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 800ms ease, transform 800ms ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

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

/* --- Typography --- */
.logotype {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 56px);
    color: #E8DCC8;
    letter-spacing: 0.05em;
    opacity: 0;
    animation: logotypeFadeIn 1.5s ease forwards;
    animation-delay: 0.8s;
}

@keyframes logotypeFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-heading {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(22px, 3vw, 44px);
    color: #E8DCC8;
    letter-spacing: 0.03em;
    line-height: 1.3;
}

.panel-heading em {
    font-style: italic;
}

.panel-body {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 300;
    font-size: clamp(14px, 1vw, 17px);
    line-height: 2.0;
    color: #E8DCC8;
    opacity: 0.85;
    max-width: 360px;
}

.jp-accent {
    font-family: 'Shippori Mincho', serif;
    font-weight: 400;
    font-size: clamp(32px, 4vw, 64px);
    color: #E8DCC8;
    opacity: 0.15;
    letter-spacing: 0.1em;
    margin-top: 16px;
}

/* --- Panel Dividers (Shoji screen edges) --- */
.panel-divider {
    position: absolute;
    right: 0;
    top: 10%;
    height: 80%;
    width: 1px;
    background: rgba(232, 220, 200, 0.2);
    z-index: 3;
}

/* --- Candle Elements --- */
.candle {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 40px;
}

.panel-1 .candle {
    margin-top: 60px;
}

.candle-flame {
    filter: drop-shadow(0 0 8px rgba(255, 184, 77, 0.3));
    animation: flicker 2s ease-in-out infinite;
    opacity: 0;
    animation-delay: 0.8s;
    animation-fill-mode: forwards;
}

@keyframes flicker {
    0% {
        transform: scaleY(1) scaleX(1) rotate(0deg);
        opacity: 1;
        filter: drop-shadow(0 0 8px rgba(255, 184, 77, 0.3));
    }
    15% {
        transform: scaleY(1.05) scaleX(0.95) rotate(-1deg);
        opacity: 0.92;
        filter: drop-shadow(0 0 10px rgba(255, 184, 77, 0.35));
    }
    30% {
        transform: scaleY(0.97) scaleX(1.02) rotate(1deg);
        opacity: 1;
        filter: drop-shadow(0 0 7px rgba(255, 184, 77, 0.28));
    }
    50% {
        transform: scaleY(1.08) scaleX(0.93) rotate(-0.5deg);
        opacity: 0.88;
        filter: drop-shadow(0 0 12px rgba(255, 184, 77, 0.4));
    }
    70% {
        transform: scaleY(0.95) scaleX(1.04) rotate(0.5deg);
        opacity: 1;
        filter: drop-shadow(0 0 6px rgba(255, 184, 77, 0.25));
    }
    85% {
        transform: scaleY(1.03) scaleX(0.97) rotate(-0.8deg);
        opacity: 0.95;
        filter: drop-shadow(0 0 9px rgba(255, 184, 77, 0.32));
    }
    100% {
        transform: scaleY(1) scaleX(1) rotate(0deg);
        opacity: 1;
        filter: drop-shadow(0 0 8px rgba(255, 184, 77, 0.3));
    }
}

.candle-glow {
    width: 60px;
    height: 30px;
    background: radial-gradient(ellipse, rgba(255, 184, 77, 0.3) 0%, transparent 70%);
    margin-top: -5px;
    animation: glowPulse 3s ease-in-out infinite alternate;
}

@keyframes glowPulse {
    0% {
        opacity: 0.6;
        transform: scaleX(1);
    }
    100% {
        opacity: 1;
        transform: scaleX(1.15);
    }
}

/* --- Scroll Hint --- */
.scroll-hint {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    animation: hintFadeIn 1s ease forwards;
    animation-delay: 2.5s;
}

.scroll-hint-text {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 300;
    font-size: 12px;
    color: #E8DCC8;
    opacity: 0.4;
    letter-spacing: 0.15em;
    text-transform: lowercase;
}

.scroll-arrow {
    animation: arrowSlide 2s ease-in-out infinite;
}

@keyframes hintFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes arrowSlide {
    0%, 100% {
        transform: translateX(0);
        opacity: 0.4;
    }
    50% {
        transform: translateX(6px);
        opacity: 0.7;
    }
}

/* --- Aurora Burst (Panel 6) --- */
.aurora-burst {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background:
        radial-gradient(ellipse at 40% 40%, rgba(160, 64, 112, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 60%, rgba(64, 160, 128, 0.22) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(96, 64, 160, 0.20) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 184, 77, 0.18) 0%, transparent 40%);
    filter: blur(40px);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: burstPulse 8s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes burstPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.15);
        opacity: 1;
    }
}

.final-heading {
    position: relative;
    z-index: 2;
}

.final-body {
    position: relative;
    z-index: 2;
}

/* --- Aurora mesh pulse for panel 1 --- */
.aurora-mesh-1 {
    animation: meshShift1 12s ease-in-out infinite alternate, meshPulse 8s ease-in-out infinite alternate;
}

@keyframes meshPulse {
    0% { opacity: 1; }
    100% { opacity: 1.03; }
}
