/* ============================================================
   CyberSpark Labs — styles.css
   "Spark to System" design system
   ============================================================ */

/* ---------- Fonts (self-hosted, no third-party requests) ---------- */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-standard-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  --bg: #05070d;
  --surface: #0a0f1a;
  --surface-2: #0d1422;
  --line: rgba(120, 145, 190, 0.16);
  --line-strong: rgba(120, 145, 190, 0.34);
  --text: #f2f7ff;
  --text-dim: #9aa8c0;
  --text-faint: #7d8dab;
  --accent: #4ee1ff;
  --accent-rgb: 78, 225, 255;
  --accent-dim: #0a90b8;
  --accent-hot: #dcfbff;
  --steel: #607397;
  --steel-dark: #2a3d63;
  --warn: #ffb38a;

  --font-head: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --nav-h: 76px;
  --radius: 3px;
  --chamfer: 10px;
  --gutter: clamp(1.25rem, 4.5vw, 4rem);
  --wrap: 1360px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ---------- Base ---------- */

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

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: var(--nav-h);
}
html.motion-ok:not(.lenis) { scroll-behavior: smooth; }
html.menu-open { overflow: hidden; }

body {
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 700;
  font-stretch: 110%;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h2 { font-size: clamp(2rem, 1.1rem + 3.2vw, 3.9rem); }
h3 { font-size: 1.15rem; font-stretch: 105%; line-height: 1.2; letter-spacing: -0.01em; }

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; }

::selection { background: rgba(var(--accent-rgb), 0.3); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.accent {
  color: var(--accent);
  text-shadow: 0 0 44px rgba(var(--accent-rgb), 0.35);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 400;
  padding: 0.7rem 1.1rem;
  background: var(--accent);
  color: #04121a;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.eyebrow,
.experience-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.2rem;
}
.eyebrow::before,
.experience-tag::before { content: "// "; color: var(--steel); }

/* ---------- Background layers ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 70% 35%, rgba(10, 144, 184, 0.16), transparent 70%),
    radial-gradient(ellipse 50% 45% at 15% 85%, rgba(42, 61, 99, 0.28), transparent 70%),
    var(--bg);
}
.backdrop img {
  width: min(72vmin, 640px);
  height: auto;
  opacity: 0.09;
}

#spark-canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  display: none;
  pointer-events: none;
}
.webgl #spark-canvas { display: block; }
.webgl .backdrop { display: none; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}

main, .footer { position: relative; z-index: 2; }

/* Cursor ring (fine pointers only, native cursor stays visible) */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .js.motion-ok .cursor {
    display: block;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 300;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 1px solid rgba(var(--accent-rgb), 0.5);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    will-change: transform;
    transition:
      opacity 0.3s ease,
      width 0.35s var(--ease),
      height 0.35s var(--ease),
      margin 0.35s var(--ease),
      background 0.3s ease,
      border-color 0.3s ease;
  }
  .cursor.is-on { opacity: 1; }
  .cursor.is-hover {
    width: 62px;
    height: 62px;
    margin: -31px 0 0 -31px;
    background: rgba(var(--accent-rgb), 0.07);
    border-color: rgba(var(--accent-rgb), 0.9);
  }
  .cursor.is-down {
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    background: rgba(var(--accent-rgb), 0.3);
  }
}

/* ---------- Buttons (chamfered, echoing the wordmark) ---------- */

.btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7em;
  padding: 1.05em 1.9em;
  border: 0;
  background: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.3s ease, filter 0.4s ease;
}
.btn > * { position: relative; z-index: 1; }
.btn svg { width: 1.25em; height: 1.25em; transition: transform 0.4s var(--ease); }
.btn:hover svg { transform: translateX(4px); }

.btn::before,
.btn::after {
  content: "";
  position: absolute;
  z-index: 0;
  clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
  transition: background 0.3s ease, background-position 0.8s var(--ease);
}
.btn::before { --c: var(--chamfer); inset: 0; }
.btn::after { --c: calc(var(--chamfer) - 0.6px); inset: 1px; }

