/* hoummi-facade.css : configurateur de façade du bloc « Définir les ouvertures »
 * (particuliers.html, js/hoummi-facade.js).
 *
 * Même langage que hoummi-branches.css : aplats, coins francs, aucune ombre.
 * Le module est dessiné comme le schéma d'origine (cadre sombre, poteaux
 * entre les travées, emplacements libres en pointillés). Un emplacement rempli
 * occupe toute sa case, sans marge blanche : les éléments voisins se touchent,
 * deux menuiseries voisines forment une seule baie.
 */

.hm-fac {
  margin: 0;
  padding: clamp(18px, 2.4vw, 36px);
  background: var(--hm-blanc);
  border-radius: var(--hm-r, 2px);
}

.hm-fac__fig { margin: 0; }

/* Sans JavaScript : l'image d'origine, rien d'autre */
.hm-fac:not(.hm-fac--actif) .hm-fac__barre,
.hm-fac:not(.hm-fac--actif) .hm-fac__palette,
.hm-fac:not(.hm-fac--actif) .hm-fac__resume,
.hm-fac:not(.hm-fac--actif) .hm-fac__message,
.hm-fac:not(.hm-fac--actif) .hm-fac__aide { display: none; }

.hm-fac__dessin img { display: block; width: 100%; max-width: 1100px; height: auto; margin: 0 auto; }

/* ---------- Barre : taille du module, réinitialiser ---------- */

.hm-fac__barre {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(14px, 1.8vw, 22px);
}

.hm-fac__tailles { display: inline-flex; border: 2px solid var(--hm-noir); }

.hm-fac button {
  font-family: Ranua, sans-serif;
  color: var(--hm-encre);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hm-fac__taille {
  min-width: 84px;
  padding: 9px 16px;
  font-size: 16px;
  font-weight: 700;
  background: var(--hm-blanc);
  border: 0;
  transition: background-color .2s ease, color .2s ease;
}
.hm-fac__taille + .hm-fac__taille { border-left: 2px solid var(--hm-noir); }
.hm-fac__taille[aria-pressed="true"] { background: var(--hm-noir); color: var(--hm-blanc); }

.hm-fac__raz {
  padding: 9px 16px;
  font-size: 15px;
  font-weight: 600;
  background: transparent;
  border: 2px solid var(--hm-noir);
  transition: background-color .2s ease, color .2s ease;
}
.hm-fac__raz:hover { background: var(--hm-noir); color: var(--hm-blanc); }

.hm-fac button:focus-visible { outline: 3px solid var(--hm-corail); outline-offset: 2px; }

/* ---------- Le module, vu de face ---------- */

.hm-fac__module {
  display: grid;
  grid-template-columns: repeat(var(--travees, 3), minmax(0, 1fr));
  gap: clamp(4px, .7vw, 8px); /* les poteaux de la structure */
  max-width: min(1100px, calc(var(--travees, 3) * 367px));
  margin: 0 auto;
  padding: clamp(14px, 1.8vw, 22px) clamp(8px, 1vw, 12px) clamp(8px, 1vw, 12px);
  background: #5B5857;
  position: relative;
}
.hm-fac__module::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: clamp(8px, 1vw, 12px);
  height: 2px;
  background: var(--hm-blanc);
}

.hm-fac__travee {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  aspect-ratio: 4 / 3;
  min-width: 0;
  background: var(--hm-blanc);
}

.hm-fac__case {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--hm-blanc);
  overflow: hidden;
}
.hm-fac__case--double { grid-column: span 2; }
.hm-fac__case--triple { grid-column: span 3; }
.hm-fac__case svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

.hm-fac__plus {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 1px solid #8a8a8a;
  border-radius: 50%;
  background: var(--hm-blanc);
  font-size: 22px;
  font-weight: 700;
  line-height: 27px;
  text-align: center;
  color: var(--hm-noir);
  transition: transform .2s ease, background-color .2s ease;
}
.hm-fac__case:hover .hm-fac__plus { transform: scale(1.12); background: var(--hm-vert-doux); }
.hm-fac__case:hover:not(.hm-fac__case--vide) { filter: brightness(1.05); }

