/* ═════════ B. Decoupling lab (#decoupling) ═════════
   Warm = RGB / semantic context, cool = depth / physical state, lavender = action. Calm finish: small token radii
   (no pills on rectangles), flat colours (no multi-hue gradients), frosted glass only on overlays over media.
   Every state change is opacity / colour / transform only; text slots that change are stacked in one grid
   cell (.lab-stack) so the box is always as large as its longest state and nothing reflows. */

#decoupling { --lab-gut: 76px; }
@media (min-width: 1140px) { #decoupling { --lab-gut: 92px; } }
#decoupling .lab-hw { color: var(--warm-ink); }
#decoupling .lab-hc { color: var(--cool-ink); }

/* ── stacked text slots: all states share one grid cell, only the active one is visible ── */
#decoupling .lab-stack { display: inline-grid; }
#decoupling .lab-stack > * {
  grid-area: 1 / 1;
  transition: opacity .32s ease, transform .5s var(--ease), visibility 0s;
}
#decoupling .lab-stack > :not(.is-on) {
  opacity: 0; transform: translateY(6px); visibility: hidden; pointer-events: none;
  transition: opacity .2s ease, transform .3s var(--ease), visibility 0s .3s;
}

/* ───────── lab card ───────── */
#decoupling .lab-fig { margin: 0; }
#decoupling .lab-card {
  position: relative; padding: clamp(18px, 2.3vw, 30px) clamp(16px, 2.3vw, 30px) clamp(18px, 2.2vw, 28px);
  box-shadow: var(--shadow-1); overflow: hidden;
}
/* card head: title left, demo button right (wraps under the title on narrow screens), on the stage's width */
#decoupling .lab-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px;
  max-width: 900px; margin: 0 auto clamp(16px, 2vw, 24px);
}
/* one size for both sub-section headings (lab card + part 2) */
#decoupling .lab-title, #decoupling .lab-h3 { font-size: clamp(20px, 1.85vw, 26px); line-height: 1.22; font-weight: 650; letter-spacing: -0.018em; }
#decoupling .lab-linkbtn {
  position: relative; flex: none; border: 0; background: none; padding: 2px 4px; margin-right: -4px; cursor: pointer;
  font-size: 14px; line-height: 1.5; font-weight: 600; color: var(--accent-ink); border-radius: var(--r-xs);
}
#decoupling .lab-linkbtn::before { content: ""; position: absolute; inset: -10px -6px; } /* 44px touch target, no layout */
#decoupling .lab-linkbtn .lab-stack { justify-items: end; }
#decoupling .lab-linkbtn .lab-stack > * {
  white-space: nowrap; text-decoration: underline; text-decoration-color: rgba(95, 82, 166, .3); text-underline-offset: 3px;
}
#decoupling .lab-linkbtn:hover .lab-stack > * { text-decoration-color: currentColor; }
#decoupling .lab-live-dot { display: inline-block; vertical-align: 1px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; box-shadow: 0 0 0 0 rgba(150, 138, 201, .5); }
@media (prefers-reduced-motion: no-preference) {
  #decoupling .lab-linkbtn .is-on .lab-live-dot { animation: lab-breathe 1.4s ease-in-out infinite; }
}
@keyframes lab-breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(150, 138, 201, .55); } 60% { box-shadow: 0 0 0 6px rgba(150, 138, 201, 0); } }

/* ───────── stage: RGB | prism | depth ───────── */
#decoupling .lab-stage, #decoupling .lab-controls { max-width: 900px; margin-left: auto; margin-right: auto; }
#decoupling .lab-stage {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--lab-gut) minmax(0, 1fr);
  grid-template-areas: "top-rgb . top-d" "rgb gut d"; row-gap: 10px;
}
#decoupling .lab-top--rgb { grid-area: top-rgb; }
#decoupling .lab-top--depth { grid-area: top-d; }
#decoupling .lab-frame--rgb { grid-area: rgb; }
#decoupling .lab-frame--depth { grid-area: d; }
#decoupling .lab-gutter { grid-area: gut; }

#decoupling .lab-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; height: 28px; }
#decoupling .lab-name { display: inline-flex; align-items: center; min-width: 0; font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; }
#decoupling .lab-name b { font-weight: 650; color: var(--ink); }
#decoupling .lab-name i { flex: none; width: 9px; height: 9px; border-radius: 3px; margin-right: 8px; }
#decoupling .lab-top--rgb .lab-name i { background: var(--warm); }
#decoupling .lab-top--depth .lab-name i { background: var(--cool); }
#decoupling .lab-name-sub { overflow: hidden; text-overflow: ellipsis; }

