/* ============================================================
   gunsul.quest — soft-industrial blobitecture
   palette: #5b5752 #a39e94 #ece7df #f4c542 #e87a3e
            #cdd5d3 #c4bdb3 #fce6a8
   ============================================================ */

:root {
    --wet-concrete: #5b5752;
    --cured-slab: #a39e94;
    --steel-beam: #3d3a36;
    --plaster-bone: #ece7df;
    --surveyor-yellow: #f4c542;
    --hi-vis-orange: #e87a3e;
    --rebar-rust: #8a4a2e;
    --poly-mist: #cdd5d3;
    --beam-warm: #c4bdb3;
    --bubble-glow: #fce6a8;

    --rail-width: 24px;
    --gutter-right: 6vw;
    --text-column-width: 35vw;
    --max-text: 460px;

    --font-display: "Big Shoulders Inline Display", "Inter", system-ui, sans-serif;
    --font-korean-display: "Black Han Sans", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    --font-body: "Lora", "Inter", Georgia, serif;
    --font-korean-body: "Gowun Batang", "Apple SD Gothic Neo", "Malgun Gothic", serif;
    --font-mono: "JetBrains Mono", "Space Mono", monospace;
}

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

html {
    scroll-behavior: auto;
}

body {
    background: var(--plaster-bone);
    color: var(--steel-beam);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 500vh;
    position: relative;
}

/* ============================================================
   Scaffold rail (sticky left edge)
   ============================================================ */

.scaffold-rail {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--rail-width);
    height: 100vh;
    z-index: 50;
    pointer-events: none;
}

