/* Pranav Yerramaneni, devmello.xyz
   Tokens first, then base, then components in page order. No framework. */

:root {
  color-scheme: light dark;

  --bg: oklch(0.985 0.004 250);
  --bg-2: oklch(0.955 0.006 250);
  --ink: oklch(0.21 0.012 250);
  --ink-2: oklch(0.44 0.016 250);
  --ink-3: oklch(0.545 0.014 250);
  --rule: oklch(0.88 0.006 250);
  --accent: oklch(0.54 0.19 24);
  --accent-soft: oklch(0.93 0.03 24);

  --font: "Atkinson Hyperlegible Next", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --container: 72rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --entry-gap: clamp(2.5rem, 4vw, 3.25rem);
  --lh: 1.5;
  --track: 0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.18 0.008 250);
    --bg-2: oklch(0.22 0.009 250);
    --ink: oklch(0.93 0.006 250);
    --ink-2: oklch(0.74 0.01 250);
    --ink-3: oklch(0.64 0.01 250);
    --rule: oklch(0.31 0.01 250);
    --accent: oklch(0.72 0.17 26);
    --accent-soft: oklch(0.28 0.05 24);
    --lh: 1.55;
    --track: 0.01em;
  }
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: var(--lh);
  letter-spacing: var(--track);
  font-optical-sizing: auto;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { text-wrap: balance; }
p, figcaption { text-wrap: pretty; }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  text-decoration-color: var(--ink-3);
  transition: text-decoration-color 160ms var(--ease), color 160ms var(--ease);
}

a:hover,
a:focus-visible { text-decoration-color: var(--accent); }

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

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

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

.visually-hidden {
  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;
}

.skip {
  position: absolute;
  top: -100%;
  left: var(--gutter);
  z-index: 20;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  border-radius: 0 0 0.25rem 0.25rem;
}

.skip:focus { top: 0; }

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

.hero { padding-block: clamp(1.75rem, 3.5vw, 2.5rem) clamp(2rem, 4vw, 3rem); }

.hero__grid {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

@media (min-width: 56rem) {
  .hero__grid { grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem); }
}

.hero h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(2.4rem, 1.4rem + 3.2vw, 4.25rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.025em;
}

/* The name settles into place: a small overshoot, then rest, one letter after another. */
.settle__w { display: inline-block; white-space: nowrap; }

.settle__ch {
  display: inline-block;
  animation: settle 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 22ms);
}

@keyframes settle {
  from { opacity: 0; transform: translateY(0.45em); }
  55% { opacity: 1; transform: translateY(-0.06em); }
  78% { transform: translateY(0.02em); }
  to { opacity: 1; transform: translateY(0); }
}

.hero__status {
  max-width: 42ch;
  margin: 0 0 0.625rem;
  font-size: 1.0625rem;
  color: var(--ink-2);
}

.hero__status strong { font-weight: 500; color: var(--ink); }

.avail {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.avail::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-0.05em);
}

.hero__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.hero__links a { display: inline-block; padding-block: 0.5rem; }

/* ---------- Simulation ---------- */

.sim { margin: 0; }

.sim__stage {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 0.375rem;
  background: var(--bg-2);
}

@media (min-width: 56rem) {
  .sim__stage { aspect-ratio: 1 / 1; }
}

.sim__stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.sim__stage canvas:active { cursor: grabbing; }

.js .sim__stage canvas.is-static { cursor: default; }

.sim__static {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.js .sim__static { display: none; }
.js .sim__stage canvas { position: relative; }
html:not(.js) .sim__stage canvas { display: none; }

.sim__caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--ink-2);
}

