/**
 * SR Product 360° View — frontend viewer styles.
 *
 * Loaded only on pages that render a viewer (see Frontend\Assets). Holds the
 * gallery 360 badge styling (task 043) now that a frontend stylesheet exists; the
 * viewer stage / popup styles are added with their markup in Phase 5 (045+).
 */

/* ---- Viewer container (task 045) ---------------------------------------- */

/* Sizing + positioning wrapper (task 081): holds the SpriteSpin container plus the
   a11y instruction + live region, which must sit OUTSIDE the container SpriteSpin
   empties on boot. */
.sr360-viewer-wrap {
	position: relative;
	margin: 0 auto;
}

.sr360-viewer {
	position: relative;
	width: 100%;
	margin: 0 auto;
	touch-action: pan-y;
}

.sr360-viewer__poster {
	display: block;
	width: 100%;
	height: auto;
}

.sr360-viewer:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* SpriteSpin builds .spritespin-stage / a <canvas> inside the container. */
.sr360-viewer .spritespin-stage,
.sr360-viewer canvas.spritespin-canvas {
	display: block;
	width: 100%;
	touch-action: none;
}

/* Drag affordance. The grab cursor covers the WHOLE viewer, not just the canvas: a drag
   started anywhere in the element rotates the spin (including the letterbox margin around
   a frame whose aspect differs from the viewer), so the cursor should say so. The
   --draggable class is added by viewer.js/popup.js ONLY when a pointer-rotation plugin
   (drag or hover) is actually active, so the cursor never promises a dead interaction. */
.sr360-viewer--draggable,
.sr360-popup__stage--draggable,
.sr360-popup__stage--draggable canvas.spritespin-canvas {
	cursor: grab;
}

.sr360-viewer--draggable:active,
.sr360-popup__stage--draggable:active,
.sr360-popup__stage--draggable:active canvas.spritespin-canvas {
	cursor: grabbing;
}

/* The closed hand for the whole of a popup drag (card 263). The :active rule above ends at the
   picture's edge, but a drag now starts on the band and carries on over the backdrop, so popup.js puts
   this class on the popup root from the press to the release and the cursor stays closed everywhere
   in the popup, the controls included. !important because the close button and the controls set their
   own cursor, and it only ever applies while a button is held. */
.sr360-popup--dragging,
.sr360-popup--dragging * {
	cursor: grabbing !important;
}

/* ---- Popup / lightbox (task 047) ---------------------------------------- */

