/* ==========================================================================
   aiice.quest  -  The Expedition Log
   Neomorphic-as-geology system, Z-pattern layout, warm-to-cold descent.
   Fonts: Barlow Condensed (display), Source Sans 3 (body), Inconsolata (code).
   Palette: #E8D4BE Frozen Clay, #E2CDB4, #D4B896 Warm Permafrost,
            #B8A08A, #A0785A Expedition Shadow, #5B3D2A Deep Loam,
            #4A3728 Bark Brown, #8B5E3C Rust Ochre, #D4943A Compass Amber,
            #5A9EA0 Glacial Teal, #2C3E50 Crevasse Navy, #E2CDB4, #C4A882.
   Easing: cubic-bezier(0.68, -0.55, 0.27, 1.55) elastic overshoot.
   ========================================================================== */

:root {
    --c-frozen-clay:        #E8D4BE;
    --c-frozen-clay-2:      #E2CDB4;
    --c-warm-permafrost:    #D4B896;
    --c-permafrost-deep:    #B8A08A;
    --c-expedition-shadow:  #A0785A;
    --c-deep-loam:          #5B3D2A;
    --c-bark-brown:         #4A3728;
    --c-rust-ochre:         #8B5E3C;
    --c-compass-amber:      #D4943A;
    --c-glacial-teal:       #5A9EA0;
    --c-crevasse-navy:      #2C3E50;
    --c-sand-watermark:     #C4A882;

    --elastic: cubic-bezier(0.68, -0.55, 0.27, 1.55);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

    --shadow-dark:  rgba(120, 80, 50, 0.25);
    --shadow-light: rgba(255, 240, 220, 0.7);
    --inset-dark:   rgba(120, 80, 50, 0.30);
    --inset-light:  rgba(255, 240, 220, 0.50);

    --font-display: 'Barlow Condensed', 'Inter', sans-serif;
    --font-body:    'Source Sans 3', 'Inter', sans-serif;
    --font-code:    'Inconsolata', 'Space Mono', monospace;
}

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

html, body {
    height: 100%;
}

html {
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    color: var(--c-bark-brown);
    background: var(--c-frozen-clay);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    hyphens: auto;
}

button {
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

/* Hidden SVG filter bank */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* ==========================================================================
   LEFT-EDGE CHEVRON PROGRESS STRIP
   Five stacked sharp chevrons replace all navigation.
   ========================================================================== */
.waypoint-strip {
    position: fixed;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 120;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.wp-chevron {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 4px;
    opacity: 0.35;
    transition: opacity 0.4s var(--ease-smooth), transform 0.5s var(--elastic);
}

.wp-chevron svg {
    width: 26px;
    height: 12px;
    display: block;
    transition: transform 0.5s var(--elastic);
}

.wp-chevron svg polyline {
    transition: stroke 0.4s var(--ease-smooth), fill 0.4s var(--ease-smooth), stroke-width 0.4s var(--ease-smooth);
}

.wp-chevron-num {
    font-family: var(--font-display);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: var(--c-expedition-shadow);
    opacity: 0.65;
}

.wp-chevron.visited {
    opacity: 0.85;
}
.wp-chevron.visited svg polyline {
    stroke: var(--c-compass-amber);
    fill: rgba(212, 148, 58, 0.25);
}

.wp-chevron.active {
    opacity: 1;
    transform: translateX(3px) scale(1.15);
}
.wp-chevron.active svg polyline {
    stroke: var(--c-compass-amber);
    fill: var(--c-compass-amber);
    stroke-width: 2.4;
}
.wp-chevron.active .wp-chevron-num {
    color: var(--c-deep-loam);
    opacity: 1;
}

.waypoint-strip::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -30px;
    bottom: -30px;
    width: 1px;
    background: linear-gradient(to bottom,
        transparent,
        var(--c-expedition-shadow) 15%,
        var(--c-expedition-shadow) 85%,
        transparent);
    opacity: 0.28;
    transform: translateX(-0.5px);
    z-index: -1;
}

/* ==========================================================================
   TEMPERATURE GAUGE (right edge)
   Reflects chromatic descent from +2C to -40C.
   ========================================================================== */
.temperature-gauge {
    position: fixed;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 110;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 320px;
}

.gauge-track {
    width: 6px;
    height: 100%;
    background: rgba(91, 61, 42, 0.14);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
    box-shadow:
        inset 2px 2px 4px rgba(91, 61, 42, 0.18),
        inset -2px -2px 4px rgba(255, 240, 220, 0.35);
}

.gauge-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20%;
    background: linear-gradient(to top, var(--c-glacial-teal), var(--c-compass-amber));
    border-radius: 3px;
    transition: height 0.8s var(--elastic);
}

