/* ============================================================
   iibdaei — site-1-industrial
   Bold Industrial × Product, warm Najdi palette
   ============================================================ */

:root {
  --sand: #F5EFE3;
  --cream: #FBF8F2;
  --palm: #0B5C45;
  --ink: #0E1A14;
  --gold: #C9A227;
  --warmink: #241D12;
  --warmmuted: #7A715F;
}

html { scroll-behavior: auto; }      /* Lenis owns scrolling */
body { overflow-x: hidden; }

/* Respect Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* Selection */
::selection { background: var(--gold); color: var(--ink); }

/* Focus visibility (a11y) */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Grain + scanline atmosphere overlay ---------- */
.grain-overlay {
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(36,29,18,0.018) 2px 3px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
  background-size: auto, 160px 160px;
}

/* ---------- Blueprint grid backgrounds ---------- */
.hero-grid {
  background-image:
    linear-gradient(rgba(245,239,227,0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,239,227,0.10) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 40%, #000 30%, transparent 80%);
          mask-image: radial-gradient(ellipse 80% 70% at 30% 40%, #000 30%, transparent 80%);
}
.grid-bg-faint {
  background-image:
    linear-gradient(rgba(245,239,227,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,239,227,0.06) 1px, transparent 1px);
  background-size: 64px 64px;
}

/* ---------- Nav states ---------- */
#nav.nav-solid {
  background: rgba(251,248,242,0.86);
  -webkit-backdrop-filter: blur(14px);
          backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(36,29,18,0.06);
}
.nav-link {
  position: relative;
  color: var(--sand);
  transition: color .3s ease;
}
#nav.nav-solid .nav-link { color: var(--warmmuted); }
.nav-link::after {
  content: "";
  position: absolute; left: 0; bottom: -6px;
  height: 1.5px; width: 0;
  background: var(--gold);
  transition: width .35s cubic-bezier(0.16,1,0.3,1);
}
.nav-link:hover { color: var(--gold); }
#nav.nav-solid .nav-link:hover { color: var(--palm); }
.nav-link:hover::after { width: 100%; }

/* Wordmark legibility on transparent hero */
.nav-wordmark { color: var(--sand); transition: color .3s ease; }
#nav.nav-solid .nav-wordmark { color: var(--palm); }

/* ---------- Mobile menu open state ---------- */
#mobile-menu.open { transform: translateY(0); }
#menu-btn[aria-expanded="true"] .menu-icon span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#menu-btn[aria-expanded="true"] .menu-icon span:nth-child(2) { opacity: 0; }
#menu-btn[aria-expanded="true"] .menu-icon span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Bracket corners on instruments ---------- */
.instrument .bracket-tl,
.instrument .bracket-br {
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid var(--gold);
  opacity: .65;
  pointer-events: none;
}
.instrument .bracket-tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.instrument .bracket-br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }

/* ---------- Instrument animations ---------- */

/* Signal bars (Pillar 01) */
.sig-bar { transform-box: fill-box; transform-origin: bottom; animation: sigPulse 1.8s ease-in-out infinite; }
.sig-bar:nth-child(2){ animation-delay:.1s } .sig-bar:nth-child(3){ animation-delay:.2s }
.sig-bar:nth-child(4){ animation-delay:.3s } .sig-bar:nth-child(5){ animation-delay:.4s }
.sig-bar:nth-child(6){ animation-delay:.5s } .sig-bar:nth-child(7){ animation-delay:.6s }
@keyframes sigPulse { 0%,100%{ transform: scaleY(.6) } 50%{ transform: scaleY(1) } }
.sig-ring { transform-box: fill-box; transform-origin: center; animation: ringPing 2s ease-out infinite; }
@keyframes ringPing { 0%{ transform: scale(1); opacity:.9 } 100%{ transform: scale(4); opacity:0 } }

/* Oscilloscope wave (Pillar 02) */
.scope-wave { stroke-dasharray: 6 5; animation: scopeDash 1.4s linear infinite; }
@keyframes scopeDash { to { stroke-dashoffset: -44; } }

/* Network nodes (Pillar 03) */
.net-node { transform-box: fill-box; transform-origin: center; animation: nodeGlow 2.4s ease-in-out infinite; }
.net-node:nth-child(2){ animation-delay:.4s } .net-node:nth-child(4){ animation-delay:.8s } .net-node:nth-child(5){ animation-delay:1.2s }
.net-core { animation-duration: 1.8s; }
@keyframes nodeGlow { 0%,100%{ opacity:.55 } 50%{ opacity:1 } }
.net-edge { stroke-dasharray: 4 4; animation: edgeFlow 1.6s linear infinite; }
@keyframes edgeFlow { to { stroke-dashoffset: -16; } }

/* Gauge needle + arc (Pillar 04) — driven by GSAP on reveal, idle sweep fallback */
.gauge-needle { transform: rotate(-15deg); }

/* Radar sweep (Pillar 05) */
.radar-sweep { animation: radarSpin 3.2s linear infinite; }
@keyframes radarSpin { to { transform: rotate(360deg); } }
.radar-blip { transform-box: fill-box; transform-origin: center; animation: blip 3.2s ease-in-out infinite; }
@keyframes blip { 0%,18%{ opacity:0 } 22%{ opacity:1 } 60%,100%{ opacity:0 } }

/* ---------- Magnetic CTA base ---------- */
.magnetic { will-change: transform; }

/* ---------- Reveal base (GSAP toggles) ---------- */
.reveal { opacity: 0; transform: translateY(26px); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Footer links ---------- */
.footer-link { transition: color .3s ease; }
.footer-link:hover { color: var(--gold); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .hero-line, .hero-sub, .hero-cta { opacity: 1 !important; }
  .hero-word span { transform: none !important; }
  .nav-rule { transform: scaleX(1) !important; }
}

/* ---------- Small screens: keep video covering, tighten HUD ---------- */
@media (max-width: 640px) {
  .hero-grid {
    -webkit-mask-image: radial-gradient(ellipse 120% 70% at 50% 35%, #000 30%, transparent 85%);
            mask-image: radial-gradient(ellipse 120% 70% at 50% 35%, #000 30%, transparent 85%);
  }
}

/* mobile overflow guard */
html,body{overflow-x:hidden;max-width:100%;}

/* --- robust mobile fixes --- */
@media (max-width:600px){
  h1.font-display{font-size:clamp(1.4rem,6vw,1.98rem)!important;line-height:1.07!important;}
  section,main,[class*="grid"]{min-width:0!important;}
  [class*="max-w-"]{max-width:100%!important;}
}
