/* ==========================================================================
   NODE GRAPH — Backend Engineer Control Center
   ========================================================================== */

/* ---- Graph Toast (fallback notification) ---- */
.graph-toast {
  position: fixed; bottom: 2rem; left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  font-size: 0.8rem; font-weight: 600;
  font-family: var(--font-body);
  box-shadow: var(--shadow-md), 0 0 20px rgba(61,220,151,0.15);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s var(--ease);
  z-index: 9999; pointer-events: none; white-space: nowrap;
}
.graph-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Graph Scene ---- */
.graph-scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 1;
}

/* ---- Background ---- */
.graph-bg {
  position: absolute; inset: 0;
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 900px 600px at 15% 10%, rgba(61,220,151,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 700px 500px at 85% 90%, rgba(74,163,255,0.07) 0%, transparent 55%),
    radial-gradient(circle 1px at center, rgba(255,255,255,0.06) 1px, transparent 0);
  background-size: auto, auto, 32px 32px;
  pointer-events: none;
}

/* ---- SVG Connection Layer ---- */
.graph-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.graph-line {
  stroke: var(--border-light);
  stroke-width: 1.5;
  fill: none;
  transition: stroke 0.3s ease, stroke-width 0.3s ease, opacity 0.3s ease;
  opacity: 0.6;
}

.graph-line.active { stroke: var(--accent); stroke-width: 2; opacity: 1; }
.graph-line.dimmed { opacity: 0.15; }

/* Animated particle along line */
.graph-particle {
  fill: var(--accent);
  opacity: 0.85;
  filter: drop-shadow(0 0 4px var(--accent));
}

/* ---- Center Node ---- */
.graph-node-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.center-ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 220px; height: 220px;
  border-radius: 50%;
  border: 1px solid rgba(61,220,151,0.2);
  animation: ringPulse 3s ease-in-out infinite;
  pointer-events: none;
}

.center-ring-2 {
  width: 280px; height: 280px;
  border-color: rgba(61,220,151,0.08);
  animation-delay: 1s;
}

@keyframes ringPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.04); opacity: 0.6; }
}

.center-card {
  background: rgba(15, 22, 32, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(61,220,151,0.22);
  border-radius: var(--radius-xl);
  padding: 2.2rem 2.8rem;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(61,220,151,0.06), var(--shadow-lg), 0 0 60px rgba(61,220,151,0.08);
  min-width: 260px;
  position: relative;
  z-index: 2;
}

.center-status {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 1rem;
}

.center-status-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  animation: statusPulse 2.5s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(34,197,94,0.4);
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

.center-name {
  font-family: var(--font-heading);
  font-size: 2rem; font-weight: 700; letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.center-role {
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 0.6rem;
}

.center-tagline {
  font-size: 0.83rem; color: var(--text-muted);
  line-height: 1.6; max-width: 220px; margin: 0 auto 1.2rem;
}

.center-links {
  display: flex; gap: 0.6rem; justify-content: center;
}

.center-link {
  padding: 0.35rem 0.9rem; border-radius: 999px;
  border: 1px solid var(--border-light);
  color: var(--text-muted); font-size: 0.72rem; font-weight: 600;
  text-decoration: none; letter-spacing: 0.03em;
  transition: all 0.22s ease;
}

.center-link:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Satellite Nodes ---- */
.graph-node {
  position: absolute;
  z-index: 10;
  transform: translate(-50%, -50%);
  background: rgba(15, 22, 32, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: clamp(0.8rem, 2vw, 1.2rem) clamp(1rem, 2vw, 1.4rem);
  width: clamp(100px, 12vw, 130px);
  display: flex; flex-direction: column; align-items: center; gap: 0.45rem;
  cursor: pointer; text-align: center;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s var(--ease), background 0.25s ease;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-body);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.graph-node:hover, .graph-node:focus-visible {
  border-color: var(--node-color, var(--accent));
  box-shadow: 0 0 0 1px var(--node-color, var(--accent)), 0 8px 28px rgba(0,0,0,0.4), 0 0 20px rgba(61,220,151,0.12);
  transform: translate(-50%, -50%) translateY(-3px);
  background: rgba(17, 26, 37, 0.92);
}

.graph-node.node-active {
  border-color: var(--node-color, var(--accent));
  box-shadow: 0 0 0 1px var(--node-color, var(--accent)), var(--shadow-md), 0 0 30px rgba(61,220,151,0.15);
  background: rgba(17, 26, 37, 0.95);
}

.graph-node.node-dimmed { opacity: 0.3; transform: translate(-50%, -50%); }

.graph-node:focus-visible { outline: 2px solid var(--node-color, var(--accent)); outline-offset: 3px; }

.node-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--node-color, var(--accent)) 15%, transparent);
  color: var(--node-color, var(--accent));
  transition: background 0.25s ease;
  flex-shrink: 0;
}

.node-icon svg { width: 18px; height: 18px; }

