/**
 * Styles for the [fitrx_single_product] shortcode.
 *
 * The "Replacement Parts" and "More From {Category}" grids are NOT styled
 * here — that markup is wrapped in the Shop Page block's own
 * `.wp-block-fitrx-blocks-shop-page` / `.shop-page__*` classes and styled
 * by its own compiled stylesheet (build/shop-page/style-index.css,
 * enqueued as a dependency of this file — see single-product-helpers.php),
 * same reuse approach as [fitrx_product_category]. Everything else here
 * (gallery, info column, description, meta) is this page's own design.
 *
 * 'Anton' and 'Manrope' are the same two fonts every block/shortcode in
 * this plugin uses, loaded once site-wide by fitrx_blocks_enqueue_fonts()
 * in fitrx-blocks.php — not repeated here.
 */

.fitrx-sp-page,
.fitrx-sp-page *,
.fitrx-sp-page *::before,
.fitrx-sp-page *::after {
	box-sizing: border-box;
}

.fitrx-sp-page {
	--ink: #181818;
	--ink-soft: rgba(24, 24, 24, 0.64);
	--ink-softer: rgba(24, 24, 24, 0.44);
	--line: #ece8e2;
	--red: #ce0e2d;
	--red-dim: #a80c25;
	--pink: #ffbdc8;
	--paper: #fffdfb;
	--card: #ffffff;
	--text-dim: #9a9d9f;

	display: block;
	width: 100%;
	background: var(--paper);
	color: var(--ink);
	font-family: 'Manrope', -apple-system, sans-serif;
	-webkit-font-smoothing: antialiased;
}

.fitrx-sp-page a { text-decoration: none; }
.fitrx-sp-page button {
	font-family: inherit;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	white-space: normal; /* guards against a theme button reset forcing nowrap */
}
/*
 * Deliberately NOT resetting border/background/padding on the blanket
 * `button` rule above: that rule's specificity (.fitrx-sp-page + button)
 * beats a single-class rule like `.fitrx-sp-gallery-tab`, so it would
 * silently win and strip the pill styling back to nothing — then the
 * theme's own button defaults (padding, border) show through instead,
 * which is exactly the bug this page hit. Every button/pill component
 * below sets its own border/background/padding explicitly instead, and
 * restates them on :hover too rather than assuming the base state
 * carries over — a theme `:hover` rule can still win on specificity for
 * properties left unstated there.
 */
.fitrx-sp-page :focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.fitrx-sp-page h1, .fitrx-sp-page h2 { text-wrap: balance; }

.fitrx-sp-inner {
	max-width: 1520px;
	margin: 0 auto;
	padding: 20px;
}

/* ---- breadcrumb ---- */
.fitrx-sp-crumb {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 20px 0 0;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--ink-softer);
}
.fitrx-sp-crumb a { color: var(--ink-softer); }
.fitrx-sp-crumb a:hover { color: var(--red); }
.fitrx-sp-crumb span { color: var(--line); }
.fitrx-sp-crumb .is-current { color: var(--ink-soft); }

/* ---- hero ---- */
.fitrx-sp-hero {
	display: grid;
	grid-template-columns: 1.05fr 0.95fr;
	gap: 56px;
	padding: 28px 0 56px;
	/*
	 * Without this, CSS Grid's default (stretch) forces the info column
	 * to match whatever height the gallery happens to be — which now
	 * changes per active tab (1:1 photos vs. 16:9 video vs. 4:3 3D & AR).
	 * Top-aligning both columns instead means switching tabs only moves
	 * the gallery, not the price/CTA/etc. sitting beside it.
	 */
	align-items: start;
}

/*
 * Wraps the gallery + Description together so .fitrx-sp-info's sticky
 * containing block (its parent, per how position:sticky works) spans both
 * — the info column (price/CTA) stays pinned in view while scrolling
 * through the gallery AND the description text, only scrolling away once
 * Description ends, instead of releasing right after the gallery.
 */