/* status pills */
#decoupling .lab-status { flex: none; justify-items: end; }
#decoupling .lab-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 9px;
  border-radius: var(--r-xs); border: 1px solid transparent; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; line-height: 1;
}
#decoupling .lab-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
#decoupling .lab-pill svg { width: 13px; height: 13px; flex: none; }
#decoupling .lab-pill--same { background: var(--paper); color: var(--ink-2); border-color: var(--line-2); }
#decoupling .lab-pill--warm { background: var(--warm); color: #3d2500; border-color: var(--warm); }
#decoupling .lab-pill--keep { background: var(--cool-soft); color: var(--cool-ink); border-color: rgba(53, 167, 255, .45); padding-left: 8px; }
#decoupling .lab-pill--cool { background: var(--cool-ink); color: #fff; border-color: var(--cool-ink); }
#decoupling .lab-status.is-ping .lab-pill.is-on { animation: lab-ping .9s var(--ease); }
#decoupling .lab-status.is-pop .lab-pill.is-on i { animation: lab-dot .8s var(--ease); }
@keyframes lab-ping { 0% { box-shadow: 0 0 0 0 rgba(53, 167, 255, .5); } 100% { box-shadow: 0 0 0 8px rgba(53, 167, 255, 0); } }
@keyframes lab-dot { 0% { transform: scale(2.2); } 100% { transform: none; } }

/* frames: the simulator's 640×480 head camera, both views the same size */
#decoupling .lab-frame {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-md); overflow: hidden;
  background: var(--night-2); isolation: isolate; min-width: 0;
}
#decoupling .lab-frame::after { /* state ring, warm for RGB, cool for depth */
  content: ""; position: absolute; inset: 0; z-index: 5; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(20, 16, 40, .08); transition: box-shadow .45s var(--ease);
}
#decoupling .lab-frame--rgb.is-changed::after { box-shadow: inset 0 0 0 2px var(--warm), inset 0 0 22px rgba(255, 149, 0, .28); }
#decoupling .lab-frame--depth.is-changed::after { box-shadow: inset 0 0 0 2px var(--cool), inset 0 0 22px rgba(53, 167, 255, .3); }
#decoupling .lab-frame::before { /* brief brightening when the prism's pulse lands on this view */
  content: ""; position: absolute; inset: 0; z-index: 5; border-radius: inherit; pointer-events: none; opacity: 0;
}
#decoupling .lab-frame--rgb::before { box-shadow: inset 0 0 0 3px var(--warm), inset 0 0 34px rgba(255, 149, 0, .5); }
#decoupling .lab-frame--depth::before { box-shadow: inset 0 0 0 3px var(--cool), inset 0 0 34px rgba(53, 167, 255, .5); }
#decoupling .lab-frame.is-hit::before { animation: lab-flash .8s ease-out .36s both; }
@keyframes lab-flash { 0% { opacity: 0; } 22% { opacity: 1; } 100% { opacity: 0; } }

#decoupling .lab-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* the new look fades in over the old one at the same physical state; it leaves instantly (never ghosts a frame) */
#decoupling .lab-img--fade { z-index: 1; opacity: 0; transition: none; }
#decoupling .lab-img--fade:not([src]) { visibility: hidden; }
#decoupling .lab-img--fade.is-on { opacity: 1; transition: opacity .24s ease; }

/* depth colour key: near (purple) to far (yellow), the simulator's viridis map */
#decoupling .lab-dkey {
  position: absolute; right: 10px; bottom: 10px; z-index: 6; display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: var(--r-xs); font: 600 11px/1 var(--font); color: #fff; white-space: nowrap;
  background: rgba(10, 10, 20, .5); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
#decoupling .lab-dkey i { width: 48px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #440154, #3b528b 25%, #21918c 50%, #5ec962 75%, #fde725); box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }


/* prism link: the world state enters from above, splits warm (left, RGB) and cool (right, depth) */
#decoupling .lab-gutter { position: relative; min-height: 0; }
#decoupling .lab-gut-lbl {
  position: absolute; left: 0; right: 0; top: 18%; text-align: center; white-space: nowrap;
  font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-2);
}
#decoupling .lab-beam { position: absolute; pointer-events: none; }
#decoupling .lab-beam--in {
  left: 50%; width: 2px; margin-left: -1px; top: calc(18% + 24px); bottom: calc(50% + 21px); border-radius: 2px;
  background: linear-gradient(to bottom, rgba(150, 138, 201, .08), rgba(150, 138, 201, .7));
}
#decoupling .lab-beam--w, #decoupling .lab-beam--c { top: 50%; height: 3px; margin-top: -1.5px; border-radius: 3px; }
#decoupling .lab-beam--w { left: 0; right: calc(50% + 18px); background: linear-gradient(to left, rgba(255, 149, 0, .5), var(--warm)); box-shadow: 0 0 8px rgba(255, 149, 0, .45); }
#decoupling .lab-beam--c { right: 0; left: calc(50% + 18px); background: linear-gradient(to right, rgba(53, 167, 255, .5), var(--cool)); box-shadow: 0 0 8px rgba(53, 167, 255, .45); }
#decoupling .lab-prism {
  position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px;
  display: grid; place-items: center; border-radius: 50%; background: var(--paper); color: var(--accent-ink);
  border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(20, 16, 40, .08), 0 0 0 4px rgba(255, 255, 255, .9);
}
#decoupling .lab-prism svg { width: 20px; height: 20px; margin-top: -1px; }
#decoupling .lab-pulse { position: absolute; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; opacity: 0; }
#decoupling .lab-beam--w .lab-pulse { right: -5px; background: #fff1de; box-shadow: 0 0 0 2px var(--warm), 0 0 12px 3px rgba(255, 149, 0, .85); --dx: calc(-1 * (var(--lab-gut) / 2 - 18px)); }
#decoupling .lab-beam--c .lab-pulse { left: -5px; background: #e9f5ff; box-shadow: 0 0 0 2px var(--cool), 0 0 12px 3px rgba(53, 167, 255, .85); --dx: calc(var(--lab-gut) / 2 - 18px); }
#decoupling .lab-pulse.is-go { animation: lab-travel .6s var(--ease-io) both; }
@keyframes lab-travel {
  0% { opacity: 0; transform: translateX(0) scale(.5); }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(var(--dx)) scale(1); }
}

/* ───────── summary line (fixed height: tallest state) ───────── */
#decoupling .lab-summary {
  display: grid; justify-items: center; align-items: center; margin: clamp(16px, 1.8vw, 22px) auto 0; max-width: 900px;
  text-align: center; font-size: clamp(16.5px, 1.25vw, 18.5px); line-height: 1.5; font-weight: 500; color: var(--ink); text-wrap: balance;
}
#decoupling .lab-summary em { font-style: normal; font-weight: 600; }
#decoupling .lab-nw { white-space: nowrap; }
#decoupling .lab-sent { display: inline-block; } /* break between sentences, not after "So" */
#decoupling .lab-kw { color: var(--warm-ink); }
#decoupling .lab-kc { color: var(--cool-ink); }
#decoupling .lab-ka { color: var(--accent-ink); }

/* ───────── controls ───────── */
/* the five looks keep their natural width; the timeline takes the rest */
#decoupling .lab-controls {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px;
  margin-top: clamp(16px, 1.8vw, 22px);
}
#decoupling .lab-group { min-width: 0; padding: 13px 16px 15px; border-radius: var(--r-lg); background: var(--mist); border: 1px solid var(--line); }
#decoupling .lab-group--look { grid-column: 1; }
#decoupling .lab-group--act { grid-column: 2; }
#decoupling .lab-group-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 22px; margin-bottom: 11px; }
#decoupling .lab-group-name { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; white-space: nowrap; }
#decoupling .lab-group-name i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
#decoupling .lab-group--look .lab-group-name i { background: var(--warm); }
#decoupling .lab-group--act .lab-group-name i { background: var(--accent); }

