/*
 * Commun à toutes les pages : pied de page, dialogues « Mentions légales » et « Accessibilité »,
 * réglages de lecture (taille, espacement, police, animations) posés par src/theme-init.js.
 * S'appuie sur les couleurs de la page (home.css ou main.css).
 */

/* Polices hébergées avec le site (aucun appel à un service de polices). Téléchargées
   seulement si la personne les choisit. Licence SIL OFL : assets/fonts/. */
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../../assets/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../../assets/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "OpenDyslexic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../../assets/fonts/opendyslexic-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "OpenDyslexic";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../../assets/fonts/opendyslexic-latin-700-normal.woff2") format("woff2");
}

/* ---------- Réglages de lecture ---------- */

:root[data-text-size="grand"] { font-size: 118.75%; }
:root[data-text-size="tres-grand"] { font-size: 137.5%; }

:root[data-font="lisible"] body,
:root[data-font="lisible"] button,
:root[data-font="lisible"] input,
:root[data-font="lisible"] select,
:root[data-font="lisible"] textarea {
  font-family: "Atkinson Hyperlegible", system-ui, sans-serif !important;
}
:root[data-font="dyslexie"] body,
:root[data-font="dyslexie"] button,
:root[data-font="dyslexie"] input,
:root[data-font="dyslexie"] select,
:root[data-font="dyslexie"] textarea {
  font-family: "OpenDyslexic", system-ui, sans-serif !important;
}

/* Espacement du texte (valeurs du critère RGAA 10.12). */
:root[data-spacing="large"] body * {
  line-height: 1.5 !important;
  letter-spacing: .12em !important;
  word-spacing: .16em !important;
}
:root[data-spacing="large"] p { margin-bottom: 2em; }
/* Le téléprompteur garde ses propres réglages (taille, vitesse) : pas d'espacement forcé. */
:root[data-spacing="large"] .prompter .prompter-text { line-height: 1.35 !important; letter-spacing: normal !important; word-spacing: normal !important; }

:root[data-motion="reduce"] *,
:root[data-motion="reduce"] *::before,
:root[data-motion="reduce"] *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}

/* ---------- Pied de page ---------- */

.bas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 22px;
  padding: 24px 24px calc(32px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  font-size: .9rem;
}
.bas a, .bas button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 4px;
  color: var(--text);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.bas button {
  border: 0;
  background: none;
  cursor: pointer;
}
.bas a:first-child { font-weight: 800; }
.bas-contact svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bas a:hover, .bas button:hover { color: var(--link, var(--text)); }
.bas a:focus-visible, .bas button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Dialogues du site ---------- */

