/*
 * MFD — Header & Footer styles
 *
 * Covers: top strip, cream header, primary nav, mobile drawer, values marquee,
 * footer columns, legal strip, search form, inline search bar, admin-bar offset.
 * Uses CSS custom properties from design-system.css (never edits that file).
 * Derived from docs/DESIGN-SPEC.md §2 + §1.5.
 */

/* ============================================================
 * 1. ADMIN BAR OFFSET
 * ============================================================ */

/*
 * When the WP admin bar is visible the sticky header must not overlap it.
 * The admin bar is 32px tall on desktop, 46px on mobile (≤782px).
 */
.admin-bar .mfd-header {
	top: 32px;
}

@media screen and (max-width: 782px) {
	.admin-bar .mfd-header {
		top: 46px;
	}
}

/* ============================================================
 * 2. TOP STRIP
 * ============================================================ */

.mfd-top-strip {
	background: var(--mfd-tan);
	color: var(--mfd-white);
	padding: 10px var(--mfd-gutter);
}

.mfd-top-strip__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-inline: auto;
}

/* Social icons row */
.mfd-top-strip__social {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.mfd-top-strip__social-link {
	display: flex;
	align-items: center;
	opacity: 0.9;
	transition: opacity var(--mfd-transition);
}

.mfd-top-strip__social-link:hover {
	opacity: 1;
}

.mfd-top-strip__social-icon {
	height: 26px;
	width: auto;
	display: block;
}

/* Delivery message */
.mfd-top-strip__message {
	font-family: var(--mfd-font-serif);
	font-size: 13px;
	color: var(--mfd-white);
	text-align: center;
	flex: 1;
	white-space: nowrap;
}

.mfd-top-strip__message strong {
	font-weight: 700;
}

.mfd-top-strip__contact-link {
	color: var(--mfd-white);
	font-weight: 700;
	text-decoration: underline;
}

.mfd-top-strip__contact-link:hover {
	color: var(--mfd-white);
	opacity: 0.85;
}

/* "Buy from USA" link — right-side strip item, consistent with contact-link */
.mfd-top-strip__usa {
	color: var(--mfd-white);
	font-family: var(--mfd-font-body);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	flex-shrink: 0;
	opacity: 0.9;
}

.mfd-top-strip__usa:hover {
	color: var(--mfd-white);
	opacity: 1;
	text-decoration: underline;
}

/* ============================================================
 * 3. LANGUAGE SELECTOR
 * ============================================================ */

.mfd-lang-selector {
	position: relative;
	flex-shrink: 0;
}

.mfd-lang-selector__btn {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	background: rgba(0, 0, 0, 0.06);
	border-radius: 4px;
	color: var(--mfd-white);
	font-family: var(--mfd-font-body);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--mfd-transition);
}

.mfd-lang-selector__btn:hover {
	background: rgba(0, 0, 0, 0.15);
}

.mfd-lang-selector__flag {
	height: 20px;
	width: auto;
	display: block;
}

.mfd-lang-selector__code {
	letter-spacing: 0.05em;
}

.mfd-lang-selector__caret {
	transition: transform var(--mfd-transition);
}

/* Dropdown */
.mfd-lang-selector__dropdown {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	min-width: 160px;
	background: var(--mfd-white);
	box-shadow: var(--mfd-shadow-pop);
	z-index: var(--mfd-z-drawer);
	padding: 6px 0;
	list-style: none;
	margin: 0;
	/* Hidden by default — shown when btn aria-expanded="true" */
	display: none;
}

/* JS sets data-mfd-lang-dropdown as open */
.mfd-lang-selector[data-mfd-open] .mfd-lang-selector__dropdown {
	display: block;
}

.mfd-lang-selector[data-mfd-open] .mfd-lang-selector__btn {
	background: rgba(0, 0, 0, 0.2);
}

.mfd-lang-selector[data-mfd-open] .mfd-lang-selector__caret {
	transform: rotate(180deg);
}

.mfd-lang-selector__option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 16px;
	font-size: 13px;
	color: var(--mfd-ink);
	transition: background var(--mfd-transition);
	white-space: nowrap;
}

