/* ================================================================
   HEAR THE LIGHT — Design system (refonte nov. 2026)
   Chargé par toutes les pages. Voir docs/refonte-hearthelight/DESIGN.md
   Règle projet : animations toujours actives (pas de prefers-reduced-motion).
   Mobile : uniquement dans @media (max-width: 768px).
   ================================================================ */

/* ── Palettes ─────────────────────────────────────────────────── */
:root,
[data-palette="tungstene"] {
  --bg: #06060A; --bg-2: #101016; --bg-3: #17171F;
  --fg: #F2EEE6; --muted: #A29D94; --line: rgba(242, 238, 230, .12);
  --light: #FFB341; --light-2: #FF6A3D; --on-light: #140A00;
  --scheme: dark;
}
[data-palette="neon"] {
  --bg: #07040F; --bg-2: #110B1E; --bg-3: #1A1229;
  --fg: #F1ECFF; --muted: #A59CBE; --line: rgba(241, 236, 255, .12);
  --light: #FF3DA8; --light-2: #3DE3FF; --on-light: #12000A;
  --scheme: dark;
}
[data-palette="heure-bleue"] {
  --bg: #081127; --bg-2: #0E1A37; --bg-3: #152447;
  --fg: #E9EEFA; --muted: #98A4C2; --line: rgba(233, 238, 250, .13);
  --light: #F4D27A; --light-2: #7FA7FF; --on-light: #171000;
  --scheme: dark;
}
[data-palette="infrarouge"] {
  --bg: #0A0505; --bg-2: #160B0A; --bg-3: #21110F;
  --fg: #F5E9E6; --muted: #B09891; --line: rgba(245, 233, 230, .12);
  --light: #FF3B2F; --light-2: #FF9A62; --on-light: #140505; /* texte foncé : 5,6:1 (le blanc ne faisait que 3,5:1) */
  --scheme: dark;
}
[data-palette="plein-jour"] {
  --bg: #EDEEEA; --bg-2: #E2E3DE; --bg-3: #D6D8D1;
  --fg: #0E0F12; --muted: #5C5F66; --line: rgba(14, 15, 18, .14);
  --light: #C43C17; --light-2: #F2A33A; --on-light: #fff; /* orange assez dense : 5,2:1 sous le blanc, 4,5:1 sur le fond */
  --scheme: light;
}
[data-palette="polaroid"] {
  --bg: #F1E9DF; --bg-2: #E7DDD0; --bg-3: #DCD0C1;
  --fg: #1A1410; --muted: #6E6259; --line: rgba(26, 20, 16, .14);
  --light: #2D5BFF; --light-2: #F25C8E; --on-light: #fff;
  --scheme: light;
}

:root {
  --font-display: 'Anybody', 'Geist', system-ui, sans-serif;
  --font-body: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: clamp(20px, 4vw, 64px);
  --maxw: 1600px;
  --r-media: 20px;
  --r-pill: 999px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --nav-h: 76px;
  color-scheme: var(--scheme);
}

/* ── Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body.htl {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color .5s var(--ease-out), color .5s var(--ease-out);
}
body.htl img, body.htl video, body.htl canvas, body.htl iframe { display: block; max-width: 100%; }
:where(body.htl) a { color: inherit; text-decoration: none; }
:where(body.htl) button { font: inherit; color: inherit; }
body.htl ::selection { background: var(--light); color: var(--on-light); }
body.htl :focus-visible { outline: 2px solid var(--light); outline-offset: 3px; border-radius: 4px; }

.htl-wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* ── Typographie ──────────────────────────────────────────────── */
.htl-display, .htl-h1, .htl-h2, .htl-h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: .92;
  letter-spacing: -.01em;
  margin: 0;
  text-wrap: balance;
}
.htl-display { font-size: clamp(64px, 12.5vw, 210px); font-variation-settings: 'wdth' 82; line-height: .86; }
.htl-h1 { font-size: clamp(48px, 7.4vw, 120px); font-variation-settings: 'wdth' 88; }
.htl-h2 { font-size: clamp(36px, 4.8vw, 76px); font-variation-settings: 'wdth' 92; }
.htl-h3 { font-size: clamp(22px, 2vw, 30px); font-variation-settings: 'wdth' 100; line-height: 1.05; }
.htl-lead { font-size: clamp(18px, 1.5vw, 22px); line-height: 1.45; color: var(--fg); max-width: 34em; margin: 0; }
.htl-body { color: var(--muted); max-width: 62ch; }
.htl-small { font-size: 14px; color: var(--muted); }

