/*
 * charlie.css
 * Page-specific rules for the Charlie Manikin page (Figma node 76:16007) on
 * top of the shared .ft-* foundation (css/new/foundation.css). Tokens,
 * box-sizing, the 1480px shell, base section rhythm, the heading trio
 * (.ft-eyebrow/.ft-title/.ft-accent), .ft-lead and the button primitives all
 * come from the foundation; this sheet keeps ONLY the genuine Charlie deltas —
 * extra surface tokens, section backgrounds, the hero composition
 * (badge + manikin + blob), the System/Titan product grids and cart links.
 *
 * Figma tokens (via --ft-*):
 *   Blue_Main #2DA7FA · Blue_Subtle #EDF7FF · Text #333536 · Muted #737A82
 *   BG/Default #F6F6F6 · BG/Background #F7F7F9 · BG/Line #E7E7E7 · Card #FDFDFD
 *   Title/Display 36/44 · Title/Title 24/30 · Body/Lead 16/22
 *   Body-B 14 · Body-sm 12 · Label/Button 16
 */

/* Charlie-only surface tokens (no foundation equivalent: --ft-border is
 * #e4e4e4, this page's line colour is #e7e7e7). The shell cap itself matches
 * the foundation's 1480px, so no --ft-shell override is needed here. */
body.ch-page .ft-main {
	--ch-line: #e7e7e7;
	--ch-card: #fdfdfd;
}

/* Deep links from the header mega-menu (#system / #titan) land below the
 * sticky header. */
body.ch-page .ft-section {
	scroll-margin-top: calc(var(--shop-header-height, 96px) + 12px);
}

/* The content sections (System, Titan) sit in a narrower band than the full
 * shell, matching the Charlie Figma (1320px content / ~300px side margins) and
 * the homepage's .ft-split sections (1340px). The hero keeps the full shell plus
 * its own 1252px cap, so it stays aligned with the homepage hero. Without this
 * the cards stretch the whole 1480px shell and stick out ~114px past the hero. */
.ch-section--system .ft-shell,
.ch-section--titan .ft-shell {
	max-width: 1320px;
}

/* Hero sits on a wider 18.75% gutter than the sections (Figma: hero copy x=360,
 * sections x=300), exactly like the homepage hero. Applied from 991px up; below
 * that the hero stacks.
 *
 * A flat 62.5% collapses the media column on smaller desktops: at ~1000px it is
 * 625px (copy 480 + gap 48 + media ≈ 97px), shrinking the manikin to a sliver.
 * Instead hold a 1200px content block (the 1920 design: copy 480 + gap 48 + media
 * 672) down to where the viewport can't afford it (then full width minus a small
 * gutter), and only keep the 18.75% inset once 62.5% is wider than that block
 * (>=1920). Mirrors the homepage hero (.ft-section--hero .ft-shell) so the manikin
 * stays a consistent size across desktop widths and at 4K. */
@media (min-width: 991px) {
	.ch-section--hero .ft-shell {
		width: min(100% - 48px, 1200px);
		max-width: none;
	}
}

/* ---- Sections ---- */
.ch-section--hero {
	background: #f6f6f6;
	/* Compact hero band matching new/homepage.css (.ft-section--hero) instead of
	 * a tall fixed 720px band — the hero is now content-height, not min-height. */
	padding: 56px 0 80px;
	/* The blob (behind the manikin) is sized/placed to peek out lower-right and
	 * extends below the manikin. overflow:hidden clips that overhang flush to the
	 * hero's bottom edge — mirroring the Figma, where the next section overlaps and
	 * cuts the blob at y=720. The bottom padding leaves ~80px of grey band below
	 * the manikin for the visible peek (Figma: manikin bottom 639 → hero bottom 720). */
	overflow: hidden;
}

.ch-section--system {
	background: var(--ch-card);
}

.ch-section--titan {
	position: relative;
	background: #f7f7f9;
}

/* Divider line above the Titan cards (Figma Line 504: 1600px, #E7E7E7) */
.ch-section--titan::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: min(1600px, 100% - 80px);
	height: 1px;
	background: var(--ch-line);
}

/* ---- Headings ---- */
/* Foundation's .ft-heading has no bottom margin (the homepage spaces headings
 * via grid gaps); Charlie's Figma puts 40px between heading and cards. */
