/* ========================================================================== */
/* Saiwalo Labs Inc - saiwalolabs.com                                         */
/* Premium Tech R&D • Verdant Solar Punk & Biotechnology                      */
/* ========================================================================== */

/* ==================== COLOR SYSTEM & VARIABLES ==================== */
:root {
  /* Deep Forest Void & Monolith Palette */
  --bg-void: #010a06;
  --bg-deep: #02120a;
  --bg-1: #041b10;
  --bg-2: #062617;
  --bg-panel: rgba(4, 27, 16, 0.65);

  /* Core Bioluminescent Accents */
  --verdant: #10b981;
  --verdant-rgb: 16, 185, 129;
  --verdant-glow: #34d399;
  --accent-deep: #059669;
  --biolume: #d1fae5;
  --biolume-gold: #fbbf24;

  /* MycoPulse Product Accents */
  --mycopulse-violet: #a855f7;
  --hydro-cyan: #22d3ee;
  --wither-red: #ef4444;
  --wither-red-rgb: 239, 68, 68;
  --sapphire: #3b82f6;
  --amber: #f59e0b;

  /* Typography Colors */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  /* UI Geometry */
  --glass-border: rgba(52, 211, 153, 0.15);
  --glass-highlight: rgba(255, 255, 255, 0.05);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Typography */
  --display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Glow Effects */
  --glow-verdant: 0 0 20px rgba(var(--verdant-rgb), 0.5);
  --glow-red: 0 0 20px rgba(var(--wither-red-rgb), 0.5);
}

/* ==================== GLOBAL RESET & BASE ==================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 90px;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-void);
  color: var(--text-secondary);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Hardened Mobile Scroll Lock */
body.no-scroll {
  overflow: hidden;
  overscroll-behavior: none;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

/* ==================== BACKGROUND ENGINE ==================== */
#mycelium {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* ==================== LAYOUT & CONTAINERS ==================== */
.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  /* Notch-safe responsive padding */
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
}

.content-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  margin: 0 auto;
}

.panel-content-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.section {
  padding: 5rem 0;
  position: relative;
}

#main-content {
  position: relative;
  z-index: 10;
}

.hero {
  padding-top: max(8rem, 15vh);
  padding-bottom: 4rem;
  position: relative;
  z-index: 10;
  text-align: center;
}

.ambient-glow-wrapper {
  position: relative;
}

.ambient-glow-wrapper::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 90%; height: 90%;
  background: radial-gradient(circle, rgba(var(--verdant-rgb), 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}

.button-group {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 2.25rem;
  width: 100%;
  position: relative;
  z-index: 20;
}

/* ==================== PREMIUM UI PANELS & GRIDS ==================== */
.saiwalo-panel {
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2.75rem 2rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 var(--glass-highlight);
  position: relative;
  overflow: hidden;
  transition: transform 0.4s var(--ease-spring), border-color 0.4s ease;
  will-change: transform;
}

.saiwalo-panel:hover {
  border-color: rgba(var(--verdant-rgb), 0.4);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.75rem;
  margin-top: 2.5rem;
  width: 100%;
}

.stats-panel, .docs-card {
  padding: 2rem;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  text-align: left;
  will-change: transform;
}

.stats-panel {
  border-left: 4px solid var(--verdant);
}

.stats-panel:hover, .docs-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  border-color: rgba(var(--verdant-rgb), 0.4);
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 2.25rem;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  position: relative;
  overflow: hidden;
  z-index: 1;
  min-height: 48px;
  min-width: 180px;
  will-change: transform, box-shadow;
}

.btn-primary {
  background: var(--verdant);
  color: var(--bg-void);
  border: none;
  box-shadow: 0 0 15px rgba(var(--verdant-rgb), 0.3);
}

.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--verdant-glow);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(var(--verdant-rgb), 0.6);
}

.btn-secondary {
  background: transparent;
  color: var(--verdant-glow);
  border: 1px solid var(--verdant-glow);
  box-shadow: inset 0 0 10px rgba(var(--verdant-rgb), 0.1);
  animation: pulse-glow-animation 3s infinite alternate;
}

.btn-secondary:hover, .btn-secondary:focus-visible {
  animation: none;
  background: rgba(var(--verdant-rgb), 0.1);
  color: var(--text-primary);
  transform: translateY(-3px);
  box-shadow: inset 0 0 20px rgba(var(--verdant-rgb), 0.3), 0 0 20px rgba(var(--verdant-rgb), 0.2);
  border-color: var(--biolume);
}

@keyframes pulse-glow-animation {
  0%   { box-shadow: inset 0 0 12px rgba(var(--verdant-rgb), 0.25), 0 0 15px rgba(var(--verdant-rgb), 0.15); }
  50%  { box-shadow: inset 0 0 22px rgba(var(--verdant-rgb), 0.45), 0 0 30px rgba(var(--verdant-rgb), 0.35); }
  100% { box-shadow: inset 0 0 12px rgba(var(--verdant-rgb), 0.25), 0 0 15px rgba(var(--verdant-rgb), 0.15); }
}

