/* sairamsreedhar.com | v4 "scene reel"
   One thing owns the screen at a time. Scenes change with a vertical motion-blur wipe.
   Without JavaScript, or in Index mode, the same markup reads as one stacked page.
   Committed to one visual world: all three theme selectors declare identical tokens on
   purpose, so a viewer's theme toggle cannot break the piece. */

/* ---------- fonts (self-hosted, OFL) ---------- */
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Funnel Sans"; src: url("/fonts/funnel-sans-latin.woff2") format("woff2");
  font-weight: 300 800; font-style: normal; font-display: swap; }
/* Metric-near fallbacks so the swap barely moves the layout. */
@font-face { font-family: "Serif Fallback"; src: local("Times New Roman"), local("Times");
  size-adjust: 94%; ascent-override: 98%; descent-override: 26%; line-gap-override: 0%; }
@font-face { font-family: "Funnel Sans Fallback"; src: local("Arial");
  size-adjust: 101.3%; ascent-override: 98.7%; descent-override: 24.7%; line-gap-override: 0%; }

/* ---------- tokens ---------- */
:root,
:root[data-theme="light"],
:root[data-theme="dark"] {
  /* Ground: deep petrol, ink-green with a blue cast. Text: warm paper cream.
     Brass is the warm accent (labels, numbers). Glacier is the cool secondary (active state,
     the accent word in titles). Contrast on --ground: ink 13.9, ink-2 10.2, muted 7.2,
     muted-dim 5.5, brass 8.4, glacier 9.3. */
  --ground:      #0B1D20;
  --ground-deep: #081619;
  --ground-hi:   #143234;
  --surface:     #0F2427;
  --card:        #112A2D;
  --card-2:      #163339;
  --line:        rgba(196, 222, 216, 0.12);
  --line-2:      rgba(196, 222, 216, 0.22);
  --line-strong: #5D7672;
  --ink:         #EEE6D3;
  --ink-2:       #CFC6B1;
  --muted:       #9AABA5;
  --muted-dim:   #82958F;
  --brass:       #D2B06C;
  --glacier:     #9CC3DD;
  --ok:          #8CD3A9; /* semantic only: "now" */

  --f-serif: "Instrument Serif", "Serif Fallback", "Iowan Old Style", Georgia, serif;
  --f-sans:  "Funnel Sans", "Funnel Sans Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* type scale, sized off the viewport so it holds up on a projector */
  --fs-hero:     min(clamp(4rem, 1.4rem + 9.4vw, 10rem), 14vh);
  --fs-case:     min(clamp(2.6rem, 1.1rem + 4.4vw, 5.6rem), 10.5vh);
  --fs-sentence: min(clamp(2rem, 1rem + 2.6vw, 3.7rem), 7.4vh);
  --fs-body:     clamp(1.05rem, 0.96rem + 0.3vw, 1.25rem);
  --fs-small:    clamp(0.95rem, 0.9rem + 0.15vw, 1.05rem);
  --fs-caps:     clamp(0.8125rem, 0.76rem + 0.18vw, 0.92rem);
  --fs-kicker:   clamp(0.8125rem, 0.72rem + 0.4vw, 1.08rem);

  --pad-x: clamp(1.25rem, 7vw, 8rem);
  --pad-top: clamp(4.5rem, 9.5vh, 6.25rem);
  --pad-bottom: clamp(1.5rem, 4.5vh, 3.5rem);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.55, 0, 0.8, 0.25);
  --ease-io: cubic-bezier(0.76, 0, 0.24, 1);
  --t-scene: 1000ms;

  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 100%;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}
body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(120% 70% at 50% -10%, var(--ground-hi) 0%, rgba(20, 50, 52, 0) 60%),
    var(--ground);
  background-attachment: fixed;
  font-size: var(--fs-body);
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
abbr[title] { text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(156, 195, 221, 0.32); color: var(--ink); }

:focus-visible { outline: 2px solid var(--glacier); outline-offset: 3px; border-radius: 2px; }
[tabindex="-1"]:focus { outline: none; }

.skip-link {
  position: fixed; left: 12px; top: -5rem; z-index: 100;
  padding: 0.75rem 1rem; min-height: 44px;
  background: var(--card-2); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 6px;
  font-size: var(--fs-small); text-decoration: none;
}
.skip-link:focus { top: 12px; }

