/* ==========================================================
   Tokens
   ========================================================== */
:root {
  --black:     #000000;
  --ink:       #f5f5f7;
  --muted:     #a1a1a6;
  --dim:       #6e6e73;
  --surface:   #1c1c1e;
  --surface-2: #2c2c2e;
  --line:      rgba(255, 255, 255, 0.14);
  --signal:    #ffd60a;   /* the "person" box colour of the camera overlay */
  --go:        #30d158;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --wrap: 1080px;
  --gutter: clamp(16px, 4vw, 40px);
  --nav-h: 52px;
  --section: clamp(5rem, 12vw, 9.5rem);

  color-scheme: dark;
}

/* ==========================================================
   Base
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, video, iframe, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

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

[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--signal);
  color: var(--black);
  border-radius: 8px;
  font-weight: 600;
}
.skip:focus { top: 12px; }

/* Placeholders you still have to fill in: impossible to miss */
.ph {
  color: var(--signal);
  background: rgba(255, 214, 10, 0.12);
  outline: 1px dashed rgba(255, 214, 10, 0.7);
  outline-offset: 2px;
  border-radius: 4px;
  padding: 0 0.12em;
}

/* ==========================================================
   Nav
   ========================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: rgba(0, 0, 0, 0.84);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
          backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}

.nav__inner {
  max-width: var(--wrap);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav__name {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav__links {
  display: flex;
  gap: clamp(14px, 3vw, 28px);
  font-size: 0.8125rem;
}

.nav__links a {
  position: relative;
  display: inline-block;
  line-height: var(--nav-h);
  color: var(--muted);
  transition: color 0.2s;
}

/* reading progress through each project, on the nav's bottom edge */
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--signal);
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
}
.nav__links a:hover,
.nav__links a.is-active { color: var(--ink); }

/* ==========================================================
   Shared type and buttons
   ========================================================== */
