/* En-tete de viepriveemondroit.com — extrait de shared/components/header-viepriveemondroit.html
   le 2026-09-27, pour etre servi comme feuille statique au lieu d'un bloc
   <style> injecte par JavaScript.

   Le composant HTML reste la source pour les pages statiques des outils, qui
   ne peuvent pas faire d'inclusion cote serveur. tests/test_site_chrome.py
   compare les deux : memes liens, memes classes.
*/

/* ---------------------------------------------------------------------------
   Jetons propres a l'en-tete.

   Ces trois etaient consommes avec des replis **codes en dur pour le mode
   sombre** : #1e293b (slate-800), un lisere blanc a 12 %, une ombre noire a 40 %.
   Et ils n'etaient definis **nulle part** — verifie dans tout le depot. Le menu
   deroulant apparaissait donc sombre sur une page claire.

   Ils vivent ici, avec l'en-tete, parce que l'en-tete les porte partout : pages
   Wagtail, pages statiques des outils, domaines co-heberges. Ailleurs, personne
   ne les definit.

   Les quatre mecanismes de bascule du projet sont couverts : la classe `dark`,
   la classe `dark-mode`, l'attribut `data-theme`, et la preference systeme.
--------------------------------------------------------------------------- */
:root {
  --bg-dropdown: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --shadow-dropdown: 0 8px 24px rgba(0, 0, 0, 0.12);
  --dropdown-link: #0b1730;
  --dropdown-link-hover: #0369a1;
  --dropdown-hover-bg: rgba(3, 105, 161, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-dropdown: #1e293b;
    --border-subtle: rgba(255, 255, 255, 0.12);
    --shadow-dropdown: 0 8px 24px rgba(0, 0, 0, 0.4);
    --dropdown-link: #dbeafe;
    --dropdown-link-hover: #ffffff;
    --dropdown-hover-bg: rgba(255, 255, 255, 0.1);
  }
}

html.dark,
html.dark-mode,
html[data-theme="dark"] {
  --bg-dropdown: #1e293b;
  --border-subtle: rgba(255, 255, 255, 0.12);
  --shadow-dropdown: 0 8px 24px rgba(0, 0, 0, 0.4);
  --dropdown-link: #dbeafe;
  --dropdown-link-hover: #ffffff;
  --dropdown-hover-bg: rgba(255, 255, 255, 0.1);
}

/* Le choix explicite du visiteur l'emporte sur la preference systeme. */
html[data-theme="light"] {
  --bg-dropdown: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --shadow-dropdown: 0 8px 24px rgba(0, 0, 0, 0.12);
  --dropdown-link: #0b1730;
  --dropdown-link-hover: #0369a1;
  --dropdown-hover-bg: rgba(3, 105, 161, 0.08);
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--site-primary, #0369a1);
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  border-radius: 0 0 0.25rem 0;
  z-index: 1001;
}

.skip-link:focus {
  top: 0;
}

