/* ===== PORTAL CORE STYLES ===== */
:root {
  /* Portal Core Colors */
  --portal-primary: #00f5d4;
  --portal-secondary: #9d4edd;
  --portal-accent: #ff6b6b;
  --portal-bg: #030712;
  --portal-glass: rgba(15, 23, 42, 0.85);
  --terminal-green: #00ff9d;
  --terminal-dim: #008f5d;
  --quic-blue: #00b4d8;
  --ws-orange: #ff9e64;
  --cdn-purple: #9d4edd;
  
  /* Network Status */
  --status-online: #00ff9d;
  --status-syncing: #ffd166;
  --status-warning: #ff6b6b;
  
  /* Typography */
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-display: 'Orbitron', 'Exo 2', sans-serif;
}

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Orbitron:wght@500;700;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  cursor: default;
}

body {
  font-family: var(--font-mono);
  background: var(--portal-bg);
  color: #e2e8f0;
  overflow-x: hidden;
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== PORTAL CORE OVERLAY ===== */
#portal-overlay {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 80%, rgba(157,78,221,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0,245,212,0.06) 0%, transparent 50%),
    repeating-linear-gradient(0deg, rgba(3,7,18,0.9) 0px, rgba(3,7,18,0.9) 1px, transparent 1px, transparent 20px),
    repeating-linear-gradient(90deg, rgba(3,7,18,0.9) 0px, rgba(3,7,18,0.9) 1px, transparent 1px, transparent 20px);
  pointer-events: none;
  z-index: 1;
  animation: gridPulse 20s linear infinite;
}
@keyframes gridPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.95; }
}

/* ===== THREE.JS CANVAS ===== */
#network-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ===== CUSTOM CURSOR ===== */
.portal-cursor {
  position: fixed;
  width: 22px; height: 22px;
  border: 2px solid var(--portal-primary);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 10000;
  transition: all 0.08s ease;
  mix-blend-mode: screen;
  box-shadow: 0 0 12px var(--portal-primary), inset 0 0 8px var(--portal-primary);
}
.portal-cursor.hover {
  width: 32px; height: 32px;
  background: rgba(0,245,212,0.15);
  border-color: var(--portal-accent);
  box-shadow: 0 0 20px var(--portal-accent), inset 0 0 12px var(--portal-accent);
}
.portal-cursor::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 4px; height: 4px;
  background: var(--portal-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* ===== LOADING STATE ===== */
.portal-loading {
  position: fixed;
  inset: 0;
  background: var(--portal-bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  transition: opacity 0.5s, visibility 0.5s;
}
.portal-loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loading-spinner {
  width: 80px; height: 80px;
  border: 3px solid rgba(0,245,212,0.2);
  border-top-color: var(--portal-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

.loading-text {
  font-family: var(--font-mono);
  color: var(--terminal-green);
  font-size: 0.9rem;
}
.loading-progress {
  width: 200px;
  height: 4px;
  background: rgba(0,245,212,0.1);
  border-radius: 2px;
  margin-top: 1rem;
  overflow: hidden;
}
.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--portal-primary), var(--portal-secondary));
  animation: loadProgress 3s ease-in-out forwards;
}
@keyframes loadProgress { to { width: 100%; } }

/* ===== MAIN CONTENT LAYOUT ===== */
.portal-main {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  padding-top: 48px;
}

.portal-hero {
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  position: relative;
}

.portal-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--portal-primary), var(--portal-secondary), var(--portal-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientFlow 6s ease infinite;
  position: relative;
  margin-bottom: 1rem;
}
@keyframes gradientFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.portal-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--portal-primary);
  max-width: 700px;
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(20px);
}

.portal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 2rem auto;
  opacity: 0;
}
.stat-card {
  background: var(--portal-glass);
  border: 1px solid rgba(0,245,212,0.3);
  border-radius: 12px;
  padding: 1.2rem;
  text-align: center;
  backdrop-filter: blur(10px);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--portal-primary);
  display: block;
}
.stat-label {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.3rem;
}

/* ===== CONTENT SECTIONS ===== */
.portal-content {
  max-width: 1300px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
  opacity: 0;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--portal-secondary);
  margin-bottom: 0.5rem;
}
.section-header p {
  color: #94a3b8;
  max-width: 600px;
  margin: 0 auto;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 2rem;
}

.absurd-card {
  background: var(--portal-glass);
  border: 1px solid rgba(157,78,221,0.4);
  border-radius: 16px;
  padding: 2rem;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px);
  transition: border-color 0.3s, transform 0.3s;
}
.absurd-card:hover {
  border-color: var(--portal-primary);
  transform: translateY(-5px);
}

.absurd-card::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0,245,212,0.1), transparent);
  transition: left 0.6s ease;
}
.absurd-card:hover::before { left: 100%; }

.card-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed rgba(157,78,221,0.4);
}
.card-icon { font-size: 1.8rem; }
.card-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--portal-primary);
}

.card-body {
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.protocol-requirement {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}
.req-badge {
  padding: 0.25rem 0.6rem;
  background: rgba(0,180,216,0.15);
  border: 1px solid var(--quic-blue);
  border-radius: 4px;
  font-size: 0.7rem;
  color: var(--quic-blue);
}
.req-badge.ws { 
  background: rgba(255,158,100,0.15); 
  border-color: var(--ws-orange); 
  color: var(--ws-orange); 
}
.req-badge.cdn { 
  background: rgba(157,78,221,0.15); 
  border-color: var(--cdn-purple); 
  color: var(--cdn-purple); 
}

.steps-list {
  list-style: none;
  counter-reset: step-counter;
  margin: 1.5rem 0;
}
.steps-list li {
  counter-increment: step-counter;
  padding-left: 2.5rem;
  position: relative;
  margin: 1rem 0;
  opacity: 0;
  transform: translateX(-15px);
}
.steps-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0; top: 0;
  width: 1.8rem; height: 1.8rem;
  background: linear-gradient(135deg, var(--portal-secondary), var(--portal-accent));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 0 12px rgba(157,78,221,0.5);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px dashed rgba(0,245,212,0.3);
  font-size: 0.8rem;
  color: #94a3b8;
}
.sync-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sync-dot {
  width: 6px; height: 6px;
  background: var(--status-syncing);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(0.9); } }

/* ===== FOOTER ===== */
.portal-footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid rgba(0,245,212,0.3);
  margin-top: 4rem;
  opacity: 0;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--portal-primary);
  text-decoration: none;
  font-weight: 600;
  position: relative;
  padding: 0.3rem 0;
  transition: all 0.3s;
}
.footer-links a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 2px;
  background: var(--portal-accent);
  transition: width 0.3s;
}
.footer-links a:hover::after { width: 100%; }

.footer-meta {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.8;
}
.footer-meta strong { color: var(--terminal-green); }
.footer-disclaimer {
  margin-top: 1rem;
  opacity: 0.7;
  font-style: italic;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .network-panel { display: none; }
  .terminal-panel { left: 0.5rem; right: 0.5rem; }
}
@media (max-width: 768px) {
  .portal-status-bar { padding: 0 1rem; font-size: 0.7rem; }
  .protocol-tags { gap: 0.3rem; }
  .proto-tag { padding: 0.15rem 0.4rem; font-size: 0.65rem; }
  .portal-title { font-size: 2.5rem; }
  .card-grid { grid-template-columns: 1fr; }
}