/* === TOKENS === */
:root {
  --bg-deep: #080c14;
  --bg-section: #0a0f1a;
  --bg-card: #0e1521;
  --bg-glass: rgba(14, 21, 33, 0.8);
  --accent: #00d4ff;
  --accent-2: #7c3aed;
  --accent-3: #10b981;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
  --text-1: #f0f4f8;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --border: rgba(0, 212, 255, 0.12);
  --glow: 0 0 20px rgba(0, 212, 255, 0.25);
  --glow-sm: 0 0 10px rgba(0, 212, 255, 0.15);
  --radius: 12px;
  --radius-lg: 20px;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-w: 1200px;
  --section-pad: clamp(4rem, 10vw, 8rem) clamp(1rem, 5vw, 2rem);
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-2);
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

/* === TYPOGRAPHY === */
h1 { font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 800; color: var(--text-1); line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.5rem); font-weight: 700; color: var(--text-1); line-height: 1.2; letter-spacing: -0.01em; }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); font-weight: 600; color: var(--text-1); }
.accent { color: var(--accent); }
.eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1rem;
}

/* === LAYOUT === */
.container { max-width: var(--max-w); margin: 0 auto; width: 100%; }
section { padding: var(--section-pad); }
.section-header { text-align: center; margin-bottom: 3rem; }
.section-header p { color: var(--text-2); max-width: 600px; margin: 1rem auto 0; }
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 3rem;
  align-items: center;
}

/* === NAV === */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.3s, backdrop-filter 0.3s;
}
nav.scrolled {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-1);
}
.nav-links { display: flex; gap: 1.5rem; list-style: none; }
.nav-links a {
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--accent); }
.nav-toggle { display: none; background: none; border: none; color: var(--text-1); font-size: 1.5rem; }

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    height: 100vh;
    flex-direction: column;
    background: var(--bg-card);
    padding: 5rem 2rem 2rem;
    gap: 2rem;
    transition: right 0.3s ease;
  }
  .nav-links.open { right: 0; }
  .nav-links a { font-size: 1.1rem; }
  .nav-toggle { display: block; z-index: 101; }
}

/* === HERO === */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 2rem 4rem;
  overflow: hidden;
}
#particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 700px;
}
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-2);
  margin: 1.5rem 0 2.5rem;
}
.btn-primary {
  display: inline-block;
  padding: 0.9rem 2.2rem;
  background: var(--accent);
  color: var(--bg-deep);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 50px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow);
}
.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s ease-in-out infinite;
  color: var(--text-3);
  font-size: 1.5rem;
}
@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* === STATS === */
#stats {
  padding: 3rem 2rem;
  background: var(--bg-section);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stats-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 2rem;
  text-align: center;
}
.stat-item .counter {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  color: var(--accent);
}
.stat-item .suffix {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--accent);
}
.stat-item p {
  font-size: 0.85rem;
  color: var(--text-3);
  margin-top: 0.25rem;
}

/* === SERVICE CARDS === */
.services-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}
.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.service-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--glow);
  border-color: var(--accent);
}
.service-card .icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  color: var(--accent);
}
.service-card h3 { margin-bottom: 0.5rem; }
.service-card .summary { font-size: 0.9rem; color: var(--text-2); }
.service-card .detail-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, margin-top 0.4s ease;
  margin-top: 0;
}
.service-card.expanded .detail-panel {
  max-height: 400px;
  margin-top: 1rem;
}
.detail-panel ul {
  list-style: none;
  padding: 0;
}
.detail-panel li {
  font-size: 0.85rem;
  color: var(--text-2);
  padding: 0.3rem 0;
  padding-left: 1.2rem;
  position: relative;
}
.detail-panel li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* === NETWORK TOPOLOGY === */
.topo-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topo-container svg { width: 100%; max-width: 500px; height: auto; }
.topo-node-core { animation: pulse-glow 2s ease-in-out infinite alternate; }
@keyframes pulse-glow {
  from { filter: drop-shadow(0 0 4px var(--accent)); }
  to { filter: drop-shadow(0 0 16px var(--accent)); }
}
.topo-packet {
  fill: var(--accent);
  opacity: 0.8;
}
@keyframes travel-1 { 0% { opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; } }

/* === DEVICE GRID === */
.device-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}
.device-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}
.device-cell:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}
.device-cell .device-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}
.device-cell .device-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-1);
}
.device-cell .device-count {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 0.25rem;
}
.device-cell[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-deep);
  color: var(--text-1);
  font-size: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

