/* ============================================
   jungchi.boo — Neon Dancheong / Art-Deco Bento
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
    /* Palette: Dark Neon (obangsaek reinterpreted) */
    --obsidian-void: #0a0a12;
    --charcoal-slate: #141422;
    --civic-glow: #00f0ff;
    --signal-rose: #ff2d6a;
    --mandate-gold: #ffd700;
    --jade-mist: #00ffaa;
    --silver-mist: #c8d0e0;
    --slate-fog: #5a6a8a;
    --midnight-wire: #1e2040;
    --aurora-white: #e8f0ff;

    /* Custom easing */
    --ease-organic: cubic-bezier(0.16, 1, 0.3, 1);

    /* Neon glow values */
    --glow-sm: 8px;
    --glow-md: 20px;
    --glow-lg: 40px;
}

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    background: var(--obsidian-void);
}

body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    color: var(--silver-mist);
    background: var(--obsidian-void);
    overflow-x: hidden;
}

/* ---------- Scroll Progress ---------- */
#scroll-progress {
    position: fixed;
    right: 12px;
    top: 0;
    width: 2px;
    height: 0%;
    background: linear-gradient(
        to bottom,
        var(--civic-glow),
        var(--signal-rose),
        var(--mandate-gold),
        var(--jade-mist)
    );
    z-index: 1000;
    transition: height 0.15s ease;
    box-shadow:
        0 0 var(--glow-sm) var(--civic-glow),
        0 0 var(--glow-md) rgba(0, 240, 255, 0.3);
}

/* ---------- Snap Sections ---------- */
.snap-section {
    min-height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Hanji Texture Filter ---------- */
.hanji-filter-svg {
    position: absolute;
    width: 0;
    height: 0;
}

.bento-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    filter: url(#hanji-texture);
    opacity: 0.02;
    pointer-events: none;
    z-index: 1;
}

/* ============================
   INTRO SECTION
   ============================ */
#intro {
    background: var(--obsidian-void);
    flex-direction: column;
    z-index: 10;
}

#intro-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    opacity: 1;
    transition: transform 0.8s var(--ease-organic), opacity 0.6s ease;
}

#intro-content.shrink {
    transform: scale(0.6) translateY(-20vh);
    opacity: 0;
}

/* Fan-burst SVG */
#fan-burst {
    max-width: 400px;
    width: 60vw;
}

#fan-lines line {
    stroke: var(--midnight-wire);
    stroke-width: 1;
    stroke-dasharray: 250;
    stroke-dashoffset: 250;
    transition: stroke 0.3s ease;
}

#fan-lines line.drawn {
    stroke-dashoffset: 0;
}

#fan-lines line.colored {
    stroke-width: 1.5;
}

/* Taegeuk */
#taegeuk {
    transform-origin: 300px 300px;
    opacity: 0;
    transform: translate(300px, 300px) scale(0);
}

#taegeuk.visible {
    opacity: 1;
    transform: translate(300px, 300px) scale(1);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

#taegeuk .taegeuk-outer,
#taegeuk .taegeuk-yin,
#taegeuk .taegeuk-yang,
#taegeuk .taegeuk-dot-top,
#taegeuk .taegeuk-dot-bottom {
    filter: drop-shadow(0 0 var(--glow-sm) rgba(255, 215, 0, 0.6))
            drop-shadow(0 0 var(--glow-md) rgba(255, 215, 0, 0.3));
}

/* Site Title */
#site-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.05em;
    text-align: center;
    opacity: 0;
}

#site-title.visible {
    opacity: 1;
}

#title-jungchi {
    color: var(--aurora-white);
    text-shadow:
        0 0 var(--glow-sm) rgba(232, 240, 255, 0.4),
        0 0 var(--glow-md) rgba(232, 240, 255, 0.2);
    opacity: 0;
    transform: translateY(30px);
    display: inline-block;
    transition: opacity 0.7s var(--ease-organic), transform 0.7s var(--ease-organic);
}

#title-jungchi.visible {
    opacity: 1;
    transform: translateY(0);
}