.rail-pole {
    position: absolute;
    left: 4px;
    top: 0;
    width: 16px;
    height: 100%;
    background: linear-gradient(90deg,
        #4a4540 0%,
        #6e6862 35%,
        var(--beam-warm) 50%,
        #6e6862 65%,
        #4a4540 100%);
    box-shadow:
        0 0 0 1px rgba(40, 36, 32, 0.4),
        2px 0 8px rgba(40, 36, 32, 0.18);
}

.rail-braces {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.rail-brace {
    position: absolute;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(0deg, #4a4540, #6e6862);
    border-top: 1px solid rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
}

.bubble-wrap {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, 0);
    width: 60px;
    height: 60px;
    will-change: transform;
}

.bubble {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%,
        var(--bubble-glow) 0%,
        var(--surveyor-yellow) 65%,
        #d6a830 100%);
    box-shadow:
        inset 0 0 12px rgba(255, 255, 255, 0.45),
        0 0 18px rgba(244, 197, 66, 0.45),
        0 2px 6px rgba(0, 0, 0, 0.35);
}

.bubble-ring {
    position: absolute;
    inset: -6px;
    width: calc(100% + 12px);
    height: calc(100% + 12px);
    transform: rotate(-90deg);
}

.bubble-ring circle {
    fill: none;
    stroke-width: 2;
}

.ring-track {
    stroke: rgba(91, 87, 82, 0.18);
}

.ring-progress {
    stroke: var(--surveyor-yellow);
    stroke-linecap: round;
    stroke-dasharray: 163.36;
    stroke-dashoffset: 163.36;
    transition: stroke-dashoffset 0.2s linear;
    filter: drop-shadow(0 0 4px rgba(244, 197, 66, 0.6));
}

/* ============================================================
   Surveyor's chalk-line (right edge of text column)
   ============================================================ */

.surveyor-line {
    position: fixed;
    top: 0;
    right: calc(var(--gutter-right) + var(--text-column-width));
    width: 1px;
    height: 100vh;
    border-left: 1px dashed var(--cured-slab);
    z-index: 8;
    pointer-events: none;
    opacity: 0.6;
}

.surveyor-line::before {
    content: "";
    position: absolute;
    left: -4px;
    top: 200px;
    width: 8px;
    height: 8px;
    background:
        linear-gradient(var(--cured-slab), var(--cured-slab)) center/8px 1px no-repeat,
        linear-gradient(var(--cured-slab), var(--cured-slab)) center/1px 8px no-repeat;
    box-shadow:
        0 200px 0 -3px var(--cured-slab),
        0 400px 0 -3px var(--cured-slab),
        0 600px 0 -3px var(--cured-slab);
}

.surveyor-mark {
    position: absolute;
    left: 8px;
    font-family: var(--font-mono);
    font-style: italic;
    font-size: 0.68rem;
    color: var(--cured-slab);
    letter-spacing: 0.04em;
    transform: translateY(-50%);
    white-space: nowrap;
}

.surveyor-cross {
    position: absolute;
    left: -4px;
    width: 8px;
    height: 8px;
    transform: translateY(-50%);
    pointer-events: none;
}

.surveyor-cross::before,
.surveyor-cross::after {
    content: "";
    position: absolute;
    background: var(--cured-slab);
}

.surveyor-cross::before {
    left: 0;
    top: 50%;
    width: 8px;
    height: 1px;
    transform: translateY(-50%);
}

.surveyor-cross::after {
    left: 50%;
    top: 0;
    width: 1px;
    height: 8px;
    transform: translateX(-50%);
}

/* ============================================================
   Phase code stamp (top-right punch-list ticket)
   ============================================================ */

.phase-code {
    position: fixed;
    top: 32px;
    right: 32px;
    width: 200px;
    height: 56px;
    background: var(--plaster-bone);
    border: 1px solid var(--cured-slab);
    box-shadow:
        2px 3px 0 rgba(91, 87, 82, 0.18),
        inset 0 0 0 4px var(--plaster-bone),
        inset 0 0 0 5px rgba(163, 158, 148, 0.4);
    transform: translateY(-180%);
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    pointer-events: none;
}

.phase-code.active {
    animation: phaseCodeDrop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes phaseCodeDrop {
    0% { transform: translateY(-180%); }
    60% { transform: translateY(8%); }
    80% { transform: translateY(-3%); }
    100% { transform: translateY(0); }
}

.phase-code::before {
    content: "";
    position: absolute;
    top: -3px;
    left: 50%;
    width: 18px;
    height: 6px;
    background: var(--steel-beam);
    border-radius: 2px 2px 0 0;
    transform: translateX(-50%);
    box-shadow: 0 -2px 0 -1px var(--steel-beam);
}

.phase-code-text {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.82rem;
    color: var(--steel-beam);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.phase-code.highlight .phase-code-text {
    color: var(--steel-beam);
    background: linear-gradient(180deg, transparent 60%, rgba(244, 197, 66, 0.55) 60%);
    padding: 0 4px;
}

.phase-code-underline {
    position: absolute;
    bottom: 8px;
    left: 12px;
    width: calc(100% - 24px);
    height: 4px;
    overflow: visible;
}

.phase-code-underline line {
    stroke: var(--steel-beam);
    stroke-width: 1;
    stroke-dasharray: 4 3;
    fill: none;
    transition: x2 0.4s ease-out 0.2s;
}

/* ============================================================
   The blob stage (left 65%)
   ============================================================ */

.blob-stage {
    position: fixed;
    top: 0;
    left: 0;
    width: 65vw;
    height: 100vh;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.blob-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

#blobPath {
    transition: opacity 0.6s ease;
    pointer-events: visiblePainted;
    cursor: crosshair;
}

#courtyardPath {
    transition: opacity 0.8s ease;
    pointer-events: none;
}

#frameStrokes {
    transition: opacity 0.6s ease;
}

.frame-stroke {
    stroke: var(--steel-beam);
    stroke-width: 3;
    stroke-linecap: round;
    opacity: 0.55;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: frameStrokeIn 1.2s ease-out forwards;
    animation-play-state: paused;
}

#frameStrokes.visible .frame-stroke {
    animation-play-state: running;
}

#frameStrokes.visible .frame-stroke:nth-child(2) { animation-delay: 0.18s; }
#frameStrokes.visible .frame-stroke:nth-child(3) { animation-delay: 0.36s; }
#frameStrokes.visible .frame-stroke:nth-child(4) { animation-delay: 0.54s; }

@keyframes frameStrokeIn {
    to { stroke-dashoffset: 0; }
}

#stressContours {
    transition: opacity 0.6s ease;
}