.vh {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- type roles ---------- */
.display {
  font-family: var(--f-serif);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: -0.012em;
  text-wrap: balance;
  color: var(--ink);
}
.display em { font-style: italic; color: var(--glacier); letter-spacing: -0.02em; }
.display--hero { font-size: var(--fs-hero); text-transform: uppercase; line-height: 0.9; }
.display--case { font-size: var(--fs-case); text-transform: uppercase; }
.display--case em { display: block; }
.display--sentence { font-size: var(--fs-sentence); line-height: 1.04; letter-spacing: -0.01em; }

.caps {
  font-family: var(--f-sans);
  font-size: var(--fs-caps);
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  line-height: 1.5;
  color: var(--muted);
}
.caps--brass { color: var(--brass); }
.kicker {
  font-size: var(--fs-kicker);
  font-weight: 500;
  letter-spacing: 0.62em;
  margin-right: -0.62em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.tick {
  display: block; width: 7px; height: 7px; margin-inline: auto;
  background: var(--ink-2);
  transform: rotate(45deg);
  opacity: 0.8;
}

.text-link {
  display: inline-flex; align-items: center; gap: 0.5em;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-size: var(--fs-caps); font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  border-bottom: 1px solid transparent;
}
.text-link:hover { color: var(--glacier); }
.text-link--inline {
  display: inline; min-height: 0;
  font-size: inherit; font-weight: inherit; letter-spacing: 0; text-transform: none;
  color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 0.2em;
}
.text-link--inline:hover { color: var(--glacier); text-decoration-color: currentColor; }

.chip {
  display: inline-flex; align-items: center; gap: 0.55rem;
  min-height: 32px; padding: 0.25rem 0.8rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: var(--fs-caps); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip[data-mark="proto"] { border-style: dashed; }
.chip[data-mark="now"], .chip[data-mark="shipped"] { color: var(--ink); }
[data-mark]::before {
  content: ""; flex: none;
  width: 10px; height: 10px; border-radius: 50%;
}
[data-mark="now"]::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(140, 211, 169, 0.18); }
[data-mark="building"]::before { border: 1.5px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
[data-mark="learning"]::before { border: 1.5px solid currentColor; }
[data-mark="proto"]::before { border: 1.5px dashed currentColor; }
[data-mark="shipped"]::before {
  width: 5px; height: 9px; margin-inline: 2px 3px; border-radius: 0;
  border-right: 2px solid var(--ok); border-bottom: 2px solid var(--ok);
  transform: translateY(-1px) rotate(45deg);
}

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; }
.tags li { font-size: var(--fs-small); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 48px; padding: 0.7rem 1.3rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: rgba(15, 36, 39, 0.6);
  color: var(--ink);
  font-size: var(--fs-caps); font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn:hover { border-color: var(--glacier); }
.btn--primary { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.btn--primary:hover { background: #FFF8E8; border-color: #FFF8E8; }
.btn.is-small { min-height: 40px; padding: 0.45rem 0.95rem; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; justify-content: center;
  padding: clamp(0.75rem, 2.2vh, 1.4rem) 1rem 0.5rem;
  pointer-events: none;
}
.nav {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(0.6rem, 4.4vw, 4.75rem);
  pointer-events: auto;
}
.nav-link {
  position: relative;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.2rem;
  background: none; border: 0; cursor: pointer;
  font-size: var(--fs-caps); font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-2); text-decoration: none;
}
.nav-link:hover { color: var(--ink); }
.nav-link[aria-current="true"] { color: var(--brass); }
.nav-link + .nav-link::before, .nav-mark + .nav-link::before, .nav-link + .nav-mark::before {
  content: ""; position: absolute; left: calc(-0.5 * clamp(0.6rem, 4.4vw, 4.75rem) - 2px); top: 50%;
  width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong);
}
.nav-mark { position: relative; display: inline-grid; place-items: center; width: 48px; height: 48px; color: var(--ink); }
.nav-mark svg { width: 34px; height: 34px; }
.nav-mark:hover { color: var(--glacier); }

/* Index: switches between the reel and the plain stacked page. Lives outside the HUD so it
   stays reachable in both modes. */
.index-toggle {
  position: fixed; z-index: 45; left: clamp(1rem, 2.6vw, 2.75rem); bottom: clamp(1rem, 3vh, 2rem);
  display: inline-flex; align-items: center; min-height: 40px; padding: 0.35rem 0.95rem;
  background: rgba(11, 29, 32, 0.72); border: 1px solid var(--line-strong); border-radius: 999px;
  pointer-events: auto;
  color: var(--ink-2); cursor: pointer;
  font-size: var(--fs-caps); font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
}
.index-toggle:hover { color: var(--ink); border-color: var(--glacier); }
.index-toggle[aria-pressed="true"] { color: var(--brass); }

/* ---------- scenes: shared stacked layout (no JS, and Index mode) ---------- */
.stage { display: block; }
.scene { position: relative; padding: clamp(4rem, 10vh, 7rem) var(--pad-x); overflow-x: clip; }
.scene + .scene { border-top: 1px solid var(--line); }
.scene-inner { width: 100%; max-width: 1280px; margin-inline: auto; }
.hud { display: none; }
.veil { display: none; }

/* ---------- hero ---------- */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero-object {
  --obj: min(50vh, 80vw, 600px);
  position: relative;
  width: var(--obj); height: var(--obj);
  flex: none;
}
.hero-object::before {
  /* the glow the object sits in */
  content: ""; position: absolute; inset: -14% 0;
  background: radial-gradient(closest-side, rgba(156, 195, 221, 0.13), rgba(156, 195, 221, 0) 70%);
  pointer-events: none;
}
.hero-fallback { position: absolute; inset: 9% 16%; width: 68%; height: 82%; transition: opacity 600ms ease; }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 900ms ease; }
.hero-object.is-live .hero-canvas { opacity: 1; }
.hero-object.is-live .hero-fallback { opacity: 0; }
.hero-floor {
  position: absolute; left: 22%; right: 22%; bottom: 1%; height: 9%;
  background: radial-gradient(closest-side, rgba(4, 12, 14, 0.7), rgba(4, 12, 14, 0));
  pointer-events: none;
}
.hero-copy {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(0.45rem, 1.3vh, 0.9rem);
  margin-top: calc(var(--obj, 50vh) * -0.07);
}
.hero-copy .kicker { margin-bottom: -0.2rem; }
.hero-copy .display--hero { text-shadow: 0 6px 40px rgba(4, 14, 16, 0.55); }
.hero-copy .tick { margin-block: 0.15rem; }
.hero-line { max-width: 62ch; color: var(--ink-2); font-size: var(--fs-body); text-wrap: balance; }
.hero-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.6rem; }
.link-chip {
  display: inline-flex; align-items: center; gap: 0.55rem; min-height: 44px;
  color: var(--ink); text-decoration: none;
  font-size: var(--fs-caps); font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
}
.link-chip svg { width: 17px; height: 17px; fill: currentColor; }
.link-chip:hover { color: var(--glacier); }

/* ---------- work gallery ---------- */
.gallery { display: flex; flex-direction: column; align-items: center; gap: clamp(2.25rem, 6vh, 3.75rem); }
.gallery-h { text-align: center; }
.gallery-stage { position: relative; width: 100%; max-width: 1100px; }
.gallery-frame {
  position: absolute; inset: -7% 4.5% -7% 4.5%;
  border: 1px solid var(--line);
  overflow: hidden;
  pointer-events: none;
}
.topo { position: absolute; inset: 0; width: 100%; height: 100%; }
.cards { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(0.6rem, 1.1vw, 1rem); }
.card { position: relative; }
.card-link {
  position: relative; display: block; color: inherit; text-decoration: none;
  border-radius: 2px;
}
.card-face {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(0.6rem, 1.6vh, 1rem);
  height: min(44vh, 400px); min-height: 250px;
  padding: 1.25rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--line-2);
  overflow: hidden;
}
.card-pin {
  position: absolute; top: 0.9rem; left: 50%;
  width: 0; height: 0; margin-left: -4px;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--muted-dim);
}
.card-mark { width: clamp(48px, 5vw, 66px); height: auto; color: var(--glacier); }
.card-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-dim); }
.card-title {
  font-size: var(--fs-caps); font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase;
  text-align: center; color: var(--ink); line-height: 1.4;
}
.card-num { font-size: var(--fs-caps); font-weight: 600; letter-spacing: 0.08em; color: var(--brass); font-variant-numeric: tabular-nums; }
.card-art { display: none; }
.card-foot { display: none; }
.gallery-more { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 2.5rem; }

