/* règle source : fond bleu doux en mode clair, jamais blanc pur, jamais sombre */
/* ==========================================================
   Harmonisation Arbres-Dragon — correctif non destructif
   Corrige lisibilité, fonds mode clair, menu/logo global.
   ========================================================== */

:root {
  --rd-ref-bg-1: #d8effc;
  --rd-ref-bg-2: #c7e7f7;
  --rd-ref-bg-3: #eef9ff;
  --rd-ref-ink: #0f2436;
  --rd-ref-soft: #37566b;
  --rd-ref-muted: #67849a;
  --rd-ref-card: rgba(238, 249, 255, 0.94);
  --rd-ref-card-strong: rgba(255, 255, 255, 0.74);
  --rd-ref-border: rgba(47, 127, 168, 0.20);
  --rd-ref-blue: #2f7fa8;
  --rd-ref-blue-deep: #1f5f86;
  --rd-ref-gold: #d8b45d;
  --rd-ref-shadow: 0 26px 72px rgba(15, 55, 85, 0.15);
}

/* MODE CLAIR — priorité forte : jamais sombre, jamais blanc pur */
html[data-rd-effective-theme="light"],
body[data-rd-effective-theme="light"],
html[data-theme="light"],
body[data-theme="light"],
html.light,
body.light,
html.rd-theme-light,
body.rd-theme-light {
  --rd-ref-bg-1: #d8effc !important;
  --rd-ref-bg-2: #c7e7f7 !important;
  --rd-ref-bg-3: #eef9ff !important;
  --rd-ref-ink: #0f2436 !important;
  --rd-ref-soft: #37566b !important;
  --rd-ref-muted: #5d7b91 !important;
  --rd-ref-card: rgba(238, 249, 255, 0.96) !important;
  --rd-ref-card-strong: rgba(255, 255, 255, 0.78) !important;
  --rd-ref-border: rgba(47, 127, 168, 0.20) !important;
  --rd-ref-blue: #2f7fa8 !important;
  --rd-ref-blue-deep: #1f5f86 !important;
  --rd-ref-gold: #d8b45d !important;
  --rd-ref-shadow: 0 26px 72px rgba(15, 55, 85, 0.15) !important;
  --rd-medit-bg: #d8effc !important;
  --rd-medit-bg-2: #c7e7f7 !important;
  --rd-medit-card: rgba(238, 249, 255, 0.96) !important;
  --rd-medit-text: #0f2436 !important;
  --rd-medit-soft: #37566b !important;
}

/* MODE SOMBRE — bleu profond mais lisible */
html[data-rd-effective-theme="dark"],
body[data-rd-effective-theme="dark"],
html[data-theme="dark"],
body[data-theme="dark"],
html.dark,
body.dark,
html.rd-theme-dark,
body.rd-theme-dark {
  --rd-ref-bg-1: #07111f !important;
  --rd-ref-bg-2: #0b1728 !important;
  --rd-ref-bg-3: #10243a !important;
  --rd-ref-ink: #f8fafc !important;
  --rd-ref-soft: #dbeafe !important;
  --rd-ref-muted: #a9c3d8 !important;
  --rd-ref-card: rgba(10, 24, 42, 0.90) !important;
  --rd-ref-card-strong: rgba(255, 255, 255, 0.08) !important;
  --rd-ref-border: rgba(255, 255, 255, 0.14) !important;
  --rd-ref-blue: #4aa3d3 !important;
  --rd-ref-blue-deep: #1f5f86 !important;
  --rd-ref-gold: #e3c36b !important;
  --rd-ref-shadow: 0 28px 90px rgba(0, 0, 0, 0.34) !important;
}

