/* ————————————————————————————————————————
   Qernel — intelligence, made abundant
   Design language: visible grid / blue gradients / grotesk
   Themes: 01 paper / 02 ultramarine / 03 dusk
———————————————————————————————————————— */

:root, [data-theme="paper"] {
  --paper: #fbfbfa;
  --ink: #10101c;
  --blue: #0040ff;
  --g2: #6e8cff;
  --g3: #c6d4ff;
  --grey: #7b7b85;
  --hair: rgba(16, 16, 28, 0.10);
  --panel-fg: #fbfbfa;
  --sel-bg: #0040ff; --sel-fg: #fff;
  --orb: radial-gradient(circle at 30% 30%, rgba(0,64,255,0.22), rgba(110,140,255,0.10) 45%, transparent 70%);
}

[data-theme="ultramarine"] {
  --paper: #0334d6;
  --ink: #f4f6ff;
  --blue: #f4f6ff;
  --g2: #9fb4ff;
  --g3: #dbe3ff;
  --grey: rgba(244, 246, 255, 0.6);
  --hair: rgba(244, 246, 255, 0.22);
  --panel-fg: #0334d6;
  --sel-bg: #f4f6ff; --sel-fg: #0334d6;
  --orb: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.20), rgba(159,180,255,0.12) 45%, transparent 70%);
}

[data-theme="dusk"] {
  --paper: #0a0b14;
  --ink: #eef0fa;
  --blue: #4f74ff;
  --g2: #8aa2ff;
  --g3: #2743a8;
  --grey: #6d7080;
  --hair: rgba(238, 240, 250, 0.10);
  --panel-fg: #0a0b14;
  --sel-bg: #4f74ff; --sel-fg: #0a0b14;
  --orb: radial-gradient(circle at 30% 30%, rgba(79,116,255,0.28), rgba(39,67,168,0.15) 45%, transparent 70%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", -apple-system, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.6s ease, color 0.6s ease;
  overflow-x: hidden;
}

::selection { background: var(--sel-bg); color: var(--sel-fg); }

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey);
}

/* section kicker labels (e.g. "What we enable") — larger than utility mono */
.silicon > .mono,
.products > .mono,
.enable > .mono,
.page-head > .mono,
.roles > .mono,
.backers-label,
.panel .mono {
  font-size: clamp(13px, 1.4vw, 16px);
  letter-spacing: 0.14em;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }

:root { --max: 1280px; --pad: clamp(20px, 4vw, 48px); --cols: 6; }
@media (max-width: 859px) { :root { --cols: 3; } }

.wrap { max-width: var(--max); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }

/* gradient text helper */
.grad {
  background: linear-gradient(100deg, var(--blue) 10%, var(--g2) 55%, var(--g3) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ————— visible grid (signature) ————— */
#gridlines {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
#gridlines .cols {
  max-width: var(--max);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--pad);
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
}
#gridlines .cols i { border-left: 1px solid var(--hair); }
#gridlines .cols i:last-child { border-right: 1px solid var(--hair); }
main, header, footer { position: relative; z-index: 1; }

/* ————— preloader ————— */
#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--paper);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 28px var(--pad);
  transition: transform 0.9s cubic-bezier(0.77, 0, 0.18, 1);
}
#loader.done { transform: translateY(-101%); }
#loader .count {
  font-weight: 600;
  font-size: clamp(72px, 16vw, 200px);
  line-height: 0.85;
  letter-spacing: -0.04em;
}
body.loading { overflow: hidden; }

/* ————— header ————— */
header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--pad);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair);
}
.wordmark { font-weight: 600; font-size: clamp(20px, 2.2vw, 26px); letter-spacing: -0.015em; text-transform: uppercase; }
.wordmark .q { color: var(--blue); }
[data-theme="ultramarine"] .wordmark .q { color: var(--g2); }
.clock { display: none; }
@media (min-width: 700px) { .clock { display: block; } }
nav a { margin-left: 28px; transition: color 0.25s; }
nav a:hover, nav a[aria-current="page"] { color: var(--blue); }