.stress-line {
    fill: none;
    stroke: rgba(255, 255, 255, 0.7);
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    animation: stressDraw 2.4s ease-out forwards;
    animation-play-state: paused;
}

#stressContours.visible .stress-line {
    animation-play-state: running;
}

#stressContours.visible #stressPath2 { animation-delay: 0.5s; }
#stressContours.visible #stressPath3 { animation-delay: 1.0s; }

@keyframes stressDraw {
    to { stroke-dashoffset: 0; }
}

/* Polyethylene wrap fragments */
.poly-wrap {
    fill: var(--poly-mist);
    opacity: 0.32;
    pointer-events: none;
}

/* ============================================================
   Curing overlay
   ============================================================ */

.curing-overlay {
    position: fixed;
    top: 50%;
    left: 32%;
    transform: translate(-50%, -50%);
    z-index: 80;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.curing-overlay.active {
    opacity: 1;
}

.curing-message {
    background: rgba(236, 231, 223, 0.92);
    border: 1px dashed var(--cured-slab);
    padding: 20px 28px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    text-align: center;
    box-shadow: 0 8px 32px rgba(91, 87, 82, 0.18);
}

.curing-text {
    display: block;
    font-family: var(--font-mono);
    font-style: italic;
    font-size: 0.92rem;
    color: var(--steel-beam);
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.curing-hint {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--cured-slab);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

/* ============================================================
   Narrative (right column, scrolling content)
   ============================================================ */

.narrative {
    position: relative;
    z-index: 20;
    margin-left: auto;
    margin-right: var(--gutter-right);
    width: var(--text-column-width);
    max-width: var(--max-text);
    padding-top: 18vh;
    padding-bottom: 28vh;
}

.phase {
    min-height: 100vh;
    padding: 14vh 0;
    display: flex;
    align-items: flex-start;
    position: relative;
}

.phase-inner {
    width: 100%;
}

.phase-subscript {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--cured-slab);
    margin-bottom: 1.4rem;
    font-style: italic;
}

.prelude-mono {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.24em;
    color: var(--cured-slab);
    margin-bottom: 1.6rem;
}

.korean-display {
    font-family: var(--font-korean-display);
    font-weight: 400;
    font-size: clamp(2.5rem, 7vw, 6rem);
    letter-spacing: -0.04em;
    line-height: 0.88;
    color: var(--steel-beam);
    margin-bottom: 0.6rem;
    text-rendering: geometricPrecision;
}

.korean-display.small {
    font-size: clamp(2rem, 5vw, 4.2rem);
}

.english-display {
    font-family: var(--font-display);
    font-weight: 100;
    font-size: clamp(1.3rem, 2.4vw, 2rem);
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: var(--rebar-rust);
    margin-bottom: 2.2rem;
    font-variation-settings: "wght" 200;
    text-transform: lowercase;
}

.english-inline {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(1rem, 1.6vw, 1.4rem);
    letter-spacing: 0.04em;
    color: var(--rebar-rust);
    text-transform: lowercase;
    margin-bottom: 2rem;
    font-variation-settings: "wght" 300;
    transition: font-variation-settings 1.2s ease, color 0.8s ease;
}

.phase.in-view .english-inline {
    font-variation-settings: "wght" 800;
    color: var(--steel-beam);
}

.prose-mix {
    font-size: clamp(1.05rem, 1.35vw, 1.3rem);
    line-height: 1.65;
    letter-spacing: 0.005em;
    color: var(--steel-beam);
    margin-bottom: 1.6rem;
    text-align: left;
}

.prose-mix .kr {
    font-family: var(--font-korean-body);
    font-weight: 400;
    color: var(--steel-beam);
    margin-right: 0.4em;
    line-height: 1.7;
}

.prose-mix .en {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--steel-beam);
    font-style: normal;
}

.prose-mix .en-quiet,
.prose-mix .kr-quiet {
    color: var(--cured-slab);
    font-weight: 400;
}

.prose-mix .kr-quiet {
    font-family: var(--font-korean-body);
    font-style: italic;
}

.prose-mix .en-quiet {
    font-style: italic;
    margin-left: 0.4em;
}