/* appearance: one segmented choice of re-rendered looks */
#decoupling .lab-seg {
  display: flex; gap: 2px; padding: 3px; border-radius: var(--r-md); background: rgba(29, 29, 31, .06);
}
#decoupling .lab-opt {
  position: relative; flex: 1 1 auto; height: 34px; padding: 0 9px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2); cursor: pointer; white-space: nowrap;
  font-size: 13.5px; font-weight: 550; line-height: 1;
  transition: background-color .2s, color .2s, box-shadow .2s;
}
#decoupling .lab-opt[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 16, 40, .1), 0 1px 6px rgba(20, 16, 40, .06); }
#decoupling .lab-opt[aria-pressed="true"]:not([data-look="clean"]) { color: var(--warm-ink); box-shadow: inset 0 0 0 1px rgba(255, 149, 0, .55), 0 1px 2px rgba(20, 16, 40, .1); }
#decoupling .lab-opt:active { background: rgba(29, 29, 31, .08); }
#decoupling .lab-opt[aria-pressed="true"]:active { background: var(--paper); }
#decoupling .lab-opt:focus-visible { z-index: 1; }
@media (hover: hover) and (pointer: fine) {
  #decoupling .lab-opt[aria-pressed="false"]:hover { background: rgba(29, 29, 31, .05); color: var(--ink); }
}

/* timeline */
#decoupling .lab-tl { display: flex; align-items: flex-start; gap: 16px; }
#decoupling .lab-play {
  position: relative; flex: none; display: grid; place-items: center; width: 40px; height: 40px; margin-top: -1px;
  border: 0; border-radius: 50%; background: var(--accent-ink); color: #fff; cursor: pointer;
  box-shadow: 0 3px 10px rgba(95, 82, 166, .26);
  transition: background-color .2s, box-shadow .25s, transform .2s var(--ease);
}
#decoupling .lab-play svg { grid-area: 1 / 1; width: 15px; height: 15px; transition: opacity .2s, transform .35s var(--ease); }
#decoupling .lab-play .i-play { transform: translateX(1px); }
#decoupling .lab-play:not([data-icon="play"]) .i-play,
#decoupling .lab-play:not([data-icon="pause"]) .i-pause,
#decoupling .lab-play:not([data-icon="replay"]) .i-replay { opacity: 0; transform: scale(.5) rotate(-30deg); }
#decoupling .lab-play:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) {
  #decoupling .lab-play:hover { background: #50458e; box-shadow: 0 0 0 5px rgba(150, 138, 201, .2), 0 5px 14px rgba(95, 82, 166, .3); }
}

#decoupling .lab-slider {
  position: relative; flex: 1; min-width: 0; height: 48px; cursor: pointer; touch-action: pan-y;
  -webkit-user-select: none; user-select: none; border-radius: var(--r-sm);
}
#decoupling .lab-slider:focus-visible { outline: none; }
/* the track is split into the episode's chapters (reach, grasp, lift), each filling up to the thumb */
#decoupling .lab-phase {
  position: absolute; top: 16px; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line-2);
  left: calc(var(--a) * 100% + 1.5px); width: calc((var(--b) - var(--a)) * 100% - 3px);
}
#decoupling .lab-phase:first-child { left: 0; width: calc(var(--b) * 100% - 1.5px); }
#decoupling .lab-phase:nth-child(3) { width: calc((var(--b) - var(--a)) * 100% - 1.5px); }
#decoupling .lab-phase-fill { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(var(--f, 0)); background: var(--accent); }
#decoupling .lab-carrier { position: absolute; left: 0; right: 0; top: 19px; height: 0; pointer-events: none; transform: translateX(calc((var(--p) - 1) * 100%)); }
#decoupling .lab-thumb {
  position: absolute; right: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--accent-ink);
  box-shadow: 0 1px 2px rgba(20, 16, 40, .2), 0 3px 10px rgba(95, 82, 166, .22);
  transition: box-shadow .25s, transform .25s var(--ease);
}
#decoupling .lab-slider:focus-visible .lab-thumb { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--focus), 0 3px 10px rgba(95, 82, 166, .22); }
#decoupling .lab-slider.is-drag .lab-thumb { transform: scale(1.12); box-shadow: 0 0 0 7px rgba(150, 138, 201, .22), 0 3px 10px rgba(95, 82, 166, .28); }
@media (hover: hover) and (pointer: fine) {
  #decoupling .lab-slider:hover .lab-thumb { box-shadow: 0 0 0 6px rgba(150, 138, 201, .2), 0 3px 10px rgba(95, 82, 166, .28); }
}
#decoupling .lab-phaselbl {
  position: absolute; top: 31px; left: calc(var(--a) * 100% + 1.5px);
  font-size: 12px; line-height: 14px; color: var(--ink-2); pointer-events: none; transition: color .25s;
}
#decoupling .lab-phaselbl.is-on { color: var(--accent-ink); }

