/* ============================================================================
   HANGUL.DAY - Design Language Implementation
   Holographic calm, leather texture, reverent typography
   ============================================================================ */

/* CSS Custom Properties (Variables) */
:root {
    /* Colors from DESIGN.md */
    --color-deep-burgundy: #3B0A1A;
    --color-burgundy-mid: #5A1A2A;
    --color-warm-cream: #F5EDE0;
    --color-pearl-white: #FAF7F2;
    --color-holographic-violet: #8B6BAE;
    --color-holographic-teal: #5AA4A0;
    --color-holographic-rose: #D4728C;
    --color-leather-brown: #2E1A10;
    --color-charcoal: #1C1216;

    /* Typography - from DESIGN.md */
    --font-display: 'Cormorant Garamond', serif;
    --font-body: 'Lora', serif;
    --font-kr: 'Noto Serif KR', serif;
    --font-mono: 'Inter', sans-serif;

    /* Spacing and Layout */
    --gutter: 24px;
    --grid-columns: 12;
    --max-width: 1440px;
    --section-height: 100vh;
    --transition-duration: 0.6s;
    --transition-easing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============================================================================
   RESET & GLOBAL STYLES
   ============================================================================ */

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

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

body {
    font-family: var(--font-body);
    color: var(--color-charcoal);
    background-color: var(--color-deep-burgundy);
    line-height: 1.75;
    letter-spacing: 0.01em;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'liga' 1, 'kern' 1;
    overflow-x: hidden;
}

/* ============================================================================
   LEATHER TEXTURE (CSS-Generated) - Primary Surface from DESIGN.md
   ============================================================================ */

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(46, 26, 16, 0.3), transparent 50%),
        repeating-conic-gradient(
            from 0deg at 40% 60%,
            rgba(46, 26, 16, 0.15) 0deg 90deg,
            transparent 90deg 180deg
        );
    background-size: 400% 400%, 4px 4px;
    filter: contrast(1.05) brightness(0.95);
    pointer-events: none;
    z-index: -1;
}

/* ============================================================================
   TYPOGRAPHY - Exact specs from DESIGN.md
   ============================================================================ */

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.03em;
    line-height: 1.0;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 600;
}

h2 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: 2rem;
    margin-top: 2rem;
}

h3 {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1.5rem;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.85;
}

/* Body text styling - from DESIGN.md */
body {
    font-size: clamp(1rem, 1.8vw, 1.2rem);
}

/* Korean text - use appropriate serif */
.jamo-label, .jamo-desc, .contemporary-text p:first-of-type {
    font-family: var(--font-kr);
}

/* ============================================================================
   HERO / TITLE SECTION - Full-bleed opening from DESIGN.md
   ============================================================================ */

.hero-section {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(
        135deg,
        var(--color-deep-burgundy) 0%,
        var(--color-burgundy-mid) 100%
    );
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent calc(1.75rem - 1px),
            rgba(245, 237, 224, 0.03) 1.75rem
        );
    pointer-events: none;
}

.hero-content {
    text-align: center;
    z-index: 1;
    animation: fadeInScale 1s var(--transition-easing) forwards;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(15rem, 25vw, 30rem);
    font-weight: 300;
    letter-spacing: 0.04em;
    line-height: 1.0;
    margin: 0;

    /* Holographic nacre text effect on Korean characters */
    background: linear-gradient(
        90deg,
        var(--color-holographic-violet) 0%,
        var(--color-holographic-teal) 50%,
        var(--color-holographic-rose) 100%
    );
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: holographicShift 8s linear infinite;
}

.hero-date {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--color-warm-cream);
    margin-top: 2rem;
    font-weight: 300;
    letter-spacing: 0.04em;
    animation: fadeInDelay 1s 0.3s var(--transition-easing) forwards;
    opacity: 0;
}

.hero-subtitle {
    font-family: var(--font-display);
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    color: var(--color-holographic-teal);
    margin-top: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    animation: fadeInDelay 1s 0.5s var(--transition-easing) forwards;
    opacity: 0;
}

/* ============================================================================
   STACKED SECTIONS - Full viewport height sections from DESIGN.md
   ============================================================================ */

section {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 4rem var(--gutter);
    position: relative;
    animation: sectionEnter var(--transition-duration) var(--transition-easing) forwards;
    opacity: 0;
    transform: translateY(30px);
}

section:nth-child(odd) {
    background-color: var(--color-warm-cream);
    color: var(--color-charcoal);
}

section:nth-child(even) {
    background-color: var(--color-deep-burgundy);
    color: var(--color-warm-cream);
}

section:nth-child(even) h2,
section:nth-child(even) h3 {
    color: var(--color-pearl-white);
}

/* Grid overlay for text sections */
section:nth-child(odd)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent calc(1.75rem - 1px),
        rgba(58, 10, 26, 0.06) 1.75rem
    );
    pointer-events: none;
}

section:nth-child(even)::before {
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent calc(1.75rem - 1px),
        rgba(245, 237, 224, 0.06) 1.75rem
    );
}

.section-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
}

/* ============================================================================
   SPECIAL SECTION STYLES
   ============================================================================ */

