/* ==========================================================================
   PIERRE ERNIE — SYSTÈME DE DESIGN ÉDITORIAL MODERNE
   Conçu pour une expérience utilisateur (UX) d'excellence
   Typographie : Cormorant Garamond & Plus Jakarta Sans — Zéro Émojis
   ========================================================================== */

:root {
  /* Fonds sombres. Le grain se voit autour ; le bloc de lecture est posé
     dessus sur --bg-surface-card, comme le voile du thème motion. */
  --bg-page: #0a0e10;
  --bg-surface: #141a1f;
  --bg-surface-elevated: #1a2127;
  --bg-surface-card: #12171a;
  --bg-glass: rgba(18, 23, 26, 0.92);
  --bg-wash: #161c21;

  /* Accents : le vert #a8ef9d est celui des liens et des titres du thème motion */
  --accent-gold: #d3a05d;
  --accent-gold-soft: rgba(211, 160, 93, 0.14);
  --accent-gold-ink: #e0b578;
  --accent-cyan: #7fb4cd;
  --accent-teal: #a8ef9d;
  --accent-teal-strong: #c4f5bc;
  --accent-teal-wash: rgba(168, 239, 157, 0.10);
  --accent-teal-glow: rgba(168, 239, 157, 0.22);

  /* Typographie : blanc cassé plutôt que blanc pur, moins agressif en lecture longue */
  --text-primary: #e8e6e1;
  --text-secondary: #b4b0a8;
  --text-muted: #8e8a83;
  --text-contrast: #f5f3ef;
  --text-on-accent: #0b0f12;

  /* Bordures et Lignes */
  --border-subtle: rgba(255, 255, 255, 0.10);
  --border-medium: rgba(255, 255, 255, 0.17);
  --border-focus: rgba(168, 239, 157, 0.55);

  /* Ombres : sur fond sombre elles creusent au lieu d'éclairer */
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-medium: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-strong: 0 18px 44px rgba(0, 0, 0, 0.55);

  /* Voiles de survol : blanctrans du thème motion (rgba 255 a 0.051) */
  --hover-wash: rgba(255, 255, 255, 0.05);
  --hover-wash-strong: rgba(255, 255, 255, 0.09);

  /* États (succès, erreur, brouillon) */
  --state-success-bg: rgba(110, 200, 125, 0.14);
  --state-success-border: rgba(110, 200, 125, 0.34);
  --state-success-ink: #8fd89e;
  --state-danger-bg: rgba(226, 110, 110, 0.14);
  --state-danger-border: rgba(226, 110, 110, 0.34);
  --state-danger-ink: #e08a8a;
  --state-draft-bg: rgba(211, 160, 93, 0.20);

  /* Polices */
  --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --------------------------------------------------------------------------
   L'ADMINISTRATION RESTE CLAIRE
   Le sombre a été demandé pour le confort de lecture du site public.
   Le back-office rétablit donc les jetons clairs d'origine sur son propre
   conteneur : tout le CSS qui suit continue de passer par les variables.
   -------------------------------------------------------------------------- */
body.admin-area {
  --bg-page: #f0ede3;
  --bg-surface: #e7e3d6;
  --bg-surface-elevated: #ffffff;
  --bg-surface-card: #fbfaf6;
  --bg-glass: rgba(251, 250, 246, 0.88);
  --bg-wash: #eae5da;

  --accent-gold: #b07c3a;
  --accent-gold-soft: #f3eada;
  --accent-gold-ink: #8a5e27;
  --accent-cyan: #3a5b70;
  --accent-teal: #3f6152;
  --accent-teal-strong: #2e483c;
  --accent-teal-wash: #e3eae4;
  --accent-teal-glow: rgba(63, 97, 82, 0.18);

  --text-primary: #2c2921;
  --text-secondary: #55514a;
  --text-muted: #67625a;
  --text-contrast: #1f1d18;
  --text-on-accent: #ffffff;

  --border-subtle: rgba(31, 29, 24, 0.10);
  --border-medium: rgba(31, 29, 24, 0.16);
  --border-focus: rgba(63, 97, 82, 0.55);

  --shadow-soft: 0 2px 8px rgba(31, 29, 24, 0.05);
  --shadow-medium: 0 8px 24px rgba(31, 29, 24, 0.08);
  --shadow-strong: 0 18px 44px rgba(31, 29, 24, 0.12);

  --hover-wash: rgba(31, 29, 24, 0.04);
  --hover-wash-strong: rgba(31, 29, 24, 0.07);

  --state-success-bg: rgba(47, 106, 62, 0.10);
  --state-success-border: rgba(47, 106, 62, 0.28);
  --state-success-ink: #2f6a3e;
  --state-danger-bg: rgba(168, 45, 45, 0.10);
  --state-danger-border: rgba(168, 45, 45, 0.28);
  --state-danger-ink: #a82d2d;
  --state-draft-bg: rgba(176, 124, 58, 0.16);

  background-image: none;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body.site-body {
  margin: 0;
  padding: 0;
  /* Fond « Grain » : un bruit fractal genere en SVG, sans aucune regularite,
     pose sur une lueur verte large en haut de page. Tout est en ligne, rien a
     telecharger. Le grain se repete, la lueur reste fixe au defilement. */
  background-color: var(--bg-page);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='0.16'/%3E%3C/svg%3E"),
    radial-gradient(70% 640px at 50% 0%, rgba(50, 116, 100, 0.18), transparent 72%);
  background-size: 180px 180px, 100% 900px;
  background-repeat: repeat, no-repeat;
  background-position: top left, top center;
  background-attachment: scroll, fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.8;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Layout général
   -------------------------------------------------------------------------- */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Largeur alignée sur l'en-tête : le contenu occupe la même bande que le menu,
   au lieu de flotter dans une colonne bien plus étroite. */
.content-wrapper {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* Le contenu repose directement sur le fond, sans cadre ni voile, comme sur
   l'ancien WordPress : le grain court d'un bord à l'autre de la page. */
.site-body:not(.admin-area) .article-layout,
.site-body:not(.admin-area) .listing-layout,
.site-body:not(.admin-area) .home-layout {
  background: none;
  border: 0;
  box-shadow: none;
  max-width: 1080px;
}

/* --------------------------------------------------------------------------
   En-tête Maître (Master Header)
   -------------------------------------------------------------------------- */
/* L'en-tête défile avec la page : il ne reste pas collé en haut de l'écran.
   Le fond translucide et le flou d'arrière-plan n'avaient de sens que pour un
   en-tête qui passait par-dessus le contenu ; il devient donc opaque, dans la
   teinte que donnait exactement le mélange précédent. */
.master-header {
  border-bottom: 1px solid var(--border-subtle);
  background: none;
  box-shadow: none;
}

.header-top-tier {
  max-width: 1600px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-block {
  display: flex;
  align-items: center;
}

.brand-link {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--text-contrast);
  transition: color 0.2s ease;
}

.brand-link:hover .brand-title {
  color: var(--accent-teal);
}

.brand-tagline {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Lecteur Audio Zen Épuré (Zéro émoji)
   -------------------------------------------------------------------------- */
.zen-player {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 6px 14px 6px 8px;
  transition: all 0.2s ease;
}

.zen-player:hover {
  background: var(--bg-surface-card);
  border-color: var(--border-medium);
}

.btn-play-pause {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-teal);
  color: var(--text-on-accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn-play-pause:hover {
  transform: scale(1.08);
  background: var(--accent-teal-strong);
}

.player-info {
  display: flex;
  flex-direction: column;
}

.player-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-teal);
}

.player-title {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Recherche & Admin
   -------------------------------------------------------------------------- */
.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 9999px;
  padding: 9px 16px;
  transition: all 0.2s ease;
}

.search-form:focus-within {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px var(--accent-teal-glow);
  background: var(--bg-surface-elevated);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-form input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  outline: none;
  width: 130px;
  transition: width 0.2s ease;
}

.search-form input:focus {
  width: 180px;
}

.search-form input::placeholder {
  color: var(--text-muted);
}

.btn-admin-access {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 7px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-admin-access:hover {
  color: var(--text-contrast);
  border-color: var(--border-medium);
  background: var(--hover-wash);
}

/* --------------------------------------------------------------------------
   Navigation Éditoriale (10 Rubriques en 2 rangées nettes)
   -------------------------------------------------------------------------- */
.main-nav {
  max-width: 1600px;
  margin: 0 auto;
  padding: 14px 20px 12px;
}

/* Les 10 rubriques tiennent sur une seule ligne : pas de retour à la ligne,
   et un défilement horizontal discret quand la fenêtre est trop étroite. */
.nav-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

.nav-row::-webkit-scrollbar {
  display: none;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 9px 13px;
  flex-shrink: 0;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.nav-pill:hover {
  color: var(--text-contrast);
  background: var(--bg-surface-card);
  border-color: var(--border-medium);
}

.nav-pill.active {
  color: var(--text-on-accent);
  background: var(--accent-teal);
  border-color: var(--accent-teal);
  font-weight: 600;
}

.nav-pill.active:hover {
  color: var(--text-on-accent);
  background: var(--accent-teal-strong);
  border-color: var(--accent-teal-strong);
}

.nav-pill:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   En-tête de contenu (Editorial Header)
   -------------------------------------------------------------------------- */
.editorial-header {
  margin-bottom: 44px;
  padding-bottom: 0;
  text-align: center;
}

/* Le filet ocre remplace la bordure pleine largeur du thème sombre */
.editorial-header::after {
  content: "";
  display: block;
  width: 58px;
  height: 2px;
  margin: 28px auto 0;
  background: var(--accent-gold);
}

.editorial-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-gold-ink);
  margin-bottom: 14px;
}

.editorial-title {
  font-family: var(--font-serif);
  font-size: 3.5rem;
  font-weight: 600;
  line-height: 1.08;
  color: var(--text-contrast);
  margin: 0;
  letter-spacing: -0.02em;
}

.editorial-lead {
  font-size: 1.1875rem;
  line-height: 1.75;
  color: var(--text-secondary);
  max-width: 820px;
  margin: 22px auto 0;
}

/* Métadonnées de l'article */
.article-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.meta-badge-link {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-gold-ink);
  text-decoration: none;
  background: var(--accent-gold-soft);
  padding: 6px 11px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}

.meta-badge-link:hover {
  border-color: var(--accent-gold);
}

.meta-separator {
  color: var(--text-muted);
}

.meta-timestamp {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Couverture d'article */
.article-cover-wrap {
  margin: 28px 0 40px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-medium);
  max-height: 520px;
}

.article-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --------------------------------------------------------------------------
   CONTENU IMPORTÉ — RENDU DU THÈME WORDPRESS « MOTION »

   Les valeurs ci-dessous ne sont pas estimées : elles sont relevées dans la
   feuille de style de pierre-ernie.fr (thème motion, wp-content/themes/motion/
   style.css) et dans celle du greffon Collapse-O-Matic. Le HTML importé
   s'appuie dessus — il commence d'ailleurs par <div class="postcontent">,
   la classe même du thème.

   Deux écarts assumés, et deux seulement :
   — les couleurs sont assombries au rendu, le thème d'origine était sur fond
     noir (voir adapter_couleurs_inline dans app/views/public.py) ;
   — sous 680 px de large, les images flottantes repassent en pleine largeur,
     le thème d'origine n'était pas responsive.
   -------------------------------------------------------------------------- */

/* .postcontent { margin: .8em 0; font-size: 1em; line-height: 1.5em; }
   #content.full { width: 980px; }
   La hauteur de ligne est exprimée en em : elle est donc calculée une fois
   ici, puis héritée telle quelle par les 3 489 fragments en 10 pt. C'est ce
   qui donne au texte d'origine son interligne régulier. */
.prose-container {
  max-width: 980px;
  margin: 0.8em auto;
  font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
  font-size: 1em;
  line-height: 1.5em;
  color: var(--text-primary);
}

/* Le thème remet les marges des paragraphes à zéro et les remplace par un
   padding asymétrique : .postcontent p { padding: .6em 0 .2em 0; } */
.prose-container p {
  margin: 0;
  padding: 0.6em 0 0.2em 0;
}

/* Alignements, valeurs exactes du thème. À noter : motion ne définit aucune
   règle .alignnone. Une image sans alignement n'a donc aucune marge et suit
   le texte au plus près — c'est là que mon rendu s'écartait le plus. */
.prose-container img.alignleft,
.prose-container .alignleft {
  float: left;
  margin: 5px 15px 5px 0;
}

.prose-container img.alignright,
.prose-container .alignright {
  float: right;
  margin: 5px 0 5px 15px;
}

.prose-container img.aligncenter,
.prose-container .aligncenter,
.prose-container div.aligncenter {
  display: block;
  margin: 10px auto;
  text-align: center;
}

/* Reset du thème : html, body, div, p, span, img, table… { margin: 0;
   padding: 0; border: 0; vertical-align: baseline; } */
.prose-container img {
  max-width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  vertical-align: baseline;
}

/* Les liens du thème n'ont pas de couleur propre : ils gardent celle du texte
   qui les entoure et se signalent par un pointillé vert. Le vert d'origine
   (#a8ef9d) était fait pour le fond noir ; il est assombri ici comme le reste,
   à teinte constante. Une image dans un lien ne porte pas ce trait. */
.prose-container a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed #a8ef9d;
}

.prose-container a:hover {
  background: var(--hover-wash);
}

.prose-container a img {
  background: none;
  border-bottom: 0;
}

/* table { margin: .5em 0; }  table td, table th { padding: .5em .7em; }
   Les fonds du thème étaient des PNG translucides posés sur le noir ; ils sont
   rendus ici par des voiles de même intensité sur le parchemin. */
.prose-container table {
  width: auto;
  margin: 0.5em 0;
  background: none;
  border: 0;
  border-radius: 0;
  border-collapse: collapse;
}

.prose-container th,
.prose-container td {
  padding: 0.5em 0.7em;
  border: 0;
  color: inherit;
  font-size: inherit;
  text-align: inherit;
  letter-spacing: normal;
}

.prose-container td {
  background: rgba(0, 0, 0, 0.30);
  vertical-align: middle;
}

.prose-container th {
  background: rgba(255, 255, 255, 0.05);
  color: #a8ef9d;
  font-weight: inherit;
  text-transform: uppercase;
}

.prose-container ul,
.prose-container ol {
  padding: 0.4em 0 0.5em 2em;
  margin: 0;
}

.prose-container ul li { list-style: disc; }
.prose-container ol li { list-style: decimal; }

.prose-container h1, .prose-container h2, .prose-container h3,
.prose-container h4, .prose-container h5, .prose-container h6 {
  padding: 0.8em 0;
  margin: 0;
  font-weight: bold;
  line-height: inherit;
}

.prose-container h1 { font-size: 1.5em; }
.prose-container h2 { font-size: 1.4em; }
.prose-container h3 { font-size: 1.3em; }
.prose-container h4 { font-size: 1.2em; }
.prose-container h5 { font-size: 1.1em; }
.prose-container h6 { font-size: 1em; }

/* Légendes d'images de WordPress. */
.prose-container .wp-caption {
  max-width: 96%;
  padding: 5px 3px 10px;
  text-align: center;
}

.prose-container .wp-caption img {
  border: 0 none;
  height: auto;
  margin: 0;
  max-width: 98.5%;
  padding: 0;
  width: auto;
}

.prose-container .wp-caption p.wp-caption-text {
  font-size: 11px;
  line-height: 17px;
  margin: 0;
  padding: 0 4px 5px;
}

/* Greffon Collapse-O-Matic, css/core_style.css :
   .collapseomatic { cursor: pointer; background-image: url(arrow-down.png);
                     background-repeat: no-repeat; padding: 0 0 10px 16px; }
   .colomat-close  { background-image: url(arrow-up.png); }
   .collapseomatic_content { margin-top: 0; margin-left: 16px; padding: 0; }
   Les deux flèches du greffon sont ici dessinées en CSS plutôt que chargées
   comme images : même place, à gauche du texte, même bascule. */
.prose-container .collapseomatic {
  cursor: pointer;
  position: relative;
  padding: 0 0 10px 16px;
}

.prose-container .collapseomatic::before {
  content: "▾";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 0.85em;
}

.prose-container .collapseomatic.est-ouvert::before {
  content: "▴";
}

.prose-container .collapseomatic:hover {
  text-decoration: underline;
}

.prose-container .collapseomatic:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.prose-container .collapseomatic_content {
  display: none;
  margin-top: 0;
  margin-left: 16px;
  padding: 0;
}

.prose-container .collapseomatic_content.est-ouvert {
  display: block;
}

.prose-container blockquote {
  margin: 0;
  padding: 0.6em 0 0.2em 0;
}

/* Les flottants sont refermés à la fin de l'article seulement : c'est entre
   les paragraphes que le texte doit continuer de s'enrouler autour des
   images. */
.prose-container::after {
  content: "";
  display: table;
  clear: both;
}

/* Cette image est encore servie par l'ancien site, où elle renvoie un 404 :
   elle ne s'affiche nulle part, et un cadre vide vaut moins que rien. */
.prose-container img[src*="pierre-ernie.fr"] {
  display: none;
}

/* --------------------------------------------------------------------------
   Relaxation musicale — bande de l'en-tête, au-dessus des onglets
   Mêmes largeur et gouttières que les deux autres étages de l'en-tête, pour
   que le lecteur s'aligne sur la marque et sur les onglets.
   -------------------------------------------------------------------------- */
.header-audio {
  max-width: 1600px;
  margin: 0 auto;
  padding: 7px 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

/* L'en-tête est collant : le lecteur reste discret pour ne pas manger la
   hauteur utile de l'écran. */
.header-audio audio {
  flex: 1 1 auto;
  max-width: 420px;
  height: 32px;
}

@media (max-width: 680px) {
  .header-audio {
    padding: 6px 16px;
  }

  .header-audio audio {
    max-width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Section d'exploration & Grille d'articles
   -------------------------------------------------------------------------- */
.explore-section {
  margin-top: 70px;
  padding-top: 48px;
  border-top: 1px solid var(--border-subtle);
}

.section-title-wrap {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 36px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 2.375rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-contrast);
  margin: 0 0 10px;
}

.section-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 24px;
}

.article-card {
  background: var(--bg-surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.article-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-medium);
}

.card-media-link {
  display: block;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: var(--accent-teal-wash);
}

.card-media-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.article-card:hover .card-media-img {
  transform: scale(1.04);
}

.card-content {
  padding: 22px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-category-badge,
.card-date {
  align-self: flex-start;
  font-size: 0.6563rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-gold-ink);
  background: var(--accent-gold-soft);
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.card-headline {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.3;
  margin: 0 0 10px;
}

.card-headline a {
  color: var(--text-contrast);
  text-decoration: none;
  transition: color 0.2s ease;
}

.card-headline a:hover {
  color: var(--accent-teal);
}

.card-summary {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 18px;
  flex-grow: 1;
}

.card-action {
  margin-top: auto;
}

.card-action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-teal);
  text-decoration: none;
  transition: gap 0.2s ease;
}

.card-action-link:hover {
  gap: 10px;
}

/* Navigation bas d'article */
.article-nav-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 60px;
  padding-top: 30px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 16px;
}

.nav-back-link,
.nav-next-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-teal);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-back-link:hover,
.nav-next-link:hover {
  color: var(--accent-teal-strong);
}