body.ch-page .ft-heading {
	margin-bottom: 40px;
}

.ch-heading--center {
	justify-items: center;
	text-align: center;
}

/* ---- Buttons ---- */
/* Foundation .ft-btn gap is 12px; Charlie's Figma "Buy Now" spaces label and
 * arrow 16px apart. The buttons here are anchors, so also kill the underline. */
body.ch-page .ft-btn {
	gap: 16px;
	text-decoration: none;
}

/* "Add to Cart" text link with chevron */
.ch-cart {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	width: fit-content;
	color: var(--ft-blue);
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
}

.ch-cart i {
	font-size: 14px;
}

/* ---- Hero ---- */
/* Hero gutter matches the homepage hero exactly: 18.75% per side (360px on the
 * 1920 design, Figma node 97:2653 copy at x=360). The %-based shell rule above
 * (.ch-section--hero .ft-shell) drives it, so it also holds at 4K — identical
 * to the homepage hero (.ft-section--hero .ft-shell). */
.ch-hero {
	display: grid;
	grid-template-columns: minmax(0, 480px) minmax(0, 1fr);
	gap: 48px;
	align-items: center;
}

.ch-hero__copy {
	display: grid;
	gap: 24px;
	max-width: 480px; /* Figma node 97:2653 copy column = 480px */
}

.ch-hero__badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	width: fit-content;
	padding: 8px 12px;
	background: #fff;
	border-radius: 40px;
	box-shadow: 0 8px 24px rgba(39, 55, 75, 0.08);
	font-size: 14px;
	font-weight: 600;
	color: var(--ft-text);
}

.ch-hero__badge img {
	width: 16px;
	height: 16px;
}

/* Display-size heading (Figma Title/Display 36/44) — larger than the shared
 * .ft-title (24/30), so it stays a page rule. The description is plain
 * .ft-lead (typography identical to the foundation's). */
.ch-hero__title {
	margin: 0;
	font-size: 36px;
	line-height: 44px;
	font-weight: 700;
	color: var(--ft-text);
}

.ch-hero__media {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 360px;
}

/* The manikin + blob share this sizing box, set to the manikin's footprint
 * (Figma node 97:2663 ≈ 560px wide at 1920). The blob is then positioned as a
 * percentage of THIS box, so its size and offset relative to the manikin stay
 * identical at every width. */
.ch-hero__figure {
	position: relative;
	width: 560px;
	max-width: 100%;
}

/* Light-blue blob (Figma 97:2662) sits behind the manikin, peeking out lower-right.
 * Per Figma it is ~92% of the manikin width, with its right edge ~25% past the
 * manikin's right edge and its bottom ~30% below the manikin's bottom; that lower
 * overhang is clipped flush by the hero's overflow:hidden (as the next section
 * clips it in Figma). Sized/placed relative to .ch-hero__figure, so these numbers
 * hold at every resolution — fixing the prior media-relative placement that was
 * wrong at both 1080p and 4K. */
.ch-hero__blob {
	position: absolute;
	z-index: 0;
	left: 40%;
	top: 35%;
	width: 80%;
	height: auto;
}

/* Manikin photo clipped into the organic blob shape (Figma 97:2663). The raw
 * export carries opaque white corners outside the blob; we mask them away with
 * the blob silhouette (same coordinate space, so the framing stays exact). Fills
 * the figure box, so it drives the blob's relative sizing above. */
.ch-hero__manikin {
	position: relative;
	z-index: 1;
	display: block;
	width: 100%;
	aspect-ratio: 556 / 419;
	object-fit: cover;
	-webkit-mask: url(/images/new/charlie/hero_mask.svg) center / contain no-repeat;
	mask: url(/images/new/charlie/hero_mask.svg) center / contain no-repeat;
}

/* ---- Charlie Manikin System: vertical product cards ----
 * Five tiles (four products + the video tile) share one row; the Face Mask Kit
 * joined the row 2026-09-18 when it moved here from Accessories. */
.ch-products {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 16px;
}

.ch-pcard {
	display: flex;
	flex-direction: column;
	min-height: 360px;
	padding: 20px;
	background: var(--ft-blue-subtle);
	border-radius: 16px;
}

/* Fixed media height so every card's info block starts at the same y — the Figma
 * anchors the title/description/cart block at top:232px in all four cards, so the
 * titles line up regardless of image height or whether the card has an Add to Cart
 * (card padding 20px + media 212px ≈ the design's 232px). */
