/* ─────────────────────────────────────────────────────────────
   Logan Vimalaraj — portfolio
   Paper + ink, one signal-orange accent. Engineering-drawing details.
   ───────────────────────────────────────────────────────────── */

@property --z {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}

:root {
  --paper: #f1f0eb;
  --paper-2: #e6e4dd;
  --ink: #0f0f0e;
  --ink-2: #1b1b19;
  --accent: #ff4f12;

  --bg: var(--paper);
  --fg: var(--ink);
  --surface: var(--paper-2);
  --muted: color-mix(in srgb, currentColor 56%, transparent);
  --line: color-mix(in srgb, currentColor 16%, transparent);

  --sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --radius: 14px;

  color-scheme: light;
}

html.is-dark {
  --bg: var(--ink);
  --fg: #ecebe5;
  --surface: var(--ink-2);
  color-scheme: dark;
}

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

html.lenis,
html.lenis body {
  height: auto;
}
.lenis.lenis-stopped {
  overflow: clip;
}
.lenis [data-lenis-prevent] {
  overscroll-behavior: contain;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  transition:
    background-color 0.8s var(--ease-io),
    color 0.8s var(--ease-io);
}

img,
video,
svg,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

ol,
ul {
  list-style: none;
}

em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

::selection {
  background: var(--accent);
  color: #fff;
}

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

.skip {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  transition: top 0.3s var(--ease);
}
.skip:focus {
  top: 16px;
}

/* ── Utilities ─────────────────────────────────────────── */

.wrap {
  width: min(100% - var(--gutter) * 2, 1400px);
  margin-inline: auto;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}

.idx {
  color: var(--accent);
  margin-right: 0.9em;
}

.h2 {
  font-size: clamp(2.6rem, 6.6vw, 6.6rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-weight: 500;
}
.h2 em,
.h3 em,
.contact__title em {
  letter-spacing: -0.02em;
  padding-right: 0.04em;
}

.h3 {
  font-size: clamp(1.9rem, 3.6vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.035em;
  font-weight: 500;
}

.lead {
  font-size: clamp(1.25rem, 1.9vw, 1.75rem);
  line-height: 1.3;
  letter-spacing: -0.015em;
  max-width: 32ch;
}

.link {
  position: relative;
  text-decoration: none;
  white-space: nowrap;
}
.link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: currentColor;
  transform-origin: right;
  opacity: 0.5;
}
.link:hover::after,
.link:focus-visible::after {
  animation: underline 0.7s var(--ease-io) forwards;
}
@keyframes underline {
  0% {
    transform: scaleX(1);
    transform-origin: right;
    opacity: 0.5;
  }
  49% {
    transform: scaleX(0);
    transform-origin: right;
  }
  50% {
    transform: scaleX(0);
    transform-origin: left;
  }
  100% {
    transform: scaleX(1);
    transform-origin: left;
    opacity: 1;
  }
}

.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  white-space: nowrap;
  transition:
    color 0.5s var(--ease),
    border-color 0.5s var(--ease);
}
.pill::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--fg);
  border-radius: inherit;
  transform: translateY(101%);
  transition: transform 0.55s var(--ease);
}
.pill:hover {
  color: var(--bg);
  border-color: var(--fg);
}
.pill:hover::before {
  transform: translateY(0);
}
.pill svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  transition: transform 0.5s var(--ease);
}
.pill:hover svg {
  transform: translateY(2px);
}
.pill--solid {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.pill--solid::before {
  background: var(--accent);
}
.pill--solid:hover {
  color: #fff;
  border-color: var(--accent);
}
.pill__pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 2.2s var(--ease) infinite;
}
.pill--solid:hover .pill__pulse {
  background: #fff;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent);
  }
  80%,
  100% {
    box-shadow: 0 0 0 9px transparent;
  }
}

.pointer-only,
.touch-only {
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .pointer-only {
    display: inline;
  }
}
@media not ((hover: hover) and (pointer: fine)) {
  .touch-only {
    display: inline;
  }
}