/* === SECURITY === */
.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  max-width: var(--max-w);
  margin: 0 auto;
}
.camera-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.2s;
}
.camera-card:hover { border-color: var(--accent-red); }
.camera-card .cam-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.camera-card h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.camera-card .cam-model { font-size: 0.8rem; color: var(--text-3); }
.camera-card .cam-tag {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border-radius: 50px;
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}
.sensor-summary {
  max-width: var(--max-w);
  margin: 2rem auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}
.sensor-badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-2);
}
.sensor-badge strong { color: var(--accent-3); }

/* === ENERGY === */
.energy-dashboard {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.energy-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}
.donut-wrap { position: relative; width: 160px; height: 160px; flex-shrink: 0; }
.donut-chart {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent-3) 0% 62%,
    var(--accent-amber) 62% 88%,
    #3b82f6 88% 100%
  );
  mask: radial-gradient(farthest-side, transparent 60%, black 61%);
  -webkit-mask: radial-gradient(farthest-side, transparent 60%, black 61%);
}
.donut-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-2);
}
.donut-label strong {
  font-size: 1.4rem;
  color: var(--text-1);
  font-weight: 700;
}
.energy-bars { flex: 1; min-width: 200px; }
.energy-bar-item { margin-bottom: 1rem; }
.energy-bar-item .bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}
.energy-bar-item .bar-label span:first-child { color: var(--text-2); }
.energy-bar-item .bar-label span:last-child { color: var(--text-1); font-weight: 600; }
.bar-track {
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  width: 0;
  transition: width 1.2s ease;
}
.bar-fill.solar { background: var(--accent-3); }
.bar-fill.grid { background: var(--accent-amber); }
.bar-fill.water { background: #3b82f6; }
.energy-legend {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-2);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* === TIMELINE === */
.timeline {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  padding-left: 2rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-step {
  position: relative;
  padding-bottom: 2.5rem;
}
.timeline-step:last-child { padding-bottom: 0; }
.timeline-step .step-dot {
  position: absolute;
  left: -1.55rem;
  top: 0.2rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent);
}
.timeline-step.visible .step-dot {
  background: var(--accent);
  color: var(--bg-deep);
}
.timeline-step h3 { margin-bottom: 0.3rem; }
.timeline-step p { font-size: 0.9rem; }

/* === COMPARISON === */
.comparison-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 2rem;
}
.comparison-card {
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.comparison-card.burden {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.comparison-card.benefit {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.comparison-card h3 { margin-bottom: 1.5rem; }
.comparison-card.burden h3 { color: var(--accent-red); }
.comparison-card.benefit h3 { color: var(--accent-3); }
.comparison-card ul { list-style: none; }
.comparison-card li {
  padding: 0.6rem 0;
  padding-left: 1.8rem;
  position: relative;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.comparison-card li:last-child { border-bottom: none; }
.comparison-card li::before {
  position: absolute;
  left: 0;
  top: 0.7rem;
  font-size: 1rem;
}
.comparison-card.burden li::before { content: '\2717'; color: var(--accent-red); }
.comparison-card.benefit li::before { content: '\2713'; color: var(--accent-3); }

/* === CONTACT === */
#contact { background: var(--bg-section); }
.contact-form {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
}
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 100px; }
.form-group select { appearance: none; cursor: pointer; }
.form-submit {
  display: inline-block;
  padding: 0.85rem 2rem;
  background: var(--accent);
  color: var(--bg-deep);
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 50px;
  transition: transform 0.2s, box-shadow 0.2s;
  align-self: center;
  margin-top: 0.5rem;
}
.form-submit:hover { transform: translateY(-2px); box-shadow: var(--glow); }
.form-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
#form-status {
  text-align: center;
  font-size: 0.9rem;
  color: var(--accent-3);
  min-height: 1.5em;
  margin-top: 0.5rem;
}

/* === FOOTER === */
footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.8rem;
  color: var(--text-3);
  border-top: 1px solid var(--border);
}

/* === SCROLL ANIMATIONS === */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
[data-animate].visible {
  opacity: 1;
  transform: none;
}
[data-animate][style*="--i"] {
  transition-delay: calc(var(--i) * 80ms);
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  #particle-canvas { display: none; }
  [data-animate] { opacity: 1; transform: none; }
}