/* --------------------------------------------------------------------------
   Messages d'état
   -------------------------------------------------------------------------- */
.notice-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  background: var(--bg-surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
}

.flash-container {
  max-width: 1400px;
  margin: 16px auto 0;
  padding: 0 20px;
}

.flash-alert {
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.flash-success {
  background: var(--state-success-bg);
  border: 1px solid var(--state-success-border);
  color: var(--state-success-ink);
}

.flash-error {
  background: var(--state-danger-bg);
  border: 1px solid var(--state-danger-border);
  color: var(--state-danger-ink);
}

/* --------------------------------------------------------------------------
   Pied de page Maître (Master Footer)
   -------------------------------------------------------------------------- */
.master-footer {
  /* transparent : le grain traverse aussi le pied de page */
  background: none;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
  padding: 60px 20px 32px;
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-heading {
  font-family: var(--font-serif);
  font-size: 1.625rem;
  font-weight: 600;
  color: var(--text-contrast);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.footer-desc {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 460px;
}

.footer-subheading {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.footer-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-nav-list a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.footer-nav-list a:hover {
  color: var(--text-contrast);
}

.footer-note {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.footer-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

.footer-bottom-actions {
  display: inline-flex;
  align-items: center;
  gap: 20px;
}

.back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.back-to-top:hover {
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Bouton flottant de retour en haut (toutes les pages, site et administration)
   -------------------------------------------------------------------------- */

/* Sans JavaScript le bouton ne sert à rien : il reste masqué. L'attribut hidden
   doit primer sur le display du bouton, d'où ce garde-fou de spécificité. */
.scroll-top-btn[hidden] {
  display: none;
}

.scroll-top-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--accent-teal);
  border-radius: 9999px;
  background: var(--accent-teal);
  color: var(--text-on-accent);
  cursor: pointer;
  box-shadow: var(--shadow-medium);
  /* Masqué tant que la page n'a pas défilé, sans quitter le flux : la
     transition d'opacité ne fonctionnerait pas avec display: none. */
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease,
              visibility 0.22s ease, background 0.2s ease;
}

.scroll-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  background: var(--accent-teal-strong);
  border-color: var(--accent-teal-strong);
}

.scroll-top-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
}

/* La modale de déconnexion prend toute l'attention : le bouton s'efface */
body.has-open-dialog .scroll-top-btn {
  opacity: 0;
  visibility: hidden;
}

/* --------------------------------------------------------------------------
   Bannière Rapide Administrateur Connecté (Front-Office)
   -------------------------------------------------------------------------- */
.admin-logged-banner {
  background: var(--accent-teal-wash);
  border-bottom: 1px solid rgba(63, 97, 82, 0.25);
  padding: 8px 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.admin-logged-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-logged-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--accent-teal);
}

.admin-logged-links {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

.admin-logged-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.admin-logged-link:hover {
  color: var(--text-contrast);
}

.admin-logged-link-out {
  color: var(--state-danger-ink);
  font-weight: 600;
}

.admin-logged-link-out:hover {
  color: #7f2020;
}

/* --------------------------------------------------------------------------
   BACKOFFICE / ADMINISTRATION (Sidebar Bloquée & Layout Moderne)
   -------------------------------------------------------------------------- */
.admin-top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 54px;
  background: rgba(251, 250, 246, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.admin-top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 24px;
}

.admin-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-tag-badge {
  background: var(--accent-teal-wash);
  border: 1px solid rgba(63, 97, 82, 0.28);
  color: var(--accent-teal-strong);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 9px;
  border-radius: 6px;
}

.admin-site-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-contrast);
  letter-spacing: 0.02em;
}

