/**
 * Base du thème Sonosax : chargé sur toutes les pages.
 *
 * Les couleurs, polices et tailles viennent de theme.json
 * (variables --wp--preset--* et --wp--custom--*). Ne pas écrire de valeur
 * de couleur ou de police en dur ici.
 *
 * Sommaire
 * 1. Raccourcis de tokens
 * 2. Socle
 * 3. Conteneur
 * 4. En-tête
 * 5. Menu principal
 * 6. Recherche
 * 7. Pied de page
 */

/* 1. Raccourcis de tokens ------------------------------------------------ */

:root {
	--c-white: var(--wp--preset--color--white);
	--c-mist: var(--wp--preset--color--mist);
	--c-line: var(--wp--preset--color--line);
	--c-gray: var(--wp--preset--color--gray);
	--c-graphite: var(--wp--preset--color--graphite);
	--c-ink: var(--wp--preset--color--ink);
	--c-black: var(--wp--preset--color--black);
	--c-red: var(--wp--preset--color--red);

	--f-body: var(--wp--preset--font-family--body);
	--f-display: var(--wp--preset--font-family--display);

	--gutter: var(--wp--custom--gutter--mobile);
	/* Ombre des cartes (produits, articles, distributeurs), au repos et au survol. */
	--shadow-card: 0 1px 2px rgb(0 0 0 / 0.08), 0 4px 14px rgb(0 0 0 / 0.07);
	--shadow-card-hover: 0 2px 4px rgb(0 0 0 / 0.1), 0 10px 26px rgb(0 0 0 / 0.12);

	--container: 1200px;
	--header-height: 72px;
	--transition: 160ms ease;
}

@media (min-width: 768px) {
	:root {
		--gutter: var(--wp--custom--gutter--tablet);
	}
}

@media (min-width: 1200px) {
	:root {
		--header-height: var(--wp--custom--header--height);
	}
}

/* 2. Socle --------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-padding-top: var(--header-height);
}

body {
	margin: 0;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Hauteur de ligne du texte courant arrondie au pixel : les blocs ont alors une hauteur entière,
   ce qui garde les boutons et les pictogrammes nets et centrés plus bas dans la page.
   :where() ne pèse rien : toute règle plus précise garde la main. */
:where(p, li, dt, dd, blockquote, figcaption, td, th, label, summary, address) {
	line-height: round(1.72em, 1px);
}

img,
svg,
video {
	display: block;
	max-width: 100%;
	height: auto;
}

/* Images à légende des anciens articles : WordPress leur donne une largeur fixe en pixels. */
.wp-caption {
	max-width: 100%;
}

/* Un mot plus large que l'écran (« TONMEISTERTAGUNG » dans un titre, sur petit téléphone) est coupé
   plutôt que de faire défiler la page de côté. Sans effet quand le mot tient sur la ligne. */
:where(h1, h2, h3, h4, h5, h6) {
	overflow-wrap: break-word;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

:focus-visible {
	outline: 2px solid var(--c-red);
	outline-offset: 2px;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link:focus {
	position: fixed;
	top: 8px;
	left: 8px;
	z-index: 1000;
	width: auto;
	height: auto;
	margin: 0;
	padding: 12px 16px;
	clip-path: none;
	background: var(--c-white);
	color: var(--c-black);
}

.icon {
	display: block;
	width: 1.25em;
	height: 1.25em;
	flex: none;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
	}
}

/* 3. Conteneur ----------------------------------------------------------- */

.container {
	width: min(100% - 2 * var(--gutter), var(--container));
	margin-inline: auto;
}

.content {
	padding-block: var(--wp--preset--spacing--50);
}

/* 4. En-tête ------------------------------------------------------------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--c-graphite);
	color: var(--c-white);
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: 16px;
	min-height: var(--header-height);
	padding-inline: var(--gutter);
}

.site-header__logo,
.custom-logo-link {
	flex: none;
	margin-right: auto;
}

.site-header__logo img,
.custom-logo-link img {
	width: 170px;
	height: auto;
}

.site-header__tools {
	display: flex;
	align-items: center;
	gap: 4px;
}

/* Petits téléphones (moins de 380 px) : le logo cède la place aux trois icônes, qui gardent 44 px. */
@media (max-width: 379px) {
	.site-header__logo,
	.custom-logo-link {
		flex: 0 1 170px;
		min-width: 0;
	}

	.site-header__logo img,
	.custom-logo-link img {
		width: 100%;
	}
}

.site-header__tool,
.site-header__burger {
	position: relative;
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--c-white);
	cursor: pointer;
	transition: color var(--transition);
}

