/* ============================================================
   HANGUL.DEV - SEAPUNK KOREAN TYPOGRAPHY ARCHITECTURE
   Navy-Metallic-Teal Palette | Bento Grid | Ripple Interactions
   IBM Plex Mono only for code annotations (Google Fonts)
   Ripple Interaction Pattern:** and Hangul Character Interactions:**
   Pattern: ripple; Interactions: scroll-responsive glyphs
   Pattern* Interactions*
   ============================================================ */

/* ============================================================
   1. RESET & BASE STYLES
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #0A1628;
    color: #B8C9D9;
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

/* ============================================================
   2. COLOR PALETTE VARIABLES
   ============================================================ */

:root {
    --deep-bg: #0A1628;           /* Abyssal Navy */
    --cell-bg: #0F2138;            /* Midnight Slate */
    --primary-accent: #4FD1C5;     /* Phosphor Teal */
    --secondary-accent: #B8C9D9;   /* Metallic Silver */
    --tertiary-accent: #38B2AC;    /* Iridescent Aqua */
    --warm-highlight: #FF6B8A;     /* Coral Glow */
    --surface-shimmer: #E2EDF5;    /* Pearl Frost */
    --deep-cerulean: #1A4A6B;      /* Deep Cerulean */
    --mono-color: #7B9CB8;         /* Muted Steel Blue */

    --grid-gap: clamp(6px, 1.2vw, 14px);
    --border-radius: 6px;
    --cell-shadow: 0 2px 16px rgba(8, 22, 48, 0.35);
}

/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */

h1, h2, h3 {
    color: var(--surface-shimmer);
    letter-spacing: -0.02em;
    line-height: 1.05;
    font-family: 'Commissioner', sans-serif;
}

.heading-display {
    font-size: clamp(2.2rem, 5.5vw, 5rem);
    font-weight: 600;
    line-height: 1.05;
}

.heading-secondary {
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    font-weight: 600;
    color: var(--surface-shimmer);
}

.heading-tertiary {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: 600;
    color: var(--primary-accent);
}

.text-body {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.7;
    color: var(--secondary-accent);
}

.text-lead {
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    font-weight: 400;
    line-height: 1.6;
    color: var(--secondary-accent);
}

.text-accent {
    font-size: clamp(0.95rem, 1.3vw, 1.1rem);
    font-weight: 500;
    color: var(--primary-accent);
    transition: color 300ms ease;
}

.text-accent:hover {
    color: var(--tertiary-accent);
    font-weight: 500;
}

.text-label {
    font-size: clamp(0.75rem, 1vw, 0.95rem);
    font-weight: 700;
    color: var(--primary-accent);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.text-annotation {
    font-size: 0.8rem;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--mono-color);
    letter-spacing: 0.08em;
    margin-top: 0.5rem;
}

.text-small {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--secondary-accent);
    opacity: 0.85;
}

.text-tiny {
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--secondary-accent);
    opacity: 0.75;
}

code {
    font-family: 'IBM Plex Mono', monospace;
    background-color: rgba(79, 209, 197, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    color: var(--primary-accent);
}

/* ============================================================
   4. BACKGROUND & AMBIENT ELEMENTS
   ============================================================ */

.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

/* Marble texture - CSS-generated ocean floor */
.background-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(79, 209, 197, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(56, 178, 172, 0.06) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 80%, rgba(26, 74, 107, 0.12) 0%, transparent 55%),
        linear-gradient(135deg, #0F2138 0%, #0A1628 40%, #0F2138 70%, #0A1628 100%);
    background-size: 200% 200%, 180% 180%, 160% 160%, 100% 100%;
    background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%;
    filter: contrast(1.1) saturate(0.9);
    mix-blend-mode: overlay;
    animation: marble-drift 40s linear infinite;
}

@keyframes marble-drift {
    0% {
        background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%;
    }
    100% {
        background-position: 100% 100%, 100% 100%, 100% 100%, 0% 0%;
    }
}

/* Canvas for bubble particles */
#particleCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Tidal current SVG paths */
.tidal-currents {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.15;
}

.tidal-currents path {
    stroke-dasharray: 14 22;
    animation: tidal-flow 20s linear infinite;
}

.tidal-currents path:nth-child(2) {
    animation-duration: 25s;
    animation-delay: -5s;
}

.tidal-currents path:nth-child(3) {
    animation-duration: 30s;
    animation-delay: -10s;
}

.tidal-currents path:nth-child(4) {
    animation-duration: 22s;
    animation-delay: -8s;
}

@keyframes tidal-flow {
    0% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: 1000;
    }
}