/* Readouts sit inside the stage, along its bottom edge, so the figure stays short. */
.sim__readouts {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.625rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.sim__readouts > div {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  white-space: nowrap;
}

.sim__readouts dt { color: var(--ink-3); }

.sim__readouts dd {
  min-width: 6ch;
  margin: 0;
  color: var(--ink);
  text-align: right;
}

.sim__btn {
  flex: none;
  height: 2.75rem;
  padding: 0 1.125rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}

.sim__btn:hover,
.sim__btn:focus-visible {
  background: var(--ink);
  color: var(--bg);
}

.sim__btn[hidden] { display: none; }

.sim__note {
  flex: 1 1 auto;
  margin: 0;
  color: var(--ink-3);
  font-size: 0.8125rem;
  line-height: 1.4;
}

html:not(.js) .sim__btn,
html:not(.js) .sim__readouts { display: none; }

/* ---------- Entries: one continuous list, two abreast on wide screens ---------- */

.entries {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 56rem) {
  .entries {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(2rem, 4vw, 3rem);
  }
}

/* Each entry spans three rows (title, facts, slideshow) so the frames of a pair line up. */
.entry {
  display: grid;
  grid-template-rows: auto auto 1fr;
  grid-row: span 3;
  row-gap: 0;
  min-width: 0;
}

@supports (grid-template-rows: subgrid) {
  .entry { grid-template-rows: subgrid; }
}

.entry__title {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

.facts {
  margin: 0 0 0.875rem;
  font-size: 0.875rem;
  color: var(--ink-2);
}

.facts a { color: inherit; }

/* ---------- Slideshow ---------- */

.show {
  position: relative;
  min-width: 0;
  padding-bottom: var(--entry-gap);
}

.show__track {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.show__track::-webkit-scrollbar { display: none; }

.show__slide {
  flex: 0 0 100%;
  min-width: 0;
  padding-bottom: 4px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.slide { margin: 0; }

/* The frame: every slideshow on the page shares this 4:3 window. */
.slide__media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 0.375rem;
  background: var(--bg-2);
  container-type: inline-size;
}

/* Grid items default to min-height: auto, which would let a tall photo overflow the frame. */
.slide__media > * { min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; }

.slide__media picture,
.slide__media picture img {
  display: block;
  width: 100%;
  height: 100%;
}

.slide__media img,
.slide__media > video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slide__media--cover img { object-fit: cover; }

/* A phone clip is shown as a 4:5 crop in the frame (the whole frame is there in fullscreen). */
.slide__media--crop > video {
  width: auto;
  height: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 58%;
}

.slide__media > video { background: transparent; cursor: pointer; }

.slide__media > iframe,
.slide__media > .ill {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.slide__cap {
  margin: 0.625rem 0 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--ink-2);
}

.slide__cap a { color: inherit; }

.slide__cap kbd {
  font: 500 0.75rem var(--mono);
  color: var(--ink);
  padding: 0.05rem 0.3rem;
  border: 1px solid var(--rule);
  border-radius: 0.25rem;
}

/* Controls: previous, a counter, next; a pause button appears for video slides. */
.show__bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.125rem;
  margin-top: 0.25rem;
}

.show__count {
  min-width: 4ch;
  font: 500 0.75rem var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  text-align: center;
}

.show__btn {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: 500 1.375rem/1 var(--font);
  cursor: pointer;
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}

.show__btn:hover,
.show__btn:focus-visible {
  color: var(--ink);
  background: var(--bg-2);
}

.show__act {
  height: 2.75rem;
  padding: 0 0.25rem;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: 500 0.75rem var(--mono);
  cursor: pointer;
  transition: color 160ms var(--ease);
}

.show__act[data-play] { margin-right: auto; }

.show__act:hover,
.show__act:focus-visible { color: var(--ink); }

.show__act[hidden] { display: none; }

html:not(.js) .show__bar { display: none; }

/* YouTube: a poster and a play mark; the player loads only when asked. */
.yt {
  position: absolute;
  inset: 0;
  display: block;
  text-decoration: none;
}

.yt img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.yt__play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--ink);
  transform: translate(-50%, -50%);
  transition: background-color 160ms var(--ease);
}

.yt__play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 56%;
  border-style: solid;
  border-width: 0.45rem 0 0.45rem 0.75rem;
  border-color: transparent transparent transparent var(--bg);
  transform: translate(-50%, -50%);
}

.yt:hover .yt__play,
.yt:focus-visible .yt__play { background: var(--accent); }

/* Quadruped demo: a poster until the visitor asks for the iframe. */
.quad__poster { object-fit: cover; }

.quad__load {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  background: var(--bg);
}

html:not(.js) .quad__load { display: none; }

/* ---------- Illustrations (SVG, drawn in the page's tokens) ---------- */

/* Blocks to code: three blocks snap together, three lines of C++ type out, on an 8 s loop */

.blocks {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  gap: 4cqi;
  padding: 1.25rem;
  padding: 6cqi;
}

.blocks__svg {
  flex: none;
  width: 8.75rem;
  width: 38cqi;
  height: auto;
  overflow: visible;
}

.blk text {
  font: 500 9px var(--mono);
  fill: var(--bg);
}

.blk path { stroke: var(--bg-2); stroke-width: 1; }
.blk--1 path { fill: var(--accent); }
.blk--2 path { fill: var(--ink); }
.blk--3 path { fill: var(--ink-2); }

.blk { opacity: 0; transform: translateX(-32px); animation: 8s cubic-bezier(0.22, 1, 0.36, 1) infinite; }
.blk--1 { animation-name: blk1; }
.blk--2 { animation-name: blk2; }
.blk--3 { animation-name: blk3; }

