/* =============================================================
   CHROME — en-tête + pied de page  (Le Caribou Académie, thème FSE)
   Port du chrome du site principal (le-caribou-fse), adapté à une nav LMS
   (Formations, Tableau de bord) + aux blocs natifs WooCommerce (compte,
   panier). Les VALEURS appartiennent à theme.json : ici on ne fait qu'aliaser
   les noms courts vers les variables --wp--preset--* générées par le socle.
   Aucune couleur/typo en dur (sauf les teintes translucides dérivées, sans
   équivalent preset). Mobile-first : cibles tactiles ≥ 44px partout.
   ============================================================= */

/* --- alias tokens (valeurs = theme.json) + échelle de z-index --- */
.site-head,
.m-overlay,
.site-foot,
.checkout-head,
.skip-link.screen-reader-text {
	--terre: var(--wp--preset--color--terre);
	--spruce-900: var(--wp--preset--color--spruce-900);
	--spruce-800: var(--wp--preset--color--spruce-800);
	--bourgogne: var(--wp--preset--color--bourgogne);
	--bourgogne-vif: var(--wp--preset--color--bourgogne-vif);
	--clay: var(--wp--preset--color--clay);
	--sauge: var(--wp--preset--color--sauge);
	--bg: var(--wp--preset--color--bg);
	--surface: var(--wp--preset--color--surface);
	--ink: var(--wp--preset--color--ink);
	--ink-soft: var(--wp--preset--color--ink-soft);
	--line: var(--wp--preset--color--line);
	--line-strong: var(--wp--preset--color--line-strong);
	--on-dark: var(--wp--preset--color--on-dark);
	--on-dark-soft: var(--wp--preset--color--on-dark-soft);

	--grotesk: var(--wp--preset--font-family--grotesk);
	--sans: var(--wp--preset--font-family--sans);
	--ease: var(--wp--custom--ease);
	--step-0: var(--wp--preset--font-size--base); /* tout texte courant */
	--fine: var(--wp--preset--font-size--fine);   /* notes, légendes, mentions */

	--z-header: 50;
	--z-panel: 60;
	--z-overlay: 80;
}

/* --- remises à zéro, limitées au chrome --- */
.site-head, .site-head *,
.m-overlay, .m-overlay *,
.site-foot, .site-foot * { margin: 0; padding: 0; box-sizing: border-box; }

/* :where() → spécificité (0,1,0), à égalité avec les classes de composant qui
   suivent : la remise à zéro n'écrase plus .nav-link, .brand, etc. */
.site-head :where(a), .m-overlay :where(a), .site-foot :where(a) { color: inherit; text-decoration: none; }
.site-head svg, .m-overlay svg, .site-foot svg { max-width: 100%; display: block; }

body.no-scroll { overflow: hidden; }

/* WordPress applique margin-block-start (blockGap de theme.json, 1.5rem) à CHAQUE
   enfant direct de .wp-site-blocks (en-tête, contenu, pied), d'où des vides
   structurels non voulus. On l'annule pour tous les enfants de haut niveau. */
.wp-site-blocks > * { margin-block-start: 0; }
.wp-site-blocks > *:last-child { margin-block-start: var(--wp--preset--spacing--50); }
/* L'accueil se termine par la bande infolettre (fond propre, pleine largeur) :
   ce respire-avant-le-pied laisserait une bande claire parasite. (R4) */
body.home .wp-site-blocks > *:last-child { margin-block-start: 0; }
/* Même chose pour toute page qui se ferme sur une feuille pleine largeur — la
   page Contact aujourd'hui. Écrit en `:has()` plutôt qu'en classe de corps :
   la règle suit la composition, sans PHP à tenir à jour. Un navigateur sans
   `:has()` retrouve la bande claire de 40px, sans autre conséquence. */