.site-header__tool:hover,
.site-header__burger:hover {
	color: var(--c-red);
}

/* Sélecteur de langue (fourni par le plugin sonosax-core). */
.lang-switcher ul {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
}

.lang-switcher a {
	display: grid;
	place-items: center;
	min-width: 44px;
	height: 44px;
	color: var(--c-white);
	font-size: 15px;
	letter-spacing: 0.04em;
	text-decoration: none;
	transition: color var(--transition);
}

.lang-switcher a:hover,
.lang-switcher a[aria-current] {
	color: var(--c-red);
}

.lang-switcher abbr {
	text-decoration: none;
	cursor: inherit;
}

/* Grand écran : sélecteur compact, entre le menu et le panier. */
@media (min-width: 1200px) {
	.lang-switcher a {
		min-width: 30px;
		font-size: 13px;
	}
}

.site-header__cart-count {
	position: absolute;
	top: 4px;
	right: 2px;
	min-width: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: var(--c-red);
	color: var(--c-white);
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	letter-spacing: 0;
	text-align: center;
}

.site-header__burger-close,
.site-header__burger[aria-expanded="true"] .site-header__burger-open {
	display: none;
}

.site-header__burger[aria-expanded="true"] .site-header__burger-close {
	display: block;
}

/* Panneau mobile : menu et recherche, sous la barre. */
.site-header__panel {
	position: fixed;
	inset: var(--header-height) 0 0;
	display: none;
	flex-direction: column;
	gap: 24px;
	padding: 24px var(--gutter) 40px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--c-graphite);
}

.site-header.is-open .site-header__panel {
	display: flex;
}

@media (min-width: 1200px) {
	.site-header__inner {
		gap: 24px;
		padding-inline: 30px;
	}

	.site-header__logo img,
	.custom-logo-link img {
		width: 230px;
	}

	/* Sur grand écran, le panneau disparaît : son contenu s'aligne dans la barre,
	   dans l'ordre menu, panier et compte, recherche. */
	.site-header__panel,
	.site-header.is-open .site-header__panel {
		display: contents;
	}

	.site-nav {
		order: 1;
	}

	.lang-switcher {
		order: 2;
		margin-left: 16px;
	}

	.site-header__tools {
		order: 2;
		margin-left: 0;
	}

	.site-header .search-form {
		order: 3;
	}

	.site-header__burger {
		display: none;
	}
}

/* 5. Menu principal ------------------------------------------------------ */

.site-nav__list,
.site-nav .sub-menu {
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav__list > li {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	border-bottom: 1px solid rgb(255 255 255 / 0.15);
}

.site-nav a {
	flex: 1;
	padding: 16px 0;
	color: var(--c-white);
	font-size: 17px;
	line-height: 20px;
	letter-spacing: 0;
	text-decoration: none;
	transition: color var(--transition);
}

.site-nav a:hover,
.site-nav .current-menu-item > a,
.site-nav .current-menu-ancestor > a,
.site-nav .current-menu-parent > a {
	color: var(--c-red);
}

.site-nav__toggle {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--c-white);
	cursor: pointer;
}

.site-nav__toggle .icon {
	display: block;
	width: 18px;
	height: 18px;
	transition: transform var(--transition);
}

.site-nav__toggle[aria-expanded="true"] .icon {
	transform: rotate(180deg);
}

.site-nav .sub-menu {
	display: none;
	flex-basis: 100%;
	padding: 0 0 12px 16px;
}

.site-nav__toggle[aria-expanded="true"] + .sub-menu {
	display: block;
}

.site-nav .sub-menu a {
	display: block;
	padding: 11px 0;
	font-size: 16px;
}