#title-boo {
    color: var(--signal-rose);
    text-shadow:
        0 0 var(--glow-sm) var(--signal-rose),
        0 0 var(--glow-md) rgba(255, 45, 106, 0.5),
        0 0 var(--glow-lg) rgba(255, 45, 106, 0.2);
    opacity: 0;
    transform: translateY(30px);
    display: inline-block;
    transition: opacity 0.7s var(--ease-organic), transform 0.7s var(--ease-organic);
}

#title-boo.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================
   BENTO GRID LAYOUT
   ============================ */
.bento-viewport {
    padding: 1.5rem;
    background: var(--obsidian-void);
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 6px;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.bento-grid.visible {
    opacity: 1;
}

/* Cell base */
.bento-cell {
    position: relative;
    background: var(--obsidian-void);
    border: 1px solid var(--midnight-wire);
    overflow: hidden;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

/* Cell hover */
.bento-cell:hover {
    background: var(--charcoal-slate);
}

/* Grid areas */
.assembly-chamber {
    grid-column: 1 / 9;
    grid-row: 1 / 6;
}

.seal-panel {
    grid-column: 9 / 13;
    grid-row: 1 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.transcript-strip {
    grid-column: 9 / 13;
    grid-row: 4 / 6;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.nav-bar {
    grid-column: 1 / 13;
    grid-row: 6 / 7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-archive {
    grid-column: 1 / 7;
    grid-row: 7 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.signal-lamp {
    grid-column: 7 / 13;
    grid-row: 7 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Section-specific accent borders ---- */

/* Deliberation: Cyan */
[data-accent="cyan"] .assembly-chamber {
    border-color: var(--civic-glow);
    box-shadow: inset 0 0 40px rgba(0, 240, 255, 0.05);
}
[data-accent="cyan"] .assembly-chamber:hover {
    border-color: var(--civic-glow);
    box-shadow:
        inset 0 0 40px rgba(0, 240, 255, 0.08),
        0 0 12px var(--civic-glow),
        0 0 30px rgba(0, 240, 255, 0.3),
        0 0 60px rgba(0, 240, 255, 0.1);
}
[data-accent="cyan"] .seal-panel {
    border-color: var(--signal-rose);
}
[data-accent="cyan"] .seal-panel:hover {
    box-shadow:
        0 0 12px var(--signal-rose),
        0 0 30px rgba(255, 45, 106, 0.3),
        0 0 60px rgba(255, 45, 106, 0.1);
}
[data-accent="cyan"] .section-heading {
    color: var(--civic-glow);
    text-shadow:
        0 0 var(--glow-sm) var(--civic-glow),
        0 0 var(--glow-md) rgba(0, 240, 255, 0.5),
        0 0 var(--glow-lg) rgba(0, 240, 255, 0.2);
}

/* Conviction: Magenta */
[data-accent="magenta"] .assembly-chamber {
    border-color: var(--signal-rose);
    box-shadow: inset 0 0 40px rgba(255, 45, 106, 0.05);
}
[data-accent="magenta"] .assembly-chamber:hover {
    border-color: var(--signal-rose);
    box-shadow:
        inset 0 0 40px rgba(255, 45, 106, 0.08),
        0 0 12px var(--signal-rose),
        0 0 30px rgba(255, 45, 106, 0.3),
        0 0 60px rgba(255, 45, 106, 0.1);
}
[data-accent="magenta"] .seal-panel {
    border-color: var(--mandate-gold);
}
[data-accent="magenta"] .seal-panel:hover {
    box-shadow:
        0 0 12px var(--mandate-gold),
        0 0 30px rgba(255, 215, 0, 0.3),
        0 0 60px rgba(255, 215, 0, 0.1);
}
[data-accent="magenta"] .section-heading {
    color: var(--signal-rose);
    text-shadow:
        0 0 var(--glow-sm) var(--signal-rose),
        0 0 var(--glow-md) rgba(255, 45, 106, 0.5),
        0 0 var(--glow-lg) rgba(255, 45, 106, 0.2);
}

/* Mandate: Gold */
[data-accent="gold"] .assembly-chamber {
    border-color: var(--mandate-gold);
    box-shadow: inset 0 0 40px rgba(255, 215, 0, 0.05);
}
[data-accent="gold"] .assembly-chamber:hover {
    border-color: var(--mandate-gold);
    box-shadow:
        inset 0 0 40px rgba(255, 215, 0, 0.08),
        0 0 12px var(--mandate-gold),
        0 0 30px rgba(255, 215, 0, 0.3),
        0 0 60px rgba(255, 215, 0, 0.1);
}
[data-accent="gold"] .seal-panel {
    border-color: var(--jade-mist);
}
[data-accent="gold"] .seal-panel:hover {
    box-shadow:
        0 0 12px var(--jade-mist),
        0 0 30px rgba(0, 255, 170, 0.3),
        0 0 60px rgba(0, 255, 170, 0.1);
}
[data-accent="gold"] .section-heading {
    color: var(--mandate-gold);
    text-shadow:
        0 0 var(--glow-sm) var(--mandate-gold),
        0 0 var(--glow-md) rgba(255, 215, 0, 0.5),
        0 0 var(--glow-lg) rgba(255, 215, 0, 0.2);
}

/* Harmony: Jade */
[data-accent="jade"] .assembly-chamber {
    border-color: var(--jade-mist);
    box-shadow: inset 0 0 40px rgba(0, 255, 170, 0.05);
}
[data-accent="jade"] .assembly-chamber:hover {
    border-color: var(--jade-mist);
    box-shadow:
        inset 0 0 40px rgba(0, 255, 170, 0.08),
        0 0 12px var(--jade-mist),
        0 0 30px rgba(0, 255, 170, 0.3),
        0 0 60px rgba(0, 255, 170, 0.1);
}
[data-accent="jade"] .seal-panel {
    border-color: var(--civic-glow);
}
[data-accent="jade"] .seal-panel:hover {
    box-shadow:
        0 0 12px var(--civic-glow),
        0 0 30px rgba(0, 240, 255, 0.3),
        0 0 60px rgba(0, 240, 255, 0.1);
}
[data-accent="jade"] .section-heading {
    color: var(--jade-mist);
    text-shadow:
        0 0 var(--glow-sm) var(--jade-mist),
        0 0 var(--glow-md) rgba(0, 255, 170, 0.5),
        0 0 var(--glow-lg) rgba(0, 255, 170, 0.2);
}

/* Signal lamp hover: speed up blobs */
.signal-lamp:hover .signal-blob {
    animation-duration: 6s !important;
}

/* ============================
   CELL CONTENT STYLES
   ============================ */

/* Assembly Chamber content */
.cell-content {
    position: relative;
    z-index: 2;
    padding: clamp(1.5rem, 4vw, 3rem);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-heading {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.body-text {
    max-width: 62ch;
    margin-bottom: 1rem;
    color: var(--silver-mist);
    line-height: 1.72;
}

/* Blob background in assembly chambers */
.blob-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.morph-blob {
    animation: blob-morph-1 15s ease-in-out infinite;
}

@keyframes blob-morph-1 {
    0%, 100% {
        d: path("M250,100 C350,100 450,200 400,300 C350,400 200,450 150,350 C100,250 150,100 250,100Z");
    }
    33% {
        d: path("M260,120 C380,80 460,220 390,330 C320,440 180,420 130,320 C80,220 140,160 260,120Z");
    }
    66% {
        d: path("M240,90 C340,110 430,190 410,290 C390,390 220,430 160,340 C100,250 140,70 240,90Z");
    }
}

/* ---- Seal Panel ---- */
.seal-taegeuk {
    width: 80%;
    height: 80%;
    max-width: 180px;
    max-height: 180px;
}

.rotating-seal {
    animation: seal-rotate 60s linear infinite;
    transform-origin: 0 0;
}

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

/* ---- Transcript Strip ---- */
.transcript-scroll {
    display: flex;
    gap: 3rem;
    white-space: nowrap;
    animation: transcript-slide 30s linear infinite;
}

.transcript-scroll .kr-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 0.9em;
    letter-spacing: 0.02em;
    color: var(--slate-fog);
}

.transcript-scroll .en-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 0.9em;
    color: var(--slate-fog);
    opacity: 0.7;
}

@keyframes transcript-slide {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ---- Navigation Bar ---- */
.nav-bar nav {
    display: flex;
    gap: 0;
    width: 100%;
    justify-content: center;
}

.nav-tab {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(0.7rem, 1.5vw, 1rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--slate-fog);
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    transition: color 0.2s ease, text-shadow 0.2s ease;
    position: relative;
}

.nav-tab .chevron-sep {
    color: var(--midnight-wire);
    margin: 0 0.3rem;
    font-size: 1.2em;
}

.nav-tab:hover,
.nav-tab.active {
    color: var(--aurora-white);
}

.nav-tab:hover {
    text-shadow:
        0 0 var(--glow-sm) currentColor,
        0 0 var(--glow-md) currentColor;
}

.nav-tab.active {
    color: var(--aurora-white);
}

/* Nav tab specific accent glow on hover via data attribute */
.nav-tab[data-color="#00f0ff"]:hover {
    color: var(--civic-glow);
    text-shadow: 0 0 8px var(--civic-glow), 0 0 20px rgba(0, 240, 255, 0.5);
}
.nav-tab[data-color="#ff2d6a"]:hover {
    color: var(--signal-rose);
    text-shadow: 0 0 8px var(--signal-rose), 0 0 20px rgba(255, 45, 106, 0.5);
}
.nav-tab[data-color="#ffd700"]:hover {
    color: var(--mandate-gold);
    text-shadow: 0 0 8px var(--mandate-gold), 0 0 20px rgba(255, 215, 0, 0.5);
}
.nav-tab[data-color="#00ffaa"]:hover {
    color: var(--jade-mist);
    text-shadow: 0 0 8px var(--jade-mist), 0 0 20px rgba(0, 255, 170, 0.5);
}

/* ---- Footer Archive ---- */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem 1rem;
}

.catalog-entry {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    letter-spacing: 0.04em;
    color: var(--slate-fog);
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--midnight-wire);
    transition: color 0.2s ease;
}

.catalog-entry:hover {
    color: var(--silver-mist);
}

/* ---- Signal Lamp ---- */
.signal-blobs {
    width: 100%;
    height: 100%;
}

.signal-blob {
    animation: signal-drift 15s ease-in-out infinite alternate;
}

.signal-blob.sb-1 {
    animation-duration: 12s;
    animation-delay: 0s;
}
.signal-blob.sb-2 {
    animation-duration: 16s;
    animation-delay: -3s;
}
.signal-blob.sb-3 {
    animation-duration: 14s;
    animation-delay: -6s;
}
.signal-blob.sb-4 {
    animation-duration: 18s;
    animation-delay: -2s;
}
.signal-blob.sb-5 {
    animation-duration: 13s;
    animation-delay: -5s;
}

@keyframes signal-drift {
    0% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(10px, -15px) scale(1.08); }
    50% { transform: translate(-8px, 12px) scale(0.95); }
    75% { transform: translate(15px, 8px) scale(1.05); }
    100% { transform: translate(-5px, -10px) scale(1); }
}

/* ============================
   INTERSTITIALS
   ============================ */
.interstitial {
    background: var(--obsidian-void);
    flex-direction: column;
    gap: 2rem;
}

.interstitial-fan {
    width: 300px;
    height: 300px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.interstitial-fan.visible {
    opacity: 1;
}

.interstitial-fan line {
    stroke: var(--midnight-wire);
    stroke-width: 1;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s var(--ease-organic);
}

.interstitial-fan.visible line {
    stroke-dashoffset: 0;
}

.chevron-divider {
    width: clamp(300px, 60vw, 600px);
    height: auto;
    margin-top: 1rem;
}

.chevron-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 0.8s var(--ease-organic);
}

.interstitial.in-view .chevron-path {
    stroke-dashoffset: 0;
}

/* ============================
   BENTO CELL EXPAND (click)
   ============================ */
.bento-cell.expanded {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    border-radius: 0;
    transition: all 0.5s var(--ease-organic);
}

.bento-cell.dimmed {
    opacity: 0.2;
    transform: scale(0.97);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--slate-fog);
    background: transparent;
    color: var(--slate-fog);
    font-family: 'Josefin Sans', sans-serif;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 110;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.bento-cell.expanded .close-btn {
    display: flex;
}

.close-btn:hover {
    border-color: var(--aurora-white);
    color: var(--aurora-white);
}

/* ============================
   DANCHEONG BORDER PATTERNS
   ============================ */
.transcript-strip {
    border-image: repeating-linear-gradient(
        90deg,
        var(--midnight-wire) 0px,
        var(--midnight-wire) 8px,
        transparent 8px,
        transparent 16px
    ) 1;
}

.footer-archive {
    border-top: 1px solid var(--midnight-wire);
    border-image: repeating-linear-gradient(
        90deg,
        var(--slate-fog) 0px,
        var(--slate-fog) 4px,
        transparent 4px,
        transparent 12px
    ) 1;
}

/* ============================
   GPU ACCELERATION HINTS
   ============================ */
.bento-cell {
    will-change: box-shadow;
}

#title-jungchi,
#title-boo {
    will-change: text-shadow;
}

.signal-blob,
.morph-blob {
    will-change: transform;
}

/* ============================
   REDUCED MOTION
   ============================ */
@media (prefers-reduced-motion: reduce) {
    .rotating-seal {
        animation: none;
    }
    .transcript-scroll {
        animation: none;
    }
    .morph-blob {
        animation: none;
    }
    .signal-blob {
        animation: none;
    }
    #fan-lines line {
        stroke-dashoffset: 0;
        transition: none;
    }
    .interstitial-fan line {
        stroke-dashoffset: 0;
        transition: none;
    }
    .chevron-path {
        stroke-dashoffset: 0;
        transition: none;
    }
    html {
        scroll-snap-type: none;
    }
}

/* ============================
   RESPONSIVE: Mobile (< 768px)
   ============================ */
@media (max-width: 768px) {
    .bento-viewport {
        padding: 0.5rem;
    }

    .bento-grid {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        gap: 4px;
    }

    .bento-cell {
        min-height: auto;
    }

    .assembly-chamber {
        order: 2;
        min-height: 40vh;
    }

    .seal-panel {
        order: 1;
        min-height: 20vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .transcript-strip {
        order: 3;
        min-height: 8vh;
    }

    .nav-bar {
        order: 6;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 50;
        background: var(--obsidian-void);
        border-top: 1px solid var(--midnight-wire);
        min-height: auto;
        padding: 0.5rem 0;
    }

    .nav-bar nav {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .nav-tab {
        padding: 0.6rem 0.8rem;
        font-size: 0.7rem;
    }

    .footer-archive {
        order: 5;
        min-height: 15vh;
    }

    .signal-lamp {
        order: 4;
        min-height: 20vh;
    }

    .cell-content {
        padding: 1.5rem;
    }

    .section-heading {
        font-size: clamp(1.4rem, 5vw, 2rem);
    }

    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #fan-burst {
        width: 50vw;
    }

    #site-title {
        font-size: clamp(2rem, 10vw, 4rem);
    }

    html {
        scroll-snap-type: none;
    }
}

/* ============================
   RESPONSIVE: Tablet (768-1024px)
   ============================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(8, 1fr);
        grid-template-rows: repeat(8, 1fr);
    }

    .assembly-chamber {
        grid-column: 1 / 6;
        grid-row: 1 / 5;
    }

    .seal-panel {
        grid-column: 6 / 9;
        grid-row: 1 / 3;
    }

    .transcript-strip {
        grid-column: 6 / 9;
        grid-row: 3 / 5;
    }

    .nav-bar {
        grid-column: 1 / 9;
        grid-row: 5 / 6;
    }

    .footer-archive {
        grid-column: 1 / 5;
        grid-row: 6 / 9;
    }

    .signal-lamp {
        grid-column: 5 / 9;
        grid-row: 6 / 9;
    }
}