.gauge-marker {
    position: absolute;
    left: -5px;
    width: 16px;
    height: 3px;
    background: var(--c-deep-loam);
    border-radius: 1.5px;
    top: 80%;
    transition: top 0.8s var(--elastic), background 0.5s var(--ease-smooth);
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.gauge-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.gauge-label {
    font-family: var(--font-code);
    font-size: 10px;
    font-weight: 500;
    color: var(--c-expedition-shadow);
    white-space: nowrap;
    opacity: 0.5;
    letter-spacing: 0.04em;
    transition: opacity 0.35s var(--ease-smooth), color 0.35s var(--ease-smooth), font-weight 0.35s;
}

.gauge-label.active {
    opacity: 1;
    color: var(--c-deep-loam);
    font-weight: 700;
}

/* ==========================================================================
   SCROLL CONTAINER + WAYPOINT SECTIONS
   ========================================================================== */
.scroll-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scroll-padding: 0;
}
.scroll-container::-webkit-scrollbar { width: 0; background: transparent; }

.waypoint {
    min-height: 100vh;
    height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    overflow: hidden;
    padding: 70px 80px 70px 100px;
    transition: background-color 0.9s var(--ease-smooth);

    /* Per-waypoint shadow custom props, shifted in deeper sections */
    --shadow-dark: rgba(120, 80, 50, 0.25);
    --shadow-light: rgba(255, 240, 220, 0.70);
    --inset-dark: rgba(120, 80, 50, 0.30);
    --inset-light: rgba(255, 240, 220, 0.50);
    --panel-bg: var(--c-frozen-clay);
}

/* Noise texture overlay */
.waypoint::before {
    content: '';
    position: absolute;
    inset: 0;
    filter: url(#noiseFilter);
    pointer-events: none;
    z-index: 2;
    opacity: 0.9;
}

#waypoint01 {
    background-color: var(--c-frozen-clay);
    --panel-bg: var(--c-frozen-clay);
}
#waypoint02 {
    background-color: var(--c-frozen-clay-2);
    --panel-bg: var(--c-frozen-clay-2);
}
#waypoint03 {
    background-color: var(--c-warm-permafrost);
    --panel-bg: var(--c-warm-permafrost);
    --shadow-dark: rgba(90, 60, 40, 0.28);
    --shadow-light: rgba(250, 230, 205, 0.55);
    --inset-dark: rgba(90, 60, 40, 0.32);
    --inset-light: rgba(250, 230, 205, 0.42);
}
#waypoint04 {
    background-color: var(--c-permafrost-deep);
    --panel-bg: var(--c-permafrost-deep);
    --shadow-dark: rgba(60, 55, 50, 0.32);
    --shadow-light: rgba(220, 215, 205, 0.42);
    --inset-dark: rgba(60, 55, 50, 0.38);
    --inset-light: rgba(220, 215, 205, 0.32);
}
#waypoint05 {
    background-color: var(--c-crevasse-navy);
    --panel-bg: var(--c-crevasse-navy);
    --shadow-dark: rgba(10, 20, 30, 0.55);
    --shadow-light: rgba(100, 160, 170, 0.28);
    --inset-dark: rgba(10, 20, 30, 0.65);
    --inset-light: rgba(100, 160, 170, 0.22);
}

