/* ============================================
   gunsul.quest - Botanical Brutalism
   Construction Shaft Descent
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #1a1c19;
    --bg-secondary: #2a2e1f;
    --bg-forest: #1a2e1f;
    --text-primary: #e8e4dc;
    --text-secondary: #9ca68f;
    --accent-chlorophyll: #7cb87a;
    --accent-violet: #9b72cf;
    --accent-teal: #5ec4b6;
    --accent-orange: #d4723c;
    --highlight-biolum: #c8f7c5;
    --shaft-width: 680px;
    --shaft-narrow: 560px;
    --ease-botanical: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.008em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Aurora Background Layer --- */
.aurora-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.aurora-layer.aurora-active {
    opacity: 1;
}

.aurora-layer::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: radial-gradient(ellipse at 30% 50%, rgba(155, 114, 207, 0.15), transparent 60%);
    animation: aurora-drift-1 25s ease-in-out infinite alternate;
}

.aurora-layer::after {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background: radial-gradient(ellipse at 70% 60%, rgba(94, 196, 182, 0.12), transparent 55%);
    animation: aurora-drift-2 30s ease-in-out infinite alternate;
}

@keyframes aurora-drift-1 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(5%, -3%) scale(1.05); }
    66% { transform: translate(-3%, 5%) scale(0.95); }
    100% { transform: translate(2%, -2%) scale(1.02); }
}

@keyframes aurora-drift-2 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-5%, 3%) scale(1.08); }
    100% { transform: translate(3%, -4%) scale(0.97); }
}

/* --- Construction Grid Overlay --- */
.construction-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 59px,
            rgba(232, 228, 220, 0.06) 59px,
            rgba(232, 228, 220, 0.06) 60px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 59px,
            rgba(232, 228, 220, 0.06) 59px,
            rgba(232, 228, 220, 0.06) 60px
        );
    transition: opacity 2s ease;
}

.construction-grid.grid-fractured {
    opacity: 0.3;
}

.construction-grid.grid-overgrown {
    opacity: 0;
}

/* --- Construction Stripe Borders --- */
.construction-border {
    position: fixed;
    top: 0;
    width: calc((100vw - var(--shaft-width)) / 2 - 20px);
    height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0.15;
    transition: opacity 2s ease, clip-path 3s var(--ease-botanical);
}

.construction-border--left {
    left: 0;
    background: repeating-linear-gradient(
        45deg,
        var(--bg-secondary),
        var(--bg-secondary) 10px,
        transparent 10px,
        transparent 20px
    );
}

.construction-border--right {
    right: 0;
    background: repeating-linear-gradient(
        -45deg,
        var(--bg-secondary),
        var(--bg-secondary) 10px,
        transparent 10px,
        transparent 20px
    );
}

.construction-border.border-organic {
    clip-path: polygon(0 0, 100% 0, 85% 25%, 100% 50%, 80% 75%, 100% 100%, 0 100%);
}

/* --- Main Shaft (Single Column) --- */
.shaft {
    position: relative;
    max-width: var(--shaft-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    z-index: 5;
    transition: max-width 3s var(--ease-botanical);
}

.shaft.shaft-narrow {
    max-width: var(--shaft-narrow);
}

.shaft.shaft-restored {
    max-width: var(--shaft-width);
}

/* --- Zone Base --- */
.zone {
    position: relative;
    min-height: 100vh;
    padding: 4rem 0;
}

.zone__label {
    padding: 2rem 0 1rem;
}

/* --- Mono Label --- */
.mono-label {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-chlorophyll);
    display: block;
}

/* --- ZONE 1: Surface (Hero) --- */
.zone--surface {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 0;
}

