/* ============================================
   gunsul.quest — Construction Timeline
   Fairycore-Industrial Horizontal Scroll
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-formwork: #0B1120;
    --midnight-aggregate: #141E33;
    --scaffold-silver: #C8D0DC;
    --blueprint-cyan: #7B8FA8;
    --forge-copper: #B87A56;
    --marble-vein: #9BA4B8;
    --frost-filament: #D4E0F0;
    --surveyor-amber: #D4A245;
    --dark-navy: #1A2540;

    --font-display: 'Anybody', sans-serif;
    --font-body: 'Albert Sans', sans-serif;
    --font-mono: 'Azeret Mono', monospace;
}

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

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

body {
    background: var(--deep-formwork);
    color: var(--scaffold-silver);
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow: hidden;
    height: 100vh;
    cursor: none;
}

/* --- Custom Cursor --- */
#cursor-crosshair {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#cursor-crosshair.visible {
    opacity: 1;
}

#cursor-crosshair.hidden {
    opacity: 0;
}

.crosshair-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--surveyor-amber);
    transform: translate(-50%, -50%);
}

.crosshair-line {
    position: absolute;
    background: var(--scaffold-silver);
    opacity: 0.3;
}

.crosshair-top {
    width: 1px;
    height: 40px;
    transform: translate(-0.5px, -40px);
    animation: crosshair-pulse-v 3s ease-in-out infinite;
}

.crosshair-right {
    width: 40px;
    height: 1px;
    transform: translate(0, -0.5px);
    animation: crosshair-pulse-h 3s ease-in-out infinite;
}

.crosshair-bottom {
    width: 1px;
    height: 40px;
    transform: translate(-0.5px, 0);
    animation: crosshair-pulse-v 3s ease-in-out infinite;
}

.crosshair-left {
    width: 40px;
    height: 1px;
    transform: translate(-40px, -0.5px);
    animation: crosshair-pulse-h 3s ease-in-out infinite;
}

@keyframes crosshair-pulse-v {
    0%, 100% { height: 40px; }
    50% { height: 55px; }
}

@keyframes crosshair-pulse-h {
    0%, 100% { width: 40px; }
    50% { width: 55px; }
}

/* Glow mode for completion panel */
#cursor-crosshair.glow-mode .crosshair-dot {
    width: 12px;
    height: 12px;
    background: var(--frost-filament);
    box-shadow: 0 0 20px var(--frost-filament), 0 0 40px rgba(212, 224, 240, 0.3);
}

#cursor-crosshair.glow-mode .crosshair-line {
    opacity: 0.15;
    background: var(--frost-filament);
}

/* --- Progress Bar --- */
#progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    z-index: 100;
    background: rgba(11, 17, 32, 0.5);
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--forge-copper), var(--surveyor-amber), var(--frost-filament));
    transition: width 0.1s linear;
}

/* --- Scroll Container --- */
#scroll-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}

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

#scroll-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

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

.panel-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Panel Joints --- */
.panel-joint {
    flex-shrink: 0;
    width: 40px;
    height: 100vh;
    background:
        linear-gradient(180deg,
            var(--midnight-aggregate) 0%,
            var(--marble-vein) 20%,
            var(--midnight-aggregate) 40%,
            var(--marble-vein) 60%,
            var(--midnight-aggregate) 80%,
            var(--marble-vein) 100%
        );
    border-left: 1px solid var(--forge-copper);
    border-right: 1px solid var(--forge-copper);
    opacity: 0.4;
}

/* ============================================
   PANEL 1: SURVEY (80vw)
   ============================================ */
.panel-survey {
    width: 80vw;
    background: var(--deep-formwork);
}

.survey-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
}

.survey-grid.visible {
    opacity: 1;
}

.survey-grid-line {
    position: absolute;
    background: var(--scaffold-silver);
    opacity: 0.08;
    transform-origin: center;
}

.survey-grid-line.horizontal {
    width: 100%;
    height: 1px;
    left: 0;
}

.survey-grid-line.vertical {
    width: 1px;
    height: 100%;
    top: 0;
}

.survey-text {
    position: relative;
    z-index: 10;
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.survey-text.visible {
    opacity: 1;
}

.survey-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(4rem, 8vw, 7rem);
    color: var(--frost-filament);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.3em;
}

