/* ================================================================
   a6c.dev — The Ascent
   Palette: #1B1432 · #3D3B4A · #4A3F6B · #8B87A0 · #C5B8D9 · #E8E0F0 · #F5F2FA
   Fonts:   Abril Fatface (display), Libre Franklin (body), IBM Plex Mono (accents)
   ================================================================ */

:root {
    --c-midnight: #1B1432;
    --c-twilight: #3D3B4A;
    --c-dusk:     #4A3F6B;
    --c-fogline:  #8B87A0;
    --c-lavender: #C5B8D9;
    --c-cloud:    #E8E0F0;
    --c-summit:   #F5F2FA;

    --grad-primary: linear-gradient(165deg, #1B1432 0%, #4A3F6B 35%, #8B87A0 65%, #C5B8D9 100%);

    /* Rotating gradient angle driven by JS on scroll */
    --grad-angle: 165deg;

    --font-display: 'Abril Fatface', 'Libre Franklin', serif;
    --font-body:    'Libre Franklin', 'Inter', sans-serif;
    --font-mono:    'IBM Plex Mono', 'Space Mono', monospace;

    --grid-gap: clamp(24px, 4vw, 48px);
}

* , *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--c-summit);
    color: var(--c-twilight);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 17px;
    line-height: 1.8;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Subtle vertical wash from sky-white at top to fog-white at bottom */
    background-image:
        linear-gradient(180deg,
            #FBFAFD 0%,
            #F5F2FA 35%,
            #EDE7F4 80%,
            #E6DEEE 100%);
    background-attachment: fixed;
}

/* ================================================================
   Mountain backdrop — layered CSS clip-path silhouettes
   ================================================================ */
.mountain-backdrop {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.mountain-layer {
    position: absolute;
    bottom: 0;
    left: -5%;
    width: 110%;
    height: 100%;
    transition: opacity 0.6s ease;
}

/* Layer 1 — furthest (highest jagged peaks, deepest dusk) */
.mountain-layer-1 {
    clip-path: polygon(
        0% 100%, 0% 72%,
        6% 66%, 12% 70%, 18% 60%, 24% 63%, 30% 50%,
        36% 54%, 42% 44%, 48% 48%, 54% 38%,
        60% 42%, 66% 33%, 72% 37%, 78% 28%,
        84% 32%, 90% 26%, 96% 30%, 100% 27%,
        100% 100%
    );
    background-color: var(--c-dusk);
    opacity: 0.42;
}

/* Layer 2 */
.mountain-layer-2 {
    clip-path: polygon(
        0% 100%, 0% 78%,
        7% 72%, 14% 76%, 21% 66%, 28% 69%, 35% 58%,
        42% 62%, 49% 52%, 56% 56%, 63% 48%,
        70% 52%, 77% 44%, 84% 48%, 91% 42%,
        97% 46%, 100% 42%,
        100% 100%
    );
    background-color: var(--c-twilight);
    opacity: 0.32;
}

/* Layer 3 */
.mountain-layer-3 {
    clip-path: polygon(
        0% 100%, 0% 84%,
        8% 78%, 16% 82%, 24% 72%, 32% 76%, 40% 66%,
        48% 70%, 56% 60%, 64% 64%, 72% 56%,
        80% 60%, 88% 54%, 95% 58%, 100% 55%,
        100% 100%
    );
    background-color: var(--c-dusk);
    opacity: 0.24;
}

/* Layer 4 */
.mountain-layer-4 {
    clip-path: polygon(
        0% 100%, 0% 88%,
        9% 84%, 18% 87%, 27% 80%, 36% 83%, 45% 74%,
        54% 77%, 63% 70%, 72% 73%, 81% 66%,
        90% 70%, 100% 65%,
        100% 100%
    );
    background-color: var(--c-lavender);
    opacity: 0.22;
}

/* Layer 5 — nearest/faintest (foreground mist-ridge) */
.mountain-layer-5 {
    clip-path: polygon(
        0% 100%, 0% 93%,
        10% 89%, 20% 91%, 30% 85%, 40% 88%, 50% 82%,
        60% 85%, 70% 80%, 80% 83%, 90% 78%,
        100% 81%,
        100% 100%
    );
    background-color: var(--c-lavender);
    opacity: 0.14;
}

/* ================================================================
   Mist particle field
   ================================================================ */
.mist-container {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.mist-particle {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(197, 184, 217, 0.28) 0%,
        rgba(232, 224, 240, 0.12) 40%,
        transparent 72%);
    filter: blur(2px);
    will-change: transform, opacity;
}

/* ================================================================
   Altitude indicator (bottom-right)
   ================================================================ */
.altitude-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--c-fogline);
    background: rgba(245, 242, 250, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(139, 135, 160, 0.18);
    border-radius: 2px;
    transition: opacity 0.3s ease;
}