/* ───────── part 2: the film's grasp, split into two kinds of state ─────────
   ≥ 1140px: [video] [prism fan] [two stacked cards]; tablet: video, fan below, cards side by side; phone: stacked. */
#decoupling .lab-part2 { margin-top: clamp(64px, 7.5vw, 104px); }
#decoupling .lab-p2head { max-width: 860px; margin: 0 0 clamp(24px, 3vw, 36px); text-align: left; }
#decoupling .lab-p2lead { margin-top: 10px; font-size: clamp(16.5px, 1.25vw, 18.5px); line-height: 1.6; color: var(--ink-2); text-wrap: pretty; }

#decoupling .lab-split {
  --lab-tile: 52px; --lab-strip: calc(4 * var(--lab-tile) + 12px); --lab-mpad: 18px; --lab-cgap: 16px;
  display: grid; grid-template-columns: minmax(0, 1fr) 84px minmax(0, 1.1fr);
  grid-template-areas: "vid fan minis" "cap . act"; align-items: center; row-gap: var(--lab-cgap);
}
#decoupling .lab-vidwrap { grid-area: vid; margin: 0; min-width: 0; }
#decoupling .lab-vid {
  position: relative; aspect-ratio: 1440 / 742; border-radius: var(--r-xl); overflow: hidden;
  background: var(--night); box-shadow: var(--shadow-2);
}
#decoupling .lab-vid video { width: 100%; height: 100%; object-fit: cover; }
#decoupling .lab-vid::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); pointer-events: none; }
#decoupling .lab-vbtn {
  position: absolute; right: 12px; bottom: 12px; z-index: 2; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18); cursor: pointer;
  background: rgba(10, 10, 20, .42); color: #fff; backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  transition: background-color .2s, transform .2s var(--ease);
}
#decoupling .lab-vbtn::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; }
#decoupling .lab-vbtn svg { grid-area: 1 / 1; width: 13px; height: 13px; transition: opacity .2s; }
#decoupling .lab-vbtn[data-state="playing"] .i-play, #decoupling .lab-vbtn[data-state="paused"] .i-pause { opacity: 0; }
#decoupling .lab-vbtn:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { #decoupling .lab-vbtn:hover { background: rgba(10, 10, 20, .66); } }

/* the fan: one beam in, warm and cool beams out to the two cards */
#decoupling .lab-fan { grid-area: fan; position: relative; align-self: stretch; min-height: 60px; }
#decoupling .lab-fan > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#decoupling .lab-fan path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; transition: opacity .35s ease; }
#decoupling .lab-fan-in { stroke: #b9b7c6; stroke-width: 1.5; }
#decoupling .lab-fan-w, #decoupling .lab-fan-c { stroke-width: 2.2; }
#decoupling .lab-fan-v { display: none; }
#decoupling .lab-prism--fan { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
#decoupling .lab-prism--fan svg { width: 22px; height: 22px; }
@media (hover: hover) and (pointer: fine) {
  #decoupling .lab-split:has(.lab-mini--warm:hover) .lab-fan-c,
  #decoupling .lab-split:has(.lab-mini--cool:hover) .lab-fan-w { opacity: .22; }
}

#decoupling .lab-minis { grid-area: minis; align-self: stretch; display: grid; grid-auto-rows: 1fr; gap: 14px; min-width: 0; }
#decoupling .lab-mini {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 18px;
  padding: 16px var(--lab-mpad) 16px 20px; border-radius: var(--r-lg);
  background: var(--paper); border: 1px solid var(--line); overflow: hidden;
  transition: box-shadow .35s var(--ease), transform .35s var(--ease), border-color .35s;
}
#decoupling .lab-mini::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; }
#decoupling .lab-mini--warm::before { background: var(--warm); }
#decoupling .lab-mini--cool::before { background: var(--cool); }
#decoupling .lab-mini-name { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; white-space: nowrap; }
#decoupling .lab-mini--warm .lab-mini-name { color: var(--warm-ink); }
#decoupling .lab-mini--cool .lab-mini-name { color: var(--cool-ink); }
#decoupling .lab-mini-tag { display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: var(--r-xs); font-size: 11px; font-weight: 650; letter-spacing: .01em; }
#decoupling .lab-mini--warm .lab-mini-tag { background: var(--warm-soft); color: var(--warm-ink); }
#decoupling .lab-mini--cool .lab-mini-tag { background: var(--cool-soft); color: var(--cool-ink); }
#decoupling .lab-mini-title { margin-top: 4px; font-size: 16px; line-height: 1.3; font-weight: 650; letter-spacing: -0.012em; color: var(--ink); text-wrap: balance; }
#decoupling .lab-mini-desc { margin-top: 4px; font-size: 14px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }

/* tiny sparse / dense frame strips */
#decoupling .lab-strip { position: relative; display: grid; grid-template-columns: repeat(4, var(--lab-tile)); gap: 4px; padding-bottom: 17px; }
#decoupling .lab-tile {
  position: relative; display: block; aspect-ratio: 4 / 3; border-radius: var(--r-xs); overflow: hidden; background: var(--night-2);
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), opacity .45s;
}
#decoupling .lab-tile img { width: 100%; height: 100%; object-fit: cover; }
#decoupling .lab-tile.is-gap { background: transparent; border: 1.5px dashed var(--line-2); }
#decoupling .lab-tile.is-gap::after { content: ""; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; border-radius: 50%; background: var(--line-2); }
#decoupling .lab-tile.is-key { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--warm); }
#decoupling .lab-strip--dense .lab-tile { box-shadow: 0 0 0 1px rgba(53, 167, 255, .35); }
#decoupling .lab-strip-lbl { position: absolute; left: 0; bottom: 0; font-size: 11.5px; line-height: 13px; color: var(--ink-2); white-space: nowrap; }
#decoupling .lab-strip-lbl--end { left: auto; right: 0; }
#decoupling .lab-mini--warm .lab-strip-lbl--end { color: var(--warm-ink); font-weight: 600; }
#decoupling .lab-mini--cool .lab-strip-lbl--end { color: var(--cool-ink); font-weight: 600; }
@media (hover: hover) and (pointer: fine) {
  #decoupling .lab-mini:hover { box-shadow: var(--shadow-1); transform: translateY(-2px); }
  #decoupling .lab-mini--warm:hover { border-color: rgba(255, 149, 0, .5); }
  #decoupling .lab-mini--cool:hover { border-color: rgba(53, 167, 255, .5); }
  #decoupling .lab-mini--warm:hover .lab-tile.is-key { transform: scale(1.12); }
  #decoupling .lab-mini--cool:hover .lab-tile { animation: lab-wave .9s var(--ease) both; }
  #decoupling .lab-mini--cool:hover .lab-tile:nth-child(2) { animation-delay: .08s; }
  #decoupling .lab-mini--cool:hover .lab-tile:nth-child(3) { animation-delay: .16s; }
  #decoupling .lab-mini--cool:hover .lab-tile:nth-child(4) { animation-delay: .24s; }
}
@keyframes lab-wave { 0%, 100% { transform: none; } 40% { transform: translateY(-3px); box-shadow: 0 0 0 1.5px var(--cool), 0 4px 10px rgba(53, 167, 255, .3); } }

