/* Theme: light by default; dark via prefers-color-scheme. A manual choice (html[data-theme="light"|"dark"], set by assets/theme.js)
   beats the media query; "system" or no attribute leaves the media query in charge. */
:root {
  color-scheme: light dark;
  --bg: #F5F1F0; --fg: #342C2A;
  --gray-1: #EAE6E5; --gray-2: #E0DBDA; --gray-3: #CAC5C4;
  --gray-4: #AAA4A3; --gray-5: #7F7977; --gray-6: #4A4240;
  --blue-1: #E2DFE9; --blue-2: #8082C5; --blue-3: #00075F; --alert: #D6540B;
  --line: #807875; --diagram-blue: #62649E;
  --on-subject: var(--fg);
  --ease: cubic-bezier(.22, 1, .36, 1);
}
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #000; --fg: #FFF; --gray-1: #1A1A1A; --gray-2: #333333; --gray-3: #4F4F4F; --gray-4: #696969; --gray-5: #B2B2B2; --gray-6: #E5E5E5; --blue-1: #191D52; --blue-2: #5E6DEE; --blue-3: #E2DFE9; --alert: #FF7A30; --on-subject: var(--bg); --line: #858585; --diagram-blue: #7E8CFF; }
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #000; --fg: #FFF; --gray-1: #1A1A1A; --gray-2: #333333; --gray-3: #4F4F4F; --gray-4: #696969; --gray-5: #B2B2B2; --gray-6: #E5E5E5; --blue-1: #191D52; --blue-2: #5E6DEE; --blue-3: #E2DFE9; --alert: #FF7A30; --on-subject: var(--bg); --line: #858585; --diagram-blue: #7E8CFF; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 1.75; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button, input { border-radius: 0; }
button { background: transparent; }
a, button, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--blue-3); outline-offset: 5px; }
::selection { background: var(--blue-1); color: var(--blue-3); }
[hidden] { display: none !important; }
p, h1, h2, h3 { margin: 0; }
h1, h2, h3 { font-weight: 400; }
.tiny, .small { font-size: 14px; line-height: 1.5; }
.muted { color: var(--gray-6); }
.skip-link { position: fixed; top: -100px; left: 16px; background: var(--bg); border: 1px solid var(--blue-3); padding: 12px; z-index: 10; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.site-header { min-height: 72px; border-bottom: 1px solid var(--gray-3); padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.brand { font-size: 16px; line-height: 1.25; font-weight: 600; letter-spacing: -.02em; }
.site-header nav { margin-left: auto; font-size: 14px; }
.site-header nav a, .site-footer a { display: inline-flex; align-items: center; min-height: 44px; }
.site-header nav a:hover, .text-link:hover, .site-footer a:hover, .breadcrumbs a:hover { text-decoration: underline; text-underline-offset: 4px; }
.theme-switch { position: relative; font-size: 14px; }
.theme-switch summary { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 8px; cursor: pointer; list-style: none; }
.theme-switch summary::-webkit-details-marker { display: none; }
.theme-switch summary:hover, .theme-switch[open] summary { text-decoration: underline; text-underline-offset: 4px; }
.theme-switch > div { position: absolute; right: 0; top: calc(100% + 8px); display: flex; padding: 4px; border: 1px solid var(--line); background: var(--bg); z-index: 5; }
.theme-switch button { min-width: 64px; min-height: 44px; border: 0; padding: 8px 12px; }
.theme-switch button:hover { background: var(--gray-1); }
.theme-switch button[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 5px; font-weight: 600; }
.theme-switch button:focus-visible { outline-offset: -2px; }
.container { max-width: 1440px; margin-inline: auto; padding: 0 20px; }
.catalog-intro { padding: 28px 0 24px; }
.catalog-intro h1 { font-size: clamp(32px, 4vw, 48px); line-height: 1.2; letter-spacing: -.05em; }
.catalog-intro > p:not(.intro-meta) { margin-top: 12px; max-width: 580px; word-break: keep-all; }
.intro-meta { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--gray-6); font-size: 13px; }
.text-link { min-height: 24px; text-decoration: underline; text-underline-offset: 4px; }
.section-line { display: flex; align-items: center; border-top: 1px solid var(--line); padding-top: 16px; }
.section-line h2 { font-size: 18px; line-height: 1.4; }
.count { font-size: 14px; color: var(--gray-6); margin-left: 4px; }
.catalog-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin: 12px 0 20px; }
.filters { display: flex; gap: 2px; }
.filters button { border: 1px solid transparent; font-size: 14px; min-height: 44px; padding: 8px 12px; }
.filters button[aria-pressed="true"] { border-color: var(--line); background: var(--gray-1); }
.filters button:hover { text-decoration: underline; text-underline-offset: 4px; }
.search { width: 100%; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); padding: 0 12px; min-height: 44px; }
.search:focus-within { outline: 2px solid var(--blue-3); outline-offset: 2px; }
.search input { width: 100%; min-width: 0; border: none; background: transparent; font-size: 16px; }
.search input:focus-visible { outline: none; }
.search input::placeholder { color: var(--gray-6); }
.search > span:first-child { font-size: 24px; line-height: 1; }
.catalog-grid { display: grid; gap: 28px; }
.experiment-card { min-width: 0; display: flex; flex-direction: column; }
.experiment-card:hover h3, .experiment-card:focus-visible h3 { text-decoration: underline; text-underline-offset: 5px; }
.experiment-card:active .card-preview { background: var(--gray-2); }
.experiment-card:active h3 { text-decoration-thickness: 2px; }
.experiment-card:focus-visible { outline-offset: 5px; }
.card-info { padding: 0 0 12px; }
.experiment-code { font-size: 13px; color: var(--gray-6); letter-spacing: .03em; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.card-title h3 { font-size: 24px; line-height: 1.35; letter-spacing: -.03em; }
.card-title > span { font-size: 22px; }
.card-preview { height: 190px; display: grid; place-items: center; background: var(--gray-1); border: 1px solid var(--line); overflow: hidden; }
.card-preview svg { width: min(90%, 340px); height: 175px; overflow: visible; }
.card-meta { padding: 10px 0 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 13px; color: var(--gray-6); }
.empty-state { border: 1px solid var(--line); padding: 48px 20px; text-align: center; }
.about-section { border-top: 1px solid var(--gray-3); padding: 24px 0 32px; margin-top: 40px; display: grid; gap: 12px; }
.about-section h2 { font-size: 18px; line-height: 1.4; }
.about-section p { max-width: 660px; font-size: 14px; color: var(--gray-6); word-break: keep-all; }
.site-footer { border-top: 1px solid var(--gray-3); padding: 12px 20px; display: flex; justify-content: flex-end; align-items: center; gap: 16px; font-size: 13px; color: var(--gray-6); }
.breadcrumbs { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--gray-6); padding-top: 12px; min-height: 44px; }
.experiment-heading { padding: 12px 0 24px; }
.experiment-heading h1 { font-size: clamp(32px, 4vw, 48px); letter-spacing: -.05em; line-height: 1.2; }
.experiment-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px; font-size: 13px; line-height: 1.65; color: var(--gray-6); }
.experiment-meta a { text-decoration: underline; text-underline-offset: 4px; overflow-wrap: anywhere; }
#demo-toolbar { position: sticky; top: 0; z-index: 3; background: var(--bg); }
.demo-toolbar { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px 0; }
.demo-toolbar h2 { font-size: 16px; line-height: 1.4; }
.toolbar-buttons { display: flex; gap: 8px; }
.toolbar-buttons button { font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); min-height: 44px; }
.toolbar-buttons button:not(:disabled):hover { background: var(--gray-1); text-decoration: underline; text-underline-offset: 4px; }
#pause-all[aria-pressed="true"] { background: var(--gray-1); }
.motion-notice { width: 100%; font-size: 13px; color: var(--gray-6); }
.demo-jump { margin: 8px 0 16px; }
.demo-jump summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 14px; color: var(--gray-6); list-style: none; }
.demo-jump summary::-webkit-details-marker { display: none; }
.demo-jump summary:hover { text-decoration: underline; text-underline-offset: 4px; }
.demo-index { display: flex; flex-wrap: wrap; gap: 0 20px; padding: 4px 0 12px; }
.demo-index a { color: var(--gray-6); font-size: 14px; display: inline-flex; align-items: center; min-height: 44px; }
.demo-index a:hover { text-decoration: underline; text-underline-offset: 4px; }
.demo-index a span { margin-right: 8px; }
.demo-grid { display: grid; gap: 28px 24px; }
.demo-card { min-width: 0; scroll-margin-top: 80px; }
.demo-heading { padding: 0 0 12px; }
.demo-heading h3 { font-size: 20px; font-weight: 600; line-height: 1.4; letter-spacing: -.03em; }
.demo-number { font-size: 13px; font-weight: 400; color: var(--gray-6); margin-right: 10px; letter-spacing: 0; }
.demo-heading > span { display: block; color: var(--gray-6); font-size: 14px; line-height: 1.5; padding-top: 3px; }
.stage { height: 218px; position: relative; display: grid; place-items: center; background: var(--gray-1); overflow: hidden; border: 1px solid var(--line); }
.stage svg { display: block; width: 100%; height: 190px; overflow: visible; }
.demo-info { padding: 4px 0 0; }
.demo-description { font-size: 15px; margin: 0; color: var(--gray-6); word-break: keep-all; }
.demo-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 4px; }
.demo-controls .tiny { font-size: 13px; color: var(--gray-6); }
.replay { border: none; color: var(--blue-3); padding: 8px; font-size: 14px; min-height: 44px; }
.replay:not(:disabled):hover { text-decoration: underline; text-underline-offset: 4px; }
.replay span { margin-right: 4px; }
button:disabled { color: var(--gray-5); text-decoration: none; cursor: not-allowed; }
.toolbar-buttons button:disabled { border-color: var(--gray-3); }
.experiment-pagination { border-top: 1px solid var(--gray-3); margin-top: 36px; padding: 20px 0 32px; display: flex; justify-content: space-between; gap: 20px; font-size: 14px; }
.experiment-pagination a { min-height: 44px; display: flex; align-items: center; flex-wrap: wrap; }
.experiment-pagination a:hover { text-decoration: underline; text-underline-offset: 4px; }
.experiment-pagination span { color: var(--gray-6); margin-left: 7px; }
/* Meaningful diagram lines use a separate token so surface grays can stay quiet. */
.ink { fill: var(--blue-3); }
.violet { fill: var(--diagram-blue); }
.gray-fill { fill: var(--line); }
.line { fill: none; stroke: var(--line); stroke-width: 1; }
.ink-line { fill: none; stroke: var(--blue-3); stroke-width: 1; }
.dash { stroke-dasharray: 3 4; }
.svg-label { font-family: Arial, Helvetica, sans-serif; font-size: 13px; fill: var(--gray-6); }
.animated { animation-duration: 3.6s; animation-timing-function: var(--ease); animation-fill-mode: both; animation-iteration-count: 1; animation-play-state: paused; }
.playing .animated { animation-play-state: running; }
.is-paused .animated { animation-play-state: paused !important; }
.rewinding .animated { animation-name: none !important; }
.preview-ball { animation-name: preview-ball; animation-duration: 4s; }
.preview-path { stroke: var(--line); stroke-width: 1; fill: none; stroke-dasharray: 3 5; }
.preview-ghost { fill: none; stroke: var(--line); stroke-width: 1.5; }
.preview-key { fill: var(--line); }
@keyframes preview-ball { 0%, 10% { transform: translateX(0); } 24% { transform: translateX(-12px); } 72% { transform: translateX(162px); } 88%, 100% { transform: translateX(150px); } }
/* Motion scenes (EXP-001): the original 190px HTML/CSS stages, restored wholesale inside the card chrome.
   Geometry, keyframes and timing are the pre-wipe build; colors come from the theme tokens: ink (--fg) or deep blue (--blue-3) subjects, gray guides, and --alert for at most one small element per scene. */
