/*
 * MFD — Home page styles
 *
 * Covers: paged hero carousel, brand block, product sections.
 * Design tokens and base utilities come from design-system.css.
 * Responsive per DESIGN-SPEC §1.5: 960px (tablet) + 640px (phone).
 *
 * NO JavaScript is written here.
 * Interactions (slide transitions, dot state) are handled by main.js
 * and toggled via is-* state classes and CSS custom properties.
 */

/* ============================================================
 * 1. PAGED HERO CAROUSEL
 * ============================================================ */

/* Container -------------------------------------------------- */
.mfd-hero-carousel {
	position: relative;
	overflow: hidden;
	background: var(--mfd-ink);
	/* Reserve height while images load to prevent layout shift. */
	min-height: clamp(200px, 40vw, 520px);
}

/* Viewport: clips the moving track */
.mfd-hero-carousel__viewport {
	overflow: hidden;
	width: 100%;
}

/* Track: flex row — width = tiles * tile-width
 * The JS sets --mfd-page on [data-mfd-track] and the transform follows.
 * At rest (no JS), show the first page only. */
.mfd-hero-carousel__track {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
	/* CSS-driven slide: JS writes style="--mfd-page:N" on the track. */
	transform: translateX(calc(var(--mfd-page, 0) * -100%));
	transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1);
	/* Pause animation when :hover is set on the section via JS class. */
	will-change: transform;
}

/* Tile ------------------------------------------------------- */
.mfd-hero-carousel__tile {
	/* Each tile is exactly 1/perPage of the track width.
	 * CSS custom property --mfd-per-page is set per breakpoint below
	 * and also used by JS to determine layout. */
	flex: 0 0 calc(100% / var(--mfd-per-page, 3));
	min-width: 0;
	position: relative;
	height: clamp(360px, 55vw, 520px);
	overflow: hidden;
	/* Tile separator: 2px white right border (last tile has none via CSS) */
	border-right: 2px solid var(--mfd-white);
}

.mfd-hero-carousel__tile:last-child {
	border-right: 0;
}

/* Image wrapper — fills the tile */
.mfd-hero-carousel__link {
	display: block;
	position: absolute;
	inset: 0;
}

.mfd-hero-carousel__image-wrap {
	width: 100%;
	height: 100%;
}

.mfd-hero-carousel__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 1.2s ease;
}

.mfd-hero-carousel__tile:hover .mfd-hero-carousel__image {
	transform: scale(1.04);
}

/* Gradient overlay — bottom-up dark vignette */
.mfd-hero-carousel__gradient {
	position: absolute;
	inset: 0;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 30%, rgba(0, 0, 0, 0.55) 100%);
	pointer-events: none;
}

/* Content block — bottom-left, above gradient */
.mfd-hero-carousel__content {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: clamp(16px, 3vw, 28px);
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	/* Staggered fade-up on page-enter (driven by JS adding .is-entering) */
}

/* Anton overlay title */
.mfd-hero-carousel__title {
	font-size: clamp(28px, 4.2vw, 60px);
	/* .mfd-overlay provides display font, uppercase, letter-spacing, text-shadow */
	animation: mfdFadeUp 0.7s ease both;
}

/* Lora italic sub-line */
.mfd-hero-carousel__sub {
	font-style: italic;
	font-size: clamp(14px, 1.8vw, 22px);
	color: var(--mfd-white);
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
	animation: mfdFadeUp 0.8s 0.1s ease both;
}

/* CTA pill button */
.mfd-hero-carousel__cta {
	animation: mfdFadeUp 0.9s 0.2s ease both;
	/* Override default .mfd-btn margins */
	margin-top: 4px;
}

.mfd-hero-carousel__cta:hover {
	transform: scale(1.03);
}

/* Arrows ---------------------------------------------------- */
.mfd-hero-carousel__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.85);
	color: var(--mfd-ink);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border: 0;
	transition: background var(--mfd-transition), opacity var(--mfd-transition);
}

.mfd-hero-carousel__arrow:hover {
	background: var(--mfd-white);
}

.mfd-hero-carousel__arrow--prev {
	left: 12px;
}

.mfd-hero-carousel__arrow--next {
	right: 12px;
}

/* Dots ------------------------------------------------------ */
.mfd-hero-carousel__dots {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 14px 0;
	background: var(--mfd-white);
}

.mfd-hero-carousel__dot {
	width: 10px;
	height: 10px;
	border-radius: 5px;
	background: rgba(0, 0, 0, 0.18);
	border: 0;
	padding: 0;
	cursor: pointer;
	transition: width 0.3s ease, background 0.3s ease;
}

