/* ============================================
   gunsul.quest - Construction Simulation Quest
   Brutalist Concrete + Isometric Building
   ============================================ */

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

:root {
    --bg-concrete: #d4cfc7;
    --surface-dark: #5a5650;
    --text-primary: #2d2b28;
    --accent-orange: #e86833;
    --steel-blue: #6b7b8d;
    --completion-green: #4a9d5b;
    --caution-yellow: #f0c040;
    --blueprint-blue: #4a86b8;
    --concrete-light: #c8c3ba;
    --concrete-darkest: #4a4440;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
    background: linear-gradient(135deg, #d4cfc7 0%, #c8c3ba 100%);
    position: relative;
    overflow-x: hidden;
}

/* --- Concrete Noise Texture (applied globally) --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.05;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAMklEQVQYV2NkYPj/n4EBBBiZGBj+MzAwMDIwMPxnZGT8z8DA8J+JgeE/AwPDfwYGBgYAMTYG/TFpKEoAAAAASUVORK5CYII=");
}

/* --- Blueprint Grid Overlay --- */
#blueprint-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image:
        linear-gradient(rgba(74, 134, 184, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 134, 184, 0.08) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.korean-label {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    display: block;
    font-size: 0.8rem;
    color: var(--accent-orange);
    margin-bottom: 2px;
    letter-spacing: 0;
    text-transform: none;
}

.stat-value,
.stat-mono,
#progress-percent,
.material-qty,
.node-date {
    font-family: 'Roboto Mono', monospace;
    font-weight: 400;
}

/* ============================================
   HERO: THE BUILD SITE
   ============================================ */
#hero {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

#hero-content {
    text-align: center;
    max-width: 700px;
    width: 100%;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.hero-title-sub {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.4em;
    color: var(--accent-orange);
    vertical-align: baseline;
    letter-spacing: 0;
    text-transform: none;
}

.hero-tagline {
    font-family: 'Work Sans', sans-serif;
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--steel-blue);
    margin-bottom: 40px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* --- Isometric Construction Site SVG --- */
#isometric-wrapper {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 40px;
}

#construction-site {
    width: 100%;
    height: auto;
    filter: drop-shadow(4px 8px 12px rgba(45, 43, 40, 0.3));
}

.building-block {
    transition: transform 0.3s ease;
}

/* Crane arm rotation */
#crane-arm {
    transform-origin: 134px 59px;
    animation: craneRotate 30s linear infinite;
}

@keyframes craneRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Progress Bar --- */
#progress-container {
    max-width: 500px;
    margin: 0 auto;
}

#progress-label {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 8px;
}

#progress-label .korean-label {
    margin-bottom: 0;
}

.progress-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1rem;
    letter-spacing: 0.1em;
    color: var(--surface-dark);
    text-transform: uppercase;
}

#progress-bar {
    width: 100%;
    height: 24px;
    background: var(--surface-dark);
    position: relative;
    overflow: hidden;
}

#progress-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.1;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAMklEQVQYV2NkYPj/n4EBBBiZGBj+MzAwMDIwMPxnZGT8z8DA8J+JgeE/AwPDfwYGBgYAMTYG/TFpKEoAAAAASUVORK5CYII=");
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e86833, #f0c040);
    transition: width 1s ease-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

#progress-percent {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 400;
}

/* ============================================
   BLUEPRINT GRID: QUEST CATEGORIES
   ============================================ */
#blueprint-grid {
    position: relative;
    z-index: 2;
    padding: 60px 24px;
}

.section-title {
    font-size: clamp(2rem, 5vw, 4rem);
    margin-bottom: 32px;
    text-align: center;
    color: var(--text-primary);
}

.section-title .korean-label {
    display: inline;
    margin-right: 12px;
    font-size: 0.5em;
}

#quest-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Individual quest block */
.quest-block {
    background: var(--surface-dark);
    padding: 32px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.quest-block::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.08;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAMklEQVQYV2NkYPj/n4EBBBiZGBj+MzAwMDIwMPxnZGT8z8DA8J+JgeE/AwPDfwYGBgYAMTYG/TFpKEoAAAAASUVORK5CYII=");
    pointer-events: none;
}