.stage-scene { height: 218px; }
.scene { --subject: var(--fg); --on-subject: var(--bg); --accent: var(--alert); --ink: var(--blue-3); --guide: var(--line); --muted: var(--gray-5); position: relative; isolation: isolate; width: 100%; height: 190px; overflow: hidden; }
.scene .label { position: absolute; z-index: 2; color: var(--gray-6); font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.2; letter-spacing: .02em; white-space: nowrap; }
.scene .label-bl { bottom: 8px; left: 30px; }
.scene .label-br { bottom: 8px; right: 36px; }
.scene .ground { position: absolute; left: 0; right: 0; bottom: 30px; height: 2px; background: var(--guide); }
/* Every scene loops; the card's play state (viewport entry, replay, pause all, off-screen) drives all of them at once. */
.demo-card:not(.playing) .scene *, .demo-card:not(.playing) .scene *::before, .demo-card:not(.playing) .scene *::after,
.is-paused .scene *, .is-paused .scene *::before, .is-paused .scene *::after,
.demo-card.is-off .scene *, .demo-card.is-off .scene *::before, .demo-card.is-off .scene *::after { animation-play-state: paused !important; }
.rewinding .scene *, .rewinding .scene *::before, .rewinding .scene *::after { animation: none !important; }

/* 1. Easing: alternate so the linear ball reverses abruptly at each end while the eased ball brakes and re-accelerates. */
.scene .track { position: absolute; left: 24px; right: 24px; height: 2px; border-radius: 1px; background: var(--guide); }
.scene .track.t-ease { top: 64px; }
.scene .track.t-linear { top: 94px; }
.scene .ball { position: absolute; left: 24px; width: 22px; height: 22px; border-radius: 50%; }
.scene .ball.linear { top: 84px; background: var(--muted); animation: race 2.6s linear infinite alternate; }
.scene .ball.ease { top: 54px; background: var(--ink); animation: race 2.6s cubic-bezier(.65, 0, .35, 1) infinite alternate; }
.scene .l-ease { top: 36px; left: 24px; color: var(--fg); }
.scene .l-linear { top: 114px; left: 24px; }
@keyframes race { from { left: 24px; } to { left: calc(100% - 46px); } }

