/*
  Lisibilité PSDM — contraste des textes, champs, menus et boutons.
  Chargé après les styles de la page : les règles plus spécifiques
  (fonds marron, or, dégradés) restent prioritaires.

  Le mot-clé currentcolor est posé avec :where() (spécificité nulle).
  Il empêche un ancêtre sombre d’imposer une écriture claire sur un
  fond clair, sans écraser un -webkit-text-fill-color volontaire.
*/

:where(
  button,
  a.outline,
  a.primary,
  input,
  textarea,
  select,
  option,
  optgroup
) {
  -webkit-text-fill-color: currentcolor;
}

/* Champs à fond clair : pastille blanche, écriture noire, bordure or. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
textarea,
select {
  color: #000000;
  caret-color: #000000;
  color-scheme: light;
  background-color: #ffffff;
  border-color: #D4AF37;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):disabled,
textarea:disabled,
select:disabled {
  color: #555555;
  caret-color: #555555;
}

input::placeholder,
textarea::placeholder {
  color: #555555;
  -webkit-text-fill-color: currentcolor;
  opacity: 1;
}

select option,
select optgroup {
  color: #000000;
  background-color: #ffffff;
}

input[type="file"] {
  color: #000000;
  color-scheme: light;
}

input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: #000000 !important;
  caret-color: #000000;
}

/* Boutons d'action secondaires, comme « Compléter le dossier » :
   fond blanc, texte noir, bordure or. Tous les états. */
.outline,
a.outline,
button.outline,
.outline:hover,
.outline:focus,
.outline:focus-visible,
.outline:active,
a.outline:hover,
a.outline:focus,
a.outline:focus-visible,
a.outline:active,
button.outline:hover,
button.outline:focus,
button.outline:focus-visible,
button.outline:active {
  background-color: #ffffff !important;
  background-image: none !important;
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
  border-color: #D4AF37 !important;
  font-weight: 700;
}

.outline:disabled,
button.outline:disabled,
a.outline[aria-disabled="true"] {
  background-color: #ffffff !important;
  color: #555555 !important;
  -webkit-text-fill-color: #555555 !important;
  border-color: #D4AF37 !important;
}

/* Fond doré : encre foncée, identité or conservée. */
.primary,
a.primary,
button.primary,
.don-submit,
.admin-btn-or,
.insc-submit,
.po-lire-btn {
  -webkit-text-fill-color: currentcolor;
}

/* Boutons or de l'accueil : le dégradé et l'encre foncée restent. */
#accueil .accueil-trio-actions .outline,
#accueil .accueil-trio-actions .outline:hover,
#accueil .accueil-trio-actions .outline:focus,
#accueil .accueil-trio-actions .outline:focus-visible,
#accueil .portal-col .outline,
#accueil .portal-col .outline:hover,
#accueil .portal-col .outline:focus,
#accueil .portal-col .outline:focus-visible,
#accueil .portal-col .small a,
#accueil .portal-col .small a:hover,
#accueil .portal-col .small a:focus,
#accueil .portal-col .small a:focus-visible {
  color: #30200F !important;
  -webkit-text-fill-color: #30200F !important;
  border-color: #FFD700 !important;
  background-color: #D4AF37 !important;
  background-image: radial-gradient(circle at 32% 28%, #fff 0%, #FFE788 16%, #FFD700 42%, #D4AF37 70%, #9B751B 100%) !important;
}

/* Même pastille blanche pour les actions secondaires qui n'utilisent pas .outline. */
#admin .admin-shell-btn:not(.admin-shell-btn-or),
#admin .admin-shell-btn:not(.admin-shell-btn-or):hover,
#admin .admin-shell-btn:not(.admin-shell-btn-or):focus,
#admin .admin-shell-btn:not(.admin-shell-btn-or):focus-visible,
#admin .admin-photo-actions .gov-or-outline,
#admin .admin-photo-actions .gov-or-outline:hover,
#admin .admin-photo-actions .gov-or-outline:focus,
#gouvernance .gov-or-outline,
#gouvernance .gov-or-outline:hover,
#gouvernance .gov-or-outline:focus,
#gouvernance .gov-or-outline:focus-visible,
#admin #admMemPhotoCrop .gov-or-outline,
#gouvernance .gov-crop-dialog .gov-or-outline {
  background-color: #ffffff !important;
  background-image: none !important;
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
  border-color: #D4AF37 !important;
}

/* Dossier, éditeur et fenêtres à fond clair posées sur un cadre marron. */
#admin #adminDossierPanel .outline,
#admin #adminDossierPanel .outline:hover,
#admin #adminDossierPanel .outline:focus,
#admin #adminDossierPanel .outline:focus-visible,
#admin #adminDossierPanel .outline:active,
#admin .admin-membre-editeur .outline,
#admin .admin-membre-editeur .outline:hover,
#admin .admin-membre-editeur .outline:focus,
#admin .admin-membre-editeur .outline:focus-visible,
#admin .admin-membre-editeur .outline:active,
.admin-carte-zoom .outline,
.admin-carte-zoom .outline:hover,
.admin-carte-zoom .outline:focus,
.admin-carte-zoom .outline:focus-visible {
  color: #000000;
  -webkit-text-fill-color: currentcolor;
}