/* ---------- case scenes (also About) ---------- */
.case { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; align-items: center; }
.case-frame {
  position: relative; z-index: 2;
  aspect-ratio: 4 / 5;
  width: 100%;
  border: 2px solid transparent;
  background:
    repeating-radial-gradient(circle at 60% 40%, rgba(156, 195, 221, 0.16) 0 1px, transparent 1px 14px) padding-box,
    linear-gradient(160deg, #163339, #0B1D20) padding-box,
    linear-gradient(150deg, var(--brass), rgba(210, 176, 108, 0.35) 40%, var(--glacier) 100%) border-box;
  box-shadow: 0 30px 80px -30px rgba(2, 8, 10, 0.9);
  overflow: hidden;
}
.case-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.case-panel {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: clamp(0.7rem, 1.8vh, 1.15rem);
  padding: clamp(2rem, 6vh, 3.75rem) clamp(1.25rem, 4vw, 3.5rem);
  background: linear-gradient(180deg, rgba(17, 42, 45, 0.92), rgba(15, 36, 39, 0.92));
  border: 1px solid var(--line);
  overflow: hidden;
}
.case-panel > * { position: relative; }
.case-panel > .topo { position: absolute; opacity: 0.9; }
.case-orbit {
  position: absolute !important; top: 50%; right: -16%;
  width: 78%; aspect-ratio: 1; transform: translateY(-50%);
  border: 1px solid var(--line); border-radius: 50%;
  pointer-events: none;
}
.badge { position: relative; width: clamp(96px, 8.6vw, 124px); aspect-ratio: 1; display: grid; place-items: center; color: var(--glacier); }
.badge-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.badge-ring text { fill: var(--ink-2); font-family: var(--f-sans); font-size: 9.2px; font-weight: 600; text-transform: uppercase; }
.badge-mark { width: 38%; height: auto; }
.case-num { font-size: var(--fs-caps); font-weight: 600; letter-spacing: 0.3em; color: var(--muted); font-variant-numeric: tabular-nums; }
.case-text { max-width: 44ch; color: var(--ink-2); text-wrap: pretty; }
.case-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.75rem 1.25rem; }
.case-meta .tags { justify-content: center; }
.case-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 2rem; margin-top: 0.25rem; }