.admin-top-utils {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-admin-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.btn-admin-nav:hover {
  color: var(--text-contrast);
  background: var(--hover-wash);
  border-color: var(--border-subtle);
}

.btn-admin-logout {
  color: var(--state-danger-ink);
  font-weight: 600;
}

.btn-admin-logout:hover {
  color: #7f2020;
  background: var(--state-danger-bg);
  border-color: var(--state-danger-border);
}

/* Structure globale du Dashboard avec Sidebar Bloquée */
.admin-dashboard-layout {
  display: flex;
  min-height: calc(100vh - 54px);
  width: 100%;
  position: relative;
  align-items: flex-start;
}

/* Sidebar FIXÉE / BLOQUÉE : elle ne scrolle jamais ! */
.admin-sticky-sidebar {
  width: 250px;
  flex-shrink: 0;
  position: sticky;
  top: 54px;
  height: calc(100vh - 54px);
  overflow-y: auto;
  scrollbar-width: thin;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 24px 14px;
  z-index: 40;
}

.sidebar-nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.sidebar-item svg {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.sidebar-item:hover {
  color: var(--text-contrast);
  background: var(--hover-wash);
  border-color: var(--border-subtle);
}

.sidebar-item:hover svg {
  color: var(--accent-teal);
}

.sidebar-item.active {
  color: var(--accent-teal-strong);
  background: var(--accent-teal-wash);
  border-color: rgba(63, 97, 82, 0.28);
  font-weight: 600;
}

.sidebar-item.active svg {
  color: var(--accent-teal);
}

/* Zone de contenu principale défilante */
.admin-scrollable-content {
  flex-grow: 1;
  padding: 36px 48px;
  background: var(--bg-page);
  min-width: 0;
  overflow-x: hidden;
}

.admin-minimal-footer {
  padding: 16px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Rétro-compatibilité pour éléments admin */
.admin {
  display: flex;
  min-height: calc(100vh - 54px);
  width: 100%;
  position: relative;
  align-items: flex-start;
}

.admin aside {
  width: 250px;
  flex-shrink: 0;
  position: sticky;
  top: 54px;
  height: calc(100vh - 54px);
  overflow-y: auto;
  scrollbar-width: thin;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 40;
}

.admin aside a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.admin aside a:hover {
  color: var(--text-contrast);
  background: var(--hover-wash);
}

.admin-main {
  flex-grow: 1;
  padding: 36px 48px;
  min-width: 0;
}

.admin-main h1 {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  color: var(--text-contrast);
  margin-top: 0;
}

.stats {
  display: flex;
  gap: 18px;
  margin: 28px 0;
  flex-wrap: wrap;
}

.stats div {
  background: var(--bg-surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px 28px;
  min-width: 140px;
}

.stats b {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  color: var(--accent-teal);
  display: block;
  line-height: 1;
}

.stats span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 24px;
}

th, td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.9rem;
}

th {
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status.published {
  background: var(--state-success-bg);
  color: var(--state-success-ink);
}

.status.draft {
  background: var(--state-draft-bg);
  color: var(--accent-gold-ink);
}

/* --------------------------------------------------------------------------
   Sélecteur de Média Polyvalent & Live Preview (Admin)
   -------------------------------------------------------------------------- */
.admin-form-container {
  max-width: 960px;
  margin: 0;
}

.admin-form-header {
  margin-bottom: 28px;
}

.admin-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold-ink);
  display: block;
  margin-bottom: 6px;
}

.admin-form-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  color: var(--text-contrast);
  margin: 0;
}