.survey-subtitle {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    color: var(--blueprint-cyan);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.scroll-hint {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    animation: pulse-hint 2s ease-in-out infinite;
    transition: opacity 1s ease;
}

.scroll-hint.visible {
    opacity: 1;
}

@keyframes pulse-hint {
    0%, 100% { opacity: 0.4; transform: translateY(-50%) translateX(0); }
    50% { opacity: 1; transform: translateY(-50%) translateX(5px); }
}

/* ============================================
   PANEL 2: EXCAVATION (120vw)
   ============================================ */
.panel-excavation {
    width: 120vw;
    background: linear-gradient(180deg, var(--deep-formwork) 0%, var(--midnight-aggregate) 100%);
}

.strata-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.stratum {
    position: absolute;
    left: 0;
    width: 100%;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
    transform: translateY(10px);
}

.stratum.visible {
    opacity: 1;
    transform: translateY(0);
}

.stratum-1 { top: 0; height: 20%; }
.stratum-2 { top: 20%; height: 20%; }
.stratum-3 { top: 40%; height: 20%; }
.stratum-4 { top: 60%; height: 20%; }
.stratum-5 { top: 80%; height: 20%; }

.stratum-marble {
    width: 100%;
    height: 100%;
}

.stratum-1 .stratum-marble {
    background:
        radial-gradient(ellipse 200px 100px at 30% 50%, rgba(155, 164, 184, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse 300px 80px at 70% 30%, rgba(155, 164, 184, 0.1) 0%, transparent 70%),
        linear-gradient(180deg, var(--deep-formwork) 0%, var(--midnight-aggregate) 100%);
    border-bottom: 2px solid rgba(155, 164, 184, 0.08);
}

.stratum-2 .stratum-marble {
    background:
        radial-gradient(ellipse 250px 120px at 50% 60%, rgba(155, 164, 184, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 180px 90px at 20% 40%, rgba(155, 164, 184, 0.1) 0%, transparent 60%),
        linear-gradient(180deg, var(--midnight-aggregate) 0%, #101a2e 100%);
    border-bottom: 3px solid rgba(155, 164, 184, 0.06);
}

.stratum-3 .stratum-marble {
    background:
        radial-gradient(ellipse 200px 100px at 60% 50%, rgba(184, 122, 86, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 280px 80px at 30% 70%, rgba(184, 122, 86, 0.08) 0%, transparent 60%),
        linear-gradient(180deg, #101a2e 0%, #0d1628 100%);
    border-bottom: 1px solid rgba(184, 122, 86, 0.1);
}

.stratum-4 .stratum-marble {
    background:
        radial-gradient(ellipse 320px 90px at 40% 40%, rgba(155, 164, 184, 0.1) 0%, transparent 70%),
        radial-gradient(ellipse 200px 110px at 75% 60%, rgba(155, 164, 184, 0.08) 0%, transparent 60%),
        linear-gradient(180deg, #0d1628 0%, var(--deep-formwork) 100%);
    border-bottom: 4px solid rgba(155, 164, 184, 0.05);
}

.stratum-5 .stratum-marble {
    background:
        radial-gradient(ellipse 260px 100px at 55% 50%, rgba(184, 122, 86, 0.1) 0%, transparent 70%),
        radial-gradient(ellipse 180px 120px at 25% 30%, rgba(184, 122, 86, 0.06) 0%, transparent 60%),
        linear-gradient(180deg, var(--deep-formwork) 0%, #080d1a 100%);
}

.excavation-text {
    position: relative;
    z-index: 10;
    max-width: 500px;
    padding: 2rem;
}

.panel-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    color: var(--frost-filament);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 1em;
}

.panel-body {
    color: var(--scaffold-silver);
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0.01em;
}

/* ============================================
   PANEL 3: FOUNDATION (100vw)
   ============================================ */
.panel-foundation {
    width: 100vw;
    background: var(--deep-formwork);
}

.foundation-grid {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
}

.wireframe-svg {
    width: 100%;
    height: 100%;
    opacity: 0.3;
}

.wireframe-line {
    transition: stroke-dasharray 0.8s ease;
}

.panel-foundation.active .wireframe-line {
    stroke-dasharray: none;
}

.rebar-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cline x1='0' y1='20' x2='20' y2='0' stroke='%23B87A56' stroke-width='0.8' opacity='0.15'/%3E%3Cline x1='0' y1='0' x2='20' y2='20' stroke='%23B87A56' stroke-width='0.8' opacity='0.15'/%3E%3C/svg%3E");
    background-size: 20px 20px;
    opacity: 0;
    transition: opacity 1s ease;
}

.panel-foundation.active .rebar-overlay {
    opacity: 1;
}

.foundation-text {
    position: relative;
    z-index: 10;
    max-width: 500px;
    padding: 2rem;
}

/* ============================================
   PANEL 4: SUPERSTRUCTURE (140vw)
   ============================================ */
.panel-superstructure {
    width: 140vw;
    background: var(--deep-formwork);
}

.ibeam-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ibeam {
    position: absolute;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-origin: bottom center;
    transform: scaleY(0);
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.ibeam.grown {
    transform: scaleY(1);
}

.ibeam-flange {
    width: 40px;
    height: 8px;
    background: var(--scaffold-silver);
    opacity: 0.2;
}

.ibeam-web {
    width: 6px;
    background: var(--scaffold-silver);
    opacity: 0.18;
    flex-grow: 1;
}

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

.frost-crystal {
    position: absolute;
    opacity: 0;
    transition: opacity 0.5s ease;
    filter: drop-shadow(0 0 3px var(--frost-filament));
}

.frost-crystal.visible {
    opacity: 0.6;
}

.frost-crystal path {
    stroke: var(--frost-filament);
    fill: none;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 1.5s ease;
}

.frost-crystal.visible path {
    stroke-dashoffset: 0;
}

/* HUD Overlay */
.hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hud-frame {
    position: absolute;
    padding: 12px 16px;
    border: 1px solid rgba(123, 143, 168, 0.4);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.panel-superstructure.active .hud-frame {
    opacity: 1;
}

.hud-frame-1 { top: 10%; left: 5%; }
.hud-frame-2 { top: 25%; left: 35%; }
.hud-frame-3 { top: 15%; right: 30%; }
.hud-frame-4 { bottom: 35%; left: 15%; }
.hud-frame-5 { bottom: 20%; right: 15%; }

.hud-bracket {
    position: absolute;
    width: 10px;
    height: 10px;
}

.hud-bracket.tl {
    top: -1px;
    left: -1px;
    border-top: 2px solid var(--surveyor-amber);
    border-left: 2px solid var(--surveyor-amber);
}

.hud-bracket.tr {
    top: -1px;
    right: -1px;
    border-top: 2px solid var(--surveyor-amber);
    border-right: 2px solid var(--surveyor-amber);
}

.hud-bracket.bl {
    bottom: -1px;
    left: -1px;
    border-bottom: 2px solid var(--surveyor-amber);
    border-left: 2px solid var(--surveyor-amber);
}

.hud-bracket.br {
    bottom: -1px;
    right: -1px;
    border-bottom: 2px solid var(--surveyor-amber);
    border-right: 2px solid var(--surveyor-amber);
}

.hud-data {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    font-weight: 400;
    color: var(--blueprint-cyan);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    line-height: 1.8;
}

.hud-scope {
    position: absolute;
    width: 80px;
    height: 80px;
    pointer-events: none;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.panel-superstructure.active .hud-scope {
    opacity: 1;
}

/* Animated dashed lines connecting HUD frames */
.hud-frame::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 1px;
    background: none;
    border-top: 1px dashed rgba(123, 143, 168, 0.3);
    top: 50%;
    right: -60px;
    animation: hud-dash 4s linear infinite;
}

@keyframes hud-dash {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -20; }
}

.superstructure-text {
    position: relative;
    z-index: 10;
    max-width: 520px;
    padding: 2rem;
    margin-left: auto;
    margin-right: 5%;
}

/* ============================================
   PANEL 5: ENVELOPE (100vw)
   ============================================ */
.panel-envelope {
    width: 100vw;
    background: var(--deep-formwork);
}

.curtain-wall {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    grid-template-rows: repeat(auto-fill, minmax(100px, 1fr));
    gap: 2px;
    padding: 2px;
    opacity: 0;
    transition: opacity 1s ease;
}

.panel-envelope.active .curtain-wall {
    opacity: 1;
}

.glass-panel {
    background: linear-gradient(
        var(--glass-angle, 135deg),
        rgba(212, 224, 240, 0.03) 0%,
        rgba(123, 143, 168, 0.06) 30%,
        rgba(212, 224, 240, 0.02) 60%,
        rgba(26, 37, 64, 0.1) 100%
    );
    border: 1px solid rgba(155, 164, 184, 0.08);
    transition: background 0.3s ease;
}

.glass-panel:hover {
    background: linear-gradient(
        var(--glass-angle, 135deg),
        rgba(212, 224, 240, 0.06) 0%,
        rgba(123, 143, 168, 0.1) 30%,
        rgba(212, 224, 240, 0.04) 60%,
        rgba(26, 37, 64, 0.15) 100%
    );
    border-color: rgba(155, 164, 184, 0.15);
}

.envelope-text {
    position: relative;
    z-index: 10;
    max-width: 500px;
    padding: 2rem;
}

/* ============================================
   PANEL 6: SERVICES (90vw)
   ============================================ */
.panel-services {
    width: 90vw;
    background: var(--deep-formwork);
}

.services-schematic {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.services-svg {
    width: 100%;
    height: 100%;
}

.service-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease;
}

.panel-services.active .service-line {
    stroke-dashoffset: 0;
}

.service-node {
    opacity: 0;
    transition: opacity 1s ease 1.5s;
}

.panel-services.active .service-node {
    opacity: 1;
}

.flashlight-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle 150px at 50% 50%, transparent 0%, var(--deep-formwork) 100%);
    pointer-events: none;
    z-index: 5;
}

.services-text {
    position: relative;
    z-index: 10;
    max-width: 500px;
    padding: 2rem;
    margin-left: auto;
    margin-right: 5%;
}

/* ============================================
   PANEL 7: COMPLETION (100vw)
   ============================================ */
.panel-completion {
    width: 100vw;
    background: var(--deep-formwork);
}

.completion-palimpsest {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.palimpsest-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.panel-completion.active .palimpsest-layer {
    opacity: 1;
}

.palimpsest-marble {
    background:
        radial-gradient(ellipse 400px 200px at 30% 40%, rgba(212, 224, 240, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 300px 150px at 70% 60%, rgba(155, 164, 184, 0.04) 0%, transparent 70%),
        radial-gradient(ellipse 500px 250px at 50% 50%, rgba(26, 37, 64, 0.1) 0%, transparent 80%);
    opacity: 0.4;
}

.palimpsest-steel {
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 120px,
            rgba(200, 208, 220, 0.04) 120px,
            rgba(200, 208, 220, 0.04) 126px,
            transparent 126px,
            transparent 200px
        );
    opacity: 0.3;
}

.palimpsest-glass {
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 80px,
            rgba(155, 164, 184, 0.03) 80px,
            rgba(155, 164, 184, 0.03) 82px
        ),
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 60px,
            rgba(155, 164, 184, 0.03) 60px,
            rgba(155, 164, 184, 0.03) 62px
        );
    opacity: 0.25;
}

.palimpsest-services {
    background:
        linear-gradient(15deg, transparent 40%, rgba(184, 122, 86, 0.03) 50%, transparent 60%),
        linear-gradient(-20deg, transparent 35%, rgba(123, 143, 168, 0.03) 45%, transparent 55%),
        linear-gradient(5deg, transparent 50%, rgba(200, 208, 220, 0.02) 55%, transparent 65%);
    opacity: 0.3;
}

.completion-text {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 600px;
    padding: 2rem;
}

.completion-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3.5rem, 7vw, 6rem);
    color: var(--frost-filament);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.2em;
}

.completion-subtitle {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--surveyor-amber);
    margin-bottom: 1.5em;
}

.completion-body {
    max-width: 480px;
    margin: 0 auto;
}

.completion-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 224, 240, 0.08) 0%, transparent 70%);
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 1;
    opacity: 0;
    transition: opacity 1s ease;
}