/* About is the same composition with a person in the frame */
.case-frame--portrait { display: flex; align-items: flex-end; justify-content: center; }
.portrait { position: relative; z-index: 1; width: 78%; }
.portrait img {
  width: 100%; height: auto;
  -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 99%);
  mask-image: linear-gradient(180deg, #000 72%, transparent 99%);
}
.case-panel--about { align-items: flex-start; text-align: left; }
.about-text { max-width: 52ch; color: var(--ink-2); text-wrap: pretty; }
.ledger { display: grid; width: 100%; max-width: 40rem; border-top: 1px solid var(--line-2); }
.ledger-row {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1.5rem;
  padding: 0.8rem 0; border-bottom: 1px solid var(--line-2);
}
.ledger dt { font-family: var(--f-serif); font-size: clamp(1.3rem, 1.05rem + 0.6vw, 1.7rem); line-height: 1.2; color: var(--ink); }
.ledger dd { align-self: center; font-size: var(--fs-small); color: var(--muted); }

/* ---------- robotics: same case grammar, the real photo framed over a living contour backdrop ---------- */
.robo-figure { position: relative; z-index: 2; width: 100%; }
.robo-backdrop {
  position: absolute; inset: 7% 10% -7% -6%;
  border: 1px solid var(--line-2); overflow: hidden;
  background: var(--surface);
}
.robo-backdrop canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.case-frame.case-frame--photo { position: relative; margin: 0; aspect-ratio: 1 / 1; height: auto; }
.case-frame--photo picture, .case-frame--photo img { display: block; width: 100%; height: 100%; }
.case-frame--photo img { object-fit: cover; }
.case-panel--robotics { align-items: flex-start; text-align: left; gap: clamp(0.55rem, 1.4vh, 0.95rem); }
.robo-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding-right: 5.5rem; }
.thread { padding: 0.55rem 0; }
.case-panel--robotics .badge { position: absolute; top: clamp(1rem, 3vh, 1.75rem); right: clamp(1rem, 2.5vw, 2rem); }
.case-panel--robotics .display--sentence { max-width: 21ch; }
.case-panel--robotics .case-meta, .case-panel--robotics .case-meta .tags, .case-panel--robotics .case-nav { justify-content: flex-start; }
.robo-text { display: grid; gap: 0.7rem; max-width: 54ch; color: var(--ink-2); }
.robo-text p { text-wrap: pretty; }
.threads { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; border-top: 1px solid var(--line-2); }
.thread { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line-2); }
.thread dt { font-size: var(--fs-caps); font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; color: var(--brass); }
.thread dd { margin: 0; font-size: var(--fs-small); color: var(--ink); }
@media (min-width: 1100px) {
  .threads { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1.5rem; border-bottom: 1px solid var(--line-2); }
  .thread { border-bottom: 0; }
}

