/* BASE */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #ececec;
  color: #202020;
  font-family: Arial, sans-serif;
}

button,
input {
  font: inherit;
}

:focus-visible {
  outline: 2px solid #737783;
  outline-offset: 4px;
}

.visuellement-cache {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}


/* RETOUR, RECHERCHE ET LOGO */

.entete-organisations {
  display: grid;
  grid-template-columns: 160px minmax(0, 1280px) 160px;
  justify-content: space-between;
  align-items: start;
  gap: 32px;
  padding: 24px 16px 0;
}

.bouton-verre {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;

  min-height: 52px;
  padding: 14px 24px;

  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;

  background: rgba(20, 20, 20, 0.62);
  color: #ffffff;

  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;

  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);

  transition: background-color 0.25s ease;
}

.bouton-verre:hover {
  background: rgba(20, 20, 20, 0.76);
}

.retour-organisations {
  min-height: 64px;
  margin-top: 12px;
  font-size: 18px;
}

.retour-organisations span {
  font-size: 26px;
  font-weight: 400;
}

.logo-organisations {
  display: block;
  justify-self: end;
  width: 90px;
}

.logo-organisations img {
  display: block;
  width: 100%;
  height: auto;
}


/* RECHERCHE */

.recherche-organisations {
  min-width: 0;
  padding-top: 20px;
}

.recherche-organisations label {
  display: block;
  margin: 0 0 14px 18px;

  color: #393c43;
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: 2px;
}

.champ-recherche {
  display: flex;
  align-items: center;
  gap: 16px;

  min-height: 88px;
  padding: 0 26px;

  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #dedee3;
  border-radius: 24px;

  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

.champ-recherche:focus-within {
  border-color: #737783;
}

.champ-recherche svg {
  flex-shrink: 0;
  width: 26px;
  height: 26px;

  fill: none;
  stroke: #737783;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.champ-recherche input {
  width: 100%;
  min-width: 0;
  padding: 0;

  border: 0;
  outline: 0;
  background: transparent;

  color: #202020;
  font-size: 19px;
}

.champ-recherche input::placeholder {
  color: #8a8f99;
}

.recherche-bas {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;

  margin-top: 18px;
}

#resultats-organisations {
  margin: 0 0 0 18px;
  color: #737783;
  font-size: 13px;
}


/* CATÉGORIES */

.filtres-organisations {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

.filtre-categorie[aria-pressed="true"] {
  background: #ffffff;
  color: #151515;
  border-color: #d0d0d0;
}


/* GRANDES FICHES */

.liste-organisations {
  display: grid;
  gap: 80px;
  margin-top: 56px;
  padding: 0 2% 100px;
}

.fiche-organisation {
  position: relative;
  isolation: isolate;

  display: flex;
  align-items: center;

  min-height: clamp(480px, 42vw, 800px);
  padding: clamp(30px, 4vw, 72px);

  overflow: hidden;
  border-radius: 32px;
  background: #151515;
  color: #ffffff;

  box-shadow:
    0 15px 35px rgba(0, 0, 0, 0.25),
    0 35px 80px rgba(0, 0, 0, 0.18);
}

.organisation-image {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;
  object-fit: cover;

  transition: transform 0.8s ease;
}

.fiche-organisation::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;

  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.78) 0%,
    rgba(0, 0, 0, 0.38) 55%,
    rgba(0, 0, 0, 0.08) 100%
  );

  pointer-events: none;
}

.organisation-categorie {
  position: absolute;
  top: 35px;
  left: 40px;
  z-index: 2;

  margin: 0;
  color: #dddddd;
  font-size: 12px;
  letter-spacing: 3px;
}

.organisation-contenu {
  position: relative;
  z-index: 2;
  width: 100%;
}