.altitude-label {
    opacity: 0.55;
}

.altitude-value {
    color: var(--c-dusk);
    font-weight: 400;
    min-width: 56px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.altitude-bar {
    display: inline-block;
    width: 54px;
    height: 2px;
    background: rgba(139, 135, 160, 0.25);
    position: relative;
    overflow: hidden;
}

.altitude-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, var(--c-dusk), var(--c-lavender));
    transition: width 0.15s linear;
}

/* ================================================================
   Coordinate tag (top-left)
   ================================================================ */
.coord-tag {
    position: fixed;
    top: 20px;
    left: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--c-fogline);
    opacity: 0.72;
    pointer-events: none;
}

.coord-row {
    display: block;
}

/* ================================================================
   Main narrative
   ================================================================ */
.ascent-narrative {
    position: relative;
    z-index: 2;
    padding-bottom: 20vh;
}

.zone {
    position: relative;
    min-height: 100vh;
    padding: clamp(64px, 10vh, 140px) clamp(24px, 5vw, 72px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: opacity 0.8s ease;
}

.zone-valley { min-height: 120vh; }
.zone-summit {
    min-height: 110vh;
    align-items: center;
    justify-content: center;
}

/* Section header (altitude marker + cairn) */
.zone-header {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto clamp(24px, 4vh, 56px) auto;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 0 8px;
}

.altitude-marker {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-fogline);
    border-top: 1px solid rgba(139, 135, 160, 0.3);
    padding-top: 8px;
    max-width: 60%;
}

/* Cairn — stacked stone dots as section marker */
.cairn {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 2px;
}

.cairn-stone {
    display: block;
    border-radius: 50%;
    background: var(--c-dusk);
}
.cairn-stone:nth-child(1) { width: 10px; height: 10px; opacity: 0.85; }
.cairn-stone:nth-child(2) { width: 9px;  height: 9px;  opacity: 0.70; }
.cairn-stone:nth-child(3) { width: 8px;  height: 8px;  opacity: 0.55; }
.cairn-stone:nth-child(4) { width: 7px;  height: 7px;  opacity: 0.40; }
.cairn-stone:nth-child(5) { width: 6px;  height: 6px;  opacity: 0.28; }

/* ================================================================
   Masonry grid — thinning columns by altitude
   ================================================================ */
.masonry-grid {
    display: grid;
    gap: var(--grid-gap);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    grid-auto-flow: row dense;
}

/* Valley: 4 columns dense */
.masonry-grid[data-altitude="valley"] {
    grid-template-columns: repeat(4, 1fr);
}

/* Ridge (lower slopes + treeline): 3 columns */
.masonry-grid[data-altitude="ridge"] {
    grid-template-columns: repeat(3, 1fr);
    max-width: 1080px;
}

/* Approach: 2 columns */
.masonry-grid[data-altitude="approach"] {
    grid-template-columns: repeat(2, 1fr);
    max-width: 820px;
}

/* Summit: single column, narrow */
.masonry-grid[data-altitude="summit"] {
    grid-template-columns: 1fr;
    max-width: 640px;
    justify-items: center;
}

/* ================================================================
   Masonry blocks
   ================================================================ */
.masonry-block {
    position: relative;
    padding: clamp(22px, 3vw, 40px);
    border-radius: 2px;
    min-width: 0;
}

