/* ============================================
   gunsul.quest - Construction Narrative
   Color Palette:
     #1C1410 - Deep black
     #2C1E14 - Dark foundation (construction earth)
     #6B5B4B - Medium structure (exposed concrete)
     #E8DDD0 - Light completion (finished plaster)
     #D4A574 - Amber golden (golden hour light)
     #4A90A4 - Blueprint cyan
     #A0483C - Rebar red
     #87CEEB - Sky highlight
   Fonts: Noto Sans KR, Bebas Neue, Noto Serif KR
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: #1C1410;
    color: #E8DDD0;
    font-family: 'Noto Serif KR', serif;
    font-weight: 400;
    line-height: 1.9;
    font-size: clamp(15px, 1.1vw, 17px);
    overflow-x: hidden;
}

/* ============================================
   Floor Progress Indicator
   ============================================ */

#floor-indicator {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

#floor-track {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    background: #D4A574;
    opacity: 0.3;
    z-index: -1;
}

.floor-level {
    padding: 8px 4px;
    position: relative;
    z-index: 1;
}

.floor-label {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 12px;
    letter-spacing: 0.05em;
    color: #6B5B4B;
    transition: color 0.4s ease, transform 0.4s ease;
}

.floor-level.active .floor-label {
    color: #D4A574;
    transform: scale(1.2);
}

#crane-indicator {
    position: absolute;
    right: 28px;
    transition: top 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

/* ============================================
   Hero / Opening Viewport (Ground Floor)
   ============================================ */

#hero {
    width: 100%;
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1C1410;
    overflow: hidden;
}

.letterbox-bar {
    position: absolute;
    left: 0;
    right: 0;
    height: calc((100vh - (100vw / 2.35)) / 2);
    min-height: 40px;
    background: #1C1410;
    z-index: 10;
}

#letterbox-top {
    top: 0;
}

#letterbox-bottom {
    bottom: 0;
}

#cinematic-frame {
    position: relative;
    width: 92vw;
    max-width: 1400px;
    aspect-ratio: 21 / 9;
    max-height: 80vh;
    overflow: hidden;
    opacity: 0;
    animation: fadeInScene 1500ms 200ms ease-out forwards;
}

@keyframes fadeInScene {
    from { opacity: 0; }
    to { opacity: 1; }
}

#frame-border {
    position: absolute;
    inset: 0;
    border: 1px solid #D4A574;
    z-index: 5;
    pointer-events: none;
    clip-path: inset(0 100% 100% 0);
    animation: drawBorder 2000ms 200ms ease-out forwards;
}

@keyframes drawBorder {
    0% { clip-path: inset(0 100% 100% 0); }
    25% { clip-path: inset(0 0 100% 0); }
    50% { clip-path: inset(0 0 0 0); }
    75% { clip-path: inset(0 0 0 0); }
    100% { clip-path: inset(0 0 0 0); }
}

#hero-scene {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hero-crane {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Crane jib rotation */
#crane-jib {
    animation: rotateCraneJib 60s linear infinite;
    transform-origin: 400px 125px;
}

@keyframes rotateCraneJib {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(8deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-8deg); }
    100% { transform: rotate(0deg); }
}

/* ============================================
   Kinetic Type Logotype
   ============================================ */

#logotype {
    position: absolute;
    z-index: 20;
    display: flex;
    align-items: baseline;
    gap: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.logo-part {
    display: flex;
    align-items: baseline;
}

#logo-korean .kinetic-char {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 900;
    font-size: clamp(40px, 7vw, 90px);
    color: #E8DDD0;
    text-shadow: 2px 4px 12px rgba(0,0,0,0.6);
}

#logo-dot .kinetic-char {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(36px, 6vw, 80px);
    color: #D4A574;
    text-shadow: 2px 4px 12px rgba(0,0,0,0.6);
    margin: 0 2px;
}

#logo-english .kinetic-char {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(36px, 6vw, 80px);
    letter-spacing: 0.05em;
    color: #E8DDD0;
    text-shadow: 2px 4px 12px rgba(0,0,0,0.6);
}

.kinetic-char {
    display: inline-block;
    opacity: 0;
    transform: translate(var(--start-x, 0), var(--start-y, 0)) scale(0.3) rotate(var(--start-rot, 0deg));
    animation: kinetic-assemble 600ms var(--delay, 0ms) cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes kinetic-assemble {
    0% {
        opacity: 0;
        transform: translate(var(--start-x, 0), var(--start-y, 0)) scale(0.3) rotate(var(--start-rot, 0deg));
    }
    60% {
        opacity: 1;
        transform: translate(0, 0) scale(1.08) rotate(0deg);
    }
    80% {
        transform: translate(0, 0) scale(0.97) rotate(0deg);
    }
    100% {
        opacity: 1;
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
}

/* ============================================
   Floor Sections - Common
   ============================================ */

.floor {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

.floor-transition-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #D4A574;
    z-index: 20;
    transition: width 0.8s ease-out;
}

.floor.in-view .floor-transition-line {
    width: 100%;
}

.section-content {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px 48px;
    z-index: 2;
}

.section-header {
    margin-bottom: 64px;
}

.section-title-kr {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 900;
    font-size: clamp(32px, 5.5vw, 72px);
    color: #D4A574;
    line-height: 1.1;
    margin-bottom: 8px;
}

.section-title-en {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(18px, 2.5vw, 36px);
    letter-spacing: 0.05em;
    color: #6B5B4B;
    line-height: 1;
}

/* ============================================
   Floor 1 - Foundation
   ============================================ */

#foundation {
    background: #2C1E14;
    position: relative;
}

#blueprint-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.blueprint-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.blueprint-line {
    opacity: 0.15;
    transition: opacity 0.3s ease, stroke-width 0.3s ease;
}

