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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
}

body {
    background-color: #1a1612;
    color: #d4c4ae;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ===== Bubbles Container ===== */
#bubbles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.15), transparent 70%);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
    will-change: transform, opacity;
}

/* ===== Aurora ===== */
#aurora {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.aurora-band {
    position: absolute;
    width: 200%;
    height: 40vh;
    left: -50%;
    opacity: 0.12;
    filter: blur(80px);
    will-change: transform;
}

.aurora-band-1 {
    top: 10%;
    background: linear-gradient(90deg, transparent, #a78bfa, #5de4c7, transparent);
    animation: aurora-drift-1 25s ease-in-out infinite alternate;
}

.aurora-band-2 {
    top: 45%;
    background: linear-gradient(90deg, transparent, #5de4c7, #3d5a6e, transparent);
    animation: aurora-drift-2 30s ease-in-out infinite alternate;
}

.aurora-band-3 {
    top: 75%;
    background: linear-gradient(90deg, transparent, #8b7355, #a78bfa, transparent);
    animation: aurora-drift-3 20s ease-in-out infinite alternate;
}

@keyframes aurora-drift-1 {
    0% { transform: translateX(-10%) rotate(-2deg); }
    100% { transform: translateX(10%) rotate(2deg); }
}

@keyframes aurora-drift-2 {
    0% { transform: translateX(15%) rotate(1deg); }
    100% { transform: translateX(-15%) rotate(-1deg); }
}

@keyframes aurora-drift-3 {
    0% { transform: translateX(-5%) rotate(3deg); }
    100% { transform: translateX(5%) rotate(-3deg); }
}

/* ===== Connections Canvas ===== */
#connections-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* ===== Sections ===== */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    padding: 4rem 2rem;
}

.section-inner {
    max-width: 1200px;
    width: 100%;
}

/* ===== Opening Section ===== */
#opening {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.domain-title {
    font-family: 'Source Serif 4', serif;
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 7rem);
    color: #f2e8d9;
    letter-spacing: 0.04em;
    line-height: 1.1;
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(20px);
    animation: fade-up 1.5s ease forwards 0.3s;
}

.domain-title .dot {
    color: #a78bfa;
}

.subtitle {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.75rem, 1.5vw, 1rem);
    color: #8b7355;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    opacity: 0;
    animation: fade-up 1.5s ease forwards 0.8s;
}

.scroll-hint {
    position: absolute;
    bottom: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    animation: fade-up 1.5s ease forwards 1.5s;
}

.scroll-hint-text {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: #8b7355;
    letter-spacing: 0.2em;
    text-transform: lowercase;
}

.scroll-hint-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, #8b7355, transparent);
    animation: scroll-pulse 2s ease-in-out infinite;
}

@keyframes scroll-pulse {
    0%, 100% { opacity: 0.3; transform: scaleY(1); }
    50% { opacity: 1; transform: scaleY(1.3); }
}

@keyframes fade-up {
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Glass Grid ===== */
.glass-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    align-items: start;
}

/* ===== Glass Card ===== */
.glass-card {
    background: rgba(45, 40, 35, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 2rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease, box-shadow 0.4s ease;
}

.glass-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.glass-card:hover {
    box-shadow: 0 8px 32px rgba(167, 139, 250, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-wide {
    grid-column: span 3;
}

.card-tall {
    grid-row: span 2;
}

.card-square {
    grid-column: span 2;
    grid-row: span 2;
}

.card-small {
    grid-column: span 1;
}

.card-hero {
    grid-column: span 3;
}

.card-full {
    grid-column: span 4;
}

/* ===== Card Content ===== */
.card-label {
    display: inline-block;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: #5de4c7;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(93, 228, 199, 0.2);
    padding-bottom: 0.3rem;
}

.glass-card h2 {
    font-family: 'Source Serif 4', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: #f2e8d9;
    margin-bottom: 1rem;
    line-height: 1.25;
}

.glass-card p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #d4c4ae;
}

.card-stat {
    display: flex;
    flex-direction: column;
    margin: 1.5rem 0;
}

.stat-number {
    font-family: 'Source Serif 4', serif;
    font-weight: 700;
    font-size: 3rem;
    color: #a78bfa;
    line-height: 1;
}

.stat-unit {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #8b7355;
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
}

.card-note {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #8b7355;
}

.hanja-meaning {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: #a78bfa;
    margin-bottom: 1rem;
}

.mono-text {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: #5de4c7;
    margin-bottom: 1rem;
    line-height: 2;
}

.accent-card {
    background: rgba(167, 139, 250, 0.08);
    border-color: rgba(167, 139, 250, 0.2);
}

/* Additional theme colors: #2c2318 #4a6741 #6b4f36 */
.glass-card h2 {
    text-shadow: 0 1px 2px rgba(44, 35, 24, 0.3); /* #2c2318 */
}

.card-label {
    text-shadow: 0 0 20px rgba(74, 103, 65, 0.15); /* #4a6741 */
}

.card-note {
    border-left: 2px solid #6b4f36;
    padding-left: 0.5rem;
}

/* ===== Grid Variants ===== */
.grid-local {
    grid-template-columns: repeat(4, 1fr);
}

.grid-convergent {
    grid-template-columns: repeat(4, 1fr);
}

.grid-dissolved {
    grid-template-columns: 1fr;
}

.grid-dissolved .card-full {
    grid-column: span 1;
    text-align: center;
    padding: 4rem;
}

/* ===== Closing Mark ===== */
.closing-mark {
    text-align: center;
    margin-top: 4rem;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.closing-mark.visible {
    opacity: 1;
}

.domain-echo {
    font-family: 'Source Serif 4', serif;
    font-weight: 300;
    font-size: 1.2rem;
    color: #3d3228;
    letter-spacing: 0.1em;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .glass-grid {
        grid-template-columns: 1fr;
    }

    .card-wide,
    .card-tall,
    .card-square,
    .card-hero,
    .card-full {
        grid-column: span 1;
        grid-row: span 1;
    }

    .section {
        padding: 3rem 1.25rem;
    }

    .grid-dissolved .card-full {
        padding: 2.5rem;
    }
}