/* Fond global méditation — identique à l’esprit arbres-dragon */
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style,
body[data-rd-effective-theme="light"].rd-reference-meditation-style,
html.light body.rd-reference-meditation-style,
body.light.rd-reference-meditation-style {
  background:
    radial-gradient(circle at 12% 0%, rgba(255,255,255,.72), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(255,255,255,.34), transparent 26%),
    linear-gradient(135deg, #d8effc, #c7e7f7 48%, #eef9ff) !important;
  color: #0f2436 !important;
}

html[data-rd-effective-theme="dark"] body.rd-reference-meditation-style,
body[data-rd-effective-theme="dark"].rd-reference-meditation-style,
html.dark body.rd-reference-meditation-style,
body.dark.rd-reference-meditation-style {
  background:
    radial-gradient(circle at 12% 0%, rgba(95, 170, 210, .16), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(216, 180, 93, .10), transparent 26%),
    linear-gradient(135deg, #07111f, #0b1728 48%, #10243a) !important;
  color: #f8fafc !important;
}

/* Lisibilité forcée en clair */
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style p,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style li,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style h1,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style h2,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style h3,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style .rd-summary,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style .rd-subtitle,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style .rd-badge,
body[data-rd-effective-theme="light"].rd-reference-meditation-style,
body[data-rd-effective-theme="light"].rd-reference-meditation-style p,
body[data-rd-effective-theme="light"].rd-reference-meditation-style li,
body[data-rd-effective-theme="light"].rd-reference-meditation-style h1,
body[data-rd-effective-theme="light"].rd-reference-meditation-style h2,
body[data-rd-effective-theme="light"].rd-reference-meditation-style h3,
body[data-rd-effective-theme="light"].rd-reference-meditation-style .rd-summary,
body[data-rd-effective-theme="light"].rd-reference-meditation-style .rd-subtitle,
body[data-rd-effective-theme="light"].rd-reference-meditation-style .rd-badge {
  color: #0f2436 !important;
  -webkit-text-fill-color: #0f2436 !important;
}

html[data-rd-effective-theme="light"] body.rd-reference-meditation-style .rd-subtitle,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style .rd-summary,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style small,
body[data-rd-effective-theme="light"].rd-reference-meditation-style .rd-subtitle,
body[data-rd-effective-theme="light"].rd-reference-meditation-style .rd-summary,
body[data-rd-effective-theme="light"].rd-reference-meditation-style small {
  color: #37566b !important;
  -webkit-text-fill-color: #37566b !important;
}

/* Cartes principales — même famille de couleur que la référence */
body.rd-reference-meditation-style .rd-hero,
body.rd-reference-meditation-style .rd-article,
body.rd-reference-meditation-style article,
body.rd-reference-meditation-style .rd-journal-block,
body.rd-reference-meditation-style #journal-personnel,
body.rd-reference-meditation-style .rd-documentaries-block,
body.rd-reference-meditation-style .rd-share-block {
  background:
    linear-gradient(135deg, rgba(255,255,255,.62), rgba(255,255,255,.22)),
    var(--rd-ref-card) !important;
  border: 1px solid var(--rd-ref-border) !important;
  box-shadow: var(--rd-ref-shadow) !important;
  color: var(--rd-ref-ink) !important;
}

html[data-rd-effective-theme="light"] body.rd-reference-meditation-style .rd-hero,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style .rd-article,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style article,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style .rd-journal-block,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style #journal-personnel,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style .rd-documentaries-block,
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style .rd-share-block {
  background:
    radial-gradient(circle at 8% 0%, rgba(255,255,255,.68), transparent 28%),
    linear-gradient(135deg, rgba(238,249,255,.98), rgba(222,242,252,.94)) !important;
}

/* Hero média : pas de bloc noir dur en mode clair */
html[data-rd-effective-theme="light"] body.rd-reference-meditation-style .rd-hero-media {
  background:
    radial-gradient(circle at 30% 18%, rgba(255,255,255,.42), transparent 36%),
    linear-gradient(135deg, #d7eefb, #b8dff2) !important;
}

html[data-rd-effective-theme="dark"] body.rd-reference-meditation-style .rd-hero-media {
  background:
    radial-gradient(circle at 30% 18%, rgba(255,255,255,.16), transparent 36%),
    linear-gradient(135deg, #07111f, #10243a) !important;
}

body.rd-reference-meditation-style .rd-hero-media img {
  object-fit: contain !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

/* Kicker, tags et navigation */
body.rd-reference-meditation-style .rd-kicker,
body.rd-reference-meditation-style .rd-catalog-date {
  color: var(--rd-ref-blue-deep) !important;
  -webkit-text-fill-color: var(--rd-ref-blue-deep) !important;
}

body.rd-reference-meditation-style .rd-badge,
body.rd-reference-meditation-style .rd-quick-nav a {
  background: rgba(47,127,168,.12) !important;
  border: 1px solid rgba(47,127,168,.20) !important;
  color: var(--rd-ref-soft) !important;
  -webkit-text-fill-color: var(--rd-ref-soft) !important;
}

body.rd-reference-meditation-style .rd-quick-nav a:hover {
  background: linear-gradient(135deg, var(--rd-ref-blue), var(--rd-ref-blue-deep)) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Citation intégrée */
body.rd-reference-meditation-style .rd-quote-illustration,
body.rd-reference-meditation-style blockquote {
  background:
    linear-gradient(135deg, rgba(255,255,255,.68), rgba(216,180,93,.16)) !important;
  border-left: 6px solid var(--rd-ref-gold) !important;
  color: var(--rd-ref-ink) !important;
  -webkit-text-fill-color: var(--rd-ref-ink) !important;
}

/* Documentaires lisibles */
body.rd-reference-meditation-style .rd-documentary-card {
  background:
    linear-gradient(135deg, rgba(47,127,168,.12), rgba(216,180,93,.10)) !important;
  border: 1px solid var(--rd-ref-border) !important;
  color: var(--rd-ref-ink) !important;
  -webkit-text-fill-color: var(--rd-ref-ink) !important;
}

body.rd-reference-meditation-style .rd-documentary-card span {
  color: var(--rd-ref-muted) !important;
  -webkit-text-fill-color: var(--rd-ref-muted) !important;
}

/* Boutons toujours blancs */
body.rd-reference-meditation-style .rd-button,
body.rd-reference-meditation-style .rd-share-actions a,
body.rd-reference-meditation-style .rd-share-actions button,
body.rd-reference-meditation-style .rd-journal-actions button,
body.rd-reference-meditation-style .rd-journal-prompts button {
  background: linear-gradient(135deg, var(--rd-ref-blue), var(--rd-ref-blue-deep)) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Menu premium : logo/pictogramme de secours */
.rd-site-menu-logo {
  position: relative !important;
  overflow: hidden !important;
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,.42), transparent 36%),
    linear-gradient(135deg, #2f7fa8, #1f5f86) !important;
}

.rd-site-menu-logo::before {
  content: "🕊️";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  z-index: 1;
}

.rd-site-menu-logo img {
  position: relative;
  z-index: 2;
  background: transparent;
}

.rd-site-menu-logo.rd-logo-fallback img,
.rd-site-menu-logo img.rd-logo-hidden {
  display: none !important;
}

.rd-site-menu-title strong,
.rd-site-menu-title span {
  -webkit-text-fill-color: currentColor !important;
}

html[data-rd-effective-theme="light"] .rd-site-menu-panel,
body[data-rd-effective-theme="light"] .rd-site-menu-panel {
  background:
    radial-gradient(circle at 15% 0%, rgba(255,255,255,.80), transparent 28%),
    rgba(232,247,255,.97) !important;
  color: #0f2436 !important;
}

html[data-rd-effective-theme="light"] .rd-site-menu-panel a,
html[data-rd-effective-theme="light"] .rd-site-menu-panel button,
body[data-rd-effective-theme="light"] .rd-site-menu-panel a,
body[data-rd-effective-theme="light"] .rd-site-menu-panel button {
  color: #0f2436 !important;
  -webkit-text-fill-color: #0f2436 !important;
}

html[data-rd-effective-theme="light"] .rd-site-menu-panel a:hover,
html[data-rd-effective-theme="light"] .rd-site-menu-panel button:hover,
body[data-rd-effective-theme="light"] .rd-site-menu-panel a:hover,
body[data-rd-effective-theme="light"] .rd-site-menu-panel button:hover {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Champ journal */
body.rd-reference-meditation-style #rd-journal-text {
  background: rgba(255,255,255,.62) !important;
  color: var(--rd-ref-ink) !important;
  -webkit-text-fill-color: var(--rd-ref-ink) !important;
  border: 1px solid var(--rd-ref-border) !important;
}

html[data-rd-effective-theme="dark"] body.rd-reference-meditation-style #rd-journal-text,
body[data-rd-effective-theme="dark"].rd-reference-meditation-style #rd-journal-text {
  background: rgba(255,255,255,.08) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Mobile */
@media (max-width: 820px) {
  body.rd-reference-meditation-style .rd-hero,
  body.rd-reference-meditation-style .rd-article,
  body.rd-reference-meditation-style article,
  body.rd-reference-meditation-style .rd-journal-block,
  body.rd-reference-meditation-style .rd-documentaries-block,
  body.rd-reference-meditation-style .rd-share-block {
    border-radius: 24px !important;
  }
}