/* hangul.dev - Aquarium Typography Editorial */
/* Colors: #faf5ee, #e8e0ed, #5b6e85, #8d7ba8, #f7f0f5, #c8e6d0, #f5e4a1, #2a2438, #f4a5a5, #a8dcd1, #b3b5e6, #f0f5f7, #dfe8e5 */

:root {
    --soft-shell: #f7f0f5;
    --cream-foam: #faf5ee;
    --deep-ink: #2a2438;
    --wisteria: #8d7ba8;
    --coral-pastel: #f4a5a5;
    --aquamint: #a8dcd1;
    --butter-glow: #f5e4a1;
    --periwinkle: #b3b5e6;
    --seafoam: #c8e6d0;
    --slate-ink: #5b6e85;
    --lavender-mist: #e8e0ed;
    --deeper-bg: #dfe8e5;
    --cursor-x: 50vw;
    --cursor-y: 50vh;
}

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


/* Code/Technical typography */
code, .code-text {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.9em;
    color: var(--slate-ink);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Commissioner', sans-serif;
    color: var(--deep-ink);
    overflow-x: hidden;
    background: var(--soft-shell);
    animation: bgOscillate 60s ease-in-out infinite;
}

@keyframes bgOscillate {
    0%, 100% { background-color: #f7f0f5; }
    33% { background-color: #f0f5f7; }
    66% { background-color: #faf5ee; }
}

/* ===== DEPTH PLANE 1: Background Jamo ===== */
.depth-plane-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-jamo {
    position: absolute;
    left: var(--x);
    top: var(--y);
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 100;
    font-size: var(--size);
    color: var(--periwinkle);
    opacity: 0.06;
    transform: rotate(var(--rot));
    animation: jamoFloat var(--speed) linear infinite;
    animation-delay: var(--delay);
    line-height: 1;
    user-select: none;
}

@keyframes jamoFloat {
    0% { transform: rotate(var(--rot)) translateY(0); }
    100% { transform: rotate(var(--rot)) translateY(-120vh); }
}

/* ===== DEPTH PLANE 3: Fish ===== */
.depth-plane-fish {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
    overflow: hidden;
}

.fish {
    position: absolute;
    top: var(--start-y);
    will-change: transform;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fish-angel {
    animation: swimRight 30s linear infinite;
    animation-delay: -5s;
}

.fish-tetra-1 {
    animation: swimRight 8s linear infinite;
    animation-delay: 0s;
}

.fish-tetra-2 {
    animation: swimRight 9s linear infinite;
    animation-delay: -3s;
}

.fish-tetra-3 {
    animation: swimRight 7s linear infinite;
    animation-delay: -1s;
}

.fish-betta {
    animation: swimLeft 18s linear infinite;
    animation-delay: -7s;
}

.fish-puffer {
    animation: swimRight 25s linear infinite, pufferWobble 3s ease-in-out infinite;
    animation-delay: -12s;
}

.fish-seahorse {
    animation: seahorseBob 22s ease-in-out infinite, seahorseDrift 35s linear infinite;
    animation-delay: -4s;
}

.fish-clown {
    animation: swimLeft 14s linear infinite, clownWiggle 1.5s ease-in-out infinite;
    animation-delay: -9s;
}

@keyframes swimRight {
    0% { left: -150px; }
    100% { left: calc(100vw + 150px); }
}

@keyframes swimLeft {
    0% { left: calc(100vw + 150px); transform: scaleX(-1); }
    100% { left: -150px; transform: scaleX(-1); }
}

@keyframes pufferWobble {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(3deg); }
    75% { transform: translateY(8px) rotate(-3deg); }
}

@keyframes seahorseBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-30px); }
}

@keyframes seahorseDrift {
    0% { left: 70vw; }
    50% { left: 30vw; }
    100% { left: 70vw; }
}

@keyframes clownWiggle {
    0%, 100% { transform: scaleX(-1) rotate(0deg); }
    25% { transform: scaleX(-1) rotate(4deg); }
    75% { transform: scaleX(-1) rotate(-4deg); }
}

/* ===== BUBBLES ===== */
.bubbles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.bubble {
    position: absolute;
    bottom: -20px;
    border-radius: 50%;
    background: var(--aquamint);
    animation: floatUp 8s ease-in infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% { opacity: 0.25; }
    90% { opacity: 0.15; }
    100% {
        transform: translateY(-110vh) translateX(30px);
        opacity: 0;
    }
}

/* ===== NAVIGATION ===== */
.pill-nav {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(250, 245, 238, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 40px;
    border: 1px solid rgba(179, 181, 230, 0.2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 8px 14px;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 900;
    font-size: 1rem;
    color: var(--deep-ink);
    text-decoration: none;
    border-radius: 30px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    white-space: nowrap;
}

.nav-item::after {
    content: attr(data-label);
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--wisteria);
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-left: 0;
}

.nav-item:hover {
    background: rgba(179, 181, 230, 0.15);
}

.nav-item:hover::after {
    max-width: 100px;
    opacity: 1;
    margin-left: 6px;
}

/* ===== SCENES COMMON ===== */
.scene {
    position: relative;
    z-index: 10;
    min-height: 100vh;
}

.section-intro {
    padding: 15vh 5vw 8vh;
    text-align: center;
    max-width: 680px;
    margin: 0 auto;
}

.section-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 800;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--deep-ink);
    margin-bottom: 1.5rem;
}

.section-desc {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--wisteria);
    line-height: 1.72;
}

/* ===== SCENE 1: HERO ===== */
.scene-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    text-align: center;
}

.hero-content {
    position: relative;
}

