/* ============================================================
   khan.systems — Autonomous Systems
   Design System / Global Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900&family=Bebas+Neue&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600&family=Share+Tech+Mono&display=swap');

:root {
  /* Core palette */
  --void: #050810;
  --void-2: #070b16;
  --panel: #0a1018;
  --panel-2: #0c1320;
  --line: rgba(0, 229, 255, 0.14);
  --line-soft: rgba(0, 229, 255, 0.07);
  --line-strong: rgba(0, 229, 255, 0.45);

  --cyan: #00e5ff;
  --cyan-dim: #08adc0;
  --cyan-deep: #063b46;
  --amber: #ff9d2e;   /* secondary status accent, used sparingly */

  --white: #e9eef4;
  --titanium: #c4ccd6;
  --muted: #7d8a99;
  --muted-2: #4d5868;

  --glow: 0 0 28px rgba(0, 229, 255, 0.35);
  --glow-soft: 0 0 18px rgba(0, 229, 255, 0.18);

  --font-display: 'Exo 2', sans-serif;
  --font-head: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;

  --nav-h: 78px;
  --nav-h-compact: 58px;
  --maxw: 1340px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--void);
  color: var(--titanium);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* Global ambient grid + scanlines */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 35%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 35%, transparent 90%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.10) 3px
  );
  mix-blend-mode: overlay;
  opacity: 0.4;
}

::selection { background: var(--cyan); color: var(--void); }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: none; }

/* ============================================================
   Custom cursor
   ============================================================ */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  will-change: transform;
}
.cursor-dot {
  width: 22px; height: 22px;
}
.cursor-dot::before, .cursor-dot::after {
  content: "";
  position: absolute;
  background: var(--cyan);
  box-shadow: var(--glow-soft);
}
.cursor-dot::before { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-50%); }
.cursor-dot::after { top: 50%; left: 0; height: 1px; width: 100%; transform: translateY(-50%); }
.cursor-ring {
  width: 30px; height: 30px;
  border: 1px solid rgba(0, 229, 255, 0.55);
  border-radius: 50%;
  transition: width 0.22s var(--ease), height 0.22s var(--ease),
              background 0.22s var(--ease), border-color 0.22s var(--ease);
}
body.cursor-active .cursor-ring {
  width: 52px; height: 52px;
  background: rgba(0, 229, 255, 0.08);
  border-color: var(--cyan);
}
.has-cursor, .has-cursor * { cursor: none; }
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none !important; }
  .has-cursor, .has-cursor * { cursor: auto; }
  button, a { cursor: pointer; }
}

/* ============================================================
   HUD corner brackets + scroll progress
   ============================================================ */
.hud-corners { position: fixed; inset: 0; z-index: 8000; pointer-events: none; }
.hud-corner {
  position: absolute;
  width: 46px; height: 46px;
  border: 1px solid var(--line-strong);
  opacity: 0;
  transition: opacity 0.8s var(--ease) 0.3s, transform 0.8s var(--ease) 0.3s;
}
.boot-done .hud-corner { opacity: 0.7; }
.hud-corner.tl { top: 22px; left: 22px; border-right: 0; border-bottom: 0; transform: translate(-12px,-12px); }
.hud-corner.tr { top: 22px; right: 22px; border-left: 0; border-bottom: 0; transform: translate(12px,-12px); }
.hud-corner.bl { bottom: 22px; left: 22px; border-right: 0; border-top: 0; transform: translate(-12px,12px); }
.hud-corner.br { bottom: 22px; right: 22px; border-left: 0; border-top: 0; transform: translate(12px,12px); }
.boot-done .hud-corner.tl, .boot-done .hud-corner.tr,
.boot-done .hud-corner.bl, .boot-done .hud-corner.br { transform: translate(0,0); }

.scroll-rail {
  position: fixed;
  top: 50%; right: 14px;
  transform: translateY(-50%);
  width: 2px; height: 180px;
  background: rgba(255,255,255,0.06);
  z-index: 8000;
}
.scroll-rail .fill {
  position: absolute; top: 0; left: 0; width: 100%; height: 0%;
  background: var(--cyan);
  box-shadow: var(--glow-soft);
}
.scroll-rail .pct {
  position: absolute; left: -6px; bottom: -22px;
  font-family: var(--font-mono); font-size: 9px; color: var(--cyan-dim);
  transform: translateX(-100%);
  white-space: nowrap;
}
@media (max-width: 900px) { .scroll-rail { display: none; } }