.form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.form-col-4 { flex: 4; min-width: 200px; }
.form-col-6 { flex: 6; min-width: 260px; }
.form-col-8 { flex: 8; min-width: 320px; }

.form-group {
  margin-bottom: 22px;
}

.form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-contrast);
  margin-bottom: 8px;
}

.form-label small {
  font-weight: 400;
  color: var(--text-muted);
}

.form-input-lg {
  font-size: 1.1rem !important;
  font-weight: 600;
  padding: 12px 16px !important;
}

.form-textarea-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-size: 0.875rem !important;
  line-height: 1.6 !important;
  tab-size: 2;
}

/* Bloc sélecteur de média */
.media-selector-block {
  background: var(--bg-surface-card);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.media-selector-header {
  margin-bottom: 12px;
}

.media-helper-text {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.media-inputs-grid {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.media-input-wrap {
  flex: 3;
  min-width: 280px;
}

.media-select-wrap {
  flex: 2;
  min-width: 240px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  margin-top: 0;
}

.btn-secondary:hover {
  background: var(--hover-wash);
  color: var(--text-contrast);
  border-color: var(--border-medium);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-teal);
  color: var(--text-on-accent);
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: var(--accent-teal-strong);
  box-shadow: var(--shadow-soft);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--state-danger-bg);
  color: var(--state-danger-ink);
  border: 1px solid var(--state-danger-border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: var(--state-danger-ink);
  color: var(--text-on-accent);
  border-color: var(--state-danger-ink);
}

/* Zone de preview dynamique */
.media-preview-container {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.preview-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-gold-ink);
  margin-bottom: 8px;
}

.media-preview-box {
  background: var(--bg-surface);
  border: 1px dashed var(--border-medium);
  border-radius: 6px;
  padding: 16px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.preview-frame {
  width: 100%;
  display: flex;
  justify-content: center;
}

.preview-frame.preview-video {
  max-width: 520px;
  aspect-ratio: 16/9;
}

.preview-frame.preview-video iframe,
.preview-frame.preview-video video {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  border: none;
}

.preview-frame.preview-audio {
  max-width: 440px;
}

.preview-frame.preview-audio audio {
  width: 100%;
}

.preview-frame.preview-image img {
  max-width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.preview-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 10px;
}

.preview-placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  margin: 0;
}

.preview-error {
  color: var(--state-danger-ink);
  font-size: 0.85rem;
  margin: 0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 32px;
}

.danger-zone {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

/* --------------------------------------------------------------------------
   Front-End : Cadres de Média (Vidéo YouTube, Vidéo HTML5, Audio, Image)
   -------------------------------------------------------------------------- */
.article-media-hero {
  max-width: 880px;
  margin: 28px auto 44px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-medium);
  background: var(--accent-teal-wash);
}

.media-aspect-ratio {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
}

.media-aspect-ratio iframe,
.media-aspect-ratio video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.audio-player-card {
  background: var(--bg-surface-card);
  border: 1px solid var(--border-medium);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-soft);
}