.ch-pcard__media {
	flex: 0 0 212px;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Fill the media height (height, not max-height) so a product photo whose natural
 * size is smaller than the box scales UP to match the others instead of sitting
 * tiny — e.g. the Charlie Ear Kit (364×303), which under-filled at 4K where the box
 * grows to 424px. width:auto keeps each photo's aspect; max-width guards the rare
 * extra-wide image. */
.ch-pcard--product .ch-pcard__media img {
	width: auto;
	height: 212px;
	max-width: 100%;
	object-fit: contain;
}

/* A-dec photo: the source asset is mirrored relative to the Figma (which flips it
 * via a transform), so flip it horizontally to match the design. */
.ch-pcard__img--flip {
	transform: scaleX(-1);
}

/* Video tile: full-width rounded thumbnail anchored to the top of the media area */
.ch-pcard--video .ch-pcard__media {
	align-items: flex-start;
}

.ch-pcard--video .ch-pcard__media img {
	width: 100%;
	border-radius: 8px;
	object-fit: cover;
}

/* Video thumbnail (system tile + Titan instruction card): a clickable poster
 * with a centered play button, matching the ModuPro resources cards. */
.ch-pcard__thumb {
	position: relative;
	display: block;
	width: 100%;
	line-height: 0;
	border-radius: 8px;
	overflow: hidden;
	cursor: pointer;
}

.ch-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 46px;
	height: 46px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(45, 167, 250, .92);
	color: #fff;
	border-radius: 50%;
	font-size: 18px;
	line-height: 1;
	box-shadow: 0 6px 16px rgba(45, 167, 250, .4);
}

.ch-pcard__info {
	display: grid;
	gap: 8px;
}

.ch-pcard__info h3 {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--ft-text);
}

.ch-pcard__info p {
	margin: 0;
	font-size: 12px;
	line-height: 1.5;
	font-weight: 500;
	color: var(--ft-muted);
}

.ch-pcard__info .ch-cart {
	margin-top: 8px;
}

/* ---- Titan Mounts: horizontal product cards + instruction tile ---- */
.ch-titan {
	display: flex;
	gap: 16px;
	align-items: stretch;
}

.ch-tcard {
	flex: 1 1 0;
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 24px;
	background: var(--ch-card);
	border-radius: 16px;
}

.ch-tcard__info {
	flex: 1 1 auto;
	display: grid;
	gap: 8px;
}

.ch-tcard__info h3 {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--ft-text);
}

.ch-tcard__info p {
	margin: 0;
	font-size: 12px;
	line-height: 1.5;
	font-weight: 500;
	color: var(--ft-muted);
}

.ch-tcard__info .ch-cart {
	margin-top: 4px;
}

.ch-tcard__media {
	flex: 0 0 180px;
	align-self: stretch;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--ft-blue-subtle);
	border-radius: 16px;
	padding: 12px;
}

.ch-tcard__media img {
	max-width: 100%;
	max-height: 168px;
	object-fit: contain;
}

/* Instruction tile (narrower) */
.ch-icard {
	flex: 0 0 284px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 12px 12px 20px;
	background: var(--ch-card);
	border-radius: 16px;
}

.ch-icard__media img {
	display: block;
	width: 100%;
	border-radius: 8px;
	object-fit: cover;
}

.ch-icard h3 {
	margin: 0 auto;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	color: var(--ft-text);
}

/* ---- Responsive ---- */

/* Keep the manikin + its lower-right blob inside the viewport across mid widths.
 * The hero media column is squeezed between the fixed 480px copy (+48px gap) and
 * the gutter, so a fixed-560px figure fills the column and butts the shell's
 * right edge (~24px gutter) — pushing the blob's ~20% right overhang past the
 * viewport, where the hero's overflow:hidden slices it with a hard vertical line.
 * Scaling the figure with the viewport shrinks the whole manikin+blob unit just
 * enough that the blob's right edge stays in-bounds. The 560px cap is reached by
 * ~1350px, so wide desktop is unchanged; below that it scales down continuously
 * (no breakpoint jump). The slope/offset are derived for this hero's 480px copy +
 * 48px gap layout: figure ≈ 71.4vw − 410px keeps the centred blob's right edge
 * ~20px inside the viewport across the squeeze. Placed here (after the base
 * .ch-hero__figure rule) so it wins on source order; the <=990 stacked hero
 * below overrides it again with its own figure cap. */