.zone--surface .zone__label {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.hero-content {
    text-align: center;
}

.hero-title {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 10vw, 7rem);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.hero-korean {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 800;
    font-size: clamp(4rem, 15vw, 10rem);
    color: var(--accent-chlorophyll);
    opacity: 0.7;
    line-height: 1;
}

/* --- Shimmer Text (Skeleton Loading Aesthetic) --- */
.shimmer-text {
    background: linear-gradient(90deg, var(--accent-chlorophyll) 25%, var(--highlight-biolum) 50%, var(--accent-chlorophyll) 75%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* --- Korean Decorative Glyphs --- */
.korean-glyph {
    position: absolute;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 800;
    font-size: clamp(8rem, 20vw, 16rem);
    color: var(--accent-chlorophyll);
    opacity: 0.04;
    pointer-events: none;
    z-index: -1;
    line-height: 1;
    user-select: none;
}

.korean-glyph--1 {
    top: 10%;
    right: -10%;
}

.korean-glyph--2 {
    bottom: 5%;
    left: -15%;
}

.korean-glyph--3 {
    top: 20%;
    right: -8%;
    opacity: 0.06;
}

.korean-glyph--4 {
    bottom: 10%;
    left: -12%;
    opacity: 0.08;
}

/* --- Ghost Blocks (Skeleton Loading Motif) --- */
.ghost-block {
    height: 1.2rem;
    border-radius: 4px;
    margin: 2rem 0;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--highlight-biolum) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 5s ease-in-out infinite;
    opacity: 0.6;
}

.ghost-block--wide {
    width: 85%;
}

.ghost-block--medium {
    width: 60%;
    margin-left: auto;
}

.ghost-block--narrow {
    width: 40%;
    margin-left: 2rem;
}

.ghost-block--fade {
    animation: shimmer 5s ease-in-out infinite, ghost-fade 8s ease-in-out infinite;
}

@keyframes ghost-fade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.2; }
}

/* --- Collage Blocks --- */
.collage-block {
    position: relative;
    background: rgba(42, 46, 31, 0.85);
    padding: 2rem 2.5rem;
    margin: 2.5rem 0;
    z-index: 2;
    transition: transform 0.8s var(--ease-botanical), opacity 0.8s ease;
}

.collage-block--tilt-left {
    transform: rotate(-1.5deg);
}

.collage-block--tilt-right {
    transform: rotate(2deg);
}

.collage-block--frosted {
    backdrop-filter: blur(8px) saturate(1.2);
    -webkit-backdrop-filter: blur(8px) saturate(1.2);
    background: rgba(42, 46, 31, 0.7);
}

.collage-block--overlap {
    margin-top: -2rem;
    position: relative;
}

.collage-block--overlap:nth-child(odd) {
    z-index: 3;
}

.collage-block--overlap:nth-child(even) {
    z-index: 4;
}

.collage-text {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    color: var(--text-primary);
}

.collage-text--large {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 800;
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    line-height: 1.3;
    text-transform: none;
}

.collage-translate {
    display: block;
    margin-top: 0.8rem;
    font-family: 'Overpass Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    font-style: italic;
}