.node-label {
  font-size: 0.8rem; font-weight: 700;
  color: var(--text-primary); letter-spacing: 0.01em;
  line-height: 1;
}

.node-hint {
  font-size: 0.65rem; color: var(--text-muted);
  letter-spacing: 0.02em; line-height: 1;
}

/* Node Positions — hexagonal layout */
.graph-node[data-panel="resume"]     { left: 26%; top: 24%; --node-color: var(--purple); }
.graph-node[data-panel="projects"]   { left: 74%; top: 24%; --node-color: var(--accent); }
.graph-node[data-panel="skills"]     { left: 86%; top: 50%; --node-color: var(--blue); }
.graph-node[data-panel="experience"] { left: 74%; top: 76%; --node-color: var(--purple); }
.graph-node[data-panel="profiles"]   { left: 26%; top: 76%; --node-color: var(--amber); }
.graph-node[data-panel="contact"]    { left: 14%; top: 50%; --node-color: var(--accent); }

/* ---- System Status Bar ---- */
.status-bar {
  position: absolute;
  bottom: 1.2rem; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 1.4rem;
  font-family: var(--font-mono); font-size: 0.65rem;
  color: var(--text-muted); letter-spacing: 0.06em;
  z-index: 10;
  pointer-events: none;
  white-space: nowrap;
}

.status-bar-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--green);
  display: inline-block; margin-right: 0.3rem;
  animation: statusPulse 2.5s ease-in-out infinite;
}

.status-bar-sep { color: var(--border-light); }

.status-bar a {
  color: var(--text-muted); text-decoration: none; pointer-events: all;
  transition: color 0.2s ease;
}
.status-bar a:hover { color: var(--accent); }

/* ---- Node Tooltip ---- */
.node-tooltip {
  position: fixed; z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
  font-size: 0.72rem; font-weight: 500;
  color: var(--text-secondary);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.node-tooltip.visible { opacity: 1; }

@media (hover: none) and (pointer: coarse), (max-width: 900px) {
  .node-tooltip { display: none !important; }
}

/* ---- Mobile Layout ---- */
@media (max-width: 900px) {
  /* Satellites reposition to 3-column grid */
  .graph-node[data-panel="resume"]     { left: 20%; top: 28%; }
  .graph-node[data-panel="projects"]   { left: 50%; top: 18%; }
  .graph-node[data-panel="skills"]     { left: 80%; top: 28%; }
  .graph-node[data-panel="experience"] { left: 80%; top: 70%; }
  .graph-node[data-panel="profiles"]   { left: 50%; top: 80%; }
  .graph-node[data-panel="contact"]    { left: 20%; top: 70%; }

  .graph-node { width: clamp(90px, 15vw, 112px); padding: 1rem; }
  .center-card { padding: clamp(1rem, 3vw, 1.5rem) clamp(1rem, 3vw, 2rem); min-width: min(200px, 100%); }
  .center-name { font-size: clamp(1.4rem, 4vw, 1.7rem); }
  .center-tagline { font-size: 0.78rem; }
}

@media (max-width: 600px) {
  /* Stack as vertical list below center node */
  .graph-svg { display: none; }
  .center-ring, .center-ring-2 { display: none; }

  .graph-scene {
    overflow-y: auto;
    display: flex; flex-direction: column; align-items: center;
    padding: 4.5rem 1rem 4rem; /* Clears top-bar, reduced bottom padding */
    gap: 0.6rem; /* Tighter vertical spacing */
  }

  .graph-bg {
    position: fixed;
  }

  .graph-node-center {
    position: static; transform: none;
    width: 100%; max-width: min(340px, 100%);
  }

  /* Override center-card for compact mobile view */
  .center-card { 
    padding: 1.2rem 1rem; 
    border-radius: var(--radius-lg); 
    min-width: 100%; 
  }
  .center-status { font-size: 0.6rem; margin-bottom: 0.5rem; }
  .center-name { font-size: clamp(1.2rem, 5vw, 1.4rem); margin-bottom: 0.15rem; }
  .center-role { font-size: 0.75rem; margin-bottom: 0.4rem; }
  .center-tagline { font-size: 0.75rem; margin-bottom: 0.8rem; line-height: 1.4; }
  .center-links { gap: 0.4rem; }
  .center-link { padding: 0.3rem 0.7rem; font-size: 0.68rem; }

  .graph-node {
    position: static; transform: none;
    width: 100%; max-width: min(340px, 100%);
    flex-direction: row; text-align: left;
    padding: 0.8rem 1rem; gap: 0.8rem;
    border-radius: var(--radius);
  }

  .node-icon { width: 30px; height: 30px; }
  .node-icon svg { width: 16px; height: 16px; }
  .node-label { font-size: 0.85rem; }
  .node-hint { display: none; }

  .status-bar {
    position: fixed; bottom: 0.6rem;
    flex-wrap: wrap; justify-content: center;
    gap: 0.4rem 0.6rem; left: 0; right: 0;
    transform: none;
    padding: 0 1rem;
    font-size: 0.6rem;
  }
}
