/*
 * PouchPick Homepage — Brand Spotlight (BS.3 FINAL HUMAN LOCK).
 *
 * Source of truth: the human-locked lab package — BS.2-C Compact Image-led
 * base (54/46 split, 314px card, ~450px section at 1440), BS.3-C action-row
 * controls, T1 directional soft slide + fade, `1 / N` indicator, BS.3.1-C
 * invert-on-hover arrows. Loaded only when the section renders
 * (inc/assets.php), mirroring home-strength.css / home-flavour.css.
 *
 * THREE LOAD-BEARING RULES:
 *
 * 1. THE CARD IS THE HEIGHT AUTHORITY, NEVER THE IMAGE. The artwork is taken
 *    out of flow (position:absolute) so it can never impose its intrinsic
 *    ratio on the card. Measured defect from the lab: with `height:100%`
 *    against an indefinite grid row a wider column silently made the whole
 *    section taller.
 * 2. SLIDES ARE GRID-STACKED (`grid-area: 1 / 1`) with inactive slides
 *    `visibility: hidden` — stable height, no tab order, no a11y tree.
 *    Absolute positioning is forbidden: it collapses the height onto the
 *    active slide.
 * 3. CONTROL GEOMETRY IS TOKEN-DRIVEN and anchored to the CTA's optical
 *    centre, so retuning the circle size can never break action-row
 *    alignment.
 *
 * LOCK-SAFE: no card translate, no elevation shadow (GLOBAL-COMMERCE-POLISH-
 * LOCK §9). No Lime anywhere in the component — DESIGN.md scopes Lime to the
 * Strength and Assurance exceptions; the section head's Level-2 lime dot is
 * the existing approved usage and lives outside this file.
 *
 * SPECIFICITY CONTRACT: the responsive blocks must keep the same selector
 * SHAPE as the rules they override (`.pp-spot[data-…] .pp-spot-arrow`) and
 * rely on source order. A flatter selector loses — this trap produced three
 * separate defects during the lab.
 */

/* ======================================================================
 * Tokens + card
 * ==================================================================== */
.pp-spot {
	--pp-spot-card-min: 314px;
	--pp-spot-split: 54fr 46fr;

	--pp-spot-nav-size: 42px;
	--pp-spot-nav-gap: 10px;
	--pp-spot-nav-inset: 30px;
	--pp-spot-nav-ind: 32px;
	/* The CTA's optical centre from the card bottom: body padding-bottom (26)
	   + half the 44px button. Controls derive their offset from THIS. */
	--pp-spot-cta-mid: 48px;
	/* Measured optical correction: the glyph's ink centroid sits ~1.24px
	   toward the head at a 17px render; 1px removes most of it without
	   losing the arrow's forward bias. */
	--pp-spot-optical: 1px;

	--pp-spot-dur: 300ms;
	--pp-spot-enter: 20px;
	--pp-spot-enter-body: 14px;
	--pp-spot-leave: 16px;
	--pp-spot-leave-body: 11px;
}

.pp-spot-card {
	position: relative;
	display: grid;
	min-height: var(--pp-spot-card-min);
	background: #fff;
	border: 1px solid var(--pp-border);
	border-radius: var(--pp-radius-lg);
	overflow: hidden;
	/* Vertical page panning stays with the browser; horizontal gestures come
	   to the controller. Never blocks ordinary scrolling. */
	touch-action: pan-y;
	transition: border-color var(--pp-motion-component) var(--pp-ease-out);
}

.pp-spot-viewport { display: grid; }

/* ======================================================================
 * Slides
 * ==================================================================== */
.pp-spot-slide {
	grid-area: 1 / 1;
	display: grid;
	grid-template-columns: var(--pp-spot-split);
	min-width: 0;
	opacity: 0;
	visibility: hidden;
	transition:
		opacity var(--pp-spot-dur) var(--pp-ease-out),
		visibility 0s linear var(--pp-spot-dur);
}
.pp-spot-slide.is-active {
	opacity: 1;
	visibility: visible;
	transition: opacity var(--pp-spot-dur) var(--pp-ease-out), visibility 0s;
}