.wp-site-blocks:has(> main .ct-band) > *:last-child { margin-block-start: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link.screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link.screen-reader-text:focus,
.skip-link.screen-reader-text:focus-visible {
	position: fixed; top: .75rem; left: .75rem; z-index: calc(var(--z-header) + 1);
	width: auto; height: auto; min-height: 44px; margin: 0; padding: .65rem 1rem;
	display: inline-flex; align-items: center; overflow: visible; clip: auto; white-space: normal;
	box-sizing: border-box; border: 0; border-radius: 8px; background: var(--bourgogne); color: var(--on-dark);
	font-family: var(--grotesk); font-weight: 700; text-decoration: none;
	outline: 2px solid var(--on-dark); outline-offset: 2px;
}
.site-head :focus-visible, .m-overlay :focus-visible, .site-foot :focus-visible { outline: 2px solid var(--bourgogne); outline-offset: 2px; border-radius: 3px; }

/* ---------- EN-TÊTE (collant + se condense) ---------- */
/* Le bloc « partie de gabarit » enferme l'en-tête dans une boîte de sa propre hauteur :
   `position: sticky` n'y a aucune course. On efface la boîte, pas l'en-tête. */
.wp-block-template-part:has(> .site-head) { display: contents; }

.site-head { position: sticky; top: 0; z-index: var(--z-header); background: oklch(0.985 0.003 100 / .88); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); transition: box-shadow .25s var(--ease), background .25s var(--ease); }
.site-head.scrolled { background: oklch(0.985 0.003 100 / .96); box-shadow: 0 6px 24px oklch(0.2 0.02 60 / .07); }
.bar { max-width: 1200px; margin: 0 auto; padding: .8rem clamp(1rem, 4vw, 2.5rem); display: flex; align-items: center; gap: 1rem; transition: padding .25s var(--ease); }
.site-head.scrolled .bar { padding-top: .55rem; padding-bottom: .55rem; }

.brand { font-family: var(--grotesk); font-weight: 800; font-size: 1.15rem; letter-spacing: -.03em; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .55rem; flex-shrink: 0; }
.brand .glyph { width: 26px; height: 26px; color: var(--bourgogne); transition: transform .25s var(--ease); flex-shrink: 0; }
.site-head.scrolled .brand .glyph { transform: scale(.92); }
.brand-sub { font-weight: 500; font-size: .72em; letter-spacing: 0; color: var(--ink-soft); margin-left: .15em; }
.m-top .brand-sub { color: var(--on-dark-soft); }

.nav { margin-left: auto; display: flex; align-items: center; gap: .2rem; font-family: var(--grotesk); font-weight: 600; font-size: .96rem; }
.nav-link { text-decoration: none; color: var(--ink-soft); position: relative; padding: .6rem .8rem; border-radius: 8px; min-height: 44px; display: inline-flex; align-items: center; transition: color .2s, background .2s; }
.nav-link:hover { color: var(--ink); background: var(--surface); }

/* --- comptes/panier (blocs natifs WooCommerce) --- */
.head-account, .head-cart { display: flex; align-items: center; margin-left: .1rem; }
.head-account .wc-block-customer-account__link,
.head-account > a,
.wc-block-mini-cart__button {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 44px; height: 44px; padding-inline: .75rem; gap: .45rem;
	box-sizing: border-box; border-radius: 8px; border: 0; background: none;
	color: var(--ink-soft); cursor: pointer; transition: color .2s, background .2s;
}
.wc-block-mini-cart__button { width: 44px; padding-inline: 0; }
.head-account .wc-block-customer-account__link,
.head-account > a { font-family: var(--grotesk); font-weight: 600; font-size: .96rem; }
.head-account .wc-block-customer-account__link:hover,
.head-account > a:hover,
.wc-block-mini-cart__button:hover { color: var(--ink); background: var(--surface); }
.head-account svg, .wc-block-mini-cart__icon { width: 21px; height: 21px; color: currentColor; }
/* Pastille du compteur panier : WooCommerce impose par défaut un vert foncé
   sur texte quasi-noir (illisible). On reprend la main avec une spécificité
   supérieure (scopée sous .head-cart) + !important pour battre le style natif. */
.head-cart .wc-block-mini-cart__badge { background: var(--bourgogne) !important; color: var(--on-dark) !important; font-family: var(--grotesk); font-weight: 700; }

/* Pied du tiroir : deux boutons côte à côte dans une colonne étroite. La Grotesk 700 du bouton
   de charte y est plus large que la police que WooCommerce y mettait, et « Valider la commande »
   repassait sur deux lignes. On resserre le texte et les gouttières pour ce seul contexte. */
.wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-cart,
.wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-checkout,
.wc-block-mini-cart__footer .wc-block-mini-cart__footer-cart,
.wc-block-mini-cart__footer .wc-block-mini-cart__footer-checkout {
	padding-inline: 0.7rem;
	font-size: 0.94rem;
	white-space: nowrap;
}
/* Chaque ligne du tiroir affiche le prix deux fois : sous le nom (prix unitaire) et à
   droite (total de la ligne). Un cours se vend à l'unité, les deux sont toujours égaux :
   on garde celui de droite, aligné sur le sous-total. */
