/* ============================================
   daitoua.com - Mountain Descent
   Dark-mode contemplation | Parallax sections
   Variable-fluid typography | Border-animate
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Color Palette - from DESIGN.md */
    --void-obsidian: #0A0A12;
    --mountain-charcoal: #0D0D14;
    --twilight-slate: #12121F;
    --deep-ridge: #17172A;
    --far-peak: #1C1C35;
    --granite-edge: #2D3748;
    --mist-gray: #4A5568;
    --cloud-silver: #A0AEC0;
    --frost-white: #CBD5E0;
    --dawn-amber: #C6956C;
    --dusk-indigo: #5B6FA3;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    background-color: var(--void-obsidian);
}

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1vw + 0.5rem, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--cloud-silver);
    background: linear-gradient(180deg, #0A0A12 0%, #0D0D14 30%, #0A0A12 60%, #12121F 100%);
    background-attachment: fixed;
    overflow-x: hidden;
}

/* --- Variable Fluid Typography --- */
@supports (font-variation-settings: normal) {
    .summit-title {
        font-family: 'Fraunces', serif;
        font-variation-settings: 'WONK' 1;
        font-weight: 300;
    }

    .section-heading {
        font-family: 'Fraunces', serif;
        font-variation-settings: 'WONK' 1;
        font-weight: 300;
    }

    .basecamp-heading {
        font-family: 'Fraunces', serif;
        font-variation-settings: 'WONK' 1;
        font-weight: 200;
    }
}

.summit-title,
.section-heading,
.basecamp-heading {
    font-family: 'Fraunces', serif;
    color: var(--frost-white);
}

/* --- Ghost Kanji (Klee One) --- */
.ghost-kanji {
    font-family: 'Klee One', cursive;
    font-size: clamp(4rem, 10vw, 10rem);
    position: absolute;
    opacity: 0.06;
    color: var(--mist-gray);
    pointer-events: none;
    z-index: 1;
    user-select: none;
}

#summit .ghost-kanji { top: 15%; right: 10%; }
#ridge .ghost-kanji { top: 5%; left: 5%; }
#valley .ghost-kanji { top: 20%; right: 15%; }
#ascent .ghost-kanji { bottom: 10%; left: 8%; }
#ascent-two .ghost-kanji { top: 10%; right: 8%; }
#basecamp .ghost-kanji { top: 15%; left: 12%; }

/* --- Sections (100vh) --- */
.section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* --- SUMMIT (Section 1) --- */
.section-summit {
    background-color: var(--void-obsidian);
    flex-direction: column;
}

.summit-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding-top: 8vh;
}

.summit-title {
    font-size: clamp(2.5rem, 5vw + 1rem, 5.5rem);
    font-weight: 300;
    letter-spacing: 0.08em;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 2s ease-out 0.5s forwards;
}

.summit-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.2vw, 1.1rem);
    color: var(--mist-gray);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    opacity: 0;
    animation: fadeInUp 2s ease-out 1.2s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Mountain Silhouette Layers --- */
