/* =========================================
   bada.day - A Day at the Korean Sea
   ========================================= */

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

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

body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    background: #0A0E1A;
    color: #E0F5F0;
    transition: background-color 0.1s linear;
}

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

/* --- Sound Toggle --- */
#sound-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 200;
    background: none;
    border: 1px solid rgba(224, 245, 240, 0.2);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(224, 245, 240, 0.5);
    transition: color 0.3s ease, border-color 0.3s ease;
    padding: 0;
}

#sound-toggle:hover {
    color: rgba(224, 245, 240, 0.8);
    border-color: rgba(224, 245, 240, 0.4);
}

/* --- Main Horizontal Scroll Container --- */
.ocean-scroll {
    display: flex;
    width: 500vw;
    height: 100vh;
    overflow: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

/* Actual scrollable wrapper - applied on body or a wrapper */
#ocean-scroll {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

#ocean-scroll::-webkit-scrollbar {
    display: none;
}

#ocean-scroll > .ocean-scroll {
    display: flex;
}

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

.zone-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    transition: opacity 0.3s ease;
}

/* --- Horizon Line --- */
.horizon-line {
    position: absolute;
    top: 60%;
    left: 0;
    width: 100%;
    height: 1px;
    z-index: 10;
    opacity: 0.3;
    transition: background-color 0.5s ease;
}