/* Hide intro targets until JS has set their start state */
.js:not(.is-ready) [data-intro],
.js:not(.is-ready) [data-hero-title],
.js:not(.is-ready) .hero__canvas {
  opacity: 0;
}

/* ── Progress + Nav ───────────────────────────────────── */

.progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: 70;
  pointer-events: none;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
}

.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 22px var(--gutter);
  color: #fff;
  mix-blend-mode: difference;
  transition: transform 0.7s var(--ease);
}
.nav.is-hidden {
  transform: translateY(-110%);
}
.nav__mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-decoration: none;
  justify-self: start;
}
.nav__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.nav__links {
  display: flex;
  gap: clamp(16px, 2.4vw, 36px);
}
.nav__links a,
.nav__clock {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.nav__clock {
  justify-self: end;
  opacity: 0.8;
}
.nav__clock time {
  font-variant-numeric: tabular-nums;
}

[data-roll] {
  position: relative;
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}
[data-roll] .roll__a,
[data-roll] .roll__b {
  display: block;
  transition: transform 0.55s var(--ease);
}
[data-roll] .roll__b {
  position: absolute;
  inset: 0;
  transform: translateY(105%);
}
[data-roll]:hover .roll__a {
  transform: translateY(-105%);
}
[data-roll]:hover .roll__b {
  transform: translateY(0);
}

@media (max-width: 820px) {
  .nav {
    grid-template-columns: 1fr auto;
  }
  .nav__links {
    display: none;
  }
}

/* ── Hero ─────────────────────────────────────────────── */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 620px;
  padding: 84px var(--gutter) clamp(64px, 8vw, 108px);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  touch-action: pan-y;
}
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero__frame {
  position: absolute;
  inset: 12px;
  border: 1px solid var(--line);
  pointer-events: none;
}
.hero__frame i {
  position: absolute;
  width: 11px;
  height: 11px;
}
.hero__frame i::before,
.hero__frame i::after {
  content: "";
  position: absolute;
  background: var(--fg);
}
.hero__frame i::before {
  left: 5px;
  top: 0;
  width: 1px;
  height: 11px;
}
.hero__frame i::after {
  top: 5px;
  left: 0;
  height: 1px;
  width: 11px;
}
.hero__frame i:nth-child(1) {
  left: -6px;
  top: -6px;
}
.hero__frame i:nth-child(2) {
  right: -6px;
  top: -6px;
}
.hero__frame i:nth-child(3) {
  left: -6px;
  bottom: -6px;
}
.hero__frame i:nth-child(4) {
  right: -6px;
  bottom: -6px;
}