.mountain-layer {
    position: absolute;
    bottom: 0;
    left: -5%;
    width: 110%;
    height: 40%;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

.mountain-layer-1 {
    clip-path: polygon(0% 100%, 0% 70%, 5% 65%, 12% 55%, 18% 60%, 25% 45%, 32% 50%, 38% 40%, 42% 35%, 48% 42%, 55% 30%, 60% 38%, 65% 25%, 70% 35%, 75% 28%, 80% 40%, 85% 35%, 90% 50%, 95% 45%, 100% 55%, 100% 100%);
    background-color: var(--deep-ridge);
    z-index: 4;
    height: 35%;
}

.mountain-layer-2 {
    clip-path: polygon(0% 100%, 0% 60%, 8% 55%, 15% 45%, 22% 50%, 30% 38%, 35% 42%, 42% 30%, 50% 35%, 55% 28%, 62% 40%, 68% 32%, 75% 45%, 82% 38%, 88% 48%, 95% 42%, 100% 50%, 100% 100%);
    background-color: var(--far-peak);
    z-index: 3;
    height: 45%;
}

.mountain-layer-3 {
    clip-path: polygon(0% 100%, 0% 55%, 10% 50%, 20% 42%, 28% 48%, 35% 38%, 45% 45%, 52% 35%, 60% 42%, 68% 35%, 75% 42%, 85% 38%, 92% 48%, 100% 42%, 100% 100%);
    background-color: var(--twilight-slate);
    z-index: 2;
    height: 50%;
}

.mountain-layer-4 {
    clip-path: polygon(0% 100%, 0% 58%, 12% 52%, 25% 48%, 38% 55%, 50% 45%, 62% 52%, 75% 47%, 88% 55%, 100% 50%, 100% 100%);
    background-color: var(--mountain-charcoal);
    z-index: 1;
    height: 55%;
}

/* Inverted mountains for Base Camp */
.mountain-layer-inverted-1 {
    clip-path: polygon(0% 0%, 0% 30%, 5% 35%, 12% 45%, 18% 40%, 25% 55%, 32% 50%, 38% 60%, 42% 65%, 48% 58%, 55% 70%, 60% 62%, 65% 75%, 70% 65%, 75% 72%, 80% 60%, 85% 65%, 90% 50%, 95% 55%, 100% 45%, 100% 0%);
    background-color: var(--deep-ridge);
    position: absolute;
    top: 0;
    left: -5%;
    width: 110%;
    height: 35%;
    z-index: 1;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

.mountain-layer-inverted-2 {
    clip-path: polygon(0% 0%, 0% 25%, 10% 30%, 20% 40%, 30% 35%, 42% 50%, 55% 40%, 65% 52%, 78% 42%, 88% 48%, 100% 38%, 100% 0%);
    background-color: var(--far-peak);
    position: absolute;
    top: 0;
    left: -5%;
    width: 110%;
    height: 40%;
    z-index: 0;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

/* --- Transition Zones --- */
.transition-zone {
    position: relative;
    height: 60vh;
    background-color: var(--void-obsidian);
    overflow: hidden;
}

.transition-short {
    height: 40vh;
}

/* --- Mist Bands --- */
.mist-band {
    position: absolute;
    width: 120%;
    left: -10%;
    pointer-events: none;
}

.mist-1 {
    height: 120px;
    top: 15%;
    background: linear-gradient(90deg, transparent 0%, rgba(160, 174, 192, 0.03) 30%, rgba(160, 174, 192, 0.04) 50%, rgba(160, 174, 192, 0.03) 70%, transparent 100%);
    animation: drift-mist 28s ease-in-out infinite alternate;
    opacity: 0.4;
}

.mist-2 {
    height: 100px;
    top: 40%;
    background: linear-gradient(90deg, transparent 0%, rgba(160, 174, 192, 0.03) 25%, rgba(160, 174, 192, 0.05) 50%, rgba(160, 174, 192, 0.03) 75%, transparent 100%);
    animation: drift-mist 32s ease-in-out infinite alternate-reverse;
    opacity: 0.5;
}

.mist-3 {
    height: 80px;
    top: 65%;
    background: linear-gradient(90deg, transparent 0%, rgba(160, 174, 192, 0.02) 30%, rgba(160, 174, 192, 0.04) 50%, rgba(160, 174, 192, 0.02) 70%, transparent 100%);
    animation: drift-mist 36s ease-in-out infinite alternate;
    opacity: 0.3;
}

.mist-4 {
    height: 150px;
    top: 80%;
    background: linear-gradient(90deg, transparent 0%, rgba(160, 174, 192, 0.02) 20%, rgba(160, 174, 192, 0.035) 50%, rgba(160, 174, 192, 0.02) 80%, transparent 100%);
    animation: drift-mist 34s ease-in-out infinite alternate-reverse;
    opacity: 0.35;
}

@keyframes drift-mist {
    from { transform: translateY(0) translateX(-5%); }
    to { transform: translateY(-40px) translateX(5%); }
}

/* --- Ridge Dividers --- */
.ridge-divider {
    position: absolute;
    bottom: 10%;
    left: 0;
    width: 100%;
    height: 60px;
    opacity: 0.2;
}

.ridge-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 3s ease-in-out;
}

.ridge-divider.drawn .ridge-path {
    stroke-dashoffset: 0;
}

/* --- Constellation Dots --- */
.constellation-dots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.constellation-dot {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background-color: rgba(160, 174, 192, 0.15);
}

/* --- RIDGE LINE (Section 2) --- */
.section-ridge {
    background-color: var(--mountain-charcoal);
}

.ridge-content {
    position: relative;
    z-index: 5;
    max-width: 60ch;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    gap: clamp(3rem, 6vh, 5rem);
}

.content-block {
    position: relative;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    background: rgba(13, 13, 20, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

.section-heading {
    font-size: clamp(1.5rem, 3vw + 0.5rem, 3rem);
    font-weight: 300;
    letter-spacing: 0.04em;
    margin-bottom: 1.2rem;
    line-height: 1.3;
}

.body-text {
    color: var(--cloud-silver);
    font-weight: 300;
}

/* --- Border Animate --- */
.border-animate {
    border: none;
    position: relative;
}

.border-animate .border-top,
.border-animate .border-right,
.border-animate .border-bottom,
.border-animate .border-left {
    position: absolute;
    background-color: var(--granite-edge);
}

.border-animate .border-top {
    top: 0;
    left: 0;
    height: 1px;
    width: 0;
}

.border-animate .border-right {
    top: 0;
    right: 0;
    width: 1px;
    height: 0;
}

.border-animate .border-bottom {
    bottom: 0;
    right: 0;
    height: 1px;
    width: 0;
}

.border-animate .border-left {
    bottom: 0;
    left: 0;
    width: 1px;
    height: 0;
}

/* Border draw animations */
@keyframes draw-width {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes draw-height {
    from { height: 0; }
    to { height: 100%; }
}

@keyframes border-color-pulse {
    0% { background-color: var(--granite-edge); }
    40% { background-color: var(--dawn-amber); }
    100% { background-color: var(--granite-edge); }
}

.border-animate.in-view .border-top {
    animation: draw-width 300ms ease-out 0ms forwards, border-color-pulse 2s ease-out 0ms forwards;
}

.border-animate.in-view .border-right {
    animation: draw-height 300ms ease-out 250ms forwards, border-color-pulse 2s ease-out 250ms forwards;
}

.border-animate.in-view .border-bottom {
    animation: draw-width 300ms ease-out 500ms forwards, border-color-pulse 2s ease-out 500ms forwards;
}

.border-animate.in-view .border-left {
    animation: draw-height 300ms ease-out 750ms forwards, border-color-pulse 2s ease-out 750ms forwards;
}

/* --- VALLEY (Section 3) --- */
.section-valley {
    background-color: var(--void-obsidian);
}

.valley-content {
    position: relative;
    z-index: 5;
    width: 90%;
    max-width: 1200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* SVG Path Drawing */
.draw-path {
    stroke-dasharray: var(--path-length, 2000);
    stroke-dashoffset: var(--path-length, 2000);
    transition: stroke-dashoffset 3s ease-in-out;
}

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

/* --- ASCENT (Sections 4 & 5) --- */
.section-ascent,
.section-ascent-two {
    background-color: var(--mountain-charcoal);
}

.ascent-content {
    position: relative;
    z-index: 5;
    width: 90%;
    max-width: 1100px;
    padding: 0 2rem;
}

.two-column {
    display: flex;
    align-items: center;
    gap: 0;
}

.column-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: clamp(2rem, 4vh, 3.5rem);
    max-width: 50ch;
}

.column-divider {
    width: 1px;
    height: 300px;
    background-color: var(--granite-edge);
    margin: 0 clamp(1.5rem, 3vw, 3rem);
    position: relative;
    flex-shrink: 0;
}

.divider-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--granite-edge);
    animation: pulse-opacity 4s ease-in-out infinite;
}

@keyframes pulse-opacity {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.column-illustration {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* --- BASE CAMP (Section 6) --- */
.section-basecamp {
    background-color: var(--void-obsidian);
}

.basecamp-content {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 50ch;
    padding: 0 2rem;
}

.basecamp-block {
    text-align: center;
}

.basecamp-heading {
    font-size: clamp(2rem, 4vw + 0.5rem, 4rem);
    font-weight: 200;
    letter-spacing: 0.06em;
    margin-bottom: 1.5rem;
}

.basecamp-contact {
    margin-top: 2.5rem;
}

.contact-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--mist-gray);
}

.dawn-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--dawn-amber), transparent);
    margin: 1.5rem auto 0;
    width: 60px;
    animation: dawn-glow 4s ease-in-out infinite alternate;
}