.wc-block-mini-cart__products-table table.wc-block-cart-items .wc-block-cart-items__row .wc-block-cart-item__prices { display: none; }

/* ---------- CLOCHE DE NOTIFICATIONS ----------
   Même affordance que le compte et le panier voisins (44px, encre douce, fond
   surface au survol) : trois boutons de la même barre ne peuvent pas avoir trois
   grammaires. ⚠️ La barre est CLAIRE — jeu ink / ink-soft / clay ici, jamais
   on-dark, qui appartient au menu mobile et au pied sapin. La pastille est le
   seul aplat : bourgogne + on-dark, comme celle du panier. */
/* Pas de `position: relative` ici, volontairement : le panneau s'ancre sur
   .site-head (collant, donc positionné) et non sur la cloche. Ancré à la cloche,
   il partait hors écran par la gauche sur mobile — le bouton n'est pas au bord
   droit, il a le compte, le panier et le hamburger après lui. */
.head-bell { display: flex; align-items: center; }
.bell-btn {
	position: relative; display: inline-flex; align-items: center; justify-content: center;
	width: 44px; height: 44px; padding: 0; box-sizing: border-box;
	border: 0; border-radius: 8px; background: none; color: var(--ink-soft);
	cursor: pointer; transition: color .2s, background .2s;
}
.bell-btn:hover { color: var(--ink); background: var(--surface); }
.bell-btn svg { width: 21px; height: 21px; }
.head-bell.is-open .bell-btn { color: var(--ink); background: var(--surface); }

.bell-badge {
	position: absolute; top: 3px; right: 3px;
	min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
	display: grid; place-items: center; border-radius: 999px;
	/* L'anneau au ton du fond détache la pastille du dessin de la cloche. */
	border: 2px solid var(--bg); background: var(--bourgogne); color: var(--on-dark);
	font-family: var(--grotesk); font-size: 11px; font-weight: 700; line-height: 1;
}
.bell-badge[hidden] { display: none; }

/* Le panneau : liste plate en filets, pas de cartes empilées — même grammaire que
   le fil Q&R de la leçon. Ancré à droite du bouton, largeur bornée au viewport. */
.bell-panel {
	/* Aligné sur la gouttière de la barre : même bord droit que le contenu. */
	position: absolute; top: calc(100% + 10px); right: clamp(1rem, 4vw, 2.5rem); z-index: var(--z-panel);
	width: min(23rem, calc(100vw - 2rem));
	max-height: min(70vh, 30rem); overflow-y: auto; overscroll-behavior: contain;
	background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
	box-shadow: 0 18px 44px -18px oklch(0.2 0.02 60 / .3), 0 2px 6px oklch(0.2 0.02 60 / .06);
	opacity: 0; visibility: hidden; transform: translateY(-6px);
	transition: opacity .18s var(--ease), transform .18s var(--ease), visibility 0s linear .18s;
}
.head-bell.is-open .bell-panel {
	opacity: 1; visibility: visible; transform: none;
	transition: opacity .18s var(--ease), transform .18s var(--ease), visibility 0s linear 0s;
}

/* Collants tous les deux : au-delà de quelques notifications la liste défile, et
   ni le compte ni le bouton « tout marquer » ne doivent partir hors de vue. */
.bell-etat {
	position: sticky; top: 0; z-index: 1;
	margin: 0; padding: .85rem 1rem .7rem; background: var(--bg);
	font-family: var(--grotesk); font-size: .8rem; font-weight: 700;
	letter-spacing: .01em; color: var(--clay);
}

.bell-liste { list-style: none; margin: 0; padding: 0; }
.bell-item + .bell-item { border-top: 1px solid var(--line); }
.bell-item__lien {
	display: grid; grid-template-columns: 14px 1fr; gap: 2px .6rem;
	padding: .8rem 1rem .9rem; text-decoration: none; transition: background .18s var(--ease);
}
.bell-item__lien:hover { background: var(--surface); }
.bell-item__point { grid-row: 1 / span 3; width: 8px; height: 8px; margin-top: .42rem; border-radius: 50%; background: transparent; }
.bell-item.is-neuve .bell-item__point { background: var(--bourgogne); }
.bell-item__titre { font-family: var(--grotesk); font-size: .93rem; font-weight: 600; line-height: 1.35; color: var(--ink); }
/* Une notification déjà lue s'efface d'un cran — elle reste lisible (ink-soft
   passe 4,5:1 sur le fond), elle cesse juste de réclamer l'attention. */