.fitrx-sp-hero-left {
	display: flex;
	flex-direction: column;
}

.fitrx-sp-info {
	padding-top: 4px;
	position: sticky;
	top: 24px; /* if the theme header is fixed/sticky, bump this to clear it */
	align-self: start;
}

/* gallery */
.fitrx-sp-gallery-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
/* Qualified with `button` (not just `.fitrx-sp-gallery-tab`) so this beats
   the theme's own `button { ... }` reset on specificity instead of depending
   on which stylesheet happens to print later in <head> — see the enqueue-
   timing note in single-product-helpers.php. */
button.fitrx-sp-gallery-tab {
	padding: 9px 18px;
	border-radius: 999px;
	border: 1.5px solid var(--line);
	background: var(--card);
	font-size: 12.5px;
	font-weight: 800;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	color: var(--ink-softer);
	transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
button.fitrx-sp-gallery-tab:hover { border-color: var(--ink); color: var(--ink); background: var(--card); }
button.fitrx-sp-gallery-tab.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

/*
 * Thumbnails sit in a fixed-width column to the LEFT of the stage on
 * desktop (order:1) — a column's own width doesn't care that the stage's
 * aspect ratio (and therefore height) changes per active pane, so it
 * pairs cleanly with that. Below 700px there isn't room for a side column
 * next to the stage, so it drops to a horizontal strip below instead
 * (order:2) — same layout the page used before this redesign.
 */
.fitrx-sp-gallery-main { display: flex; gap: 14px; align-items: flex-start; }
.fitrx-sp-gallery-stage {
	order: 2;
	flex: 1;
	min-width: 0; /* allow the stage to actually shrink in the flex row instead of overflowing next to the thumb column */
	position: relative;
	border-radius: 20px;
	overflow: hidden;
	/*
	 * No aspect-ratio here on purpose: single-product.js sets an explicit
	 * pixel height per active pane (see below), and an aspect-ratio left in
	 * place alongside that fights it — the browser keeps resizing the box
	 * back to satisfy the CSS ratio instead of the pane's real shape. The
	 * min-height is just a flash-of-zero-height guard for the instant
	 * before that JS runs.
	 */
	min-height: 300px;
	background: var(--ink);
	transition: height 0.3s ease;
}
/*
 * The stage's height is fixed to the Photos pane's 1:1 ratio (see
 * single-product.js — it always reads data-aspect off #fitrxSpPanePhotos,
 * never the active pane) and does not change when switching tabs. Video
 * (16:9) and 3D & AR (4:3) are shorter than that at the same width, so
 * .is-active below centers their content vertically inside the fixed
 * height instead of stretching it — the stage's own dark background shows
 * as letterboxing above/below, the common way e-commerce galleries handle
 * mixed media aspect ratios without the whole gallery resizing per tab.
 */
.fitrx-sp-gallery-pane { position: absolute; inset: 0; display: none; }
.fitrx-sp-gallery-pane.is-active { display: flex; align-items: center; justify-content: center; }

.fitrx-sp-photo { position: absolute; inset: 0; display: none; }
.fitrx-sp-photo.is-active { display: block; }
/*
 * .fitrx-sp-page prefix here isn't decorative — it's a defensive
 * specificity bump. A theme's own `img { max-width:100%; height:auto }`
 * reset (close to universal in WordPress themes) can still beat a plain
 * `.fitrx-sp-photo img` rule if the theme's real selector is something
 * like `.entry-content img`, which ties or wins on specificity — height
 * would fall back to "auto" (the image's own natural ratio) instead of
 * 100%, leaving the square box's dark background visible around it
 * wherever the real photo isn't exactly square.
 */
.fitrx-sp-page .fitrx-sp-photo img { width: 100%; height: 100%; max-width: none; object-fit: cover; display: block; }

.fitrx-sp-shot-fallback {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background:
		radial-gradient(circle at 28% 22%, rgba(206, 14, 45, 0.22), transparent 55%),
		radial-gradient(circle at 78% 82%, rgba(255, 189, 200, 0.42), transparent 50%),
		var(--ink);
}
.fitrx-sp-shot-fallback span {
	font-family: 'Anton', sans-serif;
	font-size: 22px;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.25);
}

