/* =========================================================
   Salon du Chocolat Tarbes : accessibilité
   1. Corrections RGAA  2. Liens d'évitement  3. Accès au module
   4. Panneau « Paramètres d'affichage »  5. Réglages appliqués
   ========================================================= */

/* ---------- 1. Corrections RGAA ---------- */
.sct-main:focus { outline: none; }
/* Liens de consentement des formulaires : identifiables sans la couleur */
.ff_t_c a, .ff-el-tc a, .sct-formulaire .ff-el-form-check label a { text-decoration: underline !important; text-underline-offset: 3px; }
/* Cases à cocher : cible de 24 px minimum */
.sct-formulaire input[type="checkbox"] { width: 24px !important; height: 24px !important; min-width: 24px; flex: none; }

/* Pastilles de choix des formulaires : contour au même contraste que les champs */
.sct-formulaire .ff-el-form-check :is(label, .ff-el-form-check-label) { border-color: var(--color-border-field); }
.sct-formulaire .ff_t_c { display: inline; }

/* ---------- 2. Liens d'évitement visibles au focus ---------- */
.skip-link.screen-reader-text:focus, .sct-a11y-evitement:focus {
  position: fixed !important; top: 10px; left: 10px; z-index: 100000; width: auto !important; height: auto !important;
  clip: auto !important; clip-path: none !important; overflow: visible !important; margin: 0 !important;
  padding: 12px 18px !important; border-radius: var(--radius-pill); background: var(--color-cacao-900) !important; color: var(--color-creme-50) !important;
  font: 700 16px/1.2 var(--font-body) !important; text-decoration: underline; box-shadow: 0 0 0 3px var(--color-creme-50), 0 0 0 5px var(--color-focus);
}
.sct-a11y-evitement:focus { top: 64px; }