.hero__top {
  position: relative;
  display: flex;
  gap: clamp(20px, 4vw, 64px);
  pointer-events: none;
}
.hero__body {
  position: relative;
  align-self: end;
  pointer-events: none;
}
.hero__body a {
  pointer-events: auto;
}
.hero__title {
  font-size: clamp(4rem, 15.6vw, 17rem);
  line-height: 0.83;
  letter-spacing: -0.058em;
  font-weight: 500;
  margin-left: -0.055em;
}
.hero__title > span,
.hero__title .line {
  display: block;
}
.hero__row {
  display: flex;
  align-items: flex-end;
  gap: clamp(24px, 4vw, 56px);
  margin-top: clamp(20px, 3vw, 40px);
}
.hero__lede {
  max-width: 36ch;
  font-size: clamp(1.1rem, 1.5vw, 1.4rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.hero__lede em {
  font-size: 1.15em;
}

.hero__block {
  position: absolute;
  top: 84px;
  right: var(--gutter);
  width: 250px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: blur(6px);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  pointer-events: none;
}
.hero__block-head {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.hero__readout {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.hero__readout div {
  display: flex;
  justify-content: space-between;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}
.hero__readout div:nth-child(odd) {
  border-right: 1px solid var(--line);
}
.hero__readout dt {
  color: var(--muted);
}
.hero__readout dd {
  font-variant-numeric: tabular-nums;
}
.hero__hint {
  padding: 8px 10px;
  color: var(--accent);
}

@media (max-width: 820px) {
  .hide-sm {
    display: none;
  }
  .hero__block {
    top: auto;
    bottom: calc(100% - 0px);
  }
  .hero__block .hero__block-head,
  .hero__block .hero__readout {
    display: none;
  }
  .hero__block {
    inset: 116px auto auto var(--gutter);
    width: auto;
    border: 0;
    background: none;
    backdrop-filter: none;
  }
  .hero__hint {
    padding: 0;
  }
  .hero__row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Statement ────────────────────────────────────────── */

.statement {
  width: min(100% - var(--gutter) * 2, 1400px);
  margin-inline: auto;
  padding-block: clamp(120px, 20vh, 240px);
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 5fr;
  gap: 24px;
}
.statement__label {
  padding-top: 0.9em;
}
.statement__text {
  font-size: clamp(1.8rem, 4.1vw, 4.1rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 500;
  text-wrap: pretty;
}
@media (max-width: 820px) {
  .statement {
    grid-template-columns: 1fr;
  }
}

/* ── Section scaffolding ─────────────────────────────── */

section {
  position: relative;
}

.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  margin-bottom: clamp(40px, 6vw, 80px);
}

.sec-head__links {
  display: flex;
  gap: 20px;
}
.dume__note .link,
.sec-head__links .link {
  color: var(--fg);
}

/* ── DUM-E ────────────────────────────────────────────── */

.dume {
  padding-block: clamp(100px, 14vw, 180px);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.2s var(--ease) infinite;
}

.dume__title {
  display: flex;
  /* "DUM-E" sets at ~3.28em wide: fill the content column exactly */
  font-size: min(calc((100vw - var(--gutter) * 2) / 3.3), 424px);
  line-height: 0.8;
  font-weight: 600;
  letter-spacing: -0.04em;
  white-space: nowrap;
  overflow: hidden;
  padding-block: 0.03em 0.05em;
}
.dume__title span {
  display: inline-block;
  will-change: transform;
}

.dume__intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-top: clamp(32px, 5vw, 64px);
}
.dume__note {
  text-align: right;
  line-height: 1.7;
}
@media (max-width: 820px) {
  .dume__intro {
    flex-direction: column;
    align-items: flex-start;
  }
  .dume__note {
    text-align: left;
  }
}

.dume__stage {
  padding-inline: var(--gutter);
  margin-top: clamp(56px, 8vw, 110px);
}
.dume__video {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface);
  max-height: 92vh;
  margin-inline: auto;
}
.dume__video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dume__video figcaption {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: clamp(14px, 2.4vw, 28px);
}
.dume__video figcaption > .mono {
  color: #fff;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(15, 15, 14, 0.45);
  backdrop-filter: blur(12px);
}

.play {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 18px 6px 6px;
  border-radius: 999px;
  background: rgba(15, 15, 14, 0.5);
  backdrop-filter: blur(14px);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  transition: background-color 0.4s var(--ease);
}
.play .mono {
  color: rgba(255, 255, 255, 0.6);
}
.play__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  transition:
    transform 0.5s var(--ease),
    background-color 0.4s var(--ease);
}
.play__icon svg {
  width: 14px;
  fill: var(--ink);
  transform: translateX(1px);
}
.play:hover {
  background: rgba(15, 15, 14, 0.75);
}
.play:hover .play__icon {
  transform: scale(1.1);
  background: var(--accent);
}
.play:hover .play__icon svg {
  fill: #fff;
}
@media (max-width: 600px) {
  .dume__video {
    aspect-ratio: 4 / 5;
  }
  .dume__video figcaption {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Anatomy */

.anatomy {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 8vw, 140px);
  margin-top: clamp(100px, 14vw, 200px);
}
.anatomy__figure-col {
  position: relative;
}
.anatomy__figure {
  position: sticky;
  top: 10vh;
  height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.anatomy__img {
  position: relative;
  flex: 1;
  min-height: 0;
  aspect-ratio: 721 / 961;
  max-width: 100%;
  margin-inline: auto;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
}
.anatomy__zoom {
  position: absolute;
  inset: 0;
  transform: scale(var(--z));
  transform-origin: var(--ox, 50%) var(--oy, 50%);
  transition:
    --z 1.3s var(--ease),
    transform-origin 1.3s var(--ease);
}
.anatomy__zoom img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.anatomy__figure[data-active="0"] {
  --z: 1.55;
  --ox: 36%;
  --oy: 38%;
}
.anatomy__figure[data-active="1"] {
  --z: 1.35;
  --ox: 63%;
  --oy: 52%;
}
.anatomy__figure[data-active="2"] {
  --z: 1.5;
  --ox: 42%;
  --oy: 86%;
}
.anatomy__figure[data-active="3"] {
  --z: 1.75;
  --ox: 47%;
  --oy: 75%;
}
.anatomy__figure[data-active="-1"] {
  --z: 1;
}
.anatomy__figure > figcaption {
  display: flex;
  justify-content: space-between;
}

.spot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%) scale(calc(1 / var(--z)));
  z-index: 2;
}
.spot::before,
.spot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
}
.spot::before {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  transition:
    background-color 0.5s var(--ease),
    transform 0.5s var(--ease);
}
.spot::after {
  border: 1px solid #fff;
  opacity: 0;
}
.spot b {
  position: absolute;
  left: 24px;
  top: 50%;
  translate: 0 -50%;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-8px);
  transition:
    opacity 0.5s var(--ease),
    transform 0.5s var(--ease);
}
.spot.is-active::before {
  background: var(--accent);
  transform: scale(1.15);
}
.spot.is-active::after {
  border-color: var(--accent);
  animation: ring 1.8s var(--ease) infinite;
}
.spot.is-active b {
  opacity: 1;
  transform: none;
}
@keyframes ring {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(3.2);
    opacity: 0;
  }
}

