/* === RESET & BASE === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #18181b;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    color: #404040;
    overflow-x: hidden;
    line-height: 1.75;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
}

/* === BENTO GRID === */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(3, minmax(140px, 1fr)) 60px repeat(2, minmax(220px, 1fr));
    gap: 4px;
    max-width: 1400px;
    margin: 40px auto;
    padding: 4px;
    background: #c0c0c0;
    border-radius: 4px;
    perspective: 1000px;
    opacity: 0;
    transition: opacity 400ms ease;
}

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

/* === BENTO CELLS === */
.bento-cell {
    background: linear-gradient(135deg, #d4d4d8 0%, #a1a1aa 40%, #e4e4e7 60%, #d4d4d8 100%);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    transition: box-shadow 200ms ease, transform 200ms ease, background 300ms ease;
    opacity: 0;
    transform: translateY(20px);
}

.bento-cell.entered {
    opacity: 1;
    transform: translateY(0) !important;
    animation: cellSnap 500ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cellSnap {
    from { opacity: 0; }
    to { opacity: 1; transform: translateY(0) translateX(0); }
}

.bento-cell[data-enter="left"] { transform: translateX(-40px); }
.bento-cell[data-enter="right"] { transform: translateX(40px); }
.bento-cell[data-enter="top"] { transform: translateY(-40px); }

.bento-cell:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    transform: translateY(-2px) !important;
}

/* === HERO CELL === */
.hero-cell {
    grid-column: 1 / 9;
    grid-row: 1 / 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3f3f46 0%, #18181b 40%, #3f3f46 70%, #18181b 100%);
    color: #e4e4e7;
    padding: 2rem;
}

.hero-text-container {
    position: relative;
    overflow: hidden;
}

.hero-hangul {
    font-family: 'Black Han Sans', sans-serif;
    font-size: clamp(6rem, 15vw, 14rem);
    letter-spacing: -0.02em;
    line-height: 0.95;
    background: linear-gradient(135deg, #d4d4d8 0%, #e4e4e7 30%, #ffffff 50%, #d4d4d8 70%, #a1a1aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
}

.hero-flare {
    position: absolute;
    top: 50%;
    left: -100%;
    width: 200px;
    height: 200px;
    transform: translateY(-50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.9) 15px, rgba(250,204,21,0.3) 40px, rgba(6,182,212,0.1) 100px, transparent 100px);
    pointer-events: none;
    animation: flareSweep 8s ease-in-out infinite;
    z-index: 2;
    mix-blend-mode: screen;
}

@keyframes flareSweep {
    0% { left: -200px; }
    100% { left: calc(100% + 200px); }
}

.hero-subtitle {
    font-family: 'Dela Gothic One', sans-serif;
    font-size: clamp(1.2rem, 3vw, 2.5rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #a1a1aa;
    margin-top: 0.5rem;
}

/* Window grid overlay */
.window-grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(161,161,170,0.2) 0.5px, transparent 0.5px),
        linear-gradient(to bottom, rgba(161,161,170,0.2) 0.5px, transparent 0.5px);
    background-size: 5% 5%;
    pointer-events: none;
    z-index: 0;
    transition: opacity 300ms;
}

.hero-cell:hover .window-grid-overlay {
    opacity: 0;
}

/* Signal dots */
.signal-dots {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0;
}