/* ============================================================
   Boot + page transition overlays
   ============================================================ */
#boot {
  position: fixed; inset: 0; z-index: 10050;
  background: var(--void);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 22px;
}
#boot .boot-scan {
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 22px var(--cyan);
  animation: bootScan 1.1s var(--ease) forwards;
}
@keyframes bootScan { 0%{top:0; opacity:1;} 92%{opacity:1;} 100%{top:100%; opacity:0;} }
#boot .boot-mark {
  font-family: var(--font-display); font-weight: 800; letter-spacing: 0.04em;
  font-size: clamp(22px, 4vw, 34px); color: var(--white);
}
#boot .boot-mark .dot { color: var(--cyan); }
#boot .boot-readout { font-family: var(--font-mono); font-size: 11px; color: var(--cyan-dim); letter-spacing: 0.18em; }
#boot.hide { opacity: 0; visibility: hidden; transition: opacity 0.5s ease, visibility 0.5s ease; }

#wipe {
  position: fixed; inset: 0; z-index: 10040;
  background: linear-gradient(120deg, var(--cyan) 0%, #00b8d0 55%, var(--cyan) 100%);
  transform: scaleY(0); transform-origin: top;
  pointer-events: none;
  mix-blend-mode: screen;
}
#wipe.run { animation: wipeFlash 0.46s var(--ease) forwards; }
@keyframes wipeFlash {
  0% { transform: scaleY(0); transform-origin: top; }
  45% { transform: scaleY(1); transform-origin: top; }
  46% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 9000;
  display: flex; align-items: center;
  padding: 0 clamp(18px, 4vw, 48px);
  background: rgba(5, 8, 16, 0.55);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
  transition: height 0.35s var(--ease), background 0.35s var(--ease);
}
.nav.compact { height: var(--nav-h-compact); background: rgba(5, 8, 16, 0.82); }

.brand {
  font-family: var(--font-display); font-weight: 800;
  font-size: 21px; letter-spacing: 0.02em; color: var(--white);
  display: flex; align-items: center; gap: 1px;
  white-space: nowrap;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--cyan); margin: 0 2px;
  box-shadow: 0 0 10px var(--cyan), 0 0 22px var(--cyan);
  animation: pulseDot 2.1s ease-in-out infinite;
  display: inline-block;
}
@keyframes pulseDot {
  0%,100% { box-shadow: 0 0 8px var(--cyan), 0 0 16px var(--cyan); transform: scale(1); }
  50% { box-shadow: 0 0 16px var(--cyan), 0 0 34px var(--cyan); transform: scale(1.22); }
}
.brand .sys { color: var(--titanium); font-weight: 600; }

.nav-links { display: flex; align-items: center; gap: clamp(20px, 2.4vw, 40px); margin-left: auto; }
.nav-link {
  position: relative;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
  padding: 8px 2px;
  transition: color 0.25s var(--ease);
}
.nav-link:hover { color: var(--white); }
.nav-link::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: var(--cyan); transform: scaleX(0); transform-origin: left;
  transition: transform 0.32s var(--ease);
}
.nav-link:hover::after { transform: scaleX(1); }
.nav-link.active { color: var(--white); }
.nav-link.active .ind {
  position: absolute; left: 50%; bottom: -3px; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}
.nav-cta {
  position: relative; overflow: hidden;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--cyan); background: transparent;
  border: 1px solid var(--line-strong);
  padding: 11px 20px; margin-left: 12px;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.nav-cta span { position: relative; z-index: 2; }
.nav-cta::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(110deg, var(--cyan), #00b8d0);
  transform: translateX(-101%); transition: transform 0.4s var(--ease);
}
.nav-cta:hover { color: var(--void); border-color: var(--cyan); }
.nav-cta:hover::before { transform: translateX(0); }

