/* ===================================================
   miris.one -- Fairycore Aquatic Horizontal Scroll
   =================================================== */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    background: #1a2744;
}

/* --- Palette Custom Properties --- */
:root {
    --koi-dawn: #f7c59f;
    --lotus-pink: #e8a0bf;
    --scaled-teal: #5bbfb5;
    --river-glass: #3d9ea0;
    --fern-shadow: #2a6b5a;
    --midnight-koi: #1a2744;
    --opal-flicker: #d4e7f7;
    --neon-gill: #ff6b8a;
}

/* --- Scroll Viewport --- */
#scroll-viewport {
    width: 100vw;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar across browsers */
#scroll-viewport::-webkit-scrollbar {
    display: none;
}
#scroll-viewport {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- Scroll Container --- */
#scroll-container {
    display: flex;
    flex-direction: row;
    width: 600vw;
    height: 100vh;
    background: linear-gradient(
        90deg,
        #f7c59f 0%,
        #e8a0bf 18%,
        #5bbfb5 40%,
        #3d9ea0 58%,
        #2a6b5a 78%,
        #1a2744 100%
    );
    position: relative;
}

/* --- Water Caustic Overlay --- */
#caustic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    opacity: 0.035;
    z-index: 10;
}

@keyframes caustic-drift {
    0% { transform: translate(0, 0); }
    50% { transform: translate(20px, 10px); }
    100% { transform: translate(0, 0); }
}

/* --- Panel Base --- */
.panel {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    overflow: hidden;
}

/* --- Panel 0 -- The Surface --- */
#panel-0 {
    align-items: center;
    justify-content: center;
}

.site-name-hero {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(3rem, 18vw, 14rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--midnight-koi);
    mix-blend-mode: overlay;
    position: relative;
    z-index: 5;
    margin-left: -15%;
    cursor: default;
    line-height: 1;
    transition: color 200ms ease;
}

@keyframes swim-across {
    0% {
        transform: translateX(100vw) translateY(0px);
    }
    25% {
        transform: translateX(66vw) translateY(-15px);
    }
    50% {
        transform: translateX(33vw) translateY(5px);
    }
    75% {
        transform: translateX(0vw) translateY(-10px);
    }
    100% {
        transform: translateX(-200px) translateY(0px);
    }
}

.swimming-fish {
    position: absolute;
    width: 140px;
    height: auto;
    top: 55%;
    left: 0;
    z-index: 4;
    animation: swim-across 18s linear infinite;
    opacity: 0.7;
}

/* --- Panels 1-4 -- The Current --- */
#panel-1, #panel-2, #panel-3, #panel-4 {
    display: flex;
    flex-direction: row;
}

.panel-content {
    width: 55%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 12vw;
    padding-right: 4vw;
    position: relative;
    z-index: 5;
}

.panel-label {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(0.7rem, 1.2vw, 0.95rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--opal-flicker);
    margin-bottom: 1.5rem;
    display: inline-block;
    cursor: default;
    transition: color 200ms ease;
}

.panel-headline {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(2rem, 8vw, 6rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 0.95;
    margin-bottom: 2rem;
    cursor: default;
    transition: color 200ms ease;
}

/* Headline color progression per panel */
#panel-1 .panel-headline {
    color: var(--midnight-koi);
}

#panel-2 .panel-headline {
    color: var(--midnight-koi);
}

#panel-3 .panel-headline {
    color: var(--opal-flicker);
}

#panel-4 .panel-headline {
    color: var(--opal-flicker);
}

/* Label color progression */
#panel-1 .panel-label {
    color: var(--fern-shadow);
}

#panel-2 .panel-label {
    color: var(--midnight-koi);
}

#panel-3 .panel-label {
    color: var(--lotus-pink);
}

#panel-4 .panel-label {
    color: var(--scaled-teal);
}

.panel-body {
    font-family: 'Karla', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.4vw, 1.15rem);
    line-height: 1.72;
    max-width: 38ch;
}

/* Body text color progression */
#panel-1 .panel-body {
    color: var(--fern-shadow);
}

#panel-2 .panel-body {
    color: var(--midnight-koi);
}

#panel-3 .panel-body {
    color: var(--opal-flicker);
}

#panel-4 .panel-body {
    color: var(--opal-flicker);
}

/* --- Atmosphere Zone --- */
.panel-atmosphere {
    width: 45%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.fish {
    width: 160px;
    height: auto;
    position: relative;
    z-index: 3;
}

#panel-2 .fish {
    width: 140px;
}

#panel-3 .fish {
    width: 180px;
}

