/*
Theme Name: CDAD Mayotte — Divi Child
Theme URI: https://cdad-mayotte.fr
Description: Thème enfant Divi pour le site du CDAD de Mayotte.
Author: CDAD Mayotte
Template: Divi
Version: 1.2.0
Text Domain: cdad-divi-child
License: GNU General Public License v2 or later
*/

/*
 * Institutional header and footer, taken from the approved mockup
 * (CDAD Mayotte.png). These load on every page; the homepage layout itself is
 * styled by assets/css/home.css.
 */

:root {
  --cdad-navy: #041b62;
  --cdad-navy-deep: #00164f;
  --cdad-teal: #007d8f;
  --cdad-sky: #eef7ff;
  --cdad-ink: #071d62;
  --cdad-border: #d7e2f1;
  --cdad-white: #fff;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.cdad-header {
  background: var(--cdad-white);
}

/*
 * L'en-tête suit la maquette OpenDesign (opendesign/cdad-homepage) : bloc
 * identité de 140 px, barre de navigation de 45 px, soit 185 px au total, et
 * une largeur pleine fenêtre à 20 px des bords, indépendante de la largeur de
 * contenu (comme la maquette).
 */
.cdad-header__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 26px;
  width: calc(100% - 40px);
  min-height: 135px;
  margin-inline: auto;
  padding-block: 18px 15px;
}

/*
 * Divi applique `p { padding-bottom: 1em }` à tous les paragraphes. Sous le nom
 * du site, cela ajoutait 44 px (1em à 44 px) : le bloc identité passait de 102
 * à 146 px et l'en-tête entier de 185 à 219 px. Les paragraphes de l'en-tête et
 * du pied de page n'ont pas de respiration à porter : leurs marges sont réglées
 * ici, élément par élément.
 */
.cdad-header p,
.cdad-footer p {
  padding-bottom: 0;
}

/*
 * Identité : la pastille Point Justice occupe la place de l'ancienne Marianne,
 * le logo CDAD celle du nom du site — son mot-symbole porte déjà « CDAD
 * Mayotte » et « Conseil départemental de l'accès au droit ».
 *
 * Les trois colonnes se serrent à gauche (`justify-content: start`) : pastille,
 * filet, logo CDAD, sans étirement. Avec des colonnes `auto` sans
 * `justify-content`, l'espace libre se répartissait dans les colonnes et le
 * filet s'éloignait du logo quand la fenêtre s'élargissait.
 */
.cdad-identity {
  display: grid;
  grid-template-columns: auto 1px auto;
  align-items: center;
  justify-content: start;
  gap: 26px;
  min-width: 0;
}

.cdad-identity__badge,
.cdad-identity__brand {
  display: block;
  line-height: 0;
}

.cdad-identity__logo {
  display: block;
  width: auto;
  height: 76px;
}

.cdad-identity__separator {
  width: 1px;
  height: 99px;
  background: #364da1;
}

.cdad-phone {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 265px;
}

.cdad-phone__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border: 1.8px solid var(--cdad-navy);
  border-radius: 50%;
}

.cdad-phone__icon svg {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  fill: var(--cdad-navy);
}

.cdad-phone__number {
  display: block;
  margin-top: -3px;
  color: #006b7c;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 33px;
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none;
}

.cdad-phone p {
  margin: 5px 0 0;
  color: var(--cdad-ink);
  font-size: 14px;
  line-height: 1.35;
}

.cdad-phone strong {
  font-weight: 500;
  color: var(--cdad-navy);
}

/* Navigation */

.cdad-nav {
  position: relative;
  z-index: 20;
  color: var(--cdad-white);
  background: var(--cdad-navy-deep);
}

.cdad-nav__inner {
  display: flex;
  align-items: stretch;
  width: calc(100% - 40px);
  min-height: 45px;
  margin-inline: auto;
}

.cdad-nav__home {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 51px;
  background: var(--cdad-teal);
}

.cdad-nav__home svg {
  width: 24px;
  height: 24px;
  fill: var(--cdad-white);
}

.cdad-nav__list {
  display: flex;
  flex: 1;
  margin: 0;
  padding: 0;
  list-style: none;
}

/*
 * Divi applique à tout `ul` de l'en-tête la règle
 * `.et-l--header ul { padding: 0 0 23px 1em; line-height: 26px }`, plus
 * spécifique (classe + élément) que la règle `.cdad-nav__list` ci-dessus : le
 * `padding: 0` était donc ignoré. Les 23 px de padding bas agrandissaient la
 * barre et collaient le texte des liens en haut, alors que les icônes d'accueil
 * et de recherche restaient centrées. Ce sélecteur ne neutralise que les
 * propriétés concernées : les règles du menu mobile, plus bas, gardent la main
 * sur la position et l'affichage de la liste.
 */