@keyframes blk1 {
  0%, 2.5% { opacity: 0; transform: translateX(-32px); }
  8% { opacity: 1; transform: translateX(2px); }
  10%, 90% { opacity: 1; transform: translateX(0); }
  96%, 100% { opacity: 0; transform: translateX(0); }
}

@keyframes blk2 {
  0%, 7.5% { opacity: 0; transform: translateX(-32px); }
  13% { opacity: 1; transform: translateX(2px); }
  15%, 90% { opacity: 1; transform: translateX(0); }
  96%, 100% { opacity: 0; transform: translateX(0); }
}

@keyframes blk3 {
  0%, 12.5% { opacity: 0; transform: translateX(-32px); }
  18% { opacity: 1; transform: translateX(2px); }
  20%, 90% { opacity: 1; transform: translateX(0); }
  96%, 100% { opacity: 0; transform: translateX(0); }
}

.blocks__code {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  font: 500 0.6875rem/1.55 var(--mono);
  font-size: 3cqi;
  color: var(--ink);
}

.ln {
  display: block;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  animation: 8s linear infinite;
}

.ln--1 { animation-name: ln1; }
.ln--2 { animation-name: ln2; }
.ln--3 { animation-name: ln3; }
.ln--4 { animation-name: ln4; }

@keyframes ln1 {
  0% { width: 0; opacity: 1; }
  26% { width: 0; animation-timing-function: steps(14, end); }
  33%, 90% { width: 100%; opacity: 1; }
  96% { width: 100%; opacity: 0; animation-timing-function: step-end; }
  100% { width: 0; opacity: 0; }
}

@keyframes ln2 {
  0% { width: 0; opacity: 1; }
  35% { width: 0; animation-timing-function: steps(22, end); }
  44%, 90% { width: 100%; opacity: 1; }
  96% { width: 100%; opacity: 0; animation-timing-function: step-end; }
  100% { width: 0; opacity: 0; }
}

@keyframes ln3 {
  0% { width: 0; opacity: 1; }
  46% { width: 0; animation-timing-function: steps(16, end); }
  53%, 90% { width: 100%; opacity: 1; }
  96% { width: 100%; opacity: 0; animation-timing-function: step-end; }
  100% { width: 0; opacity: 0; }
}

@keyframes ln4 {
  0% { width: 0; opacity: 1; }
  56% { width: 0; animation-timing-function: step-end; }
  58%, 90% { width: 100%; opacity: 1; }
  96% { width: 100%; opacity: 0; animation-timing-function: step-end; }
  100% { width: 0; opacity: 0; }
}

/* Field: an autonomous path draws itself, then a robot follows it, on a 10 s loop */

.field__ground { fill: var(--bg); stroke: var(--rule); }
.field__zone { fill: var(--accent-soft); }
.field__tape { fill: none; stroke: var(--ink-3); stroke-width: 1; opacity: 0.7; }

.field__path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: fieldDraw 10s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

@keyframes fieldDraw {
  0%, 4% { stroke-dashoffset: 1; opacity: 1; }
  30%, 92% { stroke-dashoffset: 0; opacity: 1; }
  97% { stroke-dashoffset: 0; opacity: 0; }
  100% { stroke-dashoffset: 1; opacity: 0; }
}

.field__robot rect { fill: var(--ink); }
.field__heading { stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }

.field__robot {
  offset-path: path("M40 178C44 140 72 132 86 108C100 84 78 60 52 48C40 42 30 36 24 26");
  offset-rotate: auto;
  offset-distance: 0%;
  animation: fieldRun 10s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes fieldRun {
  0%, 32% { offset-distance: 0%; opacity: 1; }
  84%, 92% { offset-distance: 100%; opacity: 1; }
  97% { offset-distance: 100%; opacity: 0; }
  100% { offset-distance: 0%; opacity: 0; }
}

html:not(.has-motion-path) .field__robot { display: none; }

/* The decode: a scan line sweeps the viewport while the views swap underneath it */

.scan {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 25;
  height: 2px;
  background: var(--accent);
  pointer-events: none;
  will-change: transform;
}

.scan::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 28px;
  background: linear-gradient(to top, var(--accent-soft), transparent);
}

.is-sweeping { position: relative; }