.hero-title {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 900;
    font-size: clamp(8rem, 20vw, 16rem);
    color: var(--deep-ink);
    line-height: 1;
    margin-bottom: 2rem;
    opacity: 0;
    animation: heroFadeIn 1.2s ease-out 0.5s forwards;
}

.hero-char {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.hero-subtitle {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--wisteria);
    line-height: 1.6;
}

.hero-subtitle .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(15px);
    animation: wordFadeIn 0.6s ease-out forwards;
}

.hero-subtitle .word:nth-child(1) { animation-delay: 1.2s; }
.hero-subtitle .word:nth-child(2) { animation-delay: 1.28s; }
.hero-subtitle .word:nth-child(3) { animation-delay: 1.36s; }
.hero-subtitle .word:nth-child(4) { animation-delay: 1.44s; }
.hero-subtitle .word:nth-child(5) { animation-delay: 1.52s; }
.hero-subtitle .word:nth-child(6) { animation-delay: 1.6s; }
.hero-subtitle .word:nth-child(7) { animation-delay: 1.68s; }
.hero-subtitle .word:nth-child(8) { animation-delay: 1.76s; }

@keyframes wordFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== SCENE 2: CONSONANTS ===== */
.scene-consonants {
    padding-bottom: 20vh;
}

.consonant-exhibit {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10vh 5vw;
    min-height: 80vh;
    opacity: 0;
    transform: scale(0.8) translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.consonant-exhibit.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.jamo-display {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jamo-large {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 100;
    font-size: clamp(15rem, 40vw, 30rem);
    color: var(--deep-ink);
    line-height: 1;
    transition: font-weight 0.6s ease;
}

.consonant-exhibit:hover .jamo-large {
    font-weight: 900;
}

.annotation-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.jamo-annotation {
    padding: 2rem 3rem;
}

.jamo-annotation-left {
    grid-column: 1;
    grid-row: 1;
    text-align: right;
}

.jamo-name {
    display: block;
    font-family: 'Commissioner', sans-serif;
    font-weight: 800;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    color: var(--deep-ink);
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.jamo-info {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    line-height: 1.72;
    color: var(--slate-ink);
}

/* ===== SCENE 3: VOWELS ===== */
.scene-vowels {
    padding-bottom: 15vh;
}

.vowel-foundations {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    max-width: 900px;
    margin: 0 auto 10vh;
    padding: 0 5vw;
}

.vowel-foundation-item {
    text-align: center;
    padding: 3rem 2rem;
    background: rgba(250, 245, 238, 0.7);
    border-radius: 20px;
    border: 1px solid rgba(179, 181, 230, 0.15);
    backdrop-filter: blur(10px);
}

.foundation-symbol {
    display: block;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 900;
    font-size: clamp(4rem, 8vw, 7rem);
    color: var(--deep-ink);
    line-height: 1;
    margin-bottom: 1.5rem;
}

.foundation-label {
    display: block;
    font-family: 'Commissioner', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--deep-ink);
    margin-bottom: 0.75rem;
}

.foundation-desc {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--wisteria);
    line-height: 1.6;
}

.vowel-scroll-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    padding: 5vh 0;
}

.vowel-scroll-container::-webkit-scrollbar {
    display: none;
}

.vowel-panel {
    flex: 0 0 100vw;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.vowel-large {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 100;
    font-size: clamp(15rem, 40vw, 30rem);
    color: var(--deep-ink);
    line-height: 1;
    transition: font-weight 0.6s ease;
}

.vowel-panel:hover .vowel-large {
    font-weight: 900;
}

.vowel-romanization {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: 1.5rem;
    letter-spacing: 0.08em;
    color: var(--wisteria);
    margin-top: 2rem;
}

/* ===== SCENE 4: ASSEMBLY ===== */
.scene-assembly {
    padding-bottom: 20vh;
}

.assembly-demo {
    max-width: 800px;
    margin: 0 auto 15vh;
    padding: 0 5vw;
    text-align: center;
}

.assembly-stage {
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-bottom: 3rem;
    min-height: 20vh;
    align-items: center;
}

.assembly-jamo {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 400;
    font-size: clamp(4rem, 10vw, 8rem);
    color: var(--deep-ink);
    opacity: 0;
    transform: translateY(60px);
    transition: all 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.assembly-jamo.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.assembly-result {
    margin-bottom: 2rem;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.assembly-result.animate-in {
    opacity: 1;
    transform: scale(1);
}

.assembled-char {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 900;
    font-size: clamp(8rem, 20vw, 14rem);
    color: var(--deep-ink);
    line-height: 1;
}

.assembly-caption {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    color: var(--slate-ink);
    line-height: 1.72;
}

.assembly-caption strong {
    color: var(--deep-ink);
    font-weight: 800;
}

/* ===== SCENE 5: THE DEEP ===== */
.scene-deep {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    background: linear-gradient(180deg, transparent 0%, var(--lavender-mist) 40%, var(--deeper-bg) 100%);
}

.deep-content {
    position: relative;
}

.deep-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--deep-ink);
    letter-spacing: -0.02em;
    line-height: 1.05;
    margin-bottom: 1.5rem;
    animation: breathe 4s ease-in-out infinite;
}

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

.deep-subtitle {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--wisteria);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .consonant-exhibit {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 5vh 5vw;
        min-height: auto;
    }

    .jamo-annotation-left {
        grid-column: auto;
        grid-row: auto;
        text-align: center;
    }

    .jamo-annotation {
        padding: 1rem;
    }

    .vowel-foundations {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .assembly-stage {
        gap: 2rem;
    }

    .pill-nav {
        gap: 2px;
        padding: 4px 8px;
    }

    .nav-item {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}