.prose-mix.final {
    margin-top: 2rem;
    font-size: clamp(1.2rem, 1.6vw, 1.5rem);
}

/* Punch-list margin annotations */
.punch-list {
    list-style: none;
    margin-top: 2.4rem;
    padding-top: 1.2rem;
    border-top: 1px dashed var(--cured-slab);
}

.punch-list li {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 0.74rem;
    line-height: 2;
    letter-spacing: 0.06em;
    color: var(--cured-slab);
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.punch-bullet {
    color: var(--cured-slab);
    margin-right: 0.6em;
}

.mono-num {
    color: var(--steel-beam);
    font-style: normal;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0.04em;
}

.mono-italic {
    color: var(--steel-beam);
    font-style: italic;
    font-weight: 300;
    text-transform: none;
    letter-spacing: 0.02em;
}

/* Annotation line */
.annotation {
    font-family: var(--font-mono);
    font-weight: 300;
    font-style: italic;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--cured-slab);
    margin-top: 1.6rem;
    text-transform: lowercase;
}

/* ============================================================
   Per-phase tonal variations (palette shift only — no bg change)
   ============================================================ */

.phase-1 .korean-display {
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.phase-2 .korean-display {
    color: var(--steel-beam);
}

.phase-3 .korean-display {
    color: var(--steel-beam);
}

.phase-4 .korean-display {
    color: var(--steel-beam);
}

.phase-5 .korean-display {
    color: var(--steel-beam);
}

.phase-cure {
    min-height: 80vh;
}

.phase-cure .phase-inner {
    border-left: 2px solid var(--cured-slab);
    padding-left: 1.4rem;
    opacity: 0.85;
}

/* Completion stamp */
.completion-stamp {
    position: relative;
    margin-top: 4rem;
    width: 220px;
    height: 110px;
    border: 3px solid var(--hi-vis-orange);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: rotate(-7deg);
    background: rgba(232, 122, 62, 0.04);
    box-shadow:
        inset 0 0 0 1px var(--hi-vis-orange),
        0 0 0 8px var(--plaster-bone),
        0 0 0 9px rgba(232, 122, 62, 0.25);
    opacity: 0;
    transform: rotate(-25deg) scale(2.5);
    transition: opacity 0.5s ease-out, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.completion-stamp.landed {
    opacity: 1;
    transform: rotate(-7deg) scale(1);
}

.stamp-text {
    font-family: var(--font-korean-display);
    font-size: 2.4rem;
    color: var(--hi-vis-orange);
    letter-spacing: -0.02em;
    line-height: 1;
}

.stamp-sub {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--hi-vis-orange);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-top: 0.5rem;
}

.phase-5 .prose-mix.final .en-quiet::after {
    content: " .";
    color: var(--hi-vis-orange);
    font-weight: 700;
}

.phase-eof {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eof-mark {
    font-family: var(--font-mono);
    font-style: italic;
    font-weight: 300;
    font-size: 0.74rem;
    color: var(--cured-slab);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* Intro phase tweaks */
.phase-intro .korean-display {
    font-size: clamp(4rem, 14vw, 11rem);
    line-height: 0.86;
}

.phase-intro .english-display {
    margin-top: 1.4rem;
}

/* ============================================================
   Responsive considerations
   ============================================================ */

@media (max-width: 900px) {
    :root {
        --text-column-width: 60vw;
        --gutter-right: 5vw;
    }

    .blob-stage {
        width: 100vw;
        opacity: 0.32;
    }

    .narrative {
        width: var(--text-column-width);
    }

    .phase-code {
        width: 160px;
        height: 48px;
    }
}

@media (max-width: 560px) {
    :root {
        --text-column-width: 80vw;
        --gutter-right: 6vw;
    }

    .blob-stage {
        opacity: 0.22;
    }

    .scaffold-rail {
        width: 16px;
    }

    .rail-pole {
        width: 10px;
        left: 3px;
    }

    .bubble-wrap {
        width: 40px;
        height: 40px;
    }

    .surveyor-line {
        display: none;
    }

    .completion-stamp {
        width: 180px;
        height: 90px;
    }

    .stamp-text {
        font-size: 1.8rem;
    }
}