/* ---------- more work ---------- */
.more { display: flex; flex-direction: column; gap: clamp(1.5rem, 4vh, 2.75rem); }
.more-head { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; text-align: center; }
.more-head .display--case em { display: inline; }
.more-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
@media (min-width: 640px) { .more-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .more-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.more-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.65rem;
  padding: clamp(1.1rem, 2.4vh, 1.6rem) clamp(1.1rem, 1.8vw, 1.6rem);
  background: var(--surface);
}
.more-title { font-family: var(--f-serif); font-weight: 400; font-size: clamp(1.45rem, 1.1rem + 0.8vw, 1.95rem); line-height: 1.12; color: var(--ink); text-wrap: balance; }
.more-item p { color: var(--ink-2); font-size: var(--fs-small); text-wrap: pretty; }
.more-item .tags { margin-top: auto; padding-top: 0.25rem; }
.more-item .tags li { font-size: 0.875rem; }

/* ---------- contact ---------- */
.contact {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: clamp(0.9rem, 2.4vh, 1.4rem);
  max-width: 980px;
  padding: clamp(2.5rem, 8vh, 5rem) clamp(1rem, 5vw, 4rem);
}
.contact > * { position: relative; }
.contact-frame { position: absolute !important; inset: 0; border: 1px solid var(--line); overflow: hidden; pointer-events: none; }
.contact-text { max-width: 46ch; color: var(--ink-2); text-wrap: pretty; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
.email-list { display: grid; gap: 0.6rem; justify-items: center; }
.email-list[hidden] { display: none; }
.email-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1rem; }
.email-row .label { font-size: var(--fs-caps); font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.email-row a { color: var(--ink); font-size: var(--fs-body); overflow-wrap: anywhere; text-underline-offset: 0.2em; text-decoration-color: var(--line-strong); }
.noscript-note { color: var(--ink-2); font-size: var(--fs-small); }
.fine { margin-top: clamp(0.5rem, 3vh, 2rem); font-size: 0.875rem; color: var(--muted-dim); }

/* ---------- wider screens: the reel compositions ---------- */
@media (min-width: 900px) {
  .case { grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr); }
  .case-frame { height: min(68vh, 620px); width: auto; justify-self: end; max-width: 100%; }
  .case-panel { margin-left: -22%; padding-left: calc(22% + clamp(1.5rem, 4vw, 4rem)); min-height: min(76vh, 660px); justify-content: center; padding-block: clamp(1.5rem, 4vh, 3rem); }
  :root, :root[data-theme="light"], :root[data-theme="dark"] { --pad-x: clamp(6.5rem, 10vw, 10rem); }
  .case-panel--about { padding-right: clamp(2rem, 5vw, 5rem); }
  .robo-figure { justify-self: end; width: min(100%, 64vh); }
  .case-frame--photo { width: 100%; height: auto; }
}

/* ======================================================================
   Stage mode: JS on and not in Index mode. One scene at a time.
   ====================================================================== */
.js:not(.is-index) body { position: fixed; inset: 0; overflow: hidden; }
.js:not(.is-index) .topbar { position: fixed; left: 0; right: 0; }
.js:not(.is-index) .stage { position: fixed; inset: 0; overflow: hidden; }
.js:not(.is-index) .scene {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: var(--pad-top) var(--pad-x) var(--pad-bottom);
  overflow-x: hidden; overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
  visibility: hidden;
  border: 0;
}
.js:not(.is-index) .scene > .scene-inner { margin-block: auto; }
.js:not(.is-index) .scene.is-active,
.js:not(.is-index) .scene.is-leaving { visibility: visible; }
.js:not(.is-index) .scene.is-leaving { z-index: 1; pointer-events: none; }
.js:not(.is-index) .scene.is-active { z-index: 2; }

.js:not(.is-index) .hud { display: block; }
.js:not(.is-index) .veil {
  display: block; position: fixed; inset: 0; z-index: 30; pointer-events: none;
  background: radial-gradient(80% 60% at 50% 50%, rgba(8, 22, 25, 0.55), var(--ground-deep));
  opacity: 0;
}
.js:not(.is-index).is-moving .veil { animation: veil var(--t-scene) var(--ease-io) both; }
@keyframes veil { 0% { opacity: 0; } 45% { opacity: 0.88; } 100% { opacity: 0; } }