.sr360-popup {
	position: fixed;
	inset: 0;

	/*
	 * ⛔ THE MAXIMUM, DELIBERATELY, AND NOT AS A FLOURISH.
	 *
	 * This was 100000 and it lost. Click-to-Chat — on a very large number of WooCommerce
	 * stores — sits at 99999999, so its WhatsApp bubble painted over a FULLSCREEN MODAL and
	 * swallowed the Zoom button: `document.elementFromPoint()` at the button's own centre
	 * returned the chat widget, not our control. On a phone the button was visible and
	 * completely untappable, which is the worst combination there is.
	 *
	 * Picking a bigger number is an arms race, and normally the wrong instinct. It is right
	 * here for one reason: while a modal is open, nothing else on the page should be
	 * interactive. That is what "modal" means. A cookie bar, a back-to-top arrow or a chat
	 * bubble floating over it is a bug in every case, not only ours.
	 *
	 * The custom property is the escape hatch — a site that genuinely needs something above
	 * this can set --sr360-popup-z rather than fight us with !important.
	 *
	 * ⚠ THE DURABLE FIX IS NOT A NUMBER. A native <dialog> opened with showModal() is placed
	 * in the browser's TOP LAYER and cannot be painted over at any z-index. The popup is a div
	 * with role="dialog" today; moving it would also hand us focus-trapping and Escape for
	 * free, replacing code we currently maintain. That is a bigger change than the bug
	 * warrants right now, but it is the answer if this ever recurs.
	 */
	z-index: var( --sr360-popup-z, 2147483647 );
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.sr360-popup[hidden] {
	display: none;
}

.sr360-popup--blur {
	-webkit-backdrop-filter: blur( 6px );
	backdrop-filter: blur( 6px );
}

.sr360-popup__dialog {
	position: relative;
	/* Centres the stage when it is narrower/shorter than the dialog — which is the
	   case once the stage is sized to the frames' aspect contained inside the dialog
	   (task 131). The close button and controls bar are absolutely positioned, so the
	   stage is the only in-flow child and this cannot disturb them. */
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 96vw;
	max-height: 92vh;
	max-height: 92dvh;
	/* White unless a Popup background colour is configured — this is the band around the
	   spin when the frame's shape differs from the popup's. */
	background: var( --sr360-bg, #fff );
	border-radius: 4px;
	box-shadow: 0 10px 40px rgba( 0, 0, 0, 0.45 );
	overflow: hidden;
}

.sr360-popup--light .sr360-popup__dialog {
	box-shadow: 0 10px 40px rgba( 0, 0, 0, 0.25 );
}

/* While the frames are being probed in percent mode the dialog is sized from a stand-in
   aspect, so it stays invisible until the probe has set its real width (card 273). The
   overlay itself shows at once. */
.sr360-popup--sizing .sr360-popup__dialog {
	visibility: hidden;
}

/* The box the stage is fitted into (task 131). Sized in JS to the frames' aspect
   contained inside the dialog; SpriteSpin owns the stage's own inline size, so the
   constraint has to live on a wrapper it does not touch. Defaults to filling the
   dialog, which is the pre-fit behaviour. */
.sr360-popup__fit {
	position: relative;
	width: 100%;
	height: 100%;
}

.sr360-popup__stage {
	position: relative;
	width: 100%;
	/*
	 * ⛔ RESERVE SPACE FOR THE CHROME INSTEAD OF PAINTING IT OVER THE PRODUCT.
	 *
	 * The controls bar and the close button are absolutely positioned over the stage.
	 * Whenever the frame fills the stage's height — the normal case for a square product
	 * shot — the bar sat ON the product: measured at 9% of it on a 900x560 desktop popup
	 * and 13% on a landscape phone. On the reported set that strip is exactly where the
	 * bottle's base is, so the product read as cut off.
	 *
	 * Padding is the fix rather than shrinking the frame in JS, because the frame is
	 * already contain-sized against whatever box it is given: make the box shorter and
	 * the spin re-fits itself, still centred, still undistorted, still uncropped. No
	 * magic numbers and nothing for the sizing race to get wrong.
	 *
	 * Top AND bottom, equally, for two reasons: the close button occupies the top corner
	 * the same way the bar occupies the bottom, and padding only one side would push the
	 * product off-centre — which looks like a bug even though nothing is covered.
	 *
	 * The cost is honest: the spin is about 10% smaller. Never covering the subject is
	 * worth more than 10% of its size, and an empty band was always the deliberate
	 * behaviour here (frames are contained, never cropped).
	 */
	/*
	 * ⛔ MARGIN + A SHORTER HEIGHT, NOT PADDING. Padding was the obvious spelling and it
	 * only half worked: SpriteSpin measures the STAGE ELEMENT and writes explicit pixel
	 * sizes onto its own children, so a padded stage still reported its full height and
	 * the spin was still drawn 560px tall inside a 440px content box — the bar covered
	 * the product exactly as before on desktop, while mobile happened to look fixed
	 * because its frame was width-constrained anyway. Shrinking the element itself is
	 * what SpriteSpin actually reads.
	 */
	height: 100%;
}

/* Let the spin canvas scale with the dialog (e.g. on resize / fullscreen). */
.sr360-popup__stage .spritespin-stage,
.sr360-popup__stage canvas.spritespin-canvas {
	max-width: 100%;
	max-height: 100%;
}

/* ---- Loading progress bar (SpriteSpin 'progress' plugin) ----------------- */

/* SpriteSpin's progress plugin injects `.spritespin-progress` (a percentage label +
   a fill bar) into the viewer while frames download, but ships no CSS — so without
   these rules it renders invisibly and a large 360 set just shows a blank stage until
   every frame is in. Give it a centred overlay with a track + fill and the live
   percentage. Applies to both the inline viewer (.sr360-viewer) and the popup stage
   (.sr360-popup__stage) — the two elements SpriteSpin boots on. The track is a
   content-box-clipped background strip (the middle 62%, set by the horizontal padding);
   the fill bar's inline width % is then measured against that same 62%, so 0–100% maps
   onto the rail exactly.

   Visibility is driven by the `loading` class SpriteSpin puts on the viewer while it
   preloads (see the rule below) — NOT by the plugin's own jQuery fadeIn()/fadeOut().
   Those two effects QUEUE, so on a cached/instant load the plugin fades the bar fully
   in and then out (~800ms) over the already-revealed spin, even though nothing was
   loading. Masking it with a `visibility` gate keyed off the `loading` class (below)
   makes the bar appear only during a real wait and vanish the instant it ends. */
.spritespin-progress {
	position: absolute;
	inset: 0;
	z-index: 4;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: center;
	box-sizing: border-box;
	padding: 0 19%;
	overflow: hidden;
	background:
		linear-gradient( rgba( 0, 0, 0, 0.14 ), rgba( 0, 0, 0, 0.14 ) ) content-box no-repeat center / 100% 8px,
		rgba( 255, 255, 255, 0.92 );
	color: #1e1e1e;
	pointer-events: none;
	/* Hidden by default; revealed only by the grace animation below. `visibility` is used
	   because the progress plugin never sets it (it only animates opacity/display), so this
	   cleanly overrides the plugin's queued fadeIn/fadeOut — those flash a full bar on a
	   cached/instant load even though nothing is loading. */
	visibility: hidden;
}

/* Reveal the bar only after SpriteSpin has been in its `loading` state for a grace period
   (~150ms). A cached/instant load adds then removes `loading` within a few ms — far under
   the delay — so the animation never reaches its visible keyframe and the bar never shows.
   An ANIMATION (not a transition) is required: `loading` is already on the viewer when the
   plugin creates the element, so there is no post-birth state change for a transition to
   catch, whereas an animation-delay is honoured from the element's birth. The global
   prefers-reduced-motion rule (bottom of this file) squashes the 0.01s duration but leaves
   the 0.15s delay intact, so the grace still holds without any motion. */
/* Variation-switch treatment (task 217): applied by variations.js the instant a
   variation is chosen, BEFORE the manifest fetch — so the shopper is never looking at
   the previous variation's spin as if it were current, and never at a bare blank box
   while the reboot's frame-aspect probe runs. A dim over whatever is there, plus an
   indeterminate bar on the same rail geometry as the card-095 percentage bar below, so
   the hand-off from one to the other reads as a single continuous loading state. */
.sr360-viewer--switching {
	position: relative;
}

.sr360-viewer--switching::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 5;
	background: rgba( 255, 255, 255, 0.72 );
	pointer-events: none;
}

.sr360-viewer--switching::after {
	content: "";
	position: absolute;
	top: 50%;
	inset-inline-start: 19%;
	inset-inline-end: 19%;
	height: 8px;
	margin-top: -4px;
	z-index: 6;
	background:
		linear-gradient( 90deg, transparent, rgba( 30, 30, 30, 0.55 ) 35%, rgba( 30, 30, 30, 0.55 ) 65%, transparent ) no-repeat 0 0 / 40% 100%,
		rgba( 0, 0, 0, 0.14 );
	pointer-events: none;
	animation: sr360-switch-sweep 1.1s linear infinite;
}

@keyframes sr360-switch-sweep {
	from { background-position: -40% 0, 0 0; }
	to   { background-position: 140% 0, 0 0; }
}

@keyframes sr360-progress-reveal { to { visibility: visible; } }
.sr360-viewer.loading .spritespin-progress,
.sr360-popup__stage.loading .spritespin-progress {
	animation: sr360-progress-reveal 0.01s linear 0.15s forwards;
}

.spritespin-progress-label {
	position: absolute;
	inset-inline: 0;
	top: 50%;
	margin-top: -30px;
	text-align: center;
	font: 600 15px/1 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.03em;
}

.spritespin-progress-bar {
	align-self: flex-start;
	min-width: 8px;
	height: 8px;
	border-radius: 999px;
	background: #2271b1;
	/* Smooth the per-frame width jumps into a continuous fill. */
	transition: width 0.18s ease;
}

/* Auto-fullscreen (task 048): the dialog fills the viewport. */
.sr360-popup--fullscreen {
	padding: 0;
}

/*
 * ⛔ dvh, NOT vh — this is the whole reason the controls were invisible on a real phone.
 *
 * On iOS Safari and Chrome for Android, `100vh` is the LARGEST viewport: the height the
 * page would have with the browser's toolbars hidden. Those toolbars are drawn OVER the
 * page, so a 100vh element extends underneath them — and anything pinned to its bottom
 * edge, which is exactly where the controls bar lives, is behind the browser's own UI and
 * cannot be seen or tapped.
 *
 * ⛔ NO EMULATOR REPRODUCES THIS. Headless Chrome and DevTools device mode have no browser
 * chrome at all, so every measurement says the bar is visible, on screen, opaque and
 * within the viewport — and it is, in a window that has no toolbars. The owner reported it
 * twice from a real phone while the tests stayed green. Believe the phone.
 *
 * `100dvh` is the DYNAMIC viewport height: it tracks the area actually visible right now
 * and shrinks when the toolbars are shown. The plain `vh` line stays first as the fallback
 * for anything that does not understand dvh (pre-15.4 iOS), where the old behaviour is no
 * worse than it was.
 */
.sr360-popup--fullscreen .sr360-popup__dialog {
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	max-width: 100vw;
	max-height: 100vh;
	max-height: 100dvh;
	border-radius: 0;
}

/*
 * ⛔ THE POPUP COVERS THE WHOLE WINDOW ON A PHONE, and that is deliberate (card 205 reverted).
 *
 * Card 205 asked why a portrait phone showed a 390x390 stage inside an 844px-tall dialog — 54%
 * of the screen as empty band. I answered it by shrinking the dialog onto the image. That was
 * the wrong half of the problem: the owner wants the window filled, because a tall product
 * photographed tall SHOULD get the height, and a lightbox that hugs a small square reads as a
 * broken page rather than a deliberate one.
 *
 * The real answer is to make the IMAGE bigger, not the window smaller, and that is a per-product
 * judgement (fill the window vs fit the product) rather than something CSS can decide here. It
 * is carded as a future setting. Until then: full window, as it always was.
 */

/*
 * THE BUTTON IS A STILL TARGET AND ITS FACE IS A ::after THAT SPINS (card 253; the spin itself was
 * corrected by card 266).
 *
 * The owner asked for "a very smooth transition of that rotation when mouse hovers on the close
 * button". Card 253 first read that as a turn round the vertical axis, like a product on a
 * turntable. The owner meant a spin in the plane of the screen (2026-10-20): "a 360 degree
 * rotation clockwise, so the icon looks spinning. not like a coin flip", and then, the same day,
 * "sorry make it rotate anticlockwise". The direction is his choice and it is ANTICLOCKWISE, and
 * after seeing a half turn and a full turn side by side on staging he chose the half turn ("Yes,
 * this is what I wanted, the half spin of close icon"). So on hover the face makes half a turn
 * anticlockwise, like a wheel, in 0.6s, and on mouse-out it turns back clockwise over the same
 * 0.6s. Keep it in that plane, that direction and that amount.
 *
 * Why the face is a ::after and not the button. This was measured while the turn was still the
 * vertical-axis one, and it is why the structure stays: turning the BUTTON is the obvious way to do
 * it and was the wrong one. A box rotated to 90 degrees about that axis is edge-on: its projected
 * width is 0, so a pointer resting anywhere but dead centre is no longer over it, `:hover` drops,
 * the transition reverses, `:hover` comes back a frame later, and the turn judders. Measured in
 * Chrome 152 with the button itself rotating, five runs each: pointer dead centre, clean; pointer
 * 9px off-centre and still, the transition was cancelled mid-turn every time (1 to 4 times); hand
 * wandering about, `:hover` flipped 20 times and the turn never got past 63 degrees.
 *
 * So the button never moves (same box, same inline size from popup.js, same 44px floors, same
 * invisible ::before touch area, same keyboard ring, which must NOT turn) and the face it paints is
 * a ::after that does. A pseudo-element belongs to its button for hit testing, so the pointer always
 * has a still target under it. Measured again for the spin in the plane (Chrome 152, pointer 9px
 * off-centre and still, every frame of the turn in): `:hover` never dropped and elementFromPoint
 * answered "the button" on every frame. Over the whole cycle the button saw one mouseover going in
 * and one mouseout going out, nothing between, and `:hover` did not flicker on the way out. A spin
 * in the plane never goes edge-on, so the stray mouseout/mouseover pair that the vertical-axis turn
 * caused is gone too.
 *
 * That is why the button's own background is transparent in every state, and why the face
 * (colour, image, size, halo) is declared on ::after here and again in the theme-proofing block
 * near the end of this file.
 */
.sr360-popup__close {
	position: absolute;
	top: 8px;
	inset-inline-end: 8px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	line-height: 1;
	font-size: 20px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
}

/*
 * The face: the same box and the same circle as the button.
 *
 * The REST transform is spelled out, `rotate( 0deg )`, instead of being left as `none`, on purpose:
 * two rotate() values interpolate function by function, so the angle runs from 0 to -180 as a real
 * turn whatever the engine. Measured in Chrome 152 while the turn was still a full one, a rest of
 * `none` interpolated too (the spec reads `none` as the identity of the other list), so this is
 * insurance rather than a fix: it keeps the intent explicit.
 *
 * The sign is the direction: a positive angle is clockwise on screen, a negative one is
 * anticlockwise. The owner chose anticlockwise and half a turn (2026-10-20), hence -180deg.
 *
 * The standard × glyph looks the same at 180 degrees as at rest, so with the default icon the half
 * turn reads as a quick turn that settles; an asymmetric custom close image shows the half turn in
 * full. The owner saw both on staging before choosing.
 *
 * The transition lives on this rest rule, not on the hover rule, so leaving the button turns the
 * face back (clockwise, from -180 to 0) over the same 0.6s.
 */
.sr360-popup__close::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background-repeat: no-repeat;
	background-position: center;
	transform: rotate( 0deg );
	transition: transform 0.6s ease-in-out;
}