.bell-item:not(.is-neuve) .bell-item__titre { font-weight: 500; color: var(--ink-soft); }
.bell-item__corps {
	font-family: var(--sans); font-size: .88rem; line-height: 1.5; color: var(--ink-soft);
	display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.bell-item__date { margin-top: .15rem; font-family: var(--grotesk); font-size: .76rem; font-weight: 500; color: var(--clay); }

.bell-tout {
	position: sticky; bottom: 0; z-index: 1;
	display: block; width: 100%; min-height: 44px; padding: .7rem 1rem;
	border: 0; border-top: 1px solid var(--line); border-radius: 0 0 11px 11px;
	background: var(--surface); color: var(--terre); cursor: pointer;
	font-family: var(--grotesk); font-size: .86rem; font-weight: 700;
	transition: background .18s var(--ease), color .18s var(--ease);
}
.bell-tout:hover { background: var(--line); color: var(--bourgogne); }
.bell-tout:disabled { background: var(--surface); color: var(--clay); cursor: default; }

/* hamburger — 48px : cible tactile confortable (au-dessus du plancher WCAG 44px) */
.burger { display: none; margin-left: .2rem; width: 48px; height: 48px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); cursor: pointer; position: relative; flex-shrink: 0; }
.burger span { position: absolute; left: 13px; right: 13px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .28s var(--ease), opacity .2s; }
.burger span:nth-child(1) { top: 17px; }
.burger span:nth-child(2) { top: 23px; }
.burger span:nth-child(3) { top: 29px; }

@media (max-width: 780px) {
	.nav { display: none; }
	/* C'est .nav qui portait le margin-left: auto : masquée, plus rien ne poussait
	   compte, panier et hamburger au bord droit — ils restaient collés à la marque. */
	.brand { margin-right: auto; }
	.burger { display: block; }
}

@media (max-width: 900px) {
	.head-account .label { display: none; }
	.head-account .wc-block-customer-account__link,
	.head-account > a { width: 44px; padding-inline: 0; }
}

/* En-tête très étroit : logo + compte + panier + burger ne tiennent plus avec
   le sous-titre « Académie » du lockup — on le masque, le glyphe + « Le Caribou »
   suffisent à identifier la marque (pas de perte de sens, juste de la place). */
@media (max-width: 420px) {
	.brand-sub { display: none; }
	.bar { gap: .5rem; }
}

/* ---------- MENU MOBILE plein écran (sombre) ---------- */
.m-overlay { position: fixed; inset: 0; z-index: var(--z-overlay); background: var(--spruce-900); color: var(--on-dark); display: flex; flex-direction: column; padding: 1rem clamp(1.2rem, 6vw, 2rem) 2rem; opacity: 0; visibility: hidden; transform: translateY(-12px); transition: opacity .3s var(--ease), transform .3s var(--ease), visibility 0s linear .3s; overflow-y: auto; }
body.menu-open .m-overlay { opacity: 1; visibility: visible; transform: none; transition: opacity .3s var(--ease), transform .3s var(--ease), visibility 0s linear 0s; }
body.menu-open .burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.menu-open .burger span:nth-child(2) { opacity: 0; }
body.menu-open .burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.m-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.m-top .brand { color: var(--on-dark); }
.m-top .brand .glyph { color: var(--bourgogne); }
.m-close { width: 44px; height: 44px; border: 1px solid oklch(0.5 0.03 178 / .5); border-radius: 10px; background: none; color: var(--on-dark); font-size: 1.3rem; cursor: pointer; display: grid; place-items: center; line-height: 1; }
.m-nav { display: flex; flex-direction: column; font-family: var(--grotesk); }
.m-nav a { font-weight: 700; font-size: 1.5rem; letter-spacing: -.02em; color: var(--on-dark); text-decoration: none; padding: 1.1rem 0; border-bottom: 1px solid oklch(0.5 0.03 178 / .28); min-height: 44px; }
/* Se déconnecter : une action, pas une destination — un cran plus bas que les
   entrées de navigation, même ligne et même cible de 44px. Fond sombre : on-dark-soft. */
.m-nav .m-out { font-weight: 600; font-size: 1.1rem; letter-spacing: 0; color: var(--on-dark-soft); }
.m-nav .m-out:hover { color: var(--on-dark); }
.m-note { margin-top: 1.6rem; font-family: var(--sans); font-size: var(--fine); color: var(--on-dark-soft); text-align: center; }

/* ---------- EN-TÊTE DU TUNNEL (paiement sans distraction) ----------
   WooCommerce sert son propre gabarit sur /checkout/ : ni navigation ni pied de
   page, pour qu'on aille au bout de la commande. On garde ce principe et on ne
   reprend que la marque — surcharge de parts/checkout-header.html. */