/* Faint oversize waypoint-number watermark */
.waypoint-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20vw;
    color: var(--c-sand-watermark);
    opacity: 0.15;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    pointer-events: none;
    z-index: 1;
    user-select: none;
    line-height: 0.9;
    white-space: nowrap;
}
.waypoint-number-light {
    color: var(--c-glacial-teal);
    opacity: 0.12;
}

/* Topographic contour line illustrations, background of opposite quadrant */
.topo-contours {
    position: absolute;
    width: 420px;
    height: 420px;
    z-index: 1;
    opacity: 0.55;
    pointer-events: none;
}
.waypoint:not(.waypoint--reverse) .topo-contours {
    top: 58%;
    left: 55%;
}
.waypoint--reverse .topo-contours {
    top: 10%;
    left: -2%;
}
.waypoint-final .topo-contours {
    opacity: 0.4;
}
.topo-dense    { opacity: 0.6; }
.topo-denser   { opacity: 0.65; }
.topo-deepest  { opacity: 0.55; }

/* Visible Z-trail SVG drawn across each viewport */
.z-trail {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.z-path {
    stroke-dasharray: 4000;
    stroke-dashoffset: 4000;
    transition: stroke-dashoffset 1.8s var(--ease-smooth);
}
.waypoint.in-view .z-path {
    stroke-dashoffset: 0;
}

/* ==========================================================================
   Z-GRID  -  four quadrants per waypoint
   Odd sections TL > TR > BL > BR (standard Z)
   Even sections reversed (serpentine descent)
   ========================================================================== */
.z-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 36px 60px;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 3;
}

.quadrant {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}

.z-tl {
    grid-column: 1;
    grid-row: 1;
    justify-content: flex-start;
    align-items: flex-start;
    padding-top: 8px;
}
.z-tr {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-start;
    align-items: flex-end;
    padding-top: 8px;
}
.z-bl {
    grid-column: 1;
    grid-row: 2;
    justify-content: flex-end;
    align-items: flex-start;
    padding-bottom: 8px;
}
.z-br {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-end;
    align-items: flex-end;
    padding-bottom: 8px;
    text-align: right;
}

