/* ==========================================================================
   pencloser.com - Navy-Metallic Vaporwave Horizontal Scroll
   Palette: #0d1b2a, #1b2a3d, #8a9bb0, #c0c8d4, #5a7a6a, #7a6e5a, #e8edf2, #2c2c2c
   Fonts: Roboto Slab 700, Source Serif 4 300/400, Caveat 400
   ========================================================================== */

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

html {
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

body {
    overflow: hidden;
    overflow-y: hidden;
    height: 100vh;
    width: 100vw;
    background: #0d1b2a;
    font-family: 'Source Serif 4', Georgia, serif;
    color: #8a9bb0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
.section-heading {
    font-family: 'Roboto Slab', 'Courier New', monospace;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: #c0c8d4;
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    letter-spacing: 0.01em;
    line-height: 1.75;
    color: #8a9bb0;
    max-width: 38ch;
}

.annotation {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.4rem);
    color: #5a7a6a;
    display: block;
    margin-top: 1.8rem;
    font-style: italic;
}

/* --- Parallax Curves Background --- */
.parallax-curves {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.bg-curve {
    fill: none;
    stroke-linecap: round;
}

.curve-1 {
    stroke: #8a9bb0;
    stroke-width: 2;
    opacity: 0.08;
}

.curve-2 {
    stroke: #c0c8d4;
    stroke-width: 1.5;
    opacity: 0.1;
}

.curve-3 {
    stroke: #7a6e5a;
    stroke-width: 2.5;
    opacity: 0.12;
}

.curve-4 {
    stroke: #8a9bb0;
    stroke-width: 1.8;
    opacity: 0.09;
}

/* --- Scroll Container --- */
.scroll-container {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    height: 100vh;
    width: 100vw;
    position: relative;
    z-index: 1;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

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

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

/* Panel backgrounds */
.panel-1 { background: #0d1b2a; }
.panel-2 { background: #1b2a3d; }
.panel-3 { background: #0d1b2a; }
.panel-4 { background: #1b2a3d; }
.panel-5 { background: #0d1b2a; }
.panel-6 { background: #e8edf2; }
.panel-7 { background: #e8edf2; }
.panel-8 { background: #0d1b2a; }

/* --- Panel 1: Entry --- */
.panel-1-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.title-svg {
    width: 70vw;
    max-width: 900px;
    height: auto;
}

.ink-flourish {
    animation: flourishPulse 6s ease-in-out infinite alternate;
}

@keyframes flourishPulse {
    0% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

/* Scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 10vh;
    right: 8vw;
    opacity: 0.3;
    animation: hintPulse 2s ease-in-out infinite;
    transition: opacity 0.8s ease;
}

.scroll-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

@keyframes hintPulse {
    0%, 100% { transform: translateX(0); opacity: 0.3; }
    50% { transform: translateX(6px); opacity: 0.5; }
}

/* --- Panel Split Layout (Panels 2-5) --- */
.panel-split {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0 3vw;
    gap: 6vw;
}

.panel-illustration {
    flex: 0 0 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.panel-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 0;
}

.panel-left {
    order: 0;
}

.panel-right {
    order: 1;
}

/* Alternate layout for panels 3 and 5 (text left, illustration right) */
.panel-3 .panel-text.panel-left {
    flex: 1;
    order: 0;
}

.panel-3 .panel-illustration.panel-right {
    flex: 0 0 60%;
    order: 1;
}

.panel-5 .panel-text.panel-left {
    flex: 1;
    order: 0;
}

.panel-5 .panel-illustration.panel-right {
    flex: 0 0 60%;
    order: 1;
}

.illustration {
    width: 100%;
    max-width: 500px;
    height: auto;
}

/* --- Panels 6-7: Flowing --- */
.panel-flowing {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
}

.flowing-text-svg {
    width: 90%;
    max-width: 900px;
    height: auto;
}

.curved-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    letter-spacing: 0.01em;
}

.curved-text-accent {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 22px;
}

/* Light panel typography overrides */
.panel-6 .section-heading,
.panel-7 .section-heading {
    color: #0d1b2a;
}

.panel-6 .body-text,
.panel-7 .body-text {
    color: #1b2a3d;
}

/* --- Panel 8: Close --- */
.panel-close {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 3rem;
}

.close-heading {
    font-family: 'Roboto Slab', 'Courier New', monospace;
    font-weight: 700;
    font-size: clamp(2.8rem, 5vw, 5.5rem);
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: #c0c8d4;
}

.close-motif {
    width: 160px;
    height: auto;
    opacity: 0.5;
}

/* --- Progress Bar --- */
.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #5a7a6a, #8a9bb0, #c0c8d4);
    z-index: 100;
    transition: width 0.1s ease;
    pointer-events: none;
}

/* --- Navigation Dots --- */
.nav-dots {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 100;
    pointer-events: auto;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8a9bb0;
    opacity: 0.25;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.dot.active {
    opacity: 0.7;
    transform: scale(1.3);
    background: #c0c8d4;
}

.dot:hover {
    opacity: 0.5;
}

/* --- Slow morph animation for background curves (CSS breathing) --- */
.parallax-curves .bg-curve {
    animation: curveBreathe 35s ease-in-out infinite alternate;
}

.curve-1 { animation-delay: 0s; }
.curve-2 { animation-delay: -8s; }
.curve-3 { animation-delay: -16s; }
.curve-4 { animation-delay: -24s; }

@keyframes curveBreathe {
    0% { transform: translateY(0px); }
    25% { transform: translateY(8px); }
    50% { transform: translateY(-5px); }
    75% { transform: translateY(10px); }
    100% { transform: translateY(-3px); }
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
    .panel-split {
        flex-direction: column;
        gap: 2vh;
        padding: 3vh 5vw;
    }

    .panel-illustration {
        flex: 0 0 55%;
        width: 100%;
    }

    .panel-text {
        flex: 0 0 40%;
        width: 100%;
    }

    .panel-3 .panel-text.panel-left {
        order: 0;
    }

    .panel-3 .panel-illustration.panel-right {
        order: 1;
    }

    .panel-5 .panel-text.panel-left {
        order: 0;
    }

    .panel-5 .panel-illustration.panel-right {
        order: 1;
    }

    .illustration {
        max-width: 80vw;
    }

    .title-svg {
        width: 90vw;
    }

    .body-text {
        max-width: 90vw;
    }

    .close-heading {
        font-size: clamp(1.8rem, 6vw, 3.5rem);
    }

    .flowing-text-svg {
        width: 95%;
    }

    .curved-text {
        font-size: 14px;
    }

    .curved-text-accent {
        font-size: 18px;
    }
}