/* 2. Anticipation: crouch (opposite direction) -> stretch into the jump -> squash on landing. */
.scene .jumper { position: absolute; left: 50%; bottom: 32px; width: 54px; height: 54px; margin-left: -27px; border-radius: 14px; background: var(--ink); transform-origin: 50% 100%; animation: anticipate 2.8s infinite; }
.scene .jumper::before, .scene .jumper::after { content: ""; position: absolute; top: 18px; width: 8px; height: 10px; background: var(--on-subject); border-radius: 4px; }
.scene .jumper::before { left: 14px; }
.scene .jumper::after { right: 14px; }
@keyframes anticipate {
  0%   { transform: translateY(0) scale(1, 1);        animation-timing-function: ease-in-out; }
  16%  { transform: translateY(0) scale(1.2, .76);    animation-timing-function: ease-in-out; }
  24%  { transform: translateY(0) scale(1.3, .62);    animation-timing-function: cubic-bezier(.333, .667, .667, 1); }
  38%  { transform: translateY(-92px) scale(.92, 1.1); animation-timing-function: cubic-bezier(.333, 0, .667, .333); }
  48%  { transform: translateY(0) scale(1.14, .86);   animation-timing-function: ease-out; }
  56%, 100% { transform: translateY(0) scale(1, 1); }
}

