/* ==========================================================================
   Zion Rubin — homepage stylesheet
   The homepage, the os-hub, Getaroom, Loom and Synapsee pages (with
   project.css) and the Zion OS page (with project.css and zion-os.css) load
   this; only 404 still uses styles.css.
   Sections: tokens · base · intro · projects · plates · diagrams · overview ·
             footer · responsive · motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   Light by default. Dark follows the system unless a saved theme (applied by
   theme.js as <html data-theme>) says otherwise. data-palette is ignored here.
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  --bg: #f5f4f1;
  --plate: #ecebe7;
  --ink: #121212;
  --ink-2: #4e4d49;
  --ink-3: #6f6e69;
  --line: rgba(18, 18, 18, .12);
  --line-strong: rgba(18, 18, 18, .5);
  --grid: rgba(18, 18, 18, .05);
  --dia: rgba(18, 18, 18, .5);
  --dia-soft: rgba(18, 18, 18, .2);
  --fill: rgba(18, 18, 18, .06);
  --accent: #c8461c;

  /* The embedded film (motion.js) reads these as hex: the accent for Zion OS,
     greys for the other projects. */
  --dim: #6f6e69;
  --gold: #c8461c;
  --cyan: #4e4d49;
  --pink: #4e4d49;
  --lime: #4e4d49;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --gap: clamp(16px, 2.2vw, 32px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #0f0f0e;
    --plate: #161615;
    --ink: #ebeae6;
    --ink-2: #b0afa9;
    --ink-3: #85847e;
    --line: rgba(235, 234, 230, .12);
    --line-strong: rgba(235, 234, 230, .5);
    --grid: rgba(235, 234, 230, .045);
    --dia: rgba(235, 234, 230, .5);
    --dia-soft: rgba(235, 234, 230, .2);
    --fill: rgba(235, 234, 230, .07);
    --accent: #ef6a3d;

    --dim: #85847e;
    --gold: #ef6a3d;
    --cyan: #b0afa9;
    --pink: #b0afa9;
    --lime: #b0afa9;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0f0f0e;
  --plate: #161615;
  --ink: #ebeae6;
  --ink-2: #b0afa9;
  --ink-3: #85847e;
  --line: rgba(235, 234, 230, .12);
  --line-strong: rgba(235, 234, 230, .5);
  --grid: rgba(235, 234, 230, .045);
  --dia: rgba(235, 234, 230, .5);
  --dia-soft: rgba(235, 234, 230, .2);
  --fill: rgba(235, 234, 230, .07);
  --accent: #ef6a3d;

  --dim: #85847e;
  --gold: #ef6a3d;
  --cyan: #b0afa9;
  --pink: #b0afa9;
  --lime: #b0afa9;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */

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

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