/* Titre qui « s'accorde » : la largeur passe de condensée à normale */
.htl-tune { font-variation-settings: 'wdth' 50; opacity: 0; transition: font-variation-settings 1.4s var(--ease-out), opacity .9s var(--ease-out); }
.htl-tune.is-in { font-variation-settings: 'wdth' var(--tune-to, 82); opacity: 1; }
.htl-tune > span { display: inline-block; transition: font-variation-settings 1.4s var(--ease-out); }

/* ── Boutons ──────────────────────────────────────────────────── */
.htl-btn {
  --b-bg: var(--fg); --b-fg: var(--bg);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  height: 52px; padding: 0 26px;
  border: 0; border-radius: var(--r-pill);
  background: var(--b-bg); color: var(--b-fg);
  font-family: var(--font-body); font-weight: 600; font-size: 15px; letter-spacing: .005em;
  cursor: pointer; white-space: nowrap; overflow: hidden; isolation: isolate;
  transition: transform .4s var(--ease-out), background-color .3s, color .3s;
}
.htl-btn::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(120px 120px at var(--mx, 50%) var(--my, 50%), var(--light), transparent 70%);
  opacity: 0; transition: opacity .35s;
}
.htl-btn:hover::before { opacity: .55; }
.htl-btn--light { --b-bg: var(--light); --b-fg: var(--on-light); }
.htl-btn--ghost { --b-bg: transparent; --b-fg: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.htl-btn--ghost:hover { box-shadow: inset 0 0 0 1px var(--fg); }
.htl-btn--sm { height: 40px; padding: 0 18px; font-size: 14px; }

.htl-link { position: relative; display: inline-block; }
.htl-link::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform .45s var(--ease-out);
}
.htl-link:hover::after, .htl-link.is-current::after { transform: scaleX(1); transform-origin: left; }

/* ── Navigation ───────────────────────────────────────────────── */
.htl-nav {
  position: fixed; inset: 0 0 auto 0; z-index: 900;
  height: var(--nav-h);
  display: flex; align-items: center;
  transition: transform .5s var(--ease-out), background-color .4s;
}
.htl-nav.is-scrolled { background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.htl-nav.is-hidden { transform: translateY(-100%); }
.htl-nav__in { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; }
.htl-logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: .02em; font-variation-settings: 'wdth' 78; text-transform: uppercase; line-height: 1; }
.htl-logo svg { width: 26px; height: 26px; color: var(--light); flex: none; }
.htl-nav__links { display: flex; gap: 28px; font-size: 14px; font-weight: 500; }
.htl-nav__links a { color: var(--muted); transition: color .25s; }
.htl-nav__links a:hover, .htl-nav__links a.is-current { color: var(--fg); }
.htl-nav__right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.htl-icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--fg); display: inline-grid; place-items: center; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .25s, background-color .25s; position: relative; }
.htl-icon-btn:hover { box-shadow: inset 0 0 0 1px var(--fg); }
.htl-icon-btn svg { width: 18px; height: 18px; }