.mfd-lang-selector__option:hover,
.mfd-lang-selector__option.is-active {
	background: var(--mfd-cream-soft);
}

.mfd-lang-selector__option.is-active {
	font-weight: 600;
}

/* ============================================================
 * 4. HEADER (cream bar + sticky)
 * ============================================================ */

.mfd-header {
	background: var(--mfd-cream);
	position: sticky;
	top: 0;
	z-index: var(--mfd-z-header);
	box-shadow: var(--mfd-shadow-header);
	width: 100%;
}

/* Cream row */
.mfd-header__cream {
	position: relative;
}

.mfd-header__inner {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	padding: 20px var(--mfd-gutter) 8px;
	margin-inline: auto;
}

/* Left zone */
.mfd-header__left {
	display: flex;
	align-items: center;
	gap: 12px;
}

.mfd-hamburger {
	display: none; /* shown at ≤960px */
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	color: var(--mfd-ink);
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	flex-shrink: 0;
}

.mfd-hamburger:focus-visible {
	outline: 2px solid var(--mfd-tan);
	outline-offset: 2px;
}

.mfd-header__diamond-badge {
	display: flex;
	align-items: center;
	gap: 8px;
}

.mfd-header__diamond-icon {
	width: 28px;
	height: 28px;
	display: block;
}

.mfd-header__certified {
	font-family: var(--mfd-font-serif);
	font-style: italic;
	font-size: 13px;
	color: var(--mfd-ink);
	white-space: nowrap;
}

/* Center zone */
.mfd-header__center {
	display: flex;
	justify-content: center;
}

.mfd-header__home-link {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 12px;
	text-decoration: none;
}

.mfd-header__mif-badge {
	width: 64px;
	height: 64px;
	display: block;
	flex-shrink: 0;
}

.mfd-header__wordmark,
.mfd-header__home-link .custom-logo {
	height: 48px;
	width: auto;
	display: block;
}

/* Right zone */
.mfd-header__right {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 20px;
}

.mfd-header__action {
	display: flex;
	align-items: center;
	position: relative;
	text-decoration: none;
	color: var(--mfd-ink);
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	transition: opacity var(--mfd-transition);
}

.mfd-header__action:hover {
	opacity: 0.7;
}

.mfd-header__action:focus-visible {
	outline: 2px solid var(--mfd-tan);
	outline-offset: 2px;
}

.mfd-header__action-icon {
	display: block;
}

.mfd-header__action--search .mfd-header__action-icon {
	width: 26px;
	height: 26px;
}

.mfd-header__action--account .mfd-header__action-icon {
	width: 24px;
	height: 26px;
}

.mfd-header__action--cart .mfd-header__action-icon {
	width: 26px;
	height: 26px;
}

/* Cart badge — hidden by default; shown only when cart count > 0 via .is-visible (H-02). */
.mfd-cart-badge {
	position: absolute;
	top: -6px;
	right: -8px;
	min-width: 18px;
	min-height: 18px;
	padding: 0 4px;
	border-radius: 50%;
	background: var(--mfd-tan);
	color: var(--mfd-white);
	font-family: var(--mfd-font-body);
	font-size: 10px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	display: none;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.mfd-cart-badge.is-visible {
	display: flex;
}

/* Inline search bar (shown/hidden by main.js) */
.mfd-header__search-bar {
	background: var(--mfd-cream);
	padding: 0;
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease, padding 0.3s ease;
}

.mfd-header__search-bar[data-mfd-open] {
	max-height: 100px;
	padding: 12px 0 16px;
}

.mfd-header__search-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-inline: auto;
}

.mfd-header__search-close {
	flex-shrink: 0;
	color: var(--mfd-ink);
	cursor: pointer;
	background: none;
	border: 0;
	padding: 4px;
	transition: opacity var(--mfd-transition);
}

.mfd-header__search-close:hover {
	opacity: 0.6;
}

/* ============================================================
 * 5. PRIMARY NAVIGATION
 * ============================================================ */