.frame {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Pre-rendered ASCII creature behind the page. The canvas never intercepts
   links; pointer interaction is handled globally by field.js. */
body:has(> .field) {
  position: relative;
  z-index: 0;
}

.field {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  contain: strict;
  opacity: 0;
  transition: opacity 1.1s var(--ease);
}

.field.is-on { opacity: 1; }

.arr {
  display: inline-block;
  transition: transform .45s var(--ease);
}

/* --------------------------------------------------------------------------
   3. Intro
   Intro copy beside a portrait; stacked on phones.
   -------------------------------------------------------------------------- */

.intro { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px var(--gap); align-items: center; padding: clamp(64px, 12vh, 128px) 0 clamp(80px, 12vh, 128px); }
.intro-copy { grid-column: 1 / span 7; min-width: 0; }
.intro-portrait { grid-column: 9 / -1; justify-self: end; width: min(100%, 280px); aspect-ratio: 1; margin: 0; -webkit-mask-image: linear-gradient(#000 78%, transparent 100%); mask-image: linear-gradient(#000 78%, transparent 100%); }
.intro-portrait img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
@media (max-width: 599px) {
  .intro-copy { grid-column: 1 / -1; }
  .intro-portrait { grid-column: 1 / -1; justify-self: start; width: 144px; }
}

.intro h1 {
  margin: 0;
  font-size: clamp(2.25rem, 1.55rem + 2.9vw, 3.75rem);
  font-weight: 500;
  letter-spacing: -.04em;
  line-height: 1;
}

.intro .line {
  max-width: 34ch;
  margin: 20px 0 0;
  color: var(--ink-2);
  font-size: clamp(1.125rem, 1rem + .55vw, 1.5rem);
  line-height: 1.4;
  letter-spacing: -.015em;
  text-wrap: pretty;
}

.elsewhere {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 12px;
}

.elsewhere a, .colophon a, .colophon .mode {
  color: var(--ink-2);
  transition: color .3s var(--ease);
}

.elsewhere a:hover, .colophon a:hover, .colophon .mode:hover { color: var(--ink); }
.elsewhere a:hover .arr, .obj-repo:hover .arr { transform: translate(2px, -2px); }
.colophon a:hover .arr { transform: translateX(3px); }

/* --------------------------------------------------------------------------
   4. Projects
   Every project is the same sheet on a shared 12-column grid (subgrid):
   a text rail on the left (meta, name and line, spec and links) and a plate
   on the right whose top lines up with the name. Spacing inside the rail is
   fixed, so all five sheets read the same way.
   -------------------------------------------------------------------------- */

.work-head {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  align-items: baseline;
  padding-bottom: 48px;
}

.work-head h2 {
  grid-column: 1 / span 8;
  grid-row: 1;
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -.01em;
}

.work-head .count {
  grid-column: 9 / -1;
  grid-row: 1;
  justify-self: end;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.work-head p {
  grid-column: 1 / span 6;
  grid-row: 2;
  max-width: 52ch;
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.5;
}

/* The Natural Intelligence band follows the personal one. */
.work + .work { margin-top: clamp(120px, 14vw, 192px); }

.work-list {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: clamp(80px, 9vw, 128px);
}

.obj {
  position: relative;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  grid-template-rows: auto auto auto 1fr;
  align-items: start;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  transition: border-color .5s var(--ease);
  scroll-margin-top: 32px;
}

.obj-meta {
  grid-column: 1 / span 4;
  grid-row: 1;
  display: flex;
  align-items: baseline;
  gap: 20px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
}

.obj-n { transition: color .4s var(--ease); }

.obj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.obj-lead {
  grid-column: 1 / span 4;
  grid-row: 2;
  min-width: 0;
  padding-top: 40px;
}

.obj-name {
  margin: 0;
  font-size: clamp(1.625rem, 1.2rem + 1.3vw, 2.375rem);
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1.05;
}

.obj-line {
  max-width: 38ch;
  margin: 12px 0 0;
  color: var(--ink-2);
  font-size: 1.0625rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.obj-foot {
  grid-column: 1 / span 4;
  grid-row: 3;
  min-width: 0;
  padding-top: 32px;
}

.obj-spec {
  margin: 0;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.obj-spec div {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.obj-spec dt { color: var(--ink-3); }
.obj-spec dd { margin: 0; color: var(--ink-2); transition: color .4s var(--ease); }

.obj-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 20px 0 0;
  font-size: 14px;
  font-weight: 500;
}

/* The project name is the link; its ::after stretches over the whole object.
   Secondary links (Loom's repository) sit above that layer. */
.obj-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.obj-link:focus-visible { outline: none; }
.obj-link:focus-visible::after { outline: 1px solid var(--accent); outline-offset: 12px; }

.obj-repo {
  position: relative;
  z-index: 2;
  color: var(--ink-2);
  transition: color .3s var(--ease);
}

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

/* Active state: hover, keyboard focus, or (on touch screens) home.js marking
   the project nearest the middle of the viewport. */
.obj:is(:hover, :focus-within, .is-active) { border-top-color: var(--ink); }
.obj:is(:hover, :focus-within, .is-active) .obj-n { color: var(--accent); }
.obj:is(:hover, :focus-within, .is-active) .obj-spec dd { color: var(--ink); }
.obj:is(:hover, :focus-within, .is-active) .obj-cta .arr { transform: translateX(4px); }
.obj:is(:hover, :focus-within, .is-active) .plate-art { border-color: var(--line-strong); }

/* --------------------------------------------------------------------------
   5. Plates
   The plate spans the rail's rows; the last row (1fr) takes whatever height
   the plate needs beyond the text, so the rail's own spacing never stretches.
   -------------------------------------------------------------------------- */

.plate {
  grid-column: 6 / -1;
  grid-row: 2 / -1;
  min-width: 0;
  margin: 40px 0 0;
}

.plate-art {
  overflow: hidden;
  background: var(--plate);
  border: 1px solid var(--line);
  transition: border-color .5s var(--ease);
}

.plate figcaption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
}

.plate figcaption span:first-child { flex: none; }
.plate figcaption span:last-child { text-align: right; }

/* --------------------------------------------------------------------------
   6. Diagrams
   Inline SVG drawn in theme tokens. Strokes stay one device pixel wide at any
   size; labels and the accent appear when the project is active.
   -------------------------------------------------------------------------- */

.dia { display: block; width: 100%; height: auto; }

.d-grid { fill: none; stroke: var(--grid); stroke-width: 1; }

.d-box, .d-line, .d-soft, .d-node, .d-fill, .d-mini {
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.d-box  { fill: var(--plate); stroke: var(--dia); }
.d-line { fill: none; stroke: var(--dia); }
.d-soft { fill: none; stroke: var(--dia-soft); }
.d-fill { fill: var(--fill); stroke: var(--dia); }
.d-node { fill: var(--plate); stroke: var(--dia); }
.d-mini { fill: var(--fill); stroke: var(--dia-soft); }
.d-dot  { fill: var(--dia-soft); }
.d-dash { stroke-dasharray: 3 3; }

.d-lbl {
  fill: var(--ink-2);
  font-family: var(--mono);
  font-size: 10px;
  opacity: 0;
  transition: opacity .45s var(--ease);
}
.d-lbl .d-dim { fill: var(--ink-3); }
/* a halo in the plate colour keeps labels clear of the lines beneath them */
.d-lbl text {
  paint-order: stroke;
  stroke: var(--plate);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.d-ac { fill: var(--dia-soft); transition: fill .4s var(--ease); }

/* Zion OS: an agent's turn, drawn from the agent down to the app capabilities */
.d-trace {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.2s var(--ease);
}

/* os-hub: the hub's heartbeat down to each instance; Getaroom: connectors */
.d-flow {
  fill: none;
  stroke: var(--dia);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

/* os-hub: each instance reports in, and the hub starts one more */
.d-st { fill: var(--dia-soft); transition: fill .4s var(--ease); }
.d-new {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .5s var(--ease), transform .7s var(--ease);
}
.d-plus { transition: opacity .3s var(--ease); }

/* Getaroom: an agent from each instance takes its seat and writes to the
   shared context */
.d-agent {
  fill: var(--ink);
  transition: transform 1s var(--ease), fill .4s var(--ease);
}
.d-ctx {
  fill: none;
  stroke: var(--dia);
  stroke-width: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset .5s var(--ease);
}
.d-ctx--ac { stroke: var(--accent); stroke-width: 1.5; }

/* Loom: tasks advance along their lanes, a little out of step */
.d-lane { transition: transform .9s var(--ease); }
.d-lane:nth-child(2) { transition-delay: .05s; }
.d-lane:nth-child(3) { transition-delay: .1s; }
.d-lane:nth-child(4) { transition-delay: .15s; }
.d-lane:nth-child(5) { transition-delay: .2s; }

/* Synapsee: a read head sweeps the trace */
.d-cursor {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: 0;
  transition: transform 1.8s var(--ease), opacity .4s var(--ease);
}

/* Delays live only on the active state, so everything resets at once. */
.obj:is(:hover, :focus-within, .is-active) .d-lbl { opacity: 1; }
.obj:is(:hover, :focus-within, .is-active) .d-ac { fill: var(--accent); }
.obj:is(:hover, :focus-within, .is-active) .d-trace { stroke-dashoffset: 0; }
.obj:is(:hover, :focus-within, .is-active) .d-flow { animation: d-beat 1s linear infinite; }
.obj:is(:hover, :focus-within, .is-active) .d-st { fill: var(--accent); }
.obj:is(:hover, :focus-within, .is-active) .d-s2 { transition-delay: .15s; }
.obj:is(:hover, :focus-within, .is-active) .d-s3 { transition-delay: .3s; }
.obj:is(:hover, :focus-within, .is-active) .d-s4 { transition-delay: .9s; }
.obj:is(:hover, :focus-within, .is-active) .d-new { opacity: 1; transform: none; transition-delay: .3s; }
.obj:is(:hover, :focus-within, .is-active) .d-plus { opacity: 0; }
.obj:is(:hover, :focus-within, .is-active) .d-agent { fill: var(--accent); }
.obj:is(:hover, :focus-within, .is-active) .d-agent--a { transform: translateX(124px); }
.obj:is(:hover, :focus-within, .is-active) .d-agent--b { transform: translateX(-124px); }
.obj:is(:hover, :focus-within, .is-active) .d-ctx { stroke-dashoffset: 0; }
.obj:is(:hover, :focus-within, .is-active) .d-c1 { transition-delay: .9s; }
.obj:is(:hover, :focus-within, .is-active) .d-c2 { transition-delay: 1.1s; }
.obj:is(:hover, :focus-within, .is-active) .d-c3 { transition-delay: 1.3s; }
.obj:is(:hover, :focus-within, .is-active) .d-lane { transform: translateX(24px); }
.obj:is(:hover, :focus-within, .is-active) .d-cursor { opacity: 1; transform: translateX(288px); }

@keyframes d-beat { to { stroke-dashoffset: -6; } }

/* --------------------------------------------------------------------------
   7. Overview
   The homepage is two bands on the same grid: the film (or, for Natural
   Intelligence, a still map) in the rail, and one small looping diagram per
   project beside it. Each tile links to its project's page. The film and the
   tiles share a top and a bottom edge.
   -------------------------------------------------------------------------- */

.overview {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  margin-bottom: clamp(80px, 9vw, 128px);
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.ov-film {
  grid-column: 1 / span 4;
  grid-row: 2;
  min-width: 0;
  margin: 40px 0 0;
}

.film-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--plate);
  border: 1px solid var(--line);
  transition: border-color .5s var(--ease);
}

.film-stage canvas { display: block; width: 100%; height: 100%; cursor: pointer; }

.ov-film:hover .film-stage { border-color: var(--line-strong); }

/* pause, play, replay: shown on hover, on focus, and whenever the film is stopped */
.film-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-2);
  cursor: pointer;
  opacity: 0;
  transition: opacity .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}

.film-toggle svg { display: none; width: 12px; height: 12px; fill: currentColor; }
.ov-film.is-playing .i-pause,
.ov-film:not(.is-playing):not(.is-ended) .i-play,
.ov-film.is-ended .i-replay { display: block; }
.ov-film:not(.is-ready) .film-toggle { display: none; }
.ov-film:is(:hover, :focus-within, :not(.is-playing)) .film-toggle { opacity: 1; }
.film-toggle:hover { color: var(--accent); border-color: var(--line-strong); }

.ov-film figcaption, .mini-cap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
}

.ov-full { color: var(--ink-2); transition: color .3s var(--ease); }
.ov-full:hover { color: var(--ink); }
.ov-full:hover .arr { transform: translateX(3px); }

.ov-minis {
  grid-column: 6 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}

.ov-minis li { display: flex; min-width: 0; }

.mini { display: flex; flex: 1; flex-direction: column; min-width: 0; }

/* The tile takes its height from the row (the film's height); the drawing
   is centred in it and the grid fills whatever is left. */
.mini-art {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--plate);
  border: 1px solid var(--line);
  transition: border-color .5s var(--ease);
}

.mini-dia { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

.mini-cap { justify-content: flex-start; gap: 8px; white-space: nowrap; }
.mini-name { color: var(--ink-2); transition: color .3s var(--ease); }

.mini:hover .mini-art { border-color: var(--line-strong); }
.mini:hover .mini-name { color: var(--ink); }

/* Each tile loops a quiet version of its project's diagram. The base styles
   are the finished frame, which is what reduced motion shows; the keyframes
   start from the empty frame and come back to it. --t is the loop length and
   --d puts the five tiles out of step. */
.mini--os   { --t: 7s;   --d: -1s; }
.mini--hub  { --t: 8s;   --d: -2.5s; }
.mini--room { --t: 9s;   --d: -4s; }
.mini--loom { --t: 7.5s; --d: -5.5s; }
.mini--syn  { --t: 6.5s; --d: -3s; }

.m-ac { fill: var(--accent); }

.m-flow {
  fill: none;
  stroke: var(--dia);
  stroke-width: 1;
  stroke-dasharray: 2 4;
  animation: d-beat 2s linear infinite;
}

/* Zion OS: an agent's turn runs down through the layers */
.m-trace {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.m-os-trace { animation: m-os-trace var(--t) var(--ease) var(--d) infinite both; }
.m-os-ac    { animation: m-os-ac var(--t) linear var(--d) infinite both; }

@keyframes m-os-trace {
  0%        { stroke-dashoffset: 1; opacity: 1; }
  40%       { stroke-dashoffset: 0; }
  82%       { opacity: 1; }
  94%, 100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes m-os-ac {
  0%, 38%   { fill: var(--dia-soft); }
  44%, 86%  { fill: var(--accent); }
  94%, 100% { fill: var(--dia-soft); }
}

/* os-hub: each instance reports in, then the hub starts one more */
.m-st { fill: var(--accent); }
.m-st1 { animation: m-hub-st1 var(--t) linear var(--d) infinite both; }
.m-st2 { animation: m-hub-st2 var(--t) linear var(--d) infinite both; }
.m-st3 { animation: m-hub-st3 var(--t) linear var(--d) infinite both; }
.m-st4 { animation: m-hub-st4 var(--t) linear var(--d) infinite both; }
.m-new  { animation: m-hub-new var(--t) var(--ease) var(--d) infinite both; }
.m-plus { opacity: 0; animation: m-hub-plus var(--t) linear var(--d) infinite both; }

@keyframes m-hub-st1 { 0%, 8%  { fill: var(--dia-soft); } 12%, 86% { fill: var(--accent); } 92%, 100% { fill: var(--dia-soft); } }
@keyframes m-hub-st2 { 0%, 16% { fill: var(--dia-soft); } 20%, 86% { fill: var(--accent); } 92%, 100% { fill: var(--dia-soft); } }
@keyframes m-hub-st3 { 0%, 24% { fill: var(--dia-soft); } 28%, 86% { fill: var(--accent); } 92%, 100% { fill: var(--dia-soft); } }
@keyframes m-hub-st4 { 0%, 58% { fill: var(--dia-soft); } 62%, 86% { fill: var(--accent); } 92%, 100% { fill: var(--dia-soft); } }
@keyframes m-hub-new {
  0%, 38%   { opacity: 0; transform: translateY(6px); }
  48%, 86%  { opacity: 1; transform: none; }
  92%, 100% { opacity: 0; transform: none; }
}
@keyframes m-hub-plus {
  0%, 34%  { opacity: 1; }
  40%, 92% { opacity: 0; }
  100%     { opacity: 1; }
}

/* Getaroom: an agent from each instance takes a seat and writes to the
   shared context */
.m-agent { fill: var(--accent); transform: translateY(-36px); }
.m-agent-a { animation: m-room-a var(--t) var(--ease) var(--d) infinite both; }
.m-agent-b { animation: m-room-b var(--t) var(--ease) var(--d) infinite both; }

.m-ctx {
  fill: none;
  stroke: var(--dia);
  stroke-width: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.m-ctx--ac { stroke: var(--accent); stroke-width: 1.5; }
.m-c1 { animation: m-room-c1 var(--t) var(--ease) var(--d) infinite both; }
.m-c2 { animation: m-room-c2 var(--t) var(--ease) var(--d) infinite both; }
.m-c3 { animation: m-room-c3 var(--t) var(--ease) var(--d) infinite both; }

@keyframes m-room-a {
  0%, 6%    { transform: none; }
  20%, 86%  { transform: translateY(-36px); }
  96%, 100% { transform: none; }
}
@keyframes m-room-b {
  0%, 22%   { transform: none; }
  36%, 86%  { transform: translateY(-36px); }
  96%, 100% { transform: none; }
}
@keyframes m-room-c1 { 0%, 40% { stroke-dashoffset: 1; opacity: 1; } 48%, 84% { stroke-dashoffset: 0; opacity: 1; } 92%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes m-room-c2 { 0%, 48% { stroke-dashoffset: 1; opacity: 1; } 56%, 84% { stroke-dashoffset: 0; opacity: 1; } 92%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes m-room-c3 { 0%, 56% { stroke-dashoffset: 1; opacity: 1; } 64%, 84% { stroke-dashoffset: 0; opacity: 1; } 92%, 100% { stroke-dashoffset: 0; opacity: 0; } }

/* Loom: tasks advance down their lanes, a little out of step, and reduce */
.m-lane { transform: translateY(12px); animation: m-loom-lane var(--t) var(--ease) var(--d) infinite both; }
.m-lane:nth-child(2) { animation-delay: calc(var(--d) + .15s); }
.m-lane:nth-child(3) { animation-delay: calc(var(--d) + .3s); }
.m-lane:nth-child(4) { animation-delay: calc(var(--d) + .45s); }
.m-lane:nth-child(5) { animation-delay: calc(var(--d) + .6s); }
.m-loom-ac { animation: m-loom-ac var(--t) linear var(--d) infinite both; }

@keyframes m-loom-lane {
  0%, 4%    { transform: none; }
  46%, 84%  { transform: translateY(12px); }
  96%, 100% { transform: none; }
}
@keyframes m-loom-ac {
  0%, 52%   { fill: var(--dia-soft); }
  58%, 86%  { fill: var(--accent); }
  94%, 100% { fill: var(--dia-soft); }
}

/* Synapsee: a read head sweeps the trace, then the graph recommends */
.m-cursor {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transform: translateX(48px);
  animation: m-syn-cursor var(--t) var(--ease) var(--d) infinite both;
}
.m-syn-ac { animation: m-syn-ac var(--t) linear var(--d) infinite both; }

@keyframes m-syn-cursor {
  0%        { opacity: 0; transform: none; }
  6%        { opacity: 1; }
  56%       { opacity: 1; transform: translateX(96px); }
  64%, 100% { opacity: 0; transform: translateX(96px); }
}
@keyframes m-syn-ac {
  0%, 56%   { fill: var(--dia-soft); }
  62%, 88%  { fill: var(--accent); }
  96%, 100% { fill: var(--dia-soft); }
}

/* home.js marks each band while it is off screen */
.overview.is-off :is(.mini-dia, .ov-dia) * { animation-play-state: paused; }

/* The last band of a section needs no space of its own below it. */
.overview:last-child { margin-bottom: 0; }

/* Natural Intelligence: the same band, with a still map where the film sits
   and three tiles. A request lights its way down the map, from an employee's
   Claude through the OS to the systems, stopping at the approval. */
.ov-dia { display: block; width: 100%; height: 100%; }
.ov-lbl { fill: var(--ink-3); font-family: var(--mono); font-size: 9px; }
.ov-lbl .ov-strong { fill: var(--ink); }
.ov-lbl text {
  paint-order: stroke;
  stroke: var(--plate);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.ov-step { fill: var(--accent); animation: ov-step 8s linear infinite both; }
.ov-hi   { fill: var(--accent); opacity: .16; animation: ov-hi 8s linear infinite both; }
.ov-s2 { animation-delay: .5s; }
.ov-s3 { animation-delay: 1s; }
.ov-s4 { animation-delay: 1.5s; }
.ov-s5 { animation-delay: 2s; }
.ov-s6 { animation-delay: 2.8s; }
.ov-s7 { animation-delay: 3.6s; }

@keyframes ov-step {
  0%, 4%    { fill: var(--dia-soft); }
  8%, 60%   { fill: var(--accent); }
  68%, 100% { fill: var(--dia-soft); }
}
@keyframes ov-hi {
  0%, 4%    { opacity: 0; }
  8%, 60%   { opacity: .16; }
  68%, 100% { opacity: 0; }
}

.ov-minis--ni { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.mini--nios { --t: 8s;   --d: -1.5s; }
.mini--da   { --t: 7s;   --d: -3.5s; }
.mini--nb   { --t: 7.5s; --d: -.5s; }

/* Industry OS: a request runs from one Claude through the OS, waits for a
   person at the gate, then reaches the systems */
.m-nios-t1 { animation: m-nios-t1 var(--t) var(--ease) var(--d) infinite both; }
.m-nios-t2 { animation: m-nios-t2 var(--t) var(--ease) var(--d) infinite both; }
.m-gate    { fill: var(--accent); animation: m-nios-gate var(--t) linear var(--d) infinite both; }
.m-nios-ac { animation: m-nios-ac var(--t) linear var(--d) infinite both; }

@keyframes m-nios-t1 {
  0%        { stroke-dashoffset: 1; opacity: 1; }
  32%       { stroke-dashoffset: 0; }
  84%       { opacity: 1; }
  94%, 100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes m-nios-t2 {
  0%, 48%   { stroke-dashoffset: 1; opacity: 1; }
  58%       { stroke-dashoffset: 0; }
  84%       { opacity: 1; }
  94%, 100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes m-nios-gate {
  0%, 32%   { fill: var(--dia-soft); }
  36%, 86%  { fill: var(--accent); }
  94%, 100% { fill: var(--dia-soft); }
}
@keyframes m-nios-ac {
  0%, 58%   { fill: var(--dia-soft); }
  62%, 86%  { fill: var(--accent); }
  94%, 100% { fill: var(--dia-soft); }
}

/* Data Agent: a question picks a semantic view, reads one column, and the
   answer's bars rise */
.m-chip { fill: var(--accent); animation: m-da-chip var(--t) linear var(--d) infinite both; }
.m-col  { fill: var(--accent); opacity: .18; animation: m-da-col var(--t) linear var(--d) infinite both; }
.m-bars rect {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: m-da-bar var(--t) var(--ease) var(--d) infinite both;
}
.m-bars rect:nth-child(2) { animation-delay: calc(var(--d) + .08s); }
.m-bars rect:nth-child(3) { animation-delay: calc(var(--d) + .16s); }
.m-bars rect:nth-child(4) { animation-delay: calc(var(--d) + .24s); }
.m-bars rect:nth-child(5) { animation-delay: calc(var(--d) + .32s); }

@keyframes m-da-chip {
  0%, 10%   { opacity: 0; }
  16%, 86%  { opacity: 1; }
  94%, 100% { opacity: 0; }
}
@keyframes m-da-col {
  0%, 26%   { opacity: 0; }
  34%, 86%  { opacity: .18; }
  94%, 100% { opacity: 0; }
}
@keyframes m-da-bar {
  0%, 40%   { transform: scaleY(0); }
  54%, 86%  { transform: none; }
  96%, 100% { transform: scaleY(0); }
}

/* Natural Brain: a traversal walks down through the strata, one fact at a
   time */
.m-nb-trace { animation: m-nb-trace var(--t) var(--ease) var(--d) infinite both; }
.m-nb-n1 { animation: m-nb-n1 var(--t) linear var(--d) infinite both; }
.m-nb-n2 { animation: m-nb-n2 var(--t) linear var(--d) infinite both; }
.m-nb-n3 { animation: m-nb-n3 var(--t) linear var(--d) infinite both; }
.m-nb-n4 { animation: m-nb-n4 var(--t) linear var(--d) infinite both; }

@keyframes m-nb-trace {
  0%        { stroke-dashoffset: 1; opacity: 1; }
  50%       { stroke-dashoffset: 0; }
  84%       { opacity: 1; }
  94%, 100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes m-nb-n1 { 0%, 2%  { fill: var(--dia-soft); } 6%, 86%  { fill: var(--accent); } 94%, 100% { fill: var(--dia-soft); } }
@keyframes m-nb-n2 { 0%, 18% { fill: var(--dia-soft); } 22%, 86% { fill: var(--accent); } 94%, 100% { fill: var(--dia-soft); } }
@keyframes m-nb-n3 { 0%, 34% { fill: var(--dia-soft); } 38%, 86% { fill: var(--accent); } 94%, 100% { fill: var(--dia-soft); } }
@keyframes m-nb-n4 { 0%, 48% { fill: var(--dia-soft); } 52%, 86% { fill: var(--accent); } 94%, 100% { fill: var(--dia-soft); } }

/* --------------------------------------------------------------------------
   8. Footer
   On the same grid as the projects: the film link lines up with the plates.
   -------------------------------------------------------------------------- */

.colophon {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  align-items: baseline;
  margin-top: clamp(96px, 10vw, 144px);
  padding: 16px 0 48px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
}

.colophon .copy { grid-column: 1 / span 4; }
.colophon .film { grid-column: 6 / span 5; }
.colophon .mode {
  grid-column: 11 / -1;
  justify-self: end;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   9. Responsive
   -------------------------------------------------------------------------- */

/* Without hover, diagram labels are always shown where they are legible. */
@media (hover: none) {
  .d-lbl { opacity: 1; }
}

/* Narrower desktops: a wider rail, the plate keeps the right half. */
@media (max-width: 1099px) {
  .obj-meta, .obj-lead, .obj-foot { grid-column: 1 / span 5; }
  .plate { grid-column: 7 / -1; }
  .ov-film { grid-column: 1 / span 5; }
  .ov-minis { grid-column: 7 / -1; gap: 12px; }
  .colophon .copy { grid-column: 1 / span 5; }
  .colophon .film { grid-column: 7 / span 4; }
}

/* Tablets and phones: one column, in reading order — meta, name and line,
   plate, spec and links. */
@media (max-width: 899px) {
  .work-head p { grid-column: 1 / -1; }

  .obj { grid-template-rows: none; }
  .obj-meta { grid-column: 1 / -1; }
  .obj-lead { grid-column: 1 / span 9; padding-top: 28px; }
  .plate { grid-column: 1 / -1; grid-row: 3; margin-top: 28px; }
  .obj-foot { grid-column: 1 / span 9; grid-row: 4; padding-top: 28px; }

  .ov-film { grid-column: 1 / span 6; margin-top: 28px; }
  .ov-minis { grid-column: 1 / -1; grid-row: 3; margin-top: 28px; }
  .mini-art { flex: none; aspect-ratio: 128 / 208; }
  .ov-minis--ni .mini-art { aspect-ratio: 1; }

  .colophon {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 32px;
  }
  .colophon .mode { margin-left: auto; }
}

/* On phones the plates are too small for their labels; the spec and the
   caption carry them. */
@media (max-width: 599px) {
  .obj-lead, .obj-foot { grid-column: 1 / -1; }
  .d-lbl { display: none; }

  .ov-film { grid-column: 1 / -1; }
  .ov-minis { gap: 8px; }
  .mini-n { display: none; }
}

/* --------------------------------------------------------------------------
   10. Motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
    animation: none !important;
  }
}

/* Earlier roles, kept compact beside the project showcases. */
.experience-entry { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px var(--gap); padding-top: 24px; border-top: 1px solid var(--line); }
.experience-role { grid-column: 1 / span 4; }
.experience-role h3 { margin: 0 0 8px; font-size: 20px; font-weight: 500; letter-spacing: -.025em; }
.experience-date { color: var(--ink-3); font: 12px var(--mono); }
.experience-entry p { grid-column: 6 / -1; max-width: 60ch; margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.6; }
@media (max-width: 599px) {
  .experience-role, .experience-entry p { grid-column: 1 / -1; }
}

/* Shared summaries for personal projects and Natural Intelligence products. */
button.mini { width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.mini:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }
.ni-summary { position: fixed; z-index: 20; width: min(340px, calc(100vw - 32px)); box-sizing: border-box; padding: 24px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); box-shadow: 0 12px 40px rgb(0 0 0 / .14); }
.ni-summary[hidden] { display: none; }
.ni-summary-label { display: block; padding-right: 24px; color: var(--ink-3); font: 10px var(--mono); text-transform: uppercase; letter-spacing: .07em; }
.ni-summary h3 { margin: 12px 0 10px; font-size: 20px; font-weight: 500; letter-spacing: -.025em; }
.ni-summary p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.6; }
.ni-summary-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border: 0; background: none; color: var(--ink-2); font-size: 24px; cursor: pointer; }

.ni-summary-footer { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.ni-blog { position: relative; display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font: 12px var(--mono); cursor: default; }
.ni-blog-note { position: absolute; bottom: calc(100% + 8px); left: 0; padding: 6px 10px; background: var(--ink); color: var(--bg); font: 11px var(--mono); white-space: nowrap; visibility: hidden; }
.ni-blog:is(:hover, :focus) .ni-blog-note { visibility: visible; }
.ni-blog:is(:hover, :focus) .arr { transform: translate(2px, -2px); }

.ni-blog[hidden] { display: none; }
a.ni-blog { cursor: pointer; }
a.ni-blog:hover { color: var(--ink); }

/* Compact usage chart, disclosed beneath the Data Agent tile. */
.data-numbers { grid-column: 6 / -1; margin-top: 12px; min-width: 0; }
.data-numbers summary { width: fit-content; cursor: pointer; color: var(--ink-2); font: 12px var(--mono); padding: 6px 0; list-style: none; }
.data-numbers summary::-webkit-details-marker { display: none; }
.data-numbers summary:hover { color: var(--accent); }
.data-numbers summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.data-numbers[open] summary .arr { transform: rotate(180deg); }
.data-numbers figure { margin: 16px 0 0; padding: 24px; border: 1px solid var(--line); background: var(--bg); }
.data-numbers figcaption { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 24px; font-size: 14px; }
.data-numbers figcaption span { font: 10px/1.6 var(--mono); color: var(--ink-3); }
.data-numbers svg { display: block; width: 100%; }
.numbers-label { fill: var(--ink-2); font: 12px var(--mono); }
.numbers-value { fill: var(--ink-3); font: 12px var(--mono); }
.numbers-current { fill: var(--accent); }
.numbers-grid { fill: none; stroke: var(--line); }
.numbers-trend { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.numbers-point { fill: var(--accent); }
.numbers-month { fill: var(--ink-3); font: 10px var(--mono); }
.numbers-bi { font-size: 13px; line-height: 1.7; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 16px; }
.numbers-bi strong { display: block; font-weight: 500; color: var(--ink); }
.numbers-note { font-size: 11px; line-height: 1.6; color: var(--ink-3); margin: 12px 0 0; }
@media (max-width: 1099px) { .data-numbers { grid-column: 7 / -1; } }
@media (max-width: 899px) { .data-numbers { grid-column: 1 / -1; } }
@media (max-width: 599px) { .data-numbers { grid-column: 1 / -1; }.data-numbers figure { padding: 20px; } }

.numbers-hero { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; }
.numbers-hero strong { font-size: clamp(48px, 6vw, 72px); line-height: 1; font-weight: 500; letter-spacing: -.06em; color: var(--accent); }
.numbers-hero span { color: var(--ink); font-size: 17px; }
.numbers-definition { color: var(--ink-3); font-size: 11px; line-height: 1.6; margin: 12px 0 8px; }
.numbers-area { fill: var(--accent); opacity: .08; }
.numbers-support { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.numbers-support p { margin: 0; }
.numbers-support strong { display: block; color: var(--ink); font-size: 20px; font-weight: 500; letter-spacing: -.03em; }
.numbers-support span, .numbers-period { display: block; margin-top: 8px; color: var(--ink-3); font: 10px/1.6 var(--mono); }
.numbers-period { margin: 12px 0 0; }