/* Sélecteur de langue FR / EN */
.htl-lang { display: inline-flex; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px var(--line); padding: 3px; font-size: 12px; font-weight: 600; }
.htl-lang button { border: 0; background: transparent; padding: 6px 10px; border-radius: var(--r-pill); cursor: pointer; color: var(--muted); letter-spacing: .04em; }
.htl-lang button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* Menu plein écran */
.htl-burger { display: none; }
.htl-menu { position: fixed; inset: 0; z-index: 950; background: var(--bg); visibility: hidden; opacity: 0; transition: opacity .45s var(--ease-out), visibility 0s linear .45s; display: flex; flex-direction: column; padding: calc(var(--nav-h) + 24px) var(--gutter) 32px; }
.htl-menu.is-open { visibility: visible; opacity: 1; transition: opacity .45s var(--ease-out); }
.htl-menu a.htl-menu__item { font-family: var(--font-display); font-weight: 800; font-size: clamp(40px, 9vw, 96px); line-height: 1.02; font-variation-settings: 'wdth' 70; transition: font-variation-settings .6s var(--ease-out), color .3s; display: block; }
.htl-menu a.htl-menu__item:hover, .htl-menu a.htl-menu__item.is-current { font-variation-settings: 'wdth' 110; color: var(--light); }

/* ── Dock (son + palette) ─────────────────────────────────────── */
.htl-dock { position: fixed; left: var(--gutter); bottom: 22px; z-index: 880; display: flex; gap: 8px; }
.htl-dock .htl-icon-btn { background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.htl-sound-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.htl-sound-bars i { width: 2px; height: 30%; background: currentColor; border-radius: 1px; transition: height .3s; }
.htl-sound-on .htl-sound-bars i { animation: htl-eq 1s var(--ease-in-out) infinite alternate; }
.htl-sound-bars i:nth-child(2) { animation-delay: -.3s !important; }
.htl-sound-bars i:nth-child(3) { animation-delay: -.6s !important; }
.htl-sound-bars i:nth-child(4) { animation-delay: -.15s !important; }
@keyframes htl-eq { from { height: 25%; } to { height: 100%; } }

.htl-palettes { position: absolute; left: 0; bottom: calc(100% + 10px); background: var(--bg-2); border-radius: 18px; padding: 14px; box-shadow: inset 0 0 0 1px var(--line); display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; min-width: 260px; opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .3s var(--ease-out), transform .3s var(--ease-out), visibility 0s linear .3s; }
.htl-palettes.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity .3s var(--ease-out), transform .3s var(--ease-out); }
.htl-swatch { border: 0; padding: 0; background: transparent; cursor: pointer; display: grid; gap: 6px; justify-items: center; font-size: 11px; color: var(--muted); }
.htl-swatch__dot { width: 54px; height: 38px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); position: relative; overflow: hidden; }
.htl-swatch__dot::after { content: ''; position: absolute; left: 22%; right: 22%; bottom: 0; height: 70%; background: linear-gradient(to top, var(--sw-light), transparent); filter: blur(2px); }
.htl-swatch[aria-pressed="true"] { color: var(--fg); }
.htl-swatch[aria-pressed="true"] .htl-swatch__dot { box-shadow: 0 0 0 2px var(--fg); }

/* ── Curseur « spot » (desktop) ───────────────────────────────── */
.htl-cursor { position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--fg); mix-blend-mode: difference; transition: width .35s var(--ease-out), height .35s var(--ease-out), margin .35s var(--ease-out), opacity .3s; }
.htl-cursor.is-hover { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
.htl-cursor.is-media { width: 92px; height: 92px; margin: -46px 0 0 -46px; mix-blend-mode: normal; background: var(--light); color: var(--on-light); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.htl-cursor__label { opacity: 0; transition: opacity .2s; }
.htl-cursor.is-media .htl-cursor__label { opacity: 1; }
.htl-spot { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(520px 520px at var(--sx, -999px) var(--sy, -999px), color-mix(in srgb, var(--light) 9%, transparent), transparent 70%); }
html.htl-touch .htl-cursor, html.htl-touch .htl-spot { display: none; }

/* ── Sections génériques ──────────────────────────────────────── */
.htl-section { position: relative; z-index: 2; padding: clamp(80px, 11vw, 180px) 0; }
.htl-section--tight { padding: clamp(56px, 7vw, 110px) 0; }
.htl-section__head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); align-items: end; gap: 32px; margin-bottom: clamp(36px, 5vw, 72px); }
.htl-rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* Apparition au scroll : discrète, un seul geste (opacité + léger décalage) */
.htl-reveal { opacity: 0; transform: translateY(24px); transition: opacity 1s var(--ease-out), transform 1s var(--ease-out); }
.htl-reveal.is-in { opacity: 1; transform: none; }

