/* ==========================================================
   hangeul.day — Kinetic Typography Cultural Exhibition
   ========================================================== */

/* --- Palette ---
   Museum white:      #f9f7f4
   Deep ink:          #1a1612
   Royal indigo:      #3c2b6b
   Hanji amber:       #c89b3c
   Scholar gray:      #6b6560
   Celadon green:     #5a9e7c
   Soft gold:         #d4b06a
   Ink wash gray:     #b5afa6
*/

/* --- 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: #f9f7f4;
    color: #1a1612;
    font-family: 'Noto Sans KR', 'Pretendard', sans-serif;
    font-weight: 300;
    line-height: 1.6;
    letter-spacing: 0.02em;
    overflow-x: hidden;
}

/* --- Hanji Paper Texture Overlay --- */
#paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Typography Classes --- */
.hangul-display {
    font-family: 'Noto Serif KR', serif;
    font-weight: 900;
}

.label-text {
    font-family: 'Noto Sans KR', 'Pretendard', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    line-height: 1.6;
    letter-spacing: 0.05em;
    color: #6b6560;
}

.mono-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: #6b6560;
}

.label-english {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #6b6560;
}

/* --- Scholarly Bracket Motifs --- */
.bracket-left,
.bracket-right {
    color: #c89b3c;
    font-weight: 300;
    margin: 0 0.15em;
}

/* --- Exhibition Sections --- */
.exhibition-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 4rem 2rem;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-family: 'Noto Serif KR', serif;
    font-weight: 900;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: #1a1612;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1rem;
    color: #6b6560;
    letter-spacing: 0.08em;
}

/* --- Section Dividers --- */
.exhibition-section + .exhibition-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    background-color: #b5afa6;
}

/* ============================
   SECTION 1: THE LETTER (HERO)
   ============================ */

#hero {
    background-color: #f9f7f4;
    padding: 0;
    justify-content: center;
    overflow: hidden;
}

.hero-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

#hero-svg-container {
    position: relative;
    width: clamp(280px, 60vw, 500px);
    height: clamp(280px, 60vw, 500px);
}

#hero-svg {
    width: 100%;
    height: 100%;
}

#hero-svg path {
    fill: none;
    stroke: #1a1612;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#hero-annotation {
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#hero-annotation.visible {
    opacity: 1;
}

#hero-meta {
    display: flex;
    gap: 2rem;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#hero-meta.visible {
    opacity: 1;
}

#scroll-hint {
    position: absolute;
    bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #b5afa6;
    animation: scrollBounce 2s ease-in-out infinite;
}

.scroll-hint-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

.scroll-arrow {
    color: #b5afa6;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ====================================
   SECTION 2: THE CONSTRUCTION EXHIBIT
   ==================================== */

#construction {
    background-color: #f9f7f4;
}

#assembly-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

#assembly-container {
    position: relative;
    width: 200px;
    height: 200px;
    border: 1px solid #b5afa6;
    border-radius: 4px;
    background-color: rgba(249, 247, 244, 0.8);
}

.jamo-piece {
    position: absolute;
    font-family: 'Noto Serif KR', serif;
    font-weight: 900;
    font-size: 3rem;
    color: #1a1612;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
}

.jamo-piece[data-role="choseong"] {
    top: 10px;
    left: 30px;
    transform: translateY(-100px);
}

.jamo-piece[data-role="jungseong"] {
    top: 10px;
    right: 20px;
    transform: translateX(100px);
}

.jamo-piece[data-role="jongseong"] {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
}

.jamo-piece.assembled {
    opacity: 1;
    transform: translate(0, 0) !important;
}

.jamo-piece[data-role="jongseong"].assembled {
    transform: translateX(-50%) translateY(0) !important;
}

#assembly-arrow {
    opacity: 0;
    transition: opacity 0.5s ease 1.8s;
}

#assembly-arrow.visible {
    opacity: 1;
}

#assembled-result {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#assembled-result.visible {
    opacity: 1;
    transform: scale(1);
}

#assembled-char {
    font-family: 'Noto Serif KR', serif;
    font-weight: 900;
    font-size: clamp(4rem, 10vw, 6rem);
    color: #3c2b6b;
    position: relative;
    z-index: 2;
}

#ink-splash {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 155, 60, 0.15) 0%, transparent 70%);
    transition: all 0.8s ease;
    z-index: 1;
}

#ink-splash.pulse {
    width: 160px;
    height: 160px;
}

#assembly-labels {
    display: flex;
    gap: 3rem;
    margin-bottom: 2rem;
}

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