/* Oversized decorative Hangul characters in background */
.background-hangul {
    position: absolute;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: clamp(260px, 38vw, 560px);
    font-weight: 400;
    -webkit-text-stroke: 1.5px var(--primary-accent);
    color: transparent;
    opacity: 0.045;
    top: 50%;
    left: 10%;
    transform: translate(-50%, -50%) rotate(-15deg) scale(1);
    white-space: nowrap;
    z-index: 0;
    pointer-events: none;
}

.glyph-one {
    top: 48%;
    left: 8%;
}

.glyph-two {
    top: 15%;
    left: 78%;
    transform: translate(-50%, -50%) rotate(12deg) scale(0.72);
    opacity: 0.032;
}

.glyph-three {
    top: 82%;
    left: 88%;
    transform: translate(-50%, -50%) rotate(-8deg) scale(0.64);
    opacity: 0.035;
}

.glyph-four {
    top: 72%;
    left: 32%;
    transform: translate(-50%, -50%) rotate(18deg) scale(0.54);
    opacity: 0.026;
}

/* ============================================================
   5. LAYOUT - SYLLABLE BLOCKS & BENTO GRID
   ============================================================ */

.syllable-block {
    min-height: 90vh;
    padding: clamp(2rem, 4vw, 4rem) clamp(1.5rem, 3vw, 3rem);
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--grid-gap);
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    clip-path: circle(0% at 50% 50%);
    opacity: 0.88;
}

