/*
 * Amani - mode sombre bleu nuit / mauve.
 * Ce fichier est charge apres la feuille originale. Les !important ponctuels
 * neutralisent les couleurs que le Customizer injecte dans le <head>.
 */

/* Interrupteur pres de la loupe (version bureau). */
header.header-main .header-essentials {
  position: relative;
}
header.header-main .header-essentials > .search-trigger-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}
header.header-main .header-essentials > .amani-dark-toggle-mobile {
  display: none;
}
/* Les mises en page 1/2 masquent normalement la recherche :
   l'interrupteur reste disponible, sans forcer l'affichage de la loupe. */
@media (min-width: 1001px) {
  .theme-body.header_layout-one header.header-main .header-essentials > .search-trigger-wrap,
  .theme-body.header_layout-two header.header-main .header-essentials > .search-trigger-wrap {
    display: flex;
  }
  .theme-body.header_layout-one .search-trigger-wrap > .search-trigger,
  .theme-body.header_layout-two .search-trigger-wrap > .search-trigger {
    display: none;
  }
}

.amani-dark-toggle {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  flex: 0 0 auto;
  line-height: 1;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.amani-dark-toggle .amani-toggle-track {
  display: block;
  position: relative;
  width: 72px;
  height: 34px;
  border-radius: 999px;
  background: transparent;
  border: 1.5px solid #ffffff;
  box-shadow: none;
  transition: opacity .2s ease, border-color .2s ease;
}
.amani-dark-toggle .amani-toggle-off,
.amani-dark-toggle .amani-toggle-on {
  position: absolute;
  top: 0;
  height: 32px;
  display: flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  font-family: system-ui, sans-serif;
  color: #ffffff;
  pointer-events: none;
  transition: opacity .2s ease;
}
.amani-dark-toggle .amani-toggle-off { right: 9px; opacity: 1; }
.amani-dark-toggle .amani-toggle-on { left: 9px; opacity: 0; }
.amani-dark-toggle .amani-toggle-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  height: 24px;
  width: 24px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid #ffffff;
  box-shadow: none;
  transform: translateX(0);
  transition: transform .25s ease;
  pointer-events: none;
}
.amani-dark-toggle .amani-toggle-thumb::before {
  content: '';
  position: absolute;
  inset: 5px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3a7 7 0 0 0 9.79 9.79Z'/%3E%3C/svg%3E");
}
.amani-dark-toggle[aria-checked="true"] .amani-toggle-off { opacity: 0; }
.amani-dark-toggle[aria-checked="true"] .amani-toggle-on { opacity: 1; }
.amani-dark-toggle[aria-checked="true"] .amani-toggle-thumb {
  transform: translateX(40px);
}
.amani-dark-toggle[aria-checked="true"] .amani-toggle-thumb::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2'/%3E%3Cpath d='M12 20v2'/%3E%3Cpath d='m4.93 4.93 1.41 1.41'/%3E%3Cpath d='m17.66 17.66 1.41 1.41'/%3E%3Cpath d='M2 12h2'/%3E%3Cpath d='M20 12h2'/%3E%3Cpath d='m6.34 17.66-1.41 1.41'/%3E%3Cpath d='m19.07 4.93-1.41 1.41'/%3E%3C/svg%3E");
}
.amani-dark-toggle:focus-visible {
  outline: 2px solid #ffffff !important;
  outline-offset: 3px;
}