/*
 * The turn, and only where something can hover. A phone or tablet has no pointer to hover with, so
 * the turn could only ever fire as a side effect of the tap that closes the popup (touch browsers
 * emulate `:hover` on a tap and can leave it stuck on). `hover: none` devices keep the still face
 * they have always had: measured with a touch emulation and a real pointer over the button, `:hover`
 * matched and the face still did not turn.
 *
 * `:hover` only. Nothing on `:focus` or `:active`: a keyboard user gets the ring and no turn.
 * Nothing in the theme-proofing block writes `transform` on the ::after either, so this
 * (0,2,2) selector only has to beat the (0,1,1) rest rule above it.
 */
@media ( hover: hover ) {
	button.sr360-popup__close:hover::after {
		transform: rotate( -180deg );
	}
}

/*
 * ⛔ CONTRAST AND TAP TARGET (card 206). The owner reported "the close button is not there" from
 * a phone. It was there — in the DOM, on screen, nothing covering it — but at 32px and 60% black
 * it reads as a faint grey smudge in the corner of a WHITE stage, which is what most product
 * shots are. Present is not the same as findable.
 *
 * ⚠ AND THE AUTOMATED PASS SAID IT LOOKED FINE, because a screenshot taken after a programmatic
 * .click() shows a focus ring that a real tap never draws. That blue outline was doing the work
 * the button's own styling should have been doing.
 *
 * The ring is what separates it from the background, whatever the background is: white halo for
 * a light stage, dark shadow for a dark one. Not applied to .has-image, where the site owner has
 * chosen their own icon and a halo we invented would fight it.
 *
 * Since card 253 the halo is the box-shadow of the FACE (the ::after), not of the button, so it
 * turns with the face instead of staying behind as a ring round nothing.
 */
.sr360-popup__close:not( .has-image )::after {
	box-shadow:
		0 0 0 2px rgba( 255, 255, 255, 0.9 ),
		0 1px 5px rgba( 0, 0, 0, 0.4 );
	/*
	 * The BUILT-IN close icon (owner, 2026-09-02): the bundled close.svg is the default
	 * face of this button in BOTH editions — the text glyph the JS still writes stays in
	 * the DOM as the accessible name and the forced-colors fallback, but paints
	 * transparent under the image. A site owner choosing their own image (premium)
	 * switches to .has-image, which never enters this rule; clearing it returns HERE —
	 * to the bundled icon, never to the bare text glyph.
	 * Relative url resolves against THIS FILE, so no PHP hands the asset URL around.
	 * 62% keeps the mark clear of the halo ring at every close_button_size.
	 */
	background-color: #fff;
	background-image: url( img/close.svg );
	background-size: 62%;
}

/* The glyph the JS writes stays the accessible name and paints transparent under the face. */
.sr360-popup__close:not( .has-image ) {
	color: transparent;
}

/*
 * Forced-colors (Windows High Contrast): see the block at the END of this file. It had to
 * move there — the theme-proofing section below raises every control's specificity, and a
 * forced-colors override that loses to our own hardening is worse than none at all.
 */

/*
 * A 44px minimum tap target on touch devices — and, since the owner's ruling of 2026-10-07,
 * a 44px minimum VISIBLE button with it. The ::before below made the TARGET 44px while the
 * circle stayed at close_button_size (32 by default), which a phone-width pass measures as
 * 32 × 32 and a shopper reads as a smudge on a white stage.
 *
 * min-width/min-height are a FLOOR, not a size: popup.js writes close_button_size as an
 * INLINE width/height, and a used width is clamped to its own min-width, so a larger chosen
 * size still wins and only an undersized one is lifted. The ::before stays — it is what
 * reaches 44px on a coarse pointer whatever the circle ends up being.
 *
 * 44px is the usual accessibility floor for a touch target, and this button is the only way out
 * of a fullscreen modal — the worst possible control to make people aim at.
 *
 * Both conditions, as .sr360-expand uses lower down: a phone-width viewport is what the UI
 * pass measures, and `pointer: coarse` catches the tablet held in landscape at 1024px.
 */