/* Reverse Z-pattern for even sections (serpentine) */
.waypoint--reverse .z-tl {
    grid-column: 2;
    align-items: flex-end;
    text-align: right;
}
.waypoint--reverse .z-tr {
    grid-column: 1;
    align-items: flex-start;
}
.waypoint--reverse .z-bl {
    grid-column: 2;
    align-items: flex-end;
}
.waypoint--reverse .z-br {
    grid-column: 1;
    align-items: flex-start;
    text-align: left;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
.waypoint-tag {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.28em;
    color: var(--c-rust-ochre);
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.waypoint-tag::before {
    content: '';
    width: 26px;
    height: 1px;
    background: currentColor;
    opacity: 0.7;
}
.waypoint-tag-light {
    color: var(--c-glacial-teal);
}

.waypoint-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(34px, 4.4vw, 56px);
    color: var(--c-deep-loam);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 0.92;
    margin-bottom: 14px;
}
.waypoint-title-light {
    color: var(--c-frozen-clay);
}

.directive-subtitle {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: 15px;
    color: var(--c-rust-ochre);
    letter-spacing: 0.02em;
    max-width: 380px;
}
.directive-subtitle-light {
    color: var(--c-glacial-teal);
}

.narrative {
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.72;
    color: var(--c-bark-brown);
    max-width: 520px;
    hyphens: auto;
}
.narrative strong {
    color: var(--c-deep-loam);
    font-weight: 700;
}
.narrative-light {
    color: var(--c-frozen-clay);
}
.narrative-light strong {
    color: #fff;
}

.waypoint--reverse .narrative {
    text-align: left;
}

/* ==========================================================================
   NEOMORPHIC PANELS  -  compressed snow / ice channels
   Corner notches via clip-path give every rectangle a broken-ice quality.
   ========================================================================== */
.panel {
    background: var(--panel-bg);
    border-radius: 24px;
    padding: 22px 26px;
    position: relative;
    clip-path: polygon(
        16px 0,
        100% 0,
        100% calc(100% - 16px),
        calc(100% - 16px) 100%,
        0 100%,
        0 16px
    );
}

.neo-raised {
    box-shadow:
        8px 8px 16px var(--shadow-dark),
        -8px -8px 16px var(--shadow-light);
    transition: transform 0.5s var(--elastic), box-shadow 0.5s var(--elastic);
}

.neo-raised-dark {
    background: var(--c-crevasse-navy);
    border-radius: 24px;
    padding: 22px 26px;
    position: relative;
    clip-path: polygon(
        16px 0,
        100% 0,
        100% calc(100% - 16px),
        calc(100% - 16px) 100%,
        0 100%,
        0 16px
    );
    box-shadow:
        8px 8px 16px var(--shadow-dark),
        -8px -8px 16px var(--shadow-light);
    transition: transform 0.5s var(--elastic), box-shadow 0.5s var(--elastic);
}

.neo-inset {
    background: var(--panel-bg);
    border-radius: 18px;
    padding: 0;
    position: relative;
    box-shadow:
        inset 4px 4px 8px var(--inset-dark),
        inset -4px -4px 8px var(--inset-light);
    overflow: hidden;
    max-width: 460px;
    width: 100%;
    transform-origin: top center;
    transition: transform 0.6s var(--elastic);
    clip-path: polygon(
        14px 0,
        100% 0,
        100% calc(100% - 14px),
        calc(100% - 14px) 100%,
        0 100%,
        0 14px
    );
}

.neo-inset-dark {
    background: var(--c-crevasse-navy);
    border-radius: 18px;
    padding: 0;
    position: relative;
    box-shadow:
        inset 4px 4px 8px var(--inset-dark),
        inset -4px -4px 8px var(--inset-light);
    overflow: hidden;
    max-width: 460px;
    width: 100%;
    clip-path: polygon(
        14px 0,
        100% 0,
        100% calc(100% - 14px),
        calc(100% - 14px) 100%,
        0 100%,
        0 14px
    );
}

/* Subtle tilt to break grid rigidity */
.waypoint .z-tr > .panel.neo-raised:first-child,
.waypoint .z-br > .panel.neo-raised:first-child {
    transform: rotate(0.3deg);
}
.waypoint .z-bl > .panel.neo-inset {
    transform: rotate(-0.5deg);
}

.waypoint.in-view .panel.neo-raised,
.waypoint.in-view .panel.neo-raised-dark {
    transform: translateY(0) rotate(0.3deg);
}
.waypoint.in-view .z-bl > .panel.neo-inset {
    transform: rotate(-0.5deg) scaleY(1);
}

/* Hover lift, neomorphic-style */
.panel.neo-raised:hover,
.panel.neo-raised-dark:hover {
    box-shadow:
        10px 10px 22px var(--shadow-dark),
        -10px -10px 22px var(--shadow-light);
}

/* ==========================================================================
   STATUS INDICATOR  (waypoint 01)
   ========================================================================== */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    align-self: flex-end;
}
.waypoint--reverse .status-indicator {
    align-self: flex-start;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--c-expedition-shadow);
    flex-shrink: 0;
}
.status-dot.active {
    background: var(--c-glacial-teal);
    box-shadow: 0 0 10px rgba(90, 158, 160, 0.55);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(90, 158, 160, 0.35); }
    50%      { box-shadow: 0 0 18px rgba(90, 158, 160, 0.70); }
}