.btn-primary {
  color: #04121a;
  filter: drop-shadow(0 0 16px rgba(var(--accent-rgb), 0.3));
}
.btn-primary::before { background: var(--accent); }
.btn-primary::after {
  inset: 0;
  --c: var(--chamfer);
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.6) 50%, transparent 58%) no-repeat;
  background-size: 260% 100%;
  background-position: 130% 0;
}
.btn-primary:hover { filter: drop-shadow(0 0 26px rgba(var(--accent-rgb), 0.55)); }
.btn-primary:hover::after { background-position: -30% 0; }

.btn-ghost::before { background: var(--line-strong); }
.btn-ghost::after { background: rgba(7, 11, 20, 0.9); }
.btn-ghost:hover { color: var(--accent); }
.btn-ghost:hover::before { background: var(--accent); }

.btn-small {
  padding: 0.78em 1.35em;
  font-size: 0.74rem;
  color: var(--accent);
  --chamfer: 8px;
}
.btn-small::before { background: var(--accent-dim); }
.btn-small::after { background: rgba(7, 11, 20, 0.92); }
.btn-small:hover::before { background: var(--accent); }
.btn-small:hover::after { background: rgba(10, 30, 44, 0.95); }

.btn-large { font-size: 0.92rem; padding: 1.15em 2.5em; }

/* ---------- Nav ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: transform 0.55s var(--ease), background 0.3s ease, border-color 0.3s ease;
}
.nav.is-scrolled {
  background: rgba(5, 7, 13, 0.74);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom-color: var(--line);
}
.nav.is-hidden { transform: translateY(-101%); }

.nav-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand { display: inline-flex; align-items: center; gap: 0.7rem; }
.brand-lockup { width: auto; height: 44px; }
.brand-mark { width: 34px; height: 34px; }
.brand-name {
  font-family: var(--font-head);
  font-stretch: 112%;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.brand-name .accent { text-shadow: none; }

.nav-links { display: flex; align-items: center; gap: 2.2rem; }
.nav-links a:not(.btn) {
  position: relative;
  padding: 0.4rem 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.25s ease;
}
.nav-links a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease);
}
.nav-links a:not(.btn):hover { color: var(--text); }
.nav-links a:not(.btn):hover::after { transform: scaleX(1); transform-origin: left; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.25s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Section rail ---------- */

.rail { display: none; }
@media (min-width: 1100px) and (hover: hover) {
  .js .rail {
    position: fixed;
    right: clamp(0.6rem, 1.3vw, 1.5rem);
    top: 50%;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transform: translateY(-50%);
  }
  .rail a {
    position: relative;
    display: block;
    width: 30px;
    height: 22px;
  }
  .rail a::before {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    width: 10px;
    height: 1px;
    background: var(--steel);
    transition: width 0.5s var(--ease), background 0.3s ease, box-shadow 0.3s ease;
  }
  .rail a:hover::before { width: 18px; background: var(--text); }
  .rail a.is-active::before {
    width: 26px;
    background: var(--accent);
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.9);
  }
  .rail a span {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translate(8px, -50%);
    padding: 0.25rem 0.55rem;
    background: rgba(5, 7, 13, 0.8);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-dim);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.4s var(--ease);
  }
  .rail a:hover span,
  .rail a:focus-visible span { opacity: 1; transform: translate(0, -50%); }
}

/* ---------- Section scaffolding ---------- */

.hero, .manifesto, .caps, .process, .why, .contact { position: relative; }
main > section:focus { outline: none; }

.caps, .why, .contact { padding: clamp(6rem, 16vh, 11rem) 0; }

