/* ==========================================================================
   Mezclarte — base.css
   Ne contient AUCUNE valeur de marque : tout vient des tokens émis par le thème
   (<style id="mz-theme">). Couche 3 « dérivés » calculée ici.
   ========================================================================== */

/* ---- Dérivés : recalculés partout où un ton redéfinit --bg / --fg ---------- */
:root {
  --bg: var(--role-bg);
  --fg: var(--role-fg);
  --muted: var(--role-muted);
  --accent: var(--role-accent);
  --on-accent: var(--role-on-accent);
}
:root, [data-tone] {
  --line: color-mix(in srgb, var(--fg) var(--line-alpha), transparent);
  --surface: color-mix(in srgb, var(--fg) var(--surface-alpha), var(--bg));
  --surface-2: color-mix(in srgb, var(--fg) calc(var(--surface-alpha) * 2.5), var(--bg));
  --dur: calc(700ms * var(--motion));
  --dur-fast: calc(250ms * var(--motion));
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --card-radius: var(--radius);
  --img-radius: calc(var(--radius) * .85);
  --pad-x: clamp(20px, 4vw, var(--gutter));
}

/* ---- Tons de section ------------------------------------------------------ */
[data-tone="alt"] {
  --bg: var(--role-alt-bg);
  --fg: var(--role-alt-fg);
  --muted: color-mix(in srgb, var(--role-alt-fg) 64%, var(--role-alt-bg));
}
[data-tone="accent"] {
  --bg: var(--role-accent);
  --fg: var(--role-on-accent);
  --muted: color-mix(in srgb, var(--role-on-accent) 74%, var(--role-accent));
  --accent: var(--role-on-accent);
  --on-accent: var(--role-accent);
}
[data-tone="deep"] {
  --bg: var(--c-deep);
}
[data-tone] { background: var(--bg); color: var(--fg); }
:root, [data-tone="base"] { --logo-color: var(--role-logo-base, var(--accent)); }
[data-tone="alt"] { --logo-color: var(--role-logo-alt, var(--accent)); }
[data-tone="accent"] { --logo-color: var(--role-logo-accent, var(--fg)); }
[data-tone="deep"] { --logo-color: var(--role-logo-deep, #fff); }

/* ---- Reset ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; overflow-x: clip; scrollbar-gutter: stable; }
/* Fenêtre ouverte (dialog modal, ou popup de connexion dans son Shadow DOM) : la page derrière ne défile pas */
html:has(dialog:modal), html.mz-modal-open { overflow: hidden; }
dialog { overscroll-behavior: contain; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: var(--body-size); line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
[hidden] { display: none !important; }
img, video { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--on-accent); }

@view-transition { navigation: auto; }

/* ---- Utilitaires de typo --------------------------------------------------- */
.mz-display {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: var(--display-leading);
  text-transform: var(--display-case);
  font-optical-sizing: auto;
}
.mz-h1 { font-size: calc(clamp(48px, 7vw, 104px) * var(--display-scale)); }
.mz-h2 { font-size: calc(clamp(38px, 5vw, 72px) * var(--display-scale)); }
.mz-h3 { font-size: calc(clamp(28px, 3.4vw, 48px) * var(--display-scale)); }
.mz-label {
  font-family: var(--font-label);
  font-size: 13px; font-weight: 500;
  letter-spacing: var(--label-tracking);
  text-transform: var(--label-case);
  line-height: 1.5;
}
.mz-lead { font-size: calc(var(--body-size) * 1.12); line-height: 1.6; }
.mz-muted { color: var(--muted); }
.mz-accent { color: var(--accent); }
.mz-em { font-style: normal; color: var(--accent); }
.mz-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Mise en page ---------------------------------------------------------- */
.mz-wrap { width: 100%; max-width: calc(var(--container) + var(--pad-x) * 2); margin-inline: auto; padding-inline: var(--pad-x); }
.mz-pad { padding-block: var(--section-pad); }
.mz-sec { position: relative; }
/* Deux sections de même ton qui se suivent : on évite la double respiration. */
.mz-sec[data-tone="base"] + .mz-sec[data-tone="base"] > .mz-pad,
.mz-sec[data-tone="alt"] + .mz-sec[data-tone="alt"] > .mz-pad { padding-top: calc(var(--section-pad) * .35); }
.mz-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 24px 48px; margin-bottom: clamp(36px, 5vw, 64px); }
.mz-head__aside { max-width: 460px; }

/* ---- Boutons --------------------------------------------------------------- */
.mz-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.mz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 28px; border-radius: var(--btn-radius);
  font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.mz-btn:hover { transform: translateY(-2px); }
.mz-btn:active { transform: translateY(0) scale(.98); }
.mz-btn--sm { min-height: 44px; padding: 0 16px; font-size: 14px; font-weight: 500; }
.mz-btn--accent { background: var(--accent); color: var(--on-accent); }
.mz-btn--accent:hover { box-shadow: 0 10px var(--glow) -8px var(--accent); }
.mz-btn--ghost { border: var(--border-w) solid color-mix(in srgb, var(--fg) 28%, transparent); }
.mz-btn--ghost:hover { border-color: var(--fg); }
.mz-btn--ink { background: var(--fg); color: var(--bg); }
.mz-btn--outline { border: 2px solid var(--fg); }

/* ---- Petits éléments ------------------------------------------------------- */
.mz-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.mz-dot--glow { box-shadow: 0 0 var(--glow) var(--accent); }
.mz-logo { width: auto; height: 44px; max-width: 180px; object-fit: contain; }
.mz-logo--ink:not(svg) { filter: invert(1); }
[data-tone="alt"] .mz-logo:not(svg) { filter: invert(1); }
/* Logo SVG d'origine : une couleur, qui suit le fond de la section (réglages « Logo sobre fondo … » dans Estilos) */
svg.mz-logo { color: var(--logo-color); display: block; overflow: visible; }
.mz-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.mz-eq i { width: 3px; height: 30%; background: currentColor; border-radius: 1px; transition: height .2s; }
[aria-pressed="true"] .mz-eq i { animation: mz-eq calc(900ms * var(--motion)) ease-in-out infinite alternate; }
[aria-pressed="true"] .mz-eq i:nth-child(2) { animation-delay: -.3s; }
[aria-pressed="true"] .mz-eq i:nth-child(3) { animation-delay: -.6s; }
[aria-pressed="true"] .mz-eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes mz-eq { from { height: 20%; } to { height: 100%; } }

.mz-person { display: flex; align-items: center; gap: 16px; padding-top: 20px; border-top: var(--border-w) solid var(--line); }
.mz-person__img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.mz-person div { display: flex; flex-direction: column; }

/* Badge (pass) réutilisable */
.mz-pass {
  background: var(--role-fg); color: var(--role-bg);
  border-radius: calc(var(--radius) * 1.3); overflow: hidden;
  box-shadow: 0 40px 80px -36px rgba(0, 0, 0, .75);
  transition: transform var(--dur) var(--ease);
}
.mz-pass__band { background: var(--role-accent); color: var(--role-on-accent); padding: 10px 18px; }

/* Onglets */
.mz-tabs { display: inline-flex; gap: 6px; padding: 6px; border-radius: var(--btn-radius); background: var(--surface-2); }
.mz-tabs [role="tab"] {
  min-height: 46px; padding: 0 22px; border-radius: var(--btn-radius); font-weight: 600;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.mz-tabs [aria-selected="true"] { background: var(--fg); color: var(--bg); }
.mz-tabs--square { background: none; padding: 0; gap: 8px; }
.mz-tabs--square [role="tab"] { border: var(--border-w) solid var(--line); border-radius: calc(var(--btn-radius) * .7); font-weight: 500; }
.mz-tabs--square [aria-selected="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ---- Navigation ------------------------------------------------------------ */
.mz-skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--accent); color: var(--on-accent); border-radius: 8px; }
.mz-skip:focus { top: 12px; }
.mz-nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(var(--nav-blur)); -webkit-backdrop-filter: blur(var(--nav-blur));
  border-bottom: var(--border-w) solid var(--line);
  transition: transform var(--dur) var(--ease), background var(--dur-fast);
}
.mz-nav.is-hidden { transform: translateY(-100%); }
.mz-nav__in { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px var(--pad-x); }
.mz-nav__brand { display: flex; }
.mz-nav__links { display: flex; gap: clamp(18px, 2.4vw, 34px); }
.mz-nav__links a { position: relative; text-decoration: none; font-weight: 500; padding: 6px 0; }
.mz-nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: right; transition: transform var(--dur-fast) var(--ease);
}
.mz-nav__links a:hover::after, .mz-nav__links a[aria-current="true"]::after { transform: scaleX(1); transform-origin: left; }
.mz-nav__tools { display: flex; align-items: center; gap: 16px; }
.mz-lang { display: flex; gap: 10px; font-size: 13px; letter-spacing: .1em; }
.mz-lang a { text-decoration: none; color: var(--muted); padding: 6px 2px; }
.mz-lang a[aria-current="true"] { color: var(--accent); }
.mz-nav__burger { display: none; width: 44px; height: 44px; position: relative; }
.mz-nav__burger span { position: absolute; left: 11px; right: 11px; height: 2px; background: currentColor; transition: transform var(--dur-fast) var(--ease); }
.mz-nav__burger span:first-child { top: 17px; }
.mz-nav__burger span:last-child { top: 25px; }
.mz-nav__burger[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.mz-nav__burger[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

.mz-nav[data-variant="slash"] .mz-nav__links a { font-weight: 400; }
.mz-nav__sound { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.mz-nav__sound[aria-pressed="true"] .mz-dot { animation: mz-blink 1.4s ease-in-out infinite; }
@keyframes mz-blink { 50% { opacity: .2; } }

@media (max-width: 900px) {
  .mz-nav__burger { display: block; }
  .mz-nav__links {
    position: fixed; inset: 72px 0 auto 0; flex-direction: column; gap: 0;
    padding: 12px var(--pad-x) 28px; background: var(--bg); border-bottom: var(--border-w) solid var(--line);
    transform: translateY(-12px); opacity: 0; visibility: hidden;
    transition: opacity var(--dur-fast), transform var(--dur-fast) var(--ease), visibility var(--dur-fast);
  }
  .mz-nav__links.is-open { transform: none; opacity: 1; visibility: visible; }
  .mz-nav__links a { font-size: 22px; padding: 14px 0; border-bottom: var(--border-w) solid var(--line); }
  .mz-nav .mz-btn--sm { padding: 0 12px; }
}
.mz-nav .mz-lang--menu { display: none; }
@media (max-width: 560px) {
  .mz-nav .mz-nav__tools .mz-lang { display: none; }
  /* Sur téléphone, les langues passent dans le menu burger */
  .mz-nav .mz-lang--menu { display: flex; gap: 22px; padding: 18px 0 4px; font-size: 16px; }
  .mz-nav .mz-lang--menu a { border: 0; font-size: 16px; padding: 6px 0; }
}

/* ---- Pied de page ---------------------------------------------------------- */
.mz-footer { border-top: var(--border-w) solid var(--line); padding-block: 40px; color: var(--muted); font-size: 14px; }
.mz-footer__in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.mz-footer .mz-logo { width: auto; height: 36px; }

/* ---- Lecteur Sonido -------------------------------------------------------- */
.mz-player {
  position: fixed; right: 20px; bottom: 20px; z-index: 60; width: min(320px, calc(100vw - 40px));
  padding: 18px; border-radius: var(--card-radius); background: var(--surface-2); color: var(--fg);
  border: var(--border-w) solid var(--line); backdrop-filter: blur(16px);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .7);
  animation: mz-pop var(--dur) var(--ease-spring);
}
.mz-player[hidden] { display: none; }
.mz-player__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mz-player__close { width: 36px; height: 36px; display: grid; place-items: center; }
.mz-player__list button { display: flex; gap: 12px; align-items: baseline; width: 100%; padding: 10px 6px; text-align: left; border-radius: 8px; }
.mz-player__list button:hover { background: var(--surface); }
.mz-player__list button[aria-current="true"] { color: var(--accent); }
@keyframes mz-pop { from { opacity: 0; transform: translateY(16px) scale(.96); } }

/* ---- Lightbox -------------------------------------------------------------- */
.mz-lightbox { border: 0; padding: 0; background: transparent; max-width: 92vw; max-height: 92vh; overflow: visible; }
.mz-lightbox::backdrop { background: rgba(0, 0, 0, .82); backdrop-filter: blur(6px); }
.mz-lightbox img { max-height: 88vh; width: auto; border-radius: var(--img-radius); }
.mz-lightbox[open] img { animation: mz-pop var(--dur) var(--ease); }
.mz-lightbox__close { position: absolute; top: -52px; right: 0; width: 44px; height: 44px; display: grid; place-items: center; color: #fff; }

/* ---- Apparitions au défilement -------------------------------------------- */
.js [data-reveal] {
  opacity: 0; transform: translateY(var(--reveal-dist));
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms * var(--motion));
}
.js [data-reveal="left"] { transform: translateX(calc(var(--reveal-dist) * -1.5)); }
.js [data-reveal="drop"] { transform: translateY(calc(var(--reveal-dist) * -2)) rotate(-6deg); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  :root, [data-tone] { --motion: 0 !important; }
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* ---- Repère de version (contrôle après déploiement) ------------------------ */
.mz-build {
  position: fixed; top: 4px; left: 50%; z-index: 70; transform: translateX(-50%);
  padding: 2px 8px; border-radius: 999px; pointer-events: none;
  font: 500 10.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em;
  color: var(--fg); background: color-mix(in srgb, var(--bg) 70%, transparent);
  border: 1px solid var(--line); opacity: .85;
}

/* ---- Boutons flottants des comptes connectés (bas à gauche) ---------------
   De haut en bas : Abrir mi despacho, Editar contenido, Editar estilos. */
.mz-dock { position: fixed; left: 20px; bottom: 20px; z-index: 900; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.mz-dock > * { position: static !important; margin: 0 !important; }
.mz-dock .mz-dock__desp { order: 1; } .mz-dock .cmsx-fab { order: 2; } .mz-dock .mzd-fab { order: 3; } .mz-dock .mze-fab { order: 4; }
.mz-dock__btn { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 14px; border-radius: 999px;
  background: #15151a; color: #f2f2f5; border: 1px solid #34343f; box-shadow: 0 16px 40px -12px rgba(0,0,0,.6);
  font: 600 14px/1 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: 0; text-transform: none; text-decoration: none; }
.mz-dock__btn:hover, .mz-dock__btn:focus-visible { border-color: #f2f2f5; outline: none; color: #fff; }
.mz-dock__btn svg { width: 18px; height: 18px; }
html.cms-edit .mz-dock__desp, html.data-edit .mz-dock__desp, html.mze-open .mz-dock__desp { opacity: .35; filter: grayscale(1); pointer-events: none; }
/* Appui long sur le logo (téléphone) : pas de menu contextuel ni de sélection */
.mz-logo { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* ---- Fenêtres de message des outils d'édition (palette bleue du bandeau) ---- */
.mz-pop { border: 0; padding: 0; border-radius: 16px; max-width: min(460px, 92vw); background: #fff; color: #0f172a;
  box-shadow: 0 30px 80px -20px rgba(15, 23, 42, .55); font: 400 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.mz-pop::backdrop { background: rgba(23, 37, 84, .45); }
.mz-pop__in { padding: 22px 24px 18px; border-top: 6px solid #1D4ED8; border-radius: 16px; }
.mz-pop h2 { margin: 0 0 8px; font: 700 18px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; color: #1E3A8A; letter-spacing: 0; text-transform: none; }
.mz-pop p { margin: 0; }
.mz-pop__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.mz-pop__btn { min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid #93C5FD; background: #fff; color: #1E3A8A;
  font: 600 14px system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer; }
.mz-pop__btn:hover, .mz-pop__btn:focus-visible { border-color: #1D4ED8; outline: none; }
.mz-pop__btn.is-primary { background: #1D4ED8; border-color: #1D4ED8; color: #fff; }
.mz-pop__btn.is-danger { background: #EF4444; border-color: #EF4444; color: #fff; }
