/*
 * Lilly's Shelf (/shelf/, page-shelf.php) — lane partner-shop-page, 03.12.2026.
 * Mobile first. Colours, fonts, shadows and the easing curve come only from the theme tokens in style-v4.css (:root);
 * buttons are the theme's .page-btn. Logical properties throughout, so Arabic mirrors by itself.
 * Lane partner-shop-items (03.12.2026, «in the look of the site»): the list chips are the Places explorer's filter pills
 * (places-explorer.css .apx-ex__chip — same height, pill radius, 1px line, heading font 600 at .82rem, deep fill when active)
 * and the cards are the explorer's / .page-card's white card with a 1px warm line and 16px corners, drawn here with the theme
 * tokens only (the explorer's own colour variables live inside .apx-ex and are not available on this page).
 */

/* Lilly greets in the hero (existing artwork, inc/lilly-svg.php); fixed size, so nothing moves when it loads. */
.shelf__lilly {
	display: block;
	inline-size: clamp(4.5rem, 12vw, 6rem);
	aspect-ratio: 124 / 100;
	margin-block-end: 0.75rem;
}

.shelf__lilly svg {
	display: block;
	inline-size: 100%;
	block-size: auto;
}

/*
 * Lilly's shopping film as the hero (lane shelf-hero-video, 03.12.2026). The house hero film CSS does the rest
 * (style-pages.css .page-hero__media / __video / __scrim, prose-video.css .page-hero__film-toggle); here only what the shelf
 * adds. The hero keeps one height while the poster and the film load, so nothing below it moves (CLS 0): the film is an
 * absolutely placed layer, the box height comes from this min-block-size and the text.
 */
.shelf__hero--film {
	min-block-size: clamp(30rem, 72vh, 44rem);
	display: flex;
	align-items: flex-end;
}

.shelf__hero--film .page-hero__inner {
	inline-size: 100%;
}

/* The poster (page-shelf.php sets both URLs on the layer): the full copy on wide screens, WordPress's 1024 px copy on phones —
   the same files the head preloads. Placed like the film's frame (style-pages.css .page-hero__video: cover, centre 38 %). */
.shelf__hero--film .page-hero__media {
	background-image: var(--shelf-poster);
	background-size: cover;
	background-position: center 38%;
}

/* The film's own scrim, from the theme tokens: dark where the text is (AA for the orange eyebrow and the disclosure), clear
   where Lilly shops. Arabic: the text is on the right, so the dark side moves there. */
.shelf__hero--film .page-hero__scrim {
	background:
		linear-gradient(100deg,
			color-mix(in srgb, var(--dark-deep) 90%, transparent) 0%,
			color-mix(in srgb, var(--dark-deep) 86%, transparent) 52%,
			color-mix(in srgb, var(--dark-deep) 25%, transparent) 76%,
			color-mix(in srgb, var(--dark-deep) 5%, transparent) 100%);
}

/* Wider screens: the text stays in the dark half, so Lilly in the light half is seen and every line keeps AA. */
@media (min-width: 901px) {
	.shelf__hero--film .page-hero__inner > * {
		max-inline-size: min(38rem, 44vw);
	}
}

[dir="rtl"] .shelf__hero .page-hero__scrim {
	transform: scaleX(-1);
}

/* Phones and small tablets: the text runs over the whole width, so the film shows clear at the top and is dark behind the
   text below it. */
@media (max-width: 900px) {
	.shelf__hero--film .page-hero__scrim {
		background: linear-gradient(180deg,
			color-mix(in srgb, var(--dark-deep) 15%, transparent) 0%,
			color-mix(in srgb, var(--dark-deep) 90%, transparent) 36%,
			color-mix(in srgb, var(--dark-deep) 94%, transparent) 100%);
	}

	/* The portrait crop of the 16:9 film: Lilly is right of the middle, the shelf behind her (poster and film alike). */
	.shelf__hero--film .page-hero__video {
		object-position: 64% 50%;
	}

	.shelf__hero--film .page-hero__media {
		background-image: var(--shelf-poster-small);
		background-position: 64% 50%;
	}

	[dir="rtl"] .shelf__hero .page-hero__scrim {
		transform: none;
	}
}