.btn:focus-visible, .mushroom-card:focus-visible {
  outline: 2px solid var(--verdant-glow);
  outline-offset: 4px;
}

/* ==================== TYPOGRAPHY ==================== */
h1, h2, h3, h4 {
  font-family: var(--display);
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero-headline {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.hero-headline span {
  color: var(--verdant);
  text-shadow: var(--glow-verdant);
}

.section-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  margin-bottom: 2rem;
  text-align: center;
}

.high-legibility-text {
  color: var(--text-primary);
  opacity: 0.95;
  font-weight: 400;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.color-biolume {
  color: var(--biolume);
  text-shadow: var(--glow-verdant);
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.25rem);
  max-width: 78ch;
  margin: 0 auto 2.25rem;
  line-height: 1.7;
}

/* ==================== NAVIGATION ==================== */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1rem 0;
  z-index: 100;
  transition: all 0.4s ease;
  background: transparent;
}

body.scrolled nav {
  background: rgba(2, 18, 10, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  padding: 0.75rem 0;
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-mark img {
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(var(--verdant-rgb), 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}

.brand:hover .brand-mark img {
  transform: scale(1.1);
  box-shadow: 0 0 25px rgba(var(--verdant-rgb), 0.6);
}

.brand-text {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  color: var(--text-primary);
}

.nav-links {
  display: flex;
  gap: 2.25rem;
  align-items: center;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--verdant-glow);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--verdant-glow);
  transition: width 0.3s ease;
}

.nav-links a:hover::after, .nav-links a.active::after {
  width: 100%;
}

/* ==================== MOBILE MENU ==================== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 32px;
  height: 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 102;
  padding: 4px;
}

.hamburger span {
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
  transition: all 0.3s ease;
  border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
  background-color: var(--verdant-glow);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-10px) rotate(-45deg);
  background-color: var(--verdant-glow);
}

.mobile-menu {
  position: fixed;
  inset: 0;
  min-height: 100dvh;
  background: rgba(2, 18, 10, 0.98);
  backdrop-filter: blur(20px);
  z-index: 101;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-30px);
  transition: all 0.4s var(--ease-spring);
}

.mobile-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mobile-menu .nav-links {
  flex-direction: column;
  gap: 2.25rem;
  text-align: center;
}

.mobile-menu .nav-links a {
  font-size: 1.55rem;
}

/* ==================== MYCOPULSE & HERO ARCHITECTURE ==================== */
.hero-mark {
  width: 168px;
  height: 168px;
  margin: 0 auto 2.25rem;
  background: rgba(255, 255, 255, 0.035);
  border-radius: 50px;
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 60px rgba(212, 255, 159, 0.25);
}

.hero-mark img {
  width: 80%;
  filter: drop-shadow(0 0 58px rgba(212, 255, 159, 0.75));
}

.hero-logo-optimized {
  width: 100%;
  max-width: clamp(160px, 22vw, 260px);
  height: auto;
  margin: 0 auto 2rem;
  display: block;
  filter: drop-shadow(0 0 65px rgba(var(--verdant-rgb), 0.45));
  cursor: pointer;
  transition: transform 0.4s var(--ease-spring), filter 0.4s ease;
  will-change: transform, filter;
  transform: translateZ(0);
}

.hero-logo-optimized:hover {
  transform: scale(1.05) translateY(-5px) translateZ(0);
  filter: drop-shadow(0 0 85px rgba(var(--verdant-rgb), 0.8));
}

.mycelium-network-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(1.75rem, 5vw, 3.5rem);
  margin: 2rem auto 3rem;
  padding: 2.5rem 1.5rem;
  background: rgba(4, 27, 16, 0.4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 0 40px rgba(0,0,0,0.6);
  position: relative;
}

.mushroom-node {
  width: clamp(85px, 14vw, 130px);
  height: auto;
  cursor: pointer;
  transition: transform 0.4s var(--ease-spring), filter 0.4s ease;
  animation: float-node 6s ease-in-out infinite;
  will-change: transform;
}

.mushroom-node:nth-child(1) { animation-delay: 0s; }
.mushroom-node:nth-child(2) { animation-delay: -2s; }
.mushroom-node:nth-child(3) { animation-delay: -4s; }

@keyframes float-node {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.mushroom-node:hover {
  animation-play-state: paused;
  transform: translateY(-12px) scale(1.15) !important;
  z-index: 10;
}

.shroom-node-sapphire { filter: drop-shadow(0 0 25px rgba(59, 130, 246, 0.5)); }
.shroom-node-violet { filter: drop-shadow(0 0 25px rgba(168, 85, 247, 0.5)); }
.shroom-node-verdant {
  transform: scale(1.15);
  filter: drop-shadow(0 0 35px rgba(var(--verdant-rgb), 0.6));
}
.shroom-node-verdant:hover { transform: translateY(-12px) scale(1.3) !important; }

.section-thread {
  width: 2px;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--verdant), transparent);
  margin: 0 auto;
  opacity: 0.5;
}