@media screen and ( max-width: 782px ), ( pointer: coarse ) {
	.sr360-popup__close {
		min-width: 44px;
		min-height: 44px;
	}
}

@media ( pointer: coarse ) {
	.sr360-popup__close {
		top: 12px;
		inset-inline-end: 12px;
	}

	/* UI verifier D11 (found while fixing the gallery badge's own ::before, card 248b):
	   the same logical/physical mix was already here. `inset-inline-start: 50%` flips to
	   `right: 50%` under `direction: rtl`; `transform: translate( -50%, -50% )` does not,
	   so the box would slide half its own width off-centre whenever the popup inherits
	   RTL from the page (nothing here sets its own `direction`). This circle is square, so
	   `min-width`/`min-height: 44px` plays the same role a fixed `44px` did: the button is
	   already >= 44 x 44 via the floor above whenever this rule can apply, so the box
	   matches it exactly and would still hold the 44px floor if that ever stopped being
	   true. See the gallery badge's own comment below for the full reasoning. */
	.sr360-popup__close::before {
		content: "";
		position: absolute;
		inset-inline: 0;
		inset-block-start: 50%;
		width: auto;
		min-width: 44px;
		height: 44px;
		min-height: 100%;
		transform: translateY( -50% );
	}
}

.sr360-popup__close.has-image {
	color: transparent;
}

/*
 * The owner's own image (premium). popup.js hands it over as `--sr360-close-image`, set on the
 * BUTTON as a complete, absolute url("...") and removed again when no image is configured. It
 * used to be an inline background-image on the button; the face is the ::after now, which an
 * inline style on the button cannot reach, but a custom property inherits into it.
 *
 * Absolute on purpose, and the bundled icon above is a plain declaration rather than a var()
 * fallback on this one: a RELATIVE url() inside a custom property is resolved against a base that
 * differs between browsers (the stylesheet that uses it, or the sheet or document that set it).
 */
.sr360-popup__close.has-image::after {
	background-color: transparent;
	background-image: var( --sr360-close-image );
	/* Scale the chosen image to the button. Without this, background-size defaults to
	   `auto` and the image paints at its natural size — the media URL is the 150x150
	   thumbnail, so a 32px (default) button showed a 32px CROP from the middle of it
	   rather than the icon (task 132). `contain` keeps the whole image visible and
	   undistorted; `cover` would fill the circle but clip a non-square icon. */
	background-size: contain;
	box-shadow: none;
}

.sr360-popup__close:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* Popup controls (task 049). */
/*
 * Clear the home indicator on notched phones. `env(safe-area-inset-bottom)` is 0 on every
 * device that does not have one, so this costs nothing anywhere else — and without it the
 * bar's buttons sit under the indicator on an iPhone even once dvh has freed them from
 * the browser toolbar.
 */
.sr360-popup__controls {
	position: absolute;
	inset-inline-start: 0;
	inset-inline-end: 0;
	bottom: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 10px 14px;
	/*
	 * ⛔ AFTER the shorthand, not before it. The home-indicator clearance was declared
	 * above `padding: 10px 14px`, so the shorthand overwrote it and the inset has never
	 * reached a device: computed padding-bottom was 10px either way. Proven by swapping a
	 * literal in for env() and reading getComputedStyle — 10px as shipped, 30px reordered.
	 * env( safe-area-inset-bottom ) is 0 on every device without an indicator, so this
	 * costs nothing anywhere else.
	 */
	padding-bottom: calc( 10px + env( safe-area-inset-bottom, 0px ) );
	/*
	 * 0.45, was 0.55 (card 255; owner, 2026-10-17: "the bar could be a little more transparent").
	 * On the default white popup the bar now composites to rgb( 140 ) instead of rgb( 115 ), so a white
	 * icon straight on the bar is 3.36:1 (was 4.74:1). The icons do not sit straight on it, they sit on
	 * the buttons' own fill, and that is what .sr360-ctl below keeps at its old contrast.
	 */
	background: rgba( 0, 0, 0, 0.45 );
}

.sr360-popup__controls[hidden] {
	display: none;
}

/*
 * No font-size / line-height here since card 240: every control in this bar is now an icon
 * or a range input, so there is no text left for them to size. The three consumers are
 * .sr360-ctl--icon (play/pause, zoom) and .sr360-ctl--slider, all of which set their own box.
 */
/*
 * The fill is a 6% BLACK veil, and a 7% WHITE one on hover (card 255). It was 12% and 24% white.
 * Measured in pixels on the default white popup: with the bar at 0.45 the old white veil lifted the
 * pill from the bar's rgb( 140 ) to rgb( 154 ), and a white icon on it fell from 3.74:1 to 2.81:1,
 * under the 3:1 a graphic needs (hover 3.03:1 to 2.41:1). These two put the pill back where it was
 * before the bar changed: rgb( 131 ) at rest against 132 (3.79:1 against 3.74:1), rgb( 148 ) on hover
 * against 148 (3.03:1 both), so the buttons look as they did and only the bar around them is
 * lighter. White is the worst case for a white icon: any other popup background gives at least this
 * much contrast. The same two values are restated in the theme-proofing block at the end of the file.
 */
.sr360-ctl {
	padding: 4px 12px;
	border: 1px solid rgba( 255, 255, 255, 0.5 );
	border-radius: 3px;
	background: rgba( 0, 0, 0, 0.06 );
	color: #fff;
	cursor: pointer;
}

.sr360-ctl:hover {
	background: rgba( 255, 255, 255, 0.07 );
}

.sr360-ctl[aria-pressed="true"],
.sr360-ctl.is-on {
	background: #2271b1;
	border-color: #2271b1;
}

.sr360-ctl:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/*
 * Icon controls (card 240). Play/Pause and Zoom were text pills; they are now inline SVGs,
 * the same drawings the general-purpose SR 360 View plugin uses, so the two products read as
 * one family. The pill treatment above is kept deliberately: the icons sit on this plugin's
 * own solid dark controls bar, where the other plugin's dark translucent pill would vanish.
 *
 * Nothing here sets a colour. The path is fill="currentColor", so it inherits .sr360-ctl's
 * `color` and keeps following a theme override or forced-colors mode for free.
 */
.sr360-ctl--icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/*
	 * 44px is the accessibility floor for a touch target, and on a phone this strip is the
	 * only way to drive the spin. It never shrinks: when the bar runs out of room it is the
	 * gap and the bar's side padding that give way (see the narrow-width rule below).
	 *
	 * The bar's height is MEASURED by popup.js (measureChrome) and reserved at both ends of
	 * the stage, so a taller button moves the product rather than covering it (card 220).
	 */
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	border-radius: 999px;
}
/* The `hidden` attribute must still win over the display above: the Fullscreen button hides itself
   where it would change nothing (card 270, ui-270 D3). */
.sr360-ctl--icon[hidden] {
	display: none;
}

.sr360-ctl--icon svg {
	display: block;
	width: 18px;
	height: 18px;
	/* Clicks land on the button, never on the path — otherwise event.target is the <path>
	   and a handler that checks it misses the press. */
	pointer-events: none;
}

.sr360-ctl--slider {
	display: inline-flex;
	align-items: center;
	min-width: 140px;
}