.step {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  opacity: 0.22;
  transition: opacity 0.7s var(--ease);
}
.step.is-active {
  opacity: 1;
}
.step h3 {
  font-size: clamp(2rem, 3.8vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 500;
}
.step p:not(.mono) {
  max-width: 40ch;
  font-size: 1.1rem;
  color: var(--muted);
}
.step .link {
  align-self: flex-start;
}
.step__n {
  color: var(--accent);
}

@media (max-width: 820px) {
  .anatomy {
    grid-template-columns: 1fr;
  }
  .anatomy__figure {
    position: relative;
    top: 0;
    height: auto;
  }
  .anatomy__img {
    width: 100%;
    flex: none;
  }
  .step {
    min-height: 0;
    padding-block: 36px;
    border-top: 1px solid var(--line);
    opacity: 1;
  }
  .anatomy__figure .spot b {
    opacity: 1;
    transform: none;
    background: rgba(15, 15, 14, 0.6);
  }
  .anatomy__figure .spot.is-active b {
    background: var(--accent);
  }
}

/* Pipeline */

.pipeline {
  margin-top: clamp(120px, 14vw, 220px);
}
.pipeline__head {
  display: grid;
  gap: 18px;
  margin-bottom: clamp(40px, 6vw, 72px);
}
.pipeline__flow {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.pipeline__flow::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: var(--line);
}
.pipeline__pulse {
  position: absolute;
  top: -1px;
  left: 0;
  width: 90px;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
  opacity: 0;
}
.node {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 28px 24px 0 0;
}
.node::before {
  content: "";
  position: absolute;
  left: 0;
  top: -4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid currentColor;
  transition:
    background-color 0.3s,
    border-color 0.3s,
    transform 0.3s var(--ease);
}
.node.is-lit::before {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.35);
}
.node strong {
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.node small {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.4;
}
.node .mono {
  transition: color 0.3s;
}
.node.is-lit .mono {
  color: var(--accent);
}
@media (max-width: 820px) {
  .pipeline__flow {
    grid-template-columns: 1fr;
    padding-left: 28px;
  }
  .pipeline__flow::before {
    inset: 0 auto 0 0;
    width: 1px;
    height: auto;
  }
  .pipeline__pulse {
    top: 0;
    left: -1px;
    width: 3px;
    height: 70px;
  }
  .node {
    padding: 0 0 36px;
  }
  .node::before {
    left: -32px;
    top: 4px;
  }
}

/* ── Arm v7 ───────────────────────────────────────────── */

.arm {
  padding-block: clamp(100px, 14vw, 180px);
}
.arm__head,
.sim__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
}
@media (max-width: 820px) {
  .arm__head,
  .sim__head {
    flex-direction: column;
    align-items: flex-start;
  }
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(56px, 8vw, 110px);
  border-top: 1px solid var(--line);
}
.stat {
  padding: 22px 20px 26px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.stat + .stat {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}
.stat dt {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}
.stat dd {
  font-size: clamp(2.8rem, 6vw, 6rem);
  line-height: 0.9;
  font-weight: 500;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}
.stat small {
  font-size: 0.32em;
  letter-spacing: 0;
  color: var(--muted);
  margin-inline: 0.25em;
  font-weight: 400;
}
@media (max-width: 820px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }
  .stat:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

/* Teleop / policy switcher: one full-bleed stage, policy only on request */
.demo {
  padding-inline: var(--gutter);
  margin-top: clamp(40px, 5vw, 64px);
}
.demo__stage {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 88vh;
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface);
  isolation: isolate;
}
.demo__slide {
  position: absolute;
  inset: 0;
  clip-path: inset(0 0 0 100%);
  transition: clip-path 1.1s var(--ease-io);
}
.demo[data-dir="back"] .demo__slide {
  clip-path: inset(0 100% 0 0);
}
.demo .demo__slide.is-active {
  clip-path: inset(0);
  z-index: 2;
}
.demo .demo__slide.is-leaving {
  clip-path: inset(0);
  z-index: 1;
  transition: none;
}
.demo__slide > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  transform: scale(1.08);
  transition:
    transform 1.4s var(--ease),
    opacity 1.1s var(--ease-io);
}
.demo__slide.is-active > video {
  transform: none;
}
.demo__slide.is-leaving > video {
  transform: scale(0.96);
  opacity: 0.4;
}

