/* ========================================
   saram.ai — Observatory Design System
   ======================================== */

/* CSS Custom Properties */
:root {
    --void-bg: #0b0e1a;
    --void-bg-light: #0e1222;
    --panel-surface: #1a2137;
    --panel-border: #2a3454;
    --text-primary: #e2ddd5;
    --text-secondary: #8b8fa8;
    --neon-cyan: #4fd1c5;
    --neon-amber: #d4a574;
    --neon-rose: #c77dba;
    --panel-glow: #0d3b3f;

    --glass-bg: rgba(26, 33, 55, 0.65);
    --glass-blur: blur(16px) saturate(1.2);
    --glass-border: 1px solid rgba(42, 52, 84, 0.5);
    --glass-radius: 12px;
    --glass-shadow: 0 8px 32px rgba(11, 14, 26, 0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

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

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

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    background-color: var(--void-bg);
    color: var(--text-primary);
    line-height: 1.75;
    letter-spacing: 0.01em;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    overflow-x: hidden;
}

/* ========================================
   Glassmorphic Panel Base
   ======================================== */
.glassmorphic-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: var(--glass-border);
    border-radius: var(--glass-radius);
    box-shadow: var(--glass-shadow);
    position: relative;
}

/* ========================================
   Hangul Particle Field
   ======================================== */
#particle-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

#particle-field .hangul-particle {
    position: absolute;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    color: var(--text-secondary);
    opacity: 0;
    animation: particleDrift linear infinite;
    pointer-events: none;
    user-select: none;
}

@keyframes particleDrift {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.06;
    }
    90% {
        opacity: 0.06;
    }
    100% {
        transform: translate(var(--drift-x), var(--drift-y)) rotate(var(--drift-rot));
        opacity: 0;
    }
}

/* ========================================
   Progress Indicator
   ======================================== */
#progress-indicator {
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 40vh;
    background: rgba(42, 52, 84, 0.3);
    z-index: 100;
    border-radius: 1px;
}

#progress-line {
    width: 100%;
    height: 0%;
    background: var(--neon-cyan);
    border-radius: 1px;
    transition: height 0.3s ease;
    box-shadow: 0 0 8px rgba(79, 209, 197, 0.4);
}

/* ========================================
   Chamber Base
   ======================================== */
.chamber {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5vw;
    overflow: hidden;
}

#chamber-1 { min-height: 100vh; }
#chamber-2 { min-height: 100vh; }
#chamber-3 { min-height: 100vh; }
#chamber-4 { min-height: 120vh; }
#chamber-5 { min-height: 80vh; }

/* ========================================
   Chamber 1 — Arrival (Hero)
   ======================================== */
#fingerprint-watermark {
    position: absolute;
    width: 80vh;
    height: 80vh;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

.panel-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 4rem;
    z-index: 2;
    min-width: 280px;
    max-width: 500px;
}

#human-silhouette {
    width: 160px;
    height: auto;
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 8px rgba(79, 209, 197, 0.4));
}

.silhouette-outer .draw-path,
.silhouette-inner .draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawStroke 3s ease-out forwards;
    animation-delay: 1.5s;
}

@keyframes drawStroke {
    to {
        stroke-dashoffset: 0;
    }
}

.hero-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
    opacity: 0;
    animation: fadeInLetters 1s ease-out forwards;
    animation-delay: 4.5s;
}

.hero-korean {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 2rem;
    color: var(--neon-amber);
    text-shadow: 0 0 20px rgba(212, 165, 116, 0.3);
    margin-top: 0.5rem;
    opacity: 0;
    animation: fadeInGlow 1.2s ease-out forwards;
    animation-delay: 5s;
}

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

@keyframes fadeInGlow {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Domain title letter animation */
#domain-title span {
    display: inline-block;
    opacity: 0;
    animation: letterFadeIn 0.4s ease-out forwards;
}

/* ========================================
   Chamber 2 — Anatomy of Being
   ======================================== */
.chamber-2-layout {
    display: flex;
    gap: 1.5rem;
    width: 100%;
    max-width: 1200px;
    align-items: stretch;
    min-height: 70vh;
}

.panel-anatomy-main {
    flex: 0 0 61.8%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    min-height: 500px;
}

#anatomy-figure {
    width: 100%;
    max-width: 300px;
    height: auto;
}

.flow-line {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
}

.flow-line.animated {
    animation: drawFlow 2s ease-out forwards;
}

@keyframes drawFlow {
    to { stroke-dashoffset: 0; }
}

.particle-flow {
    opacity: 0.6;
    animation: pulseParticle 3s ease-in-out infinite;
}

@keyframes pulseParticle {
    0%, 100% { opacity: 0.3; r: 1.5; }
    50% { opacity: 0.8; r: 2.5; }
}

.panel-stack-right {
    flex: 0 0 38.2%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel-text-a,
.panel-text-b,
.panel-text-c {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 2rem;
}

.poetic-text {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 1.5vw, 1.4rem);
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.3;
    text-align: center;
}

.poetic-text.secondary {
    color: var(--text-secondary);
}

