/**
 * Swipe View — Reels Viewer (SMASH-1851 / SMASH-1978 / SMASH-1979)
 *
 * Restyled 2026-09-08 to Aman's FINAL reference build (HEAD 0334f13), per the
 * decision log at local-notes/swipe-view-launch/aman-final-porting-decisions-2026-09-08.md.
 * Rule ids in comments below (1.1, IG-4, …) are that log's.
 *
 * ── Viewport-unit convention (team feedback 2026-08-24, UNCHANGED) ─────────
 * EVERY viewport-height value in this file is declared TWICE, `vh` first and
 * `dvh` second. `100vh` is the LARGE viewport — it deliberately excludes mobile
 * browsers' collapsible toolbars from its measurement, so on a phone the viewer
 * sized itself taller than the visible area and the bottom-right rail rendered
 * underneath the browser chrome (the reported clipping). `100dvh` tracks the
 * viewport as the toolbars come and go, which is what "full screen" has to mean
 * here.
 *
 * The two-declaration order is the whole mechanism, not styling: a browser that
 * doesn't parse `dvh` discards the second declaration and keeps the `vh` value,
 * and one that does parse it takes the later declaration per the cascade. Never
 * collapse a pair into just the dvh line, and never reverse the order. Rule 1.1
 * of the porting log is explicit that the reference's bare `100dvh` is NOT
 * ported: we keep this pair convention, and a test guards it.
 *
 * The JS side is coupled to this: goToIndex() translates the track by one
 * viewport height per slide and uses the SAME vh-then-dvh assignment pair (see
 * its comment). A unit mismatch between the two files desyncs the track from the
 * slides progressively — slide N lands N * (100vh - 100dvh) off.
 *
 * ── Capability-query convention (rule 1.2) ─────────────────────────────────
 * The desktop-vs-touch switch is INPUT CAPABILITY, never viewport width. The
 * reference expresses it as ten `max-width: 768px` branches; every one of them
 * is really "does this pointer hover" — chevrons and tooltips need a mouse, the
 * in-frame rail and the rail-mounted CTA are touch layouts. So:
 *
 *   BASE rules in this file are the TOUCH layout (full-bleed frame, no rail
 *   column, no chevrons, no tooltips, CTA in the rail).
 *   `@media (hover: hover) and (pointer: fine)` at the END of the file adds the
 *   DESKTOP layout (framed 9:16 stage, rail column beside it, chevrons,
 *   tooltips, CTA pill in the top row).
 *
 * ZERO width media queries ship from this file, and no `dvh` value appears
 * without its `vh` partner. tests/js/swipe-css-conventions.test.js fails the
 * build on either.
 *
 * ── @media placement is load-bearing, not tidiness ────────────────────────
 * Every @media block lives BELOW every top-level rule. The geometry suites read
 * the stylesheet as `stripCssComments(css).split('@media')[0]`, so a mid-file
 * @media block silently truncates their view of the file and every rule after it
 * reads as missing. (Recorded in the survey's harness-blind-spot table; it has
 * bitten three times.) Narrow-viewport overrides fold into the existing blocks.
 */

/* ── Body lock ───────────────────────────────────────────────────────────── */
.sbi-qs-scroll-locked {
	overflow: hidden !important;
	height: 100vh;
	height: 100dvh;
}

/* ── Overlay root ────────────────────────────────────────────────────────── *
 * Rule 1.13 — the BACKDROP. Base (touch) is opaque with no blur: a blurred
 * backdrop on a full-bleed viewer paints nothing but itself, and the filter
 * costs a compositor pass on the least capable hardware. The desktop block
 * below swaps in the reference's translucent-plus-blur treatment, where the host
 * page staying faintly visible is Aman's stated intent.
 *
 * Rule 1.15 — TYPE SCALE without the webfont. The reference loads Inter
 * Variable from rsms.me; a third-party font request from a WP plugin is a new
 * external dependency (and self-hosting is a new bundled asset), so neither
 * ships. `Inter, InterVariable` lead the stack so the design's own face is used
 * wherever the host site already serves it, and the system stack carries the
 * rest. `liga`/`calt` on, matching the reference. Deliberately does NOT inherit
 * the host theme's font — the viewer is a self-contained surface.
 */
.sbi-qs-overlay {
	position: fixed;
	inset: 0;
	background: #000;
	z-index: 999999;
	display: none;
	overflow: hidden;
	color: #fff;
	color-scheme: dark;
	font-family: Inter, InterVariable, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
	font-feature-settings: 'liga' 1, 'calt' 1;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
	/* Viewer root fades in over 180ms (rule 1.13). Fade-IN only: close() tears
	 * the DOM down synchronously so focus restoration, the scroll-lock release
	 * and the analytics flush all stay on one tick. A fade-OUT would have to
	 * defer teardown behind a timer, which is a new failure mode (an interrupted
	 * close leaving the body locked) for 180ms of polish on the way out. */
	opacity: 0;
	transition: opacity 180ms ease;

	/* ── Geometry tokens ────────────────────────────────────────────────────
	 * Base values are the TOUCH layout: full-bleed frame, square corners, no
	 * rail column reserved beside the stage. The desktop block at the end of
	 * this file overrides all four.
	 *
	 * --sbi-qs-frame-shift is HALF the horizontal space the rail column plus
	 * the stage gap occupy. Rule 1.1 centres the frame and the rail column
	 * TOGETHER, not the frame alone, so the frame's centre sits that far left of
	 * the window's centre. Holding it as one token is what keeps the frame, the
	 * session-level frame chrome, the rail column and the chevrons agreeing:
	 * five rules derive from it and none of them repeats the arithmetic. */
	--sbi-qs-stage-radius: 0px;
	--sbi-qs-rail-w: 0px;
	--sbi-qs-stage-gap: 0px;
	--sbi-qs-frame-shift: 0px;
	/* ── Stage-relative anchoring (unchanged mechanism, new formula) ─────────
	 * Half the PAINTED frame's width. This is what lets overlay-level chrome
	 * anchor to the FRAME's edges rather than the WINDOW's:
	 *
	 *     right: calc(50% - var(--sbi-qs-frame-shift) - var(--sbi-qs-stage-half))
	 *
	 * is the frame's left inset — and, because the frame+gap+rail trio is
	 * centred, it is also the rail column's RIGHT inset. That symmetry is why
	 * the rail column and the chevrons can anchor off the same one expression.
	 *
	 * On touch the frame is full-bleed, so half of it is exactly 50vw and the
	 * min()/ratio clamp has nothing to clamp. The desktop block restores the
	 * continuous `min()` form — rule 1.2's clamp-not-breakpoint requirement, and
	 * the reason a real iPhone SE (320x568, a quarter pixel above 9/16) can't
	 * fall off a threshold. The 9/16 ratio there MUST stay the same ratio
	 * .sbi-qs-media sizes with; a test asserts every occurrence agrees. */
	--sbi-qs-stage-half: 50vw;
	/* Expanded-caption cap (rule IG-5). See .sbi-qs-caption-text. */
	--sbi-qs-caption-cap: calc(18.2px * 12);
}
.sbi-qs-overlay.sbi-qs-active {
	display: block;
}
.sbi-qs-overlay.sbi-qs-visible {
	opacity: 1;
}
.sbi-qs-overlay:focus {
	outline: 0;
}

/* ── Close — window-anchored, TOP-LEFT (rule 1.4) ────────────────────────── *
 * MOVED from top-right (2026-09-08). Two things changed and both are the
 * design's: the corner, and the rest-state paint.
 *
 * Still window-anchored, and that reasoning is unchanged and still the right
 * one: close dismisses the VIEWER, a window-level object, so it belongs to the
 * window; mute and play/pause act on the VIDEO, so they belong to the frame.
 * Anchoring a control by what it acts on keeps deciding correctly as chrome is
 * added. What the reference changes is which corner — the frame's top-LEFT is
 * now deliberately empty (rule 1.5: no wordmark, no counter), so the window's
 * top-left is free and the frame's top-right belongs to mute + CTA.
 *
 * The 2026-08-18 bare-glyph decision is REVERSED here, deliberately rather than
 * by drift: rule 1.4 gives every circular control in this design one paint —
 * `rgba(255,255,255,.16)` at rest, `.28` on hover — and close, the chevrons and
 * the TikTok rail circles all share it. The reference's own mobile IG override
 * to `.14` is a specificity accident (spec §4.4 item 1, confirmed against his
 * "all circular buttons share one style" commit), so `.16` is used uniformly on
 * both viewports.
 *
 * 40x40 is the design's box and is BELOW the 44px convention this file uses
 * elsewhere. Recorded, not silently accepted: 40px clears WCAG 2.5.8 (24px) and
 * 2.5.5's AAA target is 44px, which this viewer's other controls meet. The
 * design's number wins per the authority split (visual design = Aman), and the
 * gap is one line in the change log rather than a silent 4px.
 */
.sbi-qs-close {
	/* ── The UA's form-control defaults, refused explicitly ──────────────────
	 * A <button> is not a normal element: the UA sets its own `font` shorthand
	 * (`400 13.3333px Arial` in Chrome) and its own `padding: 1px 6px`, and
	 * NEITHER inherits from the viewer. Measured on the live demo: every button
	 * in this viewer reported `font-family: Arial` while the overlay itself
	 * reported the design's `Inter, InterVariable, …` stack — so rule 1.6's
	 * "Tap to unmute" label and the rail's counts were rendering in Arial, at
	 * the design's sizes but not its face.
	 *
	 * `font: inherit` FIRST, so each rule's own explicit size/weight below still
	 * wins on source order. `padding: 0` because a glyph-only control's box is
	 * its tap target and the UA's 6px side padding silently shrinks the content
	 * area (a 40px close disc was laying out its 22px glyph in 28px of content
	 * box). `appearance: none` because iOS Safari otherwise paints its own
	 * control chrome over the disc.
	 *
	 * Deliberately repeated per rule rather than hoisted into a
	 * `.sbi-qs-overlay button` reset: that selector has HIGHER specificity
	 * (0,1,1) than the single-class rules here (0,1,0), so it would override the
	 * paddings those rules set on purpose — the mute chip's `0 7px`, the pill's
	 * `0 13px 0 11px`. Flat specificity is what keeps this predictable. */
	font: inherit;
	-webkit-appearance: none;
	appearance: none;
	padding: 0;
	position: absolute;
	top: 12px;
	top: max(12px, env(safe-area-inset-top, 0px));
	left: 12px;
	z-index: 6;
	box-sizing: border-box;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 0;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	cursor: pointer;
	/* Rex review (SMASH-1851): explicit, not relied-on-by-omission — every
	 * genuine control states its own pointer-events: auto so an "opt out by
	 * default" ancestor can't silently swallow it if a future change wraps
	 * these in a container. */
	pointer-events: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 150ms ease, transform 150ms ease;
}
.sbi-qs-close:hover,
.sbi-qs-close:focus-visible {
	background: rgba(255, 255, 255, 0.28);
	outline: 0;
}
.sbi-qs-close:active {
	transform: scale(0.94);
}
/* Kept even though the reference has no focus ring anywhere (spec §4.2's last
 * row names IG/TikTok anchors as the gap). Behaviour + a11y are ours where the
 * design is silent, and a keyboard user must be able to see where they are. */