.sr360-ctl--slider input[type="range"] {
	width: 100%;
}

/* Scroll lock applied to <body> while the popup is open. */
.sr360-noscroll {
	overflow: hidden !important;
}

/* Inline "expand to popup" control (inline_expand mode) — an icon button overlaid on
   the bottom-left of the inline viewer. The inline wrapper is positioned so the button
   anchors to the viewer's bottom-left corner (mirrors the gallery badge placement). */
.sr360-inline {
	position: relative;
}

.sr360-expand {
	position: absolute;
	inset-block-end: 10px;
	inset-inline-start: 10px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.72 );
	color: #fff;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.3 );
	transition: background 0.15s ease, transform 0.15s ease;
}

.sr360-expand:hover,
.sr360-expand:focus {
	background: #2271b1;
	transform: scale( 1.05 );
}

.sr360-expand:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.sr360-expand__icon {
	display: block;
	width: 20px;
	height: 20px;
}

/* A thumb needs 44px, and this button is 40px.
 *
 * Unlike the popup's close button a few hundred lines up, nothing lets a shop owner choose
 * this one's size, so it can set width/height outright rather than the min-* floor that
 * button needs in order to leave a larger chosen size alone. The icon inside stays 20px:
 * what was too small was the thing a thumb has to hit, not the thing an eye has to read.
 *
 * Both conditions, because neither alone is the question. A phone-width viewport is the
 * case the UI pass measured; `pointer: coarse` is the one this file already uses for the
 * close button, and it catches the tablet held in landscape at 1024px, which is a thumb at
 * a width no max-width rule would call small. */
@media screen and ( max-width: 782px ), ( pointer: coarse ) {
	.sr360-expand {
		width: 44px;
		height: 44px;
	}
}

/* ---- Inline display wrappers (task 046) --------------------------------- */

.sr360-inline--after-gallery,
.sr360-inline--tab {
	margin: 1.25em 0;
}

/* The replace-featured wrapper sits inside the gallery, so it needs no margin. */

/* ---- Gallery 360 badge — overlay chip (task 043, reworked in 075) -------- */

/* Emitted inside WooCommerce's gallery but relocated by popup.js onto the gallery
   root (which WooCommerce positions relative) as an absolutely-positioned chip —
   NOT a gallery slide. Hidden until popup.js reveals it, so a page without our JS
   never shows a dead badge. Sits bottom-left, clear of WooCommerce's top-right
   zoom trigger (fixes R2-m3). */
.sr360-gallery-badge {
	position: absolute;
	inset-block-end: 12px;
	inset-inline-start: 12px;
	z-index: 3;
	margin: 0;
}

/* Premium: the corner is a setting. These are the CSS-only baseline — popup.js then
   offsets whichever two insets the chosen corner uses, so the chip sits against the
   IMAGE's corner rather than the container's (task 126). The rules below still matter:
   they are what a page sees before JS runs, and what it keeps if JS never does.
   Each modifier clears the pair it does not use, or the base rule's bottom-left
   values would compete with the ones it sets. */
.sr360-gallery-badge--bottom-right {
	inset-inline-start: auto;
	inset-inline-end: 12px;
}

.sr360-gallery-badge--top-left {
	inset-block-end: auto;
	inset-block-start: 12px;
}

.sr360-gallery-badge--top-right {
	inset-block-end: auto;
	inset-block-start: 12px;
	inset-inline-start: auto;
	inset-inline-end: 12px;
}

/* Premium: a custom icon replaces the "360°" text. Capped so an oversized upload cannot
   take over the product image — the chip is a marker, not a banner. Height-led with
   width:auto keeps any aspect ratio undistorted, which is the same contract the viewer
   itself honours for frames. */
/*
 * The custom icon is a SPAN with a background image, never an <img> — see
 * GalleryBadge::badge_face() for why. A theme's "every image in this container" rule
 * cannot match an element that is not an image, so this needs no specificity contest
 * and no !important.
 *
 * `contain` is the load-bearing part: without an explicit background-size the image
 * paints at natural size and the box shows a 32px CROP from the middle of it — exactly
 * the bug task 132 fixed on the close button. `contain` keeps the whole icon visible and
 * undistorted whatever its shape; `cover` would fill the box and clip a non-square icon.
 */
.sr360-gallery-badge__icon {
	display: block;
	width: 48px;
	height: 32px;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
}

/* The icon carries its own shape, so the chip's pill background would frame it in a
   second, unwanted box. Strip the button's chrome when an icon is present and let the
   image be the badge. :has() is safe here — a browser without it simply keeps the pill,
   which is a cosmetic difference, not a broken badge. */
.sr360-gallery-badge__button:has( .sr360-gallery-badge__icon ) {
	padding: 0;
	background: none;
	box-shadow: none;
	border-radius: 4px;
}

.sr360-gallery-badge__button:has( .sr360-gallery-badge__icon ):hover,
.sr360-gallery-badge__button:has( .sr360-gallery-badge__icon ):focus-visible {
	background: none;
}

.sr360-gallery-badge:not( .sr360-gallery-badge--ready ) {
	display: none;
}

/* A theme gallery the badge was re-hosted onto (task 216): the badge is absolute, so
   the host must establish the positioning box. Applied by JS only when the host was
   position:static — an already-positioned host is left exactly as the theme made it. */
.sr360-badge-host {
	position: relative;
}

/* Footer-fallback badge (task 098) with no gallery to anchor to: show it as a normal
   inline button instead of an absolutely-positioned corner chip. As of task 188 it is
   parked just above the add-to-cart form, so it reads as part of the buy box. */
.sr360-gallery-badge--standalone {
	position: static;
	inset: auto;
	display: inline-block;
	margin: 1.25em 0;
}

/* The absolute last resort (task 188): no gallery, no matched product image, no
   add-to-cart form. A fixed corner chip — ugly beats absent, and the popup it opens
   is a modal on <body> that works on any theme. Below the popup overlay's z-index so
   an open popup still covers it. */
.sr360-gallery-badge--floating {
	position: fixed;
	inset-block-end: 16px;
	inset-inline-start: 16px;
	z-index: 2147483000;
	margin: 0;
}

.sr360-gallery-badge__button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 6px 12px;
	border: 0;
	border-radius: 999px;
	background: rgba( 0, 0, 0, 0.72 );
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.5;
	letter-spacing: 0.02em;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.3 );
}

/*
 * ⛔ :focus-visible, NOT :focus. Closing the popup returns focus to this badge, which is
 * required for a modal — but with bare :focus that left the badge painted blue and looking
 * pressed long after the popup was gone. :focus-visible fires for keyboard users (who need
 * the cue) and not for the pointer/touch user who just tapped Close.
 */
.sr360-gallery-badge__button:hover,
.sr360-gallery-badge__button:focus-visible {
	background: #2271b1;
}

.sr360-gallery-badge__button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.sr360-gallery-badge__tag {
	pointer-events: none;
}