.zone-predawn .horizon-line {
    background: linear-gradient(90deg, transparent, #2D1B69, #1B1464, #2D1B69, transparent);
}

.zone-morning .horizon-line {
    background: linear-gradient(90deg, transparent, #1A936F, #0B6E6E, #1A936F, transparent);
}

.zone-noon .horizon-line {
    background: linear-gradient(90deg, transparent, #0892D0, #F5E6C8, #0892D0, transparent);
}

.zone-dusk .horizon-line {
    background: linear-gradient(90deg, transparent, #D4890A, #6B5B7B, #D4890A, transparent);
}

.zone-night .horizon-line {
    background: linear-gradient(90deg, transparent, #00FFE0, #8B5CF6, #00FFE0, transparent);
    opacity: 0.15;
}

/* --- Watermark Text --- */
.watermark-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Noto Serif KR', serif;
    font-weight: 900;
    font-size: clamp(40rem, 60vw, 80rem);
    opacity: 0.035;
    z-index: 1;
    pointer-events: none;
    white-space: nowrap;
    letter-spacing: 0.1em;
    line-height: 1;
    user-select: none;
}

.zone-predawn .watermark-text {
    color: #2D1B69;
}

.zone-morning .watermark-text {
    color: #1A936F;
}

.zone-noon .watermark-text {
    color: #0892D0;
}

.zone-dusk .watermark-text {
    color: #D4890A;
}

.zone-night .watermark-text {
    color: #8B5CF6;
}

/* --- Wave Container --- */
.wave-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 45%;
    z-index: 20;
    pointer-events: none;
}

.wave-svg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 100%;
}

.wave-1 { z-index: 5; }
.wave-2 { z-index: 4; }
.wave-3 { z-index: 3; }
.wave-4 { z-index: 2; }
.wave-5 { z-index: 1; }

/* Pre-Dawn Wave Colors */
.zone-predawn .wave-1 .wave-path { fill: rgba(27, 20, 100, 0.4); }
.zone-predawn .wave-2 .wave-path { fill: rgba(45, 27, 105, 0.25); }
.zone-predawn .wave-3 .wave-path { fill: rgba(10, 14, 26, 0.35); }

/* Morning Tide Wave Colors */
.zone-morning .wave-1 .wave-path { fill: rgba(11, 110, 110, 0.45); }
.zone-morning .wave-2 .wave-path { fill: rgba(26, 147, 111, 0.3); }
.zone-morning .wave-3 .wave-path { fill: rgba(224, 245, 240, 0.15); }
.zone-morning .wave-4 .wave-path { fill: rgba(11, 110, 110, 0.2); }
.zone-morning .wave-5 .wave-path { fill: rgba(26, 147, 111, 0.1); }

/* High Noon Wave Colors */
.zone-noon .wave-1 .wave-path { fill: rgba(8, 146, 208, 0.35); }
.zone-noon .wave-2 .wave-path { fill: rgba(245, 230, 200, 0.2); }

/* Dusk Ebb Wave Colors */
.zone-dusk .wave-1 .wave-path { fill: rgba(212, 137, 10, 0.35); }
.zone-dusk .wave-2 .wave-path { fill: rgba(47, 93, 98, 0.25); }
.zone-dusk .wave-3 .wave-path { fill: rgba(107, 91, 123, 0.2); }

/* Night Sea Wave Colors */
.zone-night .wave-1 .wave-path { fill: rgba(0, 255, 224, 0.1); }
.zone-night .wave-2 .wave-path { fill: rgba(139, 92, 246, 0.08); }

/* --- Zone Content (Typography) --- */
.zone-content {
    position: relative;
    z-index: 50;
    text-align: center;
    pointer-events: none;
}

.korean-title {
    font-family: 'Noto Serif KR', serif;
    font-weight: 900;
    font-size: clamp(12rem, 18vw, 35rem);
    letter-spacing: 0.15em;
    line-height: 1;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.korean-title.visible {
    opacity: 1;
    transform: scale(1);
}

.zone-subtitle {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    line-height: 1.8;
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 1s ease-out 0.3s;
    letter-spacing: 0.05em;
}

.zone-subtitle.visible {
    opacity: 0.7;
}

/* Zone-specific typography colors */
.zone-predawn .korean-title {
    color: #2D1B69;
    text-shadow: 0 0 80px rgba(27, 20, 100, 0.5);
}

.zone-predawn .zone-subtitle {
    color: rgba(45, 27, 105, 0.6);
}

.zone-morning .korean-title {
    color: rgba(224, 245, 240, 0.85);
    text-shadow: 0 0 60px rgba(224, 245, 240, 0.3);
}

.zone-morning .zone-subtitle {
    color: rgba(224, 245, 240, 0.6);
}

.zone-noon .korean-title {
    color: #F5E6C8;
    text-shadow: 0 0 80px rgba(255, 111, 97, 0.3);
}

.zone-noon .zone-subtitle {
    color: rgba(245, 230, 200, 0.7);
}

.zone-dusk .korean-title {
    color: #D4890A;
    text-shadow: 0 0 60px rgba(212, 137, 10, 0.3);
}

.zone-dusk .zone-subtitle {
    color: rgba(212, 137, 10, 0.5);
}

.zone-night .korean-title {
    color: #00FFE0;
    text-shadow: 0 0 80px rgba(0, 255, 224, 0.2);
}

.zone-night .zone-subtitle {
    color: rgba(0, 255, 224, 0.4);
}

/* Night pulse animation */
.night-pulse {
    animation: nightPulse 4s ease-in-out infinite;
}

@keyframes nightPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.night-pulse.visible {
    animation: nightPulse 4s ease-in-out infinite;
}

/* --- Zone Backgrounds --- */
.zone-predawn {
    background: radial-gradient(ellipse at 50% 60%, #1B1464 0%, #0A0E1A 70%);
}

.zone-morning {
    background: linear-gradient(180deg, #0B6E6E 0%, #1A936F 40%, #E0F5F0 100%);
}

.zone-noon {
    background: linear-gradient(180deg, #0892D0 0%, #F5E6C8 50%, #FF6F61 100%);
}

.zone-dusk {
    background: linear-gradient(180deg, #6B5B7B 0%, #D4890A 40%, #2F5D62 100%);
}

.zone-night {
    background: radial-gradient(ellipse at 50% 60%, #0A0E1A 0%, #0A0E1A 100%);
}

/* --- Porthole Mask (Zone 3 - High Noon) --- */
.porthole-mask {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(280px, 40vw, 500px);
    height: clamp(280px, 40vw, 500px);
    border-radius: 50%;
    overflow: hidden;
    z-index: 30;
    background: radial-gradient(circle, rgba(8, 146, 208, 0.3) 0%, rgba(8, 146, 208, 0.1) 60%, transparent 100%);
    border: 2px solid rgba(245, 230, 200, 0.15);
    box-shadow: 0 0 60px rgba(8, 146, 208, 0.15), inset 0 0 40px rgba(8, 146, 208, 0.1);
}

.porthole-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Haenyeo Silhouette --- */
.haenyeo-svg {
    width: 45%;
    height: auto;
    color: rgba(245, 230, 200, 0.6);
    opacity: 0;
    transform: translateY(0);
    transition: opacity 0.5s ease;
}

.haenyeo-svg.visible {
    opacity: 1;
}

.haenyeo-svg.sinking {
    animation: haenyeoSink 8s ease-in forwards;
}

.haenyeo-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 3s ease-out;
}

.haenyeo-path.drawn {
    stroke-dashoffset: 0;
}

@keyframes haenyeoSink {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(60px); opacity: 0.2; }
}

/* --- Sea Life Motifs --- */
.sea-life-motifs {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.sea-motif {
    position: absolute;
    width: 30px;
    height: 30px;
    color: rgba(245, 230, 200, 0.4);
    animation: floatMotif 6s ease-in-out infinite;
}

.motif-1 { top: 15%; left: 20%; animation-delay: 0s; animation-duration: 7s; }
.motif-2 { top: 25%; right: 18%; animation-delay: 1s; animation-duration: 5.5s; }
.motif-3 { bottom: 30%; left: 25%; animation-delay: 2s; animation-duration: 8s; }
.motif-4 { top: 40%; right: 30%; animation-delay: 0.5s; animation-duration: 6s; }
.motif-5 { bottom: 20%; right: 22%; animation-delay: 1.5s; animation-duration: 7.5s; }

@keyframes floatMotif {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(5px, -8px) rotate(5deg); }
    50% { transform: translate(-3px, 5px) rotate(-3deg); }
    75% { transform: translate(7px, 3px) rotate(2deg); }
}

/* --- Bioluminescence (Zone 5) --- */
.bioluminescence {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    pointer-events: none;
}

/* --- Tidal Navigation --- */
.tidal-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 150;
    cursor: pointer;
    user-select: none;
}

.tidal-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        #1B1464 0%,
        #2D1B69 10%,
        #0B6E6E 20%,
        #1A936F 30%,
        #0892D0 40%,
        #F5E6C8 50%,
        #FF6F61 55%,
        #D4890A 65%,
        #6B5B7B 75%,
        #2F5D62 80%,
        #0A0E1A 90%,
        #0A0E1A 100%
    );
    opacity: 0.6;
}

.tidal-chart {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.tidal-chart-svg {
    width: 100%;
    height: 100%;
}

.tidal-sine {
    animation: tidalOscillate 12s ease-in-out infinite;
}

@keyframes tidalOscillate {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(2px); }
}

.tidal-scrubber {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #E0F5F0;
    box-shadow: 0 0 10px rgba(224, 245, 240, 0.5);
    transition: left 0.15s ease-out;
    pointer-events: none;
    left: 0%;
}

.tidal-timestamps {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-around;
    pointer-events: none;
}

.tidal-time {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.6rem, 0.8vw, 0.75rem);
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: rgba(224, 245, 240, 0.4);
    opacity: 0.6;
}

/* --- Dusk stroke-reveal animation --- */
.zone-dusk .korean-title {
    -webkit-text-stroke: 2px #D4890A;
    color: transparent;
    background: linear-gradient(90deg, #D4890A 0%, transparent 100%);
    -webkit-background-clip: text;
    background-clip: text;
    background-size: 200% 100%;
    background-position: -100% 0;
    transition: background-position 2s ease-out, opacity 0.8s ease-out, transform 0.8s ease-out;
}

.zone-dusk .korean-title.visible {
    background-position: 0% 0;
    opacity: 1;
    transform: scale(1);
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .korean-title {
        font-size: clamp(6rem, 14vw, 18rem);
    }

    .watermark-text {
        font-size: clamp(20rem, 45vw, 40rem);
    }

    .porthole-mask {
        width: clamp(200px, 70vw, 350px);
        height: clamp(200px, 70vw, 350px);
    }

    #sound-toggle {
        top: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
    }
}