h2 {
  font-size: clamp(2.5rem, 6.4vw, 5rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

h3 {
  font-size: clamp(1.75rem, 3.6vw, 2.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.lede {
  font-size: clamp(1.2rem, 2.1vw, 1.5rem);
  line-height: 1.4;
  color: var(--muted);
  max-width: 36em;
  margin-inline: auto;
  text-wrap: pretty;
}


/* ==========================================================
   Hero: the name, then an index of the projects
   ========================================================== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(4.5rem, 12vh, 7.5rem) var(--gutter) clamp(4rem, 10vh, 6rem);
}

/* The name comes into focus like a lens hunting for it, then a short
   bar draws underneath once focus locks. */
.hero__name {
  position: relative;
  font-size: clamp(2.5rem, 10vw, 8.25rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
  white-space: nowrap;
  padding-bottom: 0.22em;
  animation: focus-hunt 1.2s cubic-bezier(0.3, 0.6, 0.2, 1) 0.15s both;
}

.hero__name::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1.1em;
  height: 3px;
  margin-left: -0.55em;
  border-radius: 2px;
  background: var(--signal);
  transform: scaleX(0);
  animation: focus-lock 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) 1.3s both;
}

@keyframes focus-hunt {
  0%   { opacity: 0;   filter: blur(6px);   transform: scale(1.012); }
  40%  { opacity: 1;   filter: blur(1px); }
  62%  {               filter: blur(2.5px); }
  100% { opacity: 1;   filter: blur(0);     transform: none; }
}

@keyframes focus-lock {
  to { transform: scaleX(1); }
}

/* Project index under the name */
.index {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: 100%;
  max-width: 780px;
  margin-top: 48px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.index li + li { border-left: 1px solid var(--line); }

.index a {
  display: block;
  height: 100%;
  padding: 22px 26px 6px;
}

.index__name {
  display: block;
  color: var(--signal);
  font-size: 0.95rem;
  font-weight: 700;
}

.index__title {
  display: block;
  margin-top: 6px;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.index a:hover .index__title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* ==========================================================
   Project rail (scrollspy), wide screens only
   ========================================================== */
.rail { display: none; }

@media (min-width: 1360px) {
  .rail {
    display: block;
    position: fixed;
    top: 50%;
    left: max(24px, calc((100vw - var(--wrap)) / 2 - 176px));
    z-index: 40;
    transform: translateY(-50%);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
  }
  .rail.is-visible { opacity: 1; visibility: visible; }
}

.rail ol {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail__link {
  display: grid;
  grid-template-columns: 3px auto;
  column-gap: 14px;
  min-height: 72px;
  color: var(--dim);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  transition: color 0.2s;
}

.rail__link:hover,
.rail__link.is-active { color: var(--ink); }

.rail__bar {
  position: relative;
  border-radius: 2px;
  background: var(--surface-2);
  overflow: hidden;
}

.rail__fill {
  position: absolute;
  inset: 0;
  background: var(--signal);
  transform: scaleY(0);
  transform-origin: top;
}

.rail__label { padding-top: 1px; max-width: 8.5em; }

/* ==========================================================
   Project
   ========================================================== */
.project {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: var(--section) var(--gutter) 0;
  border-top: 1px solid var(--line);
}

.section-head {
  text-align: center;
}
.section-head h2 { margin: 20px auto 24px; max-width: 13em; }

.project__name {
  color: var(--signal);
  font-weight: 700;
  font-size: clamp(1.1rem, 1.9vw, 1.35rem);
  letter-spacing: -0.01em;
}

/* ---------- Film ---------- */
.film {
  margin-top: clamp(3rem, 7vw, 5rem);
}

.film__frame {
  position: relative;
  aspect-ratio: 16 / 9;          /* reserves space so anchor links land in the right place */
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}

.film__frame video,
.film__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  background: var(--black);
}

.film__placeholder {
  position: absolute;
  inset: 0;
}

.film__placeholder--single { display: block; padding: 0; }
.film__placeholder--single svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.pane {
  background: linear-gradient(180deg, #1f1f22, #0c0c0d);
  overflow: hidden;
}

.pane__label {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: clamp(0.62rem, 1.1vw, 0.8rem);
  color: var(--dim);
  font-weight: 600;
}

.pane__box {
  position: absolute;
  left: 30%;
  top: 38%;
  width: 16%;
  height: 34%;
  border: 2px solid var(--signal);
  opacity: 0.8;
}
.pane__box--b { left: 58%; top: 34%; width: 12%; height: 28%; }

.film__soon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--line);
  font-size: clamp(0.8rem, 1.5vw, 1rem);
  font-weight: 600;
  white-space: nowrap;
}

/* Security Agent: one 9:8 video. Two 4:3 camera views stacked on the left
   (960x720 each) and the chat on a phone on the right (660x1440). */
.film__frame--split {
  aspect-ratio: 9 / 8;
  max-width: 820px;
  margin: 0 auto;
}

.film__placeholder--split {
  display: grid;
  grid-template-columns: 960fr 660fr;
  grid-template-rows: 1fr 1fr;
}

.pane--cam { position: relative; border-bottom: 1px solid var(--line); }
.pane--cam + .pane--cam { border-bottom: 0; }

.pane--phone {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  position: relative;
  margin: 5% 9%;
  padding: 16px 14px;
  border: 2px solid var(--surface-2);
  border-radius: 28px;
}

.pane__line { height: 8px; border-radius: 4px; background: var(--surface-2); }
.pane__line--short { width: 60%; }

.film__caption {
  margin-top: 32px;
}

.film__title {
  font-weight: 600;
  margin-bottom: 14px;
}

.chapters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 28px 20px;
  counter-reset: ch;
}

.chapters li {
  counter-increment: ch;
  position: relative;
  padding-top: 14px;
  border-top: 2px solid var(--surface-2);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.chapters li::before {
  content: counter(ch);
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Results ---------- */
.results {
  margin-top: var(--section);
}

.block-title {
  text-align: center;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: clamp(24px, 4vw, 56px);
  row-gap: clamp(40px, 6vw, 72px);
}

.stat__value {
  font-size: clamp(3rem, 6.5vw, 5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.stat__text {
  margin-top: 14px;
  color: var(--muted);
  max-width: 19em;
  text-wrap: pretty;
}

/* ---------- Flow ---------- */
.flow {
  margin-top: var(--section);
}

.flow__steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(24px, 4vw, 48px);
}

/* connector running behind the icons */
.flow__steps::before {
  content: "";
  position: absolute;
  top: 27px;
  left: calc((100% - 2 * clamp(24px, 4vw, 48px)) / 6);    /* centre of the first icon */
  right: calc((100% - 2 * clamp(24px, 4vw, 48px)) / 6);   /* centre of the last icon */
  height: 2px;
  background: linear-gradient(90deg, var(--signal), rgba(255, 214, 10, 0.15));
}

.flow__step { position: relative; text-align: center; }

.flow__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--black);
  border: 2px solid var(--signal);
  margin: 0 auto 22px;
}

.flow__icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.flow__step h4 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.flow__step p { color: var(--muted); max-width: 22em; margin-inline: auto; }

/* ---------- Features ---------- */
.feature {
  margin-top: var(--section);
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}

.feature--flip .feature__text { order: 2; }

.feature__text h3 { margin-bottom: 20px; }
.feature__text p { color: var(--muted); max-width: 30em; }
.feature__text p + p { margin-top: 14px; }

.feature__visual figcaption {
  margin-top: 14px;
  color: var(--dim);
  font-size: 0.9rem;
  text-align: center;
}

/* SVG scenes */
.scene { width: 100%; height: auto; font-family: var(--font); }
.scene__ground line { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1.5; }
.scene__obj { fill: #3a3a3c; }
.scene__ghost { fill: #3a3a3c; }
.scene__wheel { fill: #242426; stroke: #3a3a3c; stroke-width: 3; }
.scene__label { fill: var(--dim); font-size: 18px; font-weight: 600; }
.scene__link { fill: none; stroke: var(--signal); stroke-width: 2; stroke-dasharray: 6 6; opacity: 0.6; }

.scene__court path,
.scene__court rect { fill: none; stroke: rgba(255, 255, 255, 0.22); stroke-width: 2; }
.scene__court--faint path { stroke: rgba(255, 255, 255, 0.1); }
.scene__court--map rect,
.scene__court--map path { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1.5; }
.scene__net { fill: none; stroke: rgba(255, 255, 255, 0.45); stroke-width: 4; }
.scene__ball { fill: #c9d65c; }            /* optic yellow-green, distinct from the box colour */
.scene__decoy { fill: #5a5a5e; }
.scene__map { fill: rgba(0, 0, 0, 0.78); stroke: var(--line); stroke-width: 1.5; }
.scene__leader { stroke: var(--signal); stroke-width: 1.5; stroke-dasharray: 4 5; opacity: 0.7; }
.scene__predict { fill: none; stroke: var(--signal); stroke-width: 2.5; stroke-dasharray: 7 7; }
.scene__bounce { fill: rgba(255, 214, 10, 0.18); stroke: var(--signal); stroke-width: 2.5; }

.px rect { fill: #1d1d20; }
.px .px--1 { fill: #29292d; }
.px .px--2 { fill: #6f7640; }
.px .px--3 { fill: #c9d65c; }

.box { fill: none; stroke-width: 3; }
.box--thin { stroke-width: 2; }
.box--live { stroke: var(--signal); }
.box--idle { stroke: var(--dim); stroke-dasharray: 8 6; }

.tag text { font-size: 20px; font-weight: 700; }
.tag--live rect { fill: var(--signal); }
.tag--live text { fill: var(--black); }
.tag--idle rect { fill: var(--surface-2); }
.tag--idle text { fill: var(--muted); }

.pill rect { fill: var(--black); stroke: var(--signal); stroke-width: 1.5; }
.pill text { fill: var(--ink); font-size: 18px; font-weight: 600; }

/* ---------- House map (street map in a dark map style) ---------- */
.map__lawn { fill: #161d18; }
.map__walk rect { fill: #242427; }
.map__road rect { fill: #313135; }
.map__drive, .map__drive rect { fill: #29292c; }
.map__house, .map__house rect { fill: #26262a; stroke: #313136; stroke-width: 1; }
.map__house--home { fill: #2e2e33; stroke: #45454b; stroke-width: 1.5; }
.map__fence { fill: none; stroke: #4a4a50; stroke-width: 2; }
.map__gate { fill: none; stroke: #8e8e93; stroke-width: 2; stroke-dasharray: 3 3; }
.map__tree circle { fill: #1c3324; }
.map__place text {
  fill: #a1a1a6;
  font-size: 12.5px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: central;
}
.map__street text {
  fill: #86868b;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-anchor: middle;
  dominant-baseline: central;
}

.map__fov {
  fill: rgba(255, 214, 10, 0.07);
  stroke: rgba(255, 214, 10, 0.35);
  stroke-width: 1.5;
  transition: fill 0.25s, stroke 0.25s;
}
.map__fov.is-active { fill: rgba(255, 214, 10, 0.22); stroke: var(--signal); }

.map__route { fill: none; stroke: #6e6e73; stroke-width: 2.5; stroke-dasharray: 4 7; stroke-linecap: round; }
.map__seen { fill: none; stroke: var(--signal); stroke-width: 4; stroke-linecap: round; }

.map__cam circle { fill: var(--black); stroke: var(--signal); stroke-width: 2.5; transition: fill 0.25s; }
.map__cam text { fill: var(--signal); font-size: 13px; font-weight: 700; transition: fill 0.25s; }
.map__cam.is-active circle { fill: var(--signal); }
.map__cam.is-active text { fill: var(--black); }

.map__car-body rect { fill: var(--ink); }
.map__car-glass { fill: #48484a; }

/* tracking box and tag: only while a camera sees the car */
.map__spot { opacity: 0; transition: opacity 0.15s; }
.map.is-seen .map__spot { opacity: 1; }
.map .tag text { font-size: 15px; }

.map__scale rect { fill: rgba(0, 0, 0, 0.7); }
.map__scale text { fill: var(--muted); font-size: 12px; font-weight: 600; }
.map__scale path { fill: none; stroke: var(--muted); stroke-width: 2; }
.map__edge { fill: none; stroke: var(--line); stroke-width: 1.5; }

/* ---------- Chat mock ---------- */
.chat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(18px, 3vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.msg {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
}

.msg__who {
  font-weight: 700;
  font-size: 0.875rem;
  margin-bottom: 2px;
}

.msg--you .msg__who { color: var(--muted); }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.avatar--you {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
}

/* the bot's avatar is a tiny tracking box */
.avatar--bot {
  background: var(--signal);
  position: relative;
}
.avatar--bot::after {
  content: "";
  width: 12px;
  height: 16px;
  border: 2px solid var(--black);
  border-radius: 1px;
}

.cmd {
  display: inline-block;
  padding: 0 6px;
  border-radius: 5px;
  background: rgba(255, 214, 10, 0.14);
  color: var(--signal);
  font-weight: 600;
}

.ok { color: var(--go); font-weight: 600; }

.chat__gap {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--dim);
  font-size: 0.8rem;
  font-weight: 600;
}
.chat__gap::before,
.chat__gap::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.msg--alert > div {
  border-left: 3px solid var(--signal);
  padding-left: 12px;
}

/* ---------- Stack ---------- */
.stack {
  margin-top: var(--section);
  padding-bottom: var(--section);
  text-align: center;
}

.block-title--small {
  font-size: 1.1rem;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 18px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 44em;
  margin: 0 auto;
}

.chips li {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--ink);
}

/* ==========================================================
   Footer
   ========================================================== */
.footer {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 28px var(--gutter) 40px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.8125rem;
}

.footer a { color: var(--muted); }
.footer a:hover { color: var(--ink); }

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .feature { grid-template-columns: 1fr; }
  .feature--flip .feature__text { order: 0; }
}

@media (max-width: 640px) {
  .nav__name { font-size: 0.875rem; }
  .nav__links { gap: 14px; }

  .film__frame { border-radius: 14px; }

  .stats { grid-template-columns: 1fr; }

  .flow__steps { grid-template-columns: 1fr; gap: 36px; }
  .flow__steps::before { display: none; }
  /* one connector per step, from its icon down to the next icon */
  .flow__step:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 27px;
    top: 56px;
    bottom: -36px;
    width: 2px;
    background: var(--signal);
    opacity: 0.6;
  }
  .flow__step {
    text-align: left;
    display: grid;
    grid-template-columns: 56px 1fr;
    column-gap: 18px;
  }
  .flow__icon { grid-row: 1 / span 2; margin: 0; }
  .flow__step h4 { align-self: end; }
  .flow__step p { margin-inline: 0; }

  .index { grid-template-columns: 1fr; }
  .index li + li { border-left: 0; border-top: 1px solid var(--line); }
  .index a { padding: 18px 4px 16px; }
}

@media (max-width: 480px) {
  .nav__more { display: none; }
}

/* ==========================================================
   Motion preferences
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