.audio-badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold-ink);
}

.media-audio-element {
  width: 100%;
}

.image-cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Formulaires */
input, textarea, select {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px var(--accent-teal-glow);
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-teal);
  color: var(--text-on-accent);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 11px 22px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  margin-top: 10px;
}

button:hover, .button:hover {
  background: var(--accent-teal-strong);
  box-shadow: var(--shadow-soft);
}

.button.danger {
  background: var(--state-danger-ink);
  color: var(--text-on-accent);
}

.button.danger:hover {
  background: #7f2020;
}

.login {
  max-width: 420px;
  margin: 80px auto;
  background: var(--bg-surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 36px;
  box-shadow: var(--shadow-medium);
}

.login h1 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  margin-top: 0;
  color: var(--text-contrast);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.media-grid figure {
  margin: 0;
  background: var(--bg-surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.media-grid img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

.media-grid figcaption {
  padding: 8px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-all;
}

/* --------------------------------------------------------------------------
   Fenêtre de confirmation (déconnexion)
   -------------------------------------------------------------------------- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(44, 41, 33, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: confirm-fade 0.18s ease;
}

/* La règle display:flex ci-dessus l'emporterait sur l'attribut hidden */
.confirm-overlay[hidden] {
  display: none;
}

body.has-open-dialog {
  overflow: hidden;
}

.confirm-dialog {
  width: 100%;
  max-width: 420px;
  padding: 28px;
  text-align: center;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  box-shadow: var(--shadow-strong);
  animation: confirm-rise 0.22s ease;
}

.confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  border-radius: 50%;
  color: var(--state-danger-ink);
  background: var(--state-danger-bg);
  border: 1px solid var(--state-danger-border);
}

.confirm-title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-contrast);
}