.mfd-nav {
	background: var(--mfd-cream);
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.mfd-nav__list {
	display: flex;
	align-items: center;
	justify-content: space-around;
	padding: 18px var(--mfd-gutter) 12px;
	margin: 0;
	list-style: none;
	max-width: calc(var(--mfd-container-wide) + var(--mfd-gutter) * 2);
	margin-inline: auto;
}

.mfd-nav__item {
	position: relative;
}

.mfd-nav__link,
.mfd-nav__list > li > a {
	display: block;
	font-family: var(--mfd-font-serif);
	font-size: 15px;
	font-weight: 400;
	color: var(--mfd-ink);
	text-decoration: none;
	padding-bottom: 4px;
	border-bottom: 2px solid transparent;
	transition: border-color var(--mfd-transition), color var(--mfd-transition);
	white-space: nowrap;
}

.mfd-nav__link:hover,
.mfd-nav__list > li > a:hover,
.mfd-nav__list > li.current-menu-item > a,
.mfd-nav__list > li.current_page_item > a,
.mfd-nav__link.is-active {
	border-bottom-color: var(--mfd-tan);
	color: var(--mfd-ink);
}

/* ============================================================
 * 6. MOBILE DRAWER
 * ============================================================ */

.mfd-drawer-scrim {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	z-index: calc(var(--mfd-z-drawer) - 1);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.mfd-drawer-scrim.is-open {
	opacity: 1;
	pointer-events: auto;
}

.mfd-drawer {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: 85%;
	max-width: 360px;
	background: var(--mfd-cream);
	z-index: var(--mfd-z-drawer);
	padding: 28px;
	overflow-y: auto;
	transform: translateX(-100%);
	transition: transform 0.3s ease;
	display: flex;
	flex-direction: column;
}

.mfd-drawer.is-open {
	transform: translateX(0);
}

/* Drawer header */
.mfd-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.mfd-drawer__logo {
	display: block;
}

.mfd-drawer__wordmark {
	height: 32px;
	width: auto;
	display: block;
}

.mfd-drawer__close {
	color: var(--mfd-ink);
	cursor: pointer;
	background: none;
	border: 0;
	padding: 4px;
	flex-shrink: 0;
	transition: opacity var(--mfd-transition);
}

.mfd-drawer__close:hover {
	opacity: 0.6;
}

.mfd-drawer__close:focus-visible {
	outline: 2px solid var(--mfd-tan);
	outline-offset: 2px;
}

/* Drawer nav list */
.mfd-drawer__nav {
	list-style: none;
	margin: 0;
	padding: 0;
	flex: 1;
}

.mfd-drawer__nav-item,
.mfd-drawer__nav > li {
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.mfd-drawer__nav-link,
.mfd-drawer__nav > li > a {
	display: block;
	padding: 14px 0;
	font-family: var(--mfd-font-serif);
	font-size: 18px;
	font-weight: 400;
	color: var(--mfd-ink);
	text-decoration: none;
	transition: color var(--mfd-transition);
}

.mfd-drawer__nav-link:hover,
.mfd-drawer__nav > li > a:hover,
.mfd-drawer__nav > li.current-menu-item > a {
	color: var(--mfd-tan);
}

/* ============================================================
 * 7. CHECKOUT MINIMAL HEADER
 * ============================================================ */

.mfd-header--checkout {
	padding: 16px var(--mfd-gutter);
}

.mfd-header-checkout__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-inline: auto;
}

.mfd-header-checkout__logo {
	display: block;
}

.mfd-header-checkout__logo .custom-logo,
.mfd-header-checkout__wordmark {
	height: 36px;
	width: auto;
	display: block;
}

.mfd-header-checkout__secure {
	font-family: var(--mfd-font-serif);
	font-size: 13px;
	color: var(--mfd-muted);
}

/* ============================================================
 * 8. SEARCH FORM
 * ============================================================ */

.mfd-search-form {
	display: flex;
	align-items: stretch;
	gap: 0;
	width: 100%;
	max-width: 600px;
}

.mfd-search-form__field {
	flex: 1;
	border-right: 0;
	font-family: var(--mfd-font-body);
	font-size: 14px;
	color: var(--mfd-ink);
	background: var(--mfd-white);
	border: 1px solid var(--mfd-line);
	padding: 11px 14px;
}

.mfd-search-form__field:focus {
	outline: none;
	border-color: var(--mfd-tan);
}

.mfd-search-form__submit {
	border-left: 0;
	flex-shrink: 0;
	padding: 11px 18px;
	display: flex;
	align-items: center;
	gap: 6px;
}

/* ============================================================
 * 9. VALUES MARQUEE
 * ============================================================ */

@keyframes mfd-marquee-scroll {
	from { transform: translateX(0); }
	to   { transform: translateX(-33.333%); }
}

.mfd-marquee {
	background: var(--mfd-tan);
	color: var(--mfd-white);
	padding: 18px 0;
	overflow: hidden;
	white-space: nowrap;
}

.mfd-marquee__track {
	display: inline-flex;
	align-items: center;
	/* Width = 3× content to allow -33.333% translate for seamless loop */
	animation: mfd-marquee-scroll 40s linear infinite;
}

.mfd-marquee__word {
	font-family: var(--mfd-font-body);
	font-size: 22px;
	font-weight: 700;
	padding: 0 18px;
	display: inline-block;
}

.mfd-marquee__sep {
	font-size: 22px;
	opacity: 0.85;
	display: inline-block;
	padding: 0 4px;
}

@media (prefers-reduced-motion: reduce) {
	.mfd-marquee__track {
		animation: none;
	}
}

/* ============================================================
 * 10. FOOTER
 * ============================================================ */

.mfd-footer {
	background: var(--mfd-ink);
	color: var(--mfd-white);
	padding-block: 48px 22px;
}

/* 5-column grid */
.mfd-footer__columns {
	display: grid;
	grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
	gap: clamp(24px, 3vw, 48px);
	align-items: start;
	padding-bottom: 40px;
}

.mfd-footer__brand-link {
	display: inline-block;
	margin-bottom: 16px;
}

.mfd-footer__wordmark {
	height: 32px;
	width: auto;
	display: block;
	filter: invert(1);
}

.mfd-footer__tagline {
	font-family: var(--mfd-font-serif);
	font-style: italic;
	font-size: 12px;
	line-height: 1.7;
	opacity: 0.72;
	color: var(--mfd-white);
	margin-bottom: 24px;
}

/* Newsletter */
.mfd-footer__newsletter-label {
	margin-bottom: 10px;
	color: var(--mfd-tan);
}

.mfd-footer__newsletter-field {
	display: flex;
	border: 1px solid var(--mfd-tan);
}

.mfd-footer__newsletter-input {
	flex: 1;
	background: transparent;
	border: 0;
	padding: 10px 12px;
	font-family: var(--mfd-font-body);
	font-size: 13px;
	color: var(--mfd-white);
	min-width: 0;
}

.mfd-footer__newsletter-input::placeholder {
	color: rgba(255, 255, 255, 0.45);
	font-style: italic;
}

.mfd-footer__newsletter-input:focus {
	outline: none;
}

.mfd-footer__newsletter-btn {
	flex-shrink: 0;
	padding: 10px 16px;
	font-size: 10px;
	letter-spacing: 0.12em;
}

/* Link columns */
.mfd-footer__col-title {
	color: var(--mfd-tan);
	margin-bottom: 14px;
	letter-spacing: 0.14em;
	font-size: 11px;
}

.mfd-footer__links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.mfd-footer__link {
	font-family: var(--mfd-font-body);
	font-size: 12px;
	font-weight: 400;
	color: rgba(255, 255, 255, 0.8);
	text-decoration: none;
	line-height: 1.5;
	transition: color var(--mfd-transition);
}

.mfd-footer__link:hover {
	color: var(--mfd-tan);
}

/* wp_nav_menu rendered links in footer columns */
.mfd-footer__col .mfd-footer__links a {
	font-family: var(--mfd-font-body);
	font-size: 12px;
	font-weight: 400;
	color: rgba(255, 255, 255, 0.8);
	text-decoration: none;
	line-height: 1.5;
	transition: color var(--mfd-transition);
}

.mfd-footer__col .mfd-footer__links a:hover {
	color: var(--mfd-tan);
}

/* Legal strip */
.mfd-footer__legal {
	border-top: 1px solid rgba(255, 255, 255, 0.12);
	padding-top: 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
}

.mfd-footer__copyright {
	font-family: var(--mfd-font-body);
	font-size: 10px;
	font-weight: 400;
	opacity: 0.5;
	color: var(--mfd-white);
}

.mfd-footer__legal-links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.mfd-footer__legal-link {
	font-family: var(--mfd-font-body);
	font-size: 10px;
	font-weight: 400;
	opacity: 0.5;
	color: var(--mfd-white);
	text-decoration: none;
	transition: opacity var(--mfd-transition);
}

.mfd-footer__legal-link:hover {
	opacity: 0.8;
}

/* wp_nav_menu rendered links in legal strip */
.mfd-footer__legal .mfd-footer__legal-links a {
	font-family: var(--mfd-font-body);
	font-size: 10px;
	opacity: 0.5;
	color: var(--mfd-white);
	text-decoration: none;
	transition: opacity var(--mfd-transition);
}

.mfd-footer__legal .mfd-footer__legal-links a:hover {
	opacity: 0.8;
}

/* ============================================================
 * 11. RESPONSIVE — TABLET (≤960px)
 * ============================================================ */

@media (max-width: 960px) {

	/* Top strip */
	.mfd-top-strip__message {
		display: none;
	}

	.mfd-top-strip__social-icon {
		height: 22px;
	}

	.mfd-top-strip__social {
		gap: 8px;
	}

	/* Header */
	.mfd-hamburger {
		display: flex;
	}

	.mfd-header__mif-badge {
		width: 48px;
		height: 48px;
	}

	.mfd-header__wordmark,
	.mfd-header__home-link .custom-logo {
		height: 36px;
	}

	/* Hide desktop nav */
	.mfd-nav {
		display: none;
	}

	/* Footer grid → 2 columns */
	.mfd-footer__columns {
		grid-template-columns: 1fr 1fr;
	}
}

/* ============================================================
 * 12. RESPONSIVE — PHONE (≤640px)
 * ============================================================ */

@media (max-width: 640px) {

	/* Hide language selector and "Buy from USA" on narrow phones */
	.mfd-lang-selector,
	.mfd-top-strip__usa {
		display: none;
	}

	/* Header inner adjustments */
	.mfd-header__inner {
		padding-top: 14px;
		padding-bottom: 6px;
	}

	.mfd-header__diamond-badge {
		display: none;
	}

	/* Footer grid → 1 column */
	.mfd-footer__columns {
		grid-template-columns: 1fr;
	}

	/* Legal strip stacks */
	.mfd-footer__legal {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* ============================================================
 * 13. RESPONSIVE — SMALL PHONE (≤479px) — prevent header collision
 * At very narrow viewports the wordmark + MIF badge together
 * overflow into the right action icons. Fix: hide the MIF badge
 * and shrink the wordmark so the grid 1fr columns each have
 * enough space for the action icon cluster.
 * ============================================================ */

@media (max-width: 479px) {

	/* Hide the Made-in-France badge to free ~76px of center space */
	.mfd-header__mif-badge {
		display: none;
	}

	/* Shrink the wordmark further — 28px height ≈ 124px wide,
	   giving each 1fr column ~126px for the three action icons */
	.mfd-header__wordmark,
	.mfd-header__home-link .custom-logo {
		height: 28px;
	}

	/* Allow the home link to shrink so it never overflows its column */
	.mfd-header__home-link {
		min-width: 0;
		overflow: hidden;
	}

	/* Right action cluster: let icons wrap gracefully if still tight */
	.mfd-header__right {
		gap: 14px;
		flex-shrink: 0;
	}
}