.korean-stack {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 1.6rem;
    color: var(--neon-cyan);
    line-height: 2;
    text-align: center;
    letter-spacing: 0.05em;
}

/* ========================================
   Morph Panel Animation
   ======================================== */
.morph-panel {
    transform: scale(0);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                backdrop-filter 0.8s ease;
}

.morph-panel.visible {
    transform: scale(1);
    opacity: 1;
}

/* ========================================
   Chamber 3 — The Mirror
   ======================================== */
#chamber-3 {
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-mirror {
    width: 85%;
    max-width: 1100px;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 4rem;
    position: relative;
    overflow: hidden;
}

.mirror-gradient-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, #4fd1c5 0%, transparent 30%, transparent 70%, #d4a574 100%);
}

.root-border-top {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
}

#typewriter-container {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    max-width: 800px;
    margin: 0 auto;
}

.mirror-text {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    color: var(--text-primary);
    line-height: 2;
    letter-spacing: 0.01em;
}

.mirror-text .char {
    display: inline;
    transition: opacity 0.1s;
}

.cursor {
    display: inline;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    color: var(--neon-cyan);
    animation: cursorBlink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ========================================
   Chamber 4 — Garden of Forms
   ======================================== */
#chamber-4 {
    display: flex;
    align-items: center;
    justify-content: center;
}

.garden-constellation {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 80vh;
    min-height: 600px;
}

.garden-panel {
    position: absolute;
    width: 180px;
    height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    cursor: default;
    transition: filter 0.4s ease, backdrop-filter 0.4s ease;
}

/* Golden angle spiral positions */
.garden-panel[data-index="0"] { left: 50%; top: 10%; transform: translate(-50%, 0); }
.garden-panel[data-index="1"] { left: 75%; top: 20%; }
.garden-panel[data-index="2"] { left: 80%; top: 45%; }
.garden-panel[data-index="3"] { left: 60%; top: 65%; }
.garden-panel[data-index="4"] { left: 35%; top: 72%; }
.garden-panel[data-index="5"] { left: 12%; top: 55%; }
.garden-panel[data-index="6"] { left: 8%; top: 28%; }
.garden-panel[data-index="7"] { left: 30%; top: 12%; }

.garden-panel svg {
    width: 100px;
    height: 125px;
    transition: filter 0.4s ease;
}

.garden-panel:hover svg {
    filter: drop-shadow(0 0 16px currentColor);
}

.garden-panel:hover {
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
}

.garden-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    margin-top: 0.75rem;
    text-transform: uppercase;
    opacity: 0.7;
}

/* ========================================
   Chamber 5 — Departure
   ======================================== */
#chamber-5 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--void-bg);
    transition: background-color 2s ease;
}

#chamber-5.transitioning {
    background-color: var(--void-bg-light);
}

.departure-content {
    text-align: center;
    z-index: 2;
}

.departure-domain {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
    animation: gentlePulse 4s ease-in-out infinite;
}

@keyframes gentlePulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.departure-tagline {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    margin-top: 1.5rem;
}

/* ========================================
   Water Ripple Background
   ======================================== */
#ripple-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.ripple-circle {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--neon-rose);
    opacity: 0;
    animation: rippleExpand 8s ease-out infinite;
}

.ripple-circle:nth-child(1) {
    top: 30%;
    left: 20%;
    animation-delay: 0s;
}

.ripple-circle:nth-child(2) {
    top: 60%;
    left: 70%;
    animation-delay: 2.5s;
}

.ripple-circle:nth-child(3) {
    top: 80%;
    left: 40%;
    animation-delay: 5s;
}

@keyframes rippleExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.15;
        transform: translate(-50%, -50%);
    }
    100% {
        width: 400px;
        height: 400px;
        opacity: 0;
        transform: translate(-50%, -50%);
    }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .chamber {
        padding: 3vw;
    }

    .chamber-2-layout {
        flex-direction: column;
    }

    .panel-anatomy-main {
        flex: none;
        min-height: 300px;
    }

    .panel-stack-right {
        flex: none;
    }

    .panel-mirror {
        width: 95%;
        padding: 2rem;
        min-height: auto;
    }

    .garden-constellation {
        height: auto;
        min-height: auto;
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
        padding: 1rem 0;
    }

    .garden-panel {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        width: 140px;
        height: 180px;
    }

    #progress-indicator {
        right: 0.5rem;
    }

    .departure-domain {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }
}

/* ========================================
   Silhouette Glow Pulse
   ======================================== */
.silhouette-outer {
    filter: drop-shadow(0 0 8px rgba(79, 209, 197, 0.4));
}

.silhouette-inner {
    filter: drop-shadow(0 0 4px rgba(199, 125, 186, 0.3));
}

/* ========================================
   Departure Panel Dissolve
   ======================================== */
.panel-dissolving {
    transition: backdrop-filter 2s ease, border-color 2s ease, background 2s ease;
    backdrop-filter: blur(0px) saturate(1) !important;
    -webkit-backdrop-filter: blur(0px) saturate(1) !important;
    border-color: transparent !important;
    background: transparent !important;
}