.demo__slide--policy {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  background: var(--ink);
  color: #ecebe5;
}
.demo__slide--policy > video {
  width: auto;
  height: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  object-position: center;
}
.demo__about {
  align-self: center;
  display: grid;
  gap: 20px;
  max-width: 46ch;
  padding: clamp(28px, 5vw, 80px);
}
@media (min-width: 821px) {
  .demo[data-at="1"] [data-demo-text] {
    display: none;
  }
}
.demo__about p:not(.mono) {
  font-size: 1.1rem;
  color: var(--muted);
}
.demo__about > * {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.8s var(--ease),
    transform 1s var(--ease);
}
.demo__slide.is-active .demo__about > * {
  opacity: 1;
  transform: none;
}
.demo__slide.is-active .demo__about > :nth-child(1) {
  transition-delay: 0.5s;
}
.demo__slide.is-active .demo__about > :nth-child(2) {
  transition-delay: 0.6s;
}
.demo__slide.is-active .demo__about > :nth-child(3) {
  transition-delay: 0.7s;
}

.demo__bar {
  position: absolute;
  inset: auto 0 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: clamp(14px, 2.4vw, 28px);
  pointer-events: none;
}
.demo__bar > * {
  pointer-events: auto;
}
.demo__cap {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 56ch;
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  background: rgba(15, 15, 14, 0.5);
  backdrop-filter: blur(14px);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.35;
}
.demo__cap .mono {
  flex: none;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}