/* The wipe: vertical travel, a vertical stretch and blur together read as motion blur. */
.scene.is-leaving.dir-next { animation: out-up 620ms var(--ease-in) both; transform-origin: 50% 100%; }
.scene.is-entering.dir-next { animation: in-up 760ms var(--ease-out) 300ms both; transform-origin: 50% 0%; }
.scene.is-leaving.dir-prev { animation: out-down 620ms var(--ease-in) both; transform-origin: 50% 0%; }
.scene.is-entering.dir-prev { animation: in-down 760ms var(--ease-out) 300ms both; transform-origin: 50% 100%; }
@keyframes out-up {
  0% { transform: none; filter: blur(0); opacity: 1; }
  100% { transform: translate3d(0, -16vh, 0) scale(1, 1.22); filter: blur(18px); opacity: 0; }
}
@keyframes in-up {
  0% { transform: translate3d(0, 18vh, 0) scale(1, 1.26); filter: blur(20px); opacity: 0; }
  60% { filter: blur(2px); opacity: 1; }
  100% { transform: none; filter: blur(0); opacity: 1; }
}
@keyframes out-down {
  0% { transform: none; filter: blur(0); opacity: 1; }
  100% { transform: translate3d(0, 16vh, 0) scale(1, 1.22); filter: blur(18px); opacity: 0; }
}
@keyframes in-down {
  0% { transform: translate3d(0, -18vh, 0) scale(1, 1.26); filter: blur(20px); opacity: 0; }
  60% { filter: blur(2px); opacity: 1; }
  100% { transform: none; filter: blur(0); opacity: 1; }
}
/* Inside the arriving scene, the text rises out of its own blur, a beat behind. */
.scene.is-entering [data-rise] { animation: rise 760ms var(--ease-out) both; }
.scene.is-entering [data-rise]:nth-child(1) { animation-delay: 420ms; }
.scene.is-entering [data-rise]:nth-child(2) { animation-delay: 480ms; }
.scene.is-entering [data-rise]:nth-child(3) { animation-delay: 530ms; }
.scene.is-entering [data-rise]:nth-child(4) { animation-delay: 580ms; }
.scene.is-entering [data-rise]:nth-child(n+5) { animation-delay: 620ms; }
@keyframes rise {
  0% { transform: translate3d(0, 28px, 0); filter: blur(8px); opacity: 0; }
  100% { transform: none; filter: blur(0); opacity: 1; }
}
/* First paint: the object surfaces from the dark, then the name rises. */
.is-intro .scene--hero .hero-object { animation: surface 1400ms var(--ease-out) both; }
.is-intro .scene--hero [data-rise] { animation: rise 900ms var(--ease-out) both; }
.is-intro .scene--hero .kicker { animation-delay: 380ms; }
.is-intro .scene--hero .display--hero { animation-delay: 460ms; }
.is-intro .scene--hero .tick { animation-delay: 560ms; }
.is-intro .scene--hero .caps { animation-delay: 620ms; }
.is-intro .scene--hero .hero-line { animation-delay: 680ms; }
.is-intro .scene--hero .hero-links { animation-delay: 740ms; }
.is-intro .topbar { animation: fade 900ms ease 500ms both; }
@keyframes surface {
  0% { transform: translate3d(0, 4vh, 0) scale(0.92); filter: blur(14px) brightness(0.3); opacity: 0; }
  100% { transform: none; filter: none; opacity: 1; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- HUD: counter left, ring and pager right ---------- */
.hud-count {
  position: fixed; z-index: 35; left: clamp(1rem, 2.6vw, 2.75rem); top: 50%;
  display: flex; align-items: center; gap: 0.6rem;
  transform: translateY(-50%);
}
.hud-num { font-size: var(--fs-caps); font-weight: 600; letter-spacing: 0.1em; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 2ch; }
.hud-line { width: clamp(1.25rem, 2.2vw, 2.5rem); height: 1px; background: var(--line-strong); }
@media (max-width: 1199px) { .hud-line { display: none; } }
.hud-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-left: -10px;
  background: none; border: 0; border-radius: 50%; cursor: pointer; color: var(--muted);
}
.hud-btn svg { width: 18px; height: 18px; }
.hud-btn:hover { color: var(--brass); }
.hud-prev { display: none; }
.hud-next.is-wrap svg { transform: rotate(-90deg); }
.hud-rail {
  position: fixed; z-index: 35; right: clamp(0.75rem, 2.2vw, 2.5rem); top: 50%;
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  transform: translateY(-50%);
}
.hud-ring { width: 30px; height: 30px; transform: rotate(-90deg); }
.hud-ring circle { fill: none; stroke-width: 1.5; }
.hud-ring-track { stroke: var(--line-2); }
.hud-ring-fill { stroke: var(--glacier); stroke-dasharray: 87.97; stroke-dashoffset: 87.97; stroke-linecap: round; transition: stroke-dashoffset 900ms var(--ease-io); }
.hud-dots { display: flex; flex-direction: column; align-items: center; }
.hud-dot {
  position: relative; display: grid; place-items: center;
  width: 32px; height: 28px; padding: 0; background: none; border: 0; cursor: pointer;
}
.hud-dot::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--line-strong); transition: transform 300ms var(--ease-out), background-color 300ms ease;
}
.hud-dot:hover::before { background: var(--ink-2); }
.hud-dot[aria-current="step"]::before { background: var(--glacier); transform: scale(1.6); }
.hud-dot.is-group-start { margin-top: 6px; }
.hud-dot[aria-current="step"]::after {
  content: ""; position: absolute; right: 100%; top: 50%; margin-top: -4px;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 5px solid var(--ink-2);
}