/* A thumb needs 44px, and this chip is 49.78 x 30 (card 248, UI verifier D9).
 *
 * ⛔ AN INVISIBLE ::before, NOT A BIGGER CHIP. .sr360-expand a few hundred lines up simply
 * grows to 44px because nothing lets a shop owner choose its size. This one is different:
 * the chip is the thing the owner looks at and the owner has said its look matters, so the
 * painted box must not move by a pixel. Same answer as the popup's close button: the hit
 * area grows, the circle does not.
 *
 * ⛔ AND IT MUST NEVER SHRINK THE TARGET. `min-width: 44px` is a floor, not a size:
 * `inset-inline: 0` (both logical inline insets at once) gives the box the container's own
 * width before any floor applies, so the used width is the larger of the two on each axis
 * independently: 49.78 x 30 becomes 49.78 x 44, and premium's 96 x 64 custom badge image is
 * left alone because it already clears the floor on both axes.
 *
 * ⛔ UI VERIFIER D11 (card 248b): THE FIRST VERSION CENTRED WITH ONE LOGICAL INSET AND A
 * PHYSICAL TRANSFORM, AND RTL ONLY HONOURED ONE OF THEM. It read `inset-inline-start: 50%;
 * transform: translate( -50%, -50% )` — `inset-inline-start` flips to `right: 50%` under
 * `direction: rtl` (nothing here sets its own `direction`, so the badge inherits whatever
 * the page is), but a `transform` is always physical and never flips, so the box kept
 * sliding the same way regardless of direction. In RTL that moved it one full chip-width
 * off-centre: the 44px floor landed beside the chip, over the product photo, instead of on
 * it. `inset-inline: 0` pins BOTH inline edges to the container's own edges, so the box is
 * already centred horizontally by construction, in either direction, with nothing left for
 * a transform to do — which is why only the vertical translateY survives below. Vertical
 * centring was never the bug: `block-start`/`block-end` do not flip with inline direction,
 * so `inset-block-start: 50%` + `translateY( -50% )` is the same centring `top: 50%` always
 * gave.
 *
 * The chip is the one control a shopper must hit to reach the 360° view at all on a phone,
 * which is why it gets the same floor its neighbours have had since cards 243 and 240.
 */
@media screen and ( max-width: 782px ), ( pointer: coarse ) {
	/* The containing block for the ::before. It changes no painted pixel: the button is
	   inline-flex and lays out identically either way. */
	.sr360-gallery-badge[data-sr360-badge] button.sr360-gallery-badge__button {
		position: relative;
	}

	.sr360-gallery-badge[data-sr360-badge] button.sr360-gallery-badge__button::before {
		content: "";
		position: absolute;
		inset-inline: 0;
		inset-block-start: 50%;
		width: auto;
		min-width: 44px;
		height: 44px;
		min-height: 100%;
		transform: translateY( -50% );
	}
}

/* Screen-reader-only text (instruction + the polite frame-status live region).
   Defined here rather than relying on the active theme, so the viewer's a11y
   affordances stay hidden visually on any theme. */
.sr360-viewer-wrap .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
	word-wrap: normal;
}

/* Reduced motion: the JS already suppresses SpriteSpin auto-rotation; this is a
   defensive backstop that neutralises any CSS transition/animation on our own
   viewer and popup elements. Manual (user-initiated) rotation is unaffected.

   `*` matches elements, never their pseudo-elements, so the close button's turning ::after
   (card 253) needs a selector of its own (measured: without it the ::after kept its 0.6s). Squashed
   rather than removed: the turn then ends before the first frame. With the standard × that is
   invisible, since it looks the same at 180 degrees as at rest (measured for the full turn: no
   pixel differed from rest). A custom image would sit on its half-turned face at once, so the
   hover pose is also held at rest here: the same (0,2,2) selector as the hover rule, later in
   the file, so it wins only when reduced motion is asked for. */
@media ( prefers-reduced-motion: reduce ) {
	.sr360-viewer,
	.sr360-viewer *,
	.sr360-popup,
	.sr360-popup *,
	.sr360-popup *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}

	button.sr360-popup__close:hover::after {
		transform: rotate( 0deg );
	}
}


/* =========================================================================
 * THEME-PROOFING: our storefront controls, in every state (card 247)
 * =========================================================================
 *
 * ⛔ THE BUG THE OWNER SAW. On chimayotrading.com the popup's close icon TILED into four
 * partial ×s on hover. The theme ships
 *
 *   .themebutton:hover, button:hover, html input[type="button"]:hover,
 *   input[type="reset"]:hover, input[type="submit"]:hover { color:#FFF; background:#DDAF4D }
 *
 * and `button:hover` is (0,1,1) while `.sr360-popup__close` — where background-repeat and
 * background-position live — is only (0,1,0). The theme's `background` SHORTHAND therefore
 * reset repeat to its initial `repeat` and position to `0% 0%`, and because
 * `.sr360-popup__close:not( .has-image )` is (0,2,0) it kept pinning the colour, the image
 * and the size, the icon survived at 62% of a tiling box, and the theme's `transition: .3s`
 * animated the whole thing into view. Measured locally with the theme's rules injected:
 * rest `no-repeat / 50% 50%` → hover `repeat / 0% 0%`.
 *
 * ⛔ A SHORTHAND RESETS EVERY LONGHAND IT OWNS, so pinning three of the eight background
 * longhands is not a defence. The defence is to pin the WHOLE set, in every state a theme
 * is likely to style, at a specificity the theme's unscoped element rules cannot reach.
 *
 * Why these anchors, and no `!important` (claude-memory/css-specificity-vs-themes.md):
 *
 *   .sr360-popup is appended to document.body, OUTSIDE the theme's product containers, so a
 *   selector like `.woocommerce div.product button:hover` can never match the close button
 *   or the controls bar. Only unscoped `button:hover` rules reach them, and (0,4,1) clears
 *   those by a wide margin.
 *
 *   The gallery badge and the expand button DO live inside the theme's own markup, so they
 *   take the highest counts here and anchor on an attribute PHP always writes
 *   ([data-sr360-badge], [data-sr360-popup]) rather than on a `--ready` class that JS adds
 *   later or a parent that popup.js may re-host the element into.
 *
 * Each block lists the RESTING selector alongside its state variants, so the rest state is
 * pinned at the same strength and the states cannot drift away from it: one rule, one look.
 *
 * The states are grouped with `:is()`, which carries the specificity of its most specific
 * argument — all pseudo-classes here, so `X:is( :hover, :active )` weighs exactly what
 * `X:hover` weighs and the counts quoted above still hold. Measured, not estimated: written
 * out longhand this section cost +393 B gzipped of the storefront bundle, grouped it costs
 * +329 B, against 1033 B of headroom under the 24 KB gate. `:has()` is already relied on a
 * few rules up, so `:is()` asks nothing new of the browser.
 */

/* ---- Popup close button, the BUTTON (both faces): (0,4,1) / (0,5,1) ----------
 * Card 253 moved the visible face onto ::after, so what is left to pin on the button is the
 * absence of one: transparent, no image, no halo, in every state, whatever a theme's
 * `button:hover { background: ... }` shorthand resets. `transform: none` stays and now has a
 * second job: a theme's `button:hover { transform: ... }` must not move the still target the face
 * turns over. One block for both faces because they no longer differ on the button.
 *
 * `overflow: visible` is new, and for the halo. The halo is the ::after's box-shadow now, painted
 * OUTSIDE the face's box, so a theme's `button { overflow: hidden }` (ripple effects use it)
 * clips it, and the halo is the only thing that separates a white disc from a white stage (card
 * 206). Measured with that one rule injected: the halo vanished and the red mark floated on bare
 * white. On the button's own box-shadow it was never clipped by its own overflow. */