.bento-grid.revealed {
    animation: grid-radial-reveal 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes grid-radial-reveal {
    from {
        clip-path: circle(0% at 50% 50%);
        opacity: 0.88;
    }
    to {
        clip-path: circle(75% at 50% 50%);
        opacity: 1;
    }
}

/* Variation 1: Section 1 - Primary heading left, supporting content right */
.section-1 .bento-grid {
    grid-template-rows: auto auto auto;
}

.section-1 .cell-intro-heading {
    grid-column: 1 / 4;
    grid-row: 1 / 3;
}

.section-1 .cell-intro-lead {
    grid-column: 4 / 7;
    grid-row: 1 / 2;
}

.section-1 .cell-intro-subtitle {
    grid-column: 4 / 7;
    grid-row: 2 / 3;
}

.section-1 .cell-intro-quote {
    grid-column: 1 / 4;
    grid-row: 3 / 4;
}

.section-1 .cell-intro-detail {
    grid-column: 4 / 6;
    grid-row: 3 / 4;
}

.section-1 .cell-intro-interaction {
    grid-column: 6 / 7;
    grid-row: 3 / 4;
}

/* Variation 2: Section 2 - Inverted with diagram */
.section-2 .bento-grid {
    grid-template-rows: auto auto auto;
}

.section-2 .cell-syllable-diagram {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
}

.section-2 .cell-syllable-title {
    grid-column: 3 / 7;
    grid-row: 1 / 2;
}

.section-2 .cell-syllable-cho {
    grid-column: 3 / 5;
    grid-row: 2 / 3;
}

.section-2 .cell-syllable-jung {
    grid-column: 5 / 7;
    grid-row: 2 / 3;
}

.section-2 .cell-syllable-jong {
    grid-column: 1 / 4;
    grid-row: 3 / 4;
}

.section-2 .cell-syllable-meta {
    grid-column: 4 / 7;
    grid-row: 3 / 4;
}

/* Variation 3: Section 3 - Full-width panoramic top */
.section-3 .bento-grid {
    grid-template-rows: auto auto auto;
}

.section-3 .cell-seapunk-atmosphere {
    grid-column: 1 / 7;
    grid-row: 1 / 2;
}

.section-3 .cell-seapunk-scholarly {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
}

.section-3 .cell-seapunk-colors {
    grid-column: 3 / 5;
    grid-row: 2 / 3;
}

.section-3 .cell-seapunk-currents {
    grid-column: 5 / 7;
    grid-row: 2 / 3;
}

.section-3 .cell-seapunk-interaction {
    grid-column: 1 / 3;
    grid-row: 3 / 4;
}

.section-3 .cell-seapunk-corner {
    grid-column: 3 / 7;
    grid-row: 3 / 4;
}

/* Variation 4: Section 4 - Typography showcase */
.section-4 .bento-grid {
    grid-template-rows: auto auto auto;
}

.section-4 .cell-typography-commissioner {
    grid-column: 1 / 3;
    grid-row: 1 / 2;
}

.section-4 .cell-typography-mono {
    grid-column: 3 / 5;
    grid-row: 1 / 2;
}

.section-4 .cell-typography-korean {
    grid-column: 5 / 7;
    grid-row: 1 / 2;
}

.section-4 .cell-typography-conversational {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
}

.section-4 .cell-typography-showcase {
    grid-column: 3 / 5;
    grid-row: 2 / 3;
}

.section-4 .cell-typography-interaction {
    grid-column: 5 / 7;
    grid-row: 2 / 3;
}

/* Variation 5: Section 5 - Bento grid explanation */
.section-5 .bento-grid {
    grid-template-rows: auto auto auto;
}

.section-5 .cell-bentobox-concept {
    grid-column: 1 / 3;
    grid-row: 1 / 2;
}

.section-5 .cell-bentobox-grid {
    grid-column: 3 / 7;
    grid-row: 1 / 2;
}

.section-5 .cell-bentobox-spacing {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
}

.section-5 .cell-bentobox-variation {
    grid-column: 3 / 5;
    grid-row: 2 / 3;
}

.section-5 .cell-bentobox-nav {
    grid-column: 5 / 7;
    grid-row: 2 / 3;
}

.section-5 .cell-bentobox-responsive {
    grid-column: 1 / 7;
    grid-row: 3 / 4;
}

/* Variation 6: Section 6 - Interactions */
.section-6 .bento-grid {
    grid-template-rows: auto auto auto;
}

.section-6 .cell-interaction-ripple {
    grid-column: 1 / 3;
    grid-row: 1 / 2;
}

.section-6 .cell-interaction-reveal {
    grid-column: 3 / 5;
    grid-row: 1 / 2;
}

.section-6 .cell-interaction-ambient {
    grid-column: 5 / 7;
    grid-row: 1 / 2;
}

.section-6 .cell-interaction-hangul {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
}

.section-6 .cell-interaction-particles {
    grid-column: 3 / 5;
    grid-row: 2 / 3;
}

.section-6 .cell-interaction-cta {
    grid-column: 5 / 7;
    grid-row: 2 / 3;
}

/* ============================================================
   6. BENTO CELLS - STYLING
   ============================================================ */

.bento-cell {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(79, 209, 197, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(56, 178, 172, 0.06) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 80%, rgba(26, 74, 107, 0.12) 0%, transparent 55%),
        linear-gradient(135deg, #0F2138 0%, #0A1628 40%, #0F2138 70%, #0A1628 100%);
    background-size: 200% 200%, 180% 180%, 160% 160%, 100% 100%;
    border-radius: var(--border-radius);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    box-shadow: var(--cell-shadow);
    position: relative;
    overflow: hidden;
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    animation: cell-marble-drift 40s linear infinite;
}

@keyframes cell-marble-drift {
    from {
        background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%;
    }
    to {
        background-position: 100% 100%, 85% 120%, 120% 80%, 0% 0%;
    }
}

/* Marble vein overlay on cells */
.bento-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(135deg, transparent 0%, rgba(184, 201, 217, 0.05) 24%, transparent 49%),
        linear-gradient(45deg, transparent 0%, rgba(184, 201, 217, 0.04) 50%, transparent 100%),
        radial-gradient(ellipse at 80% 20%, rgba(226, 237, 245, 0.035) 0%, transparent 32%);
    pointer-events: none;
    border-radius: var(--border-radius);
}

.bento-cell:hover {
    box-shadow: 0 4px 24px rgba(79, 209, 197, 0.15);
    transform: translateY(-2px);
}

/* ============================================================
   7. SPECIFIC CONTENT ELEMENTS
   ============================================================ */

.hangul-char {
    font-family: 'Noto Sans KR', sans-serif;
    color: var(--primary-accent);
    font-size: 1.2em;
    font-weight: 700;
}

.syllable-illustration {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 0.5rem;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    color: var(--primary-accent);
    margin: 1rem 0;
}

.syllable-consonant {
    grid-column: 1;
    grid-row: 1;
    text-align: center;
}

.syllable-vowel {
    grid-column: 2;
    grid-row: 1;
    text-align: center;
}

.syllable-final {
    grid-column: 1 / 3;
    grid-row: 2;
    text-align: center;
}

.color-palette {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.color-swatch {
    width: clamp(2rem, 5vw, 3rem);
    height: clamp(2rem, 5vw, 3rem);
    border-radius: 4px;
    border: 2px solid var(--secondary-accent);
    cursor: pointer;
    transition: transform 200ms ease;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.grid-diagram {
    width: 100%;
    max-width: 600px;
    height: auto;
}

.typography-demo {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-family: 'Commissioner', sans-serif;
}

.typography-demo p {
    margin: 0;
    padding: 0.5rem;
    background-color: rgba(79, 209, 197, 0.08);
    border-left: 2px solid var(--primary-accent);
    border-radius: 2px;
}

.interaction-zone {
    background: linear-gradient(135deg, rgba(79, 209, 197, 0.1) 0%, rgba(56, 178, 172, 0.05) 100%);
    border: 2px dashed var(--primary-accent);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    color: var(--primary-accent);
    font-weight: 500;
    cursor: pointer;
    transition: all 300ms ease;
    user-select: none;
}

.interaction-zone:hover {
    background: linear-gradient(135deg, rgba(79, 209, 197, 0.15) 0%, rgba(56, 178, 172, 0.1) 100%);
    border-color: var(--tertiary-accent);
    color: var(--tertiary-accent);
}

/* ============================================================
   8. NAVIGATION - VERTICAL DOT INDICATOR
   ============================================================ */

.dot-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 100;
}

.dot-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--deep-cerulean);
    background-color: transparent;
    cursor: pointer;
    transition: all 300ms ease;
    position: relative;
}

