/* ======== Neural Interface — base styles ======== */
:root {
  --bg: #0a0a0f;
  --bg-2: #0d0d18;
  --ink: #e6f7ff;
  --ink-dim: #8aa3b8;
  --ink-faint: #4a5d72;
  --cyan: #00f5ff;
  --purple: #9d00ff;
  --pink: #ff2bd6;
  --grid: rgba(0, 245, 255, 0.06);
  --glass: rgba(255, 255, 255, 0.035);
  --glass-strong: rgba(255, 255, 255, 0.06);
  --hairline: rgba(0, 245, 255, 0.18);
  --hairline-purple: rgba(157, 0, 255, 0.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { background: var(--bg); color: var(--ink); overflow-x: clip; max-width: 100vw; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  overflow-x: clip;
  cursor: none;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: none; }
input, textarea { font: inherit; color: inherit; }

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; letter-spacing: 0.02em; }
.display { font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.02em; }

/* ======== Animated background ======== */
.bg-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  overflow: hidden;
  max-width: 100vw;
}
.bg-layer > canvas { display: block; max-width: 100%; }
.bg-grid {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 30%, transparent 80%);
}
.bg-noise {
  opacity: 0.5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0.96  0 0 0 0 1  0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: screen;
}
.bg-vignette {
  background:
    radial-gradient(ellipse 60% 50% at 80% 0%, rgba(157, 0, 255, 0.12), transparent 60%),
    radial-gradient(ellipse 60% 50% at 0% 100%, rgba(0, 245, 255, 0.10), transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 100%, rgba(255, 43, 214, 0.08), transparent 70%);
}

/* ======== Custom cursor ======== */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999;
  transform: translate3d(-100px, -100px, 0);
  will-change: transform;
}
.cursor-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan), 0 0 24px var(--cyan);
}
.cursor-ring {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(0, 245, 255, 0.6);
  margin-top: -15px; margin-left: -15px;
  transition: width 180ms ease, height 180ms ease, border-color 180ms ease, margin 180ms ease;
}
.cursor-ring.hover {
  width: 56px; height: 56px; margin-top: -25px; margin-left: -25px;
  border-color: var(--pink);
  box-shadow: 0 0 24px rgba(255, 43, 214, 0.6), inset 0 0 16px rgba(255, 43, 214, 0.3);
}

/* ======== Glass primitive ======== */
.glass {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(0, 245, 255, 0.04),
    0 24px 60px -20px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.glass-strong {
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(160%);
}

/* ======== Layout ======== */
main { position: relative; z-index: 1; }
section.deck {
  min-height: 100vh;
  padding: 120px 7vw;
  position: relative;
}
.section-tag {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--cyan);
  padding: 6px 12px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(0, 245, 255, 0.05);
}
.section-tag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 500; line-height: 1.05; letter-spacing: -0.025em;
  margin: 18px 0 12px;
}
.section-sub {
  color: var(--ink-dim); font-size: 16px; max-width: 640px;
}

/* ======== Glow text ======== */
.glow-cyan { color: var(--cyan); text-shadow: 0 0 18px rgba(0, 245, 255, 0.6); }
.glow-purple { color: var(--purple); text-shadow: 0 0 18px rgba(157, 0, 255, 0.6); }
.glow-pink { color: var(--pink); text-shadow: 0 0 18px rgba(255, 43, 214, 0.6); }

/* ======== Scanline / corner brackets ======== */
.brackets { position: relative; }
.brackets::before, .brackets::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  border: 1px solid var(--cyan); opacity: 0.7;
}
.brackets::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.brackets::after { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* ======== Selection ======== */
::selection { background: rgba(0, 245, 255, 0.3); color: #fff; }

/* ======== Reveal-on-scroll ======== */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  filter: blur(8px);
  transition:
    opacity var(--reveal-duration, 900ms) cubic-bezier(.2,.7,.2,1),
    transform var(--reveal-duration, 900ms) cubic-bezier(.2,.7,.2,1),
    filter var(--reveal-duration, 900ms) cubic-bezier(.2,.7,.2,1);
  will-change: opacity, transform, filter;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}
.reveal.delay-1 { transition-delay: 80ms; }
.reveal.delay-2 { transition-delay: 160ms; }
.reveal.delay-3 { transition-delay: 240ms; }
.reveal.delay-4 { transition-delay: 320ms; }

/* ======== Scrollbar ======== */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #07070b; }
::-webkit-scrollbar-thumb { background: rgba(0, 245, 255, 0.18); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 245, 255, 0.32); }