.sbi-qs-close:focus-visible {
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6);
}
.sbi-qs-close svg {
	width: 22px;
	height: 22px;
}
/* ── The 44px hit target, WITHOUT changing the design's 40px disc ─────────────
 * Same technique as .sbi-qs-caption-more's, and the same reason: the visible
 * box is the design's and is not negotiable, while the REACHABLE box is ours
 * and this file's convention is 44px. A positioned pseudo-element takes no part
 * in layout but is hit-tested, and a hit on it resolves to its originating
 * element — so elementFromPoint over this ring returns the button.
 *
 * 40 -> 44 is 2px on each side. Worth doing rather than waving through: 40px
 * clears WCAG 2.5.8 (24px, AA) but misses 2.5.5's 44px AAA target, and this
 * viewer's other controls meet it. Invisible either way, so there is no design
 * question to escalate — only a gap to close. */
.sbi-qs-close::before {
	content: '';
	position: absolute;
	inset: -2px;
	border-radius: 50%;
}

/* ── Viewport (clips the transforming track) ─────────────────────────────── *
 * Both z-index: 2 AND pointer-events: none are load-bearing here, not
 * decorative — see the note on .sbi-qs-gesture below for why the z-index fix
 * has to live here and not on a slide descendant.
 *
 * pointer-events: none is inherited by everything painted inside (track, post,
 * frame, media, per-slide chrome) UNLESS a rule targets that element
 * specifically. The genuine per-slide controls do exactly that — the author
 * link, the Follow pill, the more/less button, every rail item — and NOT via a
 * blanket `> *` rule, which is the defect Rex caught in review (see
 * .sbi-qs-bottom). Without the `none` here, .sbi-qs-viewport / .sbi-qs-track
 * themselves (bare containers with no click handler) become the hit-test result
 * for a tap anywhere on the video area, and tap-to-toggle-play silently stops
 * firing.
 */
.sbi-qs-viewport {
	position: absolute;
	inset: 0;
	overflow: hidden;
	z-index: 2;
	pointer-events: none;
}

.sbi-qs-track {
	position: relative;
	width: 100%;
	will-change: transform;
	transform: translate3d(0, 0, 0);
	pointer-events: none; /* Inherited from .sbi-qs-viewport anyway; explicit for clarity. */
	/* Transition is applied inline by the JS so the first positioning can skip animation. */
}

/* ── Individual post — the SLIDE, one viewport tall ──────────────────────── *
 * Full viewport height, and that is the track's arithmetic, not a visual
 * choice: goToIndex() translates by one viewport height per slide. The PAINTED
 * frame inside is shorter than this on desktop (rule 1.1's 8px margins) — the
 * slide is the scroll unit, the frame is the picture.
 */
.sbi-qs-post {
	position: relative;
	width: 100%;
	/* vh-then-dvh pair — see the viewport-unit convention at the top of this
	 * file. This is the rule the rail-clipping report was actually about: the
	 * slide, and therefore the chrome positioned against its bottom edge, used
	 * to extend below the visible viewport on a phone. */
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
	pointer-events: none;
}

/* ── The FRAME (rule 1.1) ────────────────────────────────────────────────── *
 * Base = touch: full-bleed, square corners, no margins. `inset: 0` with no
 * width/height fills the slide.
 *
 * Desktop (see the capability block at the end of the file) = a 9:16 column of
 * height `viewport - 16px`, giving 8px top and bottom margins, centred TOGETHER
 * with the rail column. The centring mechanism is `margin: auto` against a
 * right inset that reserves the rail column plus the stage gap: the box then
 * centres inside `[0, 100vw - rail - gap]`, whose centre is exactly
 * `50vw - frame-shift`. No transform is involved, which matters — a transform
 * here would mint a stacking context, and this file's §6.3 history is about
 * exactly those.
 *
 * `isolation: isolate` is the reference's (and ours): it scopes the per-slide
 * chrome's paint order to the frame. It adds a stacking context INSIDE the
 * track, which is already inside one (the track's transform), so it cannot
 * affect the only comparison that decides pointer ownership — viewport z-index
 * vs gesture z-index, one level up. See .sbi-qs-gesture.
 *
 * `overflow: hidden` is the CLIP for the corner radius and for the per-slide
 * chrome, which NOW LIVES INSIDE THIS BOX (it used to hug the stage from
 * outside). Nothing in here needs to escape: the author row and the caption are
 * inset by their own padding, and the expanded caption is capped and scrolls
 * internally (rule IG-5) rather than growing past the frame — which is the very
 * defect spec §4.1 item 9 measured in the reference (a 2.5k-char caption
 * escaping the frame top by 463px and being silently clipped).
 */
.sbi-qs-media {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	margin: auto;
	background: #000;
	border-radius: var(--sbi-qs-stage-radius, 0px);
	overflow: hidden;
	isolation: isolate;
	pointer-events: none;
}

/* ── Letterbox backdrop (rule 1.14) ──────────────────────────────────────── *
 * Media WIDER than 9:16 x 1.04 letterboxes with `contain` over a blurred,
 * darkened blow-up of its own poster. Media TALLER than that is CROPPED with
 * `cover` and gets no backdrop — the reference's behaviour, carried as decided
 * (log rule 1.14, flagged to Aman as Q5).
 *
 * Instagram posters are absent on most cached rows, so the common IG case is
 * the plain black frame; the JS only sets this element up when a poster URL
 * actually survives the scheme check. Recorded because it makes the treatment
 * look unimplemented on a typical feed when it is simply not applicable.
 *
 * The URL reaches this element as an inline `background-image` set by the JS
 * through a dedicated CSS-url guard, never by string-building a stylesheet.
 */
.sbi-qs-backdrop {
	position: absolute;
	inset: -10%;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	filter: blur(28px) brightness(0.55) saturate(1.2);
	transform: scale(1.1);
	pointer-events: none;
}

.sbi-qs-video,
.sbi-qs-poster,
.sbi-qs-embed {
	position: relative;
	width: 100%;
	height: 100%;
	pointer-events: none;
	/* The second half of the corner clip. `border-radius` alone is dropped on
	 * real GPUs once a composited video layer settles — the layer ignores the
	 * ancestor's clip — so the shape is ALSO stated as a `clip-path`, which
	 * composites. Both read the one variable, so there is still one value and
	 * one gate. Neither is redundant with the other; they fail in different
	 * directions, and at-rest corners stay an on-device verification step
	 * (SwiftShader/headless cannot reproduce the failure). */
	border-radius: var(--sbi-qs-stage-radius, 0px);
	clip-path: inset(0 round var(--sbi-qs-stage-radius, 0px));
}
.sbi-qs-video,
.sbi-qs-poster {
	/* Rule 1.14: `cover` is the DEFAULT (the taller-than-9:16 case, cropped);
	 * `[data-fit="contain"]` below switches the wider case to letterboxing.
	 * This inverts the previous always-`contain` treatment, which letterboxed
	 * every non-9:16 source inside a fixed frame.
	 *
	 * NO `background` here, and that is load-bearing rather than tidying. It
	 * used to be `#000`, which was right when the frame always letterboxed
	 * against black — but an `object-fit: contain` element still FILLS its box
	 * and paints its own background in the letterbox bands, so once rule 1.14
	 * put a blurred poster backdrop behind the media, that background covered
	 * it completely. Caught by the browser measurement pass on the live demo:
	 * every geometry and state probe passed, the backdrop was present,
	 * displayed, correctly filtered and correctly sized, and the bands still
	 * rendered plain black.
	 *
	 * The frame's own `background: #000` is what shows through instead — which
	 * is exactly the behaviour rule 1.14 asks for in the (common, on Instagram)
	 * no-poster case, since the backdrop is hidden then. One black, one owner. */
	object-fit: cover;
}
.sbi-qs-media[data-fit="contain"] .sbi-qs-video,
.sbi-qs-media[data-fit="contain"] .sbi-qs-poster {
	object-fit: contain;
}
.sbi-qs-embed {
	border: 0;
	background: #000;
}

/* ── Media host ──────────────────────────────────────────────────────────── *
 * The tier's own element (video / iframe / poster img) goes in here, and
 * instantiateTier() clears THIS node on every escalation. It exists so the
 * per-slide chrome — backdrop, scrim, bottom row, spinner, terminal tier — can
 * live inside the painted frame and survive a tier change. The previous
 * structure had the frame and the media host as one element, which is exactly
 * why the chrome had to sit outside the frame and hug it, and why the meta row
 * read wider than the video column.
 */
.sbi-qs-mediahost {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

/* ── Buffering spinner (rule 1.19, spec §6.1's loading affordance) ───────── */
.sbi-qs-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -18px 0 0 -18px;
	box-sizing: border-box;
	width: 36px;
	height: 36px;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: #fff;
	border-radius: 50%;
	z-index: 2;
	pointer-events: none;
	opacity: 0;
	transition: opacity 200ms ease;
	animation: sbiQsSpin 0.8s linear infinite;
}
.sbi-qs-media[data-buffering="true"] .sbi-qs-spinner {
	opacity: 1;
}