.cdad-nav ul.cdad-nav__list {
  padding: 0;
  line-height: 1.2;
  list-style: none;
}

.cdad-nav__list li {
  display: flex;
  flex: 1;
}

.cdad-nav__list a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 14px;
  color: var(--cdad-white);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .065em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.cdad-nav__list a:hover,
.cdad-nav__list a:focus-visible {
  background: rgba(255, 255, 255, .1);
}

/*
 * « Prendre rendez-vous » est l'appel à l'action principal du menu. Il reprend
 * le dégradé turquoise de la maquette (qui marquait alors l'entrée « Contact »)
 * et pousse la graisse d'un cran pour se détacher des autres entrées. La
 * classe `cdad-nav__cta` est posée sur l'entrée de menu (le `li`, voir
 * Apparence → Menus) : le fond va donc sur le `li`, la typographie sur le lien,
 * car `.cdad-nav__list a` impose déjà sa graisse et son interlettrage.
 */
.cdad-nav__list .cdad-nav__cta {
  background: linear-gradient(90deg, #007082, #008b9a);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .26);
}

.cdad-nav__list .cdad-nav__cta a {
  font-weight: 800;
  letter-spacing: .075em;
}

.cdad-nav__list .cdad-nav__cta:hover,
.cdad-nav__list .cdad-nav__cta:focus-within {
  background: linear-gradient(90deg, #005d6c, #007f8d);
}

.cdad-nav__toggle {
  display: none;
  flex: 1;
  border: 0;
  color: var(--cdad-white);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .065em;
  text-transform: uppercase;
  cursor: pointer;
}

.cdad-nav__search {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 66px;
  border: 0;
  color: var(--cdad-white);
  background: transparent;
  cursor: pointer;
}

.cdad-nav__search svg {
  width: 25px;
  height: 25px;
  fill: var(--cdad-white);
}

.cdad-search {
  width: min(100% - 32px, 1200px);
  margin-inline: auto;
  padding: 14px 0 18px;
}

.cdad-search label {
  display: block;
  margin-bottom: 6px;
  color: var(--cdad-white);
  font-weight: 700;
}

.cdad-search div {
  display: flex;
}

.cdad-search input {
  flex: 1;
  min-height: 44px;
  border: 0;
  padding: 0 14px;
}

.cdad-search button {
  border: 0;
  padding-inline: 20px;
  color: var(--cdad-white);
  background: var(--cdad-teal);
  font-weight: 700;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.cdad-footer {
  color: var(--cdad-white);
  background: linear-gradient(115deg, #00144f 0%, #06296f 58%, #00124b 100%);
}

/* Comme l'en-tête, le pied de page occupe toute la fenêtre avec 20 px de marge
   de chaque côté : les deux bandeaux s'alignent d'un bord à l'autre.
   Trois blocs seulement : identité, plan du site, partenaires. */
.cdad-footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.15fr;
  gap: 40px;
  width: calc(100% - 40px);
  margin-inline: auto;
  padding-block: 26px 16px;
}

.cdad-footer__grid h2 {
  margin: 0 0 8px;
  color: var(--cdad-white);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .065em;
  text-transform: uppercase;
}

.cdad-footer__grid ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cdad-footer__grid li {
  margin: 2px 0;
  line-height: 1.35;
}

.cdad-footer__grid li a {
  color: var(--cdad-white);
  font-size: 11.5px;
  text-decoration: none;
}

.cdad-footer__grid li a::before {
  content: "› ";
}

.cdad-footer__grid a:hover,
.cdad-footer__grid a:focus-visible {
  text-decoration: underline;
}

/*
 * Le logo du pied de page est un fichier bleu sur blanc : il lui faut une
 * pastille claire pour rester lisible sur le fond marine.
 */
.cdad-footer__logo {
  display: inline-block;
  padding: 8px 11px;
  border-radius: 6px;
  background: var(--cdad-white);
}

.cdad-footer__logo img {
  display: block;
  width: 178px;
  height: auto;
}

.cdad-footer__about p {
  margin: 14px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
}

.cdad-footer__about a {
  color: var(--cdad-white);
  text-decoration: none;
}

.cdad-footer__about a:hover,
.cdad-footer__about a:focus-visible {
  text-decoration: underline;
}

.cdad-footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: calc(100% - 40px);
  min-height: 40px;
  margin-inline: auto;
  padding-block: 10px;
  border-top: 1px solid rgba(255, 255, 255, .2);
}

.cdad-footer__bottom p {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
}

.cdad-footer__bottom a {
  color: var(--cdad-white);
  text-decoration: none;
}

.cdad-footer__bottom a:hover,
.cdad-footer__bottom a:focus-visible {
  text-decoration: underline;
}

/*
 * Divi ships aggressive global rules for inline SVG (it stretches them to fill
 * their container). Icon dimensions therefore have to win explicitly.
 */
.cdad-header svg,
.cdad-footer svg {
  width: 1em;
  height: 1em;
  max-width: 100%;
  flex: 0 0 auto;
}

/* Le sélecteur `svg` ci-dessus vise toutes les icônes : les tailles réelles de
   la maquette doivent donc repasser avec la même force. */
.cdad-phone__icon svg {
  width: 30px !important;
  height: 30px !important;
  fill: var(--cdad-navy);
}

.cdad-nav__home svg {
  width: 24px !important;
  height: 24px !important;
  fill: var(--cdad-white);
}

.cdad-nav__search svg {
  width: 25px !important;
  height: 25px !important;
  fill: var(--cdad-white);
}

/* --------------------------------------------------------------------------
   Skip link
   -------------------------------------------------------------------------- */

.skip-link {
  position: fixed;
  z-index: 9999;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  padding: 10px 14px;
  color: var(--cdad-white);
  background: var(--cdad-navy);
  border-radius: 6px;
}

.skip-link:focus {
  transform: none;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/*
 * Sous 1 070 px, la barre de menu se resserre : les intitulés passent en 11 px
 * et les deux icônes réduisent. La barre étant pleine largeur (100 % − 40 px),
 * les cinq entrées en 13 px réclament 1 069 px ; sans cette compression elles
 * débordent et poussent la loupe hors de l'écran.
 * Le bloc identité descend lui aussi d'un cran. La hauteur des logos suit
 * `clamp()` : figée à 46 px, elle ne laisserait plus assez de place au nom
 * entre 880 et 930 px, où la marque encadrée par deux logos manque de largeur.
 */
@media (max-width: 1070px) {
  .cdad-nav__list a {
    font-size: 11px;
    padding-inline: 8px;
  }

  .cdad-nav__home {
    width: 44px;
  }

  .cdad-nav__search {
    width: 52px;
  }

  .cdad-identity {
    gap: 18px;
  }

  .cdad-identity__logo {
    height: 62px;
  }

  .cdad-identity__separator {
    height: 82px;
  }

  .cdad-phone {
    min-width: 205px;
  }

  .cdad-phone__icon {
    width: 44px;
    height: 44px;
  }

  .cdad-phone__number {
    font-size: 29px;
  }

  .cdad-phone p {
    font-size: 12px;
  }
}

/*
 * Sous 980 px, le pied de page passe sur deux colonnes et son bandeau du bas est
 * centré. L'en-tête, lui, reste sur une seule ligne jusqu'à 880 px, comme la
 * maquette : il empilait dès 980 px et grimpait à 276 px en 1024 × 768.
 */
@media (max-width: 980px) {
  .cdad-footer__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
  }

  .cdad-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/*
 * Sous 880 px, le menu passe en panneau déroulant — la maquette bascule à
 * 820 px, mais même en 11 px les cinq intitulés ne tiennent plus dans la barre
 * à côté de l'accueil et de la loupe — et l'en-tête s'empile : le téléphone
 * occupe sa propre ligne, séparé par un filet clair.
 */
@media (max-width: 880px) {
  .cdad-nav__toggle {
    display: block;
  }

  .cdad-nav__list {
    position: absolute;
    top: 45px;
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    background: var(--cdad-navy-deep);
    box-shadow: 0 6px 18px rgba(9, 35, 92, .18);
  }

  .cdad-nav__list.is-open {
    display: flex;
  }

  .cdad-nav__list li,
  .cdad-nav__list a {
    min-height: 48px;
  }

  /* Dans le panneau déroulant, la place ne manque pas : on rend aux intitulés
     leur taille de lecture, que la compression de la barre avait réduite. */
  .cdad-nav__list a {
    justify-content: flex-start;
    padding-inline: 20px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: 13px;
  }

  .cdad-nav__search {
    width: 48px;
  }

  .cdad-header__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding-block: 12px;
  }

  .cdad-identity {
    gap: 16px;
  }

  .cdad-identity__logo {
    height: 52px;
  }

  .cdad-identity__separator {
    height: 69px;
  }

  .cdad-phone {
    width: 100%;
    min-width: 0;
    border-top: 1px solid var(--cdad-border);
    padding-top: 9px;
  }

  .cdad-phone__icon {
    width: 37px;
    height: 37px;
  }

  .cdad-phone__number {
    font-size: 26px;
  }

  .cdad-phone p {
    font-size: 11px;
  }

  .cdad-footer__grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/*
 * Sous 640 px, la barre de navigation passe en burger et les deux logos
 * réduisent encore : Point Justice 40 px et le mot-symbole CDAD dans la même
 * hauteur, filet raccourci à leur mesure.
 */
@media (max-width: 640px) {
  .cdad-identity {
    gap: 12px;
  }

  .cdad-identity__logo {
    height: 40px;
  }

  .cdad-identity__separator {
    height: 54px;
  }
}