/* Enterprise Grid Mesh */
.mycelium-network-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 3.5rem auto 2.5rem;
  text-align: left;
}

.mushroom-card {
  background: var(--bg-panel);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.75rem;
  transition: all 0.4s var(--ease-spring);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.3);
  z-index: 2;
  will-change: transform, box-shadow;
  transform: translateZ(0); 
}

.mushroom-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(var(--verdant-rgb), 0.15), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.mushroom-card:hover {
  transform: translateY(-8px) translateZ(0);
  border-color: var(--verdant);
  box-shadow: 0 25px 60px rgba(var(--verdant-rgb), 0.15);
}

.mushroom-card:hover::before { opacity: 1; }

.mushroom-card .node-badge {
  width: 100px;
  height: 100px;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

.mushroom-card:hover .node-badge {
  transform: scale(1.15) rotate(4deg);
}

.card-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.node-tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.35rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--text-muted);
}

.node-title {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
}

.node-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
}

/* ==================== DOCS & CONTACT SPECIFIC ==================== */
.docs-search {
  width: 100%;
  max-width: 580px;
  margin: 2.5rem auto 0;
  position: relative;
}

.docs-search input {
  width: 100%;
  padding: 1.1rem 1.5rem 1.1rem 3.2rem;
  border-radius: 50px;
  border: 1px solid rgba(212, 255, 159, 0.15);
  background: rgba(4, 27, 16, 0.6);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.docs-search input:focus {
  border-color: var(--biolume);
  box-shadow: 0 0 20px rgba(212, 255, 159, 0.1);
  background: rgba(4, 27, 16, 0.85);
}

.docs-search input::placeholder { color: rgba(255, 255, 255, 0.4); }

.docs-search svg {
  position: absolute;
  left: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(212, 255, 159, 0.5);
  pointer-events: none;
}

.contact-glass {
  max-width: 680px;
  margin: 0 auto;
  padding: 4rem 2rem;
  text-align: center;
}

/* ==================== FOOTER ==================== */
footer {
  border-top: 1px solid var(--glass-border);
  padding: 3.5rem 0 2.5rem;
  text-align: center;
  background: linear-gradient(to top, var(--bg-void), transparent);
}

.footer-brand {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.footer-brand span { color: var(--verdant); }

.footer-copy { 
  font-size: 0.9rem; 
  color: var(--text-muted); 
}

.footer-copy a { 
  color: var(--text-secondary);
}

.footer-copy a:hover { 
  color: var(--verdant-glow); 
}

/* ==================== RESPONSIVE BREAKPOINTS ==================== */
@media (min-width: 1024px) {
  .mycelium-network-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .central-nexus-card {
    grid-column: span 3;
    flex-direction: row;
    text-align: left;
    padding: 4rem;
    background: linear-gradient(135deg, rgba(30, 8, 8, 0.6), rgba(4, 27, 16, 0.65));
    border: 1px solid rgba(var(--wither-red-rgb), 0.3);
    box-shadow: 0 25px 65px rgba(var(--wither-red-rgb), 0.1);
    gap: 4rem;
  }
  
  .central-nexus-card::before {
    background: radial-gradient(circle at 20% 50%, rgba(var(--wither-red-rgb), 0.15), transparent 70%);
  }

  .central-nexus-card:hover {
    border-color: var(--wither-red);
    box-shadow: 0 30px 85px rgba(var(--wither-red-rgb), 0.25);
  }
  
  .central-nexus-card .node-badge {
    width: 160px;
    height: 160px;
    flex-shrink: 0;
  }
}

@media (max-width: 960px) {
  .nav-inner .nav-links,
  .nav-inner > .btn {
    display: none !important;
  }

  .hamburger {
    display: flex !important;
  }

  .hero-headline {
    font-size: clamp(2.2rem, 8vw, 3.2rem);
  }
}

@media (max-width: 768px) {
  .section {
    padding: 3.75rem 0;
  }
  .log-entry {
    flex-direction: column;
    gap: 0.5rem;
  }
  .log-date {
    margin-bottom: 0.2rem;
  }
  .button-group {
    flex-direction: column;
    gap: 1.15rem;
    width: 100%;
    padding: 0 1rem;
  }
  .btn { 
    width: 100%; 
    max-width: 350px;
  }
  .hero-headline { 
    font-size: clamp(2.5rem, 8vw, 3.5rem);
  }
  .hero-subtitle {
    padding: 0 1rem;
  }
  .saiwalo-panel {
    padding: 2rem 1.5rem;
  }
  .mycelium-network-container {
    padding: 2rem 1rem;
  }
}

@media (max-width: 480px) {
  .hero {
    padding-top: max(6rem, 12vh);
    padding-bottom: 3rem;
  }
  .contact-glass {
    padding: 3rem 1.5rem;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, .mushroom-card, .node-badge, .hero-logo-optimized, .mushroom-node {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}