/* ── Terminal tier (rule 1.19) ───────────────────────────────────────────── *
 * The poster stays visible under a scrim with one centred line and a route out.
 * The permanent top-row CTA (desktop) / rail "View" item (touch) is untouched
 * by the escalation — spec §6f forbids re-rendering or relocating it — so this
 * pill is an ADDITION on the dead tier, not that CTA moved.
 */
.sbi-qs-fail {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	background: rgba(0, 0, 0, 0.4);
	/* §6.3: the layer is inert and the pill opts back in. */
	pointer-events: none;
}
.sbi-qs-media[data-tier="terminal"] .sbi-qs-fail {
	display: flex;
}
/* Shown on BOTH viewports, unlike the top-row CTA it borrows its paint from: a
 * dead tier needs a visible route out even on touch, where the top pill is
 * hidden and the rail's "View" item is the CTA. */
.sbi-qs-media[data-tier="terminal"] .sbi-qs-fail-link {
	display: inline-flex;
	pointer-events: auto;
}
.sbi-qs-fail-text {
	font-size: 13px;
	color: rgba(255, 255, 255, 0.7);
}

/* ── Gesture-capture layer (§7.1: hidden from AT, not focusable) ─────────── *
 * SMASH-1851: this layer is a SIBLING of .sbi-qs-viewport (both are direct
 * children of .sbi-qs-overlay) — it is NOT nested inside the track, so a
 * z-index set on something inside the track never gets compared against this
 * element's z-index at all.
 *
 * .sbi-qs-track carries a live `transform` (the swipe animation, §3.2) and
 * therefore establishes its OWN stacking context (a non-none transform does
 * that per spec, independent of will-change). That traps every z-index inside
 * the track — a slide descendant's z-index only ever orders it against OTHER
 * elements inside that same trapped context, never against this gesture div.
 * The actual comparison that decides who wins a click is this element's z-index
 * vs .sbi-qs-viewport's, because those two are the ones that are actually
 * siblings. That is why .sbi-qs-viewport carries the real z-index: 2 (above
 * this element's 1) instead.
 *
 * With .sbi-qs-viewport on top, this div would swallow EVERY click inside the
 * track were it not for the pointer-events: none on .sbi-qs-post /
 * .sbi-qs-media / the media elements: those make the video area transparent to
 * the pointer so a tap still falls through here (tap-to-toggle keeps working
 * everywhere except the bits of chrome that explicitly opt back in).
 *
 * Carries NO tabindex, deliberately. It used to have tabindex="-1" to keep it
 * "out of the tab order", which was backwards: a <div> is not focusable to
 * begin with, so the attribute did not remove sequential focusability (there
 * was none) — it ADDED click and programmatic focusability, which is the one
 * thing an aria-hidden element must not have. Chrome then refused the
 * aria-hidden outright on any click landing here.
 */
.sbi-qs-gesture {
	position: absolute;
	inset: 0;
	z-index: 1;
	cursor: pointer;
}

/* ── Session-level frame chrome (the second consumer of the frame geometry) ─ *
 * An overlay-level box that reproduces the PAINTED FRAME's exact geometry, and
 * holds the chrome that is session-scoped rather than per-post: the top row
 * (mute + CTA), the progress bar, and the pause glyph.
 *
 * Why it exists, since the reference has no equivalent: in his build the top row
 * and the progress bar are per-slide children of each frame, which is free
 * because there is exactly one of each state to hold — his mute is a global
 * `state.muted` read by CSS. Ours cannot be per-slide: mute is one session-level
 * <button> (one accessible name, one focus stop, one disabled state driven by
 * the ACTIVE tier's capability), and N mute buttons would mean N focus stops in
 * the trap and N labels to keep in sync. The CTA pill is per-post data, but only
 * ever one post is active, so its href is refreshed on slide change — the same
 * thing updateChrome() already does for every other session control.
 *
 * Consequence to know: this chrome does NOT travel with a drag, while the rail
 * and the bottom row (both per-slide, inside the track) do. That matches the
 * ratified rule, which names the RAIL as the element that mirrors the drag
 * transform, and it matches the reference visually because his build has no JS
 * drag to reveal the difference.
 *
 * `overflow: hidden` + the radius are what let the 2px progress bar sit flush
 * on the frame's ROUNDED bottom edge: the bar is full frame width, so without
 * the clip its square ends would poke out past the corner curve. This is the
 * one job that could not be done by positioning alone.
 *
 * The geometry formula is stated in TWO places — here and .sbi-qs-media — and
 * that duplication is the cost of the split above.
 * tests/js/swipe-stage-geometry.test.js re-derives both from the file and fails
 * if they disagree, so the pair cannot drift silently.
 */
.sbi-qs-framechrome {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	margin: auto;
	z-index: 3;
	border-radius: var(--sbi-qs-stage-radius, 0px);
	overflow: hidden;
	/* §6.3: the container is inert; each genuine control opts back in. */
	pointer-events: none;
}

/* ── Top row inside the frame (rule 1.5) ─────────────────────────────────── *
 * `[blank left] … [mute][View on Instagram]`, right-aligned. The frame's
 * top-LEFT is deliberately EMPTY — the reference removed the Reels wordmark and
 * never added a counter there (rule 1.8), and the window close button now
 * occupies that corner of the WINDOW.
 *
 * Touch keeps a 62px left pad so the row's contents can never slide under that
 * window-anchored close button, which on a full-bleed frame overlaps this row.
 */
.sbi-qs-top {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	box-sizing: border-box;
	height: 48px;
	padding: 14px 10px 0 62px;
	padding-top: max(14px, env(safe-area-inset-top, 0px));
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	/* Rule IG-1 — the only text-shadow in the design's IG skin, and it is here
	 * because the top row has NO scrim behind it (there is no top gradient).
	 * The bottom row gets its contrast from .sbi-qs-scrim instead. */
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
	pointer-events: none;
}

/* ── Mute button (rule 1.6 / spec §2.4) ──────────────────────────────────── *
 * MOVED from the bottom-right gutter to the frame's top-right (reversing the
 * 2026-08-28 placement), and completely restyled: this is the design's shared
 * unmute affordance, the single most-explained element in Aman's walkthrough.
 *
 * The state paint is the point, and it is inverted from every other control in
 * this file: MUTED is LOUD (solid white chip, dark glyph) and UNMUTED is QUIET
 * (dark translucent, white glyph). His commit message is literal about it —
 * "Mute chip is solid white whenever muted, dark translucent once unmuted" —
 * and it is why the chip carries NO shadow: it is deliberately flatter than the
 * scrim-shadowed text around it.
 *
 * The label slides OUT OF the button rather than appearing beside it, which is
 * what makes 34 -> 136 a single expanding box instead of two elements. The
 * transitions are the measured ones and they are deliberately asymmetric
 * (700ms for the geometry, 450ms for the colour, 350ms+50ms for the label's
 * opacity) — the label fades in behind a width that is still opening.
 *
 * WHEN the label shows is OURS, not his (rule 1.7): he opens muted
 * unconditionally, we keep §4.1's unmuted attempt, so the label becomes the
 * REFUSAL arm. The JS owns that gate; this file only paints the two states.
 */
.sbi-qs-mute {
	/* ── The UA's form-control defaults, refused explicitly ──────────────────
	 * A <button> is not a normal element: the UA sets its own `font` shorthand
	 * (`400 13.3333px Arial` in Chrome) and its own `padding: 1px 6px`, and
	 * NEITHER inherits from the viewer. Measured on the live demo: every button
	 * in this viewer reported `font-family: Arial` while the overlay itself
	 * reported the design's `Inter, InterVariable, …` stack — so rule 1.6's
	 * "Tap to unmute" label and the rail's counts were rendering in Arial, at
	 * the design's sizes but not its face.
	 *
	 * `font: inherit` FIRST, so each rule's own explicit size/weight below still
	 * wins on source order. `padding: 0` because a glyph-only control's box is
	 * its tap target and the UA's 6px side padding silently shrinks the content
	 * area (a 40px close disc was laying out its 22px glyph in 28px of content
	 * box). `appearance: none` because iOS Safari otherwise paints its own
	 * control chrome over the disc.
	 *
	 * Deliberately repeated per rule rather than hoisted into a
	 * `.sbi-qs-overlay button` reset: that selector has HIGHER specificity
	 * (0,1,1) than the single-class rules here (0,1,0), so it would override the
	 * paddings those rules set on purpose — the mute chip's `0 7px`, the pill's
	 * `0 13px 0 11px`. Flat specificity is what keeps this predictable. */
	font: inherit;
	-webkit-appearance: none;
	appearance: none;
	position: relative;   /* the ::before hit-target ring below */
	box-sizing: border-box;
	min-width: 34px;
	height: 34px;
	border: 0;
	border-radius: 17px;
	padding: 0 7px;
	background: #fff;
	color: #111;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	/* Deliberate — reference commit 33f0e75 removes it from the chip and the
	 * glyph both. Stated rather than omitted so a future "add a shadow like the
	 * other controls" change has to argue with it. */
	box-shadow: none;
	text-shadow: none;
	cursor: pointer;
	pointer-events: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	/* NO `overflow: hidden` here (MG-06). The ::before below is the 44px hit
	 * ring, absolutely positioned at `inset: -5px` — so it lies OUTSIDE this
	 * 34px chip's padding box, and clipping the box clipped the ring with it.
	 * The pseudo-element still computed as 44x44 with `pointer-events: auto`,
	 * which is why this read as working: nothing outside the chip was actually
	 * hit-testable, so an edge tap fell through to `.sbi-qs-gesture` and PAUSED
	 * the Reel instead of toggling sound — a misroute of exactly the kind §6.3
	 * exists to exclude, on the one control whose visual size is deliberately
	 * smaller than its target.
	 *
	 * Nothing here needs the clip: the sliding "Tap to unmute" label clips
	 * itself (`.sbi-qs-mute-label { max-width: 0; overflow: hidden }`), and the
	 * 20px glyph cannot overflow a 34px chip. `.sbi-qs-close` never had this
	 * bug because it does not clip — same ring pattern, `inset: -2px`. */
	white-space: nowrap;
	line-height: 1;
	transition: padding 700ms cubic-bezier(0.22, 1, 0.36, 1),
		background 450ms ease,
		color 450ms ease;
}
.sbi-qs-mute svg {
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
	filter: none;
}
/* ── The 44px hit target for a 34px chip (see .sbi-qs-close::before) ─────────
 * 5px on each side takes the 34px resting chip to 44x44. The insets are
 * asymmetric in effect rather than in value: the chip GROWS to 136px wide while
 * hinting, so the horizontal 5px only ever matters at rest, where it is needed.
 *
 * The right-hand 5px reaches into the 8px gap between this and the CTA pill and
 * stops 3px short of it — and the pill's own expansion below is VERTICAL ONLY
 * for exactly that reason. Two controls whose grown hit boxes overlap would hand
 * the shared strip to whichever paints last, which is the kind of silent,
 * position-dependent misroute §6.3's history is made of. */