.sr360-popup .sr360-popup__dialog button.sr360-popup__close:not( .has-image ),
.sr360-popup .sr360-popup__dialog button.sr360-popup__close.has-image,
.sr360-popup .sr360-popup__dialog button.sr360-popup__close:not( .has-image ):is( :hover, :focus, :focus-visible, :active ),
.sr360-popup .sr360-popup__dialog button.sr360-popup__close.has-image:is( :hover, :focus, :focus-visible, :active ) {
	border: 0;
	background-color: transparent;
	background-image: none;
	color: transparent;
	box-shadow: none;
	overflow: visible;
	transform: none;
	text-decoration: none;
}

/* ---- Popup close button, bundled-icon FACE (the ::after): (0,4,2) / (0,5,2) ----------
 * The one part of the button a theme's `button:hover` cannot reach, since that styles the button
 * and this is its pseudo-element. `display` IS pinned (card 276): Storefront hides every button's
 * ::after (`button::after { display: none }`, its style.css line 31), which left only an empty focus
 * ring where the close mark should be, on WooCommerce's own theme. Pinned anyway, at the strength the button's own declarations had
 * before card 253, so the card 247 tiling cannot come back by another route.
 *
 * `transform` is deliberately NOT here. The turn belongs to the base rules above, and a pin at this
 * strength would out-rank the (0,2,2) hover rule that drives it and stop the face turning. */
.sr360-popup .sr360-popup__dialog button.sr360-popup__close:not( .has-image )::after,
.sr360-popup .sr360-popup__dialog button.sr360-popup__close:not( .has-image ):is( :hover, :focus, :focus-visible, :active )::after {
	display: block;
	background-color: #fff;
	background-image: url( img/close.svg );
	background-repeat: no-repeat;
	background-position: center;
	background-size: 62%;
	box-shadow:
		0 0 0 2px rgba( 255, 255, 255, 0.9 ),
		0 1px 5px rgba( 0, 0, 0, 0.4 );
}

/* ---- Popup close button, custom-image FACE (the ::after): (0,4,2) / (0,5,2) ----------
 * background-image IS restated here, through `--sr360-close-image`. It used to be left out because
 * popup.js wrote it as an inline style on the button, which outranks any stylesheet; but the face
 * is the ::after now and an inline style on the button cannot reach it, so the image comes in as a
 * custom property, which inherits into the pseudo-element. Its repeat/position/size are in CSS,
 * which is why that face tiled too. */
.sr360-popup .sr360-popup__dialog button.sr360-popup__close.has-image::after,
.sr360-popup .sr360-popup__dialog button.sr360-popup__close.has-image:is( :hover, :focus, :focus-visible, :active )::after {
	display: block;
	background-color: transparent;
	background-image: var( --sr360-close-image );
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	box-shadow: none;
}

/* A theme's `button:focus` ring (Storefront: 2px purple) must not show after a MOUSE or TAP open:
 * popup.js focuses the close button on open, which is right for keyboard and screen-reader users
 * but drew Storefront's ring round the button for everyone else (card 276). Keyboard focus still
 * gets the plugin's own blue ring below. */
.sr360-popup .sr360-popup__dialog button.sr360-popup__close:focus:not( :focus-visible ) {
	outline: 0;
}

/* The keyboard ring, restated at the hardened strength so the blocks above cannot eat it. */
.sr360-popup .sr360-popup__dialog button.sr360-popup__close:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* ---- Popup controls bar — (0,3,1) / (0,4,1) -----------------------------
 * The two fill values (rest, hover) are .sr360-ctl's above (card 255): change them together. */
.sr360-popup .sr360-popup__controls button.sr360-ctl,
.sr360-popup .sr360-popup__controls button.sr360-ctl:is( :focus, :active ) {
	border: 1px solid rgba( 255, 255, 255, 0.5 );
	background-color: rgba( 0, 0, 0, 0.06 );
	background-image: none;
	color: #fff;
	box-shadow: none;
	transform: none;
	text-decoration: none;
}

/* Our own hover, which the theme's gold was overwriting on :focus. */
.sr360-popup .sr360-popup__controls button.sr360-ctl:hover {
	border-color: rgba( 255, 255, 255, 0.5 );
	background-color: rgba( 255, 255, 255, 0.07 );
	background-image: none;
	color: #fff;
	box-shadow: none;
	transform: none;
}

/* Pressed stays pressed, in every state — (0,4,1) / (0,5,1), above the hover rule above. */
.sr360-popup .sr360-popup__controls button.sr360-ctl[aria-pressed="true"],
.sr360-popup .sr360-popup__controls button.sr360-ctl[aria-pressed="true"]:is( :hover, :focus, :focus-visible, :active ),
.sr360-popup .sr360-popup__controls button.sr360-ctl.is-on,
.sr360-popup .sr360-popup__controls button.sr360-ctl.is-on:is( :hover, :focus, :focus-visible, :active ) {
	border-color: #2271b1;
	background-color: #2271b1;
	background-image: none;
	color: #fff;
}

/* A theme's `button:focus` ring (Storefront: 2px purple) must not show after a MOUSE click on Play,
   Zoom or Fullscreen, nor on Zoom when the lightbox hands focus back to it (card 276 rule, ui-270 D4).
   The keyboard keeps the white ring below. */
.sr360-popup .sr360-popup__controls button.sr360-ctl:focus:not( :focus-visible ) {
	outline: 0;
}
.sr360-popup .sr360-popup__controls button.sr360-ctl:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* WooCommerce's `.woocommerce-page label { margin-bottom: .7em }` (15.4px) reached this label and put the
 * pill 7.69px above the Play and Zoom centre line, and the bar at 65.39px instead of 64 (card 259). */
.sr360-popup .sr360-popup__controls label.sr360-ctl--slider {
	margin: 0;
	/* Card 285: the pill is the buttons' 44 px, border included, so the bar's height and the
	   stage reserve measured from it (card 220) do not change; the control inside fills it. */
	padding-top: 0;
	padding-bottom: 0;
}

/* Keyboard focus on the slider rings the PILL, like the buttons' own ring, instead of the
 * theme's ring on the control (Storefront's purple read 1.63:1 against the bar). */
