/* ════════════════════════════════════════════════════
   THE WEB OF INTERDEPENDENCE — Stylesheet
   A systems-thinking visualization of universal
   interdependence. WCAG 2.1 AA contrast compliant.
   ════════════════════════════════════════════════════ */

/* ─── CSS Variables ──────────────────────────────── */
:root {
  /* Backgrounds */
  --void:          #0B0F14;
  --deep-space:    #0e1318;
  --nebula-dark:   #131b24;

  /* Domain palette — clearly distinct on dark background */
  --gold:          #f5c842;  /* Individual   — warm gold            */
  --gold-glow:     rgba(245, 200, 66, 0.55);

  --life:          #f97316;  /* Food & Life  — warm orange          */
  --life-glow:     rgba(249, 115, 22, 0.5);

  --nature:        #22c55e;  /* Nature       — organic green        */
  --nature-glow:   rgba(34, 197, 94, 0.5);

  --culture:       #a855f7;  /* Society      — violet purple        */
  --culture-glow:  rgba(168, 85, 247, 0.5);

  --tech:          #06b6d4;  /* Technology   — electric cyan        */
  --tech-glow:     rgba(6, 182, 212, 0.5);

  --connection:    #f472b6;  /* Relationships — soft pink           */
  --connection-glow: rgba(244, 114, 182, 0.5);

  --mind:          #84cc16;  /* Knowledge    — lime yellow-green    */
  --mind-glow:     rgba(132, 204, 22, 0.5);

  /* Links */
  --link-base:     rgba(255, 255, 255, 0.1);
  --link-lit:      rgba(255, 255, 255, 0.55);

  /* Panels */
  --panel-bg:      rgba(11, 15, 20, 0.94);
  --panel-border:  rgba(255, 255, 255, 0.12);

  /* Text — WCAG 2.1 AA compliant on --void background */
  --text-primary:   #E8EEF5;   /* ~14.5:1 contrast on #0B0F14 */
  --text-secondary: #B8C8DC;   /* ~7.8:1  contrast on #0B0F14 */
  --text-muted:     #8A9AB8;   /* ~4.6:1  contrast on #0B0F14 */
  --text-dim:       #6B7A96;   /* ~3.2:1  use only for non-essential decoration */

  --font-display:  'Cinzel', serif;
  --font-body:     'Cormorant Garamond', serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--text-primary);
}

/* ─── Canvas Layers ──────────────────────────────── */
#star-canvas,
#visualization,
#particle-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

#star-canvas     { z-index: 1; }
#visualization   { z-index: 2; }
#particle-canvas { z-index: 3; pointer-events: none; }

/* ─── UI Overlay ─────────────────────────────────── */
#ui-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

/* ─── Title ──────────────────────────────────────── */
#title-header {
  position: absolute;
  top: 36px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  user-select: none;
}

.title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 2.8vw, 2.2rem);
  letter-spacing: 0.3em;
  color: var(--gold);
  text-shadow:
    0 0 18px var(--gold-glow),
    0 0 50px rgba(245, 200, 66, 0.18);
  animation: titleBreathe 7s ease-in-out infinite;
}

.subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.88rem;
  letter-spacing: 0.16em;
  color: var(--text-muted);   /* 4.6:1 — AA compliant */
  margin-top: 7px;
}

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

/* ─── Info Panel ─────────────────────────────────── */
#info-panel {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 2px;
  padding: 18px 28px 16px;
  min-width: 280px;
  max-width: 440px;
  text-align: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#info-panel.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(6px);
  pointer-events: none;
}

#info-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.22em;
  color: var(--gold);
  margin-bottom: 10px;
}

#info-desc {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.93rem;
  line-height: 1.7;
  color: var(--text-secondary);  /* 7.8:1 — AA compliant */
}

#info-meta {
  margin-top: 12px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.07em;
  color: var(--text-muted);  /* 4.6:1 — AA compliant */
}

/* ─── Expand hint ────────────────────────────────── */
#expand-hint {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  transition: opacity 0.4s;
  animation: hintPulse 2.5s ease-in-out infinite;
}

#expand-hint.hidden { opacity: 0; pointer-events: none; }

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

/* ─── Legend ─────────────────────────────────────── */
#legend {
  position: absolute;
  top: 50%;
  left: 24px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(11, 15, 20, 0.82);
  border: 1px solid var(--panel-border);
  border-radius: 2px;
  padding: 14px 16px 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#legend-title {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  color: var(--text-muted);  /* 4.6:1 — AA compliant */
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--text-secondary);  /* 7.8:1 — AA compliant */
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Each domain colour, clearly differentiated */
.dot.observer   { background: var(--gold);       box-shadow: 0 0 7px var(--gold-glow);       }
.dot.life       { background: var(--life);        box-shadow: 0 0 7px var(--life-glow);       }
.dot.nature     { background: var(--nature);      box-shadow: 0 0 7px var(--nature-glow);     }
.dot.culture    { background: var(--culture);     box-shadow: 0 0 7px var(--culture-glow);    }
.dot.tech       { background: var(--tech);        box-shadow: 0 0 7px var(--tech-glow);       }
.dot.connection { background: var(--connection);  box-shadow: 0 0 7px var(--connection-glow); }
.dot.mind       { background: var(--mind);        box-shadow: 0 0 7px var(--mind-glow);       }