.is-sweeping .sweep-in {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

@media (prefers-reduced-motion: reduce) {
  .settle__ch { animation: none; opacity: 1; transform: none; }
  .blk { animation: none; opacity: 1; transform: none; }
  .ln { animation: none; width: auto; opacity: 1; }
  .field__path { animation: none; stroke-dashoffset: 0; }
  .field__robot { animation: none; offset-distance: 100%; }
  .show__track { scroll-behavior: auto; }
}

/* ---------- Scroll motion: things arrive as they enter and recede as they leave ---------- */

/* The position rail: a hairline at the right edge with a tick per entry and a marker
   that rides the scroll. Built by script.js; hidden on narrow screens and in the LLM view. */
.rail {
  position: fixed;
  top: 50%;
  right: max(0.875rem, env(safe-area-inset-right));
  z-index: 20;
  width: 1px;
  height: 44vh;
  background: var(--rule);
  transform: translateY(-50%);
}

.rail__tick {
  position: absolute;
  right: 0;
  top: calc(var(--p, 0) * 100%);
  width: 0.625rem;
  height: 1px;
  background: var(--ink-3);
  transition: width 160ms var(--ease), background-color 160ms var(--ease);
}

.rail__tick::before {
  content: "";
  position: absolute;
  inset: -0.5rem -0.25rem;
}

.rail__tick::after {
  content: attr(data-label);
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font: 500 0.6875rem var(--mono);
  color: var(--ink-2);
  opacity: 0;
  transition: opacity 160ms var(--ease);
  pointer-events: none;
}

.rail__tick:hover,
.rail__tick:focus-visible,
.rail__tick.is-current { width: 1rem; }

.rail__tick.is-current { background: var(--accent); }

.rail__tick:hover::after,
.rail__tick:focus-visible::after { opacity: 1; }

.rail__marker {
  position: absolute;
  right: -1px;
  top: calc(var(--p, 0) * 100%);
  width: 3px;
  height: 1.125rem;
  margin-top: -0.5625rem;
  border-radius: 2px;
  background: var(--accent);
  pointer-events: none;
}

.rail__tick[hidden],
.llm-mode .rail { display: none; }

@media (max-width: 55.99rem) {
  .rail { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  /* Load: after the name settles, the lines under it and the instrument arrive in turn. */
  .js .hero__status,
  .js .hero__links,
  .js .sim { animation: fadeUp 700ms var(--ease) both; }
  .js .sim { animation-delay: 150ms; }
  .js .hero__status { animation-delay: 320ms; }
  .js .avail { animation-delay: 440ms; }
  .js .hero__links { animation-delay: 560ms; }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(0.6rem); }
    to { opacity: 1; transform: none; }
  }

  /* Entries: script.js marks an entry is-in when 12% of it is in view (the title wipes in, the
     facts line follows) and its slideshow is-seen when a quarter of the frame is in view (a scan
     line sweeps the frame open, then the caption and the controls rise). --d staggers a batch.
     Everything is visible without JavaScript. */
  .js .entry__title {
    clip-path: inset(-0.25rem -0.5rem);
    transition: clip-path 600ms var(--ease) var(--d, 0ms), opacity 600ms var(--ease) var(--d, 0ms);
  }

  .js .entry .facts,
  .js .slide__cap,
  .js .show__bar,
  .js .footer__links li,
  .js .footer__meta {
    transition: opacity 600ms var(--ease), transform 600ms var(--ease);
  }

  .js .entry .facts { transition-delay: calc(var(--d, 0ms) + 120ms); }
  .js .slide__cap { transition-delay: calc(var(--d, 0ms) + 560ms); }
  .js .show__bar { transition-delay: calc(var(--d, 0ms) + 680ms); }

  .js .slide__media {
    clip-path: inset(0 0 0 0);
    transition: clip-path 760ms var(--ease) calc(var(--d, 0ms) + 180ms);
  }

  .js .slide__media::after {
    content: "";
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    z-index: 2;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 14px 2px var(--accent-soft);
    opacity: 0;
    transform: translateY(calc(75cqi + 6px));
    pointer-events: none;
    transition: transform 760ms var(--ease) calc(var(--d, 0ms) + 180ms), opacity 220ms linear calc(var(--d, 0ms) + 760ms);
  }

  .js .entry:not(.is-in) .entry__title { opacity: 0; clip-path: inset(-0.25rem 100% -0.25rem -0.5rem); transition: none; }
  .js .entry:not(.is-in) .facts,
  .js .show:not(.is-seen) .slide__cap,
  .js .show:not(.is-seen) .show__bar { opacity: 0; transform: translateY(0.6rem); transition: none; }
  .js .show:not(.is-seen) .slide__media { clip-path: inset(0 0 100% 0); transition: none; }
  .js .show:not(.is-seen) .slide__media::after { opacity: 1; transform: translateY(0); transition: none; }

  .js .footer__links li:nth-child(2) { transition-delay: 90ms; }
  .js .footer__links li:nth-child(3) { transition-delay: 180ms; }
  .js .footer__meta { transition-delay: 300ms; }
  .js .footer:not(.is-in) .footer__links li,
  .js .footer:not(.is-in) .footer__meta { opacity: 0; transform: translateY(0.6rem); transition: none; }

  /* Scroll-linked depth, where the browser can drive an animation from the scroll position:
     the hero recedes as it leaves, a slideshow settles into place as it arrives, and an entry
     that has scrolled past the top dims. Older browsers simply skip this layer. */
  @supports (animation-timeline: view()) {
    .js .hero__grid {
      animation: heroExit linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 100%;
    }

    @keyframes heroExit {
      0% { opacity: 1; transform: none; }
      30% { opacity: 1; }
      100% { opacity: 0; transform: translateY(22%) scale(0.98); }
    }

    .js .show__track {
      animation: frameNear linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 90%;
    }

    @keyframes frameNear {
      from { transform: translateY(1.5rem) scale(0.97); }
      to { transform: none; }
    }

    .js .entry {
      animation: entryExit linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 100%;
    }

    @keyframes entryExit {
      0%, 35% { opacity: 1; }
      100% { opacity: 0.4; }
    }
  }
}