/* 3. Squash & stretch: long while falling, flat on contact, long again on the rebound. */
.scene .bouncer { --drop: 104px; position: absolute; left: 50%; bottom: 32px; width: 44px; height: 44px; margin-left: -22px; border-radius: 50%; background: var(--subject); transform-origin: 50% 100%; animation: bounce 1.6s infinite; }
@keyframes bounce {
  0%   { transform: translateY(calc(-1 * var(--drop))) scale(1, 1); animation-timing-function: cubic-bezier(.333, 0, .667, .333); }
  42%  { transform: translateY(0) scale(.9, 1.16);                  animation-timing-function: linear; }
  48%  { transform: translateY(0) scale(1.45, .55);                 animation-timing-function: ease-out; }
  56%  { transform: translateY(-26px) scale(.88, 1.18);              animation-timing-function: cubic-bezier(.333, .667, .667, 1); }
  100% { transform: translateY(calc(-1 * var(--drop))) scale(1, 1); }
}

/* 4. Arc: x is constant speed, y alone is a parabola (ease-out up, ease-in down), so the path is a true curve. */
.scene .arc-guide { position: absolute; left: 40px; bottom: 50px; width: calc(100% - 80px); height: 110px; overflow: visible; }
.scene .arc-guide path { fill: none; stroke: var(--guide); stroke-width: 1.5; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.scene .arc-ball, .scene .arc-ghost { position: absolute; bottom: 40px; left: 30px; width: 20px; height: 20px; border-radius: 50%; }
.scene .arc-ball { background: var(--accent); animation: arcX 2.4s linear infinite alternate, arcY 2.4s infinite alternate; }
.scene .arc-ghost { border: 2px dashed var(--muted); opacity: .8; animation: arcX 2.4s linear infinite alternate; }
@keyframes arcX { from { left: 30px; } to { left: calc(100% - 50px); } }
@keyframes arcY {
  0%   { transform: translateY(0);      animation-timing-function: cubic-bezier(.333, .667, .667, 1); }
  50%  { transform: translateY(-110px); animation-timing-function: cubic-bezier(.333, 0, .667, .333); }
  100% { transform: translateY(0); }
}

/* 5. Follow-through: the body stops dead, the rod keeps swinging and decays. */
.scene .ft-body { position: absolute; left: 24px; bottom: 32px; width: 52px; height: 36px; border-radius: 10px 10px 4px 4px; background: var(--ink); animation: ftMove 4.8s cubic-bezier(.5, 0, .9, .55) infinite; }
.scene .ft-tail { position: absolute; left: 50%; bottom: 100%; width: 4px; height: 58px; margin-left: -2px; border-radius: 2px; background: var(--ink); transform-origin: 50% 100%; animation: ftSwing 4.8s ease-in-out infinite; }
.scene .ft-tail::after { content: ""; position: absolute; top: -8px; left: -6px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); }
@keyframes ftMove { 0%, 4% { left: 24px; } 30%, 54% { left: calc(100% - 76px); } 80%, 100% { left: 24px; } }
@keyframes ftSwing {
  0%, 4% { transform: rotate(0); animation-timing-function: ease-in; }
  30% { transform: rotate(-24deg); animation-timing-function: ease-in-out; }
  36% { transform: rotate(16deg); }
  42% { transform: rotate(-9deg); }
  47% { transform: rotate(4deg); }
  51% { transform: rotate(-1.5deg); }
  54% { transform: rotate(0); animation-timing-function: ease-in; }
  80% { transform: rotate(24deg); animation-timing-function: ease-in-out; }
  86% { transform: rotate(-16deg); }
  91% { transform: rotate(9deg); }
  95% { transform: rotate(-4deg); }
  98% { transform: rotate(1.5deg); }
  100% { transform: rotate(0); }
}

/* 6. Overlap: jointed segments run the same swing, each 0.15s later than its parent. */
.scene .arm { position: absolute; left: 28px; top: 50%; }
.scene .seg { position: absolute; left: 0; top: -5px; width: 54px; height: 10px; border-radius: 5px; background: var(--ink); transform-origin: 5px 50%; animation: segSwing 2.4s ease-in-out infinite; }
.scene .seg::after { content: ""; position: absolute; left: 2px; top: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--on-subject); }
.scene .seg > .seg { left: 44px; top: 0; }
.scene .seg.s4 { background: var(--accent); }
.scene .seg.s1 { animation-delay: -1.2s; }
.scene .seg.s2 { animation-delay: -1.05s; }
.scene .seg.s3 { animation-delay: -.9s; }
.scene .seg.s4 { animation-delay: -.75s; }
@keyframes segSwing { 0%, 100% { transform: rotate(-11deg); } 50% { transform: rotate(11deg); } }

/* 7. Stagger: six bars, 0.15s apart; they shrink with the card instead of overflowing. */
.scene .stagger-wrap { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; gap: 10px; padding: 0 12px 30px; }
.scene .stagger-wrap span { flex: 0 1 34px; min-width: 0; border-radius: 6px 6px 0 0; background: var(--subject); animation: staggerUp 2.4s infinite backwards; }
.scene .stagger-wrap span:nth-child(1) { height: 50px;  animation-delay: 0s; }
.scene .stagger-wrap span:nth-child(2) { height: 80px;  animation-delay: .15s; }
.scene .stagger-wrap span:nth-child(3) { height: 110px; animation-delay: .3s; }
.scene .stagger-wrap span:nth-child(4) { height: 70px;  animation-delay: .45s; }
.scene .stagger-wrap span:nth-child(5) { height: 95px;  animation-delay: .6s; }
.scene .stagger-wrap span:nth-child(6) { height: 60px;  animation-delay: .75s; }
@keyframes staggerUp {
  0%   { opacity: 0; transform: translateY(24px); animation-timing-function: cubic-bezier(.22, 1, .36, 1); }
  14%  { opacity: 1; transform: none; }
  70%  { opacity: 1; transform: none; animation-timing-function: ease-in; }
  88%, 100% { opacity: 0; transform: translateY(-14px); }
}