.confirm-text {
  margin: 0 0 24px;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.confirm-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.confirm-btn {
  flex: 1 1 140px;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.confirm-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.confirm-btn-cancel {
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-medium);
}

.confirm-btn-cancel:hover {
  color: var(--text-contrast);
  background: var(--hover-wash);
}

.confirm-btn-danger {
  color: var(--text-on-accent);
  background: var(--state-danger-ink);
  border: 1px solid var(--state-danger-ink);
  font-weight: 600;
}

.confirm-btn-danger:hover {
  color: var(--text-on-accent);
  background: #7f2020;
  border-color: #7f2020;
}

@keyframes confirm-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes confirm-rise {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .confirm-overlay,
  .confirm-dialog {
    animation: none;
  }

  .scroll-top-btn {
    transform: none;
    transition: opacity 0.01s linear, visibility 0.01s linear;
  }
}

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .header-top-tier {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    justify-content: space-between;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .admin {
    grid-template-columns: 1fr;
  }

  .admin aside {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    flex-direction: row;
    flex-wrap: wrap;
  }

  .admin-main {
    padding: 24px 18px;
  }
}

@media (max-width: 680px) {
  .nav-row {
    justify-content: flex-start;
  }

  .nav-pill {
    font-size: 0.78rem;
    padding: 8px 12px;
  }

  .prose-container .alignleft,
  .prose-container .alignright {
    float: none !important;
    max-width: 100% !important;
    margin: 16px auto !important;
    display: block;
  }

  .editorial-title {
    font-size: 2.25rem;
  }

  .scroll-top-btn {
    right: 16px;
    bottom: 16px;
  }
}
/* --------------------------------------------------------------------------
   ÉDITEUR DE CONTENU — onglets Visuel / Texte
   La surface d'édition porte la classe .prose-container : ce que l'auteur voit
   pendant qu'il écrit est rendu par les styles mêmes du site public.
   -------------------------------------------------------------------------- */
.content-editor {
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-surface-elevated);
}