/* ---------- LLM view: the raw llms-full.txt shown in place of the page ---------- */

.llm { padding-block: clamp(1.5rem, 4vw, 3rem) 6rem; }

.llm__text {
  max-width: 84ch;
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}

.llm__text:focus-visible { outline: none; }

/* Human / LLM switch */

.mode {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 30;
  display: inline-flex;
  padding: 0.25rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.08), 0 10px 30px oklch(0 0 0 / 0.12);
  transform: translateX(-50%);
  font-size: 0.8125rem;
  font-weight: 500;
}

.mode::before {
  content: "";
  position: absolute;
  top: 0.25rem;
  bottom: 0.25rem;
  left: 0.25rem;
  width: calc(50% - 0.25rem);
  border-radius: 999px;
  background: var(--ink);
  transition: transform 240ms var(--ease);
}

.mode--llm::before { transform: translateX(100%); }

.mode__opt {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 5.25rem;
  min-height: 2.25rem;
  padding: 0 0.9rem;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  transition: color 240ms var(--ease);
}

.mode__opt::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  border: 1px solid currentColor;
  transition: background-color 240ms var(--ease), border-color 240ms var(--ease);
}

.mode__opt:hover { color: var(--ink); }

.mode__opt[aria-current="true"],
.mode__opt[aria-current="true"]:hover { color: var(--bg); }

.mode__opt[aria-current="true"]::before {
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- Footer: the three ways to reach him, then the colophon ---------- */

.footer {
  border-top: 1px solid var(--rule);
  padding-block: 1.25rem 5.25rem;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer__links a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  color: var(--ink);
  font-size: 0.9375rem;
  text-decoration-color: transparent;
}

.footer__links a:hover,
.footer__links a:focus-visible { text-decoration-color: var(--accent); }

.footer__links svg {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  fill: currentColor;
  color: var(--ink-2);
  transition: color 160ms var(--ease);
}

.footer__links a:hover svg,
.footer__links a:focus-visible svg { color: var(--ink); }

.footer__meta {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.footer__meta a { color: var(--ink-2); }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after { transition-duration: 0.01ms !important; }
}

/* ---------- Print ---------- */

@media print {
  :root {
    --bg: #fff;
    --bg-2: #fff;
    --ink: #000;
    --ink-2: #333;
    --ink-3: #555;
    --rule: #bbb;
    --accent: #000;
  }
  .skip,
  .sim,
  .sim__btn,
  .mode,
  .llm,
  .scan,
  .show__bar,
  .quad__load,
  .rail,
  .yt__play { display: none; }
  .human[hidden] { display: block; }
  .human *,
  .footer * { opacity: 1 !important; clip-path: none !important; transform: none !important; animation: none !important; }
  .hero__grid,
  .entries { grid-template-columns: 1fr; }
  .entry { display: block; break-inside: avoid; }
  .show { padding-bottom: 1.5rem; }
  .show__track { display: block; overflow: visible; }
  .show__slide { margin-bottom: 1rem; break-inside: avoid; }
  .slide__media:has(video) { display: none; }
  a { text-decoration: none; }
  .footer__links a[href^="http"]::after,
  .hero__links a[href^="http"]::after,
  .entry__title a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: var(--ink-2);
  }
}