/* emplacement choisi : un cadre corail franc, par-dessus le dessin */
.hm-fac__case::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 4px solid transparent;
  transition: border-color .2s ease;
  pointer-events: none;
}
.hm-fac__case.est-choisie::after { border-color: var(--hm-corail); }
.hm-fac__case:focus-visible { outline: 3px solid var(--hm-corail); outline-offset: 2px; z-index: 1; }

/* le dessin d'un emplacement qui change se pose en douceur */
.hm-fac__g { transform-box: fill-box; transform-origin: 50% 100%; }
.hm-fac__case.vient-de-changer .hm-fac__g { animation: hm-fac-pose .38s cubic-bezier(.16, 1, .3, 1); }
@keyframes hm-fac-pose {
  from { opacity: 0; transform: translateY(6%) scaleY(.94); }
  to { opacity: 1; transform: none; }
}

/* ---------- Le choix de l'ouverture ---------- */

.hm-fac__palette {
  max-width: 1100px;
  margin: clamp(12px, 1.6vw, 18px) auto 0;
  padding: clamp(12px, 1.6vw, 18px);
  border: 2px solid var(--hm-noir);
  animation: hm-fac-ouvre .25s ease-out;
}
@keyframes hm-fac-ouvre {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.hm-fac__palette-titre { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--hm-encre); }

.hm-fac__groupe { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hm-fac__options { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.hm-fac__groupe + .hm-fac__groupe { margin-top: 10px; }
.hm-fac__groupe[hidden] { display: none; }
.hm-fac__sous { padding-top: 10px; border-top: 1px solid var(--hm-beige); }
.hm-fac__groupe-txt { flex: 0 0 104px; font-size: 15px; font-weight: 600; color: var(--hm-encre); }

.hm-fac__groupe button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 7px;
  font-size: 15px;
  font-weight: 600;
  background: var(--hm-blanc);
  border: 2px solid var(--hm-noir);
  border-radius: 2px;
  transition: background-color .2s ease, color .2s ease;
}
.hm-fac__groupe button:hover { background: var(--hm-beige); }
.hm-fac__groupe button[aria-pressed="true"] { background: var(--hm-noir); color: var(--hm-blanc); }
.hm-fac__precision { font-size: 13px; font-weight: 500; opacity: .7; }

/* vignettes : le même dessin que la façade, en petit */
.hm-fac__ico { flex: none; display: block; height: 30px; border: 1px solid var(--hm-noir); background: var(--hm-blanc); }
.hm-fac__ico svg { display: block; width: 100%; height: 100%; }

/* ---------- Résumé, message doux, légende ---------- */

.hm-fac__resume {
  max-width: 1100px;
  margin: clamp(14px, 1.8vw, 20px) auto 0;
  font-size: clamp(16px, 1.3vw, 18px);
  font-weight: 600;
  color: var(--hm-encre);
}
.hm-fac__message {
  max-width: 1100px;
  margin: 8px auto 0;
  font-size: 15px;
  color: var(--hm-encre);
}
.hm-fac__message:empty { display: none; }
.hm-fac__message:not(:empty) { padding-left: 12px; border-left: 4px solid var(--hm-corail); }

.hm-fac figcaption {
  max-width: 1100px;
  margin: 12px auto 0;
  font-size: 14px;
  color: var(--hm-encre-douce);
  text-align: left;
}

/* téléphone : des travées plus hautes, des emplacements plus faciles à toucher */
@media (max-width: 600px) {
  .hm-fac__travee { aspect-ratio: 3 / 4; }
  .hm-fac__plus { width: 24px; height: 24px; margin: -12px 0 0 -12px; font-size: 18px; line-height: 21px; }
  .hm-fac__options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .hm-fac__groupe button { gap: 8px; font-size: 13px; line-height: 1.2; text-align: left; padding: 6px 8px 6px 6px; }
  .hm-fac__precision { display: none; }
  .hm-fac__groupe { flex-direction: column; align-items: flex-start; }
  .hm-fac__groupe-txt { flex-basis: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .hm-fac__case.vient-de-changer .hm-fac__g,
  .hm-fac__palette { animation: none; }
  .hm-fac *, .hm-fac *::after { transition: none !important; }
}