/* Scrims keep copy legible over the particle field */
.hero::before,
.manifesto::before,
.caps::before,
.process-sticky::before,
.why::before,
.contact::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(5, 7, 13, 0.62);
  -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
}
.hero::before {
  -webkit-mask-image: linear-gradient(#000 80%, transparent);
  mask-image: linear-gradient(#000 80%, transparent);
}
.hero > *, .manifesto > *, .caps > *, .process-sticky > *, .why > *, .contact > * { position: relative; z-index: 1; }

.split { display: grid; grid-template-columns: minmax(0, 1fr); }

.section-head { max-width: 44rem; margin-bottom: clamp(2.2rem, 5vh, 3.6rem); }
.section-sub {
  margin-top: 1.2rem;
  max-width: 36rem;
  color: var(--text-dim);
  font-size: 1.08rem;
}
.section-head-center { margin-inline: auto; text-align: center; }
.section-head-center .section-sub { margin-inline: auto; }

/* ---------- 01 Hero ---------- */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-h) + 1.75rem) 0 9.5rem;
}

.display {
  max-width: 8.7em;
  font-size: clamp(2.5rem, min(1rem + 4.6vw, 9.4vh), 5.2rem);
  font-weight: 750;
  font-stretch: 112%;
  line-height: 0.99;
  letter-spacing: -0.028em;
}

.lede {
  margin-top: 1.8rem;
  max-width: 35rem;
  font-size: clamp(1.02rem, 0.95rem + 0.4vw, 1.2rem);
  color: var(--text-dim);
}

.cta-row { margin-top: 2.6rem; display: flex; flex-wrap: wrap; gap: 1rem; }

.hero-foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; }
.hero-foot-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.3rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.scroll-cue { display: flex; align-items: center; gap: 0.85rem; }
.scroll-cue i {
  display: block;
  width: 1px;
  height: 46px;
  background: linear-gradient(var(--accent), rgba(var(--accent-rgb), 0));
  transform-origin: top;
  animation: cue 2.4s var(--ease-io) infinite;
}
@keyframes cue {
  0% { transform: scaleY(0); opacity: 1; }
  55% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

.hero-hint { display: none; align-items: center; gap: 0.7rem; }
.hero-hint b {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: blink 1.8s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

.readout { display: none; }
.readout b { color: var(--steel-dark); font-weight: 500; }
.readout span { color: var(--accent); }

@media (hover: hover) and (min-width: 1000px) {
  .webgl .hero-hint { display: flex; }
  .webgl .readout { display: block; }
}

/* Marquees */
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee var(--dur, 60s) linear infinite;
}
.marquee-track span { flex: none; display: inline-flex; align-items: center; }
@keyframes marquee { to { transform: translate3d(-50%, 0, 0); } }

.marquee-strip {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  background: rgba(5, 7, 13, 0.55);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.marquee-strip span::after { content: "+"; margin: 0 1.7rem; color: var(--steel-dark); }

.marquee-big {
  --dur: 70s;
  margin-top: clamp(3rem, 8vh, 5rem);
  padding: 1.6rem 0;
  background: linear-gradient(rgba(5, 7, 13, 0), rgba(5, 7, 13, 0.8) 28%, rgba(5, 7, 13, 0.8) 72%, rgba(5, 7, 13, 0));
  font-family: var(--font-head);
  font-stretch: 120%;
  font-weight: 750;
  font-size: clamp(2rem, 1rem + 4.2vw, 4.6rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 1px rgba(140, 162, 205, 0.42);
}
.marquee-big span::after {
  content: "";
  width: 0.26em;
  height: 0.26em;
  margin: 0 0.75em;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.8);
  transform: rotate(45deg);
}

/* ---------- 02 Manifesto ---------- */

.manifesto {
  min-height: 105vh;
  display: flex;
  align-items: center;
  padding: clamp(7rem, 20vh, 13rem) 0;
}
.manifesto .wrap { max-width: 1200px; }
.manifesto-text {
  font-family: var(--font-head);
  font-stretch: 108%;
  font-weight: 650;
  font-size: clamp(1.75rem, 0.9rem + 3.3vw, 3.9rem);
  line-height: 1.1;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.manifesto-text em { font-style: normal; color: var(--accent); }
.manifesto-text .w { transition: opacity 0.5s ease; }
.js.motion-ok .manifesto-text.is-ready .w { opacity: 0.13; }
.js.motion-ok .manifesto-text.is-ready .w.is-lit { opacity: 1; }

/* ---------- 03 Capabilities ---------- */

.cap { position: relative; border-bottom: 1px solid var(--line); }
.caps-list { border-top: 1px solid var(--line); }
.cap::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), rgba(var(--accent-rgb), 0));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.9s var(--ease);
}
.js .cap.is-active::before { transform: scaleX(1); }