.dot-indicator:hover {
    border-color: var(--primary-accent);
}

.dot-indicator.active {
    background: linear-gradient(135deg, var(--primary-accent) 0%, var(--tertiary-accent) 100%);
    border-color: var(--surface-shimmer);
    box-shadow: 0 0 12px rgba(79, 209, 197, 0.4);
}

.dot-indicator span {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    color: var(--mono-color);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease, transform 220ms ease;
    white-space: nowrap;
}

.dot-indicator:hover span {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ============================================================
   9. RIPPLE EFFECT
   ============================================================ */

.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 209, 197, 0.35) 0%, transparent 70%);
    transform: scale(0);
    animation: ripple-expand 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    pointer-events: none;
}

@keyframes ripple-expand {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================================
   10. ANIMATIONS & TRANSITIONS
   ============================================================ */

/* Subtle hue rotation on background */
.background-container {
    animation: hue-shift 60s ease-in-out infinite;
}

@keyframes hue-shift {
    0%, 100% {
        filter: hue-rotate(0deg);
    }
    50% {
        filter: hue-rotate(8deg);
    }
}

/* Hangul character parallax on scroll */
.background-hangul {
    transition: transform 100ms ease-out;
}

/* Weight transitions on hover for interactive text */
.text-accent {
    transition: color 300ms ease, font-weight 300ms ease;
}

.text-accent:hover {
    font-weight: 500;
}

/* ============================================================
   11. RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .background-container::before,
    .bento-cell {
        animation-play-state: paused;
    }

    /* Reset all grid column/row assignments for mobile */
    .bento-cell {
        grid-column: auto !important;
        grid-row: auto !important;
    }

    .syllable-block {
        min-height: auto;
        padding: 1.5rem;
    }

    .heading-display {
        font-size: clamp(1.8rem, 5vw, 2.5rem);
    }

    .heading-secondary {
        font-size: clamp(1.4rem, 3vw, 2rem);
    }

    .background-hangul {
        font-size: clamp(200px, 30vw, 400px);
        opacity: 0.02;
    }

    .dot-nav {
        display: none;
    }
}

/* ============================================================
   12. UTILITY & SMALL SCREENS
   ============================================================ */

@media (max-width: 480px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .color-palette {
        gap: 0.3rem;
    }

    .color-swatch {
        width: 2rem;
        height: 2rem;
    }

    .heading-display {
        font-size: clamp(1.5rem, 4vw, 2rem);
    }
}
