/* Sitely extras : mode sombre, bandeau cookies, recherche, retour en haut, bouton de contact flottant,
   boutons copier, version imprimable, messages et fenêtres de confirmation.
   Même fichier pour le site sitely.fr et pour les sites d'exemples (realisations.sitely.fr).
   Les couleurs viennent de la page : sur sitely.fr (html[data-x-vars]) ce sont ses variables, ailleurs la couleur du thème. */

.x-root {
  --x-bg: #ffffff; --x-fg: #1b1b1f; --x-mute: #5d5d66; --x-line: #dcdce2;
  --x-accent: #1f3a5f; --x-on-accent: #ffffff; --x-soft: rgba(0, 0, 0, 0.05);
  --x-shadow: 0 10px 30px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
  position: fixed; inset: 0; z-index: 2147483000; pointer-events: none;
  font: 400 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--x-fg);
}
.x-root > * { pointer-events: auto; }
.x-root *, .x-root *::before, .x-root *::after { box-sizing: border-box; }
html[data-x-vars] .x-root {
  --x-bg: var(--surface); --x-fg: var(--texte); --x-mute: var(--texte-2); --x-line: var(--ligne);
  --x-accent: var(--cta); --x-on-accent: var(--sur-cta); --x-soft: var(--voile-bleu);
  font-family: var(--sans);
}
/* Mode sombre des sites d'exemples : le site est inversé, l'interface Sitely est remise à l'endroit. */
html[data-x-theme="dark"]:not([data-x-vars]) { filter: invert(0.9) hue-rotate(180deg); background: #fff; }
html[data-x-theme="dark"]:not([data-x-vars]) :is(img, video, picture, canvas, iframe, svg image, [style*="background-image"], .x-keep) {
  filter: invert(1) hue-rotate(180deg);
}
html[data-x-theme="dark"]:not([data-x-vars]) .x-root {
  filter: invert(1) hue-rotate(180deg);
  --x-bg: #1b1b21; --x-fg: #f1f1f4; --x-mute: #a7a7b2; --x-line: #34343d; --x-soft: rgba(255, 255, 255, 0.07);
  --x-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
html[data-x-theme="dark"]:not([data-x-vars]) .x-root { --x-accent: color-mix(in srgb, var(--x-accent-base, #1f3a5f) 45%, #ffffff); --x-on-accent: #101014; }

.x-root a { color: inherit; }
.x-root a.x-contact { color: var(--x-on-accent); }
.x-root button { font: inherit; color: inherit; }
.x-root :focus-visible { outline: 3px solid var(--x-accent); outline-offset: 2px; }

/* ---------- Dock d'outils (bas gauche) et boutons ronds ---------- */
.x-dock { position: absolute; left: 16px; bottom: calc(16px + var(--x-lift, 0px)); display: flex; flex-direction: column; gap: 8px; }
.x-fab {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; cursor: pointer;
  border: 1px solid var(--x-line); border-radius: 50%; background: var(--x-bg); color: var(--x-fg);
  box-shadow: var(--x-shadow); transition: transform 0.18s ease, background-color 0.18s, color 0.18s, border-color 0.18s;
}
.x-fab svg { width: 20px; height: 20px; pointer-events: none; }
.x-fab:hover { transform: translateY(-2px); background: var(--x-accent); color: var(--x-on-accent); border-color: var(--x-accent); }
.x-fab:active { transform: translateY(0) scale(0.96); }

/* ---------- Boutons dans l'en-tête et le pied de page de sitely.fr ---------- */
.x-hbtn {
  display: inline-grid; place-items: center; flex: none; width: 42px; height: 42px; padding: 0; cursor: pointer;
  border: 1px solid var(--ligne-forte); border-radius: 0; background: transparent; color: var(--texte);
  transition: background-color 0.2s var(--sortie), color 0.2s var(--sortie);
}
.x-hbtn svg { width: 18px; height: 18px; pointer-events: none; }
.x-hbtn:hover { background: var(--texte); color: var(--fond); }
.x-printlink { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.x-printlink:hover { color: var(--texte); }
.x-tools { display: flex; align-items: center; gap: 12px; }
.x-tools .lang { display: inline-flex; align-items: center; box-sizing: border-box; height: 42px; padding-block: 0; }

/* ---------- Contact flottant et retour en haut (bas droite) ---------- */
.x-right { position: absolute; right: 16px; bottom: calc(16px + var(--x-lift, 0px)); display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.x-contact {
  display: inline-flex; align-items: center; gap: 9px; min-height: 48px; padding: 0 20px 0 16px; border-radius: 999px;
  background: var(--x-accent); color: var(--x-on-accent); font-weight: 700; text-decoration: none;
  box-shadow: var(--x-shadow); transition: transform 0.18s ease, box-shadow 0.18s;
}
.x-contact svg { width: 20px; height: 20px; }
.x-contact:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26); }
.x-top { opacity: 0; transform: translateY(10px); visibility: hidden; transition: opacity 0.2s, transform 0.2s, visibility 0.2s, background-color 0.18s, color 0.18s; }
.x-top.is-on { opacity: 1; transform: none; visibility: visible; }
.x-top.is-on:hover { transform: translateY(-2px); }

/* ---------- Barre de progression (sites sans barre de lecture) ---------- */
.x-progress { position: absolute; left: 0; top: 0; height: 3px; width: 100%; transform-origin: left; transform: scaleX(0); background: var(--x-accent); pointer-events: none; }

/* ---------- Bandeau cookies ---------- */
.x-cookies {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(640px, calc(100% - 32px));
  display: grid; gap: 12px; padding: 18px 20px; border: 1px solid var(--x-line); border-radius: 14px;
  background: var(--x-bg); color: var(--x-fg); box-shadow: var(--x-shadow); animation: x-rise 0.35s ease both;
}
.x-cookies p { margin: 0; color: var(--x-mute); }
.x-cookies strong { color: var(--x-fg); display: block; margin-bottom: 2px; }
.x-cookies .x-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.x-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 18px; cursor: pointer;
  border: 1.5px solid var(--x-fg); border-radius: 10px; background: transparent; color: var(--x-fg); font-weight: 700; text-decoration: none;
  transition: background-color 0.15s, color 0.15s, transform 0.15s;
}
.x-btn:hover { transform: translateY(-1px); background: var(--x-soft); }
.x-btn--main { background: var(--x-accent); border-color: var(--x-accent); color: var(--x-on-accent); }
.x-btn--main:hover { background: var(--x-accent); filter: brightness(1.08); }
.x-cookies a { font-size: 0.9em; }
body.x-has-dock-cookies .x-dock, body.x-has-dock-cookies .x-right { bottom: 176px; }
@media (min-width: 760px) { body.x-has-dock-cookies .x-dock, body.x-has-dock-cookies .x-right { bottom: 16px; } .x-cookies { left: 76px; transform: none; width: min(560px, calc(100% - 340px)); } }

/* ---------- Fenêtres (recherche, confirmation) ---------- */
dialog.x-dialog {
  padding: 0; border: 1px solid var(--x-line); border-radius: 16px; background: var(--x-bg); color: var(--x-fg);
  box-shadow: var(--x-shadow); width: min(560px, calc(100% - 28px)); max-height: min(82vh, 640px); overflow: hidden;
}
dialog.x-dialog[open] { animation: x-pop 0.2s ease both; display: flex; flex-direction: column; }
dialog.x-dialog::backdrop { background: rgba(8, 8, 12, 0.55); backdrop-filter: blur(2px); }
.x-dialog h2 { margin: 0 0 6px; font-size: 1.2rem; line-height: 1.3; letter-spacing: 0; color: var(--x-fg); font-weight: 800; }
.x-dialog p { margin: 0; color: var(--x-mute); }
.x-confirm { padding: 24px; display: grid; gap: 16px; }
.x-confirm .x-row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.x-search-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--x-line); }
.x-search-head svg { width: 20px; height: 20px; color: var(--x-mute); flex: none; }
.x-search-head input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--x-fg); font: inherit; font-size: 1.05rem; padding: 6px 0;
}
.x-search-head input::placeholder { color: var(--x-mute); }
.x-kbd { border: 1px solid var(--x-line); border-radius: 6px; padding: 1px 7px; font-size: 0.78rem; color: var(--x-mute); }
.x-results { list-style: none; margin: 0; padding: 8px; overflow: auto; }
.x-results a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--x-fg); }
.x-results a:hover, .x-results a:focus-visible { background: var(--x-soft); }
.x-results b { display: block; font-weight: 700; }
.x-results small { display: block; color: var(--x-mute); font-size: 0.88rem; margin-top: 2px; }
.x-results mark { background: color-mix(in srgb, var(--x-accent) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.x-empty { padding: 22px 18px; color: var(--x-mute); text-align: center; }
.x-spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--x-line); border-top-color: var(--x-accent); border-radius: 50%; animation: x-turn 0.7s linear infinite; vertical-align: -3px; margin-right: 8px; }