@media (min-width: 991px) {
	.ch-hero__figure {
		width: min(560px, calc(71.4vw - 410px));
	}
}

/* Below 1250px the three-in-a-row Titan layout squeezes the two bench-mount
 * cards too narrow (they share the row with the instruction tile). Keep the two
 * bench mounts together on their own row and drop the instruction tile to a
 * full-width row beneath them. */
@media (max-width: 1250px) {
	.ch-titan {
		flex-wrap: wrap;
	}

	.ch-tcard {
		flex: 1 1 calc(50% - 8px);
	}

	/* Instruction tile drops to its own row; cap + centre it so it doesn't blow up
	 * into a full-width video banner (it's full-width on phones, see <=990). */
	.ch-icard {
		flex: 1 1 100%;
		max-width: 560px;
		margin-inline: auto;
	}
}

@media (max-width: 1100px) {
	.ch-products {
		grid-template-columns: repeat(2, 1fr);
	}

	/* Odd tile count: the video tile takes the last row on its own. */
	.ch-pcard--video {
		grid-column: 1 / -1;
	}
}

@media (max-width: 990px) {
	/* Pre-migration cascade: this generic 64px rhythm rule sat AFTER the hero's
	 * 56/80 base rule in this file and won here by source order, so the hero
	 * rendered 64px top and bottom too. Foundation's ≤990 .ft-section rule loads
	 * before this sheet and would lose to the hero base rule above; restate it
	 * here (still after the hero rule) to keep the exact computed values. This
	 * also holds 64px across 601–680, where foundation's ≤680 48px step would
	 * otherwise kick in (this page steps to 48px at ≤600, below). */
	.ft-section {
		padding: 64px 0;
	}

	/* Hero stacks: copy first, manikin image below — matching the modupro mobile
	 * hero. Natural DOM order (copy → media) gives this, so no order override. */
	.ch-hero {
		grid-template-columns: 1fr;
		gap: 32px;
		min-height: 0;
		padding: 48px 0;
	}

	.ch-hero__copy {
		max-width: none;
		justify-items: center;
		text-align: center;
	}

	.ch-hero__media {
		min-height: 0;
	}

	.ch-hero__figure {
		width: 100%;
		max-width: 460px;
	}

	/* Stacked hero: tuck the blob behind the manikin (only a small lower-right
	 * peek) so its overhang doesn't reach down into the section below. */
	.ch-hero__blob {
		left: 16%;
		top: 10%;
		width: 88%;
	}

	/* Titan: each card spans the full row on mobile (the two bench mounts and the
	 * instruction tile stack one per row). The product cards keep their horizontal
	 * layout (text + image) here; they go vertical on small phones (<=600). */
	.ch-tcard {
		flex: 1 1 100%;
	}

	/* Instruction tile is full-width too on mobile, matching the bench cards. */
	.ch-icard {
		max-width: none;
	}
}

@media (max-width: 600px) {
	.ft-section {
		padding: 48px 0;
	}

	/* System cards size to content (equal height per row via the grid) with a
	 * smaller image area suited to the narrower phone cards. */
	.ch-pcard {
		min-height: 0;
		padding: 14px;
	}

	.ch-pcard__media {
		flex-basis: 150px;
	}

	.ch-pcard--product .ch-pcard__media img {
		height: 150px;
	}

	/* Titan product cards go vertical (image box on top, text below) once the
	 * full-width card is too narrow for the side-by-side image. */
	.ch-tcard {
		flex-direction: column;
		gap: 12px;
		padding: 16px;
	}

	.ch-tcard__media {
		order: -1;
		flex: 0 0 auto;
		width: 100%;
		height: 160px;
	}
}

/* ============================================================
   Narrow phones (<=449px) — the System product grid collapses to a SINGLE
   column (Titan is already one card per row from <=990). Min target width is
   325px, so also reclaim side padding here so cards stay roomy. body.ch-page
   outranks foundation's own ≤380px --ft-shell re-declaration (40px gutter).
   ============================================================ */
@media (max-width: 449px) {
	.ch-products {
		grid-template-columns: 1fr;
	}

	body.ch-page .ft-main {
		--ft-shell: min(1480px, 100% - 32px);
	}
}
