/* mang.quest - Translucent Frost Hexagonal Network */

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

html {
    overflow: hidden;
    height: 100%;
    background: #0a0e1a;
}

body {
    font-family: 'Karla', sans-serif;
    background: #0a0e1a;
    color: #c8d8e4;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: relative;
    cursor: crosshair;
}

/* ===== Hex Mesh SVG Background ===== */
.hex-mesh {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: 1;
    pointer-events: none;
}

.hex-mesh line {
    stroke: #3a4255;
    stroke-width: 0.5;
    opacity: 0.25;
    transition: opacity 0.3s ease;
}

.hex-mesh line.mesh-active {
    opacity: 0.5;
    stroke: #4a3aff;
}

.hex-mesh line.mesh-pulse {
    animation: meshPulse 2s ease-in-out infinite;
}

@keyframes meshPulse {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.4; }
}

/* ===== Canvas Field Lines ===== */
#field-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* ===== Frost Particles ===== */
#frost-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.frost-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: #e0f0ff;
    will-change: transform, opacity;
}

/* ===== Topology Watermark ===== */
#topology-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vmin;
    height: 80vmin;
    z-index: 2;
    pointer-events: none;
    opacity: 0.03;
}

.topology-glyph {
    width: 100%;
    height: 100%;
}

/* ===== Hex Field Container ===== */
#hex-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 8;
    transform-origin: center center;
    transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ===== Hex Layers ===== */
.hex-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 1s ease, transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.hex-layer[data-layer="1"],
.hex-layer[data-layer="2"],
.hex-layer[data-layer="3"] {
    opacity: 0;
    pointer-events: none;
}

.hex-layer.layer-active {
    opacity: 1;
    pointer-events: auto;
}

.hex-layer.layer-fading {
    opacity: 0.3;
}

/* ===== Hex Nodes ===== */
.hex-node {
    position: absolute;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease;
    will-change: transform;
}

.hex-node-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(200, 216, 228, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
    padding: 10%;
    text-align: center;
}

.hex-node:hover .hex-node-inner {
    background: rgba(200, 216, 228, 0.18);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* Primary Node - 망 character */
.hex-node-primary {
    width: clamp(280px, 50vmin, 500px);
    height: clamp(323px, 57.7vmin, 577px);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    animation: primaryPulse 8s ease-in-out infinite;
}

@keyframes primaryPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.005); }
}

.mang-char {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(4rem, 12vw, 10rem);
    color: #e0f0ff;
    letter-spacing: 0.15em;
    line-height: 1;
}

/* Medium Nodes */
.hex-node-medium {
    width: 200px;
    height: 231px;
}

/* Small Nodes */
.hex-node-small {
    width: 120px;
    height: 139px;
}

/* Text Nodes */
.hex-node-text {
    width: 280px;
    height: 323px;
}

/* Generative Pattern Nodes */
.hex-node-generative {
    width: 180px;
    height: 208px;
}

.hex-node-generative .hex-node-inner {
    padding: 15%;
}

.lissajous-svg,
.perlin-svg {
    width: 100%;
    height: 100%;
}

/* ===== Node Labels ===== */
.node-label {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: #e0f0ff;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.collapse-label {
    color: #e8443a;
    opacity: 0.8;
}

.connected-label {
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    text-transform: lowercase;
    letter-spacing: 0.15em;
    color: #e0f0ff;
}

/* ===== Jamo Strokes ===== */
.jamo-stroke {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #c8d8e4;
    opacity: 0.6;
    line-height: 1;
}

.jamo-rotated {
    transform: rotate(45deg);
    display: inline-block;
}

/* ===== Whisper Text ===== */
.whisper-text {
    font-family: 'Karla', sans-serif;
    font-size: 14px;
    line-height: 1.8;
    color: #c8d8e4;
    opacity: 0.55;
}

/* ===== Mono Accent ===== */
.mono-accent {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: #3a4255;
    opacity: 0.4;
    margin-top: 8px;
    display: block;
}

/* ===== Node Meta ===== */
.node-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: #3a4255;
    opacity: 0.4;
}

/* ===== Fractured Node ===== */
.hex-node-fractured {
    width: 220px;
    height: 254px;
}

.hex-node-fractured .hex-node-inner {
    background: rgba(232, 68, 58, 0.08);
    border: none;
}

.fracture-char {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #e8443a;
    opacity: 0.7;
    animation: fracturePulse 3s ease-in-out infinite;
}

@keyframes fracturePulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    25% { opacity: 0.3; transform: scale(0.98) skewX(2deg); }
    50% { opacity: 0.8; transform: scale(1.02) skewX(-1deg); }
    75% { opacity: 0.4; transform: scale(0.99) skewX(1deg); }
}

.fracture-meta {
    color: #e8443a;
    opacity: 0.5;
}

/* ===== Remnant Nodes ===== */
.hex-node-remnant .hex-node-inner {
    background: rgba(200, 216, 228, 0.04);
}

/* ===== Node Entrance Animation ===== */
.hex-node.node-entering {
    transform: scale(0) rotate(60deg);
    opacity: 0;
}

.hex-node.node-visible {
    transform: scale(1) rotate(0deg);
    opacity: 1;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease;
}

/* ===== Edge Navigation Nodes ===== */
.edge-node {
    position: fixed;
    z-index: 15;
    cursor: pointer;
}

.edge-marker {
    width: 20px;
    height: 23px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: rgba(74, 58, 255, 0.3);
    transition: background 0.3s ease, transform 0.3s ease;
}

.edge-node:hover .edge-marker {
    background: rgba(74, 58, 255, 0.6);
    transform: scale(1.3);
}

.edge-node-top {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.edge-node-right {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.edge-node-bottom {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.edge-node-left {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* ===== Frost Particle Animations ===== */
@keyframes floatParticle {
    0% { transform: translate(0, 0); }
    25% { transform: translate(var(--dx1), var(--dy1)); }
    50% { transform: translate(var(--dx2), var(--dy2)); }
    75% { transform: translate(var(--dx3), var(--dy3)); }
    100% { transform: translate(0, 0); }
}


/* ===== Breath Color - Full Opacity Moments ===== */
.connected-label {
    color: #f0f4f8;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hex-node-primary {
        width: clamp(200px, 60vmin, 320px);
        height: clamp(231px, 69.3vmin, 369px);
    }

    .hex-node-medium {
        width: 140px;
        height: 162px;
    }

    .hex-node-small {
        width: 90px;
        height: 104px;
    }

    .hex-node-text {
        width: 200px;
        height: 231px;
    }

    .hex-node-generative {
        width: 130px;
        height: 150px;
    }

    .hex-node-fractured {
        width: 160px;
        height: 185px;
    }

    .whisper-text {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .hex-node-primary {
        width: 180px;
        height: 208px;
    }

    .mang-char {
        font-size: 3rem;
    }

    .hex-node-medium {
        width: 110px;
        height: 127px;
    }

    .hex-node-small {
        width: 70px;
        height: 81px;
    }

    .hex-node-text {
        width: 160px;
        height: 185px;
    }
}