.content-editor-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 8px 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.content-editor-tab {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 9px 18px;
  min-height: 38px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.content-editor-tab:hover {
  background: var(--hover-wash);
  color: var(--text-primary);
}

.content-editor-tab.is-active {
  background: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-contrast);
}

.content-editor-tab:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: -2px;
}

.content-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 12px;
  background: var(--bg-surface-card);
  border-bottom: 1px solid var(--border-subtle);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 3px;
  padding-right: 10px;
  border-right: 1px solid var(--border-subtle);
}

.toolbar-group:last-child,
.toolbar-group-fin {
  border-right: none;
  padding-right: 0;
}

.toolbar-group-fin {
  margin-left: auto;
}

.toolbar-btn {
  min-width: 34px;
  height: 32px;
  padding: 0 9px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  cursor: pointer;
  line-height: 1;
}

.toolbar-btn:hover {
  background: var(--hover-wash-strong);
  border-color: var(--border-medium);
}

.toolbar-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
}

.toolbar-btn.is-active {
  background: var(--accent-teal);
  border-color: var(--accent-teal);
  color: var(--text-on-accent);
}

.toolbar-select {
  height: 32px;
  padding: 0 8px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  cursor: pointer;
  max-width: 220px;
}

.toolbar-color {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.toolbar-color input[type="color"] {
  width: 34px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-surface-elevated);
  cursor: pointer;
}