@media (min-width: 1200px) {
	.site-nav__list {
		display: flex;
		align-items: center;
		gap: clamp(16px, 2.6vw, 40px);
	}

	.site-nav__list > li {
		flex-wrap: nowrap;
		border: 0;
	}

	.site-nav a {
		padding: 12px 0;
		font-size: var(--wp--preset--font-size--nav);
		white-space: nowrap;
	}

	.site-nav__toggle {
		width: 24px;
		height: 24px;
		margin-left: 2px;
	}

	/* Un pixel plus haut : la pointe de la flèche se cale sur le milieu des lettres, pas sur leur pied. */
	.site-nav__toggle .icon {
		position: relative;
		top: -1px;
		width: 14px;
		height: 14px;
		stroke-width: 3;
	}

	/* Sous-menu déroulant : ouvert au survol, au clavier, ou par le bouton. */
	.site-nav .sub-menu {
		position: absolute;
		top: 100%;
		left: -20px;
		z-index: 10;
		min-width: 260px;
		padding: 8px 0;
		border-radius: var(--wp--custom--radius--card);
		background: var(--c-ink);
		box-shadow: 0 12px 32px rgb(0 0 0 / 0.35);
	}

	.site-nav__list > li:hover > .sub-menu,
	.site-nav__list > li:focus-within > .sub-menu {
		display: block;
	}

	/* Fermé avec la touche Échap : il le reste tant que la souris ou le clavier n'ont pas quitté l'entrée. */
	.site-nav__list > li.is-dismissed > .sub-menu {
		display: none;
	}

	/* Toute la ligne est cliquable, pas seulement le texte. */
	.site-nav .sub-menu a {
		padding: 11px 20px;
		font-size: 14px;
		border-bottom: 1px solid rgb(255 255 255 / 0.08);
	}

	.site-nav .sub-menu li:last-child a {
		border-bottom: 0;
	}

	.site-nav .sub-menu a:hover {
		background: rgb(255 255 255 / 0.06);
	}
}

/* 6. Recherche ----------------------------------------------------------- */

.search-form {
	position: relative;
	display: flex;
	align-items: center;
	color: var(--c-white);
}

.search-form .icon {
	position: absolute;
	/* Position verticale explicite : la loupe est centrée dans le champ sur tous les navigateurs. */
	top: 50%;
	left: 10px;
	width: 16px;
	height: 16px;
	margin-top: -8px;
	stroke-width: 3;
	pointer-events: none;
}

.search-form__field {
	width: 100%;
	height: 44px;
	/* Un pixel en haut : sans lui, le texte se pose trop haut dans le champ. */
	padding: 1px 12px 0 34px;
	border: 1px solid var(--c-white);
	border-radius: var(--wp--custom--radius--field);
	background: transparent;
	color: var(--c-white);
	font-size: 16px;
	/* Hauteur de ligne entière : le texte saisi et le texte d'invite tombent au centre du champ. */
	line-height: 20px;
	letter-spacing: 0;
}

.search-form__field::placeholder {
	color: var(--c-white);
	opacity: 1;
}

.search-form__field:focus {
	border-color: var(--c-red);
	outline: 0;
}

@media (min-width: 1200px) {
	.site-header .search-form {
		width: clamp(150px, 15vw, 215px);
	}

	.site-header .search-form__field {
		height: 32px;
	}
}

/* 7. Pied de page -------------------------------------------------------- */

.site-footer {
	background: var(--c-graphite);
	color: var(--c-white);
}

.site-footer__inner {
	width: min(100% - 2 * var(--gutter), 1210px);
	margin-inline: auto;
	padding-block: 48px 40px;
}

.site-footer a {
	color: var(--c-white);
	text-decoration: none;
	transition: color var(--transition);
}

.site-footer a:hover,
.site-footer .current-menu-item > a {
	color: var(--c-red);
}

.site-footer__newsletter {
	margin-bottom: 56px;
}

.site-footer__newsletter-title {
	margin: 0 0 28px;
	font-size: 30px;
}

/* Formulaire newsletter (fourni par le plugin sonosax-core). */
.newsletter-form {
	display: grid;
	gap: 16px;
}

.newsletter-form p {
	margin: 0;
}

.newsletter-form__trap {
	position: absolute;
	left: -9999px;
}

.newsletter-form input {
	width: 100%;
	height: 60px;
	padding: 0 18px;
	border: 1px solid var(--c-white);
	border-radius: var(--wp--custom--radius--field);
	background: transparent;
	color: var(--c-white);
	font-size: 16px;
	letter-spacing: 0;
}

.newsletter-form input::placeholder {
	color: var(--c-white);
	opacity: 1;
}

.newsletter-form input:focus {
	border-color: var(--c-red);
	outline: 0;
	box-shadow: 0 0 0 1px var(--c-red);
}