/* third role: executable action, hung off the depth card by a short lavender connector */
#decoupling .lab-mini--act { grid-area: act; align-self: stretch; overflow: visible; }
#decoupling .lab-mini--act::before { background: var(--accent); }
#decoupling .lab-mini--act .lab-mini-name { color: var(--accent-ink); }
#decoupling .lab-mini--act .lab-mini-tag { background: var(--accent-soft); color: var(--accent-ink); }
#decoupling .lab-act-link {
  position: absolute; top: calc(-1px - var(--lab-cgap)); height: calc(var(--lab-cgap) + 1px); width: 2px; border-radius: 2px; pointer-events: none;
  right: calc(var(--lab-mpad) + var(--lab-strip) / 2 - 1px);
  background: var(--accent);
}
#decoupling .lab-act-link::after { /* small arrival dot on the action card's edge */
  content: ""; position: absolute; left: 50%; bottom: -4px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--paper);
}
#decoupling .lab-strip--act { align-items: center; }
#decoupling .lab-chunk { grid-column: 1 / -1; width: 100%; height: auto; aspect-ratio: 220 / 30; overflow: visible; margin: 3.5px 0; }
#decoupling .lab-chunk path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; opacity: .7; }
#decoupling .lab-chunk circle { fill: var(--accent-ink); stroke: var(--paper); stroke-width: 2; transform-box: fill-box; transform-origin: center; }
#decoupling .lab-mini--act .lab-strip-lbl--end { color: var(--accent-ink); font-weight: 600; }
@media (hover: hover) and (pointer: fine) {
  #decoupling .lab-mini--act:hover { border-color: rgba(150, 138, 201, .6); }
  #decoupling .lab-mini--act:hover .lab-chunk circle { animation: lab-pop .7s var(--ease) both; }
  #decoupling .lab-mini--act:hover .lab-chunk circle:nth-of-type(2) { animation-delay: .06s; }
  #decoupling .lab-mini--act:hover .lab-chunk circle:nth-of-type(3) { animation-delay: .12s; }
  #decoupling .lab-mini--act:hover .lab-chunk circle:nth-of-type(4) { animation-delay: .18s; }
  #decoupling .lab-mini--act:hover .lab-chunk circle:nth-of-type(5) { animation-delay: .24s; }
  #decoupling .lab-mini--act:hover .lab-chunk circle:nth-of-type(6) { animation-delay: .3s; }
  /* actions never attend to RGB: hovering the action card dims the warm beam */
  #decoupling .lab-split:has(.lab-mini--act:hover) .lab-fan-w { opacity: .22; }
  #decoupling .lab-split:has(.lab-mini--act:hover) .lab-mini--warm { opacity: .6; }
}
@keyframes lab-pop { 0%, 100% { transform: none; } 45% { transform: scale(1.45); } }

/* ───────── responsive ───────── */
@media (max-width: 1139px) {
  #decoupling .lab-gut-lbl { left: 50%; right: auto; width: 52px; margin-left: -26px; white-space: normal; font-size: 11.5px; line-height: 15px; }
  #decoupling .lab-beam--in { top: calc(18% + 38px); }
  #decoupling .lab-split {
    --lab-tile: 50px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 16px; row-gap: 0;
    grid-template-areas: "vid vid" "cap cap" "fan fan" "w c" "act act";
  }
  #decoupling .lab-part2 { max-width: 900px; margin-left: auto; margin-right: auto; }
  #decoupling .lab-mini--act { margin-top: var(--lab-cgap); }
  #decoupling .lab-act-link { right: auto; left: calc(20px + var(--lab-strip) / 2 - 1px); }
  #decoupling .lab-vidwrap { width: 100%; }
  #decoupling .lab-fan { height: 72px; min-height: 0; align-self: auto; }
  #decoupling .lab-fan-h { display: none; }
  #decoupling .lab-fan-v { display: block; }
  #decoupling .lab-minis { display: contents; }
  #decoupling .lab-mini--warm { grid-area: w; align-self: stretch; }
  #decoupling .lab-mini--cool { grid-area: c; align-self: stretch; }
  #decoupling .lab-mini { grid-template-columns: minmax(0, 1fr); align-content: start; }
  #decoupling .lab-strip { justify-self: start; }
}
@media (max-width: 899px) {
  /* narrower: controls stack under the views */
  #decoupling .lab-controls { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #decoupling .lab-group--look, #decoupling .lab-group--act { grid-column: 1; }
}
@media (max-width: 1000px) {
  #decoupling { --lab-gut: 56px; }
}
@media (max-width: 680px) {
  #decoupling .lab-split { --lab-cgap: 12px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "vid" "cap" "w" "c" "act"; row-gap: 12px; }
  #decoupling .lab-fan { display: none; }
  #decoupling .lab-mini--act { margin-top: 0; }
  #decoupling .lab-vidwrap { margin-bottom: 6px; }
}
@media (max-width: 640px) {
  /* phones: keep both views side by side so every edit is seen against the other view */
  #decoupling .lab-card { padding-left: 12px; padding-right: 12px; }
  #decoupling .lab-stage {
    grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr);
    grid-template-areas: "nr . nd" "rgb gut d" "sr . sd"; row-gap: 8px;
  }
  #decoupling .lab-top { display: contents; }
  #decoupling .lab-top--rgb .lab-name { grid-area: nr; }
  #decoupling .lab-top--depth .lab-name { grid-area: nd; }
  #decoupling .lab-top--rgb .lab-status { grid-area: sr; }
  #decoupling .lab-top--depth .lab-status { grid-area: sd; }
  #decoupling .lab-name { font-size: 13.5px; }
  #decoupling .lab-name-sub { display: none; }
  #decoupling .lab-status { justify-self: center; justify-items: center; }
  #decoupling .lab-frame { border-radius: var(--r-sm); }
  #decoupling .lab-linkbtn { margin-left: -4px; margin-right: 0; }
  #decoupling .lab-linkbtn .lab-stack { justify-items: start; }
  #decoupling .lab-gut-lbl { display: none; }
  #decoupling .lab-beam--in { top: 18%; bottom: calc(50% + 12px); }
  #decoupling .lab-beam--w, #decoupling .lab-beam--c { height: 2px; margin-top: -1px; box-shadow: none; }
  #decoupling .lab-beam--w { right: calc(50% + 11px); }
  #decoupling .lab-beam--c { left: calc(50% + 11px); }
  #decoupling .lab-beam--w .lab-pulse, #decoupling .lab-beam--c .lab-pulse { display: none; }
  #decoupling .lab-prism { width: 24px; height: 24px; margin: -12px 0 0 -12px; box-shadow: 0 1px 4px rgba(20, 16, 40, .1); }
  #decoupling .lab-prism svg { width: 14px; height: 14px; }
  #decoupling .lab-summary { margin-top: 14px; font-size: 15px; }
  #decoupling .lab-group { padding: 12px 12px 13px; }
  /* five looks on two rows: Default · Lighting · Texture, then Lighting + texture · Random */
  #decoupling .lab-seg { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #decoupling .lab-opt { grid-column: span 2; padding: 0 6px; }
  #decoupling .lab-opt--wide { grid-column: span 4; }
  #decoupling .lab-split { --lab-tile: 52px; --lab-mpad: 16px; }
  #decoupling .lab-mini { padding: 15px var(--lab-mpad) 15px 18px; }
  #decoupling .lab-act-link { left: calc(18px + var(--lab-strip) / 2 - 1px); }
  #decoupling .lab-dkey { left: 5px; right: auto; bottom: 5px; height: 16px; padding: 0 5px; gap: 3px; font-size: 9px; border-radius: 4px; }
  #decoupling .lab-dkey i { width: 18px; height: 4px; }
}