/* ---------- Messages (toasts) ---------- */
.x-toasts { position: absolute; top: 16px; right: 16px; display: grid; gap: 10px; width: min(380px, calc(100% - 32px)); }
.x-toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 13px 14px; border: 1px solid var(--x-line); border-left: 5px solid var(--x-accent);
  border-radius: 12px; background: var(--x-bg); color: var(--x-fg); box-shadow: var(--x-shadow); animation: x-slide 0.3s ease both;
}
.x-toast--ok { border-left-color: #1a9a55; }
.x-toast--error { border-left-color: #d92d20; }
.x-toast p { flex: 1; margin: 0; color: var(--x-fg); }
.x-toast button { border: 0; background: transparent; cursor: pointer; font-size: 1.3rem; line-height: 1; padding: 0 2px; color: var(--x-mute); }

/* ---------- Boutons copier et mot de passe (dans la page) ---------- */
.x-copy, .x-eye {
  display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: 8px; padding: 0; vertical-align: middle; cursor: pointer;
  border: 1px solid rgba(127, 127, 127, 0.45); border-radius: 8px; background: transparent; color: inherit; opacity: 0.75;
  transition: opacity 0.15s, background-color 0.15s, transform 0.15s;
}
.x-copy:hover, .x-eye:hover { opacity: 1; background: rgba(127, 127, 127, 0.16); transform: translateY(-1px); }
.x-copy svg, .x-eye svg { width: 15px; height: 15px; pointer-events: none; }
.x-copy.is-done { opacity: 1; border-color: #1a9a55; color: #1a9a55; }
.x-wrap-pass { position: relative; display: block; }
.x-wrap-pass > input { padding-right: 46px !important; }
.x-wrap-pass > .x-eye { position: absolute; right: 8px; top: 50%; margin: 0; transform: translateY(-50%); }
.x-wrap-pass > .x-eye:hover { transform: translateY(-50%); }
pre.x-has-copy { position: relative; }
pre.x-has-copy > .x-copy { position: absolute; top: 8px; right: 8px; margin: 0; }

/* ---------- Lien d'évitement ajouté quand la page n'en a pas ---------- */
.x-skip {
  position: fixed; left: 12px; top: -80px; z-index: 2147483001; padding: 12px 18px; border-radius: 8px; font-weight: 700; text-decoration: none;
  background: #111; color: #fff; transition: top 0.15s;
}
.x-skip:focus { top: 12px; }

/* ---------- Dernière mise à jour ---------- */
.x-updated { margin: 10px 0 0; font-size: 0.85em; opacity: 0.7; }

/* ---------- Chargement et survol (sites d'exemples ; sitely.fr a déjà les siens) ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.x-ex body { animation: x-fade 0.55s ease both; }
  html.x-ex :where(a[class*="btn"], button[class*="btn"], a[class*="button"], button[class*="button"], a[class*="cta"], button[type="submit"]) { transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease; }
  html.x-ex :where(a[class*="btn"], button[class*="btn"], a[class*="button"], button[class*="button"], a[class*="cta"], button[type="submit"]):hover { transform: translateY(-2px); filter: brightness(1.06); }
  html.x-ex :where(article, [class*="card"], li[class*="border"]) { transition: transform 0.25s ease, box-shadow 0.25s ease; }
  html.x-ex :where(article, [class*="card"]):hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(0, 0, 0, 0.14); }
  html.x-ex :where(article, [class*="card"], figure) img { transition: transform 0.5s ease; }
  html.x-ex :where(article, [class*="card"], figure):hover img { transform: scale(1.04); }
  html.x-ex :where(main a:not([class]), footer a:not([class])) { text-underline-offset: 4px; transition: color 0.15s, text-decoration-color 0.15s; }
}
.x-busy { position: relative; pointer-events: none; opacity: 0.75; }
.x-busy::after { content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: x-turn 0.7s linear infinite; vertical-align: -2px; }

/* FAQ de sitely.fr : ouverture douce */
@media (prefers-reduced-motion: no-preference) { .faq details[open] > :not(summary) { animation: x-fade 0.3s ease both; } }

@keyframes x-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes x-rise { from { opacity: 0; transform: translate(var(--x-tx, 0), 12px); } to { opacity: 1; transform: translate(var(--x-tx, 0), 0); } }
@keyframes x-pop { from { opacity: 0; transform: scale(0.97) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes x-slide { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes x-turn { to { transform: rotate(360deg); } }
.x-cookies { --x-tx: -50%; }
@media (min-width: 760px) { .x-cookies { --x-tx: 0; } }

@media (max-width: 560px) {
  .x-dock { left: 10px; bottom: calc(10px + var(--x-lift, 0px)); }
  .x-right { right: 10px; bottom: calc(10px + var(--x-lift, 0px)); }
  .x-fab { width: 40px; height: 40px; }
  .x-contact span { display: none; }
  .x-contact { padding: 0; width: 48px; justify-content: center; }
  .x-toasts { top: 10px; right: 10px; }
}

/* ---------- Version imprimable ---------- */
@media print {
  .x-root, .x-skip, .site-header, header[role="banner"], nav, .lang-banner, .band, video, iframe, .lecture, .hero-actions { display: none !important; }
  html, html[data-x-theme="dark"] { filter: none !important; background: #fff !important; }
  *, *::before, *::after { background: transparent !important; color: #000 !important; box-shadow: none !important; text-shadow: none !important; animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; }
  body { font-size: 11.5pt !important; line-height: 1.45 !important; }
  img { max-width: 100% !important; filter: none !important; }
  h1, h2, h3 { break-after: avoid; }
  p, li, details, figure, tr { break-inside: avoid; }
  main a[href^="http"]:not([href*="#"])::after, main a[href^="mailto:"]::after, main a[href^="tel:"]::after { content: " (" attr(href) ")"; font-size: 0.85em; word-break: break-all; }
  details > * { display: block !important; }
  .reveal, .mot { opacity: 1 !important; transform: none !important; }
  .x-updated { opacity: 1 !important; }
}