/* ---------- stage: gallery lift-out (wide screens with a fine pointer or a keyboard) ---------- */
@media (min-width: 900px) {
  .js:not(.is-index) .card-art {
    display: block; position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px);
    opacity: 0; transition: opacity 600ms var(--ease-out);
  }
  .js:not(.is-index) .card-face > :not(.card-art) { transition: opacity 400ms ease; }
  .js:not(.is-index) .card-foot {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
    height: clamp(5.5rem, 13vh, 7.5rem); margin-top: -1px;
    background: var(--card); border: 1px solid var(--line-2); border-top-color: transparent;
    transform: translate3d(0, -100%, 0); opacity: 0;
    transition: transform 650ms var(--ease-out), opacity 300ms ease;
  }
  .js:not(.is-index) .card-foot .card-num { color: var(--glacier); }
  .js:not(.is-index) .card-bar {
    position: absolute; left: 32%; right: 32%; bottom: -1px; height: 2px;
    background: var(--glacier); transform: scaleX(0); transform-origin: 0 50%;
  }
  .js:not(.is-index) .card { transition: opacity 500ms ease, transform 650ms var(--ease-out); }
  .js:not(.is-index) .cards.has-active .card:not(.is-active) .card-face > :not(.card-art) { opacity: 0.62; }
  .js:not(.is-index) .cards.has-active .card:not(.is-active) .card-face > .card-num { opacity: 0.86; }
  .js:not(.is-index) .cards.has-active .card:not(.is-active) .card-face { background: #0E2326; }
  .js:not(.is-index) .card.is-active { z-index: 2; transform: translate3d(0, -2vh, 0); }
  .js:not(.is-index) .card.is-active .card-art { opacity: 1; }
  .js:not(.is-index) .card.is-active .card-face > :not(.card-art) { opacity: 0; }
  .js:not(.is-index) .card.is-active .card-face { border-color: rgba(156, 195, 221, 0.35); }
  .js:not(.is-index) .card.is-active .card-foot { transform: none; opacity: 1; }
  .js:not(.is-index) .card.is-active .card-bar { animation: bar 1600ms var(--ease-io) 300ms both; }
  .js:not(.is-index) .gallery-stage { margin-bottom: clamp(5.5rem, 13vh, 7.5rem); }
  .js:not(.is-index) .card-link:focus-visible { outline-offset: 6px; }
}
@keyframes bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* badge turns only while its scene is on screen */
.js:not(.is-index) .scene.is-active .badge-ring { animation: turn 36s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }

/* ---------- narrow screens ---------- */
@media (max-width: 899px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-face { height: auto; min-height: 0; aspect-ratio: 4 / 4.4; }
  .gallery-frame { inset: -4% -3%; }
  .case-frame { aspect-ratio: 16 / 11; }
  .case-frame--portrait { aspect-ratio: 4 / 3.4; }
  .portrait { width: 52%; }
  .case-panel { margin-top: -1.5rem; padding-top: 2.75rem; }
  .case-orbit { width: 120%; right: -50%; }
  .robo-figure { max-width: min(100%, 560px); margin-inline: auto; }
  .robo-backdrop { inset: 6% -3% 6% 6%; }
  .case--robotics .case-panel { margin-top: 1.25rem; padding-top: 2rem; }
}
@media (max-width: 899px) {
  :root, :root[data-theme="light"], :root[data-theme="dark"] { --pad-bottom: 5.5rem; }
  .js:not(.is-index) .hud-count {
    top: auto; bottom: 0; left: 0; right: 0; transform: none;
    justify-content: center; gap: 0.75rem;
    padding: 0.4rem 1rem calc(0.4rem + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(11, 29, 32, 0), rgba(8, 22, 25, 0.94) 40%);
  }
  .hud-prev { display: inline-grid; margin: 0; }
  .hud-prev[disabled] { visibility: hidden; }
  .hud-next { margin: 0; }
  .hud-next svg { transform: rotate(90deg); }
  .hud-next.is-wrap svg { transform: rotate(-90deg); }
  .hud-rail { display: none !important; }
  .index-toggle { left: 0.75rem; bottom: calc(0.45rem + env(safe-area-inset-bottom)); min-height: 36px; padding: 0.25rem 0.8rem; }
}
@media (max-width: 719px) {
  :root, :root[data-theme="light"], :root[data-theme="dark"] { --pad-x: 1.25rem; --pad-top: 4.25rem; --pad-bottom: 5.5rem; }
  .nav { gap: 0.85rem; }
  .nav-link { letter-spacing: 0.14em; }
  .nav-link + .nav-link::before, .nav-mark + .nav-link::before, .nav-link + .nav-mark::before { left: calc(-0.425rem - 2px); }
  .nav-mark svg { width: 30px; height: 30px; }
  .hero-object { --obj: min(44vh, 84vw); }
  .hero-copy { margin-top: calc(var(--obj) * -0.01); }
  .kicker { letter-spacing: 0.42em; margin-right: -0.42em; }
  .caps { letter-spacing: 0.22em; }
}
@media (max-width: 380px) {
  .nav { gap: 0.6rem; }
  .nav-link { letter-spacing: 0.1em; font-size: 0.8125rem; }
  .nav-link + .nav-link::before, .nav-mark + .nav-link::before, .nav-link + .nav-mark::before { display: none; }
  .cards { gap: 0.5rem; }
  .card-title { letter-spacing: 0.14em; }
}
/* short laptop screens: let the object give way to the type */
@media (min-width: 900px) and (max-height: 820px) {
  .badge { width: clamp(76px, 10vh, 96px); }
  .case-panel--robotics .robo-text { gap: 0.45rem; }
  .case-panel--robotics .case-nav { margin-top: 0; }
  .case-panel--robotics { padding-block: 1.25rem; }
  .case-panel { gap: clamp(0.5rem, 1.3vh, 0.8rem); }
  .case-panel .tags { gap: 0.25rem 1rem; }
}
@media (min-width: 900px) and (max-height: 700px) {
  .hero-object { --obj: min(42vh, 80vw); }
  .card-face { height: 38vh; min-height: 210px; }
}

/* ---------- Index mode and no-JS: a plain stacked page ---------- */
.is-index .hud, .is-index .veil { display: none !important; }
html:not(.js) .scene--hero, .is-index .scene--hero { min-height: 100svh; display: flex; align-items: center; }
.is-index .scene [data-rise], .is-index .hero-object { animation: none !important; }

/* ---------- reduced motion: an instant crossfade, no blur, nothing drifting ---------- */
@media (prefers-reduced-motion: reduce) {
  .scene.is-leaving.dir-next, .scene.is-leaving.dir-prev { animation: xfade-out 200ms linear both; }
  .scene.is-entering.dir-next, .scene.is-entering.dir-prev { animation: xfade-in 200ms linear both; }
  .scene.is-entering [data-rise], .is-intro .scene--hero [data-rise], .is-intro .scene--hero .hero-object, .is-intro .topbar { animation: none; }
  .js:not(.is-index).is-moving .veil { animation: none; }
  .js:not(.is-index) .scene.is-active .badge-ring { animation: none; }
  .js:not(.is-index) .card.is-active .card-bar { animation: none; transform: scaleX(1); }
  .js:not(.is-index) .card, .js:not(.is-index) .card-foot, .js:not(.is-index) .card-art,
  .hero-canvas, .hero-fallback, .hud-ring-fill { transition-duration: 1ms; }
  .js:not(.is-index) .card.is-active { transform: none; }
}
@keyframes xfade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes xfade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 404 ---------- */
.simple-page {
  min-height: 100svh; max-width: 46rem; margin-inline: auto;
  display: flex; flex-direction: column; justify-content: center; gap: 1.25rem;
  padding: 2rem var(--pad-x);
}

@media (forced-colors: active) {
  [data-mark="now"]::before { background: CanvasText; box-shadow: none; }
  .case-frame { border-color: CanvasText; }
  .hud-dot::before { background: CanvasText; }
}
