/* ================================================
   hangul.day - Design Language Stylesheet
   Skeuomorphic Korean Calligraphy + Aurora Gradient
   ================================================ */

/* === CSS Custom Properties === */
:root {
    --aurora-violet: #2d1b69;
    --aurora-teal: #0f9b8e;
    --aurora-rose: #c74b8e;
    --hanji-cream: #f4ece1;
    --woodblock-brown: #5c3a1e;
    --ink-black: #1a1712;
    --forsythia-gold: #e8b830;
    --petal-blush: #f0d4d8;
    --block-face: #d4a76a;
    --block-edge: #8b6536;
    --block-highlight: #c49a5c;

    --font-kr: 'Noto Serif KR', serif;
    --font-en: 'Fraunces', serif;
    --font-body: 'Nanum Gothic', sans-serif;
    --font-accent: 'Space Grotesk', sans-serif;
}

/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--ink-black);
    background: var(--aurora-violet);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* === Scroll Progress Indicator === */
.scroll-progress {
    position: fixed;
    left: 0;
    top: 0;
    width: 3px;
    height: 0%;
    background: var(--aurora-teal);
    z-index: 1000;
    transition: height 0.1s linear;
}

/* === Aurora Particles === */
.aurora-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.aurora-particle {
    position: absolute;
    border-radius: 50%;
    animation: particle-rise linear infinite;
    opacity: 0;
}

@keyframes particle-rise {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0.5);
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translateY(-10vh) scale(1);
    }
}