.block-hero {
    grid-column: span 2;
    padding: clamp(32px, 5vw, 64px);
    background: rgba(232, 224, 240, 0.55);
    border-left: 1px solid rgba(197, 184, 217, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.block-tall { grid-row: span 2; }
.block-empty { padding: 0; min-height: 40px; }
.block-centered { text-align: center; }

.block-text {
    background: rgba(232, 224, 240, 0.42);
    border-left: 1px solid rgba(197, 184, 217, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.block-code {
    background: rgba(27, 20, 50, 0.04);
    border: 1px solid rgba(139, 135, 160, 0.25);
    padding: clamp(18px, 2vw, 28px);
}

.block-accent {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    padding: clamp(12px, 2vw, 24px);
    background: transparent;
}

.block-visual {
    position: relative;
    min-height: 140px;
    overflow: hidden;
    padding: clamp(16px, 2vw, 24px);
    background: rgba(232, 224, 240, 0.32);
    border: 1px solid rgba(197, 184, 217, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.block-summit {
    padding: clamp(60px, 10vw, 140px) clamp(24px, 4vw, 48px);
    background: rgba(245, 242, 250, 0.7);
    border: 1px solid rgba(197, 184, 217, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ================================================================
   Typography
   ================================================================ */
.display-heading {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(72px, 13vw, 144px);
    letter-spacing: -0.035em;
    line-height: 0.92;
    margin-bottom: 16px;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(38px, 6vw, 72px);
    letter-spacing: -0.02em;
    line-height: 1.02;
    margin: 10px 0 18px 0;
}

.summit-heading {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(60px, 10vw, 120px);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 18px;
}

/* Gradient text fill — angle animated via --grad-angle */
.gradient-text {
    background: linear-gradient(var(--grad-angle),
        var(--c-midnight) 0%,
        var(--c-dusk)     35%,
        var(--c-fogline)  65%,
        var(--c-lavender) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    display: inline-block;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(15px, 1.3vw, 17px);
    line-height: 1.8;
    color: var(--c-twilight);
    max-width: 62ch;
}

.mono-text {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 13px;
    line-height: 1.85;
    color: var(--c-fogline);
    display: block;
    white-space: pre-line;
}

.mono-small {
    display: inline-block;
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-fogline);
    margin-bottom: 6px;
}

.mono-tag {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.1em;
    color: var(--c-dusk);
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 18px 0;
}

.dotted {
    flex: 1;
    height: 1px;
    background-image: linear-gradient(90deg, var(--c-lavender) 50%, transparent 50%);
    background-size: 6px 1px;
    background-repeat: repeat-x;
    opacity: 0.7;
}

.summit-text {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 13px;
    letter-spacing: 0.1em;
    color: var(--c-fogline);
    margin: 0 0 32px 0;
}

.summit-sign {
    margin-top: 36px;
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 12px;
    letter-spacing: 0.18em;
    color: var(--c-fogline);
    opacity: 0.85;
}

.summit-coord {
    display: block;
    margin-bottom: 16px;
}

/* ================================================================
   Accent lines, decorative SVGs, visual captions
   ================================================================ */
.accent-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--c-lavender) 50%,
        transparent 100%);
    opacity: 0.55;
}

.accent-line-thin {
    opacity: 0.3;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--c-fogline) 50%,
        transparent 100%);
}

.deco-svg {
    width: 100%;
    max-width: 140px;
    height: auto;
    opacity: 0.9;
}

.tri-pattern {
    max-width: 150px;
}

.ridge-svg {
    width: 100%;
    height: 100px;
    display: block;
}

.visual-caption {
    position: absolute;
    bottom: 10px;
    right: 12px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-fogline);
    opacity: 0.6;
}

/* ================================================================
   Fog circles (soft decorative blobs)
   ================================================================ */
.fog-circle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(197, 184, 217, 0.32) 0%,
        rgba(197, 184, 217, 0.14) 40%,
        transparent 72%);
    filter: blur(1px);
}