.cap h3 { font: inherit; letter-spacing: normal; }
.cap-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.5rem;
  padding: 1.25rem 0;
  background: none;
  border: 0;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: color 0.35s ease;
}
.js .cap-btn { color: var(--text-dim); }
.js .cap.is-active .cap-btn,
.js .cap-btn:hover { color: var(--text); }

.cap-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  transition: color 0.35s ease;
}
.cap.is-active .cap-num { color: var(--accent); }

.cap-title {
  font-family: var(--font-head);
  font-stretch: 108%;
  font-weight: 650;
  font-size: clamp(1.2rem, 0.9rem + 1.35vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.018em;
  transition: transform 0.6s var(--ease);
}
.js .cap.is-active .cap-title { transform: translateX(0.45rem); }

.cap-mark {
  position: relative;
  align-self: center;
  width: 14px;
  height: 14px;
  opacity: 0.6;
  transition: transform 0.6s var(--ease), opacity 0.3s ease;
}
.cap-mark::before,
.cap-mark::after {
  content: "";
  position: absolute;
  left: 0;
  top: 6.5px;
  width: 14px;
  height: 1px;
  background: currentColor;
  transition: transform 0.6s var(--ease), background 0.3s ease;
}
.cap-mark::after { transform: rotate(90deg); }
.cap.is-active .cap-mark { opacity: 1; color: var(--accent); }
.cap.is-active .cap-mark::after { transform: rotate(0deg); }
html:not(.js) .cap-mark { display: none; }

.cap-panel { display: grid; grid-template-rows: 1fr; }
.js .cap-panel { grid-template-rows: 0fr; transition: grid-template-rows 0.7s var(--ease); }
.js .cap.is-active .cap-panel { grid-template-rows: 1fr; }
.cap-panel > div { min-height: 0; overflow: hidden; }
.cap-panel p {
  max-width: 34rem;
  padding: 0 0 1.6rem 3.9rem;
  color: var(--text-dim);
}

.hud { display: none; }

/* ---------- 04 Process ---------- */

.process { padding: clamp(5rem, 14vh, 9rem) 0; }
.process-sticky { position: relative; }

.phases { position: relative; }
.phases::before,
.phases::after {
  content: "";
  position: absolute;
  left: calc(0.975rem - 0.5px);
  top: 1.2rem;
  bottom: 1.2rem;
  width: 1px;
  background: var(--line-strong);
}
.phases::after {
  background: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.9);
  transform: scaleY(var(--p, 0));
  transform-origin: top;
  will-change: transform;
}

.phase {
  position: relative;
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  padding: 0.8rem 0;
}
.phase-num {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 1.95rem;
  height: 1.95rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}
.phase h3 {
  padding-top: 0.2rem;
  font-size: clamp(1.15rem, 0.95rem + 0.9vw, 1.7rem);
  font-stretch: 108%;
  transition: color 0.4s ease;
}
.phase-text { display: grid; grid-template-rows: 1fr; }
.phase-text > div { min-height: 0; overflow: hidden; }
.phase-text p { max-width: 31rem; padding-top: 0.55rem; color: var(--text-dim); }

.process-meter { display: none; }