.sbi-qs-mute::before {
	content: '';
	position: absolute;
	inset: -5px;
	border-radius: 22px;
}
.sbi-qs-mute-label {
	max-width: 0;
	margin-left: 0;
	opacity: 0;
	transform: translateX(-6px);
	overflow: hidden;
	font-size: 13px;
	font-weight: 600;
	line-height: 13px;
	letter-spacing: -0.005em;
	white-space: nowrap;
	transition: max-width 700ms cubic-bezier(0.22, 1, 0.36, 1),
		margin 700ms cubic-bezier(0.22, 1, 0.36, 1),
		opacity 350ms ease 50ms,
		transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}
.sbi-qs-mute-hinting {
	padding: 0 12px 0 9px;
}
.sbi-qs-mute-hinting .sbi-qs-mute-label {
	max-width: 140px;
	margin-left: 6px;
	opacity: 1;
	transform: none;
}
/* Unmuted — the quiet state. Driven by an attribute rather than a class so the
 * paint can never disagree with what updateMuteChrome() computed as the REAL
 * state (rule 1.7a: the button always reflects reality, including "muted for a
 * reason the visitor didn't choose"). */
.sbi-qs-mute[data-state="on"] {
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
}
.sbi-qs-mute[data-state="on"]:hover,
.sbi-qs-mute[data-state="on"]:focus-visible {
	background: rgba(0, 0, 0, 0.75);
}
.sbi-qs-mute[data-state="on"] .sbi-qs-mute-label {
	display: none;
}
.sbi-qs-mute:focus-visible {
	outline: 0;
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6);
}
/* Rule 1.20 / §6.2: a control the tier cannot support is DISABLED, never
 * omitted. The reference omits the button when `hasAudio === false`, which
 * leaves `m` flipping a state with no control and no audible effect. */
.sbi-qs-mute:disabled {
	opacity: 0.35;
	cursor: default;
}

/* ── CTA pill "View on Instagram" (rule IG-6) ────────────────────────────── *
 * Desktop only, top-right beside mute. On touch it is `display: none` and the
 * CTA becomes a rail item instead — Aman states this migration explicitly for
 * all three platforms ("the view button on mobile moves at the bottom, the mute
 * stays up top").
 *
 * Replaces the left-aligned in-caption pill that used to sit in the bottom
 * chrome band (rule IG-7). Hidden by default because base = touch.
 */
.sbi-qs-view-on-ig,
.sbi-qs-fail-link {
	position: relative;   /* the ::before hit-target band below */
	display: none;
	box-sizing: border-box;
	align-items: center;
	gap: 7px;
	height: 34px;
	padding: 0 13px 0 11px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	text-decoration: none;
	text-shadow: none;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
	pointer-events: auto;
	flex: 0 0 auto;
	transition: background 150ms ease;
}
.sbi-qs-view-on-ig svg,
.sbi-qs-fail-link svg {
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
}
/* VERTICAL ONLY — see .sbi-qs-mute::before for why. The pill is already 163px
 * wide, so height is the only axis that misses 44px. */
.sbi-qs-view-on-ig::before,
.sbi-qs-fail-link::before {
	content: '';
	position: absolute;
	top: -5px;
	right: 0;
	bottom: -5px;
	left: 0;
	border-radius: 999px;
}
.sbi-qs-view-on-ig:hover,
.sbi-qs-view-on-ig:focus-visible,
.sbi-qs-fail-link:hover,
.sbi-qs-fail-link:focus-visible {
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	text-decoration: none;
	outline: 0;
}
.sbi-qs-view-on-ig:focus-visible,
.sbi-qs-fail-link:focus-visible {
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7);
}

/* ── Progress bar (rule 1.12) ────────────────────────────────────────────── *
 * MOVED from a full-bleed bar across the WINDOW's top edge to the bottom edge
 * INSIDE the frame, at the design's 2px (TikTok's is 3px, and its red fill goes
 * white on both). Sits inside .sbi-qs-framechrome so the frame's radius clips
 * the bar's square ends.
 *
 * scaleX rather than width is unchanged and is the whole reason the bar
 * interpolates smoothly between the 250ms samples §6.1 requires: a transform
 * animates on the compositor, a width relayouts.
 */
.sbi-qs-progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 2px;
	background: rgba(255, 255, 255, 0.28);
	overflow: hidden;
	/* A read-only readout with no click handler. Without this it would swallow
	 * taps landing in its band instead of letting them reach the gesture layer
	 * (spec §6.3's "non-interactive chrome MUST opt out too"). */
	pointer-events: none;
}
.sbi-qs-progress-fill {
	display: block;
	width: 100%;
	height: 100%;
	background: #fff;
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 250ms linear;
}
/* Applied by setProgress() for ONE write, whenever the position moves backward
 * (a slide change, a loop wrap). Without it the fill ANIMATES back down over
 * 250ms, which reads as the bar rewinding — rule 1.12's "jump on nav" class.
 * The class is added, the value written, then the class removed on the next
 * frame, so only that single write is unanimated. */
.sbi-qs-progress-fill-jump {
	transition: none;
}

/* ── Pause glyph (rule 1.10) ─────────────────────────────────────────────── *
 * REPLACES the 600ms tap-flash. This is a play triangle shown for AS LONG AS
 * the slide is paused, not a transient echo of a tap — so the viewer always
 * shows whether it is playing, which is also what §6.1's "play/pause reflects
 * actual state" asks for on the visual channel (the sr-only live region carries
 * it on the AT channel).
 *
 * Deliberately NOT `inset: 0` + `place-items: center`, which is how the
 * reference does it. This is a shrink-wrapped, centre-anchored 84px box, so a
 * future pointer-events regression on this layer would expose an 84px disc
 * rather than the whole frame. Same reasoning the tap-flash it replaces was
 * built with, and this file's founding §6.3 defect is exactly that shape.
 *
 * The in-curve OVERSHOOTS (scale ~1.026 at 120ms) and the out-curve does not —
 * asymmetric on purpose per the walkthrough: "appearing is a statement,
 * disappearing gets out of the way."
 */
.sbi-qs-flash {
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -42px 0 0 -42px;
	z-index: 4;
	/* Decorative echo of state the layer BELOW owns. Without this it would
	 * swallow the tap that toggles playback — an 84px dead disc dead centre of
	 * the frame, i.e. exactly where a visitor taps to resume. */
	pointer-events: none;
	display: none;
}
.sbi-qs-flash svg {
	box-sizing: border-box;
	width: 84px;
	height: 84px;
	padding: 22px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.4);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	color: #fff;
	will-change: transform, filter;
}
.sbi-qs-overlay[data-paused="true"] .sbi-qs-flash {
	display: block;
}
.sbi-qs-overlay[data-paused="true"] .sbi-qs-flash svg {
	animation: sbiQsFlashIn 200ms cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}
/* The dissolve. `.sbi-qs-flash-on` is left behind by the JS for one 100ms
 * window after unpausing, so the glyph can animate OUT rather than vanishing. */
.sbi-qs-overlay[data-paused="false"] .sbi-qs-flash-on {
	display: block;
}
.sbi-qs-overlay[data-paused="false"] .sbi-qs-flash-on svg {
	animation: sbiQsFlashOut 100ms cubic-bezier(0.4, 0, 0.6, 1) both;
}

/* ── Desktop up/down chevrons (rule 1.11) ────────────────────────────────── *
 * Row 2 of the rail column, vertically centred on the frame. The reference
 * builds the rail column as a `minmax(0,1fr) auto 1fr` grid (measured
 * 380/124/380 at an 884px frame) so the chevrons land on the frame's centre and
 * get pushed up if the action stack ever needs more than its half.
 *
 * Ours reproduces the RESULT without the grid, and the reason is that the two
 * rows have different owners: the action stack is per-POST (its counts change
 * per slide, and the ratified rule has it travelling with the drag) so it lives
 * inside the track, while the chevrons are session-level and cannot. Nothing can
 * be one grid across that boundary. Since the frame is vertically centred in the
 * viewport, "centred on the frame" is `top: 50%`, and the grid's row-growth
 * behaviour is unreachable at IG's rail height anyway (183px against a 380px
 * half). Recorded as a deviation with a measured equivalence rather than
 * silently.
 *
 * Anchored off the same one expression as the rail column: `50% - frame-shift -
 * stage-half` is the frame's LEFT inset and, because the trio is centred, also
 * the rail column's RIGHT inset.
 *
 * VISIBILITY is input capability, never width (rule 1.2): touch has swipe for
 * this already, and width is wrong in both directions — a narrow desktop window
 * still has a mouse, a large tablet still does not.
 *
 * Both directions are built unconditionally and DISABLED at the ends of the
 * track, rather than added and removed: a control that vanishes at the last
 * slide moves its sibling, and a disabled button keeps the cluster's geometry
 * stable while staying honest about what it can do (§6.2).
 */