.fog-circle-1 {
    width: 90px; height: 90px;
    top: 12%; left: 18%;
    animation: fogDrift 12s ease-in-out infinite;
}
.fog-circle-2 {
    width: 130px; height: 130px;
    top: 35%; left: 45%;
    animation: fogDrift 16s ease-in-out infinite reverse;
}
.fog-circle-3 {
    width: 70px; height: 70px;
    top: 60%; left: 28%;
    animation: fogDrift 10s ease-in-out infinite;
    animation-delay: -3s;
}
.fog-circle-large {
    width: 220px; height: 220px;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle,
        rgba(197, 184, 217, 0.24) 0%,
        rgba(197, 184, 217, 0.08) 45%,
        transparent 72%);
    animation: fogPulse 8s ease-in-out infinite;
}

@keyframes fogDrift {
    0%, 100% { transform: translate(0, 0); }
    33%      { transform: translate(18px, -8px); }
    66%      { transform: translate(-12px, 6px); }
}

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

/* ================================================================
   Cloud layers — horizontal dividers between sections
   Respond to scroll velocity via JS vars.
   ================================================================ */
.cloud-layer {
    position: relative;
    width: 100%;
    height: 80px;
    margin: 0;
    z-index: 3;
    pointer-events: none;
    transition: height 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.cloud-mass {
    position: absolute;
    inset: 0;
    width: 106%;
    left: -3%;
    background: linear-gradient(180deg,
        rgba(245, 242, 250, 0.0) 0%,
        rgba(245, 242, 250, 0.7) 50%,
        rgba(245, 242, 250, 0.0) 100%);
    backdrop-filter: blur(var(--cloud-blur, 8px));
    -webkit-backdrop-filter: blur(var(--cloud-blur, 8px));
    animation: cloudDrift 60s ease-in-out infinite;
    transition: backdrop-filter 0.6s ease;
}

@keyframes cloudDrift {
    0%, 100% { transform: translateX(-3%); }
    50%      { transform: translateX(3%);  }
}

/* ================================================================
   Reveal / stagger animation
   ================================================================ */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity 800ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 800ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Higher (later) sections reveal more slowly — thinning-air metaphor */
.zone-alpine .reveal,
.zone-ridge .reveal {
    transition-duration: 1000ms;
}
.zone-summit .reveal {
    transition-duration: 1200ms;
}

/* ================================================================
   Summit marker
   ================================================================ */
.summit-marker {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.summit-diamond {
    width: 32px;
    height: 32px;
    animation: diamondSpin 24s linear infinite;
}

@keyframes diamondSpin {
    from { transform: rotate(0deg);   }
    to   { transform: rotate(360deg); }
}

/* ================================================================
   Responsive — masonry thins on smaller viewports
   ================================================================ */
@media (max-width: 960px) {
    .masonry-grid[data-altitude="valley"] { grid-template-columns: repeat(3, 1fr); }
    .masonry-grid[data-altitude="ridge"]  { grid-template-columns: repeat(2, 1fr); }
    .masonry-grid[data-altitude="approach"] { grid-template-columns: repeat(2, 1fr); }

    .block-hero { grid-column: span 3; }
}

@media (max-width: 720px) {
    .masonry-grid[data-altitude="valley"] { grid-template-columns: repeat(2, 1fr); }
    .masonry-grid[data-altitude="ridge"]  { grid-template-columns: repeat(2, 1fr); }
    .masonry-grid[data-altitude="approach"] { grid-template-columns: 1fr; }

    .block-hero { grid-column: span 2; }
    .block-tall { grid-row: span 1; }
    .zone-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .coord-tag { display: none; }
}

@media (max-width: 480px) {
    .masonry-grid[data-altitude="valley"],
    .masonry-grid[data-altitude="ridge"],
    .masonry-grid[data-altitude="approach"] {
        grid-template-columns: 1fr;
    }
    .block-hero { grid-column: span 1; }
    .display-heading { font-size: clamp(64px, 18vw, 96px); }
    .altitude-indicator { bottom: 14px; right: 14px; }
    .altitude-bar { display: none; }
}