/* The sound button: the film toggle's glass circle (prose-video.css .page-hero__film-icon), right before it in the end corner. */
.shelf__hero .page-hero__sound {
	position: absolute;
	inset-inline-end: calc(max(12px, env(safe-area-inset-right)) + 48px);
	inset-block-end: 12px;
	z-index: 3;
	inline-size: 44px;
	block-size: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--white);
	cursor: pointer;
	display: grid;
	place-items: center;
}

.shelf__hero .page-hero__sound[hidden] {
	display: none;
}

/* The icon is the script's speaker drawing, not the toggle's CSS pause bars. */
.shelf__hero .page-hero__sound .page-hero__film-icon::before {
	content: none;
}

.shelf__hero .page-hero__sound svg {
	inline-size: 18px;
	block-size: 18px;
}

.shelf__hero .page-hero__sound:focus-visible {
	outline: none;
}

.shelf__hero .page-hero__sound:focus-visible .page-hero__film-icon {
	outline: 3px solid var(--accent);
	outline-offset: 2px;
}

/* The two buttons sit in the end corner: keep the disclosure clear of them. */
.shelf__hero--film .shelf__disclosure {
	padding-block-end: 2.5rem;
}

/* On the dark hero: a light token, so the legally required disclosure stays readable (contrast > 7:1). */
.shelf__disclosure {
	margin-block-start: 1rem;
	max-inline-size: 46rem;
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--mist-deep);
}

.shelf__banner {
	margin-block: 1rem 0;
	padding: 0.9rem 1.1rem;
	border-radius: 0.75rem;
	border-inline-start: 4px solid var(--accent);
	background: var(--cream);
	color: var(--text-dark);
	font-weight: 600;
}

.shelf__body {
	padding-block-start: clamp(1.5rem, 4vw, 2.5rem);
}

/* Tab bar: shown by shelf.js only (without JavaScript both panels show with their headings). */
.shelf__tabs {
	display: flex;
	gap: 0.5rem;
	margin-block-end: clamp(1.5rem, 4vw, 2.25rem);
	padding: 0.35rem;
	border-radius: 999px;
	background: var(--mist);
	inline-size: fit-content;
	max-inline-size: 100%;
}

.shelf__tabs[hidden] {
	display: none;
}

.shelf__tab {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-block-size: 44px;
	padding: 0.55rem 1.1rem;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--mist-text);
	font-family: var(--font-heading);
	font-size: 0.95rem;
	font-weight: 700;
	cursor: pointer;
	transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.shelf__tab[aria-selected="true"] {
	background: var(--white);
	color: var(--dark);
	box-shadow: var(--glow-soft);
}

.shelf__tab:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.shelf__tab-count {
	min-inline-size: 1.6em;
	padding: 0 0.45em;
	border-radius: 999px;
	background: var(--mist-deep);
	color: var(--dark);
	font-size: 0.8rem;
	text-align: center;
}

.shelf__panel + .shelf__panel {
	margin-block-start: clamp(2.5rem, 6vw, 4rem);
}

.shelf.is-tabbed .shelf__panel + .shelf__panel {
	margin-block-start: 0;
}

.shelf__panel:focus {
	outline: none;
}

/* With tabs the tab names say it; the panel headings stay for screen readers. */
.shelf.is-tabbed .shelf__panel-title {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.shelf__panel-note,
.shelf__empty {
	color: var(--text-muted);
}

.shelf__list + .shelf__list {
	margin-block-start: clamp(2rem, 5vw, 3rem);
}

/* List chips: jump links to the lists of the tab. One swipeable row on phones (one-hand use), wrapped from 640 px. */
.shelf__chips {
	display: flex;
	gap: 0.5rem;
	margin-block: 0 clamp(1.5rem, 4vw, 2.25rem);
	padding-block: 0.15rem;
	overflow-x: auto;
	overscroll-behavior-inline: contain;
	scrollbar-width: none;
}

.shelf__chips::-webkit-scrollbar {
	display: none;
}

@media (min-width: 640px) {
	.shelf__chips {
		flex-wrap: wrap;
		overflow-x: visible;
	}
}

.shelf__chip {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 0.4rem;
	min-block-size: 44px;
	padding: 0.45rem 0.95rem;
	border: 1px solid var(--grey-light);
	border-radius: 999px;
	background: var(--white);
	color: var(--text-dark);
	font-family: var(--font-heading);
	font-size: 0.82rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	line-height: 1.2;
	white-space: nowrap;
	text-decoration: none;
	transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease), color var(--duration) var(--ease);
}