.mfd-hero-carousel__dot.is-active {
	width: 28px;
	background: var(--mfd-tan);
}

/* Per-page CSS custom property — drives tile flex-basis */
.mfd-hero-carousel {
	--mfd-per-page: 3; /* desktop default */
}

@media (max-width: 959px) {
	.mfd-hero-carousel {
		--mfd-per-page: 2;
	}
}

@media (max-width: 639px) {
	.mfd-hero-carousel {
		--mfd-per-page: 1;
	}

	/* On single-tile mobile, hide arrows — swipe handles navigation via JS */
	.mfd-hero-carousel__arrow {
		display: none;
	}

	.mfd-hero-carousel__tile {
		border-right: 0;
	}
}

/* Paused state is set by JS on mouseenter — no style reset needed. */

/* ============================================================
 * 2. KEYFRAME ANIMATIONS
 * (mfdFadeUp is used by hero carousel content)
 * ============================================================ */
@keyframes mfdFadeUp {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Respect reduced-motion: override is already in design-system.css */

/* ============================================================
 * 3. BRAND BLOCK (§4.10)
 * ============================================================ */
/* Override section padding per spec: clamp(40px,6vw,72px) 24px */
.mfd-brand-block.mfd-section {
	padding-block: clamp(40px, 6vw, 72px);
}

.mfd-brand-block__inner {
	display: grid;
	grid-template-columns: 0.85fr 1.5fr;
	gap: 32px;
	align-items: center;
}

/* Left: stacked logo */
.mfd-brand-block__logo {
	display: flex;
	align-items: center;
	justify-content: flex-start;
}

.mfd-brand-block__logo-img {
	width: 85%;
	max-width: 360px;
	height: auto;
	object-fit: contain;
}

/* Right: badge + headline + diamond + tagline */
.mfd-brand-block__copy {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 20px;
}

.mfd-brand-block__badge {
	width: clamp(64px, 8vw, 96px);
	height: auto;
}

/* H1 headline — Montserrat 800, fluid size, "naturel certifié" in tan */
.mfd-brand-block__headline {
	font-family: var(--mfd-font-body);
	font-weight: 800;
	font-size: clamp(28px, 5.5vw, 56px);
	letter-spacing: -0.01em;
	line-height: 1.15;
	color: var(--mfd-ink);
}

.mfd-brand-block__diamond {
	width: 80px;
	height: auto;
}

.mfd-brand-block__tagline {
	font-style: italic;
	font-size: clamp(14px, 1.4vw, 17px);
	line-height: 1.7;
	color: var(--mfd-ink);
}

/* Responsive */
@media (max-width: 960px) {
	.mfd-brand-block__inner {
		grid-template-columns: 1fr;
		gap: 24px;
	}

	.mfd-brand-block__logo {
		justify-content: center;
	}

	.mfd-brand-block__logo-img {
		width: 70%;
		max-width: 280px;
	}
}

@media (max-width: 640px) {
	.mfd-brand-block__inner {
		gap: 20px;
	}

	.mfd-brand-block__headline {
		font-size: clamp(24px, 6vw, 36px);
	}
}

/* ============================================================
 * 4. PRODUCT SECTIONS  (Best Sellers + par matières)
 * ============================================================ */
.mfd-product-section__eyebrow {
	margin-bottom: 8px;
}

.mfd-product-section__title {
	margin-bottom: 28px;
}

/* Product grid — reuses .mfd-grid-4 with framed cards via WooCommerce loop */
.mfd-product-section__grid.products {
	/* ul reset */
	list-style: none;
	margin: 0;
	padding: 0;
}

/* WooCommerce product loop card overrides for the MFD style */
.mfd-product-section__grid .product {
	/* The WooCommerce <li class="product"> */
	display: flex;
	flex-direction: column;
}

/* Product image wrapper: square, framed, product-tile background */
.mfd-product-section__grid .product .woocommerce-loop-product__link,
.mfd-product-section__grid .product > a:first-child {
	display: block;
	position: relative;
}

.mfd-product-section__grid .product .attachment-woocommerce_thumbnail,
.mfd-product-section__grid .product img.wp-post-image {
	aspect-ratio: 1 / 1;
	width: 100%;
	height: auto;
	object-fit: contain;
	background: var(--mfd-product-tile);
	border: var(--mfd-frame); /* 1px solid tan — signature MFD frame */
	display: block;
	transition: transform 0.6s ease;
}

/* Hover: card lifts, image scales */
.mfd-product-section__grid .product:hover img {
	transform: scale(1.03);
}

.mfd-product-section__grid .product:hover {
	transform: translateY(-4px);
	transition: transform 0.3s ease;
}

/* Product name: Lora italic */
.mfd-product-section__grid .product .woocommerce-loop-product__title,
.mfd-product-section__grid .product h2 {
	font-family: var(--mfd-font-serif);
	font-style: italic;
	font-size: 16px;
	font-weight: 400;
	text-align: center;
	margin-top: 10px;
	color: var(--mfd-ink);
}

/* Product description (short desc in loop) */
.mfd-product-section__grid .product .woocommerce-product-details__short-description,
.mfd-product-section__grid .product .product-description {
	font-family: var(--mfd-font-body);
	font-size: 13px;
	line-height: 1.5;
	text-align: center;
	color: var(--mfd-ink);
	margin-top: 4px;
}

/* Price — per spec: prices are NOT shown on home best-seller/matières cards.
 * WooCommerce renders <span class="price"> inside the loop item (.product);
 * the MFD template also wraps it in .mfd-product-card__price — both selectors
 * are included for robustness (DESIGN-SPEC §3.1 / integration check). */
.mfd-product-section__grid .product .price,
.mfd-product-section__grid .mfd-product-card__price {
	display: none;
}

/* Add-to-cart button — hidden on home product sections (no add-to-cart on home) */
.mfd-product-section__grid .product .add_to_cart_button,
.mfd-product-section__grid .product .button {
	display: none;
}

/* CTA button below the grid */
.mfd-product-section__cta-wrap {
	display: flex;
	justify-content: center;
	margin-top: clamp(24px, 4vw, 40px);
}

/* Empty / no-WooCommerce state */
.mfd-product-section__empty {
	padding: 48px 0;
	text-align: center;
	color: var(--mfd-muted);
}

/* ============================================================
 * 5. RESPONSIVE — product grid overrides for this page
 * (design-system.css already handles .mfd-grid-4 collapse;
 *  these rules target WooCommerce's own column class)
 * ============================================================ */
@media (max-width: 960px) {
	.mfd-product-section__grid.products {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 640px) {
	.mfd-product-section__grid.products {
		grid-template-columns: repeat(2, 1fr);
	}

	.mfd-product-section__grid .product .woocommerce-loop-product__title,
	.mfd-product-section__grid .product h2 {
		font-size: 14px;
	}
}

@media (max-width: 420px) {
	.mfd-product-section__grid.products {
		grid-template-columns: 1fr;
	}
}

/* ============================================================
 * 7. MATERIAL CARDS (Les bracelets par matières)
 * 4 category cards on one row — gold-framed image + Lora italic title.
 * Mirrors the ProductGrid card design from the prototype.
 * ============================================================ */

/* Grid reset — override the default <ul> list styles */
.mfd-matieres-grid {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Individual card */
.mfd-matiere-card {
	display: flex;
	flex-direction: column;
}

/* Full-block link */
.mfd-matiere-card__link {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	transition: transform 0.3s ease;
}

.mfd-matiere-card__link:hover {
	transform: translateY(-4px);
}

/* Image wrapper — square, gold-framed, matches product tiles */
.mfd-matiere-card__image-wrap {
	overflow: hidden;
	line-height: 0; /* collapse inline gap */
}

.mfd-matiere-card__img {
	aspect-ratio: 1 / 1;
	width: 100%;
	height: auto;
	object-fit: contain;
	background: var(--mfd-product-tile);
	border: var(--mfd-frame); /* 1px solid tan — signature MFD gold frame */
	display: block;
	transition: transform 0.6s ease;
}

.mfd-matiere-card__link:hover .mfd-matiere-card__img {
	transform: scale(1.03);
}

/* Placeholder when no image is set */
.mfd-matiere-card__img--placeholder {
	aspect-ratio: 1 / 1;
	width: 100%;
	background: var(--mfd-product-tile);
	border: var(--mfd-frame);
}

/* Material name — Lora italic, matches product title in product sections */
.mfd-matiere-card__title {
	font-family: var(--mfd-font-serif);
	font-style: italic;
	font-size: 16px;
	font-weight: 400;
	text-align: center;
	margin-top: 10px;
	color: var(--mfd-ink);
}

/* Responsive: collapse to 2-col on tablet, stay 2-col on phone */
@media (max-width: 960px) {
	.mfd-matieres-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 640px) {
	.mfd-matieres-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.mfd-matiere-card__title {
		font-size: 14px;
	}
}
