/* Color Palette from Design */
:root {
    --color-cream: #FAF6F0;
    --color-gold: #E8C87A;
    --color-walnut: #3D2B1F;
    --color-linen: #F0E8DA;
    --color-fawn: #C4693D;
    --color-forest: #6B8F5E;
    --color-clay: #6B4D30;
    --color-charcoal: #2C1E14;
    --color-walnut-heading: #4A3728;
    --color-warm-stone: #8B7355;
    --color-celadon: #9FBFAD;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-family: 'Source Serif 4', serif;
}

body {
    background-color: var(--color-cream);
    color: var(--color-walnut);
    overflow-x: hidden;
    font-family: 'Source Serif 4', serif;
}

/* Typography */
h1 {
    font-family: 'Zilla Slab', serif;
    font-weight: 600;
    font-size: clamp(2.4rem, 6vw, 4.8rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--color-walnut-heading);
    margin-bottom: 1rem;
}

h2 {
    font-family: 'Bitter', serif;
    font-weight: 500;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--color-walnut-heading);
    margin-bottom: 1.5rem;
    margin-top: 0;
}

p {
    font-family: 'Source Serif 4', serif;
    font-size: clamp(1rem, 2vw, 1.1rem);
    line-height: 1.72;
    margin-bottom: 1.5rem;
    color: var(--color-walnut);
    letter-spacing: 0.005em;
}

.subtitle {
    font-family: 'IBM Plex Serif', serif;
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    font-weight: 500;
    line-height: 1.6;
    color: var(--color-fawn);
    margin-bottom: 3rem;
}

.chapter-text {
    max-width: 65ch;
    color: var(--color-walnut);
    opacity: 0.95;
}

/* Sections / Chapters */
.chapter {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 4rem 2rem;
    background-color: var(--color-cream);
}

.chapter-0 {
    background: linear-gradient(135deg, var(--color-cream) 0%, var(--color-linen) 100%);
}

.chapter-1 {
    background-color: var(--color-cream);
}

.chapter-2 {
    background: linear-gradient(135deg, var(--color-linen) 0%, var(--color-cream) 100%);
}

.chapter-3 {
    background-color: var(--color-cream);
}

.chapter-4 {
    background: linear-gradient(135deg, var(--color-cream) 0%, var(--color-linen) 100%);
}

.chapter-5 {
    background-color: var(--color-cream);
}

.chapter-6 {
    background: linear-gradient(135deg, var(--color-linen) 0%, var(--color-cream) 100%);
}

.chapter-7 {
    background-color: var(--color-cream);
}

.chapter-8 {
    background: linear-gradient(135deg, var(--color-cream) 0%, var(--color-linen) 100%);
}

.chapter-content {
    position: relative;
    z-index: 10;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.chapter-0 .chapter-content {
    text-align: center;
}

.chapter-1 .chapter-content,
.chapter-2 .chapter-content,
.chapter-3 .chapter-content,
.chapter-4 .chapter-content,
.chapter-5 .chapter-content,
.chapter-6 .chapter-content,
.chapter-7 .chapter-content {
    text-align: left;
}

/* Main Title */
.title-main {
    font-size: clamp(4rem, 12vw, 8rem);
    color: var(--color-gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
}

/* Scroll Indicator */
.scroll-indicator {
    font-size: 2rem;
    color: var(--color-gold);
    animation: bounce 2s infinite;
    margin-top: 4rem;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(1rem);
    }
}

/* Letterform Showcase */
.letterform-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    margin-bottom: 3rem;
}

.letterform {
    background: rgba(232, 200, 122, 0.1);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
}

.letterform:hover {
    background: rgba(232, 200, 122, 0.2);
    transform: translateY(-4px);
}

.hangul-char {
    font-size: 4.8rem;
    color: var(--color-fawn);
    margin-bottom: 1rem;
    font-weight: 700;
    font-family: 'Noto Serif KR', serif;
}

.hangul-description {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--color-warm-stone);
    font-weight: 300;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Word Cluster */
.word-cluster {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    margin-bottom: 3rem;
}

.cluster-word {
    text-align: center;
    padding: 2rem 1rem;
    background: rgba(107, 143, 94, 0.08);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.cluster-word:hover {
    background: rgba(107, 143, 94, 0.15);
    transform: scale(1.05);
}

.hangul-demo {
    display: block;
    font-size: 3.6rem;
    color: var(--color-forest);
    margin-bottom: 1rem;
    font-weight: 700;
    font-family: 'Noto Serif KR', serif;
}

.cluster-word p {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.95rem;
    margin-bottom: 0;
    color: var(--color-warm-stone);
    font-weight: 400;
}

/* Coda Section */
.coda {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.coda-text {
    font-size: clamp(1.3rem, 2.5vw, 1.6rem);
    font-weight: 500;
    line-height: 1.8;
    color: var(--color-walnut);
    margin-bottom: 2rem;
}

.coda-credit {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--color-warm-stone);
    font-style: italic;
    margin-bottom: 0;
    font-weight: 300;
}

/* Particle System / Decorative Bubbles */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.decorative-bubbles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 5;
}

.bubble {
    position: absolute;
    background: radial-gradient(ellipse at 35% 35%, rgba(159, 191, 173, 0.25), rgba(107, 143, 94, 0.08), transparent 70%);
    border-radius: 47% 53% 51% 49% / 52% 48% 53% 47%;
    animation: float-bubble linear infinite;
    opacity: 0.6;
    backdrop-filter: blur(1px);
}

@keyframes float-bubble {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.6;
    }
    50% {
        opacity: 0.4;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0.8);
        opacity: 0.1;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Content fade-in on scroll */
.chapter-content {
    animation: fade-in 1s ease-out;
}

/* Parallax effect */
.chapter {
    position: relative;
    background-attachment: fixed;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chapter {
        padding: 2rem 1rem;
    }

    .letterform-showcase {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .word-cluster {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .hangul-char {
        font-size: 2.5rem;
    }

    .hangul-demo {
        font-size: 2rem;
    }

    .chapter-0 .chapter-content {
        padding: 0 1rem;
    }

    .chapter-1 .chapter-content,
    .chapter-2 .chapter-content,
    .chapter-3 .chapter-content,
    .chapter-4 .chapter-content,
    .chapter-5 .chapter-content,
    .chapter-6 .chapter-content,
    .chapter-7 .chapter-content {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    p {
        font-size: 0.95rem;
    }

    .title-main {
        font-size: 3rem;
    }

    .letterform-showcase {
        grid-template-columns: 1fr;
    }

    .word-cluster {
        grid-template-columns: 1fr;
    }

    .hangul-char {
        font-size: 2rem;
    }

    .hangul-demo {
        font-size: 1.5rem;
    }
}

/* Smooth Transitions */
.letterform,
.cluster-word {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Link Styles (if needed in future) */
a {
    color: var(--color-fawn);
    text-decoration: none;
    border-bottom: 2px solid var(--color-gold);
    transition: all 0.3s ease;
}

a:hover {
    color: var(--color-walnut);
    border-bottom-color: var(--color-fawn);
}