/* ---------- 3. Accès au module ---------- */
.sct-a11y-aa { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 18px; padding: 0 3px; border: 1.5px solid currentColor; border-radius: 4px; font: 700 11px/1 var(--font-body); letter-spacing: 0; }
body .sct-bandeau .sct-bandeau__a11y { display: none; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
@media (min-width: 768px) { body .sct-bandeau .sct-bandeau__a11y { display: inline-flex; } }
body .sct-bandeau .sct-bandeau__a11y:hover { color: var(--color-caramel-300); text-decoration: underline; text-underline-offset: 3px; }
body .sct-panneau .sct-panneau__a11y { width: 100%; margin: 0; border: 0; background: none; cursor: pointer; font: inherit; text-align: left; }
body .sct-panneau .sct-panneau__a11y .sct-a11y-aa { margin-right: 2px; }

/* Bouton « Accessibilité » du header mobile (même style que le bouton du menu) */
.sct-header__a11y { display: none; }
@media (max-width: 767px) {
  .sct-js .sct-header .sct-header__a11y {
    display: inline-flex; align-items: center; justify-content: center; position: relative; z-index: 2; flex: none;
    width: 48px; height: 48px; min-height: 48px; margin: 0 0 0 auto; padding: 0;
    border: 2px solid var(--color-cacao-800); border-radius: 50%; background: transparent; color: var(--color-cacao-800); cursor: pointer;
  }
  .sct-js .sct-header .sct-header__a11y:hover, .sct-js .sct-header .sct-header__a11y:focus { background: var(--color-creme-200); color: var(--color-cacao-800); }
  .sct-js .sct-header .sct-header__a11y:active { transform: scale(.96); }
  .sct-js .sct-header__a11y + .sct-burger { margin-left: 0; }
  .sct-header__a11y svg { width: 26px; height: 26px; }
  .sct-header__a11y-point { display: none; position: absolute; top: 0; right: 0; width: 13px; height: 13px; border: 2px solid var(--color-surface); border-radius: 50%; background: var(--color-caramel-500, #C97E2E); }
  html.a11y-personnalise .sct-header__a11y-point { display: block; }
  /* Très petits écrans ou texte agrandi : le logo se réduit pour garder une seule ligne */
  :is(html.a11y-texte-115, html.a11y-texte-130, html.a11y-espacement, html.a11y-police-dys) .sct-header__texte { display: none; }
}
@media (max-width: 359px) { .sct-header__texte { height: 24px; } }

/* ---------- 4. Panneau « Paramètres d'affichage » ---------- */
.sct-a11y {
  /* Calé sur les bords de l'écran (pas d'unité vw) : reste exactement à l'écran même quand le texte est agrandi */
  position: fixed; top: 0; right: 0; bottom: 0; left: auto; width: min(420px, 100%); max-width: 100%; height: auto; max-height: none; margin: 0; box-sizing: border-box;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom, 0px)); border: 0; border-left: 1px solid var(--color-creme-300);
  background: var(--color-surface); color: var(--color-text); overflow-y: auto; overscroll-behavior: contain;
  box-shadow: -18px 0 44px rgba(62, 23, 12, .22); font-family: var(--font-body);
}
.sct-a11y::backdrop { background: rgba(62, 23, 12, .45); }
.sct-a11y[open] { animation: sct-a11y-entree .25s cubic-bezier(.2, .8, .2, 1); }
@keyframes sct-a11y-entree { from { transform: translateX(24px); opacity: 0; } }
.sct-a11y__entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sct-a11y__titre { margin: 0; font-family: var(--font-display); font-size: 26px; line-height: 1.2; color: var(--color-text-strong); }
body .sct-a11y .sct-a11y__fermer { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 0; margin: 0 -8px 0 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--color-cacao-800); cursor: pointer; }
body .sct-a11y .sct-a11y__fermer:hover, body .sct-a11y .sct-a11y__fermer:focus-visible { background: var(--color-creme-200); }
.sct-a11y__intro { margin: 0 0 12px; font-size: 15px; line-height: 1.5; color: var(--color-lait-600); }
.sct-a11y__ligne { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; padding: 14px 0; border: 0; border-top: 1px solid var(--color-creme-200); min-inline-size: 0; }
.sct-a11y__texte { display: flex; flex-direction: column; gap: 2px; }
.sct-a11y__nom { padding: 0; font: 700 16px/1.3 var(--font-body); color: var(--color-text-strong); }
.sct-a11y__aide { font-size: 14px; line-height: 1.4; color: var(--color-lait-600); }
/* Interrupteurs */
body .sct-a11y .sct-a11y__interrupteur { position: relative; flex: none; width: 52px; height: 30px; min-height: 0; margin: 0; padding: 0; border: 2px solid var(--color-cacao-800); border-radius: var(--radius-pill); background: var(--color-creme-200); cursor: pointer; transition: background-color .15s ease; }
.sct-a11y__curseur { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--color-cacao-800); transition: transform .18s ease, background-color .15s ease; }
body .sct-a11y .sct-a11y__interrupteur[aria-checked="true"] { background: var(--color-cacao-800); }
.sct-a11y__interrupteur[aria-checked="true"] .sct-a11y__curseur { transform: translateX(22px); background: var(--color-creme-50); }
body .sct-a11y .sct-a11y__interrupteur:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }
/* Choix (boutons radio en pastilles) */
.sct-a11y__choix { flex-direction: column; align-items: stretch; gap: 10px; }
.sct-a11y__choix legend { float: left; width: 100%; margin-bottom: 10px; }
.sct-a11y__options { display: flex; flex-wrap: wrap; gap: 8px; clear: both; }
.sct-a11y__option { position: relative; flex: 1 1 0; min-width: 96px; }
.sct-a11y__option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sct-a11y__option span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px; border: 2px solid var(--color-creme-300); border-radius: var(--radius-pill); background: #fff; color: var(--color-cacao-800); font: 600 15px/1.2 var(--font-body); text-align: center; cursor: pointer; }
.sct-a11y__option input:checked + span { border-color: var(--color-cacao-800); background: var(--color-cacao-800); color: var(--color-creme-50); }
.sct-a11y__option input:focus-visible + span { outline: 3px solid var(--color-focus); outline-offset: 3px; }
.sct-a11y__option:hover span { border-color: var(--color-cacao-800); }
.sct-a11y__pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--color-creme-200); }
body .sct-a11y .sct-a11y__reinit { min-height: 44px; margin: 0; padding: 0 18px; border: 2px solid var(--color-cacao-800); border-radius: var(--radius-pill); background: transparent; color: var(--color-cacao-800); font: 700 15px/1 var(--font-body); cursor: pointer; }
body .sct-a11y .sct-a11y__reinit:hover { background: var(--color-creme-200); }
.sct-a11y__declaration { color: var(--color-lait-600); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.sct-a11y__credits { margin: 18px 0 0; font-size: 12px; line-height: 1.4; color: var(--color-lait-600); }
@media (max-width: 767px) {
  .sct-a11y { left: 0; right: 0; width: auto; max-width: none; border-left: 0; padding: 18px 18px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .sct-a11y[open] { animation-name: sct-a11y-entree-mobile; }
  @keyframes sct-a11y-entree-mobile { from { transform: translateY(24px); opacity: 0; } }
}

/* ---------- 5. Réglages appliqués ---------- */

/* Contraste renforcé : textes plus foncés, fonds unis, contours marqués, focus très visible */
html.a11y-contraste {
  --color-text: #1C0A04; --color-text-strong: #1C0A04; --color-text-muted: #2E140A;
  --color-lait-600: #3A1A0E; --color-caramel-700: #4A2A06; --color-border-field: #3E170C;
}
html.a11y-contraste .sct-entete-fond::before, html.a11y-contraste .sct-entete-fond::after,
html.a11y-contraste .sct-footer::before, html.a11y-contraste .sct-footer::after { display: none !important; }
html.a11y-contraste .sct-entete-fond { background-color: var(--color-creme-100) !important; background-image: none !important; }
html.a11y-contraste :is(.sct-exposant, .sct-part-carte, .sct-presse-carte, .sct-carte, .sct-profil, .sct-soutien, .sct-info-pratique, .sct-annuaire__panneau, .sct-formulaire, .sct-coord, .sct-carte-acces, .sct-lions-chiffres > li, .sct-faq details) { border: 2px solid var(--color-cacao-900) !important; }
html.a11y-contraste .elementor-widget-text-editor a, html.a11y-contraste p a { text-decoration: underline !important; }
html.a11y-contraste ::placeholder { color: #4A3A30 !important; opacity: 1; }
html.a11y-contraste :focus-visible { outline: 3px solid #000 !important; outline-offset: 3px !important; box-shadow: 0 0 0 6px #FFD84D !important; }
html.a11y-contraste .sct-fond-fonce :focus-visible, html.a11y-contraste .sct-footer :focus-visible { outline-color: #FFD84D !important; box-shadow: 0 0 0 6px #000 !important; }

/* Taille du texte : agrandissement de toute la page (elle se réorganise comme avec le zoom du navigateur) */
html.a11y-texte-115 { zoom: 1.15; }
html.a11y-texte-130 { zoom: 1.3; }
/* Header ordinateur : le menu passe sur deux lignes plutôt que de déborder */
@media (min-width: 1024px) {
  :is(html.a11y-texte-115, html.a11y-texte-130, html.a11y-espacement, html.a11y-police-dys) .sct-header__barre { flex-wrap: wrap; height: auto; min-height: var(--header-height); row-gap: 6px; padding-block: 8px; }
  :is(html.a11y-texte-115, html.a11y-texte-130, html.a11y-espacement, html.a11y-police-dys) .sct-panneau { flex: 1 1 auto; min-width: 0; }
  :is(html.a11y-texte-115, html.a11y-texte-130, html.a11y-espacement, html.a11y-police-dys) .sct-panneau :is(ul, .sct-menu) { flex-wrap: wrap; row-gap: 4px; }
}

/* Polices adaptées (téléchargées seulement si choisies) */
html.a11y-police-dys body, html.a11y-police-dys body *:not(svg):not(svg *):not(.sct-a11y-aa) { font-family: "OpenDyslexic", "Comic Sans MS", sans-serif !important; }
html.a11y-police-luciole body, html.a11y-police-luciole body *:not(svg):not(svg *):not(.sct-a11y-aa) { font-family: "Luciole", Verdana, sans-serif !important; }
html.a11y-police-dys .sct-mot__texte, html.a11y-police-luciole .sct-mot__texte { font-style: normal; }

/* Espacement du texte (valeurs du critère WCAG 1.4.12) */
html.a11y-espacement body *:not(svg):not(svg *) { line-height: 1.5 !important; letter-spacing: .12em !important; word-spacing: .16em !important; }
html.a11y-espacement body :is(p, li) { margin-bottom: 1em; }
html.a11y-espacement body p { margin-bottom: 2em !important; }

/* Barre d'infos : passe à la ligne quand le texte est agrandi ou espacé (au lieu de se chevaucher) */
:is(html.a11y-espacement, html.a11y-texte-115, html.a11y-texte-130, html.a11y-police-dys) .sct-bandeau__barre { flex-wrap: wrap; row-gap: 4px; padding-block: 6px; }
:is(html.a11y-espacement, html.a11y-texte-115, html.a11y-texte-130, html.a11y-police-dys) :is(.sct-bandeau__droite, .sct-bandeau__lien) { flex-wrap: wrap; min-width: 0; white-space: normal; overflow: visible; text-overflow: clip; }

/* Mots longs : césure et retour à la ligne quand le texte est agrandi, espacé ou en police large (critère 1.4.10) */
:is(html.a11y-espacement, html.a11y-texte-115, html.a11y-texte-130, html.a11y-police-dys, html.a11y-police-luciole) body :is(h1, h2, h3, h4, h5, p, li, a, span, button, label, strong, em, dt, dd, td, th, figcaption, legend, summary, blockquote) { overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto; }
@media (max-width: 767px) {
  :is(html.a11y-texte-130, html.a11y-espacement) body h1 { font-size: min(1em * 2.2, 40px) !important; }
}

/* Boutons et liens du pied de page : retour à la ligne quand le texte est agrandi ou espacé (critère 1.4.10) */
:is(html.a11y-espacement, html.a11y-texte-115, html.a11y-texte-130, html.a11y-police-dys, html.a11y-police-luciole) :is(.ff-btn, .sct-btn, .elementor-button, .sct-footer__cookies, .sct-footer__legal a) { white-space: normal !important; max-width: 100%; height: auto; min-height: 44px; text-align: center; }
:is(html.a11y-espacement, html.a11y-texte-115, html.a11y-texte-130, html.a11y-police-dys, html.a11y-police-luciole) :is(.sct-footer__legal, .sct-footer__bas, .ff_submit_btn_wrapper) { flex-wrap: wrap; max-width: 100%; min-width: 0; }

/* Mot du titre : pastille souple (le mot peut se couper) quand le texte est agrandi, espacé ou en police adaptée */
:is(html.a11y-espacement, html.a11y-texte-115, html.a11y-texte-130, html.a11y-police-dys, html.a11y-police-luciole) .sct-mot { display: inline; width: auto !important; height: auto; max-width: 100%; overflow: visible; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
:is(html.a11y-espacement, html.a11y-texte-115, html.a11y-texte-130, html.a11y-police-dys, html.a11y-police-luciole) .sct-mot .sct-mot__texte { position: static !important; display: inline; white-space: normal; overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto; }

/* Souligner tous les liens (hors boutons) */
html.a11y-liens a:not(.elementor-button):not(.sct-btn):not(.sct-header__logo):not(.sct-exposant__lien) { text-decoration: underline !important; text-underline-offset: .18em; text-decoration-thickness: max(1px, .08em); }

/* Arrêter les animations */
html.a11y-sans-anim *, html.a11y-sans-anim *::before, html.a11y-sans-anim *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
  transition-duration: .001ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
}
html.a11y-sans-anim .sct-a, html.a11y-sans-anim .sct-a img, html.a11y-sans-anim .sct-mot-a > span { opacity: 1 !important; transform: none !important; clip-path: none !important; }
html.a11y-sans-anim::view-transition-group(*), html.a11y-sans-anim::view-transition-old(*), html.a11y-sans-anim::view-transition-new(*) { animation: none !important; }
html.a11y-sans-anim .sct-intro { display: none !important; }

/* Plan du site */
.sct-plan__titre { margin: 32px 0 12px; font-size: 24px; }
.sct-plan__liste, .sct-plan__liste ul { margin: 0; padding-left: 1.2em; }
.sct-plan__liste li { margin: 6px 0; line-height: 1.5; }
.sct-plan__liste a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.sct-plan__liste ul a { font-weight: 400; }

/* Déclaration : tableau des résultats */
.sct-a11y-resultats, .wp-block-table.sct-a11y-resultats { margin: 16px 0 32px; overflow: visible; }
.sct-a11y-resultats table { width: 100%; border-collapse: collapse; font-size: 15px; table-layout: fixed; }\n.sct-a11y-resultats thead th:first-child, .sct-a11y-resultats tbody th { width: 40%; }\n@media (max-width: 767px) {\n  .sct-a11y-resultats table { font-size: 13px; }\n  .sct-a11y-resultats :is(th, td) { padding: 8px 6px; overflow-wrap: anywhere; hyphens: auto; }\n}
.sct-a11y-resultats caption { margin-bottom: 10px; text-align: left; font-weight: 700; color: var(--color-text-strong); }
.sct-a11y-resultats :is(th, td) { padding: 10px 12px; border: 1px solid var(--color-border-field); text-align: left; }
.sct-a11y-resultats thead th { background: var(--color-cacao-900); color: var(--color-creme-50); }
.sct-a11y-resultats td { text-align: center; }
.sct-a11y-resultats tbody tr:last-child :is(th, td) { font-weight: 700; background: var(--color-creme-200); }
@media (max-width: 420px) { .sct-a11y-resultats table { font-size: 12px; } .sct-a11y-resultats :is(th, td) { padding: 6px 4px; } }