/* === Room Base Styles === */
.room {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.room-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.room-content {
    position: relative;
    z-index: 3;
    max-width: 720px;
    width: 90%;
    padding: 6rem 0;
}

/* === Background Types === */
.aurora-sky {
    background: linear-gradient(170deg, #2d1b69 0%, #0f9b8e 45%, #c74b8e 100%);
}

.aurora-teal {
    background: linear-gradient(170deg, #2d1b69 0%, #0f9b8e 60%, #2d1b69 100%);
}

.aurora-dawn {
    background: linear-gradient(170deg, #2d1b69 0%, #c74b8e 35%, #e8b830 70%, #f4ece1 100%);
}

.assembly-split {
    background: linear-gradient(90deg, #f4ece1 0%, #f4ece1 50%, #2d1b69 50%, #0f9b8e 100%);
    opacity: 0.15;
}

.hanji-bg {
    background-color: #f4ece1;
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(240,212,216,0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(240,212,216,0.2) 0%, transparent 50%);
}

/* === Ink Wash Accents === */
.ink-wash-accent {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(26,23,18,0.04) 0%, transparent 70%);
    top: 20%;
    left: 10%;
    z-index: 1;
    pointer-events: none;
}

.ink-wash-accent--offset {
    top: 40%;
    left: auto;
    right: 5%;
}

/* === Mountains === */
.mountains-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1;
}

.mountains-svg {
    width: 100%;
    height: auto;
    display: block;
}

.mountains-container--dawn {
    opacity: 0.5;
}

/* === Typography === */
.heading-kr {
    font-family: var(--font-kr);
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 5rem);
    letter-spacing: 0.02em;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.heading-en {
    font-family: var(--font-en);
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 4.2rem);
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-bottom: 2rem;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.2rem);
    line-height: 1.75;
    margin-bottom: 1.5rem;
    color: var(--woodblock-brown);
}

.body-text--light {
    color: var(--hanji-cream);
}

.body-text--farewell {
    color: var(--hanji-cream);
    opacity: 0.9;
}

.accent-label {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.accent-note {
    font-style: italic;
    opacity: 0.85;
    margin-top: 2rem;
}

/* === Room Transitions === */
.room {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.room--active {
    opacity: 1;
}

/* === Sticky Elements === */
.room-element--sticky {
    position: sticky;
    top: 20vh;
    z-index: 1;
}

/* === ROOM 1: The Invitation === */
.room-invitation {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.invitation-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.type-block--hero {
    width: clamp(200px, 40vw, 400px);
    aspect-ratio: 2/1;
    background: linear-gradient(145deg, #d4a76a 0%, #c49a5c 100%);
    border: 3px solid #8b6536;
    border-radius: 6px;
    box-shadow:
        0 2px 2px rgba(0,0,0,0.12),
        0 4px 8px rgba(0,0,0,0.10),
        0 8px 16px rgba(0,0,0,0.08),
        0 16px 32px rgba(0,0,0,0.06),
        inset 0 2px 0 rgba(255,255,255,0.15);
    display: grid;
    place-items: center;
    margin-bottom: 2rem;
    animation: float-gentle 6s ease-in-out infinite;
}

.type-block--hero .hangul-char {
    font-family: var(--font-kr);
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 10rem);
    color: var(--ink-black);
}

@keyframes float-gentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.invitation-text {
    font-family: var(--font-body);
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--hanji-cream);
    opacity: 0.9;
    max-width: 500px;
}

/* === ROOM 2: The Origin === */
.room-origin {
    min-height: 100vh;
    align-items: flex-start;
    padding-top: 10vh;
}

.origin-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.type-block--featured {
    width: clamp(100px, 15vw, 160px);
    aspect-ratio: 1;
    background: linear-gradient(145deg, #d4a76a 0%, #c49a5c 100%);
    border: 2px solid #8b6536;
    border-radius: 4px;
    box-shadow:
        0 1px 1px rgba(0,0,0,0.12),
        0 2px 4px rgba(0,0,0,0.08),
        0 4px 8px rgba(0,0,0,0.06),
        0 8px 16px rgba(0,0,0,0.04),
        inset 0 1px 0 rgba(255,255,255,0.15);
    display: grid;
    place-items: center;
    margin-bottom: 3rem;
    transition: transform 0.6s ease;
}

.type-block--featured .hangul-char {
    font-family: var(--font-kr);
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--ink-black);
}

.text-block {
    width: 100%;
}

.room-origin .heading-kr {
    color: var(--ink-black);
}

.room-origin .heading-en {
    color: var(--woodblock-brown);
}

/* === Botanical Positioning === */
.botanical {
    position: absolute;
    z-index: 2;
    pointer-events: none;
}

.forsythia-left {
    left: 2%;
    top: 30%;
    width: clamp(80px, 12vw, 160px);
}

.forsythia-right {
    right: 2%;
    top: 50%;
    width: clamp(80px, 12vw, 160px);
}

.cosmos-top-right {
    right: 5%;
    top: 10%;
    width: clamp(40px, 6vw, 80px);
}

.cosmos-mid-left {
    left: 3%;
    top: 50%;
    width: clamp(40px, 6vw, 70px);
}

.chrysanthemum-bottom {
    right: 10%;
    bottom: 8%;
    width: clamp(50px, 8vw, 100px);
}

.bellflower-left {
    left: 5%;
    top: 25%;
    width: clamp(30px, 5vw, 60px);
}

.bellflower-right {
    right: 8%;
    bottom: 20%;
    width: clamp(30px, 5vw, 60px);
}

.cosmos-living-1 {
    left: 5%;
    top: 15%;
    width: clamp(35px, 5vw, 65px);
    opacity: 0.7;
}

.cosmos-living-2 {
    right: 7%;
    bottom: 25%;
    width: clamp(35px, 5vw, 65px);
    opacity: 0.6;
}

/* === Flower Animations === */
.flower-sway {
    animation: sway 6s ease-in-out infinite;
}

.flower-breathe {
    animation: breathe 5s ease-in-out infinite;
}

@keyframes sway {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(5deg); }
}

@keyframes breathe {
    0%, 100% { transform: scale(0.97); opacity: 0.7; }
    50% { transform: scale(1.03); opacity: 1; }
}

/* === ROOM 3: The Consonants === */
.room-consonants {
    min-height: 200vh;
    align-items: flex-start;
    padding-top: 10vh;
}

.consonants-content {
    max-width: 900px;
}

.room-consonants .heading-kr {
    color: var(--ink-black);
}

.room-consonants .heading-en {
    color: var(--woodblock-brown);
}

.blocks-scatter {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(12px, 2vw, 24px);
    justify-content: center;
    padding: 3rem 0;
}

/* === Type Block (Wooden Block) === */
.type-block {
    width: clamp(80px, 12vw, 140px);
    aspect-ratio: 1;
    background: linear-gradient(145deg, #d4a76a 0%, #c49a5c 100%);
    border: 2px solid #8b6536;
    border-radius: 4px;
    box-shadow:
        0 1px 1px rgba(0,0,0,0.12),
        0 2px 4px rgba(0,0,0,0.08),
        0 4px 8px rgba(0,0,0,0.06),
        inset 0 1px 0 rgba(255,255,255,0.15);
    display: grid;
    place-items: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
    position: relative;
}

.type-block:hover {
    transform: translateY(-4px);
    box-shadow:
        0 2px 2px rgba(0,0,0,0.10),
        0 4px 8px rgba(0,0,0,0.10),
        0 8px 16px rgba(0,0,0,0.08);
}

.type-block .hangul-char {
    font-family: var(--font-kr);
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    color: var(--ink-black);
    transition: all 0.1s;
}

/* === Glitch Animation on Hover === */
@keyframes char-glitch {
    0%, 100% { transform: translate(0); text-shadow: none; }
    33% { transform: translate(2px, -1px); text-shadow: -2px 0 #c74b8e, 2px 0 #0f9b8e; }
    66% { transform: translate(-1px, 1px) skewX(3deg); opacity: 0.85; }
}

.type-block:hover .hangul-char,
.type-block:active .hangul-char {
    animation: char-glitch 0.3s steps(1) 1;
}

/* === Section Divider === */
.section-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem 0;
    background: var(--hanji-cream);
}

.divider-flower {
    width: clamp(60px, 10vw, 120px);
    height: auto;
    animation: breathe 5s ease-in-out infinite;
}

/* === ROOM 4: The Vowels === */
.room-vowels {
    min-height: 100vh;
}

.vowels-content {
    text-align: center;
}

.room-vowels .heading-kr {
    color: var(--hanji-cream);
}

.room-vowels .heading-en {
    color: var(--petal-blush);
}

.vowel-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(16px, 3vw, 32px);
    padding: 3rem 0;
}

.vowel-char {
    width: clamp(60px, 9vw, 100px);
    aspect-ratio: 0.7;
    display: grid;
    place-items: center;
    position: relative;
}

.ink-stroke {
    font-family: var(--font-kr);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--hanji-cream);
    text-shadow: 0 0 20px rgba(244,236,225,0.3);
    transition: text-shadow 0.3s ease;
}

.vowel-char:hover .ink-stroke {
    text-shadow: 0 0 30px rgba(244,236,225,0.6), 0 0 60px rgba(15,155,142,0.3);
}

.philosophy-note {
    font-style: italic;
    opacity: 0.8;
    margin-top: 2rem;
}

/* === ROOM 5: The Assembly === */
.room-assembly {
    min-height: 100vh;
    background: var(--hanji-cream);
}

.assembly-content {
    max-width: 900px;
}

.room-assembly .heading-kr {
    color: var(--ink-black);
}

.room-assembly .heading-en {
    color: var(--woodblock-brown);
}

.assembly-demo {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3rem;
    padding: 3rem 0;
}

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

.assembly-label {
    color: var(--woodblock-brown);
    font-size: 0.85rem;
    letter-spacing: 0.06em;
}

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

.assembly-piece {
    width: clamp(50px, 8vw, 70px);
    aspect-ratio: 1;
    background: linear-gradient(145deg, #d4a76a 0%, #c49a5c 100%);
    border: 2px solid #8b6536;
    border-radius: 4px;
    box-shadow:
        0 1px 1px rgba(0,0,0,0.12),
        0 2px 4px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.15);
    display: grid;
    place-items: center;
    font-family: var(--font-kr);
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--ink-black);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.assembly-piece.assembled {
    transform: scale(0);
    opacity: 0;
}

.assembly-result {
    font-family: var(--font-kr);
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--ink-black);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* === ROOM 6: The Living Script === */
.room-living {
    min-height: 100vh;
}

.living-content {
    text-align: center;
}

.room-living .heading-kr {
    color: var(--hanji-cream);
}

.room-living .heading-en {
    color: var(--petal-blush);
}

.modern-collage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 3rem 0;
    max-width: 600px;
    margin: 0 auto;
}