/* the grasp's takeaway under the film clip: what an action changes, and what it leaves alone */
#decoupling .lab-vcap { grid-area: cap; align-self: start; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px 22px; margin: 0; font-size: 13px; }
#decoupling .lab-vcap-g { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#decoupling .lab-vcap-k { color: var(--ink-2); margin-right: 2px; }
#decoupling .lab-vchip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: var(--r-xs); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
#decoupling .lab-vchip--cool { background: var(--cool-ink); color: #fff; }
#decoupling .lab-vchip--warm { background: var(--warm-soft); color: var(--warm-ink); box-shadow: inset 0 0 0 1px rgba(245, 130, 0, .25); }
@media (max-width: 1139px) { #decoupling .lab-vcap { margin-top: 12px; } }

/* demo-only overlays: during the auto demo, an appearance edit stamps "Changed" on RGB and "Unchanged" on depth */
#decoupling .lab-ov {
  position: absolute; left: 50%; top: 50%; z-index: 3; display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 18px; border-radius: var(--r-md); font-size: clamp(15px, 1.5vw, 20px); font-weight: 650; letter-spacing: -0.01em;
  color: #fff; white-space: nowrap; pointer-events: none;
  background: rgba(12, 14, 22, .58); backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  opacity: 0; transform: translate(-50%, -50%) scale(.9); transition: opacity .35s ease, transform .5s var(--ease);
}
#decoupling .lab-ov--rgb { box-shadow: inset 0 0 0 1.5px rgba(255, 149, 0, .9); }
#decoupling .lab-ov--rgb i { width: 9px; height: 9px; border-radius: 50%; background: var(--warm); }
#decoupling .lab-ov--d { box-shadow: inset 0 0 0 1.5px rgba(53, 167, 255, .95); }
#decoupling .lab-ov--d svg { width: 18px; height: 18px; color: #7cc4ff; }
#decoupling.show-ov .lab-ov, #decoupling .show-ov .lab-ov { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#decoupling .lab-ov--d { transition-delay: .12s; }