.sbi-qs-nav {
	position: absolute;
	right: calc(50% - var(--sbi-qs-frame-shift) - var(--sbi-qs-stage-half));
	width: var(--sbi-qs-rail-w);
	top: 50%;
	transform: translateY(-50%);
	z-index: 5;
	/* Hidden by default (base = touch); the capability query at the end of this
	 * file switches it on. */
	display: none;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	/* §6.3: the CONTAINER is inert and the two buttons opt back in below. */
	pointer-events: none;
}
.sbi-qs-nav-prev,
.sbi-qs-nav-next {
	/* ── The UA's form-control defaults, refused explicitly ──────────────────
	 * A <button> is not a normal element: the UA sets its own `font` shorthand
	 * (`400 13.3333px Arial` in Chrome) and its own `padding: 1px 6px`, and
	 * NEITHER inherits from the viewer. Measured on the live demo: every button
	 * in this viewer reported `font-family: Arial` while the overlay itself
	 * reported the design's `Inter, InterVariable, …` stack — so rule 1.6's
	 * "Tap to unmute" label and the rail's counts were rendering in Arial, at
	 * the design's sizes but not its face.
	 *
	 * `font: inherit` FIRST, so each rule's own explicit size/weight below still
	 * wins on source order. `padding: 0` because a glyph-only control's box is
	 * its tap target and the UA's 6px side padding silently shrinks the content
	 * area (a 40px close disc was laying out its 22px glyph in 28px of content
	 * box). `appearance: none` because iOS Safari otherwise paints its own
	 * control chrome over the disc.
	 *
	 * Deliberately repeated per rule rather than hoisted into a
	 * `.sbi-qs-overlay button` reset: that selector has HIGHER specificity
	 * (0,1,1) than the single-class rules here (0,1,0), so it would override the
	 * paddings those rules set on purpose — the mute chip's `0 7px`, the pill's
	 * `0 13px 0 11px`. Flat specificity is what keeps this predictable. */
	font: inherit;
	-webkit-appearance: none;
	appearance: none;
	padding: 0;
	position: relative;
	box-sizing: border-box;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 0;
	/* Rule 1.4's one circular-control paint, shared with close. */
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	cursor: pointer;
	pointer-events: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	transition: background 150ms ease, transform 150ms ease, opacity 150ms ease;
}
.sbi-qs-nav-prev svg,
.sbi-qs-nav-next svg {
	width: 24px;
	height: 24px;
}
.sbi-qs-nav-prev:hover,
.sbi-qs-nav-next:hover,
.sbi-qs-nav-prev:focus-visible,
.sbi-qs-nav-next:focus-visible {
	background: rgba(255, 255, 255, 0.28);
	outline: 0;
}
.sbi-qs-nav-prev:active,
.sbi-qs-nav-next:active {
	transform: scale(0.94);
}
.sbi-qs-nav-prev:focus-visible,
.sbi-qs-nav-next:focus-visible {
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6);
}
.sbi-qs-nav-prev:disabled,
.sbi-qs-nav-next:disabled {
	opacity: 0.3;
	cursor: default;
	transform: none;
}

/* ── Bottom scrim (rule IG-1) ────────────────────────────────────────────── *
 * 42% of the frame's height, inside the frame, under the bottom row. There is
 * deliberately NO top scrim: the top row carries its own text-shadow instead
 * (see .sbi-qs-top), because a second gradient up there would fight the
 * frame's clean top edge that removing the wordmark created.
 */
.sbi-qs-scrim {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 42%;
	z-index: 1;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.28) 55%, rgba(0, 0, 0, 0) 100%);
	pointer-events: none;
}

/* ── Rail column (rule 1.3) ──────────────────────────────────────────────── *
 * Base = touch: an in-frame absolute overlay at the frame's bottom-right,
 * shrink-wrapped to its content (`right: 10px` is the design's IG inset).
 * Desktop (capability block) = a 44px-wide column OUTSIDE the frame, 16px to
 * its right, bottom-aligned with the frame.
 *
 * ── SESSION-LEVEL: one column, an overlay child (SMASH-1851) ───────────────
 * It used to be a child of `.sbi-qs-post` — one column per slide, inside the
 * track — which is how it got its travel for free: the track's transform
 * carried it. Measured on 6.13.0.6, that made the active rail sweep the FULL
 * SLIDE HEIGHT on every navigation (900px at 1440x900, 844px at 390x844) while
 * the top row and the chevrons held perfectly still. Asmita, 2026-09-10: "keep
 * them in place and update them without them going up and down with the video
 * (we do this with TikTok)."
 *
 * This does NOT reverse the rule ratified 2026-08-27 ("the rail travels with
 * the reel"). That rule is about the DRAG, where a pinned rail leaves reel N's
 * stats over reel N+1's incoming video for the whole gesture — and the drag
 * follow survives, now as an explicit transform (see `transition-property`
 * below and setRailTravel() in the JS) rather than as an inherited one. What
 * goes is travel on the COMMIT, which is exactly what TikTok does: its one rail
 * element takes the live drag delta and lands at rest in the same paint that
 * swaps its content (`chromeTravelStyle`, SwipeView.jsx).
 *
 * The RESTING GEOMETRY is unchanged by the move, and the reason is checkable
 * rather than hopeful: `.sbi-qs-post` is `height: 100vh/100dvh` and
 * `.sbi-qs-overlay` is `position: fixed; inset: 0`, so the old and the new
 * containing blocks are the same box and these insets resolve identically
 * against either. Measured at both viewports before and after — zero delta.
 *
 * The one thing the move inherits rather than fixes: on a phone the overlay's
 * `inset: 0` and the post's `100dvh` can disagree by the browser chrome's
 * height on engines where a fixed box resolves against the LARGE viewport. That
 * is the same reference `.sbi-qs-framechrome` (also session-level, also
 * `bottom: 0` against the overlay) has always used, so this introduces no new
 * risk class — but it does mean the rail's bottom clearance is one of the
 * things only a real device can settle. Flagged for the iPhone pass, not
 * papered over.
 *
 * Base = touch: an in-frame absolute overlay at the frame's bottom-right
 * (`right: 10px` is the design's IG inset). Desktop (capability block) = a 44px
 * column OUTSIDE the frame, 16px to its right, bottom-aligned with it. It could
 * not be a child of `.sbi-qs-framechrome` instead, which would otherwise be the
 * tidier home: that box carries `overflow: hidden` so the 2px progress bar can
 * sit flush on the frame's rounded bottom edge, and on desktop the rail is
 * outside the frame, so it would be clipped away entirely.
 *
 * z-index 5, up from the 2 it carried inside the post. Inside a slide it only
 * had to beat the gesture layer's 1 within the viewport's own stacking context;
 * at overlay level it is a sibling of `.sbi-qs-framechrome` (3) and shares its
 * visual column with `.sbi-qs-nav` (5), so it takes the chevrons' level. Below
 * close (6) and the coach overlay (9), which both deliberately paint over
 * everything.
 *
 * The 44px width is the reference's `.sc-railcol`; the action stack inside it
 * shrink-wraps to ~29px and centres, which is why his `.sc-rail` measures
 * 28.9px inside a 44px column.
 */
.sbi-qs-railcol {
	position: absolute;
	right: 10px;
	bottom: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	/* Only the DURATION is written from JS (setRailTravel), so the easing and
	 * the property list stay declarative and in one place. `transform` alone,
	 * never `all`: the duration is toggled between 0ms and 320ms on every drag
	 * frame, and `all` would drag every other animatable property into that. */
	transition-property: transform;
	transition-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1);
	transition-duration: 0ms;
	/* §6.3: the column is inert; each rail item opts back in. */
	pointer-events: none;
}
/* An all-empty rail hides the COLUMN, not just its items — see updateRail().
 * `display: flex` above is an AUTHOR declaration and therefore beats `hidden`'s
 * UA rule, so without this the attribute would hide nothing at all. The column
 * must genuinely leave layout: its 18px of bottom padding is dead space for the
 * dismiss and tap-to-pause carve-outs, and a laid-out empty column would keep
 * carving a live region out of the backdrop for a post that has no rail. */
.sbi-qs-railcol[hidden] {
	display: none;
}
.sbi-qs-rail {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
	padding-bottom: 18px;
	padding-bottom: max(18px, var(--sbi-qs-safe-bottom, env(safe-area-inset-bottom, 0px)));
	pointer-events: none;
}

/* ── Rail items (rules IG-2, IG-3) ───────────────────────────────────────── *
 * BARE GLYPHS — no discs. Rule IG-2, and it is the one place the IG skin
 * departs from "all circular buttons share one style": TikTok's rail glyphs sit
 * in translucent circles, Instagram's do not, because Instagram's own Reels
 * player renders them bare. A drop-shadow does the contrast work a disc would
 * otherwise do.
 *
 * SEMANTICS differ per item and are NOT interchangeable (rule IG-3):
 *   like    — a READOUT, not a control. `<div role="img">` with an exact-figure
 *             label, `cursor: default`, and the hover transform suppressed.
 *             There is no logged-in visitor inside an embedded feed, so a heart
 *             styled like Instagram's tappable heart would promise something the
 *             UI cannot deliver.
 *   comment — a LINK to the post, where commenting genuinely works.
 *   share   — a real <button>: Web Share, then clipboard + toast, then a toast
 *             carrying the URL. The only genuine in-page action in the rail.
 *   view    — touch only; the desktop CTA pill's counterpart.
 *
 * Instagram exposes NO share count, so the share glyph carries none — and
 * "absent" is not "zero" anywhere in this cluster (a non-business account
 * reports no metrics at all).
 *
 * Each item is a shrink-wrapped column, NEVER a full-width flex child. That is
 * the ratified "never a full-width chrome strip" rule: a stretched item becomes
 * an opaque dead strip across the thumb zone that eats tap-to-pause and swipe
 * both — §6.3's fourth recurrence.
 */