/* ── Cartes médias / travaux ──────────────────────────────────── */
.htl-media { position: relative; border-radius: var(--r-media); overflow: hidden; background: var(--bg-2); }
.htl-media img, .htl-media video { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease-out); }
.htl-media:hover img, .htl-media:hover video { transform: scale(1.04); }

/* ── Pied de page ─────────────────────────────────────────────── */
.htl-footer { position: relative; z-index: 2; padding: clamp(64px, 8vw, 120px) 0 32px; border-top: 1px solid var(--line); }
.htl-footer__big { font-family: var(--font-display); font-weight: 800; font-size: clamp(40px, 11vw, 230px); line-height: .8; font-variation-settings: 'wdth' 96; letter-spacing: -.01em; margin: 0 0 48px; white-space: nowrap; text-transform: uppercase; }
/* Grand mot sur une ligne (js : HTLBigWord) : chaque lettre s'élargit sous la souris */
.htl-bigword { display: block; white-space: nowrap; width: max-content; max-width: none; padding-top: .06em; }
.htl-bigword__ch { display: inline-block; transition: font-variation-settings .5s var(--ease-out); }
.htl-footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; font-size: 14px; }
.htl-footer__grid h4 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 14px; }
.htl-footer__grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.htl-footer__bottom { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }

/* ── Transition de page : balayage de lumière ─────────────────── */
.htl-veil { position: fixed; inset: 0; z-index: 9990; pointer-events: none; background: var(--bg); transform: scaleY(0); transform-origin: bottom; }
.htl-veil::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--light), var(--light-2), transparent); box-shadow: 0 0 24px var(--light); }
.htl-veil.is-leaving { transform: scaleY(1); transition: transform .55s var(--ease-in-out); }

/* ================================================================
   MOBILE (≤ 768px) — règles mobiles uniquement ici
   ================================================================ */
@media (max-width: 768px) {
  :root { --nav-h: 64px; }
  .htl-nav__in { grid-template-columns: 1fr auto; }
  .htl-nav__links { display: none; }
  .htl-nav__right .htl-btn { display: none; }
  .htl-burger { display: inline-grid; }
  .htl-section__head { grid-template-columns: 1fr; }
  .htl-footer__grid { grid-template-columns: 1fr 1fr; }
  .htl-footer__grid > :first-child { grid-column: 1 / -1; }
  .htl-dock { bottom: 16px; }
  .htl-palettes { min-width: 240px; }
  .htl-btn { height: 48px; padding: 0 22px; }
}

/* ================================================================
   PONT DE COMPATIBILITÉ — anciens jetons (htl-v2.css, formations,
   admin, styles injectés en JS) branchés sur les nouvelles palettes.
   --a1 / --a2 / --wash restent au format « R,G,B » (rgba(var(--a1),x)).
   ================================================================ */
html[data-palette] {
  --sans: var(--font-display);
  --body: var(--font-body);
  --text: var(--fg);
  --s: var(--bg-2);
  --card: var(--bg-3);
  --b: var(--line);
  --bh: color-mix(in srgb, var(--fg) 28%, transparent);
  --dim: color-mix(in srgb, var(--fg) 38%, var(--bg));
  --orange: var(--light);
  --purple: var(--light-2);
  --grad: linear-gradient(135deg, var(--light), var(--light-2));
  --grad-t: linear-gradient(135deg, var(--light), var(--light-2));
  --glow-a1: 0 0 40px rgba(var(--a1), .28);
  --glow-a2: 0 0 40px rgba(var(--a2), .24);
  --rx: var(--r-pill);
}
html[data-palette="tungstene"]   { --wash: 242,238,230; --a1: 255,179,65;  --a2: 255,106,61; }
html[data-palette="neon"]        { --wash: 241,236,255; --a1: 255,61,168;  --a2: 61,227,255; }
html[data-palette="heure-bleue"] { --wash: 233,238,250; --a1: 244,210,122; --a2: 127,167,255; }
html[data-palette="infrarouge"]  { --wash: 245,233,230; --a1: 255,59,47;   --a2: 255,154,98; }
html[data-palette="plein-jour"]  { --wash: 14,15,18;    --a1: 196,60,23;   --a2: 242,163,58; }
html[data-palette="polaroid"]    { --wash: 26,20,16;    --a1: 45,91,255;   --a2: 242,92,142; }

