/* =============================================
   계엄령.quest - Blobitecture Martial Law Archive
   Colors: #f5f0e8, #f0ddd5, #e8c4a8, #2b2b2b, #5a5248, #c4704b, #d4856a, #c9b8b0, #ddd3c7
   Fonts: Space Grotesk (headings), IBM Plex Mono (body), Cormorant Garamond (accents)
   ============================================= */

:root {
    --bg-primary: #f5f0e8;
    --bg-secondary: #f0ddd5;
    --blob-surface: #e8c4a8;
    --text-primary: #2b2b2b;
    --text-secondary: #5a5248;
    --accent-active: #c4704b;
    --accent-hover: #d4856a;
    --blob-shadow: #c9b8b0;
    --border-soft: #ddd3c7;

    --blob-tl: 60%;
    --blob-tr: 45%;
    --blob-br: 55%;
    --blob-bl: 50%;

    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'IBM Plex Mono', monospace;
    --font-accent: 'Cormorant Garamond', serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
}

/* ===== NOISE OVERLAY ===== */
.noise-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.04;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 128px 128px;
    border-radius: inherit;
    z-index: 1;
}

/* ===== NAVIGATION ===== */
#blob-nav {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.nav-blob-container {
    display: flex;
    gap: 4px;
    background: rgba(240, 221, 213, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 60% 55% 58% 52% / 50% 60% 45% 55%;
    padding: 10px 24px;
    box-shadow:
        0 4px 20px rgba(201, 184, 176, 0.3),
        0 2px 8px rgba(201, 184, 176, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: border-radius 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-blob-container:hover {
    border-radius: 55% 60% 52% 58% / 55% 48% 58% 50%;
}

.nav-blob-item {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 50% 45% 55% 40%;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    letter-spacing: 0.02em;
}

.nav-blob-item:hover,
.nav-blob-item.active {
    background: rgba(196, 112, 75, 0.15);
    color: var(--accent-active);
    border-radius: 45% 55% 40% 60%;
}

/* ===== DATE STAMPS ===== */
#date-stamps {
    position: fixed;
    left: 16px;
    top: 0;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

.date-stamp {
    position: absolute;
    font-family: var(--font-body);
    font-size: 9px;
    color: var(--text-secondary);
    opacity: 0.15;
    letter-spacing: 0.05em;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
}

/* ===== HERO SECTION ===== */
.section-hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 60px 20px;
}

.hero-blob {
    width: min(85vw, 700px);
    aspect-ratio: 1 / 0.85;
    position: relative;
}

.hero-blob-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--blob-surface) 60%, var(--bg-secondary) 100%);
    border-radius: 62% 38% 46% 54% / 60% 44% 56% 40%;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 20px 60px rgba(201, 184, 176, 0.4),
        0 8px 24px rgba(201, 184, 176, 0.3),
        0 40px 80px rgba(201, 184, 176, 0.2),
        inset 0 -4px 20px rgba(232, 196, 168, 0.3),
        inset 0 4px 12px rgba(255, 255, 255, 0.2);
    animation: heroBreath 6s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes heroBreath {
    0%, 100% { transform: scale(1); border-radius: 62% 38% 46% 54% / 60% 44% 56% 40%; }
    50% { transform: scale(1.015); border-radius: 58% 42% 50% 50% / 56% 48% 52% 44%; }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px;
}

.hero-seal {
    margin: 0 auto 24px;
    width: 100px;
    height: 100px;
    opacity: 0.7;
    animation: sealRotate 30s linear infinite;
}

@keyframes sealRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(48px, 10vw, 96px);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.1;
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: clamp(14px, 2vw, 18px);
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.hero-annotation {
    font-family: var(--font-accent);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(14px, 2vw, 20px);
    color: var(--accent-hover);
}

.pressure-contours {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.pressure-contours svg {
    width: 100%;
    height: 100%;
}

.scroll-indicator {
    margin-top: 48px;
    text-align: center;
    opacity: 0.4;
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 0.7; transform: translateY(6px); }
}

.scroll-text {
    font-family: var(--font-body);
    font-size: 9px;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 8px;
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--text-secondary), transparent);
    margin: 0 auto;
}

/* ===== BLOB DIVIDER ===== */
.blob-divider {
    margin-top: -2px;
    line-height: 0;
}

.blob-divider svg {
    width: 100%;
    height: 80px;
    display: block;
}