@keyframes dawn-glow {
    0% { opacity: 0.4; transform: scaleX(0.7); }
    100% { opacity: 1; transform: scaleX(1.3); }
}

/* --- Navigation --- */
#section-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.nav-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--granite-edge);
    opacity: 0.3;
    z-index: -1;
}

.nav-dot {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--mist-gray);
    transition: background-color 800ms ease, transform 300ms ease;
    position: relative;
    text-decoration: none;
}

.nav-dot.active {
    background-color: var(--cloud-silver);
    transform: scale(1.5);
}

.nav-label {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.65rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--mist-gray);
    opacity: 0;
    transition: opacity 300ms ease;
    pointer-events: none;
}

.nav-dot:hover .nav-label {
    opacity: 0.3;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .two-column {
        flex-direction: column;
        gap: 2rem;
    }

    .column-divider {
        width: 100px;
        height: 1px;
        margin: 0;
    }

    .column-divider .divider-pulse {
        width: 100%;
        height: 100%;
    }

    .column-illustration {
        order: -1;
    }

    .section-ascent-two .column-illustration {
        order: -1;
    }

    #section-nav {
        right: 12px;
    }

    .nav-label {
        display: none;
    }

    .ridge-content {
        padding: 0 1.5rem;
    }

    .ascent-content {
        padding: 0 1.5rem;
    }

    .ghost-kanji {
        opacity: 0.04;
    }
}

@media (max-width: 480px) {
    .summit-title {
        letter-spacing: 0.04em;
    }

    #section-nav {
        right: 8px;
        gap: 18px;
    }
}

/* --- Selection Color --- */
::selection {
    background-color: var(--dusk-indigo);
    color: var(--frost-white);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--void-obsidian);
}

::-webkit-scrollbar-thumb {
    background: var(--granite-edge);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--mist-gray);
}
