/* ========================================
   hangul.name - Mid-Century Hangul Laboratory
   ======================================== */

:root {
    --aurora-teal: #1B7A6E;
    --aurora-violet: #7B5EA7;
    --aurora-rose: #D4729B;
    --aurora-green: #4ECDC4;
    --night-sky: #1E2433;
    --specimen-white: #FAFBFC;
    --warm-gray: #8B95A5;
    --parchment-cream: #F5F0E8;
    --charcoal-ink: #2A2D35;
    --blush-glow: #FFF0F5;
    --slate: #6B7A8D;
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

body {
    background-color: var(--parchment-cream);
    color: var(--charcoal-ink);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Top Bar --- */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem clamp(1rem, 4vw, 3rem);
    background: rgba(245, 240, 232, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(139, 149, 165, 0.15);
}

.site-identity {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--charcoal-ink);
}

.dot {
    color: var(--aurora-teal);
}

.nav-pills {
    display: flex;
    gap: 0.5rem;
}

.pill {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 100px;
    background: rgba(139, 149, 165, 0.1);
    color: var(--warm-gray);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.pill.active,
.pill:hover {
    background: linear-gradient(135deg, #1B7A6E, #4ECDC4, #7B5EA7);
    color: #fff;
}

/* --- Typography --- */
h2 {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 3.8rem);
    letter-spacing: 0.01em;
    line-height: 1.25;
    color: var(--charcoal-ink);
}

h3 {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--charcoal-ink);
    margin-bottom: 0.5rem;
}

p {
    font-size: clamp(0.95rem, 1.4vw, 1.1rem);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* --- Sections --- */
.section {
    position: relative;
}

.section-heading {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 4rem;
}

/* --- Section 1: Entrance --- */
.section-entrance {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.aurora-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1B7A6E 0%, #4ECDC4 25%, #7B5EA7 50%, #D4729B 75%, #F5F0E8 100%);
    background-size: 400% 400%;
    animation: auroraShift 20s ease infinite;
    opacity: 0.08;
    z-index: 0;
}

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

.entrance-display {
    position: relative;
    z-index: 1;
}

.hangul-atomic {
    position: relative;
    width: clamp(200px, 40vw, 400px);
    height: clamp(200px, 40vw, 400px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.syllable {
    font-size: clamp(6rem, 15vw, 12rem);
    font-weight: 300;
    color: var(--charcoal-ink);
    position: absolute;
    transition: opacity 0.8s ease;
}

.syl-han { left: 15%; }
.syl-geul { right: 15%; }

.atom {
    position: absolute;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 300;
    opacity: 0;
    transition: all 0.8s var(--spring);
}

.hangul-atomic.decomposed .syllable {
    opacity: 0.15;
}

.hangul-atomic.decomposed .atom {
    opacity: 1;
}

.atom-h { color: var(--aurora-teal); }
.atom-a { color: var(--aurora-rose); }
.atom-n1 { color: var(--aurora-violet); }
.atom-g { color: var(--aurora-green); }
.atom-eu { color: var(--aurora-rose); }
.atom-l { color: var(--aurora-violet); }

.hangul-atomic.decomposed .atom-h { transform: translate(-80px, -60px); }
.hangul-atomic.decomposed .atom-a { transform: translate(-20px, -80px); }
.hangul-atomic.decomposed .atom-n1 { transform: translate(-60px, 60px); }
.hangul-atomic.decomposed .atom-g { transform: translate(30px, -60px); }
.hangul-atomic.decomposed .atom-eu { transform: translate(80px, -30px); }
.hangul-atomic.decomposed .atom-l { transform: translate(60px, 60px); }

.entrance-subtitle {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--charcoal-ink);
    margin-top: 2rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.nature-frieze {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    overflow: hidden;
    opacity: 0.4;
    z-index: 1;
}

.frieze-svg {
    width: 100%;
    height: 100%;
}

/* --- Section 2: Specimen Hall --- */
.section-hall {
    padding: 0 clamp(1rem, 4vw, 3rem) 4rem;
}

.specimen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: clamp(16px, 2.5vw, 24px);
    max-width: 1200px;
    margin: 0 auto;
}

.specimen-card {
    perspective: 1000px;
    height: 320px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    animation: cardEntrance 0.6s var(--spring) forwards;
    animation-delay: calc(var(--i, 0) * 80ms);
    animation-play-state: paused;
}

.specimen-card.visible {
    animation-play-state: running;
}

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

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s var(--spring);
    transform-style: preserve-3d;
}

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

.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    border: 1px solid rgba(139, 149, 165, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.card-front {
    background: var(--specimen-white);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.specimen-card:hover .card-front {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(27, 122, 110, 0.1);
    border-top: 3px solid;
    border-image: linear-gradient(135deg, #1B7A6E, #7B5EA7) 1;
}

.card-back {
    background: var(--blush-glow);
    transform: rotateY(180deg);
    gap: 1rem;
}

.specimen-char {
    font-size: 5rem;
    font-weight: 300;
    color: var(--charcoal-ink);
    line-height: 1;
}

.specimen-roman {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--warm-gray);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.5rem;
}

.mini-diagram {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 1rem;
}

.mini-jamo {
    font-size: 1.2rem;
    color: var(--aurora-teal);
}

.mini-plus {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--warm-gray);
}

.back-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--slate);
    letter-spacing: 0.04em;
    text-align: center;
}

.back-nature {
    width: 60px;
    height: 60px;
}

/* --- Section 3: Timeline --- */
.section-timeline {
    padding: 0 clamp(1rem, 4vw, 3rem) 4rem;
    max-width: 800px;
    margin: 0 auto;
}

.timeline {
    position: relative;
    padding-left: 3rem;
}

.timeline-line {
    position: absolute;
    left: 0.75rem;
    top: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--aurora-teal), var(--aurora-violet), var(--aurora-rose));
    opacity: 0.3;
}

