/*!
 * Canal9 Horizon — compléments WordPress
 * ------------------------------------------------------------------
 * Tout ce que le lab n'avait pas à gérer : barre d'administration, contenus rédigés
 * dans l'éditeur, pagination, compte, zones de widgets. Les composants du lab ne sont
 * pas modifiés ici : ces règles vivent dans la couche « wp », placée après « pages ».
 */
@layer wp {
  /* ---------- Barre d'administration ----------
   * L'en-tête collant se place sous la barre. Sous 600 px, WordPress laisse défiler
   * la barre avec la page : l'en-tête remonte alors tout en haut. */
  .admin-bar .c9-header { top: var(--wp-admin--admin-bar--height, 32px); }
  @media (max-width: 600px) { .admin-bar .c9-header { top: 0; } }

  /* ---------- En-tête : ce que le lab stylait en ligne ou ne prévoyait pas ---------- */
  .c9-drawer__close { color: #ffffff; }
  .c9-drawer__close:hover { background: rgba(255, 255, 255, .08); }
  .c9-pop__links { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid #e0e0e0; }
  .c9-pop__links a { display: block; padding: 11px 0; border-bottom: 1px solid #f0f0f0; color: #292929; font: 500 15px/1.3 var(--font-display); text-transform: uppercase; }
  .c9-pop__links a:hover { text-decoration: underline; text-underline-offset: 3px; }
  .c9-pop__alt { color: #666666; font-size: 14px; }

  /* Navigateurs sans l'API Popover (Safari avant 17, Firefox avant 125) : les panneaux restent
   * fermés d'office et s'ouvrent quand même, à la main (classe .is-open posée par horizon.js). */
  @supports not selector(:popover-open) {
    [popover]:not([data-toast]) { display: none; z-index: 60; }
    [popover].is-open { display: block; }
  }
  html.no-popover [popover]:not([data-toast]) { display: none; z-index: 60; }
  html.no-popover [popover].is-open { display: block; }

  /* Navigateurs sans <dialog> (Safari avant 15.4, Firefox avant 98) : le tiroir et les dialogues
   * sont placés à la main au premier plan ; l'ombre portée tient lieu de fond assombri. */
  html.no-dialog dialog[open] {
    display: block; position: fixed; top: 0; right: 0; bottom: 0; left: auto; z-index: 200;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .6);
  }
  html.no-dialog .c9-dialog[open] { top: 50%; right: auto; bottom: auto; left: 50%; transform: translate(-50%, -50%); max-height: 90vh; overflow: auto; }

  /* ---------- Cartes : article sans image à la une ---------- */
  .c9-card__noimg { display: grid; place-items: center; width: 100%; height: 100%; background: #e0e0e0; color: #9e9e9e; }

  /* ---------- Page ou article générique (avant les gabarits dédiés) ---------- */
  .entry { padding-block: 8px 56px; }
  .entry__head { display: grid; gap: var(--space-16); margin-block: var(--space-24) var(--space-30); }
  .entry__title { font-size: clamp(28px, 3.2vw, 42px); line-height: 1.15; text-wrap: balance; }
  .entry__meta { color: var(--text-muted); font-size: 15px; }
  .entry__content--builder { max-width: none; }

  /* ---------- Contenus rédigés dans l'éditeur ---------- */
  .prose > * { min-width: 0; }
  .prose :is(h2, h3, h4) { margin-top: var(--space-16); }
  .prose h2 { font-size: 26px; }
  .prose h3 { font-size: 22px; }
  .prose h4 { font-size: 18px; }
  .prose :is(ul, ol) { display: grid; gap: 6px; padding-left: 1.3em; }
  .prose li::marker { color: var(--text-muted); }
  .prose blockquote {
    padding-left: 21px; border-left: var(--section-bar) solid var(--jaune);
    color: var(--ink); font: 500 20px/1.4 var(--font-display);
  }
  .prose blockquote cite { display: block; margin-top: 8px; color: var(--text-muted); font: 400 15px/1.4 var(--font-text); font-style: normal; }
  .prose :is(iframe, video) { width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; background: #000000; }
  .prose figure { margin: 0; }
  .prose :is(figcaption, .wp-caption-text) { margin-top: 6px; color: var(--text-muted); font-size: 14px; line-height: 1.4; }
  .prose .wp-caption { max-width: 100%; }
  .prose hr { width: 100%; height: 1px; border: 0; background: var(--border-strong); }
  .prose table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
  .prose :is(th, td) { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
  .prose th { color: var(--ink); font-family: var(--font-display); font-weight: 500; }
  .prose .aligncenter { margin-inline: auto; }
  @media (min-width: 768px) {
    .prose .alignleft { float: left; max-width: 50%; margin: 4px var(--space-24) var(--space-12) 0; }
    .prose .alignright { float: right; max-width: 50%; margin: 4px 0 var(--space-12) var(--space-24); }
  }

  /* ---------- Pagination ---------- */
  .c9-pagination { margin-top: var(--space-40); }
  .c9-pagination ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .c9-pagination .page-numbers {
    display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 12px;
    border-radius: var(--radius-pill); background: var(--surface); color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--border-strong); font: 500 15px/1 var(--font-display);
  }
  .c9-pagination a.page-numbers:hover { box-shadow: inset 0 0 0 1px var(--ink); }
  .c9-pagination .page-numbers.current { background: var(--jaune); color: var(--on-accent); box-shadow: none; }
  .c9-pagination .page-numbers.dots { background: transparent; box-shadow: none; }

  /* ---------- Page introuvable ---------- */
  .c9-empty__title { margin-bottom: 4px; font-size: 18px; }

  /* ---------- Pied de page : réseaux sociaux, hébergeur, zone newsletter ---------- */
  .c9-footer__meta { display: flex; flex-wrap: wrap; gap: 6px 18px; }
  .c9-footer__newsletter form { display: flex; flex-wrap: wrap; margin-top: var(--space-10); }
  .c9-footer__newsletter :is(input[type="email"], input[type="text"]) {
    flex: 1; min-width: 0; height: 46px; padding: 0 var(--space-20);
    border: 1px solid #bdbdbd; border-right: 0; border-radius: 32px 0 0 32px;
    font: 16px/24px var(--font-text); color: #000000; background: #ffffff;
  }
  .c9-footer__newsletter :is(button, input[type="submit"]) {
    height: 46px; padding: 0 var(--space-20); border: 0; border-radius: 0 32px 32px 0; cursor: pointer;
    background: var(--jaune); color: #000000; font: 500 14px/16.8px var(--font-display); text-transform: uppercase;
  }
  .c9-footer__newsletter :is(input, button):focus-visible { outline: 2px solid #292929; outline-offset: 2px; }

  /* ---------- Repère de l'aperçu (visible seulement en aperçu du thème) ---------- */
  .c9hz-preview {
    position: fixed; left: 12px; bottom: 12px; z-index: 300;
    padding: 8px 14px; border-radius: var(--radius-pill);
    background: #292929; color: #ffffff; box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--jaune);
    font: 500 12px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .05em;
  }
  .c9hz-preview:hover { background: var(--jaune); color: var(--on-accent); }

  /* ---------- Classes de WordPress ---------- */
  .screen-reader-text {
    position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
    overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
  }
}
