/* ============================================================
   haru.quest — CSS
   Colors: #080810 #0D0D1A #1A1A2E #FFD700 #00FFFF #9B30FF #E8E8F0
   Fonts: Cormorant Garamond 300, Space Mono 400
   ============================================================ */

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

html {
    scroll-behavior: auto;
}

body {
    background: #080810;
    color: #E8E8F0;
    font-family: 'Space Mono', monospace;
    overflow-x: hidden;
    cursor: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Cursor Glow ──────────────────────────────────────────── */
#cursor-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 255, 0.06) 0%, transparent 70%);
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 9999;
    top: 0;
    left: 0;
    transition: left 0.05s linear, top 0.05s linear;
    will-change: left, top;
}

/* ── Scroll Progress ──────────────────────────────────────── */
#scroll-progress {
    position: fixed;
    right: 0;
    top: 0;
    width: 2px;
    height: 100vh;
    background: #0D0D1A;
    z-index: 9998;
}

#scroll-progress::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: #FFD700;
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.1s linear;
}

/* ── Zones ────────────────────────────────────────────────── */
.zone {
    position: relative;
    width: 100%;
}

/* ── Zone 0: Signal Origin ───────────────────────────────── */
#zone-0 {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #080810;
    overflow: hidden;
}

.zone0-hex-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hex-large {
    width: 560px;
    height: 484px;
    background: #0D0D1A;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid rgba(255, 215, 0, 0.2);
    --border-opacity: 0.2;
    --glow-opacity: 0;
    box-shadow: inset 0 0 60px rgba(0, 255, 255, var(--glow-opacity));
    transition: box-shadow 0.2s ease;
}

/* ── PCB Dividers ─────────────────────────────────────────── */
.pcb-divider {
    width: 100%;
    height: 40px;
    background: #080810;
    overflow: visible;
}

.trace {
    stroke: #FFD700;
    stroke-width: 2;
    stroke-opacity: 0.35;
    animation: trace-pulse 4s ease-in-out infinite;
}

.pcb-divider:nth-child(2) .trace { animation-delay: 0s; }
.pcb-divider:nth-child(4) .trace { animation-delay: 0.8s; }
.pcb-divider:nth-child(6) .trace { animation-delay: 1.6s; }
.pcb-divider:nth-child(8) .trace { animation-delay: 2.4s; }

.solder-point {
    fill: #FFD700;
    opacity: 0.5;
    animation: trace-pulse 4s ease-in-out infinite;
}

@keyframes trace-pulse {
    0%, 100% { stroke-opacity: 0.2; opacity: 0.35; }
    50% { stroke-opacity: 0.5; opacity: 0.7; }
}

/* ── Zone 1: The Lattice ─────────────────────────────────── */
#zone-1 {
    min-height: 200vh;
    background: #080810;
    overflow: hidden;
    padding: 80px 0;
}

.honeycomb-grid {
    display: grid;
    grid-template-columns: repeat(4, 272px);
    gap: 4px;
    margin-left: -140px;
    position: relative;
}

.hex-cell {
    width: 272px;
    height: 235px;
    background: #0D0D1A;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid rgba(255, 215, 0, var(--border-opacity, 0.2));
    box-shadow: inset 0 0 30px rgba(0, 255, 255, var(--glow-opacity, 0));
    transition: box-shadow 0.2s ease;
    transform: scale(0.8) rotate(15deg);
    opacity: 0;
    will-change: transform, opacity;
    overflow: hidden;
}

.hex-cell.visible {
    animation: hex-snap-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes hex-snap-in {
    from {
        transform: scale(0.8) rotate(15deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Odd columns offset */
.honeycomb-grid .hex-col-odd {
    margin-top: 121px;
}

/* Micro-viz inside hex cells */
.hex-viz {
    width: 180px;
    height: 160px;
    pointer-events: none;
}

/* ── Zone 2: Deep Layer ──────────────────────────────────── */
#zone-2 {
    height: 100vh;
    background: #080810;
    position: relative;
    overflow: hidden;
}

#scatter-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ── Zone 3: Circuit Topology ────────────────────────────── */
#zone-3 {
    height: 100vh;
    background: #080810;
    position: relative;
    overflow: hidden;
}

.circuit-topology {
    width: 100%;
    height: 100%;
    position: relative;
}

#circuit-svg {
    position: absolute;
    top: 0;
    left: 0;
}

.circuit-trace-line {
    stroke: #FFD700;
    stroke-width: 2;
    stroke-opacity: 0.4;
    fill: none;
    animation: trace-pulse 4s ease-in-out infinite;
}

.chip-pad {
    fill: #0D0D1A;
    stroke: rgba(255, 215, 0, 0.4);
    stroke-width: 1;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.chip-text {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    fill: #E8E8F0;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.chip-text.revealed {
    opacity: 1;
}

/* ── Zone 4: The Seal ────────────────────────────────────── */
#zone-4 {
    height: 100vh;
    background: #080810;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zone4-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.hex-seal {
    width: 400px;
    height: 346px;
    background: #0D0D1A;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.05);
}

.domain-name {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 14px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(0, 255, 255, 0.8);
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1, "liga" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── SVG Node Graph ──────────────────────────────────────── */
.graph-edge {
    stroke: #FFD700;
    stroke-width: 1;
    stroke-opacity: 0.15;
    transition: stroke-opacity 0.2s ease;
}

.graph-node {
    fill: #00FFFF;
    transition: filter 0.2s ease, cx 0.05s, cy 0.05s;
}

.graph-node.active {
    filter: drop-shadow(0 0 8px #00FFFF);
    fill: #00FFFF;
}

/* Seal graph nodes */
.seal-node {
    fill: #00FFFF;
    transition: filter 0.2s ease;
}

.seal-node.active {
    filter: drop-shadow(0 0 6px #00FFFF);
}

.seal-edge {
    stroke: #FFD700;
    stroke-width: 1;
    stroke-opacity: 0.2;
}

/* ── Waveform Sparkline ─────────────────────────────────── */
.waveform-line {
    stroke: #9B30FF;
    stroke-width: 1.5;
    fill: none;
}

.sparkline {
    stroke: #FFD700;
    stroke-width: 1;
    fill: none;
    stroke-opacity: 0.7;
}

.node-count-text {
    font-family: 'Space Mono', monospace;
    font-size: 28px;
    fill: #00FFFF;
    dominant-baseline: middle;
    text-anchor: middle;
    opacity: 0.9;
}

.node-count-label {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    fill: #E8E8F0;
    dominant-baseline: middle;
    text-anchor: middle;
    opacity: 0.5;
}

/* ── Active Node Pulse ───────────────────────────────────── */
@keyframes node-pulse {
    0%, 100% { filter: drop-shadow(0 0 4px #00FFFF); }
    50% { filter: drop-shadow(0 0 12px #00FFFF) drop-shadow(0 0 4px #00FFFF); }
}

.graph-node.active {
    animation: node-pulse 2s ease-in-out infinite;
}

/* ── Seal Graph Pulse ───────────────────────────────────── */
@keyframes seal-node-pulse {
    0%, 100% { filter: drop-shadow(0 0 3px #00FFFF); }
    50% { filter: drop-shadow(0 0 9px #00FFFF); }
}

.seal-node.active {
    animation: seal-node-pulse 2.5s ease-in-out infinite;
}