.milestone {
    position: relative;
    padding-bottom: 3rem;
}

.milestone::before {
    content: '';
    position: absolute;
    left: -2.4rem;
    top: 0.5rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--aurora-teal);
}

.milestone:nth-child(odd)::before { background: var(--aurora-violet); }
.milestone:nth-child(even)::before { background: var(--aurora-rose); }

.milestone-year {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: var(--aurora-teal);
    letter-spacing: 0.06em;
    display: block;
    margin-bottom: 0.25rem;
}

.milestone-content p {
    color: var(--warm-gray);
    font-size: 0.95rem;
}

/* --- Section 4: Garden --- */
.section-garden {
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    background: var(--night-sky);
}

.garden-composition {
    text-align: center;
}

.garden-svg {
    width: min(80vw, 600px);
    height: auto;
    margin-bottom: 2rem;
}

.garden-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--specimen-white);
    letter-spacing: 0.02em;
}

/* --- Footer --- */
.site-footer {
    background: var(--charcoal-ink);
    color: var(--warm-gray);
    text-align: center;
    padding: 3rem 2rem;
}

.footer-jamo {
    display: inline-block;
    font-size: 2rem;
    color: var(--aurora-green);
    animation: jamoSpin 8s linear infinite;
    margin-bottom: 1rem;
}

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

.footer-text {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.footer-sub {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--slate);
}

/* --- Reveal --- */
[data-reveal] {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease, transform 0.6s var(--spring);
}

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

/* --- 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;
        transform: none;
    }

    .specimen-card {
        opacity: 1;
        transform: none;
    }

    .aurora-bg {
        animation: none;
    }
}

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

    .specimen-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .hangul-atomic.decomposed .atom-h { transform: translate(-50px, -40px); }
    .hangul-atomic.decomposed .atom-a { transform: translate(-10px, -50px); }
    .hangul-atomic.decomposed .atom-n1 { transform: translate(-40px, 40px); }
    .hangul-atomic.decomposed .atom-g { transform: translate(20px, -40px); }
    .hangul-atomic.decomposed .atom-eu { transform: translate(50px, -20px); }
    .hangul-atomic.decomposed .atom-l { transform: translate(40px, 40px); }
}