/* ── Compléments du menu plein écran et de la nav ─────────────── */
.htl-menu__close { position: absolute; top: calc((var(--nav-h) - 40px) / 2); right: var(--gutter); }
.htl-menu__list { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.htl-menu__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: auto; padding-top: 28px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.htl-nav__right > .htl-lang { order: 1; }
.htl-nav__right > #account-ctrl { order: 2; }
.htl-nav__right > .cart-toggle-btn { order: 3; }
.htl-nav__right > .htl-nav__cta { order: 4; }
.htl-nav__right > .htl-burger { order: 5; }
.cart-toggle-btn .cart-count { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--light); color: var(--on-light); font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; }
.cart-toggle-btn .cart-count:empty, .cart-toggle-btn .cart-count[data-zero] { display: none; }
html.htl-menu-on { overflow: hidden; }
.htl-footer__cookies { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: inherit; text-align: left; }

/* Bouton « rouvrir les cookies » (injecté par cookie-consent.js) : rangé dans le dock */
#km-cookie-reopen { left: calc(var(--gutter) + 48px) !important; bottom: 22px !important; width: 40px !important; height: 40px !important; }
/* Le dock n'a un bouton son que sur l'accueil (PC) : le bouton cookies se cale juste après le dernier bouton visible */
body:has(.htl-dock [data-htl-sound]:not([style*="none"])) #km-cookie-reopen { left: calc(var(--gutter) + 96px) !important; }

@media (max-width: 768px) {
  .htl-nav__right > .htl-lang { display: none; }
  #km-cookie-reopen { bottom: 16px !important; left: calc(var(--gutter) + 48px) !important; }
}
.htl-nav__links { list-style: none; margin: 0; padding: 0; }
.htl-nav__links li { margin: 0; padding: 0; }

/* Le dock passe sous les fenêtres des formations (GOAT, ABEL…) */
html:has(.goat-modal-overlay[style*="flex"]) .htl-dock,
html:has(.abel-modal-overlay[style*="flex"]) .htl-dock { visibility: hidden; }
.htl-logo, .htl-logo span { white-space: nowrap; }
/* Écrans moyens (petits portables) : les liens passent dans le menu */
@media (min-width: 769px) and (max-width: 1340px) {
  .htl-nav__links { display: none; }
  .htl-nav__in { grid-template-columns: 1fr auto; }
  .htl-burger { display: inline-grid; }
}
.htl-footer a, .htl-menu__foot a { overflow-wrap: anywhere; }
/* Adresse e-mail du pied de page : coupure seulement après « @ » (<wbr> posé par htl-shell.js) */
.htl-footer a.htl-footer__mail { overflow-wrap: normal; }

/* ── Dock (son, palette, cookies) sur PC : jamais posé sur le contenu ──
   ≥ 1200 px : rangé en colonne dans la marge gauche (la gouttière fait ≥ 48 px).
   769–1199 px : la marge est trop étroite → il s'efface en descendant et
   revient en remontant (classe html.htl-dock-away posée par htl-shell.js).
   Mobile (≤ 768 px) inchangé. L'admin garde son propre placement. */
@media (min-width: 1200px) {
  body:not(.adm-body) .htl-dock { left: max(4px, calc((var(--gutter) - 40px) / 2)); bottom: 70px; flex-direction: column; }
  body:not(.adm-body) #km-cookie-reopen,
  body:not(.adm-body):has(.htl-dock [data-htl-sound]:not([style*="none"])) #km-cookie-reopen { left: max(4px, calc((var(--gutter) - 40px) / 2)) !important; bottom: 22px !important; }
  body:not(.adm-body) .htl-palettes { left: calc(100% + 10px); bottom: 0; transform: translateX(-8px); }
  body:not(.adm-body) .htl-palettes.is-open { transform: none; }
}
@media (min-width: 769px) and (max-width: 1199px) {
  body:not(.adm-body) .htl-dock, body:not(.adm-body) #km-cookie-reopen { transition: transform .5s var(--ease-out), opacity .4s var(--ease-out); }
  html.htl-dock-away body:not(.adm-body) .htl-dock,
  html.htl-dock-away body:not(.adm-body) #km-cookie-reopen { transform: translateY(calc(100% + 30px)); opacity: 0; pointer-events: none; }
}