#assembly-examples {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.example-btn {
    font-family: 'Noto Serif KR', serif;
    font-weight: 900;
    font-size: 1.5rem;
    width: 56px;
    height: 56px;
    border: 1px solid #b5afa6;
    border-radius: 4px;
    background: transparent;
    color: #1a1612;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-btn:hover {
    border-color: #c89b3c;
    color: #3c2b6b;
    background-color: rgba(200, 155, 60, 0.08);
}

.example-btn.active {
    border-color: #3c2b6b;
    color: #3c2b6b;
    background-color: rgba(60, 43, 107, 0.06);
}

/* ==================================
   SECTION 3: THE COMPARISON GALLERY
   ================================== */

#comparison {
    background-color: #f9f7f4;
}

#comparison-panels {
    display: flex;
    width: 100%;
    max-width: 1000px;
    gap: 0;
    align-items: stretch;
}

.comparison-panel {
    flex: 1;
    padding: 2rem;
}

.comparison-divider {
    width: 1px;
    background-color: #b5afa6;
    align-self: stretch;
    margin: 0 1rem;
}

.panel-label {
    font-family: 'Noto Serif KR', serif;
    font-weight: 900;
    font-size: 1.2rem;
    color: #3c2b6b;
    text-align: center;
    margin-bottom: 2rem;
}

.panel-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.comparison-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.comparison-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.comparison-char {
    font-family: 'Noto Serif KR', serif;
    font-weight: 900;
    font-size: 2.5rem;
    line-height: 1;
    color: #1a1612;
    min-width: 3rem;
    text-align: center;
    flex-shrink: 0;
}

.panel-other .comparison-char {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 400;
    font-size: 2.5rem;
}

.comparison-note {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #6b6560;
}

.comparison-note em {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: #b5afa6;
}

.panel-description {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #6b6560;
    border-top: 1px solid #b5afa6;
    padding-top: 1rem;
}

.panel-description em {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-style: italic;
    color: #b5afa6;
}

/* =============================
   SECTION 4: THE LIVING TEXT
   ============================= */

#living-text {
    background-color: #1a1612;
    padding: 4rem 0;
}

#living-text .section-header {
    padding: 0 2rem;
}

#living-text .section-title {
    color: #f9f7f4;
}

#living-text .section-subtitle {
    color: #b5afa6;
}

#living-text .bracket-left,
#living-text .bracket-right {
    color: #c89b3c;
}

#poem-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3rem 2rem;
    cursor: grab;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#poem-container::-webkit-scrollbar {
    display: none;
}

#poem-container:active {
    cursor: grabbing;
}

#poem-scroll {
    display: inline-flex;
    white-space: nowrap;
    padding: 0 40vw;
}

.poem-char {
    font-family: 'Noto Serif KR', serif;
    font-weight: 900;
    font-size: clamp(4rem, 10vw, 8rem);
    color: #6b6560;
    transition: color 0.4s ease, transform 0.4s ease;
    display: inline-block;
    padding: 0 0.05em;
}

.poem-char.highlight {
    color: #f9f7f4;
    transform: scale(1.05);
    text-shadow: 0 0 40px rgba(200, 155, 60, 0.3);
}

.poem-space {
    display: inline-block;
    width: 1.5em;
}

#poem-translation {
    text-align: center;
    padding: 2rem;
    max-width: 600px;
}

.translation-text {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #b5afa6;
    margin-bottom: 1rem;
}

.translation-source {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: #6b6560;
    letter-spacing: 0.05em;
}

/* =============================
   FOOTER
   ============================= */

#footer {
    background-color: #f9f7f4;
    padding: 3rem 2rem;
    text-align: center;
    border-top: 1px solid #b5afa6;
}

.footer-text {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    color: #1a1612;
    margin-bottom: 0.5rem;
}

.footer-date {
    color: #6b6560;
}

/* =============================
   RESPONSIVE
   ============================= */

@media (max-width: 768px) {
    #comparison-panels {
        flex-direction: column;
    }

    .comparison-divider {
        width: 60px;
        height: 1px;
        align-self: center;
        margin: 1rem 0;
    }

    #assembly-stage {
        flex-direction: column;
    }

    #assembly-arrow {
        transform: rotate(90deg);
    }

    #assembly-labels {
        gap: 1.5rem;
    }

    .exhibition-section {
        padding: 3rem 1.5rem;
    }
}

/* =============================
   ANIMATIONS
   ============================= */

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

@keyframes inkSpread {
    0% {
        width: 0;
        height: 0;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        width: 160px;
        height: 160px;
        opacity: 0.6;
    }
}