/* ─── Controls ───────────────────────────────────── */
#controls {
  position: absolute;
  bottom: 36px;
  right: 32px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: rgba(11, 15, 20, 0.75);
  border: 1px solid var(--panel-border);
  border-radius: 2px;
  padding: 12px 16px 10px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#controls-title {
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.28em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.ctrl {
  font-family: var(--font-body);
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  color: var(--text-secondary);  /* 7.8:1 — AA compliant */
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.ctrl-icon {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ─── SVG Node Styles ────────────────────────────── */
.node-group {
  cursor: pointer;
}

.node-label {
  font-family: var(--font-body);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  fill: #C8D8F0;     /* high contrast on dark SVG background */
  pointer-events: none;
  user-select: none;
}

.node-group.level-0 .node-label {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.15em;
  fill: var(--gold);
}

.node-group.level-1 .node-label {
  font-size: 11px;
  fill: #D0DCF0;
}

/* Link lines */
.link {
  fill: none;
  stroke: var(--link-base);
  stroke-width: 0.8;
  transition: stroke 0.35s ease, opacity 0.35s ease, stroke-width 0.35s ease;
}
.link.lit    { stroke: var(--link-lit); stroke-width: 1.6; }
.link.dimmed { opacity: 0.07; }

/* Node fading */
.node-group.dimmed { opacity: 0.12; transition: opacity 0.35s ease; }
.node-group        { transition: opacity 0.35s ease; }

/* ─── Scrollbar hidden ───────────────────────────── */
::-webkit-scrollbar { display: none; }


/* ══════════════════════════════════════════════════════════
   MOBILE GATE  (<1024px)
   The hover-based network experience requires a pointer
   device and enough screen space to explore the web.
   Below 1024px we show a graceful desktop-only screen and
   hide all visualization layers.
   ══════════════════════════════════════════════════════════ */

/* Gate is hidden on desktop — zero cost when not needed */
#mobile-gate { display: none; }

/* ─── Gate layout ─────────────────────────────────── */
@media (max-width: 1023px) {

  /* Hide every visualization layer */
  #star-canvas,
  #visualization,
  #particle-canvas,
  #ui-overlay {
    display: none !important;
  }

  /* Show the gate, full-viewport centred column */
  #mobile-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    position: fixed;
    inset: 0;
    background: var(--void);
    z-index: 9999;
    padding: 32px 24px 40px;
    text-align: center;
    overflow: hidden;
  }

  /* Subtle radial glow behind the illustration */
  #mobile-gate::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 340px;
    height: 340px;
    transform: translate(-50%, -60%);
    background: radial-gradient(
      ellipse at center,
      rgba(245,200,66,0.07) 0%,
      rgba(6,182,212,0.05) 40%,
      transparent 70%
    );
    pointer-events: none;
  }

  /* ─── SVG network illustration ─────────────────── */
  .gate-visual {
    margin-bottom: 28px;
  }

  .gate-svg {
    width: 180px;
    height: 148px;
    overflow: visible;
  }

  /* Nodes pulse with staggered timing */
  .gn {
    transform-box: fill-box;
    transform-origin: center;
    animation: gnPulse 4s ease-in-out infinite;
  }
  .gn-center { animation-duration: 3.6s; }
  .gn-1  { animation-delay: 0s;    animation-duration: 4.2s; }
  .gn-2  { animation-delay: 0.5s;  animation-duration: 3.8s; }
  .gn-3  { animation-delay: 1.0s;  animation-duration: 4.5s; }
  .gn-4  { animation-delay: 1.5s;  animation-duration: 3.9s; }
  .gn-5  { animation-delay: 2.0s;  animation-duration: 4.1s; }
  .gn-6  { animation-delay: 2.5s;  animation-duration: 4.4s; }

  @keyframes gnPulse {
    0%, 100% { opacity: 0.65; transform: scale(1);    }
    50%       { opacity: 1;    transform: scale(1.18); }
  }

  /* ─── Gate text content ─────────────────────────── */
  .gate-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

  .gate-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.25rem, 5vw, 1.65rem);
    letter-spacing: 0.2em;
    color: var(--gold);
    text-shadow: 0 0 20px var(--gold-glow), 0 0 50px rgba(245,200,66,0.12);
    line-height: 1.25;
    animation: titleBreathe 7s ease-in-out infinite;
  }

  .gate-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.82rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-top: 8px;
  }

  .gate-sep {
    width: 48px;
    height: 1px;
    background: rgba(255,255,255,0.12);
    margin: 22px auto;
  }

  .gate-body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: 320px;
  }

  .gate-em {
    color: var(--gold);
    font-style: italic;
  }

  .gate-features {
    margin-top: 24px;
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    opacity: 0.7;
  }

} /* end @media (max-width: 1023px) */