.sbi-qs-act {
	/* ── The UA's form-control defaults, refused explicitly ──────────────────
	 * A <button> is not a normal element: the UA sets its own `font` shorthand
	 * (`400 13.3333px Arial` in Chrome) and its own `padding: 1px 6px`, and
	 * NEITHER inherits from the viewer. Measured on the live demo: every button
	 * in this viewer reported `font-family: Arial` while the overlay itself
	 * reported the design's `Inter, InterVariable, …` stack — so rule 1.6's
	 * "Tap to unmute" label and the rail's counts were rendering in Arial, at
	 * the design's sizes but not its face.
	 *
	 * `font: inherit` FIRST, so each rule's own explicit size/weight below still
	 * wins on source order. `padding: 0` because a glyph-only control's box is
	 * its tap target and the UA's 6px side padding silently shrinks the content
	 * area (a 40px close disc was laying out its 22px glyph in 28px of content
	 * box). `appearance: none` because iOS Safari otherwise paints its own
	 * control chrome over the disc.
	 *
	 * Deliberately repeated per rule rather than hoisted into a
	 * `.sbi-qs-overlay button` reset: that selector has HIGHER specificity
	 * (0,1,1) than the single-class rules here (0,1,0), so it would override the
	 * paddings those rules set on purpose — the mute chip's `0 7px`, the pill's
	 * `0 13px 0 11px`. Flat specificity is what keeps this predictable. */
	font: inherit;
	-webkit-appearance: none;
	appearance: none;
	position: relative;   /* the ::before hit-target box below */
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: #fff;
	text-decoration: none;
	cursor: pointer;
	pointer-events: auto;
	/* Bare glyphs over arbitrary video need their own contrast guard. */
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
	transition: transform 120ms ease;
}
.sbi-qs-act svg {
	width: 28px;
	height: 28px;
	flex: 0 0 auto;
}
/* ── 44px hit targets for BARE glyphs (see .sbi-qs-close::before) ────────────
 * A rail item is a shrink-wrapped flex column, so its WIDTH is whichever child
 * is wider: the glyph (26px desktop, 28px touch) or the count text. For a
 * one-digit count the text is ~7.8px, so the item is exactly as wide as the
 * glyph — and that is the whole defect this rule used to have. It stated the
 * ring as an INSET PAIR (`left`/`right: -8px`), which makes the ring's width a
 * value DERIVED from the item's: 28 + 16 = 44 on touch, but 26 + 16 = **42** on
 * desktop, two short of the convention. A floor expressed as a relative inset
 * is not a floor, it is an arithmetic coincidence that holds for one glyph size.
 *
 * So the horizontal axis is stated ABSOLUTELY: a fixed 44px box centred on the
 * item (`left: 50%` + `margin-left: -22px`), which is the same 44px whatever the
 * glyph measures and whatever figure Instagram returns. It resolves flush to the
 * rail COLUMN — the space the design already reserves for these controls — so a
 * grown item still cannot reach out over the video: on desktop the column is
 * 44px and the item is centred in it, so the ring lands exactly on the column's
 * two edges rather than 1px inside them.
 *
 * The VERTICAL axis keeps the ±1px insets, because the item is 43px (desktop) /
 * 45px (touch) tall and the derived 45/47px already clears 44 — shrinking it to
 * a flat 44 would REMOVE reachable area. `min-height` states the floor anyway,
 * so this axis cannot silently sink the way the other one did if the count row
 * ever stops being rendered. It does not fire at either current viewport; when a
 * min-height clamps a box that pins both `top` and `bottom`, the box is
 * over-constrained and grows downward from `top`, into the gap below.
 *
 * Adjacent items still cannot overlap: the growth is horizontal, and the ±1px
 * of vertical growth against an 18px (desktop) / 20px (touch) gap leaves ~15px
 * / ~17px of genuinely dead space between two rings — which is what keeps a tap
 * in the gap landing on the carve-out instead of on a control.
 *
 * `.sbi-qs-act-like` gets it too, even though it is a readout rather than a
 * control: it carries `role="img"` with a label, and an AT user targeting it
 * should not have a smaller target than the items either side of it. */
.sbi-qs-act::before {
	content: '';
	position: absolute;
	top: -1px;
	bottom: -1px;
	min-height: 44px;
	left: 50%;
	width: 44px;
	margin-left: -22px;
}
.sbi-qs-act-count,
.sbi-qs-act-label {
	/* `block` + min-height so an EMPTY count still reserves its row — an empty
	 * inline element generates no line box, which would pull the share glyph
	 * 17px up toward its neighbour. See buildRailItem() for why the row is
	 * always rendered. */
	display: block;
	min-height: 12px;
	font-size: 12px;
	font-weight: 600;
	line-height: 12px;
	/* Tabular figures so a count changing between slides doesn't shift the
	 * glyph above it. */
	font-variant-numeric: tabular-nums;
}
.sbi-qs-act:hover {
	color: #fff;
	text-decoration: none;
	transform: scale(1.06);
}
.sbi-qs-act:active {
	transform: scale(0.94);
}
.sbi-qs-act:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
	border-radius: 4px;
}
/* ── `hidden` must actually hide (SMASH-1851) ───────────────────────────────
 * The rail's items are built once and shown or hidden per slide, so `hidden` is
 * now load-bearing rather than decorative. `.sbi-qs-act` sets `display: flex`
 * above, and an AUTHOR declaration beats the UA's `[hidden] { display: none }`
 * — so the attribute on its own would hide NOTHING: a post with no like figure
 * would render an empty heart, and a post with no permalink would render a
 * comment glyph linking nowhere.
 *
 * Two independent conditions decide an item's visibility and they must not be
 * folded into one mechanism: DATA (this post has no figure / no permalink) is
 * `hidden`, written from JS; VIEWPORT (`.sbi-qs-act-view` is desktop-only) is
 * the capability query at the end of this file. Either one alone hides.
 *
 * `[hidden]` is (0,2,0) so it also wins over the capability block's
 * `.sbi-qs-act-view` (0,1,0) regardless of order — both resolve to `none`, so
 * the outcome is the same either way, but the specificity is why this rule does
 * not need to live below that block. */
.sbi-qs-act[hidden] {
	display: none;
}

/* The readout. Hover/active feedback is suppressed rather than merely
 * unstyled — a transform on hover is itself an affordance claim. */
.sbi-qs-act-like {
	cursor: default;
}
.sbi-qs-act-like:hover,
.sbi-qs-act-like:active {
	transform: none;
}

/* ── Bottom row (rules IG-4, IG-5) ───────────────────────────────────────── *
 * In-frame, frame-anchored, replacing the old chrome band that hugged the stage
 * from OUTSIDE it. Author row, then a ONE-LINE caption.
 *
 * `padding-right` is a SEPARATE LONGHAND and must stay one: it clears the rail
 * on touch (where the rail is inside the frame) and drops back to the plain
 * inset on desktop (where the rail is outside). Folding it into the shorthand
 * also breaks the geometry suite, which parses that shorthand's values.
 *
 * Pins `bottom` ONLY, never `top` as well. An absolutely-positioned box with
 * both pinned resolves to the full containing block on Safari 15.4-16.3 when a
 * `fit-content` height is unsupported — a full-frame band over the gesture
 * layer eating every vertical swipe. Bottom-anchored chrome pins bottom.
 */
.sbi-qs-bottom {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	box-sizing: border-box;
	padding: 0 16px 16px 16px;
	padding-bottom: max(16px, var(--sbi-qs-safe-bottom, env(safe-area-inset-bottom, 0px)));
	padding-right: 76px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	font-size: 14px;
	line-height: 18.2px;
	/* The gesture layer owns this whole band by default; only the genuine
	 * controls inside opt back in.
	 *
	 * Rex review (SMASH-1851), blocking finding, and the reason there is no
	 * `> *` rule here: a blanket opt-in used to live on the predecessor of this
	 * element on the theory that its children have nothing clickable inside
	 * them. That missed that pointer-events needs no click handler to do damage
	 * — this is a COLUMN flex container with the default `align-items: stretch`,
	 * so a blanket rule turns the author row and the caption into opaque,
	 * FULL-WIDTH bands sitting in the mobile thumb zone on every slide,
	 * silently swallowing tap-to-toggle (bound to the gesture layer, never
	 * reached) and touch-swipe navigation both. Spec §6.3 names this exact case.
	 * The fix is per-control opt-in, and the author row and Follow pill below
	 * additionally carry `align-self: flex-start` so they shrink-wrap. */
	pointer-events: none;
}

/* ── Author row (rule IG-4) ──────────────────────────────────────────────── */
.sbi-qs-authorrow {
	display: flex;
	align-items: center;
	gap: 10px;
	/* Shrink-wrapped, not stretched — see .sbi-qs-bottom. */
	align-self: flex-start;
	min-width: 0;
	max-width: 100%;
}
.sbi-qs-author {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	color: #fff;
	text-decoration: none;
	pointer-events: auto;
}
.sbi-qs-author:hover .sbi-qs-handle-text,
.sbi-qs-author:focus-visible .sbi-qs-handle-text {
	text-decoration: underline;
	text-underline-offset: 3px;
}
.sbi-qs-author:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
	border-radius: 4px;
}
.sbi-qs-avatar {
	box-sizing: border-box;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	flex: 0 0 auto;
	background: #262626;
}
/* Fallback when the post carries no usable avatar URL (rule IG-4): the
 * reference's initial-letter gradient disc. The hue is derived from the handle
 * so the same account always gets the same disc, rather than a colour that
 * changes between slides. */
.sbi-qs-avatar-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	text-transform: uppercase;
	color: #fff;
	background-image: linear-gradient(135deg, hsl(var(--sbi-qs-avatar-hue, 212) 70% 58%), hsl(calc(var(--sbi-qs-avatar-hue, 212) + 50) 65% 38%));
}
.sbi-qs-handle {
	display: flex;
	align-items: center;
	gap: 4px;
	min-width: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 18.2px;
}
.sbi-qs-handle-text {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}
.sbi-qs-verified {
	width: 14px;
	height: 14px;
	flex: 0 0 auto;
}
/* Outline pill, NOT Instagram's filled blue — the design's own treatment, and
 * the same shape TikTok fills solid red. Aman's stated rationale is CTA
 * density: "our users might appreciate having CTA almost everywhere". */