/* ===== SECTION HEADERS ===== */
.section-header {
    text-align: center;
    margin-bottom: 60px;
    padding: 0 20px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: clamp(32px, 6vw, 56px);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.section-subtitle-annotation {
    font-family: var(--font-accent);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(14px, 2vw, 18px);
    color: var(--accent-hover);
}

/* ===== ARCHIVE GRID ===== */
.section-archive {
    padding: 80px 5vw;
    background: var(--bg-secondary);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.blob-cell {
    position: relative;
    background: linear-gradient(145deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--blob-surface) 100%);
    padding: 32px 28px;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
    --blob-tl: 45%;
    --blob-tr: 55%;
    --blob-br: 48%;
    --blob-bl: 52%;
    border-radius: var(--blob-tl) var(--blob-tr) var(--blob-br) var(--blob-bl);
    box-shadow:
        0 8px 32px rgba(201, 184, 176, 0.25),
        0 4px 12px rgba(201, 184, 176, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    animation: blobPulse 6s ease-in-out infinite;
    opacity: 0;
    transform: scale(0.85);
}

.blob-cell.visible {
    opacity: 1;
    transform: scale(1);
}

@keyframes blobPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.008); }
}

.blob-cell:nth-child(2) { animation-delay: 0.5s; }
.blob-cell:nth-child(3) { animation-delay: 1s; }
.blob-cell:nth-child(4) { animation-delay: 1.5s; }
.blob-cell:nth-child(5) { animation-delay: 2s; }
.blob-cell:nth-child(6) { animation-delay: 2.5s; }

.blob-cell-large {
    grid-column: span 2;
    min-height: 280px;
    --blob-tl: 50%;
    --blob-tr: 42%;
    --blob-br: 55%;
    --blob-bl: 45%;
}

.blob-cell-medium {
    min-height: 240px;
    --blob-tl: 42%;
    --blob-tr: 58%;
    --blob-br: 45%;
    --blob-bl: 55%;
}

.blob-cell-small {
    min-height: 200px;
    --blob-tl: 55%;
    --blob-tr: 45%;
    --blob-br: 50%;
    --blob-bl: 48%;
}

.blob-cell-content {
    position: relative;
    z-index: 2;
}

.cell-tag {
    font-family: var(--font-body);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-active);
    display: inline-block;
    margin-bottom: 12px;
    padding: 3px 8px;
    background: rgba(196, 112, 75, 0.08);
    border-radius: 30% 40% 35% 45%;
}

.cell-title {
    font-family: var(--font-heading);
    font-size: clamp(18px, 2.5vw, 24px);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

.cell-body {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}

.redacted {
    background: var(--text-primary);
    color: var(--text-primary);
    padding: 0 2px;
    border-radius: 2px;
}

.cell-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.meta-date {
    font-family: var(--font-body);
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.6;
}

.meta-class {
    font-family: var(--font-body);
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--accent-active);
    padding: 2px 8px;
    border: 1px solid rgba(196, 112, 75, 0.3);
    border-radius: 20px;
}

/* ===== WAX SEAL DRIP ===== */
.wax-seal-drip {
    position: absolute;
    bottom: -8px;
    right: 30px;
    width: 28px;
    height: 36px;
    background: radial-gradient(ellipse at top, var(--accent-active) 0%, var(--accent-hover) 60%, transparent 100%);
    border-radius: 50% 50% 60% 40% / 40% 40% 60% 60%;
    opacity: 0.5;
    z-index: 3;
}

/* ===== TIMELINE ===== */
.section-timeline {
    padding: 80px 5vw;
    background: var(--bg-primary);
}

.timeline-container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    padding-left: 60px;
}

.timeline-line {
    position: absolute;
    left: 24px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--border-soft) 10%, var(--border-soft) 90%, transparent);
}