/* Scroll-scrubbed mode: section pins, phases advance with scroll */
@media (min-height: 600px) {
  .js.motion-ok .process { height: 430vh; padding: 0; }
  .js.motion-ok .process-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    display: flex;
    align-items: center;
    padding-top: var(--nav-h);
  }
}
.process.is-scrub .section-head { margin-bottom: clamp(1.4rem, 3.5vh, 2.6rem); }
.process.is-scrub .phase { color: var(--text-faint); }
.process.is-scrub .phase h3 { color: var(--text-faint); }
.process.is-scrub .phase.is-done h3 { color: var(--text-dim); }
.process.is-scrub .phase.is-active h3 { color: var(--text); }
.process.is-scrub .phase.is-done .phase-num { border-color: var(--accent-dim); color: var(--accent); }
.process.is-scrub .phase.is-active .phase-num {
  border-color: var(--accent);
  background: var(--accent);
  color: #04121a;
  box-shadow: 0 0 24px rgba(var(--accent-rgb), 0.6);
}
.process.is-scrub .phase-text {
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.7s var(--ease), opacity 0.45s ease;
}
.process.is-scrub .phase.is-active .phase-text { grid-template-rows: 1fr; opacity: 1; }

.process.is-scrub .process-meter {
  position: absolute;
  right: var(--gutter);
  bottom: 1.6rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--text-faint);
}
.process-meter span { color: var(--accent); font-size: 1rem; font-weight: 600; }
.process-meter i { display: block; width: 44px; height: 1px; background: var(--line-strong); }

/* ---------- 05 Why ---------- */

.why { padding-bottom: clamp(4rem, 10vh, 7rem); }

.why-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.why-card {
  position: relative;
  padding: 1.9rem 1.6rem 1.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(13, 20, 34, 0.88), rgba(8, 12, 22, 0.8));
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}
.why-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(var(--accent-rgb), 0.16), transparent 62%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
.why-card::after {
  --c: var(--steel);
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) top left / 14px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 1px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 14px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 1px 14px no-repeat;
}
.why-card:hover {
  border-color: rgba(var(--accent-rgb), 0.42);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 34px rgba(var(--accent-rgb), 0.08);
}
.why-card:hover::before { opacity: 1; }
.why-card:hover::after { --c: var(--accent); }
.why-card > * { position: relative; }

.why-num {
  display: block;
  margin-bottom: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.why-card h3 { margin-bottom: 0.6rem; font-size: 1.22rem; }
.why-card p { color: var(--text-dim); font-size: 0.97rem; line-height: 1.6; }

.experience {
  max-width: 22em;
  margin-top: clamp(4rem, 11vh, 7rem);
  font-family: var(--font-head);
  font-stretch: 108%;
  font-weight: 620;
  font-size: clamp(1.45rem, 0.9rem + 2.1vw, 2.7rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  color: var(--text-dim);
  text-wrap: balance;
}
.experience strong { font-weight: inherit; color: var(--text); }
.experience-tag { font-stretch: 100%; }

/* ---------- 06 Contact / brief builder ---------- */

.contact { padding-bottom: clamp(5rem, 12vh, 8rem); }
.contact-inner { max-width: 820px; }

.brief {
  position: relative;
  padding: clamp(1.4rem, 3.6vw, 2.7rem);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(8, 12, 22, 0.86);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.brief[hidden] { display: none; }
.brief::after {
  --c: var(--accent);
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) top left / 18px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 1px 18px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 18px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 1px 18px no-repeat;
}

.brief-top { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.9rem; }
.brief-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-faint);
}
.brief-count b { color: var(--accent); font-weight: 600; }
.brief-bar { position: relative; flex: 1; height: 2px; background: var(--line); }
.brief-bar i {
  position: absolute;
  inset: 0;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.9);
  transform: scaleX(0.25);
  transform-origin: left;
  transition: transform 0.8s var(--ease);
}

.brief-step { display: none; min-width: 0; border: 0; }
.brief-step.is-active { display: block; animation: step-in 0.7s var(--ease) both; }
@keyframes step-in {
  from { opacity: 0; transform: translate3d(22px, 0, 0); }
  to { opacity: 1; transform: none; }
}
.brief.is-back .brief-step.is-active { animation-name: step-in-back; }
@keyframes step-in-back {
  from { opacity: 0; transform: translate3d(-22px, 0, 0); }
  to { opacity: 1; transform: none; }
}