/* ======== Modal ======== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 5, 10, 0.7);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  opacity: 0; pointer-events: none;
  transition: opacity 240ms ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal-card {
  width: 100%; max-width: 980px; max-height: 90vh; overflow: auto;
  transform: translateY(20px) scale(0.98);
  transition: transform 320ms cubic-bezier(.2,.7,.2,1);
}
.modal-backdrop.open .modal-card { transform: translateY(0) scale(1); }

/* ======== Boot screen ======== */
#boot {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 600ms ease;
}
#boot.done { opacity: 0; pointer-events: none; }
.boot-frame {
  width: min(620px, 86vw);
  padding: 28px 32px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  border: 1px solid var(--hairline);
  background: rgba(0, 245, 255, 0.02);
  border-radius: 10px;
  box-shadow: 0 0 80px rgba(0, 245, 255, 0.08);
}
.boot-line { color: var(--ink-dim); margin: 4px 0; min-height: 18px; }
.boot-line .ok { color: var(--cyan); }
.boot-line .warn { color: var(--pink); }
.cursor-blink::after {
  content: "▊"; color: var(--cyan); margin-left: 4px;
  animation: blink 0.9s steps(2) infinite;
}
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

/* ======== Buttons ======== */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: rgba(0, 245, 255, 0.05);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--cyan);
  transition: all 180ms ease;
  position: relative;
}
.btn:hover {
  background: rgba(0, 245, 255, 0.12);
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(0, 245, 255, 0.3), inset 0 0 16px rgba(0, 245, 255, 0.1);
}
.btn-pink { color: var(--pink); border-color: var(--hairline-purple); background: rgba(255, 43, 214, 0.04); }
.btn-pink:hover { box-shadow: 0 0 24px rgba(255, 43, 214, 0.3), inset 0 0 16px rgba(255, 43, 214, 0.1); border-color: var(--pink); }

/* form */
.field {
  display: block; width: 100%;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  outline: none;
  transition: all 180ms ease;
}
.field:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(0, 245, 255, 0.08), 0 0 20px rgba(0, 245, 255, 0.2);
  background: rgba(0, 245, 255, 0.03);
}
.field::placeholder { color: var(--ink-faint); }
textarea.field { resize: vertical; min-height: 120px; }

/* dark dropdown options */
select.field {
  background-color: rgba(10, 10, 18, 0.85);
  color: var(--ink);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%2300f5ff' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
select.field option {
  background-color: #0a0a0f;
  color: var(--ink);
  padding: 8px;
}
select.field option:checked,
select.field option:hover {
  background: #00f5ff;
  color: #0a0a0f;
}

label.field-label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 8px;
}

/* node graph SVG */
.graph-wrap { position: relative; width: 100%; height: 640px; overflow: hidden; }
.graph-wrap svg { width: 100%; height: 100%; display: block; }
.node-card {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

/* ============================================================
   Navigation — transparent pill (desktop) + burger drawer (≤1100)
   ============================================================ */
.np-nav-desk {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  z-index: 50;
  display: flex; gap: 2px;
  padding: 4px 6px;
  background: transparent;
  border-radius: 999px;
  max-width: calc(100vw - 32px);
}
.np-link {
  padding: 8px 10px;
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-dim);
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
  flex-shrink: 0;
  min-width: 0;
  justify-content: center;
  transition: color 180ms ease, background 180ms ease, text-shadow 180ms ease;
}
.np-link:hover { color: var(--ink); }
.np-link.is-active {
  color: var(--cyan);
  background: rgba(0, 245, 255, 0.06);
  text-shadow: 0 0 10px rgba(0, 245, 255, 0.6);
}
.np-link-num {
  color: var(--ink-faint);
  font-size: 9px;
  letter-spacing: 0.1em;
  flex-shrink: 0;
  min-width: 18px;
  text-align: right;
}
.np-link.is-active .np-link-num { color: var(--cyan); opacity: 0.7; }
.np-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--ink-faint);
  transition: background 180ms ease, box-shadow 180ms ease;
}
.np-link.is-active .np-dot,
.np-dot.is-on {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

/* Mobile/tablet bar */
.np-nav-bar {
  position: fixed; top: 14px; left: 14px; right: 14px;
  z-index: 50;
  display: none;
  align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 10px 14px;
  background: rgba(10, 10, 18, 0.55);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(0, 245, 255, 0.04), 0 18px 40px -16px rgba(0,0,0,0.6);
}
.np-brand {
  display: inline-flex; align-items: center; gap: 8px;
  flex-shrink: 0;
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink);
}
.np-brand-mark {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 10px var(--cyan);
}
.np-current {
  flex: 1; min-width: 0;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--cyan);
  display: inline-flex; align-items: center; gap: 7px; justify-content: flex-end;
  text-shadow: 0 0 8px rgba(0,245,255,0.5);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.np-burger {
  width: 38px; height: 38px;
  display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  background: rgba(0, 245, 255, 0.05);
  flex-shrink: 0;
  transition: background 180ms ease, border-color 180ms ease;
}
.np-burger:hover { background: rgba(0, 245, 255, 0.12); border-color: var(--cyan); }
.np-burger span {
  display: block; width: 18px; height: 1.5px;
  background: var(--cyan);
  border-radius: 2px;
  transition: transform 220ms cubic-bezier(.2,.7,.2,1), opacity 180ms ease;
  box-shadow: 0 0 6px rgba(0,245,255,0.6);
}
.np-burger.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.np-burger.is-open span:nth-child(2) { opacity: 0; }
.np-burger.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Drawer */
.np-drawer {
  position: fixed; inset: 0; z-index: 49;
  background: rgba(5, 5, 10, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0; pointer-events: none;
  transition: opacity 240ms ease;
}
.np-drawer.is-open { opacity: 1; pointer-events: auto; }
.np-drawer-list {
  position: absolute;
  top: 70px; left: 14px; right: 14px;
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px;
  background: rgba(13, 13, 24, 0.92);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: 0 28px 60px -10px rgba(0,0,0,0.7), 0 0 0 1px rgba(0,245,255,0.05);
  transform: translateY(-12px);
  transition: transform 280ms cubic-bezier(.2,.7,.2,1);
}
.np-drawer.is-open .np-drawer-list { transform: translateY(0); }
.np-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 4px 12px;
  border-bottom: 1px dashed var(--hairline);
  margin-bottom: 6px;
}
.np-close {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--hairline); color: var(--cyan);
  font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0,245,255,0.06);
}
.np-drawer-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-dim);
  transition: background 180ms ease, color 180ms ease;
}
.np-drawer-link:hover { background: rgba(0,245,255,0.05); color: var(--ink); }
.np-drawer-link.is-active {
  background: rgba(0,245,255,0.08);
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(0,245,255,0.5);
}
.np-drawer-link .np-arrow {
  margin-left: auto;
  color: var(--ink-faint);
  font-size: 12px;
}
.np-drawer-link.is-active .np-arrow { color: var(--cyan); }

