/* ========================================
   hangul.day - Bioluminescent Calligraphy
   ======================================== */

:root {
    --void-black: #000000;
    --deep-black: #050510;
    --neon-magenta: #FF2D95;
    --electric-cyan: #00F5D4;
    --acid-yellow: #BBFF00;
    --ultraviolet: #7B2FBE;
    --ghost-white: #E0E0E0;
    --smoke-gray: #AEAEAE;
    --ember-orange: #FF6B35;
}

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

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

body {
    background-color: var(--void-black);
    color: var(--ghost-white);
    font-family: 'IBM Plex Sans KR', sans-serif;
    font-weight: 300;
    line-height: 1.85;
    overflow-x: hidden;
    position: relative;
}

/* --- Spore Particle Layer --- */
.spore-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.spore {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
    animation: sporeFloat linear infinite;
}

@keyframes sporeFloat {
    from {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    15% { opacity: 1; }
    85% { opacity: 1; }
    to {
        transform: translateY(-10vh) translateX(var(--drift-x));
        opacity: 0;
    }
}

/* --- Vertical Wordmark --- */
.vertical-wordmark {
    position: fixed;
    top: 50%;
    left: 1.5rem;
    transform: translateY(-50%);
    writing-mode: vertical-lr;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 0.3em;
    color: var(--neon-magenta);
    text-shadow: 0 0 7px var(--neon-magenta), 0 0 20px var(--neon-magenta);
    z-index: 100;
    pointer-events: none;
    opacity: 0.6;
}

/* --- Typography --- */
h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: 0.05em;
    color: var(--neon-magenta);
    text-shadow:
        0 0 7px var(--neon-magenta),
        0 0 20px var(--neon-magenta),
        0 0 42px rgba(255, 45, 149, 0.5),
        2px 2px 0 var(--electric-cyan);
    line-height: 1;
}

p {
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    margin-bottom: 1.5rem;
}

/* --- Neon Glow Classes --- */
.neon-magenta {
    color: var(--neon-magenta);
    text-shadow:
        0 0 7px var(--neon-magenta),
        0 0 20px var(--neon-magenta),
        0 0 42px rgba(255, 45, 149, 0.5);
}

.neon-cyan {
    color: var(--electric-cyan);
    text-shadow:
        0 0 7px var(--electric-cyan),
        0 0 20px var(--electric-cyan),
        0 0 42px rgba(0, 245, 212, 0.5);
}

.neon-yellow {
    color: var(--acid-yellow);
    text-shadow:
        0 0 7px var(--acid-yellow),
        0 0 20px var(--acid-yellow),
        0 0 42px rgba(187, 255, 0, 0.5);
}

/* --- Glow Pulse --- */
@keyframes glowPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.15); }
}

/* --- Zones --- */
.zone {
    position: relative;
    z-index: 2;
    padding: 4rem 2rem;
}

.zone-title {
    text-align: center;
    margin-bottom: 4rem;
}

/* --- Zone 1: Threshold --- */
.zone-threshold {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.glow-pool {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 500px;
    height: 500px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.glow-magenta {
    background: radial-gradient(ellipse at center, rgba(255, 45, 149, 0.12) 0%, transparent 70%);
}

.hero-han {
    width: clamp(200px, 40vw, 300px);
    height: clamp(200px, 40vw, 300px);
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 15px rgba(255, 45, 149, 0.4));
}

.neon-stroke {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawNeon 1.5s ease forwards;
}

.stroke-1 { animation-delay: 0.5s; }
.stroke-2 { animation-delay: 0.8s; }
.stroke-3 { stroke-dasharray: 100; stroke-dashoffset: 100; animation-delay: 1.1s; }
.stroke-4 { animation-delay: 1.4s; }
.stroke-5 { animation-delay: 1.7s; }
.stroke-6 { stroke-dasharray: 300; stroke-dashoffset: 300; animation-delay: 2.0s; }

@keyframes drawNeon {
    to { stroke-dashoffset: 0; }
}

/* --- Zone 2 & 3: Flow Paths --- */
.flow-path {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 4rem;
}

.jamo-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.jamo-node::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

.jamo-glyph {
    font-family: 'IBM Plex Sans KR', sans-serif;
    font-weight: 300;
    font-size: clamp(80px, 15vw, 200px);
    line-height: 1;
    display: block;
    animation: glowPulse 4s ease-in-out infinite;
}

.jamo-annotation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    opacity: 0;
    transition: opacity 0.4s ease 0.4s;
}

[data-reveal].revealed .jamo-annotation {
    opacity: 1;
}

.roman {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    color: var(--electric-cyan);
    opacity: 0.7;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.organ {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    color: var(--smoke-gray);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* --- Zone 3: Weaving --- */
.zone-weaving {
    padding-top: 6rem;
}

.zone-weaving .zone-title {
    color: var(--acid-yellow);
    text-shadow:
        0 0 7px var(--acid-yellow),
        0 0 20px var(--acid-yellow),
        0 0 42px rgba(187, 255, 0, 0.5),
        2px 2px 0 var(--neon-magenta);
}

.vowel-path .jamo-glyph {
    font-size: clamp(60px, 12vw, 160px);
}

/* --- Zone 4: Synthesis --- */
.zone-synthesis {
    padding-top: 8rem;
    padding-bottom: 8rem;
}

.assembly-examples {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4rem;
    margin-bottom: 4rem;
}

.assembly-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.assembly-parts {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.part {
    font-family: 'IBM Plex Sans KR', sans-serif;
    font-weight: 300;
    font-size: 2.5rem;
}

.part-plus {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    color: var(--smoke-gray);
}

.assembly-result {
    font-family: 'IBM Plex Sans KR', sans-serif;
    font-weight: 500;
    font-size: clamp(4rem, 10vw, 7rem);
    line-height: 1;
    animation: glowPulse 4s ease-in-out infinite;
}

.synthesis-text {
    max-width: 560px;
    margin: 0 auto;
}

.synthesis-text p {
    color: var(--ghost-white);
}

/* --- Zone 5: The Deep --- */
.zone-deep {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--void-black);
}

.deep-trace {
    text-align: center;
    margin-bottom: 6rem;
}

.trace-text {
    font-family: 'IBM Plex Sans KR', sans-serif;
    font-weight: 300;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--electric-cyan);
    text-shadow:
        0 0 7px var(--electric-cyan),
        0 0 20px rgba(0, 245, 212, 0.5);
    letter-spacing: 0.05em;
    line-height: 2;
    max-width: 80vw;
}

.colophon {
    text-align: center;
}

.colophon p {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: var(--smoke-gray);
    opacity: 0.4;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

/* --- Reveal System --- */
[data-reveal] {
    opacity: 0;
    filter: blur(8px);
    transform: scale(0.95);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal].revealed {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    [data-reveal] {
        opacity: 1;
        filter: none;
        transform: none;
    }

    .neon-stroke {
        stroke-dashoffset: 0;
    }

    .spore {
        display: none;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .vertical-wordmark {
        display: none;
    }

    .flow-path {
        padding: 0 1rem;
        gap: 1.5rem;
    }

    .jamo-glyph {
        font-size: clamp(60px, 20vw, 120px);
    }

    .vowel-path .jamo-glyph {
        font-size: clamp(50px, 18vw, 100px);
    }

    .assembly-examples {
        flex-direction: column;
        gap: 3rem;
    }

    .synthesis-text {
        max-width: 90vw;
    }

    .zone {
        padding: 3rem 1.5rem;
    }
}