.brief-step legend,
.brief-result h3 {
  float: left;
  width: 100%;
  padding: 0;
  font-family: var(--font-head);
  font-stretch: 108%;
  font-weight: 700;
  font-size: clamp(1.4rem, 1rem + 1.6vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  outline: none;
}
.brief-help {
  clear: both;
  padding: 0.75rem 0 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.chips { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.chip { position: relative; cursor: pointer; }
.chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.chip span {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(13, 20, 34, 0.7);
  font-size: 0.96rem;
  line-height: 1.3;
  color: var(--text-dim);
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease, box-shadow 0.3s ease;
}
.chip span::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border: 1px solid var(--steel);
  transform: rotate(45deg);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.3s ease;
}
.chip:hover span { border-color: rgba(var(--accent-rgb), 0.6); color: var(--text); }
.chip input:checked + span {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--text);
  box-shadow: 0 0 24px rgba(var(--accent-rgb), 0.14), inset 0 0 0 1px rgba(var(--accent-rgb), 0.25);
}
.chip input:checked + span::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field-wide { grid-column: 1 / -1; }
.field > span {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.field input,
.field textarea {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(5, 7, 13, 0.75);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  resize: vertical;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16);
}

.brief-preview {
  clear: both;
  max-height: 19rem;
  margin: 1.3rem 0 1.5rem;
  padding: 1.2rem 1.3rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  background: rgba(5, 7, 13, 0.8);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-dim);
}
.brief-result h3 { margin-bottom: 0.2rem; }
.brief-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.brief-note { margin-top: 1.1rem; font-size: 0.86rem; color: var(--text-faint); }
.brief-error { min-height: 1.5em; margin-top: 1rem; font-size: 0.9rem; color: var(--warn); }
.brief-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.5rem; }
.brief-nav [hidden] { display: none; }
#brief-next { margin-left: auto; }

.contact-fallback { text-align: center; }
.js-brief .contact-fallback { display: none; }