.demo__switch {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 6px 6px 6px 20px;
  border-radius: 999px;
  background: rgba(15, 15, 14, 0.5);
  backdrop-filter: blur(14px);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  transition: background-color 0.4s var(--ease);
}
.demo__arrow {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  transition:
    transform 0.6s var(--ease),
    background-color 0.4s var(--ease);
}
.demo__arrow svg {
  width: 16px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  transition: stroke 0.4s;
}
.demo[data-at="1"] .demo__arrow {
  transform: rotate(180deg);
}
.demo[data-at="1"] .demo__switch {
  flex-direction: row-reverse;
  padding: 6px 20px 6px 6px;
}
.demo__switch:hover {
  background: rgba(15, 15, 14, 0.75);
}
.demo__switch:hover .demo__arrow {
  background: var(--accent);
}
.demo__switch:hover .demo__arrow svg {
  stroke: #fff;
}

@media (max-width: 820px) {
  .demo__stage {
    aspect-ratio: 1270 / 1078;
    border-radius: 14px;
  }
  .demo__about,
  .demo__cap [data-demo-text] {
    display: none;
  }
  .demo__slide--policy {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .demo__cap {
    padding: 6px;
  }
  .demo__switch {
    padding-left: 14px;
    font-size: 14px;
  }
  .demo[data-at="1"] .demo__switch {
    padding: 6px 14px 6px 6px;
  }
  .demo__arrow {
    width: 34px;
    height: 34px;
  }
}

.spec {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 3fr;
  gap: 24px;
  margin-top: clamp(80px, 10vw, 140px);
}
.spec__title {
  padding-top: 18px;
}
.spec__list > div,
.facts > div {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 3fr;
  gap: 24px;
  padding-block: 18px;
  position: relative;
}
.spec__list > div::before,
.facts > div::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: var(--line);
  transform-origin: left;
}
.spec__list dt,
.facts dt {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.3em;
}
.spec__list dd,
.facts dd {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.facts dd .link {
  margin-right: 0.8em;
}
.spec__foot {
  grid-column: 2;
  margin-top: 24px;
  color: var(--muted);
}
.spec__foot .link {
  color: var(--fg);
}
@media (max-width: 820px) {
  .spec {
    grid-template-columns: 1fr;
  }
  .spec__foot {
    grid-column: 1;
  }
  .spec__list > div,
  .facts > div {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ── Lineage (horizontal) ────────────────────────────── */

.lineage {
  padding-block: clamp(40px, 6vw, 80px);
}
.lineage__pin {
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 4vh, 48px);
}
.lineage__head {
  display: grid;
  gap: 18px;
}
.lineage__track {
  display: flex;
  gap: clamp(16px, 2vw, 28px);
  padding-inline: max(var(--gutter), (100vw - 1400px) / 2);
  width: max-content;
  will-change: transform;
}
.gen {
  width: clamp(240px, min(24vw, 38vh), 380px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.gen__media {
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.gen__media video,
.gen__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gen__media--drawing {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: transparent;
}
.gen__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.gen__v {
  font-size: clamp(1.8rem, 2.4vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}
.gen--current .gen__v {
  color: var(--accent);
}
.gen p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}
.gen p .link {
  color: var(--fg);
}

.lineage__rail {
  display: flex;
  align-items: center;
  gap: 16px;
}
.lineage__bar {
  flex: 1;
  height: 1px;
  background: var(--line);
  position: relative;
}
.lineage__bar span {
  position: absolute;
  inset: 0;
  background: var(--fg);
  transform-origin: left;
  transform: scaleX(0);
}

.cycloid {
  width: 72%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
}
.cycloid .pins circle {
  stroke-width: 0.9;
}
.cycloid .disk {
  animation: cyclo 6s linear infinite;
  transform-origin: 0 0;
}
.cycloid .shaft {
  animation: spin 6s linear infinite;
  transform-origin: 0 0;
}
.cycloid .outpins {
  animation: spin-out 6s linear infinite;
  transform-origin: 0 0;
}
.cycloid .accent {
  stroke: var(--accent);
}
@keyframes cyclo {
  from {
    transform: rotate(0deg) translateX(4px) rotate(0deg);
  }
  to {
    transform: rotate(360deg) translateX(4px) rotate(-400deg);
  }
}
@keyframes spin-out {
  to {
    transform: rotate(-40deg);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 899px) {
  .lineage__track {
    width: auto;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding-bottom: 8px;
    scroll-padding-inline: var(--gutter);
  }
  .lineage__track::-webkit-scrollbar {
    display: none;
  }
  .gen {
    flex: none;
    width: min(76vw, 340px);
    scroll-snap-align: start;
  }
  .lineage__rail {
    display: none;
  }
}

/* ── Projects index ──────────────────────────────────── */

.projects {
  padding-block: clamp(100px, 14vw, 180px);
}
.index {
  margin-top: clamp(40px, 6vw, 80px);
  border-bottom: 1px solid var(--line);
}
.row {
  position: relative;
}
.row::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: var(--line);
  transform-origin: left;
}
.row__head {
  position: relative;
  isolation: isolate;
  width: calc(100% + 32px);
  margin-inline: -16px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto 36px;
  align-items: center;
  gap: 16px;
  padding: clamp(20px, 2.6vw, 34px) 16px;
  text-align: left;
  transition: color 0.5s var(--ease);
}
.row__head::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--fg);
  border-radius: 10px;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.6s var(--ease);
}
.row__head:hover {
  color: var(--bg);
}
.row__head:hover::before {
  transform: scaleY(1);
}
.row__head:hover .mono {
  color: color-mix(in srgb, var(--bg) 60%, transparent);
}
.row__title {
  font-size: clamp(1.6rem, 3.8vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 500;
  transition: transform 0.6s var(--ease);
}
.row__head:hover .row__title {
  transform: translateX(12px);
}
.row__alt {
  color: var(--muted);
}
.row__tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-align: right;
}
.badge {
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
}
.row__icon {
  position: relative;
  width: 18px;
  height: 18px;
  justify-self: end;
}
.row__icon::before,
.row__icon::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.6s var(--ease);
}
.row__icon::after {
  transform: rotate(90deg);
}
[aria-expanded="true"] .row__icon::after {
  transform: rotate(0deg);
}
[aria-expanded="true"] .row__icon::before {
  transform: rotate(180deg);
}

.row__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.8s var(--ease);
}
.row__head[aria-expanded="true"] + .row__body {
  grid-template-rows: 1fr;
}
.row__inner {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
  padding-left: 72px;
}
.row__inner > * {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.5s var(--ease),
    transform 0.8s var(--ease);
}
.row__head[aria-expanded="true"] + .row__body .row__inner > * {
  opacity: 1;
  transform: none;
  transition-delay: 0.15s;
}
.row__head[aria-expanded="true"] + .row__body .row__inner > * + * {
  transition-delay: 0.25s;
}
.row__text {
  display: grid;
  align-content: start;
  gap: 18px;
  padding-block: 8px 44px;
  font-size: 1.1rem;
  max-width: 52ch;
}
.row__text p:first-child {
  color: var(--muted);
}
.row__award strong {
  font-weight: 500;
}
.row__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 0.95rem;
}
.row__media {
  padding-bottom: 44px;
}
.row__media img,
.row__media video {
  width: 100%;
  border-radius: var(--radius);
}
@media (max-width: 820px) {
  .row__head {
    grid-template-columns: 36px minmax(0, 1fr) 24px;
  }
  .row__tag {
    display: none;
  }
  .row__inner {
    grid-template-columns: 1fr;
    padding-left: 0;
    gap: 0;
  }
}