.timeline-entry {
    margin-bottom: 40px;
    position: relative;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.timeline-entry.visible {
    opacity: 1;
    transform: translateX(0);
}

.timeline-entry::before {
    content: '';
    position: absolute;
    left: -44px;
    top: 24px;
    width: 12px;
    height: 12px;
    background: var(--accent-active);
    border-radius: 50%;
    box-shadow: 0 0 0 4px var(--bg-primary), 0 0 0 6px var(--border-soft);
}

.timeline-blob {
    position: relative;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--blob-surface) 100%);
    border-radius: 48% 52% 45% 55% / 50% 45% 55% 50%;
    padding: 28px 32px;
    box-shadow:
        0 6px 24px rgba(201, 184, 176, 0.25),
        0 3px 8px rgba(201, 184, 176, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    overflow: hidden;
    transition: border-radius 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.timeline-blob:hover {
    border-radius: 52% 48% 55% 45% / 45% 55% 45% 55%;
}

.timeline-year {
    font-family: var(--font-heading);
    font-size: 42px;
    font-weight: 700;
    color: var(--accent-active);
    opacity: 0.2;
    position: absolute;
    right: 20px;
    top: 10px;
    z-index: 0;
    letter-spacing: -0.03em;
}

.timeline-content {
    position: relative;
    z-index: 2;
}

.timeline-content h4 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.timeline-content p {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===== DOCUMENTS SECTION ===== */
.section-documents {
    padding: 80px 5vw;
    background: var(--bg-secondary);
}

.document-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.document-blob {
    position: relative;
    background: linear-gradient(160deg, var(--bg-primary) 0%, rgba(232, 196, 168, 0.3) 100%);
    border-radius: 52% 48% 50% 50% / 48% 52% 48% 52%;
    padding: 32px 24px;
    overflow: hidden;
    box-shadow:
        0 6px 24px rgba(201, 184, 176, 0.2),
        0 3px 8px rgba(201, 184, 176, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: border-radius 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    transform: scale(0.9);
}

.document-blob.visible {
    opacity: 1;
    transform: scale(1);
}

.document-blob:hover {
    border-radius: 48% 52% 46% 54% / 52% 48% 54% 46%;
}

.document-texture {
    position: relative;
    z-index: 2;
}

.texture-text {
    font-family: var(--font-body);
    font-size: 9px;
    line-height: 1.8;
    color: var(--text-secondary);
    opacity: 0.6;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: hidden;
}

.document-label {
    font-family: var(--font-accent);
    font-style: italic;
    font-weight: 300;
    font-size: 13px;
    color: var(--accent-hover);
    margin-top: 16px;
    position: relative;
    z-index: 2;
}

/* ===== LEGACY SECTION ===== */
.section-legacy {
    padding: 80px 5vw;
    background: var(--bg-primary);
}

.legacy-blob-container {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    gap: 32px;
}

.legacy-blob {
    position: relative;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--blob-surface) 50%, var(--bg-secondary) 100%);
    border-radius: 55% 45% 50% 50% / 48% 52% 48% 52%;
    padding: 48px 40px;
    overflow: hidden;
    box-shadow:
        0 12px 40px rgba(201, 184, 176, 0.3),
        0 4px 16px rgba(201, 184, 176, 0.2),
        inset 0 2px 0 rgba(255, 255, 255, 0.2);
    transition: border-radius 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    transform: translateY(20px);
}

.legacy-blob.visible {
    opacity: 1;
    transform: translateY(0);
}

.legacy-blob:hover {
    border-radius: 50% 50% 45% 55% / 52% 48% 55% 45%;
}

.legacy-content {
    position: relative;
    z-index: 2;
}

.seal-stamp {
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.legacy-quote {
    font-family: var(--font-accent);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(18px, 3vw, 26px);
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 16px;
    padding-left: 20px;
    border-left: 2px solid var(--accent-active);
}

.legacy-attribution {
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.6;
    padding-left: 20px;
}

.legacy-body {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ===== FOOTER ===== */
.section-footer {
    padding: 60px 5vw 40px;
    background: var(--bg-secondary);
    position: relative;
}

.footer-blob {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-radius: 50% 50% 45% 55% / 45% 55% 45% 55%;
    padding: 40px 32px;
    overflow: hidden;
    box-shadow:
        0 6px 20px rgba(201, 184, 176, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    text-align: center;
}

.footer-content {
    position: relative;
    z-index: 2;
}

.footer-text {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.footer-meta {
    font-family: var(--font-body);
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-bottom: 16px;
}

.footer-seal {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    opacity: 0.4;
}

.footer-tendrils {
    margin-top: 32px;
    line-height: 0;
}

.footer-tendrils svg {
    width: 100%;
    height: 100px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .blob-cell-large {
        grid-column: span 2;
    }
    .document-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    .blob-cell-large {
        grid-column: span 1;
    }
    .document-grid {
        grid-template-columns: 1fr;
    }
    .nav-blob-container {
        padding: 8px 12px;
        gap: 2px;
    }
    .nav-blob-item {
        font-size: 9px;
        padding: 4px 8px;
    }
    #date-stamps {
        display: none;
    }
    .timeline-container {
        padding-left: 40px;
    }
    .timeline-entry::before {
        left: -24px;
    }
    .timeline-line {
        left: 12px;
    }
}

/* ===== TEXT LINE ANIMATION ===== */
.line-animate {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.line-animate.visible {
    opacity: 1;
    transform: translateY(0);
}