.status-text {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--c-deep-loam);
}

.status-meta {
    font-family: var(--font-code);
    font-size: 10px;
    color: var(--c-expedition-shadow);
    margin-left: 6px;
    padding-left: 10px;
    border-left: 1px solid rgba(91, 61, 42, 0.25);
}

/* ==========================================================================
   COMPASS (waypoint 01)
   ========================================================================== */
.compass-container {
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px;
}

.compass {
    width: 140px;
    height: 140px;
    display: block;
}

#compassNeedle {
    transform-origin: 70px 70px;
    transition: transform 0.7s var(--elastic);
}

.compass-caption {
    font-family: var(--font-code);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--c-rust-ochre);
}

/* ==========================================================================
   SIGNAL DISPLAY (waypoint 02)
   ========================================================================== */
.signal-display {
    width: 340px;
    padding: 18px 20px 16px;
}

.signal-wave {
    height: 100px;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(91, 61, 42, 0.05);
    box-shadow:
        inset 2px 2px 5px rgba(91, 61, 42, 0.15),
        inset -2px -2px 5px rgba(255, 240, 220, 0.35);
}

.signal-wave svg {
    width: 100%;
    height: 100%;
    display: block;
}

.signal-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(91, 61, 42, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(91, 61, 42, 0.08) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
}

.signal-readouts {
    display: flex;
    gap: 16px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(91, 61, 42, 0.18);
}

.signal-readout {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.readout-label {
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.24em;
    color: var(--c-expedition-shadow);
    text-transform: uppercase;
}
.readout-label-light { color: var(--c-glacial-teal); }

.readout-value {
    font-family: var(--font-code);
    font-size: 15px;
    font-weight: 700;
    color: var(--c-deep-loam);
}
.readout-accent { color: var(--c-compass-amber); letter-spacing: 0.1em; font-size: 13px; }
.readout-accent-teal { color: var(--c-glacial-teal); }

/* ==========================================================================
   CORE SAMPLE (waypoint 03)
   ========================================================================== */
.core-sample {
    width: 220px;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.core-label-top {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--c-rust-ochre);
    text-transform: uppercase;
}

.core-layers {
    width: 68px;
    height: 240px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow:
        inset 2px 2px 6px rgba(91, 61, 42, 0.25),
        inset -2px -2px 6px rgba(255, 240, 220, 0.35),
        2px 2px 6px rgba(91, 61, 42, 0.15);
    position: relative;
}

.core-layer {
    width: 100%;
    position: relative;
    transition: opacity 0.35s var(--ease-smooth), transform 0.4s var(--elastic);
}
.core-layer::after {
    content: attr(data-label) " / " attr(data-age);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-code);
    font-size: 10px;
    color: var(--c-deep-loam);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s var(--ease-smooth), transform 0.3s var(--elastic);
    background: rgba(232, 212, 190, 0.92);
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
}
.core-layer:hover::after,
.core-layer.active::after {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
}

.core-depth-marker {
    text-align: center;
}
.depth-label {
    font-family: var(--font-code);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--c-rust-ochre);
}

/* ==========================================================================
   DEPTH METERS (waypoint 04)
   ========================================================================== */
.depth-meters {
    width: 340px;
    padding: 20px 22px;
}

.meters-title {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.26em;
    color: var(--c-deep-loam);
    text-transform: uppercase;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(91, 61, 42, 0.18);
}

.meter-row {
    display: grid;
    grid-template-columns: 80px 1fr 82px;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.meter-row:last-child { margin-bottom: 0; }

.meter-label {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--c-deep-loam);
    text-transform: uppercase;
}

.meter-bar {
    height: 8px;
    background: rgba(91, 61, 42, 0.15);
    border-radius: 4px;
    overflow: hidden;
    box-shadow:
        inset 1px 1px 3px rgba(91, 61, 42, 0.2),
        inset -1px -1px 3px rgba(255, 240, 220, 0.3);
}

