/* hangul.dev - Calligraphic Computational Typography */

:root {
    --ink-black: #0A0A0F;
    --deep-dark: #12141A;
    --slate-dark: #2A2A30;
    --stone: #5A5A50;
    --muted-stone: #8A8A7A;
    --warm-sand: #C8B89A;
    --hanji: #E8E0D4;
    --paper: #F8F4EC;
    --vermillion: #D44A1A;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background: var(--deep-dark);
    color: var(--hanji);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    overflow-x: hidden;
}

::selection { background: var(--vermillion); color: var(--paper); }

.section-dark { background: var(--deep-dark); color: var(--hanji); }
.section-light { background: var(--paper); color: var(--slate-dark); }

/* === Scroll to Top === */
.hex-top-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    width: 40px;
    height: 40px;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 18px;
    color: var(--warm-sand);
    background: var(--deep-dark);
    border: 1.5px solid var(--warm-sand);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s, background 0.2s;
}

.hex-top-btn.visible { opacity: 0.7; }
.hex-top-btn:hover { background: var(--slate-dark); opacity: 1; }

/* === Hero Section === */
.hero-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.hero-assembly {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    position: relative;
    min-height: 200px;
}

.jamo-float {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--warm-sand);
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.jamo-float.visible { opacity: 1; }

.jamo-float.assembling {
    position: absolute;
    opacity: 0;
}

.assembled-result {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: clamp(5rem, 14vw, 12rem);
    color: var(--hanji);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

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

.hero-decomp {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: var(--muted-stone);
    letter-spacing: 0.04em;
    min-height: 20px;
}

.hero-domain {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: var(--warm-sand);
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 1s ease;
}

.hero-domain.visible { opacity: 0.6; }

/* === Honeycomb Section === */
.honeycomb-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
    padding: 80px 20px 40px;
}

.hex-cell {
    width: 72px;
    height: 84px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--warm-sand);
    border-radius: 4px;
    gap: 4px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.2s, background 0.2s;
}

.hex-cell.visible {
    opacity: 1;
    transform: scale(1);
}

.hex-cell:hover { border-color: var(--vermillion); background: rgba(212, 74, 26, 0.06); }

.hex-cell.consonant { border-color: var(--warm-sand); }
.hex-cell.vowel { border-color: var(--vermillion); }

.hex-jamo {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: 24px;
    color: var(--slate-dark);
}

.hex-ipa {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--stone);
}

.honeycomb-note {
    text-align: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    color: var(--stone);
    padding: 20px 20px 80px;
    letter-spacing: 0.02em;
}

/* === Cosmology Section === */
.cosmology-section {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.cosmo-container {
    display: flex;
    gap: 80px;
    max-width: 900px;
}

.cosmo-item {
    text-align: center;
    flex: 1;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.cosmo-symbol {
    font-family: 'Noto Serif KR', serif;
    font-weight: 400;
    font-size: clamp(3rem, 6vw, 5rem);
    color: var(--hanji);
    display: block;
    margin-bottom: 16px;
}

.cosmo-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-sand);
    display: block;
    margin-bottom: 12px;
}

.cosmo-desc {
    font-size: 14px;
    color: var(--muted-stone);
    line-height: 1.6;
}

/* === Composition Section === */
.composition-section { padding: 80px 20px; }

.comp-content { max-width: 800px; margin: 0 auto; }

.comp-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--stone);
    margin-bottom: 32px;
}

.formula-display {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    color: var(--slate-dark);
    margin-bottom: 24px;
    padding: 20px;
    background: var(--hanji);
    border-left: 3px solid var(--warm-sand);
}

.f-lead { color: var(--vermillion); }
.f-vowel { color: #2A7B6F; }
.f-trail { color: #2A5B8A; }
.f-normal { color: var(--slate-dark); }

.comp-example {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: var(--stone);
    margin-bottom: 32px;
    line-height: 2;
}

.comp-result {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: 2rem;
    color: var(--vermillion);
    vertical-align: middle;
}

.code-card {
    background: var(--hanji);
    border: 1px solid var(--warm-sand);
    padding: 24px;
    overflow-x: auto;
}

.code-card pre {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--slate-dark);
}

.kw { color: var(--vermillion); }
.num { color: #2A5B8A; }
.op { color: var(--stone); }

/* === Specimen Section === */
.specimen-section { padding: 80px 20px; }

.specimen-header {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    text-align: center;
    color: var(--warm-sand);
    margin-bottom: 40px;
    letter-spacing: 0.1em;
}

.specimen-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 4px;
    max-width: 800px;
    margin: 0 auto;
}

.specimen-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 20px;
    color: var(--hanji);
    background: var(--slate-dark);
    cursor: default;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.specimen-cell:hover {
    background: var(--vermillion);
    color: var(--paper);
    transform: scale(1.1);
}

/* === Seal Section === */
.seal-section {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.seal-svg { margin-bottom: 24px; }

.seal-char {
    font-family: 'Noto Serif KR', serif;
    font-weight: 700;
    font-size: 80px;
    fill: var(--warm-sand);
}

.seal-domain {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    letter-spacing: 0.1em;
    color: var(--muted-stone);
    margin-bottom: 20px;
}

.seal-rule {
    width: 60px;
    height: 1px;
    background: var(--warm-sand);
    opacity: 0.3;
}

/* === Responsive === */
@media (max-width: 768px) {
    .cosmo-container { flex-direction: column; gap: 40px; }
    .hex-cell { width: 60px; height: 72px; }
    .hero-assembly { gap: 20px; }
}