/* ================================================================
   CHANTIER MOBILE (30/11) — téléphones uniquement.
   Deux cibles, aucune ne touche un PC à souris :
     · portrait : @media (max-width: 768px)
     · téléphone couché : (pointer: coarse) and (max-height: 520px)
   ================================================================ */
/* Éléments réservés au téléphone (masqués partout ailleurs) */
.htl-menu__cta, .htl-menu__palname, .htl-mail-short { display: none; }

@media (max-width: 768px), (pointer: coarse) and (max-height: 520px) {
  /* Zones sûres (encoche, Dynamic Island, barre d'accueil ; pages en viewport-fit=cover) */
  :root { --gutter: max(clamp(20px, 4vw, 64px), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)); }
  .htl-nav { padding-top: env(safe-area-inset-top, 0px); box-sizing: border-box; }
  .htl-footer { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }

  /* Nav : ronds de 44 px (cible tactile) */
  .htl-nav__right { gap: 4px; }
  .htl-nav__right .htl-icon-btn, #account-ctrl .account-btn { width: 44px; height: 44px; }

  /* Plus de dock flottant posé sur le contenu : palettes dans le menu,
     « Gérer les cookies » dans le pied de page (html.htl-pal-in-menu, htl-shell.js) */
  html.htl-pal-in-menu .htl-dock { display: none; }
  body:has(.htl-footer__cookies) #km-cookie-reopen { display: none !important; }
  /* Pages sans menu commun (formations, admin exclu) : le dock s'efface en
     descendant, revient en remontant, et respecte la barre d'accueil */
  body:not(.adm-body) .htl-dock { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transition: transform .5s var(--ease-out), opacity .4s var(--ease-out); }
  body:not(.adm-body) #km-cookie-reopen { bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important; transition: transform .5s var(--ease-out), opacity .4s var(--ease-out), box-shadow .25s; }
  html.htl-dock-away body:not(.adm-body) .htl-dock,
  html.htl-dock-away body:not(.adm-body) #km-cookie-reopen { transform: translateY(calc(100% + 30px + env(safe-area-inset-bottom, 0px))); opacity: 0; pointer-events: none; }
  /* Jamais sur un champ en cours de saisie (clavier ouvert) ni sous le bandeau cookies */
  html:has(:is(input, textarea, select):focus) :is(.htl-dock, #km-cookie-reopen),
  html:has(.km-cookie.show) .htl-dock { visibility: hidden; }
  /* Vérification finale : ronds du dock (pages formation) à 44 px */
  .htl-dock .htl-icon-btn { width: 44px; height: 44px; }
  #km-cookie-reopen { width: 44px !important; height: 44px !important; left: calc(var(--gutter) + 52px) !important; }

  /* Menu plein écran : défile si besoin, gros liens, devis et palettes au pouce */
  .htl-menu {
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: calc(var(--nav-h) + 8px) var(--gutter) calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .htl-menu__close { top: calc(env(safe-area-inset-top, 0px) + (var(--nav-h) - env(safe-area-inset-top, 0px) - 44px) / 2); width: 44px; height: 44px; }
  .htl-menu__list { gap: 4px; }
  .htl-menu a.htl-menu__item { display: flex; align-items: center; min-height: 48px; }
  .htl-menu__foot { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px 16px; padding-top: 20px; }
  .htl-menu__cta { display: inline-flex; grid-column: 1 / -1; width: 100%; height: 52px; font-size: 16px; }
  .htl-menu__palname { display: block; grid-column: 1 / -1; margin: 2px 0 -4px; font-size: 14px; color: var(--muted); }
  .htl-menu__palname span { color: var(--fg); margin-left: 6px; }
  .htl-menu .htl-palettes {
    grid-column: 1 / -1; position: static; min-width: 0; padding: 0;
    opacity: 1; visibility: visible; transform: none; transition: none;
    background: none; box-shadow: none; border-radius: 0;
    grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px;
  }
  .htl-menu .htl-swatch { position: relative; min-height: 44px; }
  .htl-menu .htl-swatch > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .htl-menu .htl-swatch__dot { width: 100%; height: 44px; border-radius: 14px; }
  /* FR / EN : en haut à gauche du menu, face à la croix */
  .htl-menu__foot .htl-lang { position: absolute; left: var(--gutter); top: calc(env(safe-area-inset-top, 0px) + (var(--nav-h) - env(safe-area-inset-top, 0px) - 50px) / 2); font-size: 14px; }
  .htl-menu__foot .htl-lang button { min-width: 48px; min-height: 44px; padding: 0 12px; }
  .htl-menu__foot > a.htl-link { grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; }

  /* Pied de page : liens de 44 px de haut, textes lisibles */
  .htl-footer__grid ul { gap: 0; }
  .htl-footer__grid a, .htl-footer__cookies { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; }
  .htl-footer__grid h4 { font-size: 14px; margin-bottom: 4px; }
  .htl-footer__bottom { font-size: 14px; }
  .htl-palettes .htl-swatch { font-size: 12.5px; }
}

@media (max-width: 768px) {
  :root { --nav-h: calc(64px + env(safe-area-inset-top, 0px)); }
  .htl-menu a.htl-menu__item { font-size: clamp(32px, min(10.5vw, 5.8svh), 46px); }
  /* Petits écrans en hauteur (iPhone SE) : l'adresse e-mail reste dans le pied de page */
  .htl-menu__foot > a.htl-link { display: none; }
  /* Rythme : moins de vide entre deux blocs */
  .htl-section { padding: 64px 0; }
  .htl-section--tight { padding: 44px 0; }
  .htl-section__head { gap: 14px; margin-bottom: 28px; }
  /* Le devis est déjà proposé juste au-dessus (dernier appel) sur l'accueil et Travaux */
  body[data-htl-page="index"] .htl-footer__grid > :first-child p:has(> .htl-btn),
  body[data-htl-page="travaux"] .htl-footer__grid > :first-child p:has(> .htl-btn),
  body[data-htl-page="services"] .htl-footer__grid > :first-child p:has(> .htl-btn),
  body[data-htl-page="devis"] .htl-footer__grid > :first-child p:has(> .htl-btn) { display: none; }
  /* Bouton e-mail des appels finaux : « Écrire un mail » (l'adresse reste dans aria-label) */
  .htl-mail-long { display: none; }
  .htl-mail-short { display: inline; }
  /* Liens du pied de page : largeur minimale de cible tactile */
  .htl-footer__grid a, .htl-footer__cookies { min-width: 44px; }
}
@media (max-width: 768px) and (min-height: 760px) {
  .htl-menu__foot > a.htl-link { display: inline-flex; }
}

/* Téléphone couché : nav compacte, menu sur deux colonnes */
@media (pointer: coarse) and (max-height: 520px) {
  :root { --nav-h: calc(56px + env(safe-area-inset-top, 0px)); }
  .htl-nav__right > .htl-lang, .htl-nav__right .htl-nav__cta, .account-label { display: none; }
  #account-ctrl .account-btn { padding: 0; justify-content: center; }
  .htl-menu { padding-top: calc(var(--nav-h) + 4px); }
  .htl-menu__list { margin-top: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .htl-menu a.htl-menu__item { font-size: 32px; }
  .htl-menu__foot { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding-top: 14px; }
  .htl-menu__cta { grid-column: 1; }
  .htl-menu__palname { display: none; }
  .htl-menu .htl-palettes { grid-column: 2; }
  .htl-menu__foot > a.htl-link { display: none; }
}