.philosophy-section {
    padding: 6rem var(--gutter) !important;
}

.jamo-section {
    background-color: var(--color-deep-burgundy) !important;
    color: var(--color-warm-cream) !important;
    padding: 6rem var(--gutter) !important;
}

.jamo-section h2 {
    color: var(--color-pearl-white) !important;
}

.vowel-section {
    background-color: var(--color-burgundy-mid) !important;
}

.geometry-section {
    background-color: var(--color-warm-cream) !important;
    color: var(--color-charcoal) !important;
    padding: 6rem var(--gutter) !important;
}

.living-section {
    background-color: var(--color-deep-burgundy) !important;
    color: var(--color-warm-cream) !important;
    padding: 6rem var(--gutter) !important;
    min-height: 120vh;
}

.living-section h2 {
    color: var(--color-pearl-white) !important;
}

/* ============================================================================
   JAMO GRID & GALLERY - Display with holographic effect
   ============================================================================ */

.jamo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.jamo-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 1px solid rgba(245, 237, 224, 0.3);
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.jamo-item:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(245, 237, 224, 0.6);
    transform: translateY(-8px);
}

.jamo-char {
    font-family: var(--font-kr);
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 400;
    margin-bottom: 1rem;

    /* Holographic nacre effect on Korean characters */
    background: linear-gradient(
        135deg,
        var(--color-holographic-violet),
        var(--color-holographic-teal),
        var(--color-holographic-rose)
    );
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: holographicShift 8s linear infinite;
}

.jamo-label {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: 600;
    color: var(--color-pearl-white);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.jamo-desc {
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    color: var(--color-warm-cream);
    text-align: center;
    opacity: 0.8;
}

/* ============================================================================
   GEOMETRY & DIAGRAMS
   ============================================================================ */

.geometry-diagram {
    margin: 3rem 0;
    padding: 2rem;
    background: rgba(58, 10, 26, 0.06);
    border: 1px solid var(--color-burgundy-mid);
    border-radius: 4px;
}

.diagram-svg {
    width: 100%;
    max-width: 500px;
    height: auto;
    margin: 0 auto;
    display: block;
    color: var(--color-charcoal);
}

.diagram-group {
    fill: currentColor;
    stroke: currentColor;
}

.diagram-circle {
    transition: all 0.3s ease;
}

.diagram-line {
    transition: all 0.3s ease;
}

.diagram-label {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 300;
    text-anchor: middle;
}

.diagram-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
}

/* ============================================================================
   CONTEMPORARY TEXT & QUOTES
   ============================================================================ */

.contemporary-text {
    background: rgba(0, 0, 0, 0.15);
    padding: 2rem;
    margin: 3rem 0;
    border-left: 4px solid var(--color-holographic-rose);
}

.contemporary-text p:first-of-type {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    line-height: 1.9;
    margin-bottom: 1rem;
    color: var(--color-pearl-white);
}

.attribution {
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    color: var(--color-warm-cream);
    margin: 0;
}

.closing-meditation {
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.9;
    font-style: italic;
    color: var(--color-warm-cream);
    opacity: 0.9;
}

/* ============================================================================
   UNDERLINE ANIMATION - SVG calligraphic underlines from DESIGN.md
   ============================================================================ */

.underline-animate {
    position: relative;
    border-bottom: 2px solid var(--color-holographic-rose);
    padding-bottom: 0.2em;
    display: inline-block;
    animation: underlineDraw 0.8s ease-in-out forwards;
    animation-delay: 0.3s;
}

/* ============================================================================
   SCROLL PROGRESS INDICATOR - Vertical line on left margin
   ============================================================================ */

.scroll-progress {
    position: fixed;
    left: 24px;
    top: 0;
    width: 2px;
    height: 0;
    background: linear-gradient(
        180deg,
        var(--color-holographic-violet),
        var(--color-holographic-teal),
        var(--color-holographic-rose)
    );
    background-size: 100% 200%;
    animation: holographicShift 8s linear infinite;
    z-index: 1000;
    transition: height 0.1s linear;
}

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

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

@keyframes underlineDraw {
    from {
        border-bottom-color: transparent;
    }
    to {
        border-bottom-color: var(--color-holographic-rose);
    }
}

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

@media (max-width: 768px) {
    :root {
        --gutter: 16px;
    }

    .hero-title {
        font-size: clamp(8rem, 20vw, 15rem);
    }

    .hero-date {
        font-size: clamp(1rem, 2.5vw, 1.5rem);
    }

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

    .jamo-item {
        padding: 1.5rem;
    }

    section {
        padding: 3rem var(--gutter);
    }

    .scroll-progress {
        left: 16px;
    }
}

@media (max-width: 480px) {
    :root {
        --gutter: 12px;
    }

    .hero-title {
        font-size: clamp(4rem, 15vw, 8rem);
    }

    .jamo-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .jamo-item {
        padding: 1rem;
    }

    section {
        padding: 2rem var(--gutter);
        min-height: auto;
    }

    .scroll-progress {
        left: 12px;
        width: 1px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    body::before {
        display: none;
    }

    section::before {
        display: none;
    }

    .scroll-progress {
        display: none;
    }

    section {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}