/* La surface hérite de .prose-container ; on lui retire seulement la colonne
   centrée de 980 px, qui n'a pas de sens dans un cadre d'édition. */
.content-editor-surface {
  max-width: none;
  margin: 0;
  min-height: 460px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 22px 26px;
  background: var(--bg-page);
  outline: none;
}

.content-editor-surface:focus-visible {
  box-shadow: inset 0 0 0 2px var(--border-focus);
}

/* Le contenu importé a été écrit pour le fond noir de l'ancien site : ce mode
   le rétablit pour la relecture. Il ne change rien à ce qui est enregistré. */
/* Les memes valeurs que le voile de lecture du site public, pour que
   l'apercu corresponde reellement a ce que verront les visiteurs. */
.content-editor-surface.fond-sombre {
  background-color: #0a0e10;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='0.16'/%3E%3C/svg%3E");
  color: #e8e6e1;
}

.content-editor-surface.fond-sombre a {
  border-bottom-color: #a8ef9d;
}

.content-editor-code {
  display: none;
  width: 100%;
  border: none;
  border-radius: 0;
  min-height: 460px;
}

.content-editor.mode-texte .content-editor-toolbar,
.content-editor.mode-texte .content-editor-surface {
  display: none;
}

.content-editor.mode-texte .content-editor-code {
  display: block;
}

.content-editor-note {
  margin: 0;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}

@media (max-width: 680px) {
  .toolbar-group {
    padding-right: 6px;
  }

  .toolbar-group-fin {
    margin-left: 0;
  }

  .content-editor-surface {
    padding: 16px;
    min-height: 340px;
  }
}