.sbi-qs-follow {
	position: relative;   /* the ::before hit-target band below */
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 28px;
	padding: 0 12px;
	margin-left: 2px;
	border: 1px solid rgba(255, 255, 255, 0.75);
	border-radius: 8px;
	background: transparent;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	text-decoration: none;
	flex: 0 0 auto;
	pointer-events: auto;
	transition: background 150ms ease;
}
/* 28px tall by design (rule IG-4); the band below takes the reachable box to
 * 44px without moving the outline. Vertical only — the pill sits in a row with
 * the author link 2px to its left, so a horizontal expansion would overlap it. */
.sbi-qs-follow::before {
	content: '';
	position: absolute;
	top: -8px;
	right: 0;
	bottom: -8px;
	left: 0;
	border-radius: 8px;
}
.sbi-qs-follow:hover,
.sbi-qs-follow:focus-visible {
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	text-decoration: none;
	outline: 0;
}
.sbi-qs-follow:focus-visible {
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7);
}

/* ── Caption (rules IG-4, IG-5) ──────────────────────────────────────────── *
 * ONE line, clamped with `nowrap` + ellipsis, with a "more" control revealed
 * only on MEASURED overflow. Down from three lines — the design's call.
 *
 * §6.1's expander contract, all four parts, and each one encodes a defect that
 * has shipped:
 *   - the caption TEXT is never tappable; only the shrink-wrapped more/less
 *     button is interactive. The reference puts `role="button" tabindex="0"` on
 *     the caption BLOCK, so its centre hit-test lands on the text node — spec
 *     §4.1 item 7. We keep his visual treatment exactly and move the role onto
 *     the button that already looks like the control.
 *   - revealed only on measured overflow (scrollWidth vs clientWidth).
 *   - expansion NEVER survives a slide change.
 *   - the expanded block is CAPPED and owns its own scroll surface; wheel and
 *     touch inside it must not navigate the track. Uncapped, a 2.5k-char
 *     caption measures 782px in his desktop build and escapes the frame top by
 *     463px, silently clipped — text lost with no indication.
 *
 * The CAP is a line count, not a viewport fraction, and that is a deliberate
 * deviation from rule IG-5's "≈26% of frame height": 12 lines at the design's
 * own 18.2px line-height is 218.4px, which is 24.7% of the 884px desktop frame
 * and 25.9% of the 844px mobile frame — inside a percentage point of his figure
 * at BOTH reference viewports, while introducing no viewport unit at all. A
 * percentage would not work: this element's containing block is bottom-anchored
 * with an auto height, so a percentage max-height resolves to `none`. Giving it
 * a definite height would mean pinning both `top` and `bottom`, which is the
 * named Safari full-band hazard above.
 */
.sbi-qs-caption {
	margin: 0;
	display: flex;
	align-items: baseline;
	gap: 6px;
	font-size: 14px;
	line-height: 18.2px;
	/* Deliberately NOT opted back into pointer events — the text must never be
	 * tappable. Only .sbi-qs-caption-more opts in. */
	pointer-events: none;
}
.sbi-qs-caption-text {
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}
.sbi-qs-caption-more {
	/* ── The UA's form-control defaults, refused explicitly ──────────────────
	 * A <button> is not a normal element: the UA sets its own `font` shorthand
	 * (`400 13.3333px Arial` in Chrome) and its own `padding: 1px 6px`, and
	 * NEITHER inherits from the viewer. Measured on the live demo: every button
	 * in this viewer reported `font-family: Arial` while the overlay itself
	 * reported the design's `Inter, InterVariable, …` stack — so rule 1.6's
	 * "Tap to unmute" label and the rail's counts were rendering in Arial, at
	 * the design's sizes but not its face.
	 *
	 * `font: inherit` FIRST, so each rule's own explicit size/weight below still
	 * wins on source order. `padding: 0` because a glyph-only control's box is
	 * its tap target and the UA's 6px side padding silently shrinks the content
	 * area (a 40px close disc was laying out its 22px glyph in 28px of content
	 * box). `appearance: none` because iOS Safari otherwise paints its own
	 * control chrome over the disc.
	 *
	 * Deliberately repeated per rule rather than hoisted into a
	 * `.sbi-qs-overlay button` reset: that selector has HIGHER specificity
	 * (0,1,1) than the single-class rules here (0,1,0), so it would override the
	 * paddings those rules set on purpose — the mute chip's `0 7px`, the pill's
	 * `0 13px 0 11px`. Flat specificity is what keeps this predictable. */
	font: inherit;
	-webkit-appearance: none;
	appearance: none;
	/* §6.3 explicit opt-in: this button IS the control, and the only one. */
	pointer-events: auto;
	position: relative;
	flex: 0 0 auto;
	display: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: #a8a8a8;
	font-size: 14px;
	font-weight: 400;
	line-height: 18.2px;
	cursor: pointer;
}
/* The 44px hit target, WITHOUT the layout cost. The design's visible control is
 * 33.9 x 18.2 — below this file's 44px control convention, a gap the survey has
 * carried as an advisory since 2026-08-19. Padding would fix the target and
 * break the design: this row is measured at 18.2px tall and the bottom row at
 * 76.2px, so a 44px-tall button grows the whole block by 26px and pushes the
 * author row up off its mark.
 *
 * A positioned pseudo-element takes no part in layout but IS hit-tested, and a
 * hit on it resolves to its originating element — so elementFromPoint over this
 * region returns the button, which is exactly what §6.3's proof asks for. The
 * visible box stays the design's; only the reachable box grows.
 *
 * Insets are asymmetric on purpose: 13px above and below the 18.2px text gives
 * 44.2px, and the horizontal 6px stops short of the caption text so the grown
 * target cannot start swallowing taps meant for the gesture layer. */
.sbi-qs-caption-more::before {
	content: '';
	position: absolute;
	top: -13px;
	right: -6px;
	bottom: -13px;
	left: -6px;
}
.sbi-qs-caption-has-more .sbi-qs-caption-more {
	display: inline-block;
}
.sbi-qs-caption-more:hover {
	color: #fff;
}
.sbi-qs-caption-more:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
	border-radius: 4px;
}
.sbi-qs-caption-expanded {
	align-items: flex-end;
}
.sbi-qs-caption-expanded .sbi-qs-caption-text {
	/* Caption text is set via textContent, never innerHTML (§12) — a caption's
	 * literal `<br>`/`<br/>` markers are translated to `\n` in JS instead (see
	 * formatCaptionText()). `pre-line` turns those preserved newlines into real
	 * breaks without ever parsing the text as markup. */
	white-space: pre-line;
	overflow-y: auto;
	overflow-x: hidden;
	text-overflow: clip;
	max-height: var(--sbi-qs-caption-cap);
	/* Owns its scroll surface. The wheel/touch handlers additionally refuse to
	 * navigate while the event originated inside here — CSS alone cannot stop
	 * the gesture layer, because the gesture layer is not an ancestor. */
	pointer-events: auto;
	padding-right: 10px;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}
.sbi-qs-caption-expanded .sbi-qs-caption-text::-webkit-scrollbar {
	width: 4px;
}
.sbi-qs-caption-expanded .sbi-qs-caption-text::-webkit-scrollbar-track {
	background: transparent;
}
.sbi-qs-caption-expanded .sbi-qs-caption-text::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.35);
	border-radius: 2px;
}
/* ── Hashtags inside the caption (rule IG-5) — COLOUR ONLY, NOT LINKS ────── *
 * CONFLICT, resolved toward behaviour and escalated rather than resolved
 * silently (log § 0). Rule IG-5 asks for two things that cannot both hold:
 * "caption text never tappable; only the shrink-wrapped more/less button is
 * interactive" AND "hashtags #e0f1ff, hover underline". A hover underline on a
 * hashtag is an interactivity claim, and a hashtag link is tappable caption
 * text — which is precisely what spec §6.1's expander contract forbids, and
 * that contract encodes a defect that has shipped three times.
 *
 * Behaviour wins per the authority split, so hashtags take the design's COLOUR
 * and stay inert spans: no href, no hover underline, no pointer-events opt-in.
 * The visual result is the design's at rest and differs only on hover.
 * Carried into the change log as a question for Aman.
 *
 * Built by tokenising the ALREADY-ESCAPED caption text and appending real text
 * nodes and spans — never by parsing markup (§12). */
.sbi-qs-tag {
	color: #e0f1ff;
}

/* ── First-run swipe coach (rule 1.9) ────────────────────────────────────── *
 * The ONLY onboarding overlay that ships, and it replaces the four-row intro
 * card outright. Aman retracts his own earlier proposal in the walkthrough — "I
 * know I added four instructions, so I'm just kind of trying to minimize what
 * we tell them… a lot of it can just be noticed from how they use Instagram" —
 * and the final design keeps exactly two hints: this one, and the unmute label
 * on the mute button. No pause hint, no desktop swipe hint, no keyboard hint
 * card, no "reset hint" button (that one is a dev aid).
 *
 * TOUCH ONLY and FIRST RUN ONLY: desktop has visible chevrons and a cursor, so
 * it needs no swipe instruction. Gated in JS on the same input-capability probe
 * this file's chevrons use, and persisted in localStorage under a
 * plugin-namespaced key so it shows once ever rather than once per session.
 *
 * `pointer-events: none` is not optional here: this is a full-frame layer above
 * the gesture layer, so without it the very swipe it is teaching would be
 * swallowed. Dismiss listeners are armed 350ms AFTER open so the tap that
 * opened the viewer cannot dismiss it before it is read.
 */
.sbi-qs-coach {
	position: absolute;
	inset: 0;
	z-index: 9;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.35);
	pointer-events: none;
}
.sbi-qs-coach-visible {
	display: flex;
}
.sbi-qs-coach-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	font-size: 15px;
	font-weight: 600;
	line-height: 19.5px;
	text-align: center;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}
.sbi-qs-coach-hand {
	width: 44px;
	height: 64px;
	animation: sbiQsSwipe 1.4s ease-in-out infinite;
}