/* ————— hero ————— */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.orb {
  position: absolute;
  width: 70vmax; height: 70vmax;
  top: -20vmax; right: -25vmax;
  background: var(--orb);
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
}
.hero h1 {
  font-weight: 600;
  font-size: clamp(44px, 10.5vw, 152px);
  line-height: 0.94;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.hero h1 .indent { padding-left: calc(100% / var(--cols)); display: block; }
.hero .sub {
  margin-top: 36px;
  color: var(--grey);
  font-size: clamp(15px, 1.6vw, 19px);
  max-width: 34ch;
  margin-left: auto;
  text-align: left;
}
@media (min-width: 860px) { .hero .sub { margin-right: calc(100% / var(--cols)); } }
.hero .kicker {
  margin-bottom: 26px;
  font-size: clamp(13px, 1.4vw, 16px);
  color: var(--ink);
  opacity: 0.85;
}
.scrollcue { position: absolute; bottom: 26px; left: var(--pad); }
.hero-meta { position: absolute; bottom: 26px; right: var(--pad); }
/* keep hero-meta clear of the fixed theme switcher */
@media (max-width: 699px) { .hero-meta { display: none; } }
@media (min-width: 700px) { .hero-meta { right: calc(var(--pad) + 140px); } }

/* masked line reveal */
.line { display: block; overflow: hidden; }
.line > span {
  display: block;
  transform: translateY(112%);
  transition: transform 1.05s cubic-bezier(0.19, 1, 0.22, 1);
}
body.ready .line > span { transform: translateY(0); }
.line:nth-child(1) > span { transition-delay: 0.05s; }
.line:nth-child(2) > span { transition-delay: 0.15s; }
.line:nth-child(3) > span { transition-delay: 0.25s; }
.hero .kicker, .hero .sub, .scrollcue, .hero-meta { opacity: 0; transition: opacity 1.1s ease 0.65s; }
body.ready .hero .kicker, body.ready .hero .sub, body.ready .scrollcue, body.ready .hero-meta { opacity: 1; }

/* ————— ticker ————— */
.ticker {
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  overflow: hidden;
  padding: 18px 0;
  white-space: nowrap;
  background: color-mix(in srgb, var(--paper) 60%, transparent);
}
.ticker .track { display: inline-block; animation: slide 30s linear infinite; }
.ticker span {
  font-weight: 600;
  font-size: clamp(18px, 2.4vw, 28px);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  padding: 0 1em;
}
.ticker .dot { color: var(--blue); }
@keyframes slide { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ————— backers ————— */
.backers { margin-top: clamp(20px, 4vh, 40px); }
.backers-label { margin-bottom: 14px; }
.backers-ticker .track { animation-duration: 44s; }
.backers-ticker span { font-weight: 500; color: var(--grey); }
.backers-ticker .dot { color: var(--blue); }
.backers-ticker span:hover { color: var(--ink); }
/* source logos are mixed colors (some white, some dark), so we normalize
   them to a single monochrome silhouette that reads on every theme:
   black on light backgrounds, white on dark ones. */
.backers-ticker .logo {
  height: clamp(22px, 2.6vw, 34px);
  width: auto;
  vertical-align: middle;
  margin: 0 clamp(28px, 4vw, 56px);
  opacity: 0.5;
  filter: brightness(0);
  transition: opacity 0.25s ease;
}
.backers-ticker .logo:hover { opacity: 0.85; }
[data-theme="ultramarine"] .backers-ticker .logo,
[data-theme="dusk"] .backers-ticker .logo {
  filter: brightness(0) invert(1);
  opacity: 0.75;
}
[data-theme="ultramarine"] .backers-ticker .logo:hover,
[data-theme="dusk"] .backers-ticker .logo:hover { opacity: 1; }

/* ————— sections ————— */
section { padding: clamp(64px, 10vh, 120px) 0; }

.silicon h2 {
  font-weight: 600;
  font-size: clamp(40px, 8.5vw, 120px);
  line-height: 0.96;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.silicon .note {
  margin-top: 30px;
  color: var(--grey);
  font-size: clamp(20px, 2.6vw, 30px);
  max-width: 70ch;
}

/* gradient panel */
.panel {
  margin-top: clamp(48px, 8vh, 96px);
  border-radius: 20px;
  padding: clamp(32px, 5vw, 64px);
  background: linear-gradient(120deg, var(--blue), var(--g2) 60%, var(--g3));
  color: var(--panel-fg);
  display: grid;
  gap: 20px;
}
[data-theme="ultramarine"] .panel { background: linear-gradient(120deg, #f4f6ff, #dbe3ff 60%, #9fb4ff); }
.panel .mono { color: color-mix(in srgb, var(--panel-fg) 70%, transparent); }
.panel h3 {
  font-weight: 600;
  font-size: clamp(26px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  max-width: 18ch;
}

.enable { padding-top: clamp(30px, 5vh, 60px); }
.panel .tag {
  font-weight: 500;
  font-size: clamp(16px, 1.8vw, 20px);
  color: color-mix(in srgb, var(--panel-fg) 82%, transparent);
}

/* ————— thesis panel (charge-domain / core IP) ————— */
.thesis-panel {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  padding: clamp(48px, 8vw, 104px) clamp(32px, 6vw, 88px);
  color: var(--panel-fg);
  background: linear-gradient(120deg, var(--blue), var(--g2) 60%, var(--g3));
  background-size: 220% 220%;
  animation: thesis-shift 14s ease-in-out infinite;
  box-shadow: 0 40px 90px -50px var(--blue);
}
[data-theme="ultramarine"] .thesis-panel {
  background: linear-gradient(120deg, #f4f6ff, #dbe3ff 60%, #9fb4ff);
  background-size: 220% 220%;
}
@keyframes thesis-shift {
  0%   { background-position: 0% 0%; }
  50%  { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}

/* faint vertical charge streaks moving across the panel */
.thesis-panel .tp-flow {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 34px,
    color-mix(in srgb, var(--panel-fg) 12%, transparent) 34px,
    color-mix(in srgb, var(--panel-fg) 12%, transparent) 36px,
    transparent 36px,
    transparent 130px
  );
  background-size: 260px 100%;
  animation: charge 5.5s linear infinite;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}
@keyframes charge {
  from { background-position: 0 0; }
  to   { background-position: 260px 0; }
}

.thesis-panel .tp-body { position: relative; z-index: 2; display: grid; gap: 22px; }
.thesis-panel h3 {
  font-weight: 600;
  font-size: clamp(40px, 8vw, 104px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.thesis-panel .tag {
  font-weight: 500;
  font-size: clamp(18px, 2.2vw, 26px);
  color: color-mix(in srgb, var(--panel-fg) 82%, transparent);
}

/* ————— products / scene ————— */
.products { padding-top: 0; }
.products h2 {
  font-weight: 600;
  font-size: clamp(40px, 8.5vw, 120px);
  line-height: 0.96;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.products .note {
  margin-top: 22px;
  color: var(--grey);
  font-size: clamp(20px, 2.6vw, 30px);
  max-width: 40ch;
}
.scene {
  margin-top: clamp(32px, 5vh, 56px);
  border: 1px solid var(--hair);
  border-radius: 20px;
  overflow: hidden;
  background: color-mix(in srgb, var(--paper) 70%, transparent);
}
.scene svg { display: block; width: 100%; height: auto; }
.scene .rover { animation: drive 15s linear infinite; }
@keyframes drive {
  from { transform: translateX(-140px); }
  to { transform: translateX(1360px); }
}
.scene .wheel {
  animation: spin 0.9s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes spin { to { transform: rotate(360deg); } }
.scene .drone { animation: fly 26s linear infinite; }
@keyframes fly {
  from { transform: translate(1300px, 84px); }
  to { transform: translate(-120px, 84px); }
}
.scene .bob { animation: bob 3.2s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(-7px); } to { transform: translateY(7px); } }

.scene .humanoid { animation: walkacross 34s linear infinite; animation-delay: -10s; }
.scene .humanoid-2 { animation-delay: -27s; }
.scene .rover-2 { animation-delay: -7.5s; }
.scene .drone-2 { animation-name: fly2; animation-duration: 21s; animation-delay: -9s; }
@keyframes fly2 {
  from { transform: translate(1300px, 48px); }
  to { transform: translate(-120px, 48px); }
}
@keyframes walkacross {
  from { transform: translateX(-90px); }
  to { transform: translateX(1330px); }
}
.scene .stride { animation: strideBob 0.56s ease-in-out infinite alternate; }
@keyframes strideBob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
.scene .leg, .scene .arm {
  transform-box: fill-box;
  transform-origin: top center;
  animation: swing 0.56s ease-in-out infinite alternate;
}
.scene .leg-b, .scene .arm-a { animation-delay: -0.56s; }
.scene .arm { animation-name: swingArm; }
@keyframes swing { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }
@keyframes swingArm { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }

/* ————— pillars ————— */
.pillars { padding-top: 0; }
.pillar {
  display: grid;
  gap: 10px 24px;
  padding: clamp(40px, 7vh, 72px) 0;
  border-top: 1px solid var(--hair);
}
.pillar:last-child { border-bottom: 1px solid var(--hair); }
@media (min-width: 860px) {
  .pillar { grid-template-columns: 1fr 2fr; align-items: start; }
}
.pillar h3 {
  font-weight: 600;
  font-size: clamp(34px, 6.5vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  transition: color 0.35s;
}
.pillar p.desc { color: var(--grey); max-width: 44ch; align-self: end; }
.pillar:hover h3 .grad-hover {
  background: linear-gradient(100deg, var(--blue) 10%, var(--g2) 60%, var(--g3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ————— CTA ————— */
.cta .panel { text-align: left; margin-top: 0; }
.cta h2 {
  font-weight: 600;
  font-size: clamp(34px, 6.5vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.cta a.button {
  justify-self: start;
  display: inline-block;
  margin-top: 12px;
  padding: 16px 34px;
  border: 1px solid var(--panel-fg);
  border-radius: 999px;
  font-weight: 500;
  font-size: 15px;
  color: var(--panel-fg);
  transition: background 0.3s, color 0.3s;
}
.cta a.button:hover { background: var(--panel-fg); color: var(--blue); }

/* ————— careers ————— */
.page-head { padding-top: clamp(130px, 20vh, 200px); padding-bottom: clamp(44px, 7vh, 80px); }
.page-head h1 {
  font-weight: 600;
  font-size: clamp(44px, 10vw, 140px);
  line-height: 0.94;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.page-head .lede { margin-top: 26px; max-width: 75ch; color: var(--grey); font-size: clamp(15px, 1.6vw, 16px); }

.roles { padding-top: 0; }
.role {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 6px 24px;
  padding: 28px 0;
  border-top: 1px solid var(--hair);
}
.role:last-of-type { border-bottom: 1px solid var(--hair); }
.role h3 {
  font-weight: 600;
  font-size: clamp(20px, 3vw, 34px);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  transition: color 0.3s, transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}
.role .meta { grid-column: 1; }
.role .arrow { grid-column: 2; grid-row: 1 / span 2; font-size: 22px; color: var(--grey); transition: transform 0.3s, color 0.3s; }
.role:hover h3 { color: var(--blue); transform: translateX(10px); }
.role:hover .arrow { color: var(--blue); transform: translateX(6px); }
.open-note { margin-top: 52px; max-width: 52ch; color: var(--grey); font-size: clamp(18px, 2vw, 22px); }
.open-note a { color: var(--blue); }

/* ————— footer ————— */
footer { border-top: 1px solid var(--hair); padding: 52px var(--pad) 92px; background: color-mix(in srgb, var(--paper) 60%, transparent); }
.foot-grid { max-width: var(--max); margin: 0 auto; display: grid; gap: 36px; }
.foot-grid a { display: block; margin-top: 8px; transition: color 0.25s; }
.foot-grid a:hover { color: var(--blue); }
.foot-line { max-width: var(--max); margin: 44px auto 0; display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between; }
@media (min-width: 700px) { .foot-grid { grid-template-columns: 2fr 1fr 1fr; } }
.foot-mark { font-weight: 600; font-size: clamp(24px, 3.6vw, 40px); line-height: 1.05; letter-spacing: -0.03em; text-transform: uppercase; }

/* ————— theme switcher ————— */
.themes { position: fixed; right: var(--pad); bottom: 22px; z-index: 20; display: flex; gap: 14px; }
.themes button {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  border: none;
  color: var(--grey);
  cursor: pointer;
  padding: 4px 4px;
  border-bottom: 1px solid transparent;
  transition: color 0.25s, border-color 0.25s;
}
.themes button:hover { color: var(--blue); }
.themes button[aria-pressed="true"] { color: var(--blue); border-color: var(--blue); }

/* ————— reveal on scroll ————— */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.9s ease, transform 0.9s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .line > span, .hero .kicker, .hero .sub, .scrollcue, .hero-meta { opacity: 1; transform: none; transition: none; }
  .ticker .track { animation: none; }
  .scene .rover, .scene .wheel, .scene .drone, .scene .bob { animation: none; }
  .scene .rover { transform: translateX(600px); }
  .scene .humanoid, .scene .stride, .scene .leg, .scene .arm { animation: none; }
  .scene .humanoid { transform: translateX(880px); }
  .scene .humanoid-2 { transform: translateX(180px); }
  .scene .rover-2 { transform: translateX(1020px); }
  .scene .drone-2 { transform: translate(760px, 48px); }
  .scene .drone { transform: translate(300px, 84px); }
  #loader { display: none; }
  .orb { display: none; }
  .thesis-panel, .thesis-panel .tp-flow { animation: none; }
}