#admin #adminDossierPanel .outline:disabled,
#admin .admin-membre-editeur .outline:disabled,
.admin-carte-zoom .outline:disabled {
  color: #555555;
}

#admin #adminDossierPanel .primary,
#admin #adminDossierPanel .primary:hover,
#admin #adminDossierPanel .primary:focus,
#admin #adminDossierPanel .primary:active,
#admin .admin-membre-editeur .primary,
#admin .admin-membre-editeur .primary:hover,
#admin .admin-membre-editeur .admin-btn-or,
#admin .admin-membre-editeur .admin-btn-or:hover {
  -webkit-text-fill-color: currentcolor;
}

#admin #adminDossierPanel input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
#admin #adminDossierPanel textarea,
#admin #adminDossierPanel select,
#admin .admin-membre-bloc input,
#admin .admin-membre-bloc textarea,
#admin .admin-membre-bloc select,
#admin .admin-membre-bloc option {
  color: #000000;
  -webkit-text-fill-color: currentcolor;
  color-scheme: light;
}

#admin #adminDossierPanel input::placeholder,
#admin #adminDossierPanel textarea::placeholder,
#admin .admin-membre-bloc input::placeholder,
#admin .admin-membre-bloc textarea::placeholder {
  color: #555555;
  -webkit-text-fill-color: currentcolor;
  opacity: 1;
}

#admin #adminDossierPanel select,
#admin .admin-membre-bloc select {
  position: relative;
  z-index: 2;
  color-scheme: light;
  background-color: #ffffff;
}
#admin #adminDossierPanel select:focus,
#admin .admin-membre-bloc select:focus {
  z-index: 6;
}
#admin #adminDossierPanel select option,
#admin .admin-membre-bloc select option {
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
  background-color: #ffffff !important;
}

/* Îlot clair (accordéon) dans le dossier marron : plus de titres or sur crème. */
#admin #adminDossierPanel details.admin-fold,
#admin #adminDossierPanel details.admin-fold :is(h3, h4, p, li, label, .small, .muted) {
  color: #000000;
  -webkit-text-fill-color: currentcolor;
}

.admin-carte-zoom,
.attestation-dialog,
#admin #admMemPhotoCrop {
  color: #000000;
  -webkit-text-fill-color: currentcolor;
}

#admin #admMemPhotoCrop {
  background: #ffffff;
}

#admin #admMemPhotoCrop button,
#admin #admMemPhotoCrop button:hover,
#admin #admMemPhotoCrop button:focus,
#admin #admMemPhotoCrop button:focus-visible {
  color: #000000;
  -webkit-text-fill-color: currentcolor;
}

.notice,
.proj-feedback,
.proj-feedback.ok,
.proj-feedback.err,
.proj-feedback.wait {
  color: #000000;
  -webkit-text-fill-color: currentcolor;
}

/* Calendrier : champs marron, écriture claire. */
#calendrier .cal-field input,
#calendrier .cal-field select,
#accueil .accueil-cal-titre select {
  color: #FFF9E8 !important;
  -webkit-text-fill-color: #FFF9E8 !important;
  caret-color: #FFF9E8;
  color-scheme: dark;
  background-color: #30200F !important;
  background-image: linear-gradient(180deg, #493415, #30200F) !important;
  border-color: rgba(255, 215, 0, .55) !important;
}

#accueil .accueil-cal-titre select {
  color: #FFE788;
  -webkit-text-fill-color: #FFE788;
}

#calendrier .cal-field input::placeholder,
#calendrier .cal-field textarea::placeholder {
  color: #FFF6DE;
  -webkit-text-fill-color: currentcolor;
  opacity: 0.92;
}

#calendrier .cal-field input:-webkit-autofill,
#calendrier .cal-field select:-webkit-autofill,
#accueil .accueil-cal-titre select:-webkit-autofill {
  -webkit-text-fill-color: #FFF9E8 !important;
  caret-color: #FFF9E8;
}

/* Administration du calendrier : carte sombre, champs ivoire. */
#calendrier #calAdmin .small,
#calendrier #calAdmin .muted,
#calendrier .cal-card .small,
#calendrier .cal-card .muted,
#calendrier .cal-day-modal .small,
#calendrier .cal-day-modal .muted {
  color: #FFF9E8;
  -webkit-text-fill-color: currentcolor;
}

#calendrier #calAdmin input,
#calendrier #calAdmin select,
#calendrier #calAdmin textarea,
#calendrier #calAdmin option {
  color: #000000;
  -webkit-text-fill-color: currentcolor;
  caret-color: #000000;
  color-scheme: light;
}

#calendrier #calAdmin input::placeholder,
#calendrier #calAdmin textarea::placeholder {
  color: #555555;
  -webkit-text-fill-color: currentcolor;
  opacity: 1;
}

/* Surfaces claires générales : le texte hérité d’un parent sombre redevient noir. */
:where(.card, .panel, .notice, .don-widget, .insc-card, .insc-sec, .adh-sec, .table-wrap, .admin-fold) {
  color: #000000;
}

:where(.table-wrap) :where(th, td) {
  -webkit-text-fill-color: currentcolor;
}