.contact-email {
  margin-top: 2.2rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--text-dim);
}
.contact-email a {
  color: var(--text);
  border-bottom: 1px solid var(--accent-dim);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.contact-email a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Footer ---------- */

.footer {
  overflow: hidden;
  padding-top: 2.4rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(rgba(5, 7, 13, 0.72), rgba(5, 7, 13, 0.97) 60%);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.2rem 2rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.7rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.footer-links a,
.footer-note a { transition: color 0.2s ease; }
.footer-links a:hover,
.footer-note a:hover { color: var(--accent); }
.footer-note { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim); }
.footer-tech {
  margin-top: 2.2rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.footer-word {
  margin-top: 1.4rem;
  margin-bottom: -0.16em;
  font-family: var(--font-head);
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(2.4rem, 11vw, 13rem);
  line-height: 0.8;
  letter-spacing: -0.03em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  color: transparent;
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.2), rgba(var(--accent-rgb), 0) 82%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 1px rgba(140, 162, 205, 0.2);
  user-select: none;
}

/* ---------- 404 page ---------- */

.notfound-main {
  position: relative;
  z-index: 2;
  max-width: var(--wrap);
  min-height: 100vh;
  min-height: 100svh;
  margin-inline: auto;
  padding: 3rem var(--gutter);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}
.notfound-main .brand { margin-bottom: clamp(3rem, 12vh, 7rem); }

/* ---------- Motion staging ---------- */

.js.motion-ok [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  transition-delay: var(--d, 0ms);
}
.js.motion-ok [data-reveal].is-in { opacity: 1; transform: none; }

.js.motion-ok [data-split] { visibility: hidden; }
.js.motion-ok [data-split].is-split { visibility: visible; }
.line-mask { padding-bottom: 0.14em; margin-bottom: -0.14em; }

.js.motion-ok .why-card.is-in {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}
.js.motion-ok .why-card.is-live {
  transition: transform 0.25s ease-out, border-color 0.35s ease, box-shadow 0.35s ease;
}

.reveal-all [data-reveal] { opacity: 1 !important; transform: none !important; }
.reveal-all [data-split] { visibility: visible !important; }

/* ---------- Desktop layout ---------- */

@media (min-width: 1000px) {
  .split-left { grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr); }
  .split-right { grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); }
  .split-right > .split-main { grid-column: 2; }

  .hero::before {
    background: linear-gradient(90deg, rgba(5, 7, 13, 0.8) 0%, rgba(5, 7, 13, 0.5) 36%, rgba(5, 7, 13, 0) 62%);
  }
  .caps::before,
  .why::before {
    background: linear-gradient(90deg, rgba(5, 7, 13, 0.86) 0%, rgba(5, 7, 13, 0.62) 44%, rgba(5, 7, 13, 0) 70%);
  }
  .process-sticky::before {
    background: linear-gradient(270deg, rgba(5, 7, 13, 0.86) 0%, rgba(5, 7, 13, 0.62) 44%, rgba(5, 7, 13, 0) 70%);
  }
  .manifesto::before,
  .contact::before {
    background: radial-gradient(ellipse 62% 60% at 50% 50%, rgba(5, 7, 13, 0.78), rgba(5, 7, 13, 0) 78%);
    -webkit-mask-image: none;
    mask-image: none;
  }

  .hud {
    position: sticky;
    bottom: 2.2rem;
    align-self: end;
    justify-self: end;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 15rem;
    margin-bottom: 0.5rem;
    padding: 0.2rem 1.2rem 0.2rem 0;
    border-right: 1px solid var(--accent-dim);
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-faint);
  }
  .experience { max-width: 15.5em; }
  .hud-val { margin-left: 0.9rem; color: var(--accent); }
  .hud-title { min-height: 1.4em; font-size: 0.78rem; letter-spacing: 0.1em; color: var(--text); }
  .hud-live::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 0.55rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    vertical-align: 1px;
    animation: blink 1.8s ease-in-out infinite;
  }

  .why-card,
  .brief {
    -webkit-backdrop-filter: blur(14px) saturate(1.25);
    backdrop-filter: blur(14px) saturate(1.25);
  }
  .why-card { background: linear-gradient(160deg, rgba(13, 20, 34, 0.7), rgba(8, 12, 22, 0.58)); }
  .brief { background: rgba(8, 12, 22, 0.62); }
}

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .brand-lockup { height: 38px; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: calc(100vh - var(--nav-h));
    height: calc(100dvh - var(--nav-h));
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: clamp(1rem, 3.5vh, 1.8rem);
    padding: clamp(1.5rem, 9vh, 5rem) var(--gutter) 3rem;
    overflow-y: auto;
    background: var(--bg);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.35s ease, transform 0.5s var(--ease), visibility 0s linear 0.35s;
  }
  .nav-links.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition-delay: 0s;
  }
  .nav-links a:not(.btn) {
    font-family: var(--font-head);
    font-stretch: 110%;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: none;
    color: var(--text);
  }
  .nav-links .btn { margin-top: 1rem; font-size: 0.86rem; padding: 1.05em 1.9em; }
  .nav.is-open { background: var(--bg); }
}

@media (max-width: 720px) {
  .hero { padding-bottom: 8.5rem; }
  .why-cards { grid-template-columns: minmax(0, 1fr); }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .cap-btn { grid-template-columns: 2.7rem minmax(0, 1fr) auto; }
  .cap-panel p { padding-left: 3.2rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 520px) {
  .eyebrow, .experience-tag { font-size: 0.68rem; letter-spacing: 0.17em; }
  .cta-row .btn { width: 100%; }
  .brief-actions .btn { width: 100%; }
  .chip, .chip span { width: 100%; }
}

/* ---------- Reduced motion ---------- */

.motion-reduce .marquee-track,
.motion-reduce .scroll-cue i,
.motion-reduce .hero-hint b,
.motion-reduce .hud-live::before { animation: none; }
.motion-reduce .scroll-cue { display: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .marquee-track { animation: none !important; }
}