.pp-spot-media { position: relative; overflow: hidden; background: var(--pp-soft-surface); }
.pp-spot-media picture { display: contents; }
.pp-spot-media img {
	position: absolute; inset: 0;
	width: 100%; height: 100%;
	object-fit: cover;
	/* Focal point is CONTENT DATA, supplied per brand by Core and emitted as
	   an inline custom property. No per-brand rule may exist in this file. */
	object-position: var(--pp-spot-focal, 50% 52%);
	display: block;
}

/* Body: row 1 centres the text in whatever space is left, row 2 is pinned —
   so the CTA sits at the SAME distance from the card bottom on every slide
   whatever the copy length, which is what keeps the action-row controls
   aligned and stops the CTA drifting between brands. */
.pp-spot-body {
	display: grid;
	grid-template-rows: 1fr auto;
	padding: 26px 30px;
	min-width: 0;
}
.pp-spot-text { align-self: center; min-width: 0; }

.pp-spot-headline { font: 600 26px/1.12 var(--pp-font-display); letter-spacing: -0.02em; margin: 0 0 10px; }
.pp-spot-hook {
	font: 400 15.5px/1.5 var(--pp-font-body); color: var(--pp-ink);
	margin: 0 0 14px; max-width: 46ch;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pp-spot-meta { font: 500 12.5px/1.4 var(--pp-font-body); color: var(--pp-secondary-text); margin: 0; }
.pp-spot-action { margin: 0; display: flex; align-items: center; }

/* The ONE semantic action per slide, stretched over the whole card. The card
   is never itself a link, so the headline, hook and metadata stay out of the
   link's accessible name while the whole card remains one hit target. */
.pp-spot-link { position: static; }
.pp-spot-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.pp-spot-link .pp-i { transition: transform var(--pp-motion-component) var(--pp-ease-out); }
.pp-spot-link:focus-visible { box-shadow: none; outline: none; }

/* THE PRESS SCALE CANNOT APPLY TO THIS LINK.
 *
 * The overlay above is the card's entire hit area, and an absolutely
 * positioned box is laid out against its nearest TRANSFORMED ancestor — not
 * merely its nearest positioned one. The shared press signature
 * (design-system.css: `.pp-btn:active, .pp-btn.is-pressed { transform: scale()
 * }`) therefore re-parents this pseudo-element onto the button for exactly as
 * long as the finger is down: measured at 390px, the overlay is 356x509 at
 * rest and 318x42 while pressed. Because a tap's target is resolved while that
 * collapse is in effect, every tap above the CTA — the whole artwork, the
 * headline, the hook, the metadata — resolved to the artwork instead of the
 * link, and the stretched link did nothing on touch.
 *
 * It cannot be fixed by moving the scale to a wrapper or to the action row
 * either: ANY transformed ancestor between the overlay and .pp-spot-card
 * collapses it the same way. The scale has to be off this element's ancestor
 * chain, so it is dropped here rather than relocated.
 *
 * The press signature is "shade first, scale second" — the pressed navy
 * (.pp-btn-primary.is-pressed) is the primary signal and is untouched; only
 * the secondary 1.5% scale is dropped, and only on this one control, where it
 * is load-bearing for the hit area. No other component is affected.
 *
 * Specificity is deliberately .pp-spot-link.pp-btn (0,3,0) rather than
 * relying on this file loading after design-system.css, so re-ordering the
 * enqueues can never silently restore the defect. */
.pp-spot-link.pp-btn:active,
.pp-spot-link.pp-btn.is-pressed { transform: none; }

/* ======================================================================
 * T1 transition — direction-aware. `.is-enter` is applied for one frame with
 * transitions suppressed so the start offset commits.
 * ==================================================================== */
.pp-spot-media, .pp-spot-body { transition: transform var(--pp-spot-dur) var(--pp-ease-out); }
.pp-spot-slide.is-enter,
.pp-spot-slide.is-enter .pp-spot-media,
.pp-spot-slide.is-enter .pp-spot-body { transition: none; }

.pp-spot-viewport[data-dir="next"] .pp-spot-slide.is-enter .pp-spot-media { transform: translateX(var(--pp-spot-enter)); }
.pp-spot-viewport[data-dir="next"] .pp-spot-slide.is-enter .pp-spot-body  { transform: translateX(var(--pp-spot-enter-body)); }
.pp-spot-viewport[data-dir="prev"] .pp-spot-slide.is-enter .pp-spot-media { transform: translateX(calc(var(--pp-spot-enter) * -1)); }
.pp-spot-viewport[data-dir="prev"] .pp-spot-slide.is-enter .pp-spot-body  { transform: translateX(calc(var(--pp-spot-enter-body) * -1)); }

.pp-spot-viewport[data-dir="next"] .pp-spot-slide.is-leave .pp-spot-media { transform: translateX(calc(var(--pp-spot-leave) * -1)); }
.pp-spot-viewport[data-dir="next"] .pp-spot-slide.is-leave .pp-spot-body  { transform: translateX(calc(var(--pp-spot-leave-body) * -1)); }
.pp-spot-viewport[data-dir="prev"] .pp-spot-slide.is-leave .pp-spot-media { transform: translateX(var(--pp-spot-leave)); }
.pp-spot-viewport[data-dir="prev"] .pp-spot-slide.is-leave .pp-spot-body  { transform: translateX(var(--pp-spot-leave-body)); }

.pp-spot-slide.is-active .pp-spot-media,
.pp-spot-slide.is-active .pp-spot-body { transform: none; }

/* ======================================================================
 * Controls — BS.3.1-C "invert on hover"
 * ==================================================================== */
.pp-spot-nav { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.pp-spot-nav > * { pointer-events: auto; }

.pp-spot-arrow {
	position: absolute;
	display: grid; place-items: center;
	width: var(--pp-spot-nav-size); height: var(--pp-spot-nav-size);
	border-radius: 50%;
	background: #fff;
	border: 1px solid var(--pp-border);
	color: var(--pp-navy);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition:
		background-color var(--pp-motion-micro) var(--pp-ease-out),
		border-color var(--pp-motion-micro) var(--pp-ease-out),
		color var(--pp-motion-micro) var(--pp-ease-out);
}
/* Keeps the effective target >=44 whatever the visible diameter, so the
   circle can be tuned for looks without touching accessibility. */
.pp-spot-arrow::after {
	content: ""; position: absolute; top: 50%; left: 50%;
	width: max(100%, var(--pp-hit-min)); height: max(100%, var(--pp-hit-min));
	transform: translate(-50%, -50%);
}

.pp-spot-glyph {
	width: 17px; height: 17px;
	display: block;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: transform var(--pp-motion-micro) var(--pp-ease-out);
}
.pp-spot-arrow[data-pp-spot-prev] .pp-spot-glyph { transform: translateX(var(--pp-spot-optical)); }
.pp-spot-arrow[data-pp-spot-next] .pp-spot-glyph { transform: translateX(calc(var(--pp-spot-optical) * -1)); }

@media (hover: hover) {
	.pp-spot-arrow:hover { background: var(--pp-navy); border-color: var(--pp-navy); color: #fff; }
	.pp-spot-arrow[data-pp-spot-prev]:hover .pp-spot-glyph { transform: translateX(calc(var(--pp-spot-optical) - 2px)); }
	.pp-spot-arrow[data-pp-spot-next]:hover .pp-spot-glyph { transform: translateX(calc(2px - var(--pp-spot-optical))); }
}

/* Pressed: the glyph SETTLES back ~1px and the surface deepens. Tactile, not
   playful — no scale-down, no sink. */
.pp-spot-arrow:active { background: var(--pp-navy-pressed); border-color: var(--pp-navy-pressed); color: #fff; transition-duration: var(--pp-motion-press-in); }
.pp-spot-arrow[data-pp-spot-prev]:active .pp-spot-glyph { transform: translateX(calc(var(--pp-spot-optical) - 1px)); }
.pp-spot-arrow[data-pp-spot-next]:active .pp-spot-glyph { transform: translateX(calc(1px - var(--pp-spot-optical))); }

/* Focus-visible: the one PouchPick focus language, deliberately on a LIGHT
   ground so it can never be confused with the inverted hover. Declared after
   hover/active so it wins when a control is both hovered and focused. */
.pp-spot-arrow:focus-visible {
	outline: none;
	background: #fff;
	border-color: var(--pp-ink);
	color: var(--pp-navy);
	box-shadow: var(--pp-focus-ring);
}

/* ---- Indicator: quiet, secondary, never dots ---- */
.pp-spot-indicator {
	position: absolute;
	display: flex; align-items: baseline; justify-content: center;
	font: 600 12.5px/1 var(--pp-font-body);
	color: var(--pp-secondary-text);
	font-variant-numeric: tabular-nums;
	letter-spacing: .01em;
	white-space: nowrap;
	margin: 0;
	transition: opacity var(--pp-motion-micro) var(--pp-ease-out);
}
/* Three weights, not two, so the pair reads as one value. */
.pp-spot-indicator b { font-weight: 700; color: var(--pp-ink); font-style: normal; }
.pp-spot-indicator i { font-style: normal; font-weight: 400; color: var(--pp-border-hover); margin: 0 3px; }
.pp-spot-indicator span { font-weight: 600; }
/* While a transition runs the indicator quiets — the only in-progress signal,
   because the controls stay fully enabled (a new press interrupts). */
.pp-spot[data-busy="true"] .pp-spot-indicator { opacity: .55; }

/* ---- Action-row placement. Every offset derives from the tokens:
     next      right = inset
     indicator right = inset + size + gap
     prev      right = inset + size + gap + ind + gap
   Vertically both are centred on the CTA's optical middle. ---- */
.pp-spot-arrow { bottom: calc(var(--pp-spot-cta-mid) - var(--pp-spot-nav-size) / 2); }
.pp-spot-arrow[data-pp-spot-next] { inset-inline-end: var(--pp-spot-nav-inset); }
.pp-spot-arrow[data-pp-spot-prev] {
	inset-inline-end: calc(var(--pp-spot-nav-inset) + var(--pp-spot-nav-size) + var(--pp-spot-nav-gap) + var(--pp-spot-nav-ind) + var(--pp-spot-nav-gap));
}
.pp-spot-indicator {
	bottom: calc(var(--pp-spot-cta-mid) - 6px);
	inset-inline-end: calc(var(--pp-spot-nav-inset) + var(--pp-spot-nav-size) + var(--pp-spot-nav-gap));
	width: var(--pp-spot-nav-ind);
}
/* Reserve the group's full width plus breathing room so Discover can never
   collide with it. Only when the carousel exists. */
.pp-spot:has(.pp-spot-nav) .pp-spot-action {
	padding-inline-end: calc(var(--pp-spot-nav-inset) + var(--pp-spot-nav-size) * 2 + var(--pp-spot-nav-gap) * 2 + var(--pp-spot-nav-ind) + 24px);
}

/* ======================================================================
 * Whole-card hover — LOCK-SAFE: border + headline + CTA glyph only.
 * No card transform. No shadow.
 * ==================================================================== */
@media (hover: hover) {
	.pp-spot-card:hover { border-color: var(--pp-navy); }
	.pp-spot-card:hover .pp-spot-headline { color: var(--pp-navy); }
	.pp-spot-card:hover .pp-spot-link .pp-i { transform: translateX(4px); }
}
.pp-spot-card:has(.pp-spot-link:focus-visible) {
	border-color: var(--pp-ink);
	box-shadow: var(--pp-focus-ring);
}
@supports not selector(:has(*)) {
	.pp-spot-card:focus-within { border-color: var(--pp-ink); }
}

/* ======================================================================
 * TABLET (<=1024) — stacked, but the SAME action-row grammar as desktop.
 * No tablet-only visual system: only the two anchoring tokens change to
 * follow the tablet body padding.
 * ==================================================================== */
@media (max-width: 1024px) {
	.pp-spot { --pp-spot-nav-inset: 26px; --pp-spot-cta-mid: 46px; }
	.pp-spot-card { min-height: 0; }
	.pp-spot-slide { grid-template-columns: minmax(0, 1fr); }
	.pp-spot-media { aspect-ratio: 21 / 9; }
	.pp-spot-body { padding: 22px 26px 24px; }
	.pp-spot-headline { font-size: 24px; }
	.pp-spot-hook { font-size: 15.5px; }
}

/* ======================================================================
 * MOBILE (<=599) — image, content, full-width Discover, then the control
 * group CENTRED beneath it. The nav becomes a flex bar and the controls drop
 * out of absolute positioning, which centres the group and keeps both gaps
 * exactly equal at every width. Arrows never touch the artwork.
 *
 * `position: relative` on the arrows is REQUIRED, not cosmetic: the >=44px
 * hit expander is sized `max(100%, 44px)`, so with a statically positioned
 * button its containing block becomes the CARD and each expander spans the
 * whole control bar — which made Previous entirely unclickable in the lab
 * (Next, later in the DOM, covered it). The per-arrow desktop offsets must
 * also be reset at matching specificity: under `relative` a leftover `right`
 * SHIFTS the element instead of being ignored.
 * ==================================================================== */
@media (max-width: 599px) {
	.pp-spot { --pp-spot-nav-size: 44px; --pp-spot-nav-gap: 14px; }
	.pp-spot-media { aspect-ratio: 3 / 2; }
	.pp-spot-body { padding: 20px 18px 22px; }
	.pp-spot-headline { font-size: 22px; margin-bottom: 8px; }
	/* The hook is the line that must survive the phone: at two lines it
	   truncated before the most interesting half of the sentence. */
	.pp-spot-hook { font-size: 15px; margin-bottom: 12px; -webkit-line-clamp: 3; }
	.pp-spot-action { display: block; }
	.pp-spot-action .pp-btn { width: 100%; }

	.pp-spot-nav {
		inset: auto 0 18px 0;
		display: flex; align-items: center; justify-content: center;
		gap: var(--pp-spot-nav-gap);
	}
	.pp-spot .pp-spot-arrow { position: relative; margin-top: 0; transform: none; }
	.pp-spot .pp-spot-arrow[data-pp-spot-prev],
	.pp-spot .pp-spot-arrow[data-pp-spot-next] { top: auto; right: auto; bottom: auto; left: auto; }
	.pp-spot .pp-spot-indicator {
		position: static;
		top: auto; right: auto; bottom: auto; left: auto;
		width: auto; min-width: var(--pp-spot-nav-ind);
	}
	/* Row 2 reserves height for the control bar so the full-width Discover
	   button and the arrows never collide. */
	.pp-spot:has(.pp-spot-nav) .pp-spot-action { padding-inline-end: 0; padding-bottom: 56px; }
}

/* ======================================================================
 * REDUCED MOTION — directional translation removed, short fade kept. The
 * static optical correction is retained (position, not motion). Every control
 * state still reads through surface, border and colour alone.
 * ==================================================================== */
@media (prefers-reduced-motion: reduce) {
	.pp-spot {
		--pp-spot-dur: 120ms;
		--pp-spot-enter: 0px; --pp-spot-enter-body: 0px;
		--pp-spot-leave: 0px; --pp-spot-leave-body: 0px;
	}
	.pp-spot-media, .pp-spot-body { transition: none; }
	.pp-spot-arrow, .pp-spot-glyph, .pp-spot-link .pp-i { transition: none; }
	.pp-spot-card:hover .pp-spot-link .pp-i { transform: none; }
	.pp-spot-arrow[data-pp-spot-prev]:hover .pp-spot-glyph,
	.pp-spot-arrow[data-pp-spot-prev]:active .pp-spot-glyph { transform: translateX(var(--pp-spot-optical)); }
	.pp-spot-arrow[data-pp-spot-next]:hover .pp-spot-glyph,
	.pp-spot-arrow[data-pp-spot-next]:active .pp-spot-glyph { transform: translateX(calc(var(--pp-spot-optical) * -1)); }
}