.shelf__chip span {
	font-weight: 500;
	opacity: 0.6;
}

.shelf__chip:hover {
	border-color: var(--accent);
}

.shelf__chip:active,
.shelf__chip.is-active {
	background: var(--dark-deep);
	border-color: var(--dark-deep);
	color: var(--white);
}

.shelf__chip:focus-visible,
.shelf__more a:focus-visible,
.shelf-card__more:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.shelf__list-title {
	margin-block: 0 0.5rem;
	font-family: var(--font-heading);
	font-size: clamp(1.15rem, 2.4vw, 1.4rem);
	color: var(--dark);
	/* a chip jump lands below the fixed header (its height is measured by the theme into --mobile-nav-offset) */
	scroll-margin-block-start: calc(var(--mobile-nav-offset, 6rem) + 1rem);
}

.shelf__list-intro {
	margin-block: 0 0.75rem;
	max-inline-size: 46rem;
	color: var(--text-muted);
	line-height: 1.55;
}

.shelf__more {
	margin-block: 0 1rem;
}

.shelf__more a,
.shelf-card__more {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	min-block-size: 44px;
	color: var(--dark);
	font-family: var(--font-heading);
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: var(--accent);
	text-underline-offset: 0.25em;
}

.shelf-card__more {
	align-self: flex-start;
	min-block-size: 32px;
}

[dir="rtl"] .shelf__more .ri-arrow-right-line,
[dir="rtl"] .shelf-card__more .ri-arrow-right-line {
	transform: scaleX(-1);
}

/* auto-fill: a list with one or two items keeps card-sized columns instead of stretched cards or empty gaps */
.shelf__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr));
	gap: clamp(1rem, 2vw, 1.5rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* The house card (Places explorer card / .page-card): white, a 1px warm line, 16px corners, no heavy shadow. */
.shelf-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--warm);
	border-radius: 16px;
	background: var(--white);
	transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.shelf-card:hover {
	border-color: var(--mist-deep);
	box-shadow: var(--glow-soft);
}

.shelf-card__media {
	display: grid;
	place-items: center;
	aspect-ratio: 4 / 3;
	background: var(--soft-white);
}

.shelf-card__img {
	inline-size: 100%;
	block-size: 100%;
	object-fit: contain;
}

.shelf-card__placeholder {
	display: block;
	inline-size: 46%;
	max-inline-size: 9rem;
	opacity: 0.85;
}

.shelf-card__placeholder svg {
	display: block;
	inline-size: 100%;
	block-size: auto;
}

.shelf-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.6rem;
	padding: 1.1rem 1.2rem 1.3rem;
}

.shelf-card__name {
	margin: 0;
	font-family: var(--font-heading);
	font-size: 1.05rem;
	line-height: 1.35;
	color: var(--dark);
	overflow-wrap: anywhere;
}

.shelf-card__ships {
	align-self: flex-start;
	margin: 0;
	padding: 0.2rem 0.65rem;
	border-radius: 999px;
	background: var(--cream);
	color: var(--text-dark);
	font-size: 0.8rem;
	font-weight: 600;
}

.shelf-card__line {
	margin: 0;
	color: var(--text-muted);
	line-height: 1.55;
}

/* Fresh Amazon price with its time (lane partner-shop-weekly; shown only within 24 h of the fetch). */
.shelf-card__price {
	margin: 0;
	color: var(--text-dark);
	font-size: 0.85rem;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.shelf-card__btn {
	align-self: flex-start;
	margin-block-start: auto;
	min-block-size: 44px;
}

.shelf-card__disclosure {
	margin: 0;
	font-size: 0.75rem;
	line-height: 1.45;
	color: var(--text-muted);
}

.shelf__footnote {
	margin-block-start: clamp(2.5rem, 6vw, 4rem);
	padding-block-start: 1.25rem;
	border-block-start: 1px solid var(--grey-light);
	max-inline-size: 46rem;
	color: var(--text-muted);
	font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
	.shelf__tab,
	.shelf__chip,
	.shelf-card {
		transition: none;
	}
}