.panel-completion.active .completion-glow {
    opacity: 1;
}

/* ============================================
   RESPONSIVE / TOUCH
   ============================================ */
@media (max-width: 768px) {
    .panel-survey { width: 100vw; }
    .panel-excavation { width: 150vw; }
    .panel-foundation { width: 120vw; }
    .panel-superstructure { width: 180vw; }
    .panel-envelope { width: 120vw; }
    .panel-services { width: 110vw; }
    .panel-completion { width: 100vw; }

    .panel-title {
        font-size: clamp(2rem, 5vw, 3.5rem);
    }

    .survey-title {
        font-size: clamp(3rem, 10vw, 5rem);
    }

    .panel-body {
        font-size: 0.9rem;
    }

    .hud-frame {
        display: none;
    }

    body {
        cursor: auto;
    }

    #cursor-crosshair {
        display: none;
    }
}

@media (pointer: coarse) {
    body {
        cursor: auto;
    }

    #cursor-crosshair {
        display: none;
    }

    .flashlight-overlay {
        background: rgba(11, 17, 32, 0.7);
    }

    #scroll-container {
        scroll-snap-type: x mandatory;
    }
}

/* ============================================
   ANIMATION UTILITIES
   ============================================ */
.fade-in {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.fade-in.visible {
    opacity: 1;
}