/* Show desktop pill ≥1101, bar ≤1100 */
@media (max-width: 1100px) {
  .np-nav-desk { display: none; }
  .np-nav-bar { display: flex; }
}

/* ============================================================
   Responsive — Tablet & Mobile
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
  body { font-size: 14.5px; cursor: auto; }
  body * { cursor: auto !important; }
  .cursor-dot, .cursor-ring { display: none !important; }

  section.deck { padding: 100px 5vw 80px; }
  .section-title { font-size: clamp(30px, 5.4vw, 52px); }
  .section-sub { font-size: 15px; }

  /* Graphs scale down */
  .graph-wrap { height: 620px !important; }
}

/* Phones */
@media (max-width: 720px) {
  body { font-size: 14px; }
  section.deck { padding: 92px 18px 64px; min-height: auto; }

  .section-title { font-size: clamp(26px, 8vw, 38px); line-height: 1.1; }
  .section-sub { font-size: 14px; }
  .section-tag { font-size: 10px; padding: 5px 10px; }

  /* Buttons stack */
  .btn { padding: 11px 16px; font-size: 11px; }

  /* Modal */
  .modal-backdrop { padding: 14px; }
  .modal-card { max-height: 92vh; border-radius: 12px; }

  /* Graphs become vertically stacked compact lists rendered by JS via .graph-wrap[data-mobile-stack] — fallback: shrink */
  .graph-wrap { height: 520px !important; }

  /* Hide the in-graph legend chip on small screens (cluttered) */
  .graph-wrap > .glass.mono[style*="position: absolute"][style*="top: 16px"] {
    display: none;
  }

  /* Fields/forms a touch tighter */
  .field { padding: 12px 14px; font-size: 13px; }

  /* Reveal: smaller travel + blur on phones */
  .reveal { transform: translateY(24px); filter: blur(4px); }
}

/* Very small phones */
@media (max-width: 420px) {
  section.deck { padding: 88px 14px 56px; }
  .section-title { font-size: clamp(24px, 8.6vw, 32px); }
  .graph-wrap { height: 460px !important; }
  .np-current { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal.in { transition: none !important; transform: none !important; filter: none !important; opacity: 1 !important; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   Component-level responsive overrides
   ============================================================ */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
  .hero-stats { grid-template-columns: repeat(3, 1fr) !important; }
  .hero-stats > :last-child { grid-column: 1 / -1; }
  .bento-grid { grid-template-columns: 1fr !important; }
  .career-row { grid-template-columns: 28px 1fr !important; gap: 14px; column-gap: 14px; }
  .career-row > :nth-child(1) { grid-column: 2 !important; grid-row: 1 !important; text-align: left !important; }
  .career-row > :nth-child(2) { grid-column: 1 !important; grid-row: 1 !important; align-self: flex-start; padding-top: 18px; }
  .career-row > :nth-child(3) { display: none !important; }
  .career-spine { display: none !important; }
}
@media (max-width: 720px) {
  .hero-stats { grid-template-columns: 1fr 1fr !important; }
  .hero-stats > :last-child { grid-column: 1 / -1; }
  .testimonial-card { width: 280px !important; padding: 18px !important; }
  /* Modal — reduce padding and relax height constraints to prevent bottom cutoff */
  .modal-backdrop { padding: 16px !important; }
  .modal-card { max-height: 92vh !important; }
  .bento-grid { padding: 14px !important; gap: 10px !important; max-height: none !important; }
}