.meter-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--c-glacial-teal), var(--c-compass-amber));
    border-radius: 4px;
    transition: width 1.2s var(--elastic);
}

.meter-value {
    font-family: var(--font-code);
    font-size: 12px;
    font-weight: 700;
    color: var(--c-glacial-teal);
    text-align: right;
}

/* ==========================================================================
   EMERGENCE RINGS (waypoint 05)
   ========================================================================== */
.emergence-visual {
    width: 240px;
    height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px;
    gap: 14px;
}

.emergence-rings {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--c-glacial-teal);
    opacity: 0;
    transition: opacity 0.8s var(--elastic), transform 0.8s var(--elastic);
}
.ring-1 { width: 180px; height: 180px; }
.ring-2 { width: 140px; height: 140px; }
.ring-3 { width: 100px; height: 100px; }
.ring-4 { width: 60px;  height: 60px;  border-color: var(--c-compass-amber); }

.waypoint-final.in-view .ring {
    opacity: 0.55;
    animation: ringPulse 3s infinite ease-in-out;
}
.waypoint-final.in-view .ring-1 { animation-delay: 0s; }
.waypoint-final.in-view .ring-2 { animation-delay: 0.3s; }
.waypoint-final.in-view .ring-3 { animation-delay: 0.6s; }
.waypoint-final.in-view .ring-4 { animation-delay: 0.9s; opacity: 0.8; }

@keyframes ringPulse {
    0%, 100% { transform: scale(0.92); opacity: 0.35; }
    50%      { transform: scale(1.08); opacity: 0.75; }
}

.ring-center {
    position: relative;
    z-index: 2;
    width: 40px;
    height: 40px;
    background: var(--c-glacial-teal);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(90, 158, 160, 0.55);
    animation: corePulse 3s infinite ease-in-out;
}
@keyframes corePulse {
    0%, 100% { box-shadow: 0 0 16px rgba(90, 158, 160, 0.4); }
    50%      { box-shadow: 0 0 28px rgba(90, 158, 160, 0.8); }
}

.ring-label {
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--c-crevasse-navy);
}

.emergence-readout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

/* ==========================================================================
   CODE BLOCKS
   ========================================================================== */
.code-block {
    font-family: var(--font-code);
    width: 100%;
    max-width: 460px;
    transform: scaleY(0.8);
    transform-origin: top;
    transition: transform 0.6s var(--elastic);
}
.waypoint.in-view .code-block {
    transform: scaleY(1);
}
.waypoint.in-view .z-bl > .code-block {
    transform: rotate(-0.5deg) scaleY(1);
}

.code-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    background: rgba(91, 61, 42, 0.08);
    border-bottom: 1px solid rgba(91, 61, 42, 0.12);
}
.code-header-dark {
    background: rgba(232, 212, 190, 0.06);
    border-bottom: 1px solid rgba(232, 212, 190, 0.12);
}

.code-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--c-sand-watermark);
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.2);
}
.code-dot:nth-child(1) { background: var(--c-compass-amber); }
.code-dot:nth-child(2) { background: var(--c-sand-watermark); }
.code-dot:nth-child(3) { background: var(--c-glacial-teal); }

.code-filename {
    font-family: var(--font-code);
    font-size: 11px;
    font-weight: 500;
    color: var(--c-rust-ochre);
    letter-spacing: 0.08em;
    margin-left: auto;
}
.code-filename-light {
    color: var(--c-glacial-teal);
}

.code-content {
    padding: 18px 20px;
    font-family: var(--font-code);
    font-size: 14px;
    line-height: 1.75;
    color: var(--c-rust-ochre);
    overflow-x: auto;
    white-space: pre;
    tab-size: 4;
}
.code-content-light {
    color: var(--c-frozen-clay);
}

.code-content code {
    font-family: var(--font-code);
}