/* --- SVG Vines --- */
.vine {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.vine--left {
    left: -120px;
    top: 10%;
    width: 200px;
    height: 400px;
}

.vine--right {
    right: -120px;
    top: 40%;
    width: 200px;
    height: 400px;
}

.vine--left-dense {
    left: -160px;
    top: 5%;
    width: 300px;
    height: 500px;
}

.vine--right-dense {
    right: -160px;
    top: 15%;
    width: 300px;
    height: 500px;
}

.vine--dense-left {
    left: -200px;
    top: 0;
    width: 400px;
    height: 600px;
}

.vine--dense-right {
    right: -200px;
    top: 5%;
    width: 400px;
    height: 600px;
}

.vine--sparse {
    left: -60px;
    top: 10%;
    width: 200px;
    height: 300px;
}

.vine-path {
    fill: none;
    stroke: var(--accent-chlorophyll);
    stroke-width: 1.5px;
    stroke-linecap: round;
}

.vine-path--secondary {
    stroke: var(--accent-chlorophyll);
    stroke-width: 1px;
    opacity: 0.7;
}

.vine-path--tertiary {
    stroke: var(--accent-teal);
    stroke-width: 0.8px;
    opacity: 0.5;
}

.vine-path--reclaim {
    stroke: var(--accent-chlorophyll);
    stroke-width: 2px;
}

.vine-leaf {
    fill: var(--accent-chlorophyll);
    opacity: 0.6;
    stroke: none;
}

.vine-leaf--reclaim {
    fill: var(--accent-chlorophyll);
    opacity: 0.8;
}

/* Vine draw animation */
.vine--draw .vine-path {
    stroke-dasharray: var(--path-length, 1000);
    stroke-dashoffset: var(--path-length, 1000);
    transition: stroke-dashoffset 3s var(--ease-botanical);
}

.vine--draw.vine-visible .vine-path {
    stroke-dashoffset: 0;
}

.vine--draw .vine-leaf {
    opacity: 0;
    transition: opacity 1.5s ease 2s;
}

.vine--draw.vine-visible .vine-leaf {
    opacity: 0.6;
}

.vine--draw .vine-leaf--reclaim {
    transition: opacity 1.5s ease 2s;
}

.vine--draw.vine-visible .vine-leaf--reclaim {
    opacity: 0.8;
}

/* --- ZONE 2: Breach --- */
.zone--breach {
    padding-top: 2rem;
}

/* --- ZONE 3: Infiltration --- */
.zone--infiltration {
    padding-top: 3rem;
}

.zone--infiltration .collage-block {
    backdrop-filter: blur(8px) saturate(1.2);
    -webkit-backdrop-filter: blur(8px) saturate(1.2);
}

/* --- ZONE 4: Overgrowth --- */
.zone--overgrowth {
    padding-top: 4rem;
}

.overgrowth-statement {
    text-align: center;
    padding: 6rem 0;
}

.statement-line {
    display: block;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 3.5rem);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: var(--text-primary);
}

.statement-line--accent {
    color: var(--highlight-biolum);
}

/* --- ZONE 5: Reclamation --- */
.zone--reclamation {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 6rem 0;
    transition: background-color 3s ease;
}

.reclamation-title {
    position: relative;
    text-align: center;
    margin-bottom: 4rem;
}

.reclamation-domain {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 800;
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent-chlorophyll);
    display: block;
}

.vine-through-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 60px;
    pointer-events: none;
}

.reclamation-closing {
    text-align: center;
}

.mono-label--final {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.mono-label--translation {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0.6;
    display: block;
    margin-top: 0.5rem;
}

/* --- Body background transition for Zone 5 --- */
body {
    transition: background-color 3s ease;
}

body.reclaimed {
    background-color: var(--bg-forest);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .construction-border {
        display: none;
    }

    .vine--left,
    .vine--right,
    .vine--left-dense,
    .vine--right-dense,
    .vine--dense-left,
    .vine--dense-right {
        width: 120px;
    }

    .vine--left,
    .vine--left-dense,
    .vine--dense-left {
        left: -60px;
    }

    .vine--right,
    .vine--right-dense,
    .vine--dense-right {
        right: -60px;
    }

    .collage-block {
        padding: 1.5rem;
    }

    .overgrowth-statement {
        padding: 4rem 0;
    }

    .shaft {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .vine {
        display: none;
    }

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

    .hero-korean {
        font-size: clamp(3rem, 18vw, 6rem);
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .shimmer-text,
    .ghost-block,
    .ghost-block--fade {
        animation: none;
    }

    .aurora-layer::before,
    .aurora-layer::after {
        animation: none;
    }

    .vine--draw .vine-path {
        transition: none;
        stroke-dashoffset: 0;
    }

    .vine--draw .vine-leaf {
        transition: none;
        opacity: 0.6;
    }
}