/* 8. Match cut: background and subject hard-cut at the midpoint; the circle's position, size and spin never break. */
.scene-match { overflow: visible; }
.scene .mc-bg { position: absolute; inset: -34px 0; background: var(--blue-1); animation: mcBg 3.6s steps(1, end) infinite; }
@keyframes mcBg { 0% { background: var(--blue-1); } 50% { background: var(--gray-2); } }
.scene .mc-circle { position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px; animation: mcSpin 3.6s linear infinite, mcBreath 3.6s ease-in-out infinite; }
@keyframes mcSpin { to { rotate: 360deg; } }
@keyframes mcBreath { 0%, 100% { scale: .8; } 50% { scale: 1.25; } }
.scene .mc-face { position: absolute; inset: 0; display: grid; place-items: center; }
.scene .mc-face svg { width: 100%; height: 100%; }
.scene .mc-a { animation: mcA 3.6s steps(1, end) infinite; }
.scene .mc-b { opacity: 0; animation: mcB 3.6s steps(1, end) infinite; }
.scene .mc-a .mc-fill { fill: var(--ink); }
.scene .mc-b .mc-fill { fill: var(--subject); }
.scene .mc-cut-out { fill: var(--blue-1); }
.scene .mc-seam { stroke: var(--bg); }
@keyframes mcA { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes mcB { 0% { opacity: 0; } 50% { opacity: 1; } }
.scene .mc-cut { position: absolute; z-index: 2; top: 10px; right: 12px; padding: 1px 6px; border: 1px solid var(--gray-3); background: var(--bg); color: var(--fg); font: 700 13px/1.5 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; opacity: 0; animation: mcFlash 3.6s infinite; }
@keyframes mcFlash { 0% { opacity: 1; } 8%, 49.9% { opacity: 0; } 50% { opacity: 1; } 58%, 99.9% { opacity: 0; } 100% { opacity: 1; } }

/* 9. Parallax: each layer travels exactly one tile per loop, so the seam never shows (16 / 40 / 75 px/s). */
.scene .px-sun { position: absolute; top: 16px; right: 22px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); opacity: .9; }
.scene .layer { position: absolute; left: 0; width: calc(100% + var(--tile)); animation: pxScroll var(--dur) linear infinite; }
@keyframes pxScroll { to { transform: translateX(calc(-1 * var(--tile))); } }
.scene .layer.far { --tile: 160px; --dur: 10s; bottom: 16px; height: 80px; color: var(--line); }
.scene .layer.mid { --tile: 120px; --dur: 3s; bottom: 16px; height: 56px; color: var(--diagram-blue); opacity: .75; }
.scene .px-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 16px; background: var(--ink); }
.scene .layer.near { --tile: 90px; --dur: 1.2s; bottom: 12px; height: 70px; color: var(--ink); opacity: .85; }

/* 10. Mask reveal: the mask sweeps over the text to reveal it, then wipes it out in the same direction. */
.scene .reveal-wrap { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 0 4px; white-space: nowrap; font-size: clamp(2rem, 11vw, 2.8rem); font-weight: 800; letter-spacing: 2px; line-height: 1.3; }
.scene .reveal-ghost { color: transparent; -webkit-text-stroke: 1px var(--line); }
.scene .reveal-text { position: absolute; inset: 0; padding: inherit; display: flex; align-items: center; justify-content: center; color: var(--ink); animation: maskReveal 3.6s ease-in-out infinite; }
@keyframes maskReveal { 0% { clip-path: inset(0 100% 0 0); } 30%, 65% { clip-path: inset(0 0 0 0); } 95%, 100% { clip-path: inset(0 0 0 100%); } }
.scene .reveal-bar { position: absolute; top: -8px; bottom: -8px; left: 0; width: 4px; border-radius: 2px; background: var(--accent); opacity: 0; animation: barSweep 3.6s ease-in-out infinite; }
@keyframes barSweep {
  0%   { left: 0; opacity: 1; } 30% { left: calc(100% - 4px); opacity: 1; } 32% { left: calc(100% - 4px); opacity: 0; }
  64%  { left: 0; opacity: 0; } 65% { left: 0; opacity: 1; }
  95%  { left: calc(100% - 4px); opacity: 1; } 97%, 100% { left: calc(100% - 4px); opacity: 0; }
}
/* Camera scenes (EXP-002): DOM stages on the motion-scene chassis, looping forever. One registered custom property per scene
   is animated on .cm (--s swing -1…1, --t turn 0…1, --mm lens readout); the camera glyph, gauge and viewfinder all read it, so they stay in sync. */