.quest-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 43, 40, 0.4);
}

.block-top-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-orange);
}

.block-icon {
    margin-bottom: 16px;
}

.block-title {
    font-size: 1.6rem;
    color: #ffffff;
    margin-bottom: 2px;
}

.block-korean {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--accent-orange);
    display: block;
    margin-bottom: 12px;
}

.block-desc {
    font-size: 0.85rem;
    color: var(--concrete-light);
    line-height: 1.6;
    margin-bottom: 16px;
}

.block-stats {
    margin-bottom: 12px;
}

.block-stats .stat-value {
    font-size: 1.4rem;
    color: var(--caution-yellow);
    margin-right: 6px;
}

.block-stats .stat-label {
    font-size: 0.75rem;
    color: var(--steel-blue);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Mini progress bars in blocks */
.block-progress-mini {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.mini-fill {
    height: 100%;
    background: var(--completion-green);
    transition: width 0.8s ease-out;
}

.mini-fill.locked {
    background: var(--steel-blue);
}

/* Locked overlay */
.block-locked-overlay {
    position: absolute;
    inset: 0;
    background: rgba(45, 43, 40, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.locked-text {
    font-family: 'Work Sans', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--caution-yellow);
    background: var(--surface-dark);
    padding: 8px 16px;
    border: 1px solid var(--caution-yellow);
}

/* 5th block spans remaining columns */
.quest-block:nth-child(5) {
    grid-column: span 1;
}

/* ============================================
   MAIN CONTENT AREA + TIMELINE
   ============================================ */
#content-area {
    position: relative;
    z-index: 2;
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
    gap: 24px;
}

#main-content {
    flex: 1;
    min-width: 0;
}

/* Concrete Panel */
.concrete-panel {
    background: var(--surface-dark);
    padding: 32px;
    margin-bottom: 24px;
    position: relative;
}

.concrete-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.08;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAMklEQVQYV2NkYPj/n4EBBBiZGBj+MzAwMDIwMPxnZGT8z8DA8J+JgeE/AwPDfwYGBgYAMTYG/TFpKEoAAAAASUVORK5CYII=");
    pointer-events: none;
}

.panel-header {
    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: #ffffff;
}

/* Active Quest Detail */
.quest-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.quest-category-badge {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    background: var(--accent-orange);
    color: #ffffff;
    padding: 4px 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.quest-difficulty {
    color: var(--caution-yellow);
    font-size: 0.85rem;
    letter-spacing: 2px;
}

.quest-name {
    font-size: 1.6rem;
    color: #ffffff;
    margin-bottom: 8px;
}

.quest-description {
    color: var(--concrete-light);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.quest-requirements {
    margin-bottom: 20px;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--steel-blue);
    font-size: 0.9rem;
}

.requirement.completed {
    color: var(--completion-green);
}

.requirement.active {
    color: var(--caution-yellow);
}

.req-check {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.quest-reward {
    background: rgba(74, 157, 91, 0.15);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.reward-label {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1rem;
    color: var(--completion-green);
    letter-spacing: 0.1em;
}

.reward-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    color: var(--caution-yellow);
}

.reward-item {
    font-size: 0.85rem;
    color: var(--concrete-light);
}

/* ============================================
   MATERIALS INVENTORY (Horizontal Scroll)
   ============================================ */
#materials-section {
    background: var(--surface-dark);
    padding: 32px;
    position: relative;
}

#materials-section::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.08;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAMklEQVQYV2NkYPj/n4EBBBiZGBj+MzAwMDIwMPxnZGT8z8DA8J+JgeE/AwPDfwYGBgYAMTYG/TFpKEoAAAAASUVORK5CYII=");
    pointer-events: none;
}

#materials-section .panel-header h2 {
    color: #ffffff;
}

#materials-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 4px;
    padding-bottom: 12px;
}

#materials-scroll::-webkit-scrollbar {
    height: 6px;
}

#materials-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#materials-scroll::-webkit-scrollbar-thumb {
    background: var(--steel-blue);
}