#panel-4 .fish {
    width: 180px;
}

/* --- Float Animation --- */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.fish-float {
    animation: float 4s ease-in-out infinite;
}

/* --- Panel 5 -- The Depth --- */
#panel-5 {
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.site-name-outline {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(3rem, 22vw, 16rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: transparent;
    -webkit-text-stroke: 2px var(--opal-flicker);
    position: relative;
    z-index: 5;
    margin-left: 15%;
    cursor: default;
    line-height: 1;
    transition: color 200ms ease;
}

/* --- Fish School (Panel 5) --- */
#fish-school {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.school-fish {
    position: absolute;
    transition: top 3s cubic-bezier(0.25, 0.1, 0.25, 1), left 3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

#school-discus {
    width: 110px;
    top: 15%;
    left: 10%;
    animation: float 4s ease-in-out infinite;
    animation-delay: 0s;
}

#school-angel {
    width: 95px;
    top: 60%;
    left: 70%;
    animation: float 4s ease-in-out infinite;
    animation-delay: -1s;
}

#school-betta {
    width: 120px;
    top: 25%;
    left: 65%;
    animation: float 4s ease-in-out infinite;
    animation-delay: -2s;
}

#school-arowana {
    width: 140px;
    top: 70%;
    left: 20%;
    animation: float 4s ease-in-out infinite;
    animation-delay: -3s;
}

/* School convergence state */
.school-fish.converge {
    transition: top 3s cubic-bezier(0.25, 0.1, 0.25, 1), left 3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.school-fish.scatter {
    transition: top 2s cubic-bezier(0.25, 0.1, 0.25, 1), left 2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* --- Shake Animation --- */
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
    100% { transform: translateX(0); }
}

@keyframes fish-startle {
    0% { transform: translateX(0) translateY(0); }
    15% { transform: translateX(-4px) translateY(2px); }
    30% { transform: translateX(4px) translateY(-2px); }
    45% { transform: translateX(-4px) translateY(1px); }
    60% { transform: translateX(3px) translateY(-1px); }
    75% { transform: translateX(-2px) translateY(1px); }
    100% { transform: translateX(0) translateY(0); }
}

.school-fish.startle {
    animation: fish-startle 300ms ease-in-out !important;
}

/* --- Interactive Hover --- */
.interactive {
    cursor: default;
    transition: color 200ms ease;
}

.interactive:hover {
    animation: shake 150ms ease-in-out;
    color: var(--neon-gill) !important;
    -webkit-text-stroke-color: var(--neon-gill);
}

/* --- Depth Attribution --- */
.depth-attribution {
    font-family: 'Karla', sans-serif;
    font-weight: 300;
    font-size: clamp(0.75rem, 1vw, 0.95rem);
    letter-spacing: 0.12em;
    color: var(--river-glass);
    position: absolute;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    white-space: nowrap;
    transition: color 200ms ease;
}

/* --- Progress Bar --- */
#progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 1px;
    width: 0%;
    background: var(--scaled-teal);
    z-index: 100;
    transition: width 400ms ease, background-color 300ms ease;
    pointer-events: none;
}

#progress-bar.complete {
    background: var(--neon-gill);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .panel-content {
        width: 100%;
        padding-left: 8vw;
        padding-right: 8vw;
    }

    .panel-atmosphere {
        position: absolute;
        width: 100%;
        height: 100%;
        opacity: 0.3;
    }

    #panel-1, #panel-2, #panel-3, #panel-4 {
        flex-direction: row;
        position: relative;
    }

    .panel-headline {
        font-size: clamp(2rem, 12vw, 4rem);
    }

    .site-name-hero {
        font-size: clamp(2.5rem, 15vw, 8rem);
        margin-left: -10%;
    }

    .site-name-outline {
        font-size: clamp(2.5rem, 18vw, 10rem);
        margin-left: 5%;
    }

    .fish {
        width: 100px;
    }

    #panel-3 .fish, #panel-4 .fish {
        width: 120px;
    }

    .school-fish {
        width: 80px !important;
    }
}

@media (max-width: 480px) {
    .panel-content {
        padding-left: 6vw;
        padding-right: 6vw;
    }

    .panel-body {
        font-size: clamp(0.85rem, 3.5vw, 1rem);
        max-width: 100%;
    }

    .site-name-hero {
        font-size: clamp(2rem, 14vw, 5rem);
    }

    .site-name-outline {
        font-size: clamp(2rem, 16vw, 6rem);
        -webkit-text-stroke: 1.5px var(--opal-flicker);
    }
}