.site-dlg {
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: var(--card, var(--panel));
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
.site-dlg::backdrop { background: rgba(5, 8, 14, .6); }
.site-dlg-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: inherit;
}
.site-dlg-head h2 { margin: 0; font-size: 1.25rem; line-height: 1.3; }
.site-dlg-close {
  flex: none;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.site-dlg-body { padding: 8px 20px 22px; }
.site-dlg-body h3 { margin: 18px 0 6px; font-size: 1rem; }
.site-dlg-body p, .site-dlg-body li { margin: 0 0 8px; color: var(--text); line-height: 1.55; }
.site-dlg-body ul { margin: 0; padding-left: 20px; }
.site-dlg-body a { color: var(--link, var(--text)); }
.site-dlg :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Fenêtres à choix (« Retour au studio » du montage, « Nouvelle prise » du studio) */
.back-dlg { width: min(520px, calc(100vw - 24px)); }
.site-dlg-body .back-choices { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.back-dlg .site-dlg-body li { margin: 0; }
.back-choice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-height: 64px;
  padding: 12px 16px;
  border: 2px solid var(--border-strong);
  border-radius: 12px;
  background: var(--field, transparent);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.back-choice strong { font-size: 1.05rem; }
.back-choice span { color: var(--muted); font-size: .9rem; line-height: 1.4; }
.back-choice:hover:not(:disabled) { border-color: var(--accent); }
.back-choice:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.back-choice:disabled { opacity: .55; cursor: not-allowed; }
.take-dlg .site-dlg-body { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; }
.take-dlg .site-dlg-body > p { margin: 0; }
.take-dlg .back-choices { margin-top: 0; }
.take-preview { width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; background: #000; }
.take-dlg .field { display: flex; flex-direction: column; gap: 6px; }
.take-dlg .field input[type="range"] { width: 100%; min-height: 36px; accent-color: var(--accent); }
.take-dlg output { font-weight: 700; font-variant-numeric: tabular-nums; }

/* « Test du son » (studio, menu ⋯) */
.sound-dlg { width: min(520px, calc(100vw - 24px)); }
.sound-dlg .site-dlg-body { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; }
.sound-dlg .site-dlg-body > p { margin: 0; }
.sound-dlg .field { margin: 0; font-weight: 600; }
.sound-dlg .select { width: 100%; }
.sound-meter { height: 14px; border-radius: 999px; background: var(--field); border: 1px solid var(--border-strong); overflow: hidden; }
.sound-meter-fill { display: block; height: 100%; background: #2f9e44; transform: scaleX(0); transform-origin: left; transition: transform 80ms linear; }
.sound-state { font-weight: 600; }
.sound-playback:empty { display: none; }
.sound-playback audio { width: 100%; margin-top: 6px; }

.pref-intro { color: var(--muted) !important; }
.pref-group { margin: 14px 0 0; padding: 12px 14px 14px; border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.pref-group legend { padding: 0 6px; font-weight: 700; }
.pref-options { display: flex; flex-wrap: wrap; gap: 8px; }
.pref-option input, .pref-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pref-option label {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
}
.pref-option input:checked + label {
  border-color: var(--accent, #4f46e5);
  background: var(--accent, #4f46e5);
  color: #fff;
  font-weight: 700;
}
.pref-option input:checked + label::before { content: "✓ "; white-space: pre; }
.pref-option input:focus-visible + label,
.pref-check input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }
.pref-check { position: relative; }
.pref-check label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
}
.pref-check label::before {
  content: "";
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
}
.pref-check input:checked + label::before {
  content: "✓";
  display: grid;
  place-items: center;
  border-color: var(--accent, #4f46e5);
  background: var(--accent, #4f46e5);
  color: #fff;
  font-weight: 800;
  font-size: .85rem;
}
.pref-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.pref-reset {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

/* Fenêtre « Quoi de neuf ? » (après une mise à jour), sur toutes les pages. */
.news-dlg { width: min(560px, calc(100vw - 32px)); }
.news-dlg .site-dlg-head { padding-top: 20px; background: linear-gradient(90deg, var(--grad-a, #4f46e5), var(--grad-b, #c2255c)) top / 100% 6px no-repeat, var(--card, var(--panel)); }
.news-dlg .site-dlg-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 1.35rem; }
.news-dlg .news-tag {
  padding: 3px 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--grad-a, #4f46e5), var(--grad-b, #c2255c));
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.news-dlg .news-version { font-weight: 600; }
.news-dlg li { margin-bottom: 10px; }
/* Proposition d'installation (ui/install.js) */
.install-dlg { width: min(520px, calc(100vw - 32px)); }
.install-dlg .site-dlg-head { padding-top: 20px; background: linear-gradient(90deg, var(--grad-a, #4f46e5), var(--grad-b, #c2255c)) top / 100% 6px no-repeat, var(--card, var(--panel)); }
.install-dlg .site-dlg-head h2 { display: flex; align-items: center; gap: 12px; font-size: 1.3rem; }
.install-dlg .site-dlg-head img { flex: none; border-radius: 10px; }
.install-perks { padding-left: 1.2em; }
.install-perks li { margin-bottom: 6px; }
.install-how { font-weight: 600; margin-top: 14px; }
.install-steps li { margin-bottom: 6px; }
.share-icon { display: inline-block; margin: 0 .15em; width: 1.25em; height: 1.25em; vertical-align: -.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.install-note { color: var(--muted, inherit); font-size: .92rem; }
.install-dlg .news-actions { align-items: center; }
.install-dlg .btn-text { margin-right: auto; padding: 4px 0; border: 0; background: none; color: var(--link, inherit); font: inherit; text-decoration: underline; cursor: pointer; min-height: 24px; }
.install-dlg .btn-text:focus-visible { outline: 2px solid var(--focus, currentColor); outline-offset: 2px; }
.news-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.news-actions .btn { text-decoration: none; }

/* « À exporter d'abord en PDF » (studio, Médias) */
.export-dlg { width: min(560px, calc(100vw - 24px)); }
.export-steps { margin: 0 0 12px; padding-left: 22px; }
.export-dlg .row { margin-top: 14px; }