.code-highlight {
    color: var(--c-compass-amber);
    font-weight: 700;
    background: rgba(212, 148, 58, 0.12);
    padding: 0 4px;
    border-radius: 3px;
}
.code-highlight-light {
    color: var(--c-compass-amber);
    font-weight: 700;
    background: rgba(212, 148, 58, 0.18);
    padding: 0 4px;
    border-radius: 3px;
}

/* ==========================================================================
   NEXT-STEP PROMPTS (sharp angular arrow, not rounded)
   ========================================================================== */
.next-prompt {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    align-self: flex-end;
    cursor: pointer;
    transition: transform 0.4s var(--elastic), box-shadow 0.4s var(--elastic), background 0.3s;
}
.waypoint--reverse .next-prompt { align-self: flex-start; }

.next-prompt:hover {
    transform: translateY(3px) rotate(0.3deg);
}

.next-prompt:active {
    transform: translateY(5px);
    box-shadow:
        inset 4px 4px 8px var(--inset-dark),
        inset -4px -4px 8px var(--inset-light);
}

.prompt-arrow-angular {
    width: 12px;
    height: 12px;
    border-right: 2px solid var(--c-compass-amber);
    border-bottom: 2px solid var(--c-compass-amber);
    transform: rotate(45deg);
    margin-top: -4px;
    animation: arrowPulse 2s infinite;
}
@keyframes arrowPulse {
    0%, 100% { transform: rotate(45deg) translate(0, 0); }
    50%      { transform: rotate(45deg) translate(2px, 2px); }
}

.prompt-arrow-up {
    width: 12px;
    height: 12px;
    border-left: 2px solid var(--c-compass-amber);
    border-top: 2px solid var(--c-compass-amber);
    transform: rotate(45deg);
    margin-bottom: -4px;
    animation: arrowPulseUp 2s infinite;
}
@keyframes arrowPulseUp {
    0%, 100% { transform: rotate(45deg) translate(0, 0); }
    50%      { transform: rotate(45deg) translate(-2px, -2px); }
}

.prompt-text {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--c-deep-loam);
    text-transform: uppercase;
}
.prompt-text-light { color: var(--c-frozen-clay); }

.prompt-return {
    padding: 14px 24px;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: transform 0.4s var(--elastic);
    border-radius: 24px;
    clip-path: polygon(
        16px 0,
        100% 0,
        100% calc(100% - 16px),
        calc(100% - 16px) 100%,
        0 100%,
        0 16px
    );
}
.prompt-return:hover {
    transform: translateY(-3px);
}

/* ==========================================================================
   EXPEDITION STATUS (waypoint 05)
   ========================================================================== */
.expedition-status {
    padding: 22px 28px;
    text-align: center;
    width: 320px;
}

.status-complete {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.2em;
    color: var(--c-frozen-clay);
    display: block;
    margin-bottom: 14px;
}
.status-complete::after {
    content: '';
    display: block;
    width: 48px;
    height: 2px;
    background: var(--c-compass-amber);
    margin: 10px auto 0;
    opacity: 0.75;
}

.status-bar {
    width: 100%;
    height: 4px;
    background: rgba(232, 212, 190, 0.15);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.status-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--c-glacial-teal), var(--c-compass-amber));
    border-radius: 2px;
    transition: width 2.2s var(--elastic);
}

.status-detail {
    font-family: var(--font-code);
    font-size: 10px;
    color: rgba(232, 212, 190, 0.75);
    letter-spacing: 0.15em;
}

/* ==========================================================================
   STRATUM DIVIDERS  -  repeating micro-chevrons between waypoints
   Sharp-angle motif: geological stratum marker.
   ========================================================================== */