.nav-burger {
  display: none; margin-left: auto;
  width: 40px; height: 40px; background: transparent; border: 1px solid var(--line);
  position: relative;
}
.nav-burger span { position: absolute; left: 9px; right: 9px; height: 1.5px; background: var(--cyan); transition: 0.3s var(--ease); }
.nav-burger span:nth-child(1) { top: 13px; }
.nav-burger span:nth-child(2) { top: 19px; }
.nav-burger span:nth-child(3) { top: 25px; }
.nav-burger.open span:nth-child(1) { top: 19px; transform: rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { top: 19px; transform: rotate(-45deg); }

@media (max-width: 880px) {
  .nav-burger { display: block; }
  .nav-links {
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: rgba(7, 11, 22, 0.97); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--line);
    padding: 14px clamp(18px, 4vw, 48px) 28px;
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: 0.3s var(--ease);
  }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-link { width: 100%; padding: 16px 0; font-size: 14px; border-bottom: 1px solid var(--line-soft); }
  .nav-cta { margin: 16px 0 0; width: 100%; text-align: center; padding: 15px; }
}

/* ============================================================
   Layout primitives
   ============================================================ */
.page { display: none; position: relative; z-index: 1; }
.page.active { display: block; }
.shell { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 4vw, 48px); }
.section { padding: clamp(72px, 10vw, 130px) 0; position: relative; }

.kicker {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.34em;
  text-transform: uppercase; color: var(--cyan-dim);
  display: inline-flex; align-items: center; gap: 12px;
}
.kicker::before { content: ""; width: 28px; height: 1px; background: var(--cyan-dim); display: inline-block; }

.h-display {
  font-family: var(--font-display); font-weight: 800; line-height: 0.92;
  letter-spacing: -0.01em; color: var(--white);
}
.h-head {
  font-family: var(--font-head); font-weight: 400; line-height: 0.9;
  letter-spacing: 0.01em; color: var(--white);
}
.lead { font-size: clamp(15px, 1.4vw, 18px); color: var(--titanium); max-width: 62ch; line-height: 1.7; }
.muted { color: var(--muted); }
.cyan { color: var(--cyan); }

/* Reveal animation base */
.reveal { opacity: 0; transform: translateY(34px); filter: blur(6px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease), filter 0.8s var(--ease); }
.reveal.in { opacity: 1; transform: none; filter: blur(0); }
.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }
.reveal.d4 { transition-delay: 0.32s; }
.reveal.d5 { transition-delay: 0.40s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; filter: none; }
}

/* Buttons */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 16px 28px; border: 1px solid var(--line-strong);
  color: var(--void); background: var(--cyan);
  transition: 0.3s var(--ease);
}
.btn .ar { transition: transform 0.3s var(--ease); }
.btn:hover .ar { transform: translateX(5px); }
.btn:hover { box-shadow: var(--glow); }
.btn.ghost { background: transparent; color: var(--cyan); }
.btn.ghost::before {
  content: ""; position: absolute; inset: 0; background: var(--cyan);
  transform: translateX(-101%); transition: transform 0.4s var(--ease); z-index: 0;
}
.btn.ghost span, .btn.ghost .ar { position: relative; z-index: 1; transition: 0.3s var(--ease); }
.btn.ghost:hover { color: var(--void); }
.btn.ghost:hover::before { transform: translateX(0); }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--cyan-dim); border: 1px solid var(--line);
  padding: 5px 11px; background: rgba(0,229,255,0.04);
  white-space: nowrap;
}
.pill.solid { background: rgba(0,229,255,0.10); color: var(--cyan); border-color: var(--line-strong); }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--line);
  background: var(--void-2);
  padding: clamp(48px, 6vw, 72px) 0 32px;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
.footer .brand { font-size: 24px; margin-bottom: 14px; }
.footer-col h5 {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 16px;
}
.footer-col a { display: block; color: var(--titanium); font-size: 14px; padding: 6px 0; transition: color 0.2s, padding-left 0.2s var(--ease); }
.footer-col a:hover { color: var(--cyan); padding-left: 6px; }
.footer-tag { color: var(--muted); font-size: 14px; max-width: 34ch; line-height: 1.7; }
.footer-bot {
  margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--muted-2);
}
.footer-bot .stat-row { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-bot .led { color: var(--cyan-dim); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer .brand { grid-column: 1 / -1; } }

/* Decorative section label (vertical) */
.section-index {
  position: absolute; top: clamp(72px,10vw,130px); right: clamp(18px,4vw,48px);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em;
  color: var(--muted-2); writing-mode: vertical-rl; transform: rotate(180deg);
}
@media (max-width: 1100px) { .section-index { display: none; } }