/* Header styles */
.header-vpm {
  background: linear-gradient(135deg, var(--brand-gradient-start, #0a4f8f) 0%, var(--brand-gradient-end, #0b1730) 100%);
  padding: 0.75rem 0;
  color: white;
  border-bottom: 1px solid var(--overlay-white-10, rgba(255, 255, 255, 0.1));
  box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
}

.header-vpm__container {
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-xl);
}

.header-vpm__brand {
  font-size: var(--text-lg, 1.125rem);
  font-weight: var(--font-semibold, 600);
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-shrink: 0;
  transition: color 0.2s;
}

.header-vpm__brand:hover {
  color: var(--brand-on-gradient, #dbeafe);
  text-decoration: none;
}

.header-vpm__brand-meta {
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--font-normal, 400);
  color: var(--brand-on-gradient, #dbeafe);
  margin-left: var(--spacing-sm, 0.5rem);
}

.header-vpm__brand-meta--hidden {
  display: none;
}

.header-vpm__nav {
  display: flex;
  gap: var(--spacing-xs);
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
  flex-grow: 1;
  justify-content: flex-end;
}

.header-vpm__nav-item {
  margin: 0;
  position: relative;
}

.header-vpm__nav-link {
  color: var(--brand-on-gradient, #dbeafe);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  border-radius: var(--radius-lg);
  border-bottom: none;
}

.header-vpm__nav-link:hover {
  color: white;
  background: var(--overlay-white-10, rgba(255, 255, 255, 0.1));
  text-decoration: none;
}

.header-vpm__nav-link.active {
  color: white;
  background: var(--overlay-white-15, rgba(255, 255, 255, 0.15));
  text-decoration: none;
}

.header-vpm__nav-link:focus-visible,
.header-vpm__dropdown-link:focus-visible,
.header-vpm__brand:focus-visible,
.header-vpm__menu-btn:focus-visible {
  outline: 2px solid var(--overlay-white-90, rgba(255, 255, 255, 0.9));
  outline-offset: 2px;
}

/* Dropdown trigger */
.header-vpm__dropdown-trigger {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.header-vpm__dropdown-arrow {
  font-size: var(--text-xs);
  transition: transform 0.2s ease;
  line-height: var(--leading-none);
}

.header-vpm__dropdown-trigger[aria-expanded="true"] .header-vpm__dropdown-arrow {
  transform: rotate(180deg);
}

/* Dropdown menu */
.header-vpm__dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg-dropdown, #1e293b);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-lg);
  padding: var(--spacing-xs);
  list-style: none;
  margin: 0;
  min-width: 11rem;
  z-index: 200;
  box-shadow: var(--shadow-dropdown, 0 8px 24px rgba(0, 0, 0, 0.4));
}

.header-vpm__dropdown-menu.is-open {
  display: block;
}

.header-vpm__dropdown-link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--dropdown-link, #dbeafe);
  text-decoration: none;
  font-size: var(--text-sm);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.header-vpm__dropdown-link:hover,
.header-vpm__dropdown-link.active {
  color: var(--dropdown-link-hover, #ffffff);
  background: var(--dropdown-hover-bg, rgba(255, 255, 255, 0.1));
  text-decoration: none;
}

.header-vpm__dropdown-link.active {
  font-weight: 500;
}

/* Controls area (toggles + menu button) */
.header-vpm__controls {
  display: flex;
  gap: var(--spacing-sm-md);
  align-items: center;
  flex-shrink: 0;
}

/* Language/theme toggle buttons */
.header-vpm__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.4rem 0.75rem;
  background: var(--overlay-white-10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--overlay-white-25);
  border-radius: 2rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  min-height: 2.5rem;
  min-width: 2.5rem;
  justify-content: center;
}

.header-vpm__toggle:hover {
  background-color: var(--overlay-white-20);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.header-vpm__toggle:active {
  transform: translateY(0);
  background-color: var(--overlay-white-25);
}

.header-vpm__toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

.header-vpm__toggle-icon,
.header-vpm__toggle-label {
  font-size: var(--text-base);
  line-height: var(--leading-none);
}

/* Theme toggle: pill with rotating SVG icon */
#theme-toggle {
  width: 2.5rem;
  padding: var(--spacing-sm);
}

#theme-toggle .header-vpm__toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#theme-toggle:hover .header-vpm__toggle-icon {
  transform: rotate(20deg) scale(1.15);
}

/* Mobile menu button */
.header-vpm__menu-btn {
  display: none;
  background: var(--overlay-white-10);
  border: 1px solid var(--overlay-white-20);
  border-radius: var(--radius-lg);
  padding: 0 0.75rem;
  min-height: 2.5rem;
  min-width: 2.5rem;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  font-size: var(--text-xl);
  line-height: var(--leading-none);
  transition: background 0.2s;
}

.header-vpm__menu-btn:hover {
  background: var(--overlay-white-15);
}

/* Responsive styles */
@media (max-width: 768px) {
  .header-vpm__container {
    flex-wrap: wrap;
  }

  .header-vpm__nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    order: 4;
    background: var(--overlay-black-20);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xs);
    margin-top: var(--spacing-sm-md);
  }

  .header-vpm__nav.is-open {
    display: flex;
  }

  .header-vpm__container {
    gap: var(--spacing-sm);
  }

  .header-vpm__brand {
    flex: 1 1 0;
    min-width: 0;
    line-height: var(--leading-tight, 1.25);
  }

  .header-vpm__controls {
    gap: var(--spacing-sm);
  }

  .header-vpm__nav-item {
    width: 100%;
  }

  .header-vpm__nav-link {
    padding: 0.75rem 1rem;
    width: 100%;
    justify-content: flex-start;
  }

  .header-vpm__dropdown-link {
    color: var(--brand-on-gradient, #dbeafe);
  }

  .header-vpm__dropdown-link:hover,
  .header-vpm__dropdown-link.active {
    color: white;
    background: var(--overlay-white-10, rgba(255, 255, 255, 0.1));
  }

  .header-vpm__nav-link:hover,
  .header-vpm__nav-link.active {
    background: var(--overlay-white-10);
  }

  /* Mobile dropdown: inline expansion */
  .header-vpm__dropdown-trigger {
    width: 100%;
    text-align: left;
    justify-content: space-between;
  }

  .header-vpm__dropdown-menu {
    position: static;
    display: none;
    flex-direction: column;
    background: var(--overlay-black-25);
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    min-width: 0;
    width: 100%;
  }

  .header-vpm__dropdown-menu.is-open {
    display: flex;
  }

  .header-vpm__dropdown-link {
    padding: 0.625rem 1.5rem;
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
  }

  .header-vpm__menu-btn {
    display: inline-flex;
  }

  .header-vpm__brand {
    font-size: var(--text-base);
  }

  .header-vpm__brand-meta {
    display: none;
  }

  .header-vpm__toggle-label {
    display: none;
  }
}

@media (max-width: 480px) {
  .header-vpm__container {
    padding: 0 1rem;
  }

  select.header-vpm__toggle {
    padding-left: var(--spacing-sm);
    padding-right: var(--spacing-xl);
    background-position: right 0.5rem center;
  }
}

/* Selecteur de langue : un <select> habille comme les autres boutons, avec son propre chevron. */
select.header-vpm__toggle {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-family: inherit;
  padding-right: var(--spacing-xl);
  text-align: left;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.75rem;
}

select.header-vpm__toggle option {
  color: var(--dropdown-link);
  background: var(--bg-dropdown);
}

/* Mouvement reduit : pas de deplacement au survol. */
@media (prefers-reduced-motion: reduce) {
  .header-vpm__toggle,
  #theme-toggle .header-vpm__toggle-icon,
  .header-vpm__dropdown-arrow {
    transition: none;
  }

  .header-vpm__toggle:hover,
  #theme-toggle:hover .header-vpm__toggle-icon {
    transform: none;
  }
}