/* ── Keyframes ───────────────────────────────────────────────────────────── */
@keyframes sbiQsSpin {
	to { transform: rotate(360deg); }
}
@keyframes sbiQsFlashIn {
	0%   { opacity: 0; transform: scale(0.3); filter: blur(4px); }
	100% { opacity: 1; transform: scale(1);   filter: blur(0);   }
}
@keyframes sbiQsFlashOut {
	0%   { opacity: 1; transform: scale(1);   filter: blur(0);   }
	100% { opacity: 0; transform: scale(0.8); filter: blur(4px); }
}
@keyframes sbiQsSwipe {
	0%   { transform: translateY(18px);  opacity: 0.35; }
	45%  { transform: translateY(-26px); opacity: 1; }
	100% { transform: translateY(18px);  opacity: 0.35; }
}

/* ══════════════════════════════════════════════════════════════════════════
 * EVERY @media BLOCK LIVES BELOW THIS LINE. Nothing top-level may follow.
 * The geometry suites read `stripCssComments(css).split('@media')[0]`, so a
 * rule placed after the first @media is invisible to them and reads as missing.
 * ══════════════════════════════════════════════════════════════════════════ */

/* ── Desktop layout (rule 1.2: input capability, NEVER width) ────────────── *
 * "Desktop" is a pointer that hovers and is fine, full stop. Everything in here
 * is either something that needs a mouse (chevrons, tooltips) or a layout that
 * only makes sense when there is room beside the frame (the rail column, the
 * top-row CTA pill). The reference expresses all of it as `max-width: 768px`
 * branches; not one of those thresholds ships.
 */
@media (hover: hover) and (pointer: fine) {
	.sbi-qs-overlay {
		/* Rule 1.13 — the host page stays faintly visible behind the blur,
		 * which is Aman's stated intent. `color-mix` second so a browser
		 * without it keeps the plain rgba above; both compute to the same
		 * 82% black over the desktop backdrop. */
		background: rgba(0, 0, 0, 0.82);
		background: color-mix(in srgb, #000 82%, transparent);
		-webkit-backdrop-filter: blur(14px);
		backdrop-filter: blur(14px);

		--sbi-qs-stage-radius: 8px;
		--sbi-qs-rail-w: 44px;
		--sbi-qs-stage-gap: 16px;
		/* Half of rail + gap. Rule 1.1 centres the frame and the rail column
		 * TOGETHER, so the frame's centre sits this far left of the window's. */
		--sbi-qs-frame-shift: 30px;
		/* Half the painted frame's width, as a CONTINUOUS clamp rather than a
		 * breakpoint (rule 1.2). Derivation, so the three numbers are checkable:
		 * the frame is `viewport height - 16px` tall (8px top and bottom
		 * margins) at 9:16, and can never be wider than the space left after
		 * the rail column and the stage gap — so
		 *   half = min(50vw - 30px, (50vh - 8px) * 9 / 16).
		 * At 1440x900: min(690, 248.625) = 248.625, frame 497.25 x 884 at
		 * x = 441.375. The 9 / 16 here MUST stay the ratio .sbi-qs-media sizes
		 * with; a test asserts every occurrence in this file agrees.
		 * vh-then-dvh pair, as everywhere. */
		--sbi-qs-stage-half: min(calc(50vw - 30px), calc((50vh - 8px) * 9 / 16));
		--sbi-qs-stage-half: min(calc(50vw - 30px), calc((50dvh - 8px) * 9 / 16));
	}

	/* Rule 1.4 — (16, 16) on desktop, (12, 12) on touch. */
	.sbi-qs-close {
		top: 16px;
		left: 16px;
	}

	/* Rule 1.1 — the framed 9:16 stage. `right` reserves the rail column plus
	 * the stage gap, and `margin: auto` then centres the frame inside what is
	 * left, which puts its centre at `50vw - frame-shift`. No transform. */
	.sbi-qs-media,
	.sbi-qs-framechrome {
		right: calc(var(--sbi-qs-rail-w) + var(--sbi-qs-stage-gap));
		height: calc(100vh - 16px);
		height: calc(100dvh - 16px);
		width: min(calc(100vw - var(--sbi-qs-rail-w) - var(--sbi-qs-stage-gap)), calc((100vh - 16px) * 9 / 16));
		width: min(calc(100vw - var(--sbi-qs-rail-w) - var(--sbi-qs-stage-gap)), calc((100dvh - 16px) * 9 / 16));
	}

	/* Rule 1.5 — no need to clear the window close button here; it is far to
	 * the left of the frame on any desktop viewport. */
	.sbi-qs-top {
		padding: 14px 14px 0 16px;
	}

	/* Rule IG-6 — the CTA is a top-row pill on desktop, a rail item on touch. */
	.sbi-qs-view-on-ig {
		display: inline-flex;
	}
	.sbi-qs-act-view {
		display: none;
	}

	.sbi-qs-nav {
		display: flex;
	}

	/* Rule 1.3 — the rail column moves OUTSIDE the frame, 16px to its right,
	 * bottom-aligned with the frame. `right` is the frame's own left inset:
	 * because the frame + gap + rail trio is centred, the trio's two outer
	 * insets are equal, so the rail column's right inset IS
	 * `50% - frame-shift - stage-half`. One expression, checkable by symmetry,
	 * and shared with .sbi-qs-nav. */
	.sbi-qs-railcol {
		right: calc(50% - var(--sbi-qs-frame-shift) - var(--sbi-qs-stage-half));
		left: auto;
		bottom: 8px;
		width: var(--sbi-qs-rail-w);
	}
	.sbi-qs-rail {
		gap: 18px;
		padding-bottom: 18px;
	}
	/* 26px desktop, 28px touch (rule IG-2) — the touch value is the base. */
	.sbi-qs-act svg {
		width: 26px;
		height: 26px;
	}

	/* Rule IG-4 — the rail is outside the frame here, so the bottom row needs
	 * no gutter reserved for it. */
	.sbi-qs-bottom {
		padding-right: 16px;
	}

	/* ── Tooltips (rule 1.9, spec §2.2) ──────────────────────────────────────
	 * On close and the two chevrons ONLY. The reference already gates its
	 * tooltips on this exact query, so the idiom is his; what this block adds
	 * is that no other control gets one — no pause hint, no swipe hint.
	 *
	 * All three sit at the design's `data-tip-pos="right"`: close is at the
	 * window's top-left and the chevrons are right of the frame, so in both
	 * cases the label has room outward. The attribute is namespaced
	 * (`data-sbi-qs-tip`) rather than the reference's bare `data-tip`, which is
	 * a name a host theme or another plugin could plausibly already use on the
	 * page.
	 *
	 * `::after` on a flex container would become a flex item; `position:
	 * absolute` takes it out of flow, and `pointer-events: none` keeps a
	 * tooltip that overhangs a sibling from stealing its clicks.
	 */
	[data-sbi-qs-tip]::after {
		content: attr(data-sbi-qs-tip);
		position: absolute;
		top: 50%;
		left: calc(100% + 10px);
		transform: translateY(-50%) translateX(4px);
		padding: 6px 9px;
		border: 1px solid rgba(255, 255, 255, 0.08);
		border-radius: 6px;
		background: rgba(28, 28, 30, 0.96);
		color: #fff;
		font-size: 12px;
		font-weight: 500;
		line-height: 12px;
		white-space: nowrap;
		box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
		z-index: 30;
		opacity: 0;
		pointer-events: none;
		transition: opacity 120ms ease, transform 120ms ease;
	}
	[data-sbi-qs-tip]:hover::after,
	[data-sbi-qs-tip]:focus-visible::after {
		opacity: 1;
		transform: translateY(-50%) translateX(0);
	}
}

/* ── Reduced motion (§3.2: motion REMOVED entirely, not shortened) ───────── *
 * Last block in the file so it wins over the capability block above regardless
 * of specificity, and `!important` on the animations for the same reason.
 *
 * ── .sbi-qs-progress-fill is DELIBERATELY ABSENT ────────────────────────────
 * Its 250ms linear transition is not decoration: it interpolates between the
 * 250ms state samples §6.1 requires, and removing it makes the bar step in
 * visible jumps rather than sit still. A progress bar that advances IS the
 * content. The one motion here nobody asked for — the rewind on a slide change
 * — is already suppressed by .sbi-qs-progress-fill-jump for exactly that write.
 */
@media (prefers-reduced-motion: reduce) {
	.sbi-qs-track {
		transition: none !important;
	}
	.sbi-qs-overlay,
	.sbi-qs-close,
	.sbi-qs-mute,
	.sbi-qs-mute-label,
	.sbi-qs-nav-prev,
	.sbi-qs-nav-next,
	.sbi-qs-view-on-ig,
	.sbi-qs-follow,
	.sbi-qs-author,
	.sbi-qs-act,
	.sbi-qs-spinner {
		transition: none;
	}
	/* ── The rail's drag-follow is NOT removed here, only its snap ────────────
	 * §3.2 is about motion the visitor did not ask for. A drag is direct
	 * manipulation they are performing themselves, so the rail keeps following
	 * the finger 1:1 — it just gets there with no transition, which is what
	 * `transition: none` produces for a transform written every frame anyway.
	 * The RELEASE snap is the animated case and it is the one that goes.
	 *
	 * setRailTravel() already refuses to animate under reduced motion, so this
	 * is the belt to that braces: the JS writes `transition-duration` inline
	 * (which beats any stylesheet rule), and this covers the case where a future
	 * caller forgets. TikTok's rail resolves to exactly the same behaviour. */
	.sbi-qs-railcol {
		transition: none;
	}
	/* The pause glyph's bloom and dissolve and the coach hand's swipe loop are
	 * both motion the visitor did not ask for. The glyph still APPEARS and
	 * still reports the paused state — only the animation goes, which is the
	 * §3.2 distinction between removing motion and removing information.
	 *
	 * .sbi-qs-spinner is DELIBERATELY NOT here. A stopped spinner is
	 * indistinguishable from a hung one, so removing its rotation would replace
	 * a small piece of essential state feedback with a misleading one. It is
	 * 36px, centred, and rotational rather than translational — the shape of
	 * animation reduced-motion guidance consistently exempts. */
	.sbi-qs-flash svg,
	.sbi-qs-coach-hand {
		animation: none !important;
	}
	.sbi-qs-overlay[data-paused="false"] .sbi-qs-flash-on {
		display: none;
	}
	[data-sbi-qs-tip]::after {
		transition: none;
	}
}
