/* ═══════════════════════════════════════════════════════════
   NEXUS — THE SENTIENT SPHERE
   Agentic Cloud Flows Laboratory
   ═══════════════════════════════════════════════════════════ */

/* ─── RESET & BASE ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(18, 18, 30, 0.7);
  --accent: #00f0ff;
  --accent-glow: rgba(0, 240, 255, 0.3);
  --accent-alt: #ff00aa;
  --accent-alt-glow: rgba(255, 0, 170, 0.3);
  --accent-warm: #ff6b35;
  --text-primary: #e8e8f0;
  --text-secondary: #8888aa;
  --text-dim: #555577;
  --glass-bg: rgba(18, 18, 30, 0.6);
  --glass-border: rgba(0, 240, 255, 0.15);
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --mood-color: var(--accent);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
}

/* ─── LOADING SCREEN ─── */
#loading-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-ring {
  width: 80px;
  height: 80px;
  border: 3px solid var(--bg-secondary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader-text {
  margin-top: 24px;
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 14px;
  letter-spacing: 2px;
}

.blink {
  animation: blink 0.8s step-end infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ─── NAVIGATION ─── */
#nav {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  padding: 16px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  backdrop-filter: blur(20px);
  background: rgba(10, 10, 15, 0.8);
  border-bottom: 1px solid var(--glass-border);
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  color: var(--accent);
  letter-spacing: 4px;
}

.brand-icon {
  font-size: 24px;
  animation: pulse-glow 2s ease-in-out infinite;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-family: var(--font-mono);
  transition: color 0.3s;
}

.nav-links a:hover {
  color: var(--accent);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.status-dot.pulse {
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-dot.offline {
  background: #ff4444;
  box-shadow: none;
  animation: none;
}

.nav-divider {
  color: var(--text-dim);
  margin: 0 8px;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 4px var(--accent-glow); }
  50% { box-shadow: 0 0 16px var(--accent-glow), 0 0 32px var(--accent-glow); }
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 8px var(--accent-glow); }
  50% { text-shadow: 0 0 24px var(--accent-glow), 0 0 48px var(--accent-glow); }
}

/* ─── HERO SECTION ─── */
#hero {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#three-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-overlay {
  position: relative;
  z-index: 2;
  text-align: center;
  pointer-events: none;
}

.hero-overlay button {
  pointer-events: all;
}

.glitch {
  font-family: var(--font-display);
  font-size: clamp(64px, 12vw, 160px);
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 16px;
  position: relative;
  text-shadow: 0 0 40px var(--accent-glow), 0 0 80px var(--accent-glow);
  animation: glitch-flicker 4s step-end infinite;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch::before {
  color: var(--accent-alt);
  animation: glitch-shift-1 3s step-end infinite;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch::after {
  color: var(--accent-warm);
  animation: glitch-shift-2 2s step-end infinite;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitch-flicker {
  0%, 90%, 100% { opacity: 1; }
  91% { opacity: 0.8; }
  92% { opacity: 1; }
  93% { opacity: 0.6; }
}

@keyframes glitch-shift-1 {
  0%, 80%, 100% { transform: translate(0); }
  81% { transform: translate(-4px, 2px); }
  82% { transform: translate(4px, -2px); }
  83% { transform: translate(0); }
}

@keyframes glitch-shift-2 {
  0%, 70%, 100% { transform: translate(0); }
  71% { transform: translate(3px, -1px); }
  72% { transform: translate(-3px, 1px); }
  73% { transform: translate(0); }
}

.hero-sub {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-secondary);
  letter-spacing: 12px;
  margin-top: 8px;
}

.hero-mood {
  margin-top: 32px;
  font-family: var(--font-mono);
  font-size: 14px;
}

.mood-label {
  color: var(--text-dim);
}

.mood-value {
  color: var(--mood-color);
  font-weight: 700;
  margin-left: 8px;
  text-shadow: 0 0 12px var(--accent-glow);
  transition: color 1s ease;
}

.hero-stats {
  display: flex;
  gap: 48px;
  justify-content: center;
  margin-top: 40px;
}

.stat {
  text-align: center;
}

.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ─── BUTTONS ─── */
.btn-neon {
  margin-top: 40px;
  padding: 14px 40px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--accent);
  background: transparent;
  border: 2px solid var(--accent);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-neon:hover {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 0 30px var(--accent-glow), 0 0 60px var(--accent-glow);
}

.btn-neon.large {
  padding: 20px 60px;
  font-size: 18px;
}

.btn-neon.small {
  margin-top: 0;
  padding: 10px 20px;
  font-size: 12px;
  letter-spacing: 2px;
}

.btn-small {
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ─── SCROLL INDICATOR ─── */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 2;
}

.scroll-indicator span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--text-dim);
}

.scroll-arrow {
  width: 20px;
  height: 20px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(45deg);
  margin: 8px auto 0;
  animation: bounce-arrow 2s ease-in-out infinite;
}

@keyframes bounce-arrow {
  0%, 100% { transform: rotate(45deg) translateY(0); }
  50% { transform: rotate(45deg) translateY(8px); }
}

