/* ===== Tokens ===== */
:root {
  --bg: #f5f7fb;
  --bg-soft: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --border: rgba(20, 35, 70, 0.12);
  --border-strong: rgba(20, 35, 70, 0.18);
  --border-bright: rgba(59, 111, 224, 0.45);

  --text: #111729;
  --text-dim: #44506b;
  --text-faint: #5a6075;

  --accent: #2f63d8;
  --accent-2: #6f43cf;
  --accent-3: #0e8e7e;
  --grad: linear-gradient(110deg, #3b6fe0 0%, #7c4ddb 52%, #13a594 100%);

  --panel: #0f1530;
  --panel-2: #161d3d;
  --on-panel: #eef1fb;
  --on-panel-dim: #aeb6d6;

  --error: #c4374d;
  --ok: #0c7d6e;

  --shadow-sm: 0 2px 10px -6px rgba(30, 50, 110, 0.30);
  --shadow: 0 18px 44px -26px rgba(30, 50, 110, 0.42);
  --radius: 16px;
  --radius-lg: 26px;
  --maxw: 1140px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* semantic z-index scale */
  --z-bg: -1;
  --z-base: 1;
  --z-sticky: 100;
  --z-nav-menu: 110;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 {
  font-family: "Sora", sans-serif;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
p { text-wrap: pretty; }
img { max-width: 100%; display: block; }

/* ===== Focus ===== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.btn:focus-visible { outline-offset: 4px; }

/* ===== Background ===== */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: var(--z-bg);
  pointer-events: none;
  background:
    radial-gradient(58% 48% at 18% 4%, rgba(59, 111, 224, 0.10), transparent 70%),
    radial-gradient(46% 42% at 92% 8%, rgba(124, 77, 219, 0.08), transparent 72%);
}

/* ===== Layout ===== */
.container { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }
.section { padding: clamp(4rem, 9vw, 8rem) 0; position: relative; }

/* ===== Nav ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-sticky);
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(247, 249, 253, 0.82);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--border);
  box-shadow: 0 6px 24px -18px rgba(30, 50, 110, 0.5);
}
.nav-inner {
  width: min(100% - 2.5rem, var(--maxw));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: "Sora", sans-serif; font-weight: 700;
  font-size: 1.16rem; letter-spacing: -0.02em;
}
.brand-mark {
  width: 28px; height: 28px;
  flex: none;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(59, 111, 224, 0.32));
}
.brand--sm .brand-mark { width: 26px; height: 26px; }
.brand--sm { font-size: 1.02rem; }

.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a { font-size: 0.93rem; color: var(--text-dim); transition: color 0.25s; position: relative; }
.nav-links a:not(.nav-cta)::after {
  content: ""; position: absolute; left: 0; bottom: -5px;
  width: 0; height: 2px; border-radius: 2px;
  background: var(--accent); transition: width 0.3s var(--ease);
}
.nav-links a:not(.nav-cta):hover { color: var(--text); }
.nav-links a:not(.nav-cta):hover::after { width: 100%; }
.nav-cta {
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  color: var(--text) !important;
  font-weight: 500;
  transition: border-color 0.3s, background 0.3s, transform 0.3s;
}
.nav-cta:hover { border-color: var(--border-bright); background: var(--surface); transform: translateY(-1px); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 6px; }
.nav-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: 0.3s var(--ease); }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Hero ===== */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.78fr;
  align-items: center;
  gap: clamp(1.8rem, 4.5vw, 3.8rem);
  min-height: min(88svh, 760px);
  position: relative;
  padding: 8rem 0 4rem;
  width: min(100% - 2.5rem, var(--maxw));
  margin-inline: auto;
}
.hero-content { position: relative; z-index: var(--z-base); }
.hero-eyebrow {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.005em;
  margin-bottom: 1.1rem;
}
.hero-title {
  font-size: clamp(1.6rem, 4vw, 2.55rem);
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.18;
  text-wrap: pretty;
  overflow-wrap: break-word;
}
.hero-title .accent { color: var(--accent); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.2rem; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: "Sora", sans-serif;
  font-weight: 600; font-size: 0.95rem;
  padding: 0.85rem 1.7rem;
  border-radius: 100px;
  cursor: pointer; border: 1px solid transparent;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s, border-color 0.25s;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 12px 28px -12px rgba(59, 111, 224, 0.65); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 38px -12px rgba(59, 111, 224, 0.7); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-bright); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn-block { width: 100%; margin-top: 0.4rem; }

/* ===== Hero scene (real operator + live labeled machine) ===== */
.hero-scene {
  position: relative;
  z-index: var(--z-base);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px var(--border);
  isolation: isolate;
  aspect-ratio: 4 / 5;
  background: linear-gradient(150deg, #4b5790, #353f73);
}
.hero-operator {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 64% 26%;
  filter: saturate(1.02) brightness(1.26) contrast(0.99);
}
/* darken the lower 60% (the scattered machine) and the photo's baked overlay; keep his face bright up top */
.hero-fade {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, transparent 24%, rgba(26, 33, 64, 0.5) 46%, rgba(17, 22, 50, 0.82) 78%, rgba(15, 20, 46, 0.9) 100%),
    linear-gradient(100deg, rgba(53, 63, 115, 0.5) 0%, rgba(53, 63, 115, 0.22) 38%, transparent 60%),
    radial-gradient(62% 50% at 34% 76%, rgba(124, 77, 219, 0.24), transparent 62%);
  pointer-events: none;
}
.hero-machine {
  position: absolute; left: 0; top: 0;
  width: 70%; height: 100%;
}
/* metallic gears */
.hero-machine .cog { fill: url(#steel); stroke: #141a30; stroke-width: 1.1; }
.hero-machine .ring { fill: url(#hub); stroke: #141a30; stroke-width: 1.1; }
.hero-machine .bolt { fill: #20294a; stroke: #0d1226; stroke-width: 0.8; }
.hero-machine .bore { fill: #161d3a; stroke: #0d1226; stroke-width: 1; }
.hero-machine .shine { fill: url(#shineG); }
.hero-machine .chipbody { fill: url(#chipG); stroke: #5d7bdc; stroke-opacity: 0.65; stroke-width: 1.3; }
.hero-machine .pins { stroke: #8fb0ff; stroke-opacity: 0.7; stroke-width: 1.5; fill: none; }
.hero-machine .lbl {
  fill: #eef2ff; font-family: "Sora", sans-serif; font-size: 12px; font-weight: 600;
  letter-spacing: 1.2px; text-anchor: start; dominant-baseline: middle;
  stroke: rgba(13, 18, 44, 0.6); stroke-width: 3px; paint-order: stroke fill;
}
.hero-machine .chiplbl {
  fill: #e2e9ff; font-family: "Sora", sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-anchor: middle;
}
.gear { transform-box: fill-box; transform-origin: center; }
.gear-a { animation: spin 18s linear infinite; }
.gear-b { animation: spin 13s linear infinite reverse; }
.gear-c { animation: spin 15s linear infinite; }
.gear-d { animation: spin 11s linear infinite reverse; }
.gear-e { animation: spin 16s linear infinite; }
.gear-f { animation: spin 12s linear infinite reverse; }
.gear-g { animation: spin 19s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes chip-pulse { 0%, 100% { opacity: 0.35; transform: scale(0.92); } 50% { opacity: 0.95; transform: scale(1.08); } }

/* ===== Section heads ===== */
.section-head { max-width: 720px; margin-bottom: 2.6rem; }
.section-head h2 { font-size: clamp(1.8rem, 4vw, 2.7rem); }
.section-sub { color: var(--text-dim); margin-top: 1rem; font-size: 1.05rem; max-width: 60ch; }

/* ===== What we do ===== */
.what-we-do h2 {
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  margin-bottom: 1.4rem;
}
.what-we-do .grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(1.8rem, 5vw, 4rem);
  align-items: center;
}
.what-we-do .body-text {
  color: var(--text-dim);
  font-size: 1.08rem;
  max-width: 56ch;
}
.what-we-do .body-text + .body-text { margin-top: 1.1rem; }
.what-we-do .media {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px var(--border);
  aspect-ratio: 11 / 12;
  isolation: isolate;
  background: #080c1e;
}
.what-we-do .media-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  /* galaxy: dimmed cosmic backdrop */
  filter: brightness(0.55) saturate(1.05) contrast(1.05);
  transform: scale(1.04);
  transition: transform 0.8s var(--ease);
}
.what-we-do .media:hover .media-bg { transform: scale(1.08); }
/* live neural network drawn over the galaxy */
.what-we-do .media-net {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.what-we-do .net-edge { stroke: rgba(135, 200, 255, 0.22); stroke-width: 1; }
.what-we-do .net-pulses { fill: #cbeeff; }
.what-we-do .net-node .core { fill: #dcf2ff; }
.what-we-do .net-node .halo {
  fill: rgba(140, 205, 255, 0.4);
  transform-box: fill-box; transform-origin: center;
  animation: net-pulse 3.4s ease-out infinite;
  animation-delay: var(--nd, 0s);
}
@keyframes net-pulse {
  0% { transform: scale(0.3); opacity: 0.7; }
  70% { opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}
.what-we-do .media::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(150deg, rgba(47, 99, 216, 0.22), rgba(111, 67, 207, 0.2));
  mix-blend-mode: soft-light;
  pointer-events: none;
}
.what-we-do .media::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(160deg, transparent 52%, rgba(8, 12, 30, 0.5));
  pointer-events: none;
}

/* ===== Industries ===== */
.industry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}
.industry-card {
  display: flex; flex-direction: column; gap: 1.1rem;
  padding: 1.6rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s var(--ease);
}
.industry-card:hover { border-color: var(--border-bright); box-shadow: var(--shadow); transform: translateY(-3px); }
.industry-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px;
  border-radius: 14px;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 10px 22px -10px rgba(59, 111, 224, 0.7);
}
.industry-icon svg { width: 27px; height: 27px; }
.industry-icon :is(path, rect, circle, line) { stroke-width: 2.1; }
.industry-card:hover .industry-icon { transform: translateY(-2px); transition: transform 0.3s var(--ease); }
.industry-card h3 { font-size: 1.12rem; font-weight: 600; line-height: 1.25; }

/* ===== Services ===== */
.service-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.service-group {
  padding: clamp(1.6rem, 3vw, 2.2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s var(--ease);
}
.service-group:hover { border-color: var(--border-bright); box-shadow: var(--shadow); transform: translateY(-3px); }
.service-group-title {
  display: flex; align-items: center; gap: 0.8rem;
  font-size: 1.3rem;
  padding-bottom: 1.2rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}
.service-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; flex: none;
  border-radius: 13px;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 10px 22px -10px rgba(59, 111, 224, 0.7);
}
.service-icon svg { width: 25px; height: 25px; }
.service-icon :is(path, rect, circle, line) { stroke-width: 2.1; }
.service-list { list-style: none; display: flex; flex-direction: column; gap: 0.9rem; }
.service-list li {
  position: relative;
  padding-left: 1.8rem;
  color: var(--text-dim);
  font-size: 1.02rem;
  transition: color 0.25s, transform 0.25s var(--ease);
}
.service-list li::before {
  content: "";
  position: absolute; left: 0; top: 0.56em;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--grad);
}
.service-list li:hover { color: var(--text); transform: translateX(4px); }

/* ===== Quark divider (contained brand motif) ===== */
.quark-band {
  display: flex;
  justify-content: center;
  padding: clamp(0.5rem, 1.5vw, 1rem) 0;
  margin: clamp(-4rem, -6vw, -2.5rem) 0;
}
.quark { width: min(100%, 360px); text-align: center; }
.quark-svg {
  width: clamp(180px, 40vw, 230px);
  height: auto;
  aspect-ratio: 1;
}
.quark-svg .orbit { fill: none; stroke: rgba(70, 110, 220, 0.42); stroke-width: 1.4; }
.quark-svg .qe { fill: #6f43cf; }
.quark-svg .qnucleus-glow { animation: chip-pulse 3.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.quark figcaption {
  margin-top: 1.1rem;
  font-size: 0.98rem;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}
.quark figcaption strong { color: var(--accent); font-weight: 600; }

/* ===== Contact (committed brand panel) ===== */
.contact-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
  padding: clamp(2rem, 5vw, 3.5rem);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 130% at 100% 0%, rgba(124, 77, 219, 0.30), transparent 58%),
    linear-gradient(165deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
  color: var(--on-panel);
}
.contact-intro h2 { font-size: clamp(2rem, 4vw, 2.8rem); color: #fff; }
.contact-intro .section-sub { color: var(--on-panel-dim); }
.contact-form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label { font-size: 0.86rem; color: var(--on-panel-dim); font-weight: 500; }
.req { color: #b79bff; margin-left: 2px; }
.field input, .field textarea {
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  color: var(--text);
  font-family: inherit; font-size: 0.98rem;
  transition: box-shadow 0.25s, background 0.25s;
  resize: vertical;
}
.field input::placeholder, .field textarea::placeholder { color: #5a6075; }
.field input:focus, .field textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 77, 219, 0.55);
}
.form-note { font-size: 0.9rem; min-height: 1.2em; color: var(--on-panel-dim); }
.form-note.ok { color: #5fe3c8; }
.form-note.err { color: #ff8b9a; }

/* ===== Footer ===== */
.footer { border-top: 1px solid var(--border); padding: 2.8rem 0; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; }
.footer-tag { color: var(--text-dim); font-size: 0.95rem; }
.footer-copy { color: var(--text-faint); font-size: 0.85rem; }

/* ===== Reveal (progressive enhancement: visible by default) ===== */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal-stagger { transition-delay: var(--d, 0s); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 6.5rem 0 3rem;
    gap: 2.2rem;
  }
  .hero-scene { max-width: 520px; }
  .what-we-do .grid { grid-template-columns: 1fr; }
  .what-we-do .media { aspect-ratio: 16 / 10; max-height: 340px; }
  .service-cols { grid-template-columns: 1fr; }
  .contact-wrap { grid-template-columns: 1fr; gap: 2rem; }
}
@media (max-width: 700px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: fixed; inset: 70px 0 auto 0;
    z-index: var(--z-nav-menu);
    flex-direction: column; gap: 0;
    background: rgba(247, 249, 253, 0.98);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 14px 30px -18px rgba(30, 50, 110, 0.5);
    padding: 1rem 1.25rem 1.5rem;
    transform: translateY(-130%);
    transition: transform 0.4s var(--ease);
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 0.9rem 0; width: 100%; border-bottom: 1px solid var(--border); }
  .nav-cta { text-align: center; margin-top: 0.8rem; border-bottom: 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
