/* ============================================
   mang.quest - Void Network Emergence
   Cyberpunk / Ma-Negative-Space / Translucent-Frost
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
    --void-black: #050508;
    --void-dark: #020204;
    --frost-white: #E0F0FF;
    --ice-blue: #B0D4F1;
    --deep-frost: #80B8E3;
    --highlight-frost: #FFFFFF;
    --node-line-opacity: 0.12;
    --bokeh-opacity-min: 0.03;
    --bokeh-opacity-max: 0.08;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--void-dark);
    color: var(--frost-white);
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Singularity (Hero, 100vh) ---------- */
.section-singularity {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: var(--void-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background-color 600ms ease;
}

.section-singularity.bg-shift {
    background-color: var(--void-black);
}

.hero-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(6rem, 16vw, 14rem);
    letter-spacing: 0.08em;
    color: var(--frost-white);
    text-shadow: 0 0 40px rgba(224, 240, 255, 0.2);
    position: relative;
    z-index: 2;
    opacity: 0;
    transition: opacity 600ms ease;
    user-select: none;
    line-height: 1;
}

.hero-title.visible {
    opacity: 1;
}

/* Glow pulse animation after initial reveal */
@keyframes hero-glow-pulse {
    0%   { text-shadow: 0 0 40px rgba(224, 240, 255, 0.2); }
    50%  { text-shadow: 0 0 70px rgba(224, 240, 255, 0.4); }
    100% { text-shadow: 0 0 40px rgba(224, 240, 255, 0.2); }
}

.hero-title.glow-pulse {
    animation: hero-glow-pulse 2s ease-in-out 1;
}

/* Hero network nodes */
.hero-nodes-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.hero-node {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    transform: scale(0);
    transition: transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-node.visible {
    transform: scale(1);
}

@keyframes node-pulsate {
    0%, 100% { transform: scale(0.85); }
    50%      { transform: scale(1.15); }
}

@keyframes node-opacity-drift {
    0%, 100% { opacity: var(--node-base-opacity); }
    50%      { opacity: calc(var(--node-base-opacity) + 0.15); }
}

.hero-node.alive {
    animation:
        node-pulsate var(--pulse-dur, 5s) ease-in-out infinite,
        node-opacity-drift var(--opacity-dur, 4s) ease-in-out infinite;
}

/* Hero connection lines (SVG) */
.hero-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.hero-connection-line {
    stroke: var(--frost-white);
    stroke-opacity: var(--node-line-opacity);
    stroke-width: 0.5;
    stroke-dasharray: var(--line-length);
    stroke-dashoffset: var(--line-length);
    transition: stroke-dashoffset 800ms ease;
}

.hero-connection-line.drawn {
    stroke-dashoffset: 0;
}

/* ---------- Signal Corridor (200vh+) ---------- */
.section-signal-corridor {
    position: relative;
    width: 100%;
    min-height: 200vh;
    background-color: var(--void-black);
    padding: 60vh 0 40vh 0;
}

/* Bokeh background layer (fixed position, always visible) */
.bokeh-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bokeh-particle {
    position: absolute;
    border-radius: 50%;
    background-color: var(--frost-white);
    filter: blur(8px);
    pointer-events: none;
    will-change: transform;
}

@keyframes bokeh-drift {
    0% {
        transform: translate(var(--start-x), var(--start-y));
    }
    100% {
        transform: translate(var(--end-x), var(--end-y));
    }
}

/* Signal clusters (content nodes) */
.signal-cluster {
    position: relative;
    max-width: 400px;
    z-index: 1;
    margin-bottom: 0;
    padding: 24px 0;
    opacity: 0;
    filter: blur(4px);
    transition: opacity 600ms ease, filter 600ms ease;
}

.signal-cluster.revealed {
    opacity: 1;
    filter: blur(0px);
}

.cluster-left {
    margin-left: 15vw;
    margin-right: auto;
    padding-top: 50vh;
}

.cluster-center {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    padding-top: 50vh;
}

.cluster-right {
    margin-left: 65vw;
    margin-right: auto;
    padding-top: 50vh;
}

/* Node tags (labels) */
.node-tag {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--deep-frost);
    display: block;
    margin-bottom: 12px;
}

/* Cluster body text */
.cluster-text {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1vw, 1rem);
    line-height: 1.85;
    color: var(--ice-blue);
}

/* Waypoint nodes between clusters */
.waypoint-node {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--frost-white);
    opacity: 0.3;
    margin: 40vh auto;
    position: relative;
    z-index: 1;
    animation: waypoint-pulse 6s ease-in-out infinite;
}

@keyframes waypoint-pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.25; }
    50%      { transform: scale(1.2); opacity: 0.4; }
}

/* ---------- Convergence Section (100vh) ---------- */
.section-convergence {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: var(--void-black);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.convergence-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.convergence-line {
    stroke: var(--frost-white);
    stroke-opacity: var(--node-line-opacity);
    stroke-width: 0.8;
    stroke-dasharray: 710;
    stroke-dashoffset: 710;
    transition: stroke-dashoffset 1.5s ease;
}

.convergence-line.drawn {
    stroke-dashoffset: 0;
}

/* Staggered transition delays for convergence lines (200ms apart) */
.convergence-line:nth-child(1) { transition-delay: 0ms; }
.convergence-line:nth-child(2) { transition-delay: 200ms; }
.convergence-line:nth-child(3) { transition-delay: 400ms; }
.convergence-line:nth-child(4) { transition-delay: 600ms; }
.convergence-line:nth-child(5) { transition-delay: 800ms; }
.convergence-line:nth-child(6) { transition-delay: 1000ms; }
.convergence-line:nth-child(7) { transition-delay: 1200ms; }
.convergence-line:nth-child(8) { transition-delay: 1400ms; }

/* Central convergence node */
.convergence-node {
    fill: var(--frost-white);
    opacity: 0.3;
    transition: opacity 1s ease 1.5s, r 1s ease 1.5s;
}

.convergence-node.bright {
    opacity: 1;
}

/* Korean character label below convergence */
.convergence-label {
    position: absolute;
    top: calc(50% + 60px);
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--frost-white);
    opacity: 0;
    z-index: 2;
    transition: opacity 600ms ease;
}

.convergence-label.visible {
    opacity: 0.6;
}

/* Convergence bokeh ring (8 dots at 200px radius) */
.convergence-bokeh-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 400px;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
}

.convergence-bokeh-dot {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--frost-white);
    filter: blur(8px);
    opacity: 0;
    transition: opacity 800ms ease;
}

.convergence-bokeh-dot.visible {
    opacity: 0.05;
}

/* ---------- Void Footer ---------- */
.section-void-footer {
    width: 100%;
    height: 100px;
    background-color: var(--void-black);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .cluster-left {
        margin-left: 8vw;
    }

    .cluster-right {
        margin-left: auto;
        margin-right: 8vw;
    }

    .signal-cluster {
        max-width: 85vw;
    }

    .convergence-bokeh-ring {
        width: 300px;
        height: 300px;
    }
}