/* ─── GLASS CARD ─── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
}

/* ─── SECTIONS ─── */
section {
  padding: 120px 60px;
  max-width: 1400px;
  margin: 0 auto;
}

.section-header {
  margin-bottom: 48px;
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 4px;
  display: block;
  margin-bottom: 8px;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 900;
  letter-spacing: 4px;
}

.accent {
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent-glow);
}

.section-desc {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 700px;
  margin-bottom: 48px;
  line-height: 1.8;
}

/* ─── ABOUT GRID ─── */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.about-card {
  padding: 32px;
  transition: transform 0.3s, border-color 0.3s;
}

.about-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.about-card.featured {
  grid-column: 1 / -1;
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.05), rgba(255, 0, 170, 0.05));
}

.card-icon {
  font-size: 36px;
  margin-bottom: 16px;
}

.about-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 12px;
  color: var(--accent);
}

.about-card p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

/* ─── AGENT DASHBOARD ─── */
.agent-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.agent-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.3s;
}

.agent-card:hover {
  border-color: var(--accent);
}

.agent-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.agent-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #555;
}

.agent-status-dot.active {
  background: #00ff88;
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.agent-status-dot.inactive {
  background: #ff4444;
}

.agent-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-primary);
}

.agent-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 4px;
  letter-spacing: 1px;
}

.agent-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 16px;
}

.agent-metrics {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
}

.metric {
  text-align: center;
}

.metric-val {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.agent-toggle {
  display: flex;
  justify-content: flex-end;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #333;
  border-radius: 24px;
  transition: 0.3s;
}

.slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #888;
  border-radius: 50%;
  transition: 0.3s;
}

.switch input:checked + .slider {
  background: rgba(0, 240, 255, 0.3);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ─── AGENT LOG ─── */
.agent-log {
  padding: 20px;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 2px;
}

.log-feed {
  max-height: 200px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 2;
}

.log-feed::-webkit-scrollbar {
  width: 4px;
}

.log-feed::-webkit-scrollbar-track {
  background: transparent;
}

.log-feed::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 2px;
}

.log-entry {
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding: 2px 0;
}

.log-time {
  color: var(--text-dim);
  margin-right: 8px;
}

.log-agent {
  color: var(--accent);
  font-weight: 700;
  margin-right: 8px;
}

/* ─── LAB GRID ─── */
.lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.lab-card {
  padding: 32px;
  transition: transform 0.3s, border-color 0.3s;
}

.lab-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.lab-card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.lab-card p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 16px;
}

.tech-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 12px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 4px;
  display: inline-block;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ─── ARCHITECTURE DIAGRAM ─── */
.architecture-diagram {
  padding: 32px;
}

.architecture-diagram h3 {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 3px;
  color: var(--accent);
  margin-bottom: 24px;
}

.arch-ascii {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
}

/* ─── MANIFEST ─── */
.manifest-content {
  padding: 48px;
  margin-bottom: 80px;
}

.manifest-quote {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1.8;
  border-left: 3px solid var(--accent);
  padding-left: 24px;
  margin-bottom: 48px;
  font-style: italic;
}

.manifest-principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
}

.principle {
  padding: 16px 0;
}

.principle-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
  text-shadow: 0 0 12px var(--accent-glow);
}

.principle h4 {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 3px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.principle p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ─── CTA ─── */
.cta-section {
  text-align: center;
  padding: 80px 0;
}

.cta-section h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 900;
  letter-spacing: 4px;
  margin-bottom: 16px;
}

.cta-section p {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 32px;
}

/* ─── MODAL ─── */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  backdrop-filter: blur(8px);
  transition: opacity 0.3s, visibility 0.3s;
}

.modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-content {
  width: 90%;
  max-width: 600px;
  padding: 40px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 28px;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--accent);
}

.modal-content h2 {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 4px;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.bridge-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 16px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.bridge-indicator .status-dot {
  flex-shrink: 0;
}

.chat-feed {
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
}

.chat-msg-user {
  color: var(--accent-alt);
  margin-bottom: 4px;
}

.chat-msg-nexus {
  color: var(--accent);
  margin-bottom: 12px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

.chat-input-row input {
  flex: 1;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.3s;
}

.chat-input-row input:focus {
  border-color: var(--accent);
}

/* ─── FOOTER ─── */
footer {
  padding: 60px;
  border-top: 1px solid var(--glass-border);
  max-width: 1400px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 40px;
}

.footer-grid p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.8;
}

.footer-sub {
  font-family: var(--font-mono);
  font-size: 11px !important;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-top: 4px;
}

.footer-bottom {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-bottom p {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  #nav {
    padding: 12px 20px;
  }

  .nav-links {
    display: none;
  }

  section {
    padding: 80px 20px;
  }

  .hero-stats {
    gap: 24px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .architecture-diagram {
    display: none;
  }
}

/* ─── AMBIENT BACKGROUND ─── */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0, 240, 255, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(255, 0, 170, 0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(255, 107, 53, 0.02) 0%, transparent 50%);
  z-index: -1;
  pointer-events: none;
}