.stratum-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 10px;
    background-image:
        linear-gradient(135deg, transparent 45%, rgba(91, 61, 42, 0.35) 45%, rgba(91, 61, 42, 0.35) 55%, transparent 55%),
        linear-gradient(45deg,  transparent 45%, rgba(91, 61, 42, 0.35) 45%, rgba(91, 61, 42, 0.35) 55%, transparent 55%);
    background-size: 10px 10px;
    background-position: 0 0, 5px 0;
    opacity: 0.55;
    z-index: 2;
    pointer-events: none;
}
.stratum-divider--deep {
    background-image:
        linear-gradient(135deg, transparent 45%, rgba(44, 62, 80, 0.55) 45%, rgba(44, 62, 80, 0.55) 55%, transparent 55%),
        linear-gradient(45deg,  transparent 45%, rgba(44, 62, 80, 0.55) 45%, rgba(44, 62, 80, 0.55) 55%, transparent 55%);
}

/* ==========================================================================
   ENTRANCE ANIMATIONS  -  elastic overshoot (terrain settling)
   ========================================================================== */
.quadrant {
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity 0.6s var(--ease-smooth),
        transform 0.6s var(--elastic);
}

.waypoint.in-view .z-tl { opacity: 1; transform: translateY(0); transition-delay: 0.10s; }
.waypoint.in-view .z-tr { opacity: 1; transform: translateY(0); transition-delay: 0.22s; }
.waypoint.in-view .z-bl { opacity: 1; transform: translateY(0); transition-delay: 0.34s; }
.waypoint.in-view .z-br { opacity: 1; transform: translateY(0); transition-delay: 0.46s; }

/* For reverse sections, first-in-Z is top-right. Adjust delays to follow the
   reversed Z flow: TR (first) > TL > BR > BL. */
.waypoint--reverse.in-view .z-tr { transition-delay: 0.10s; }
.waypoint--reverse.in-view .z-tl { transition-delay: 0.22s; }
.waypoint--reverse.in-view .z-br { transition-delay: 0.34s; }
.waypoint--reverse.in-view .z-bl { transition-delay: 0.46s; }

/* ==========================================================================
   RESPONSIVE  -  collapses Z-grid to single column on narrow viewports,
   Z-trail becomes vertical descent line.
   ========================================================================== */
@media (max-width: 900px) {
    .waypoint {
        padding: 50px 24px 50px 74px;
    }
    .z-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        gap: 20px 0;
    }
    .z-tl, .z-tr, .z-bl, .z-br,
    .waypoint--reverse .z-tl,
    .waypoint--reverse .z-tr,
    .waypoint--reverse .z-bl,
    .waypoint--reverse .z-br {
        grid-column: 1;
        align-items: flex-start;
        justify-content: flex-start;
        text-align: left;
    }
    .z-tr { grid-row: 2; }
    .z-bl { grid-row: 3; }
    .z-br { grid-row: 4; }
    .waypoint--reverse .z-tr { grid-row: 2; }
    .waypoint--reverse .z-bl { grid-row: 3; }
    .waypoint--reverse .z-br { grid-row: 4; }

    .narrative {
        text-align: left;
        max-width: 100%;
    }
    .waypoint-number {
        font-size: 40vw;
    }
    .temperature-gauge {
        right: 10px;
        height: 220px;
    }
    .gauge-labels { display: none; }
    .signal-display, .depth-meters { width: 100%; max-width: 460px; }
    .panel { border-radius: 16px; padding: 18px 20px; }
    .neo-inset, .neo-inset-dark { border-radius: 14px; }
    .status-indicator, .next-prompt { align-self: flex-start; }
    .waypoint-strip { left: 8px; gap: 12px; }
    .wp-chevron svg { width: 22px; height: 10px; }

    /* Z-trail becomes a left-edge vertical descent line */
    .z-trail path.z-path {
        d: path('M 40,40 L 40,960');
    }
}

@media (max-width: 560px) {
    .waypoint { padding: 40px 18px 40px 62px; }
    .waypoint-title { font-size: 32px; }
    .narrative { font-size: 15px; }
    .code-content { font-size: 12px; }
}