.sr360-popup .sr360-popup__controls label.sr360-ctl--slider:focus-within {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.sr360-popup .sr360-popup__controls .sr360-ctl--slider input[type="range"]:focus-visible {
	outline: 0;
}

/* ---- Frame slider — (0,4,1) ---------------------------------------------
 * Measured: the customer theme's rules never match input[type="range"], and none of the
 * four states moved. Pinned anyway, because the next theme's `input:hover` would, and
 * because these four declarations are provably no-ops on a native range control — verified
 * by measuring the rendered box and colours before and after. Nothing here touches
 * `appearance`, so the UA keeps painting the track and the thumb. */
.sr360-popup .sr360-popup__controls .sr360-ctl--slider input[type="range"],
.sr360-popup .sr360-popup__controls .sr360-ctl--slider input[type="range"]:is( :hover, :focus, :active ) {
	border: 0;
	background-image: none;
	box-shadow: none;
	transform: none;
	/*
	 * Card 285 (sweep R-15, R-18). The native control was a 16 px tall target, on a phone too,
	 * beside 44 px buttons; it now fills its pill (44 px with the pill's 1 px borders, the label
	 * rule above drops the vertical padding), so the bar does not grow and the track still
	 * paints centred. And the control's own blue (the browser's accent) differed from the bar's
	 * pressed-button blue while the spin played; accent-color makes the thumb and the filled
	 * track the plugin's blue. appearance is still untouched, so the browser keeps drawing it.
	 */
	height: 42px;
	margin: 0;
	accent-color: #2271b1;
}

/* ---- Gallery badge button — (0,3,1) / (0,4,1) ---------------------------
 * This one sits inside the theme's gallery markup, so it carries the data attribute PHP
 * always writes as well as its classes. */
.sr360-gallery-badge[data-sr360-badge] button.sr360-gallery-badge__button,
.sr360-gallery-badge[data-sr360-badge] button.sr360-gallery-badge__button:is( :focus, :active ) {
	border: 0;
	background-color: rgba( 0, 0, 0, 0.72 );
	background-image: none;
	color: #fff;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.3 );
	transform: none;
	text-decoration: none;
}

/* Ours, and it stays: hover and the keyboard ring both go blue. */
.sr360-gallery-badge[data-sr360-badge] button.sr360-gallery-badge__button:hover,
.sr360-gallery-badge[data-sr360-badge] button.sr360-gallery-badge__button:focus-visible {
	border: 0;
	background-color: #2271b1;
	background-image: none;
	color: #fff;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.3 );
	transform: none;
}

.sr360-gallery-badge[data-sr360-badge] button.sr360-gallery-badge__button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* The icon face carries its own shape, so the chip's chrome stays stripped in every state
 * — (0,4,1) / (0,5,1), above both blocks. */
.sr360-gallery-badge[data-sr360-badge] button.sr360-gallery-badge__button:has( .sr360-gallery-badge__icon ),
.sr360-gallery-badge[data-sr360-badge] button.sr360-gallery-badge__button:has( .sr360-gallery-badge__icon ):is( :hover, :focus, :focus-visible, :active ) {
	background-color: transparent;
	background-image: none;
	box-shadow: none;
	transform: none;
}

/* The badge's own icon span: a theme's `a:hover span` would reset these longhands too. */
.sr360-gallery-badge[data-sr360-badge] span.sr360-gallery-badge__icon {
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
}

/* ---- Inline expand button — (0,3,1) / (0,4,1) ---------------------------
 * UI verifier D12: `transition` was the one property this section never pinned, and it is
 * the only hardened control whose own (pre-hardening) rule declares one at all — `background
 * 0.15s ease, transform 0.15s ease` a few hundred lines up. A theme's `button:hover
 * { transition: .3s }` is (0,1,1), which beat our un-hardened (0,1,0) and silently stretched
 * our own hover from 0.15s to 0.3s: the end state never moved, only its pace did. Restated
 * here at (0,3,1)/(0,4,1) in both blocks below so it holds in every state, the same value
 * throughout because we never vary it ourselves. Nothing else in this file defines a
 * transition on a hardened control, so nothing else needs this. */
.sr360-inline button.sr360-expand[data-sr360-popup],
.sr360-inline button.sr360-expand[data-sr360-popup]:is( :active ) {
	border: 0;
	background-color: rgba( 0, 0, 0, 0.72 );
	background-image: none;
	color: #fff;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.3 );
	transform: none;
	transition: background 0.15s ease, transform 0.15s ease;
	text-decoration: none;
}

/* Ours, and it stays: blue and a 5% lift on hover and on focus. */
.sr360-inline button.sr360-expand[data-sr360-popup]:hover,
.sr360-inline button.sr360-expand[data-sr360-popup]:focus {
	border: 0;
	background-color: #2271b1;
	background-image: none;
	color: #fff;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.3 );
	transform: scale( 1.05 );
	transition: background 0.15s ease, transform 0.15s ease;
}

.sr360-inline button.sr360-expand[data-sr360-popup]:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* ---- Forced colors, LAST ------------------------------------------------
 * Windows High Contrast can drop or flatten background images, and the one control that
 * exits a fullscreen modal must never disappear: return to the glyph in the system's own
 * colours. It lives at the end of the file, at the same strength as the hardening above and
 * after it in source order, because the hardening pins background-image and colour and
 * would otherwise win. An accessibility fallback that loses to our own CSS is worse than
 * not having one.
 *
 * Card 253: the face is the ::after now, so the button keeps ButtonFace and ButtonText as before
 * and the face has to GIVE WAY to the glyph underneath it: no image, no fill, no halo. Its
 * selectors repeat the face rules' own, state variants included, or the (0,5,2) face rule wins
 * whenever the button is hovered, pressed or FOCUSED, and popup.js focuses it the moment the popup
 * opens (measured with the variants left out: the image came back at once, before any hover). */
@media ( forced-colors: active ) {
	.sr360-popup .sr360-popup__dialog button.sr360-popup__close:not( .has-image ),
	.sr360-popup .sr360-popup__dialog button.sr360-popup__close:not( .has-image ):is( :hover, :focus, :focus-visible, :active ) {
		background-image: none;
		background-color: ButtonFace;
		color: ButtonText;
	}

	.sr360-popup .sr360-popup__dialog button.sr360-popup__close:not( .has-image )::after,
	.sr360-popup .sr360-popup__dialog button.sr360-popup__close:not( .has-image ):is( :hover, :focus, :focus-visible, :active )::after {
		background-image: none;
		background-color: transparent;
		box-shadow: none;
	}
}

/* ---- Zoom lightbox (card 270) -------------------------------------------
   The current frame at full size over the whole screen, inside the popup's own stacking
   context so it paints above the dialog and its chrome. The picture is contain-fitted and
   centred; the close button keeps the 44px touch floor. */
.sr360-lightbox {
	position: fixed;
	inset: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	/* Opaque: the popup's controls bar and dialog must not show through under the picture. */
	background: #141414;
}
.sr360-lightbox[hidden] {
	display: none;
}
.sr360-lightbox__img {
	display: block;
	max-width: 100vw;
	max-height: 100vh;
	max-height: 100dvh;
	width: auto;
	height: auto;
	object-fit: contain;
}
/* A labelled pill at the top END corner, where the popup's round close also sits: the different
   shape and the word tell the two apart (owner 2026-11-18: closing the lightbox had tapped
   through onto the popup's close; he then asked for it back at the top right). 44px touch floor. */
.sr360-popup .sr360-lightbox button.sr360-lightbox__close {
	position: absolute;
	top: 12px;
	inset-inline-end: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: auto;
	min-width: 44px;
	height: 44px;
	margin: 0;
	padding: 0 16px 0 12px;
	border: 0;
	border-radius: 8px;
	background: rgba( 255, 255, 255, 0.92 );
	color: #1d2327;
	font: 600 15px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	letter-spacing: 0;
	text-transform: none;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.4 );
}
.sr360-popup .sr360-lightbox button.sr360-lightbox__close svg {
	flex: none;
	width: 22px;
	height: 22px;
}
.sr360-popup .sr360-lightbox button.sr360-lightbox__close:hover {
	background: #fff;
	color: #1d2327;
}
/* Themes style button:focus (Storefront paints a low-contrast purple ring, card 285): the
   programmatic focus the lightbox gives its close button on open is not :focus-visible, so
   the theme's ring showed. Mouse and touch get no ring; the keyboard gets a white one. */
.sr360-popup .sr360-lightbox button.sr360-lightbox__close:focus:not( :focus-visible ) {
	outline: 0;
}
.sr360-popup .sr360-lightbox button.sr360-lightbox__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}
/* Forced colours drop the white fill, so the circle needs a border to stay visible (ui-270 D6). */
@media ( forced-colors: active ) {
	.sr360-popup .sr360-lightbox button.sr360-lightbox__close {
		border: 1px solid ButtonText;
	}
}