.blueprint-line.highlight {
    opacity: 0.8;
    stroke-width: 1.5px;
}

.foundation-text-block {
    max-width: 640px;
    margin-bottom: 48px;
}

.foundation-text-block p {
    color: #E8DDD0;
    margin-bottom: 24px;
    opacity: 0.85;
}

.section-crane-ornament {
    position: absolute;
    bottom: 48px;
    right: 48px;
    opacity: 0.3;
}

/* ============================================
   Floor 2 - Structure
   ============================================ */

#structure {
    background: #6B5B4B;
}

#structure .section-title-kr {
    color: #E8DDD0;
}

#structure .section-title-en {
    color: #D4A574;
}

.bento-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    grid-template-rows: auto auto;
    gap: 24px;
    margin-bottom: 48px;
}

.bento-cell {
    position: relative;
    background: rgba(44, 30, 20, 0.6);
    border: 1px solid transparent;
    overflow: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.bento-border-draw {
    position: absolute;
    inset: 0;
    border: 1px solid #D4A574;
    opacity: 0;
    clip-path: inset(0 100% 100% 0);
    transition: clip-path 0.8s ease-out, opacity 0.3s ease;
}

.bento-cell.in-view .bento-border-draw {
    opacity: 1;
    clip-path: inset(0 0 0 0);
}

.bento-illustration {
    width: 100%;
    height: auto;
    max-height: 300px;
}

.bento-large {
    grid-column: 1;
    grid-row: 1;
}

.bento-tall {
    grid-column: 2;
    grid-row: 1 / 3;
}

.bento-wide {
    grid-column: 1;
    grid-row: 2;
}

.bento-label {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: #D4A574;
    letter-spacing: 0.08em;
    margin-top: 16px;
    text-align: center;
}

.circuit-connections {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.3;
}

.circuit-path {
    opacity: 0.5;
}

/* ============================================
   Floor 3 - Completion
   ============================================ */

#completion {
    background: #E8DDD0;
    color: #2C1E14;
}

#completion .section-title-kr {
    color: #A0483C;
}

#completion .section-title-en {
    color: #6B5B4B;
}

.completion-statement {
    margin-bottom: 64px;
}

.completion-large-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(24px, 3.5vw, 48px);
    line-height: 1.4;
    color: #2C1E14;
}

.completion-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
}

.completion-column p {
    color: #2C1E14;
    opacity: 0.8;
}

/* ============================================
   Rooftop
   ============================================ */

#rooftop {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to top, #D4A574, #87CEEB);
    position: relative;
}

.rooftop-content {
    text-align: center;
    padding: 48px;
    max-width: 800px;
}

.rooftop-contemplation {
    font-family: 'Noto Serif KR', serif;
    font-weight: 400;
    font-size: clamp(20px, 2.5vw, 32px);
    line-height: 1.8;
    color: #2C1E14;
    margin-bottom: 64px;
}

.rooftop-nav {
    display: flex;
    gap: 32px;
    justify-content: center;
}

.nav-link {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    letter-spacing: 0.1em;
    color: #2C1E14;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid transparent;
    transition: border-color 0.3s ease, color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    border-color: #2C1E14;
    color: #1C1410;
}

/* ============================================
   Scroll Animations
   ============================================ */

.section-content {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.floor.in-view .section-content {
    opacity: 1;
    transform: translateY(0);
}

/* Hero section content is always visible */
#hero .section-content {
    opacity: 1;
    transform: none;
}

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

@media (max-width: 768px) {
    .section-content {
        padding: 80px 24px;
    }

    .bento-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .bento-large { grid-column: 1; grid-row: auto; }
    .bento-tall { grid-column: 1; grid-row: auto; }
    .bento-wide { grid-column: 1; grid-row: auto; }

    .completion-details {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    #floor-indicator {
        right: 12px;
    }

    #crane-indicator {
        right: 20px;
    }

    .letterbox-bar {
        height: calc((100vh - (100vw / 1.5)) / 2);
    }

    .rooftop-nav {
        flex-wrap: wrap;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    #floor-indicator {
        display: none;
    }

    #logotype {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0;
    }
}