@property --s { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --t { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --mm { syntax: "<integer>"; inherits: true; initial-value: 24; }
@keyframes cmSwing { 0%, 12% { --s: -1; } 50%, 62% { --s: 1; } 100% { --s: -1; } }
@keyframes cmZoom { 0%, 12% { --s: -1; --mm: 24; } 50%, 62% { --s: 1; --mm: 70; } 100% { --s: -1; --mm: 24; } }
@keyframes cmTurn { from { --t: 0; } to { --t: 1; } }
.scene .cm { position: absolute; top: 0; left: 50%; width: 260px; height: 190px; margin-left: -130px; animation: cmSwing 6s cubic-bezier(.45, 0, .55, 1) infinite; }
.scene .cm-zoom { animation-name: cmZoom; }
.scene .cm-orbit { animation: cmTurn 10s linear infinite; }
.scene .cm > * { position: absolute; }
.scene .cm-vf { overflow: hidden; background: var(--bg); border: 2px solid var(--ink); }
.scene .cm-world, .scene .cm-layer, .scene .cm-fixed, .scene .cm-zw, .scene .cm-pano { position: absolute; }
.scene .cm-corners { position: absolute; inset: 5px; z-index: 2; }
.scene .cm-corners b { position: absolute; width: 9px; height: 9px; border: 0 solid var(--ink); }
.scene .cm-corners b:nth-child(1) { top: 0; left: 0; border-width: 2px 0 0 2px; }
.scene .cm-corners b:nth-child(2) { top: 0; right: 0; border-width: 2px 2px 0 0; }
.scene .cm-corners b:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
.scene .cm-corners b:nth-child(4) { bottom: 0; right: 0; border-width: 0 2px 2px 0; }
.scene .cm-flat { position: absolute; left: 0; right: 0; bottom: 0; background: var(--gray-2); border-top: 2px solid var(--guide); }
/* artwork: far = gray, mid = pale blue with violet edge, near = ink, subject = --subject; --accent only on the small lens / pointer mark */
.scene .cm-far { fill: var(--line); }
.scene .cm-mid { fill: var(--blue-1); stroke: var(--diagram-blue); stroke-width: 1.5; }
.scene .cm-near { fill: var(--ink); }
.scene .cm-floor { fill: var(--gray-2); }
.scene .cm-ground, .scene .cm-tick, .scene .cm-persp { fill: none; stroke: var(--guide); }
.scene .cm-ground { stroke-width: 2; }
.scene .cm-tick { stroke-width: 1.5; }
.scene .cm-persp { stroke-width: 1; }
.scene .cm-horizon { fill: none; stroke: var(--ink); stroke-width: 2; }
.scene .cm-sun { fill: none; stroke: var(--diagram-blue); stroke-width: 2; }
.scene .cm-win { fill: var(--ink); }
.scene .cm-sub { fill: var(--subject); }
.scene .cm-eye { fill: var(--on-subject); }
.scene .cm-t { font: 13px ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; fill: var(--gray-6); }
/* camera marker: a zero-size anchor holds a glyph whose lens faces up; modifiers turn it */
.scene .cm-rig { width: 0; height: 0; }
.scene .cm-glyph { position: absolute; left: -30px; top: -50px; overflow: visible; }
.scene .cm-glyph.cm-front { left: -32px; top: -26px; }
.scene .cm-glyph.is-right { transform: rotate(90deg); transform-origin: 30px 50px; }
.scene .cm-glyph.is-in { transform: rotate(180deg) scale(.7); transform-origin: 30px 50px; }
.scene .cm-fov { fill: var(--ink); fill-opacity: .12; stroke: var(--ink); stroke-opacity: 1; stroke-width: 1; stroke-dasharray: 3 3; }
.scene .cm-body { fill: var(--ink); }
.scene .cm-lens { fill: var(--accent); }
.scene .cm-outline { fill: var(--gray-1); stroke: var(--ink); stroke-width: 2; }
.scene .cm-arc, .scene .cm-ring { border: 1px dashed var(--guide); border-radius: 50%; }
.scene .cm-stand { background: var(--gray-5); }
.scene .cm-track { fill: none; stroke: var(--guide); stroke-width: 2; }
.scene .cm-tie { fill: none; stroke: var(--guide); stroke-width: 1; }
.scene .cm-stop { fill: none; stroke: var(--ink); stroke-width: 3; }
.scene .cm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--subject); }
/* 01 pan: the world sweeps flat (no parallax) while the head turns on a fixed pivot */
.scene .cm-pan-vf { left: 20px; top: 6px; width: 220px; height: 106px; }
.scene .cm-pan-world { left: -112px; top: 0; width: 440px; height: 102px; transform: translateX(calc(var(--s) * -96px)); }
.scene .cm-pan-arc { left: 78px; top: 116px; width: 104px; height: 104px; clip-path: inset(0 0 50% 0); }
.scene .cm-pan-stand { left: 129px; top: 177px; width: 2px; height: 11px; }
.scene .cm-pan-rig { left: 130px; top: 170px; transform: rotate(calc(var(--s) * 30deg)); }
/* 02 tilt: the world sweeps up and down while the head pitches */
.scene .cm-tilt-vf { left: 10px; top: 37px; width: 144px; height: 116px; }
.scene .cm-tilt-world { left: 0; top: -104px; width: 140px; height: 320px; transform: translateY(calc(var(--s) * 84px)); }
.scene .cm-tilt-arc { left: 146px; top: 41px; width: 108px; height: 108px; clip-path: inset(0 0 0 50%); }
.scene .cm-tilt-stand { left: 199px; top: 102px; width: 2px; height: 58px; }
.scene .cm-tilt-rig { left: 200px; top: 95px; transform: rotate(calc(var(--s) * -28deg)); }
/* 03 roll: the horizon tilts against fixed level marks while the body rotates about the lens axis */
.scene .cm-roll-vf { left: 8px; top: 37px; width: 148px; height: 116px; }
.scene .cm-roll-world { left: -78px; top: -94px; width: 300px; height: 300px; transform: rotate(calc(var(--s) * -16deg)); }
.scene .cm-level { position: absolute; inset: 0; z-index: 2; }
.scene .cm-level::before, .scene .cm-level::after { content: ""; position: absolute; top: calc(50% - 1px); width: 14px; height: 2px; background: var(--ink); }
.scene .cm-level::before { left: 0; }
.scene .cm-level::after { right: 0; }
.scene .cm-roll-ring { left: 164px; top: 53px; width: 84px; height: 84px; }
.scene .cm-roll-ring::before { content: ""; position: absolute; top: -6px; left: calc(50% - 1px); width: 2px; height: 10px; background: var(--ink); }
.scene .cm-roll-rig { left: 206px; top: 95px; transform: rotate(calc(var(--s) * 16deg)); }
/* 04 truck: the marker slides along a rail; far / mid / near layers slide opposite at different rates */
.scene .cm-truck-vf { left: 20px; top: 6px; width: 220px; height: 94px; }
.scene .cm-truck-vf .cm-flat { top: 68px; }
.scene .cm-t-far { --w: 420px; --amp: 12px; }
.scene .cm-t-mid { --w: 420px; --amp: 44px; }
.scene .cm-t-near { --w: 520px; --amp: 104px; }
.scene .cm-truck-vf .cm-layer { top: 0; left: 50%; width: var(--w); height: 90px; margin-left: calc(var(--w) / -2); transform: translateX(calc(var(--s) * var(--amp) * -1)); }
.scene .cm-truck-rail { left: 28px; top: 144px; }
.scene .cm-truck-dot { left: 125px; top: 112px; }
.scene .cm-truck-rig { left: 130px; top: 152px; transform: translateX(calc(var(--s) * 72px)); }
/* 05 pedestal: the marker rides a graduated column with its lens level; layers slide vertically at different rates */
.scene .cm-ped-col { left: 0; top: 0; }
.scene .cm-ped-vf { left: 104px; top: 37px; width: 148px; height: 116px; }
.scene .cm-ped-vf .cm-flat { top: 70px; }
.scene .cm-p-far { --h: 112px; --amp: 0px; }
.scene .cm-p-mid { --h: 164px; --amp: 26px; }
.scene .cm-p-near { --h: 212px; --amp: 50px; }
.scene .cm-ped-vf .cm-layer { left: 0; width: 144px; top: 50%; height: var(--h); margin-top: calc(var(--h) / -2); transform: translateY(calc(var(--s) * var(--amp))); }
.scene .cm-ped-rig { left: 46px; top: 95px; transform: translateY(calc(var(--s) * -42px)); }
/* 06 dolly: the marker drives toward the subject; layers scale about the vanishing point by 1 / distance, so near grows fastest */
.scene .cm-dolly-vf { left: 20px; top: 6px; width: 220px; height: 94px; }
.scene .cm-dolly-vf .cm-fixed, .scene .cm-dolly-vf .cm-layer { left: 0; top: 0; width: 216px; height: 90px; }
.scene .cm-dolly-vf .cm-layer { transform-origin: 108px 48px; transform: scale(calc(var(--d) / (var(--d) - 27.5 - 27.5 * var(--s)))); }
.scene .cm-d-far { --d: 500; }
.scene .cm-d-mid { --d: 120; }
.scene .cm-d-near { --d: 80; }
.scene .cm-dolly-rail { left: 28px; top: 142px; }
.scene .cm-dolly-dot { left: 208px; top: 145px; width: 12px; height: 12px; }
.scene .cm-dolly-rig { left: 100px; top: 150px; transform: translateX(calc(var(--s) * 50px)); }
/* 07 zoom: the camera stays put; the field of view tightens (left) and the whole picture scales flat (right) */
.scene .cm-zoom-l { left: 8px; top: 24px; width: 94px; height: 70px; border-color: var(--guide); }
.scene .cm-zw { left: 0; top: 0; width: 128px; height: 94px; }
.scene .cm-zw-s { transform: scale(.703); transform-origin: 0 0; }
.scene .cm-zoom-r .cm-zw { transform: scale(calc(1.96 + .96 * var(--s))); }
.scene .cm-fovbox { inset: calc(50% * (1 - 1 / (1.96 + .96 * var(--s)))); }
.scene .cm-zoom-arrow { left: 105px; top: 52px; }
.scene .cm-arrow { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.scene .cm-zoom-r { left: 124px; top: 10px; width: 132px; height: 98px; }
.scene .cm-mm { left: 8px; top: 100px; width: 94px; text-align: center; color: var(--fg); font: 700 16px/20px ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; counter-reset: mm var(--mm); }
.scene .cm-mm::after { content: counter(mm) "mm"; }
.scene .cm-ruler { left: 30px; top: 128px; }
.scene .cm-ptr { left: 35px; top: 133px; width: 0; height: 0; border: solid transparent; border-width: 7px 5px 0; border-top-color: var(--accent); transform: translateX(calc((var(--s) + 1) * 90px)); }
/* 08 orbit: the subject stays fixed; the marker circles a ring and the cube's face and backdrop turn with it */
.scene .cm-orb-ring { left: 20px; top: 53px; width: 84px; height: 84px; }
.scene .cm-orb-sub { left: 52px; top: 85px; width: 20px; height: 20px; border: 4px solid; border-color: var(--subject) var(--blue-2) var(--gray-5) var(--gray-3); background: var(--bg); }
.scene .cm-orb-letters { inset: 0; }
.scene .cm-orb-letters b { position: absolute; width: 12px; height: 12px; color: var(--gray-6); font: 700 13px/14px ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; text-align: center; }
.scene .cm-orb-letters b:nth-child(1) { left: 56px; top: 67px; }
.scene .cm-orb-letters b:nth-child(2) { left: 78px; top: 89px; }
.scene .cm-orb-letters b:nth-child(3) { left: 56px; top: 111px; }
.scene .cm-orb-letters b:nth-child(4) { left: 34px; top: 89px; }
.scene .cm-orb-arm { left: 62px; top: 95px; transform: rotate(calc(var(--t) * 360deg)); }
.scene .cm-orb-cam { position: absolute; left: 0; top: -42px; width: 0; height: 0; }
.scene .cm-orb-vf { left: 124px; top: 41px; width: 128px; height: 108px; }
.scene .cm-orb-vf .cm-flat { top: 76px; }
.scene .cm-pano { left: 0; top: 0; transform: translateX(calc(var(--t) * -280px)); }
.scene .cm-shadow { position: absolute; left: 36px; top: 72px; width: 52px; height: 8px; border-radius: 50%; background: var(--ink); opacity: .2; }
.scene .cm-orb-wrap { position: absolute; left: 40px; top: 30px; width: 44px; height: 44px; perspective: 320px; }
.scene .cm-cube { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(-16deg) rotateY(calc(var(--t) * 360deg)); }
.scene .cm-face { position: absolute; inset: 0; display: grid; place-items: center; border: 2px solid var(--ink); font: 700 18px/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-style: normal; backface-visibility: hidden; }
.scene .cm-fn { transform: translateZ(22px); background: var(--subject); color: var(--on-subject); }
.scene .cm-fe { transform: rotateY(-90deg) translateZ(22px); background: var(--blue-2); color: var(--fg); }
.scene .cm-fs { transform: rotateY(180deg) translateZ(22px); background: var(--gray-5); color: var(--bg); }
.scene .cm-fw { transform: rotateY(90deg) translateZ(22px); background: var(--gray-3); color: var(--fg); }
.scene .cm-ft { transform: rotateX(90deg) translateZ(22px); background: var(--bg); }
@media (min-width: 600px) {
  .search { width: 235px; }
  .catalog-grid, .demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-section { grid-template-columns: 1fr 2fr; }
}
@media (min-width: 900px) {
  .container, .site-header { padding-inline: 48px; }
  .catalog-intro { padding: 40px 0 32px; }
  .card-title h3 { font-size: 28px; }
  .card-preview { height: 220px; }
  .card-preview svg { width: 360px; height: 190px; }
  .site-footer { padding-inline: 48px; }
  .experiment-heading { padding: 16px 0 28px; }
}
@media (min-width: 1200px) {
  .catalog-grid { gap: 32px; }
  .demo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .animated { animation: none !important; }
  .preview-ball { transform: translateX(150px); }
  .scene *, .scene *::before, .scene *::after { animation: none !important; }
  .scene .ball { left: calc(100% - 46px); }
  .scene .arc-ball, .scene .arc-ghost { left: calc(50% - 10px); }
  .scene .arc-ball { transform: translateY(-110px); }
  .scene .ft-body { left: calc(100% - 76px); }
  .scene .seg { transform: rotate(8deg); }
  .scene .mc-a { opacity: 0; }
  .scene .mc-b { opacity: 1; }
  .scene .mc-bg { background: var(--gray-2); }
  /* camera scenes: a still mid-move pose each */
  .scene .cm-pan, .scene .cm-tilt, .scene .cm-pedestal { --s: .5; }
  .scene .cm-roll { --s: .6; }
  .scene .cm-truck { --s: .4; }
  .scene .cm-dolly { --s: .3; }
  .scene .cm-zoom { --s: .3; --mm: 54; }
  .scene .cm-orbit { --t: .1; }
}

/* Category library (landing summaries, grouped demo pages, source lines). Generic classes shared by every category page. */
.filters { flex-wrap: wrap; }
.card-desc { margin: 12px 0 0; font-size: 15px; line-height: 1.6; color: var(--gray-6); word-break: keep-all; }
.card-outline { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; line-height: 1.6; color: var(--fg); }
.demo-group { grid-column: 1 / -1; border-top: 1px solid var(--gray-3); padding: 20px 0 0; margin-top: 8px; }
.demo-group:first-child { margin-top: 0; }
.demo-group h2 { font-size: 20px; font-weight: 600; letter-spacing: -.03em; line-height: 1.4; }
.demo-group h2 .count { font-size: 13px; font-weight: 400; color: var(--gray-6); margin-left: 8px; letter-spacing: 0; }
.demo-group p { margin: 4px 0 0; font-size: 15px; color: var(--gray-6); word-break: keep-all; }
.demo-index-group { flex-basis: 100%; padding-top: 8px; font-size: 13px; color: var(--fg); }
.demo-credit { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; margin: 8px 0 0; font-size: 13px; line-height: 1.6; color: var(--gray-6); }
.demo-credit a { display: inline-flex; align-items: center; min-height: 44px; color: var(--blue-3); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.experiment-pagination a[rel="next"] { margin-left: auto; text-align: right; justify-content: flex-end; }