.material-card {
    scroll-snap-align: start;
    min-width: 200px;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    text-align: center;
    flex-shrink: 0;
    transition: background 0.2s ease;
    border-top: 3px solid var(--steel-blue);
}

.material-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

.material-icon {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
}

.material-icon svg {
    width: 100px;
    height: 100px;
}

.material-name {
    display: block;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    color: #ffffff;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.material-korean {
    display: block;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--accent-orange);
    margin-bottom: 8px;
}

.material-qty {
    font-size: 1.1rem;
    color: var(--caution-yellow);
}

/* ============================================
   CONSTRUCTION TIMELINE (Right Sidebar)
   ============================================ */
#timeline {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 40px;
    align-self: flex-start;
}

.timeline-header {
    margin-bottom: 24px;
}

.timeline-header h3 {
    font-size: 1.4rem;
    color: var(--text-primary);
}

#timeline-track {
    position: relative;
    padding-left: 20px;
}

.timeline-node {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}

.node-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--steel-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-concrete);
    color: var(--steel-blue);
    transition: all 0.3s ease;
}

.timeline-node.completed .node-circle {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: #ffffff;
}

.timeline-node.active .node-circle {
    background: var(--caution-yellow);
    border-color: var(--caution-yellow);
    color: var(--text-primary);
    animation: pulseNode 2s ease-in-out infinite;
}

@keyframes pulseNode {
    0%, 100% { box-shadow: 0 0 0 0 rgba(240, 192, 64, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(240, 192, 64, 0); }
}

.timeline-node.final .node-circle {
    border-color: var(--completion-green);
    color: var(--completion-green);
}

.node-content {
    padding-bottom: 4px;
}

.node-title {
    display: block;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    line-height: 1.2;
}

.node-korean {
    display: block;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--steel-blue);
}

.node-date {
    display: block;
    font-size: 0.75rem;
    color: var(--accent-orange);
    margin-top: 2px;
}

.timeline-connector {
    width: 2px;
    height: 24px;
    background: var(--steel-blue);
    margin-left: 15px;
    opacity: 0.3;
}

.timeline-connector.completed {
    background: var(--accent-orange);
    opacity: 1;
}

/* ============================================
   FOOTER
   ============================================ */
#site-footer {
    position: relative;
    z-index: 2;
    margin-top: 60px;
}

.footer-barricade {
    height: 8px;
    background: repeating-linear-gradient(
        45deg,
        var(--accent-orange),
        var(--accent-orange) 10px,
        #ffffff 10px,
        #ffffff 20px
    );
}

.footer-content {
    background: var(--surface-dark);
    padding: 32px 24px;
    text-align: center;
}

.footer-brand {
    display: block;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    color: #ffffff;
    letter-spacing: 0.1em;
}

.footer-tagline {
    display: block;
    font-family: 'Work Sans', sans-serif;
    font-size: 0.85rem;
    color: var(--steel-blue);
    margin-bottom: 16px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.footer-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.footer-stats .stat-mono {
    font-size: 0.8rem;
    color: var(--caution-yellow);
}

.stat-divider {
    color: var(--steel-blue);
    opacity: 0.5;
}

/* ============================================
   BARRICADE STRIPE PATTERN (reusable)
   ============================================ */
.barricade-stripe {
    background: repeating-linear-gradient(
        45deg,
        var(--accent-orange),
        var(--accent-orange) 8px,
        #ffffff 8px,
        #ffffff 16px
    );
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    #quest-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #content-area {
        flex-direction: column;
    }

    #timeline {
        width: 100%;
        position: static;
    }

    #timeline-track {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding-left: 0;
    }

    .timeline-connector {
        width: 24px;
        height: 2px;
        margin-left: 0;
        margin-top: 15px;
    }
}

@media (max-width: 640px) {
    #quest-grid {
        grid-template-columns: 1fr;
    }

    .quest-block {
        padding: 24px;
    }

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

    #materials-scroll {
        gap: 2px;
    }

    .material-card {
        min-width: 160px;
        padding: 16px;
    }

    .material-icon svg {
        width: 80px;
        height: 80px;
    }
}