.dot-red { background: #ef4444; animation: signalIn 200ms 600ms forwards; }
.dot-yellow { background: #facc15; animation: signalIn 200ms 800ms forwards; }
.dot-cyan { background: #06b6d4; animation: signalIn 200ms 1000ms forwards; }

@keyframes signalIn {
    from { opacity: 0; transform: scale(0); }
    to { opacity: 1; transform: scale(1); }
}

/* === SIDEBAR CELLS === */
.sidebar-cell {
    grid-column: 9 / 13;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
}

.sidebar-1 { grid-row: 1; background: #ef4444; color: #ffffff; }
.sidebar-2 { grid-row: 2; background: #facc15; color: #3f3f46; }
.sidebar-3 { grid-row: 3; background: #06b6d4; color: #ffffff; }

.sidebar-text {
    font-family: 'Black Han Sans', sans-serif;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.sidebar-text-en {
    font-family: 'Dela Gothic One', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.5rem;
    opacity: 0.7;
}

.cell-tag {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a0a0a0;
    opacity: 0.5;
    position: absolute;
    top: 8px;
    right: 12px;
}

/* === BEN-DAY DOTS === */
.ben-day-dots {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.08;
    transition: opacity 300ms ease;
}

.sidebar-1 .ben-day-dots {
    background-image: radial-gradient(circle, #06b6d4 1px, transparent 1px);
    background-size: 8px 8px;
}

.sidebar-2 .ben-day-dots {
    background-image: radial-gradient(circle, #ec4899 1px, transparent 1px);
    background-size: 8px 8px;
}

.sidebar-3 .ben-day-dots {
    background-image: radial-gradient(circle, #ef4444 1px, transparent 1px);
    background-size: 8px 8px;
}

.bento-cell:hover .ben-day-dots {
    opacity: 0.2;
}

/* Explore cells dots */
.explore-cell[data-accent="red"] .ben-day-dots {
    background-image: radial-gradient(circle, #06b6d4 1px, transparent 1px);
    background-size: 8px 8px;
}
.explore-cell[data-accent="yellow"] .ben-day-dots {
    background-image: radial-gradient(circle, #ec4899 1px, transparent 1px);
    background-size: 8px 8px;
}
.explore-cell[data-accent="cyan"] .ben-day-dots {
    background-image: radial-gradient(circle, #ef4444 1px, transparent 1px);
    background-size: 8px 8px;
}
.explore-cell[data-accent="magenta"] .ben-day-dots {
    background-image: radial-gradient(circle, #facc15 1px, transparent 1px);
    background-size: 8px 8px;
}

/* === CONTENT BAND === */
.content-band {
    grid-column: 1 / 13;
    grid-row: 4;
    display: flex;
    flex-direction: column;
    padding: 0;
    background: transparent;
}

.crosswalk-top, .crosswalk-bottom {
    height: 12px;
    background: repeating-linear-gradient(
        to right,
        #18181b 0px, #18181b 12px,
        #3f3f46 12px, #3f3f46 24px
    );
}

.chrome-band {
    flex: 1;
    background: linear-gradient(90deg, #d4d4d8, #e4e4e7, #ffffff, #e4e4e7, #d4d4d8, #a1a1aa, #d4d4d8);
    background-size: 200% 100%;
    animation: chromeShift 6s ease-in-out infinite;
}

@keyframes chromeShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* === EXPLORATION CELLS (FLIPPABLE CARDS) === */
.explore-cell {
    grid-column: span 4;
    min-height: 220px;
    perspective: 1000px;
    background: transparent !important;
    overflow: visible;
}

.explore-cell:hover {
    box-shadow: none !important;
    transform: none !important;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-style: preserve-3d;
    cursor: pointer;
}

.card-inner.flipped {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: hidden;
}

.card-front {
    z-index: 2;
}

.card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #d4d4d8 0%, #a1a1aa 40%, #e4e4e7 60%, #d4d4d8 100%);
    color: #3f3f46;
    z-index: 1;
}

/* Card front accent colors */
.explore-cell[data-accent="red"] .card-front { background: #ef4444; color: #ffffff; }
.explore-cell[data-accent="yellow"] .card-front { background: #facc15; color: #3f3f46; }
.explore-cell[data-accent="cyan"] .card-front { background: #06b6d4; color: #ffffff; }
.explore-cell[data-accent="magenta"] .card-front { background: #ec4899; color: #ffffff; }

.deco-char {
    font-family: 'Black Han Sans', sans-serif;
    font-size: clamp(4rem, 10vw, 8rem);
    line-height: 1;
    transform: rotate(-5deg);
    opacity: 0.9;
}

.card-label {
    font-family: 'Dela Gothic One', sans-serif;
    font-size: clamp(1rem, 2vw, 1.5rem);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.5rem;
}

.card-back-title {
    font-family: 'Black Han Sans', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    margin-bottom: 0.75rem;
    color: #18181b;
}

.card-back-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: center;
    max-width: 280px;
    color: #3f3f46;
}

.cell-flare {
    position: absolute;
    top: 20%;
    right: 10%;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.5) 10px, rgba(228,228,231,0.2) 30px, transparent 30px);
    pointer-events: none;
    animation: cellFlarePulse 4s ease-in-out infinite;
}

@keyframes cellFlarePulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
}

/* === SUBWAY LINES === */
.subway-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
}

.subway-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 800ms ease;
}

.subway-line.drawn {
    stroke-dashoffset: 0;
}

.subway-node {
    opacity: 0;
    transition: opacity 300ms ease 800ms;
}

.subway-node.visible {
    opacity: 1;
    animation: nodePulse 600ms ease forwards;
}

@keyframes nodePulse {
    0% { r: 2; }
    50% { r: 6; }
    100% { r: 4; }
}

/* === EDGE FLARES === */
.edge-flare {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 2px, rgba(255,255,255,0.2) 4px, transparent 6px);
    pointer-events: none;
    animation: edgePulse 4s ease-in-out infinite;
}

@keyframes edgePulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.3); opacity: 0.9; }
}

/* === HOVER ACCENT BLOOM === */
.sidebar-1:hover { background: #ef4444; filter: brightness(1.1); }
.sidebar-2:hover { background: #facc15; filter: brightness(1.05); }
.sidebar-3:hover { background: #06b6d4; filter: brightness(1.1); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        margin: 16px;
    }

    .hero-cell {
        grid-column: 1;
        grid-row: auto;
        min-height: 60vh;
    }

    .sidebar-cell {
        grid-column: 1;
        grid-row: auto;
    }

    .content-band {
        grid-column: 1;
        grid-row: auto;
        min-height: 40px;
    }

    .explore-cell {
        grid-column: 1;
        min-height: 260px;
    }

    .subway-lines {
        display: none;
    }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