.checkout-head, .checkout-head * { margin: 0; padding: 0; box-sizing: border-box; }
.checkout-head :where(a) { color: inherit; text-decoration: none; }
.checkout-head svg { max-width: 100%; display: block; }
.checkout-head { background: var(--bg); border-bottom: 1px solid var(--line); }
.checkout-head__bar { max-width: 1200px; margin: 0 auto; padding: .9rem clamp(1rem, 4vw, 2.5rem); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.checkout-head :focus-visible { outline: 2px solid var(--bourgogne); outline-offset: 2px; border-radius: 3px; }
.checkout-head .wc-block-checkout__cart-link,
.checkout-head .wp-block-woocommerce-cart-link a {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 44px; min-height: 44px; border-radius: 8px; color: var(--ink-soft);
	transition: color .2s, background .2s;
}
.checkout-head .wc-block-checkout__cart-link:hover,
.checkout-head .wp-block-woocommerce-cart-link a:hover { color: var(--ink); background: var(--surface); }

/* ---------- PIED sapin sombre ---------- */
.site-foot { background: var(--spruce-900); color: var(--on-dark); border-top: 3px solid var(--bourgogne); }
.foot-wrap { max-width: 1200px; margin: 0 auto; padding: clamp(2.4rem, 5vw, 3.6rem) clamp(1.2rem, 4vw, 2.5rem) 1.5rem; }

.sitemap { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 2rem clamp(1.5rem, 3vw, 2.5rem); }
.sm-brand .brand { color: var(--on-dark); font-size: 1.3rem; }
.sm-brand .brand .glyph { color: var(--bourgogne); }
/* « Académie » garde sinon l'encre douce du fond clair : illisible sur le sapin. */
.sm-brand .brand-sub { color: var(--on-dark-soft); }
.sm-brand p { font-family: var(--sans); font-size: var(--fine); line-height: 1.6; color: var(--on-dark-soft); margin-top: .9rem; }
/* Les réseaux, sous le texte de marque : une ligne en Grotesk, même gris chaud
   que le texte, blanc au survol. Chaque lien fait 44px de haut pour le pouce,
   et la ligne se replie sur elle-même si la colonne se resserre. */
.sm-brand .sm-social { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.1rem; margin-top: .4rem; font-family: var(--grotesk); font-size: var(--fine); max-width: none; }
.sm-social a { color: var(--on-dark-soft); font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: .25rem; min-height: 44px; transition: color .2s; }
.sm-social .up { font-size: .9em; }
.sm-social a:hover { color: var(--on-dark); }
.sm-col h3 { font-family: var(--grotesk); font-weight: 700; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--sauge); margin-bottom: 1rem; }
.sm-col ul { list-style: none; }
.sm-col li { margin: .5rem 0; }
.sm-col a { font-family: var(--grotesk); font-weight: 500; font-size: .98rem; color: var(--on-dark-soft); text-decoration: none; transition: color .2s; display: inline-flex; align-items: center; min-height: 44px; }
.sm-col a:hover { color: var(--on-dark); }

.foot-bottom { border-top: 1px solid oklch(0.5 0.03 178 / .3); padding: 1.4rem clamp(1.2rem, 4vw, 2.5rem); max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-family: var(--grotesk); font-size: .85rem; color: var(--on-dark-soft); }
.foot-bottom a { color: var(--on-dark-soft); text-decoration: none; transition: color .2s; display: inline-flex; align-items: center; gap: .25rem; }
.foot-bottom a:hover { color: var(--sauge); }
/* La flèche suit la couleur de son lien (et son survol) : l'argile est un ton de
   fond clair, elle tombait à 3,6:1 sur le sapin. */
.foot-bottom .up { font-size: .9em; }
.foot-bottom .legal { display: inline-flex; flex-wrap: wrap; gap: .4rem 1.4rem; }

@media (max-width: 720px) {
	.sitemap { grid-template-columns: 1fr 1fr; }
	.sm-brand { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
	.sitemap { grid-template-columns: 1fr; }
	.foot-bottom { flex-direction: column; align-items: flex-start; gap: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
	.m-overlay, .site-head, .bar, .brand .glyph, .burger span { transition: none !important; }
	.m-overlay { transform: none !important; }
	/* Le panneau apparaît d'un coup ; visibility garde la bascule instantanée. */
	.bell-panel { transition: visibility 0s !important; transform: none !important; }
}