/*
 * video pane — sized to its own real 16:9 ratio (not stretched to fill the
 * square stage), so it can be vertically centered by the pane's flex
 * centering above instead of being cropped/distorted into a square.
 */
.video-embed {
	width: 100%;
	aspect-ratio: 16 / 9;
	display: block;
	border: none;
}
.video-embed iframe { width: 100%; height: 100%; display: block; border: none; }

/* 3D / AR pane — same idea, sized to its own 4:3 ratio. */
.fitrx-sp-viewer {
	width: 100%;
	aspect-ratio: 4 / 3;
	position: relative;
	background: linear-gradient(160deg, #201f26, #100f14);
}
/*
 * The `ar` ACF field is a full <iframe> embed snippet (not a URL), rendered
 * as-is (via wp_kses(), which — unlike wp_kses_post() — allows iframe) in
 * single-product-helpers.php. Its own width/height attributes are
 * overridden here so it always fills this wrapper regardless of what the
 * embed code specifies.
 */
.fitrx-sp-ar-frame, .fitrx-sp-ar-frame iframe { width: 100%; height: 100%; border: none; display: block; }
/*
 * The Vectary embed's own AR launch button sits inside the iframe (top
 * right) — easy to miss since it's small and unlabeled at a glance, so this
 * points it out instead of adding a second (non-)functional button.
 */
.fitrx-sp-ar-hint {
	position: absolute;
	left: 50%;
	bottom: 16px;
	transform: translateX(-50%);
	margin: 0;
	padding: 9px 16px;
	border-radius: 999px;
	background: rgba(24, 24, 24, 0.55);
	backdrop-filter: blur(4px);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	white-space: nowrap;
	pointer-events: none;
}

.fitrx-sp-thumb-strip {
	order: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex-shrink: 0;
	overflow-y: auto;
	/* single-product.js syncs this to the stage's own height so a long
	   photo set scrolls internally instead of towering over the stage */
	max-height: 500px;
	padding-right: 4px;

	/* Same thin, on-brand scrollbar as the Shop Page filter sidebar
	   (.shop-page__sidebar in src/shop-page/style.scss) instead of the
	   browser's default one. */
	scrollbar-width: thin; /* Firefox */
	scrollbar-color: var(--line) transparent; /* Firefox */
}
.fitrx-sp-thumb-strip::-webkit-scrollbar { width: 6px; }
.fitrx-sp-thumb-strip::-webkit-scrollbar-track { background: transparent; }
.fitrx-sp-thumb-strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.fitrx-sp-thumb-strip::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
/* Qualified with `button` for the same specificity reason as
   button.fitrx-sp-gallery-tab above. */
button.fitrx-sp-thumb {
	width: 76px;
	height: 76px;
	padding: 0; /* the blanket button reset above deliberately no longer zeroes this (see comment there) — without it, the browser's native button padding shrinks the image inward and reveals this background color around it */
	border-radius: 12px;
	overflow: hidden;
	flex-shrink: 0;
	border: 1.5px solid var(--line);
	background: var(--ink);
	transition: border-color 0.15s ease, transform 0.15s ease;
}
button.fitrx-sp-thumb:hover { border-color: var(--ink); transform: translateY(-2px); }
button.fitrx-sp-thumb.is-active { border-color: var(--red); }
button.fitrx-sp-thumb.is-active:hover { border-color: var(--red); }
.fitrx-sp-page .fitrx-sp-thumb img { width: 100%; height: 100%; max-width: none; object-fit: cover; display: block; }

/* info column (position:sticky rule for .fitrx-sp-info lives up in the hero block, next to .fitrx-sp-hero-left) */
.fitrx-sp-cat-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	border-radius: 999px;
	background: var(--ink);
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	margin-bottom: 18px;
	transition: background 0.15s ease;
}
.fitrx-sp-cat-badge:hover { background: var(--red); color: #fff; }
.fitrx-sp-title {
	font-family: 'Anton', sans-serif;
	font-weight: 400;
	text-transform: uppercase;
	font-size: clamp(28px, 3.2vw, 42px);
	line-height: 1.02;
	margin: 0 0 10px;
}
.fitrx-sp-subtitle {
	font-size: 15.5px;
	color: var(--ink-soft);
	margin: 0 0 20px;
	line-height: 1.5;
}

.fitrx-sp-price-row { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; flex-wrap: wrap; }
.fitrx-sp-price { font-family: 'Anton', sans-serif; font-size: 30px; margin: 0; }
.fitrx-sp-msrp-tag {
	font-size: 10.5px;
	font-weight: 800;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	color: var(--text-dim);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 4px 10px;
}
.fitrx-sp-price-nudge {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 14px 8px 10px;
	margin: 0 0 22px;
	background: var(--pink);
	border-radius: 999px;
	font-size: 13px;
	font-weight: 800;
	color: var(--red-dim);
}
.fitrx-sp-nudge-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--red);
	flex-shrink: 0;
}
.fitrx-sp-nudge-icon svg { width: 11px; height: 11px; stroke: #fff; }

.fitrx-sp-short-desc {
	font-size: 14.5px;
	line-height: 1.5;
	color: var(--ink-soft);
	margin: 0 0 26px;
	max-width: 480px;
}
.fitrx-sp-short-desc ul { margin: 0; padding: 0; list-style: none; }
.fitrx-sp-short-desc li {
	position: relative;
	padding-left: 22px;
	margin-bottom: 9px;
}
.fitrx-sp-short-desc li:last-child { margin-bottom: 0; }
.fitrx-sp-short-desc li::before {
	content: '';
	position: absolute;
	left: 0;
	top: 8px;
	width: 12px;
	height: 2px;
	background: var(--red);
}
.fitrx-sp-short-desc p { margin: 0 0 12px; }
.fitrx-sp-short-desc p:last-child { margin-bottom: 0; }

.fitrx-sp-cta-row { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.fitrx-sp-buy-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 17px 32px;
	border-radius: 999px;
	background: var(--red);
	color: #fff;
	font-size: 14px;
	font-weight: 800;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	box-shadow: 0 14px 28px -14px rgba(206, 14, 45, 0.7);
	transition: background 0.15s ease, transform 0.15s ease;
}
.fitrx-sp-buy-btn:hover { background: var(--red-dim); color: #fff; transform: translateY(-1px); }
.fitrx-sp-buy-btn svg { width: 18px; height: 18px; }
.fitrx-sp-manual-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 15px 22px;
	border-radius: 999px;
	background: none;
	border: 1.5px solid var(--line);
	font-size: 12.5px;
	font-weight: 800;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	color: var(--ink-soft);
	transition: border-color 0.15s ease, color 0.15s ease;
}
.fitrx-sp-manual-btn:hover { border-color: var(--ink); color: var(--ink); background: none; }
.fitrx-sp-manual-btn svg { width: 15px; height: 15px; }

.fitrx-sp-meta-row {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 18px;
	font-size: 12.5px;
	color: var(--text-dim);
	font-weight: 600;
	padding-top: 20px;
	margin-top: 20px;
	border-top: 1px solid var(--line);
	margin-bottom: 20px;
}
.fitrx-sp-meta-row strong { color: var(--ink-soft); font-weight: 700; }

.fitrx-sp-tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fitrx-sp-tag-pill {
	padding: 6px 13px;
	border-radius: 999px;
	background: rgba(24, 24, 24, 0.045);
	font-size: 11.5px;
	font-weight: 700;
	color: var(--ink-soft);
	transition: background 0.15s ease, color 0.15s ease;
}
.fitrx-sp-tag-pill:hover { background: var(--pink); color: var(--red-dim); }

/* ---- sections (description, replacement parts, more from category) ---- */
.fitrx-sp-section { padding: 8px 0 56px; border-top: 1px solid var(--line); }
.fitrx-sp-section-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 28px;
	padding-top: 48px;
	gap: 14px;
	flex-wrap: wrap;
}
.fitrx-sp-section-title {
	font-family: 'Anton', sans-serif;
	font-weight: 400;
	text-transform: uppercase;
	font-size: clamp(22px, 2.4vw, 30px);
	margin: 0;
}
.fitrx-sp-section-link {
	font-size: 12.5px;
	font-weight: 800;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	color: var(--red);
	white-space: nowrap;
}
.fitrx-sp-section-link:hover { color: var(--red-dim); }
.fitrx-sp-section-link svg { width: 12px; height: 12px; margin-left: 4px; vertical-align: middle; }