.collage-item {
    padding: 2rem 1.5rem;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-family: var(--font-kr);
    font-weight: 700;
    transition: transform 0.3s ease;
}

.collage-item:hover {
    transform: scale(1.05);
}

.neon-sign {
    background: rgba(199,75,142,0.2);
    border: 1px solid rgba(199,75,142,0.4);
    color: var(--aurora-rose);
    font-size: clamp(1.8rem, 4vw, 3rem);
    text-shadow: 0 0 20px rgba(199,75,142,0.5), 0 0 40px rgba(199,75,142,0.3);
}

.text-bubble {
    background: rgba(244,236,225,0.15);
    border: 1px solid rgba(244,236,225,0.3);
    color: var(--hanji-cream);
    font-size: clamp(1.2rem, 2.5vw, 2rem);
}

.kpop-lyric {
    background: rgba(232,184,48,0.15);
    border: 1px solid rgba(232,184,48,0.3);
    color: var(--forsythia-gold);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    text-shadow: 0 0 15px rgba(232,184,48,0.3);
}

.digital-type {
    background: rgba(15,155,142,0.2);
    border: 1px solid rgba(15,155,142,0.4);
    color: var(--aurora-teal);
    font-size: clamp(1.8rem, 4vw, 3rem);
    text-shadow: 0 0 20px rgba(15,155,142,0.4);
}