.organisation-titre {
  max-width: 1100px;
  margin: 0 0 22px;

  font-size: clamp(40px, 5vw, 90px);
  font-weight: 800;
  line-height: 1.05;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.organisation-description {
  max-width: 550px;
  margin: 0;

  color: #eeeeee;
  font-size: 16px;
  line-height: 1.8;
}

@media (hover: hover) {
  .fiche-organisation:hover .organisation-image {
    transform: scale(1.04);
  }
}


/* TABLETTES ET TÉLÉPHONES */

@media (max-width: 900px) {
  .entete-organisations {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .retour-organisations {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    margin-top: 0;
  }

  .logo-organisations {
    grid-column: 2;
    grid-row: 1;
    width: 90px;
  }

  .recherche-organisations {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-top: 0;
  }
}

@media (max-width: 600px) {
  .retour-organisations {
    min-height: 52px;
    padding: 12px 22px;
    font-size: 15px;
  }

  .champ-recherche {
    min-height: 70px;
    padding: 0 18px;
    border-radius: 20px;
  }

  .champ-recherche input {
    font-size: 16px;
  }

  .filtres-organisations {
    width: 100%;
    margin-left: 0;
  }

  .liste-organisations {
    gap: 45px;
    margin-top: 40px;
  }

  .fiche-organisation {
    padding: 30px;
    border-radius: 22px;
  }

  .organisation-categorie {
    top: 26px;
    left: 30px;
  }

  .organisation-titre {
    font-size: clamp(32px, 8vw, 50px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .organisation-image,
  .bouton-verre {
    transition: none;
  }
}





.fiche-organisation[hidden],
#aucun-resultat-organisations[hidden] {
  display: none !important;
}

.aucun-resultat {
  margin: 0;
  padding: 48px 24px;

  color: #737783;
  font-size: 17px;
  line-height: 1.6;
  text-align: center;
}



/* BARRE DU MODE MODIFICATION */

.outils-organisations {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;

  margin: 28px 2% 0;
}

.liste-organisations {
  margin-top: 28px;
}

#ajouter-organisation[hidden],
#erreur-organisation[hidden] {
  display: none !important;
}

#mode-organisations[aria-pressed="true"],
#formulaire-organisation button[type="submit"] {
  background: #ffffff;
  color: #151515;
  border-color: #ffffff;
}


/* FENÊTRE DU FORMULAIRE */

.fenetre-organisation {
  width: min(600px, calc(100% - 32px));
  max-height: calc(100svh - 40px);

  padding: 32px;
  overflow: auto;

  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;

  background:
    radial-gradient(
      circle at top left,
      rgba(255, 255, 255, 0.07),
      transparent 65%
    ),
    #0f0f0f;

  color: #ffffff;

  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
}

.fenetre-organisation::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
}

#formulaire-organisation {
  display: grid;
  gap: 22px;
}

#formulaire-organisation h2 {
  margin: 0 0 6px;
  font-size: 26px;
}

#formulaire-organisation label {
  display: grid;
  gap: 10px;

  font-size: 14px;
  font-weight: 700;
}

#formulaire-organisation input,
#formulaire-organisation select,
#formulaire-organisation textarea {
  width: 100%;
  min-width: 0;
  padding: 14px 16px;

  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;

  background: #171717;
  color: #ffffff;

  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
}

#formulaire-organisation textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.6;
}

#formulaire-organisation input::file-selector-button {
  margin-right: 12px;
  padding: 10px 14px;

  border: 0;
  border-radius: 8px;

  background: #303030;
  color: #ffffff;

  font: inherit;
  cursor: pointer;
}

.fenetre-organisation :focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

.actions-fenetre {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;

  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#erreur-organisation {
  margin: 0;
  color: #f2abab;
  font-size: 14px;
  line-height: 1.6;
}


/* DESCRIPTION DES FICHES */

.organisation-description {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.fiche-organisation {
  padding-top: 90px;
}


/* FORMULAIRE SUR TÉLÉPHONE */

@media (max-width: 600px) {
  .fenetre-organisation {
    padding: 24px;
  }

  .actions-fenetre button {
    flex: 1;
  }
}





#etat-stockage-organisations {
  flex: 1 1 240px;
  align-self: center;

  margin: 0;
  color: #737783;
  font-size: 13px;
  line-height: 1.5;
}

.outils-organisations button:disabled,
.actions-fenetre button:disabled {
  opacity: 0.55;
  cursor: wait;
}





/* ACTIONS SUR LES FICHES */

