:root {
  --page-bg: #ffffff;
  --surface-bg: #ffffff;
  --surface-bg-soft: #f0f0f0;
  --link-color: #0066cc;
  --focus-ring-color: #2f6df6;
}

html[data-theme="dark"] {
  --text-color: #e6ebf5;
  --light-bg: #171c26;
  --background-color: rgba(97, 111, 153, 0.2);
  --white: #11161f;
  --border-color: #2c3445;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --titre-color: #8fb6ff;
  --page-bg: #0b0f17;
  --surface-bg: #11161f;
  --surface-bg-soft: #171c26;
  --link-color: #89b4ff;
  --focus-ring-color: #89b4ff;
}

a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: 2px;
}

body {
  background: var(--page-bg);
  color: var(--text-color);
}

.theme-toggle {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.theme-toggle__track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #c9d0db;
  position: relative;
  transition: background-color 0.25s ease;
}

.theme-toggle__thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease;
}

.theme-toggle__label {
  font-weight: 600;
}

.theme-toggle[aria-checked="true"] .theme-toggle__track {
  background: #4d7cff;
}

.theme-toggle[aria-checked="true"] .theme-toggle__thumb {
  transform: translateX(20px);
}

html[data-theme="dark"] a {
  color: var(--link-color);
}

html[data-theme="dark"] header p {
  color: var(--text-color);
}

html[data-theme="dark"] .sidebar a {
  color: #fff;
}

.sidebar .sidebar-theme-toggle {
  margin: 10px auto 0;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
}

.sidebar .sidebar-theme-toggle .theme-toggle__track {
  background: rgba(255, 255, 255, 0.35);
}

.sidebar .sidebar-theme-toggle[aria-checked="true"] .theme-toggle__track {
  background: #4d7cff;
}

.sidebar {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}

.local-search {
  position: relative;
  min-width: 0;
}

.local-search__label {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.local-search__input {
  width: 100%;
  border: 1px solid var(--border-color);
  background: var(--surface-bg);
  color: var(--text-color);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

.local-search__results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 300px;
  overflow: auto;
  z-index: 1200;
}

.local-search__item {
  display: block;
  padding: 9px 10px;
  text-decoration: none;
  color: var(--text-color);
  border-bottom: 1px solid rgba(127, 127, 127, 0.2);
}

.local-search__item:last-child {
  border-bottom: 0;
}

.local-search__item:hover,
.local-search__item:focus-visible {
  background: var(--surface-bg-soft);
  outline: none;
}

.local-search__path {
  display: block;
  font-size: 11px;
  opacity: 0.75;
  margin-top: 2px;
}

.local-search__empty {
  padding: 10px;
  margin: 0;
  font-size: 14px;
}

.local-search--header {
  margin-left: 16px;
  width: min(260px, 26vw);
}

.local-search--header .local-search__label {
  display: none;
}

.local-search--navdrawer {
  width: calc(100% - 32px);
  margin: 12px 16px;
}

body.search-mobile-nav .containerHeader > .local-search--header {
  display: none !important;
}

.local-search--sidebar {
  width: calc(100% - 28px);
  margin: 12px 14px 0;
}

.local-search--sidebar .local-search__results {
  position: static;
  margin-top: 8px;
  max-height: 42vh;
}

.sidebar .local-search__label {
  color: #fff;
}

.sidebar .local-search__input {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.sidebar .local-search__input::placeholder {
  color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 1100px) {
  .local-search--header {
    width: min(210px, 23vw);
    margin-left: 12px;
  }
}

@media (max-width: 768px) {
  .local-search--header {
    margin-left: 10px;
    width: min(170px, 42vw);
  }

  .local-search__results {
    max-height: 44vh;
  }

  .nav .local-search--navdrawer {
    display: none;
  }

  .nav.active .local-search--navdrawer {
    display: block;
  }

  .local-search--navdrawer .local-search__results {
    position: static;
    margin-top: 8px;
    max-height: 42vh;
  }
}

/* Garder les composants "menu" lisibles sans modifier l'identité visuelle des cartes */
html[data-theme="dark"] .submenu {
  background-color: var(--surface-bg);
  border-color: var(--border-color);
}

html[data-theme="dark"] #toggleLink {
  color: var(--link-color);
  background: var(--surface-bg-soft);
}

html[data-theme="dark"] #toggleLink:hover,
html[data-theme="dark"] .submenu a:hover,
html[data-theme="dark"] .nav-list a:hover,
html[data-theme="dark"] .checkbox-label:hover {
  background: #212838;
}

/* Evite le noir sur noir pour les composants "carte" avec texte forcé sombre */
html[data-theme="dark"] .carte,
html[data-theme="dark"] .carte p,
html[data-theme="dark"] .carte li,
html[data-theme="dark"] .etiquette,
html[data-theme="dark"] .etiquette div {
  color: var(--text-color);
}

/* Correctif ciblé Cadre et défis -> section "Vers une dette cognitive" */
html[data-theme="dark"] #dette .containerChiffre .carte {
  background-color: rgba(164, 179, 221, 0.2);
  border: 1px solid rgba(164, 179, 221, 0.35);
}

html[data-theme="dark"] #dette .containerChiffre .carte  .chiffre p {
  color: var(--text-color);
}

html[data-theme="dark"] .containerNav,
html[data-theme="dark"] footer {
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .containerNav a, .containerNav .titreNav, .construction, .h5p p, .rmqDys p, .truc p {
  color: var(--text-color);
}

html[data-theme="dark"] .navigationPage a::after {
  background: linear-gradient(90deg, transparent, #ffffff, transparent);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}
html[data-theme="dark"] .cardContent, .pilierContent {
  background-color: var(--surface-bg);
}

html[data-theme="dark"] .exemple, .box {
  background-color: var(--surface-bg-soft);
  border : 1px solid rgba(164, 179, 221, 0.35);
}

html[data-theme="dark"] .compIA{
  background-color: rgb(215, 215, 245);
}

html[data-theme="dark"] .containerIconTexte{
  color:var(--white);
}








html[data-theme="dark"] .prompt-output, .subtitle{
  color:var(--white);
}
html[data-theme="dark"] .subtitle{
  color:var(--white);
}

html[data-theme="dark"] .veille-encart-footer a{
  color:#ffffff;
}


/* ===== BEGIN THEME-SYNC: MYTHES REALITE ===== */
html[data-theme="dark"] {
  --mythe: #1f2740;
  --mythe-accent: #ff6b74;
  --realite: #144232;
  --realite-accent: #4fe27a;
  --cream: #0f1522;
  --text-dark: #e6ebf5;
  --page-bg: #0b0f17;
  --muted-text: #b9c4d6;
  --nav-grad-1: #213a66;
  --nav-grad-2: #182640;
  --chip-bg: #213253;
  --chip-text: #e6ebf5;
}

html[data-theme="dark"] body::before {
  opacity: 0.22;
}

html[data-theme="dark"] .navigationPage a {
  background: rgba(102, 154, 255, 0.2);
  border-color: rgba(206, 224, 255, 0.3);
}

html[data-theme="dark"] .navigationPage a:hover {
  background: rgba(124, 171, 255, 0.28);
}

html[data-theme="dark"] .card-front::after {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .card-source {
  opacity: 0.62;
}
/* ===== END THEME-SYNC: MYTHES REALITE ===== */