/* ── Simulation ──────────────────────────────────────── */

.sim {
  padding-block: clamp(100px, 14vw, 180px);
}
.runs {
  display: grid;
  gap: clamp(72px, 10vw, 150px);
  margin-top: clamp(56px, 8vw, 110px);
}
.run {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  align-items: end;
  gap: clamp(28px, 4.5vw, 72px);
}
.run--flip {
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
}
.run--flip .run__media {
  order: 2;
}
/* The HUD fills all four corners, so controls live beside the video */
.run__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface);
  cursor: pointer;
}
.run__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease);
}
.run__media:hover video {
  transform: scale(1.025);
}
.run__text {
  display: grid;
  align-content: end;
  justify-items: start;
  gap: 20px;
}
.run__text > p:not(.mono) {
  max-width: 44ch;
  font-size: 1.05rem;
  color: var(--muted);
}
.run__stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-self: stretch;
  justify-content: start;
  border-top: 1px solid var(--line);
}
.run__stats > div {
  display: grid;
  gap: 10px;
  padding: 16px 22px 4px 0;
}
.run__stats > div + div {
  padding-left: 22px;
  border-left: 1px solid var(--line);
}
.run__stats dt {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}
.run__stats dd {
  font-size: clamp(1.9rem, 2.8vw, 2.8rem);
  line-height: 0.9;
  font-weight: 500;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.run__stats small {
  font-size: 0.4em;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 0.3em;
  font-weight: 400;
}
.run__play {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 500;
}
.run__play .play__icon {
  width: 40px;
  height: 40px;
  background: var(--fg);
}
.run__play .play__icon svg {
  fill: var(--bg);
}
.run__play:hover .play__icon {
  transform: scale(1.1);
  background: var(--accent);
}
.run__play:hover .play__icon svg {
  fill: #fff;
}
@media (max-width: 820px) {
  .run,
  .run--flip {
    grid-template-columns: 1fr;
  }
  .run--flip .run__media {
    order: 0;
  }
  .run__media {
    border-radius: 14px;
  }
}

/* ── About ───────────────────────────────────────────── */

.about {
  padding-block: clamp(60px, 8vw, 120px) clamp(120px, 16vw, 220px);
}
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: clamp(32px, 6vw, 96px);
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.about__grid > div:first-child {
  display: grid;
  align-content: start;
  gap: clamp(28px, 4vw, 48px);
}
.about__body {
  display: grid;
  gap: clamp(40px, 5vw, 64px);
  padding-top: clamp(0px, 4vw, 44px);
}
.about .lead {
  max-width: 38ch;
}
@media (max-width: 820px) {
  .about__grid {
    grid-template-columns: 1fr;
  }
}

/* ── Contact ─────────────────────────────────────────── */

.contact {
  padding-block: clamp(120px, 16vw, 220px) 32px;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.contact > .wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.contact__title {
  margin-top: clamp(28px, 4vw, 48px);
  font-size: clamp(3.6rem, 12.5vw, 14rem);
  line-height: 0.88;
  letter-spacing: -0.055em;
  font-weight: 500;
}
.contact__mail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-top: clamp(40px, 6vw, 72px);
}
.contact__email {
  position: relative;
  font-size: clamp(1.3rem, 3.4vw, 3rem);
  letter-spacing: -0.03em;
  text-decoration: none;
  word-break: break-all;
}
.contact__email::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.7s var(--ease);
}
.contact__email:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}
.contact__foot {
  margin-top: auto;
  padding-top: clamp(100px, 14vw, 180px);
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: space-between;
  gap: 16px;
}
.contact__foot > * {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.contact__foot .link {
  color: var(--fg);
}
@media (max-width: 700px) {
  .contact__foot {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Modal ───────────────────────────────────────────── */

.modal {
  margin: auto;
  width: min(92vw, 1400px, calc(84vh * var(--ar, 16 / 9)));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
.modal::backdrop {
  background: rgba(12, 12, 11, 0.88);
  backdrop-filter: blur(10px);
}
.modal video {
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: #000;
}
.modal__close {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.5s var(--ease);
}
.modal__close svg {
  width: 16px;
  stroke: var(--ink);
  stroke-width: 1.6;
}
.modal__close:hover {
  transform: rotate(90deg);
}

/* ── Split-text helpers ──────────────────────────────── */

.line-mask {
  overflow: clip;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}
.hero__title .line-mask {
  padding-bottom: 0.16em;
  margin-bottom: -0.16em;
}
[data-scrub-words] .word {
  opacity: 0.14;
}

/* ── Reduced motion ──────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-scrub-words] .word {
    opacity: 1;
  }
}