/* Glitch on collage items */
@keyframes collage-glitch {
    0%, 100% { transform: translate(0); filter: none; }
    25% { transform: translate(3px, -2px); filter: hue-rotate(90deg); }
    50% { transform: translate(-2px, 1px); filter: saturate(2); }
    75% { transform: translate(1px, 2px); filter: hue-rotate(-45deg); }
}

.collage-item:hover .scramble-text {
    animation: collage-glitch 0.4s steps(1) 1;
}

/* === ROOM 7: The Farewell === */
.room-farewell {
    min-height: 100vh;
    text-align: center;
}

.farewell-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.farewell-heading {
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--hanji-cream);
    margin-bottom: 1rem;
    text-shadow: 0 2px 40px rgba(0,0,0,0.3);
}

.farewell-subtitle {
    font-family: var(--font-en);
    font-weight: 800;
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--petal-blush);
    margin-bottom: 3rem;
    opacity: 0.9;
}

.farewell-domain {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hanji-cream);
    opacity: 0.6;
    margin-top: 4rem;
}

/* === Transition Glitch (between rooms) === */
@keyframes room-tear {
    0% { clip-path: inset(48% 0 48% 0); opacity: 1; }
    50% { clip-path: inset(30% 0 30% 0); opacity: 0.8; }
    100% { clip-path: inset(50% 0 50% 0); opacity: 0; }
}

.room-transition-glitch {
    position: fixed;
    inset: 0;
    background: linear-gradient(90deg, var(--aurora-teal), var(--aurora-rose));
    z-index: 100;
    pointer-events: none;
    animation: room-tear 0.2s linear forwards;
}

/* === Mobile Adaptation === */
@media (max-width: 768px) {
    .type-block {
        width: 60px;
    }

    .botanical {
        opacity: 0.5;
    }

    .room-content {
        width: 90%;
    }

    .blocks-scatter {
        gap: 10px;
    }

    .modern-collage {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .assembly-demo {
        flex-direction: column;
        align-items: center;
    }

    .type-block--hero {
        width: clamp(160px, 60vw, 300px);
    }

    .type-block--featured {
        width: 80px;
    }

    .assembly-piece {
        width: 45px;
    }

    .forsythia-left,
    .forsythia-right {
        opacity: 0.4;
    }
}

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