.newsletter-form button {
	width: 100%;
	/* 67 px et un pixel en haut : centre au demi-pixel le texte de 18 px sur sa ligne de 20 px. */
	height: 67px;
	padding: 1px 0 0;
	line-height: 20px;
	border: 0;
	border-radius: var(--wp--custom--radius--button);
	background: var(--c-red);
	color: var(--c-white);
	font-size: 18px;
	font-weight: 700;
	letter-spacing: 0;
	cursor: pointer;
	transition: background-color var(--transition), color var(--transition);
}

.newsletter-form button:hover {
	background: var(--c-white);
	color: var(--c-black);
}

.newsletter-form__message {
	grid-column: 1 / -1;
	font-size: 15px;
}

.newsletter-form__message--email,
.newsletter-form__message--erreur {
	color: #ff6b81;
}

@media (min-width: 768px) {
	.newsletter-form {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 16px 48px;
		align-items: center;
	}
}

.site-footer__columns {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 40px 24px;
}

.site-footer__heading {
	margin: 0 0 16px;
	color: var(--c-white);
	font-size: 18px;
}

.site-footer__links {
	margin: 0;
	padding: 0;
	list-style: none;
	line-height: 31px;
}

.site-footer__column--contact {
	grid-column: 1 / -1;
	line-height: 31px;
}

.site-footer__column--contact p {
	margin: 0;
}

.site-footer__column--contact a {
	color: var(--c-red);
}

.site-footer__column--contact a:hover {
	color: var(--c-white);
}

.site-footer__bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 48px;
}

.site-footer__copyright {
	margin: 0;
	color: var(--c-red);
	font-size: 15px;
}

/* Mobile : le lien passe sous la ligne copyright et réseaux, qui garde sa mise en page. */
.site-footer__bottom {
	flex-wrap: wrap;
}

.site-footer__legal {
	order: 3;
	flex-basis: 100%;
}

@media (min-width: 768px) {
	.site-footer__legal {
		order: 0;
		flex-basis: auto;
		margin-right: auto;
	}
}

/* Vide quand la mesure d'audience n'est pas réglée : ne doit pas prendre de place. */
.site-footer__legal:empty {
	display: none;
}

.consent-link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--c-white);
	font: inherit;
	font-size: 15px;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
	transition: color var(--transition);
}

.consent-link:hover {
	color: var(--c-red);
}

.site-footer__social-list {
	display: flex;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer__social-list a {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	color: var(--c-red);
}

.site-footer__social-list .icon {
	width: 20px;
	height: 20px;
}

@media (min-width: 1024px) {
	.site-footer__inner {
		padding-block: 65px 58px;
	}

	.site-footer__newsletter {
		margin-bottom: 96px;
	}

	.site-footer__columns {
		grid-template-columns: repeat(3, 252px) minmax(0, 1fr);
		gap: 0;
	}

	.site-footer__column--contact {
		grid-column: auto;
	}

	.site-footer__bottom {
		margin-top: 64px;
	}
}

/* Bandeau de consentement (fourni par le plugin sonosax-core). En position fixe : il ne décale pas la page. */
.consent-banner {
	position: fixed;
	z-index: 200;
	right: var(--gutter);
	bottom: var(--gutter);
	left: var(--gutter);
	display: grid;
	gap: 16px;
	max-width: 560px;
	margin-left: auto;
	padding: 20px;
	border: 1px solid var(--c-gray);
	border-radius: var(--wp--custom--radius--field);
	background: var(--c-graphite);
	color: var(--c-white);
	font-size: 15px;
	line-height: 1.5;
}

.consent-banner[hidden] {
	display: none;
}

.consent-banner p {
	margin: 0;
}

.consent-banner a {
	color: var(--c-white);
	text-underline-offset: 3px;
}

.consent-banner__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

/* Les deux boutons ont le même poids : refuser est aussi simple qu'accepter. */
.consent-banner__button {
	height: 44px;
	line-height: 18px;
	border: 1px solid var(--c-white);
	border-radius: var(--wp--custom--radius--button);
	background: transparent;
	color: var(--c-white);
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color var(--transition), color var(--transition);
}

.consent-banner__button--accept,
.consent-banner__button:hover {
	background: var(--c-white);
	color: var(--c-black);
}

@media print {
	.consent-banner {
		display: none;
	}
}