.actions-fiche {
  position: absolute;
  z-index: 3;

  right: 32px;
  bottom: 28px;
  left: 32px;

  display: none;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

body.organisations-edition .actions-fiche {
  display: flex;
}

/* Réserve de la place pour les boutons. */
body.organisations-edition .fiche-organisation {
  padding-bottom: 120px;
}

.actions-fiche button:disabled {
  opacity: 0.55;
  cursor: wait;
}


/* INDICATION SOUS LE CHAMP IMAGE */

#aide-image-organisation {
  color: #aaaaaa;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
}

#aide-image-organisation[hidden] {
  display: none !important;
}


/* TÉLÉPHONE */

@media (max-width: 600px) {
  .actions-fiche {
    right: 24px;
    bottom: 24px;
    left: 24px;
    gap: 10px;
  }

  .actions-fiche button {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
  }
}




.filtres-organisations {
  flex-basis: 100%;
  width: 100%;
  max-width: 100%;

  margin: 0;

  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}




/* FOND SOMBRE */

:root {
  color-scheme: dark;

  /* Intensité de la lueur : entre 0 et 1. */
  --intensite-ambiance: 0.32;
}

body {
  min-height: 100svh;
  background: #0b0b0b;
  color: #f4f4f4;
  isolation: isolate;
}


/* AMBIANCE COLORÉE DERRIÈRE LA PAGE */

#ambiance-organisations {
  position: fixed;
  inset: 0;
  z-index: 0;

  overflow: hidden;
  pointer-events: none;

  background: #0b0b0b;
}

.calque-ambiance {
  position: absolute;
  inset: -90px;

  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;

  filter: blur(85px) saturate(1.3);
  transform: scale(1.15);

  opacity: 0;
  transition: opacity 900ms ease;
  will-change: opacity;
}

.calque-ambiance.est-actif {
  opacity: var(--intensite-ambiance);
}

/* Maintient une ambiance sombre et douce. */
#ambiance-organisations::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;

  background: linear-gradient(
    180deg,
    rgba(11, 11, 11, 0.3),
    rgba(11, 11, 11, 0.55)
  );
}


/* CONTENU AU-DESSUS DU FOND */

.entete-organisations,
.filtres-organisations,
.outils-organisations,
.liste-organisations {
  position: relative;
  z-index: 1;
}


/* CATÉGORIES SUR UNE SEULE RANGÉE */

.filtres-organisations {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 12px;

  width: 96%;
  max-width: 1800px;
  margin: 20px auto 0;
  padding: 8px 8px 16px;

  overflow-x: auto;
  overscroll-behavior-x: contain;

  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.filtres-organisations .filtre-categorie {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Ces marges centrent la rangée lorsqu'elle tient dans l'écran. */
.filtres-organisations > :first-child {
  margin-left: auto;
}

.filtres-organisations > :last-child {
  margin-right: auto;
}


/* RECHERCHE ADAPTÉE AU FOND SOMBRE */

.recherche-organisations label {
  color: #c5c6cb;
}

.champ-recherche {
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.14);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 40px rgba(0, 0, 0, 0.22);
}

.champ-recherche:focus-within {
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.champ-recherche input {
  color: #f5f5f5;
}

.champ-recherche input::placeholder {
  color: #92949b;
}

.champ-recherche svg {
  stroke: #a7a9b0;
}

#resultats-organisations,
#etat-stockage-organisations,
.aucun-resultat {
  color: #a2a4ad;
}


/* BOUTONS TRANSLUCIDES */

.bouton-verre {
  background: rgba(32, 32, 32, 0.7);
  border-color: rgba(255, 255, 255, 0.18);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 24px rgba(0, 0, 0, 0.2);
}

.bouton-verre:hover {
  background: rgba(55, 55, 55, 0.8);
  border-color: rgba(255, 255, 255, 0.35);
}

.bouton-verre:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 4px;
}

.filtre-categorie[aria-pressed="true"],
.filtre-categorie[aria-pressed="true"]:hover {
  background: #f4f4f4;
  border-color: #f4f4f4;
  color: #101010;
}


/* RELIEF DES SECTIONS */

.fiche-organisation {
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

@media (prefers-reduced-motion: reduce) {
  .calque-ambiance {
    transition: none;
  }
}