.fitrx-sp-description-body {
	max-width: 700px;
	font-size: 15.5px;
	line-height: 1.85;
	color: var(--ink-soft);
}
.fitrx-sp-description-body p { margin: 0 0 18px; }
.fitrx-sp-description-body p:last-child { margin-bottom: 0; }

@media (max-width: 980px) {
	.fitrx-sp-hero { grid-template-columns: 1fr; gap: 32px; }
	/*
	 * .fitrx-sp-hero-left normally wraps the gallery + Description together
	 * so the sticky info column's containing block spans both (see the
	 * comment on .fitrx-sp-hero-left's own rule above). In a single column
	 * that pairing is wrong — it would put the whole Description block
	 * ahead of price/CTA. display:contents removes the wrapper from layout
	 * so gallery, info, and description become three independently
	 * orderable grid items again, restoring the original gallery → info →
	 * description order. Sticky is also switched off — it doesn't make
	 * sense once everything is stacked in one column.
	 */
	.fitrx-sp-hero-left { display: contents; }
	.fitrx-sp-gallery { order: 1; }
	.fitrx-sp-info { position: static; order: 2; }
	.fitrx-sp-hero-left > .fitrx-sp-section { order: 3; }
}
@media (max-width: 700px) {
	/*
	 * align-items:flex-start on .fitrx-sp-gallery-main (set for the
	 * desktop row layout, to vertically top-align the thumb column next
	 * to a taller/shorter stage) controls the OPPOSITE axis once this
	 * container flips to a column here — cross-axis is horizontal in
	 * column mode, so flex-start there means "don't stretch to full
	 * width", and the stage (which has no intrinsic width of its own,
	 * since its only content is absolutely positioned panes) collapses to
	 * zero width. stretch restores normal full-width block behavior.
	 */
	.fitrx-sp-gallery-main { flex-direction: column; align-items: stretch; gap: 14px; }
	/*
	 * flex:1 (desktop: grow to fill the row's remaining WIDTH next to the
	 * thumb column) becomes a HEIGHT instruction in column mode instead —
	 * flex-basis:0% (part of the flex:1 shorthand) overrides the explicit
	 * height single-product.js sets, so the stage's real height came from
	 * flex-grow distribution, not the pane's actual aspect ratio. flex:none
	 * lets the explicit height win again.
	 */
	.fitrx-sp-gallery-stage { order: 1; flex: none; }
	.fitrx-sp-thumb-strip {
		order: 2;
		flex-direction: row;
		flex-wrap: wrap;
		max-height: none;
		overflow-y: visible;
		overflow-x: auto;
	}
	.fitrx-sp-thumb-strip::-webkit-scrollbar { width: 6px; height: 6px; }
}
@media (max-width: 560px) {
	.fitrx-sp-cta-row { flex-direction: column; align-items: stretch; }
	.fitrx-sp-buy-btn, .fitrx-sp-manual-btn { justify-content: center; }
	.fitrx-sp-section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
}