@media (max-width: 1000px) {
  /* Une vraie ligne flex : logo a gauche, menu et interrupteur centres
     verticalement, tous dans le meme flux (sans position absolue). */
  header.header-main .header-essentials {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 14px;
    padding-top: 0;
    min-height: 0;
  }
  header.header-main .header-essentials > .logo-wrap {
    position: relative;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: none;
    margin: 0 auto 0 0;
    text-align: left;
  }
  header.header-main .header-essentials > .logo-wrap .logo-image img {
    max-width: 100%;
    height: auto;
  }
  header.header-main .header-essentials > .search-trigger-wrap { display: none; }
  header.header-main .header-essentials > .responsive-menu-trigger {
    display: block;
    position: relative;
    flex: 0 0 30px;
    top: auto;
    right: auto;
    margin: 0;
    z-index: 120;
  }
  header.header-main .header-essentials > .amani-dark-toggle-mobile {
    display: inline-flex;
    position: relative;
    top: auto;
    right: auto;
    margin: 0;
    z-index: 120;
  }
}
@media (max-width: 370px) {
  header.header-main .header-essentials { gap: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .amani-dark-toggle .amani-toggle-track,
  .amani-dark-toggle .amani-toggle-thumb,
  .amani-dark-toggle .amani-toggle-off,
  .amani-dark-toggle .amani-toggle-on { transition: none; }
}

/* Palette nuit : on conserve la structure Amani et les accents du theme. */
html.amani-dark {
  color-scheme: dark;
  --amani-night-bg: #0d1232;
  --amani-night-surface: var(--amani-dark-surface, #171738);
  --amani-night-card: #1d1c46;
  --amani-night-raised: var(--amani-dark-raised, #292652);
  --amani-night-text: var(--amani-dark-title, #f0edff);
  --amani-night-subtle: var(--amani-dark-text, #cbc5e8);
  --amani-night-border: rgba(203, 190, 255, .20);
  --amani-night-link: var(--amani-dark-link, #c5b4ff);
}
/* Le fond global, ses couleurs/degrades et les fonds des menus restent ceux
   definis par les reglages d'origine d'Amani, independamment de jour/nuit. */
html.amani-dark body,
html.amani-dark .theme-body {
  color: var(--amani-night-subtle);
}
/* Fonds des billets, pages, mosaïques, widgets, pagination. */
html.amani-dark .theme-body:not(.blog_layout-masonry) .content,
html.amani-dark .theme-body.blog_layout-masonry .content .grid-item,
html.amani-dark .theme-body.blog_layout-masonry .content .archive-header,
html.amani-dark .theme-body.blog_layout-masonry .content .empty-cat-wrap,
html.amani-dark .theme-body.blog_layout-masonry .content section,
html.amani-dark .theme-body.blog_layout-masonry .content .nav-links a.page-numbers:not(.next),
html.amani-dark body.single .content,
html.amani-dark body.page .content,
html.amani-dark body.error404 .theme-body.blog_layout-masonry .content,
html.amani-dark body.search-no-results .theme-body.blog_layout-masonry .content {
  background-color: var(--amani-night-surface) !important;
}
/* Le body des pages single / page porte les classes sur <body> (pas <html>). */
html.amani-dark body.single .theme-body .content,
html.amani-dark body.page .theme-body .content,
html.amani-dark body.error404 .theme-body .content,
html.amani-dark body.search-no-results .theme-body .content {
  background-color: var(--amani-night-surface) !important;
}
html.amani-dark .theme-body.blog_layout-masonry .content .grid-item article,
html.amani-dark .theme-body .content .grid-item-widget > section,
html.amani-dark .theme-body .content .grid-item article .post-wrap {
  background-color: transparent;
}
html.amani-dark .theme-body .content .post-content pre:not(.wp-block-verse),
html.amani-dark .theme-body .content .comment-body pre:not(.wp-block-verse),
html.amani-dark .theme-body .content .post-content code,
html.amani-dark .theme-body .content .comment-body code,
html.amani-dark .theme-body .content .wp-block-preformatted,
html.amani-dark .theme-body .content .wp-block-code,
html.amani-dark .theme-body .content .comments .reply a,
html.amani-dark .theme-body .content .widget_calendar thead,
html.amani-dark .theme-body .content .widget_calendar tbody td div,
html.amani-dark .theme-body .content .wp-block-table th,
html.amani-dark .theme-body .content .wp-block-table td,
html.amani-dark .theme-body .content .post-content table th,
html.amani-dark .theme-body .content .comment-body table th {
  background: var(--amani-night-raised) !important;
  color: var(--amani-night-text) !important;
}
/*
 * Composants oublies par le jeu de couleurs historique Amani.
 * Le theme applique #f8f8f7 à la biographie d'auteur quand la zone de
 * contenu est en c-default. Le mode sombre doit passer en priorite.
 * La fiche ne doit pas former un cartouche colore : son fond reste
 * transparent et suit ainsi automatiquement le fond personnalise de l'article.
 */
html.amani-dark .theme-body .content article .author-bio {
  background: transparent !important;
  color: var(--amani-night-subtle) !important;
}
html.amani-dark .theme-body .content article .author-bio .person .name,
html.amani-dark .theme-body .content article .author-bio .person .name a {
  color: var(--amani-night-text) !important;
}
html.amani-dark .theme-body .content article .author-bio .person .text,
html.amani-dark .theme-body .content article .author-bio .person .text p {
  color: var(--amani-night-subtle) !important;
}
html.amani-dark .theme-body .content article .author-bio .person .social-wrap a {
  color: var(--amani-night-link) !important;
}
html.amani-dark .theme-body .content article .author-bio .person .name a:hover,
html.amani-dark .theme-body .content article .author-bio .person .social-wrap a:hover {
  color: var(--amani-dark-accent-1, #c5b4ff) !important;
}
/* Legendes des photos et galeries : pas de cartouche blanc en mode sombre. */
html.amani-dark .theme-body .content .wp-block-image figcaption,
html.amani-dark .theme-body .content .wp-block-gallery .blocks-gallery-image figcaption,
html.amani-dark .theme-body .content .wp-block-gallery .blocks-gallery-item figcaption {
  background-color: var(--amani-night-raised) !important;
  color: var(--amani-night-text) !important;
}
/* Mini-cartouches et widgets historiques conservant des fonds clairs. */
html.amani-dark .theme-body .content .grid-item article .post-meta-min,
html.amani-dark .theme-body .content .widget.widget_calendar thead,
html.amani-dark .theme-body .content .widget.widget_calendar #today div,
html.amani-dark .theme-body .content .widget.widget_post_views_counter_list_widget .post-thumbnail:before,
html.amani-dark .theme-body .content .widget.bekento_thumbnail_recent_posts .post-thumbnail:before,
html.amani-dark .theme-body .content .widget.null-instagram-feed .instagram-meta {
  background-color: var(--amani-night-raised) !important;
  color: var(--amani-night-text) !important;
}

/* Titres et textes : correction des styles c-default/b-inversed du theme. */
html.amani-dark .theme-body,
html.amani-dark .theme-body .content,
html.amani-dark .theme-body.c-default .content,
html.amani-dark .theme-body.c-inversed .content,
html.amani-dark .theme-body .content p,
html.amani-dark .theme-body .content li,
html.amani-dark .theme-body .content label,
html.amani-dark .theme-body .post-meta,
html.amani-dark .theme-body .post-meta a,
html.amani-dark .theme-body .content figcaption,
html.amani-dark .theme-body .content .comment-notes,
html.amani-dark .theme-body .content .logged-in-as,
html.amani-dark .theme-body footer.footer-main .copyright {
  color: var(--amani-night-subtle) !important;
}
html.amani-dark .theme-body h1,
html.amani-dark .theme-body h2,
html.amani-dark .theme-body h3,
html.amani-dark .theme-body h4,
html.amani-dark .theme-body h5,
html.amani-dark .theme-body h6,
html.amani-dark .theme-body .content .post-title a,
html.amani-dark .theme-body .content h1,
html.amani-dark .theme-body .content h2,
html.amani-dark .theme-body .content h3,
html.amani-dark .theme-body .content h4,
html.amani-dark .theme-body .content h5,
html.amani-dark .theme-body .content h6,
html.amani-dark .theme-body .logo-wrap .logo a,
html.amani-dark .theme-body footer.footer-main a,
html.amani-dark .theme-body .footer-logo {
  color: var(--amani-night-text) !important;
}
html.amani-dark .theme-body .content a:not(.wp-block-button__link):not(.button),
html.amani-dark .theme-body .content .post-content a:not(.wp-block-button__link):not(.button),
html.amani-dark .theme-body footer.footer-main .copyright a {
  color: var(--amani-night-link) !important;
}
html.amani-dark .theme-body .content .post-title a,
html.amani-dark .theme-body .content h1 a,
html.amani-dark .theme-body .content h2 a,
html.amani-dark .theme-body .content h3 a { color: var(--amani-night-text) !important; }
html.amani-dark .theme-body .content a:hover,
html.amani-dark .theme-body footer.footer-main a:hover { color: #e5d9ff !important; }
html.amani-dark .theme-body header.header-main .search-trigger i,
html.amani-dark .theme-body .responsive-wrap .search-trigger i,
html.amani-dark .theme-body .theme-menu div > ul > li > a,
html.amani-dark .theme-body header.header-main .social-wrap a,
html.amani-dark .theme-body footer.footer-main .social-wrap a {
  color: var(--amani-night-text) !important;
}
html.amani-dark .theme-body .theme-menu div > ul > li li a,
html.amani-dark .theme-body .responsive-nav .theme-menu a {
  background-color: var(--amani-night-raised) !important;
  color: var(--amani-night-text) !important;
}
html.amani-dark .theme-body .theme-menu div > ul > li.current-menu-item > a,
html.amani-dark .theme-body .theme-menu div > ul > li.current_page_item > a,
html.amani-dark .theme-body .theme-menu div > ul > li.current-cat > a {
  background-color: #51419a !important;
  color: #fff !important;
}
html.amani-dark .theme-body .responsive-menu-trigger {
  border-top-color: #e4dcff !important;
  border-bottom-color: #e4dcff !important;
}
/* Titre recouvert par un gradient dans le theme Amani original. */
html.amani-dark .theme-body .fourofour,
html.amani-dark .theme-body .empty-cat h2,
html.amani-dark .theme-body .archive-header h1,
html.amani-dark .theme-body h1.post-title,
html.amani-dark .theme-body .title-search-no-results {
  background-image: var(--amani-dark-accent-image, linear-gradient(110deg, #d6b4ff, #8dc5ff)) !important;
}

/* Formulaires : recherche, commentaires, newsletter et widgets. */
html.amani-dark .theme-body textarea,
html.amani-dark .theme-body input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
html.amani-dark .theme-body select,
html.amani-dark .theme-body .content textarea,
html.amani-dark .theme-body .content input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
html.amani-dark .theme-body .content select {
  color: var(--amani-night-text) !important;
  background-color: var(--amani-night-raised) !important;
  border-color: var(--amani-night-border) !important;
  opacity: 1;
}
html.amani-dark .theme-body textarea::placeholder,
html.amani-dark .theme-body input::placeholder { color: #bcb4dd !important; opacity: 1; }
html.amani-dark .theme-body textarea:focus,
html.amani-dark .theme-body input:focus,
html.amani-dark .theme-body select:focus {
  outline: 2px solid #b7a1ff !important;
  outline-offset: 1px;
}
html.amani-dark .theme-body .search-wrap input:not([type="submit"]) {
  background: transparent !important;
  border: 0 !important;
  color: #f5efff !important;
}
html.amani-dark .theme-body input[type="checkbox"],
html.amani-dark .theme-body input[type="radio"] { accent-color: #a58bf7; }
html.amani-dark .theme-body .content .wp-block-quote,
html.amani-dark .theme-body .content blockquote,
html.amani-dark .theme-body .content hr,
html.amani-dark .theme-body .content .comments .children,
html.amani-dark .theme-body .content table td,
html.amani-dark .theme-body .content table th,
html.amani-dark .theme-body .content .widget li {
  border-color: var(--amani-night-border) !important;
}
/* WordPress: conserver les couleurs choisies explicitement dans les blocs. */
html.amani-dark .theme-body .has-text-color,
html.amani-dark .theme-body .has-text-color a { color: inherit; }
html.amani-dark .theme-body ::selection {
  background: #6653b3;
  color: #fff;
}

/*
 * Citations Gutenberg : Amani 2019 ajoute une bordure superieure de 20px
 * #f8f8f7 (ou #111), qui devient une bande claire sous le mode sombre.
 * On garde la citation, ses marges et son icone ; on supprime cette bordure.
 */
html.amani-dark .theme-body .content-singular article .post-content .wp-block-quote,
html.amani-dark .theme-body .content-singular article .comment-body .wp-block-quote {
  border-top: 0 !important;
}

/*
 * Boutons de categories et etiquettes colores : toujours du blanc pur en mode
 * sombre, meme avec un lien personnalise (notamment cyan) et au survol.
 * Ne pas modifier le fond choisi pour ces etiquettes. Les liens qui ne sont
 * pas des boutons colores conservent leur couleur du personnalisateur.
 */
html.amani-dark body .theme-body.colored_categories .content .post-category a,
html.amani-dark body .theme-body.colored_categories .content .post-tags a,
html.amani-dark body .theme-body.colored_categories .content .widget_tag_cloud a,
html.amani-dark body .theme-body.colored_categories .content .post-category a:hover,
html.amani-dark body .theme-body.colored_categories .content .post-tags a:hover,
html.amani-dark body .theme-body.colored_categories .content .widget_tag_cloud a:hover,
html.amani-dark body .theme-body.colored_categories .content .post-category a:focus-visible,
html.amani-dark body .theme-body.colored_categories .content .post-tags a:focus-visible,
html.amani-dark body .theme-body.colored_categories .content .widget_tag_cloud a:focus-visible {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/*
 * Metadonnees des articles : Amani donne une couleur explicite sombre au
 * tiret genere par :before. Respecter la couleur du texte du mode sombre,
 * y compris lorsqu'elle est personnalisee dans WordPress.
 */
html.amani-dark .theme-body .post-meta > div > span::before {
  color: var(--amani-night-subtle) !important;
}
