/* ============================================================
   ALDT — Composants réutilisables
   ============================================================ */

/* --- Boutons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.5rem; font-weight: 700; line-height: 1.1;
  border-radius: var(--radius); border: 2px solid transparent;
  transition: var(--transition); cursor: pointer; text-align: center;
}
.btn--primary { background: var(--c-red); color: #fff; }
.btn--primary:hover { background: var(--c-red-dark); }
.btn--ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn--ghost:hover { background: rgba(255, 255, 255, .12); }
.btn--lg { font-size: var(--step-1); padding: 1rem 2rem; }
.btn--block { width: 100%; }

/* --- Lien d'évitement --- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: #fff; color: var(--c-ink); padding: .6rem 1rem; font-weight: 700;
}
.skip-link:focus { left: .5rem; top: .5rem; }

/* --- Header --- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--c-ink);
  color: #fff; border-bottom: 1px solid var(--c-ink-3);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; height: var(--header-h);
}
.site-header__logo { display: flex; align-items: center; }
/* Header : logo complet recadré + petite marge transparente (aldt-logo-mark.png) */
.site-header__logo img { height: 80px; width: auto; }
.primary-nav { display: flex; align-items: center; gap: 1.5rem; }
.primary-nav__list { display: flex; gap: 1.4rem; list-style: none; padding: 0; margin: 0; }
.primary-nav__list > li { position: relative; }
.primary-nav a { font-weight: 600; padding-block: .4rem; }
.primary-nav__list > li > a:hover { color: var(--c-red-bright); }
.primary-nav__actions { display: flex; align-items: center; gap: .75rem; }

/* Accès direct à l'avis Google — volontairement en retrait des boutons voisins
   (texte gris clair, sans bordure ni aplat) pour ne pas concurrencer « Devis
   gratuit ». Deux emplacements : dans les actions de la nav (desktop + menu
   burger) et dans le bandeau du header (mobile uniquement). */
.nav-review {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .45rem .7rem; border-radius: var(--radius); white-space: nowrap;
  font-size: var(--step--1); font-weight: 600; color: var(--c-text-muted-invert);
  transition: var(--transition);
}
.nav-review:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.nav-review__star { color: var(--c-gold); line-height: 1; }

/* Instance du bandeau : masquée en desktop (celle de la nav prend le relais),
   visible dès le chargement en mobile pour ne pas dépendre du menu burger. */
.site-header__review { display: none; }
@media (max-width: 920px) { .site-header__review { display: inline-flex; } }

/* Entre 921 et 1099 px la barre est trop serrée : le raccourci ferait passer le
   téléphone et « Devis gratuit » sur plusieurs lignes. On masque l'instance de la
   nav dans cette bande — il reste l'URL courte /avis et la section de bas de page.
   Au-delà de 1100 px, tout tient sur une ligne. */
@media (min-width: 921px) and (max-width: 1099px) {
  .primary-nav__actions .nav-review { display: none; }
}

/* Sous-menu Services */
.primary-nav__sub {
  display: none; position: absolute; top: 100%; left: 0;
  background: var(--c-ink-2); padding: .4rem 0; list-style: none; margin: 0;
  min-width: 240px; box-shadow: var(--shadow); border: 1px solid var(--c-ink-3);
  border-radius: var(--radius);
}
.has-sub:hover > .primary-nav__sub,
.has-sub:focus-within > .primary-nav__sub { display: block; }
.primary-nav__sub li a { display: block; padding: .6rem 1.1rem; font-weight: 500; }
.primary-nav__sub li a:hover { background: var(--c-ink-3); color: var(--c-red-bright); }

/* Burger */
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: .5rem;
  position: relative; z-index: 60; /* reste au-dessus du panneau ouvert (z-index 55) pour pouvoir le fermer */
}
.nav-toggle span { width: 26px; height: 3px; background: #fff; border-radius: 2px; transition: var(--transition); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* --- Footer --- */
.site-footer { padding-block: var(--space-l) var(--space-m); }
.site-footer__grid {
  display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: var(--space-m);
}
.site-footer__brand img { width: 360px; max-width: 80%; height: auto; margin-bottom: .9rem; }
.site-footer__brand p { color: var(--c-text-muted-invert); max-width: 32ch; }
.site-footer h3 { font-size: var(--step-0); color: var(--c-red-bright); margin-bottom: .6rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.site-footer a:hover { color: var(--c-red-bright); }
.site-footer address { font-style: normal; line-height: 1.9; }
.site-footer__legal {
  border-top: 1px solid var(--c-ink-3); margin-top: var(--space-m);
  padding-top: var(--space-s); font-size: var(--step--1); color: var(--c-text-muted-invert);
}
.site-footer a, .site-footer address { overflow-wrap: anywhere; }
@media (max-width: 680px) {
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
  .site-footer__brand { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  /* Mobile : footer centré (sinon tout colle à gauche avec un vide à droite) */
  .site-footer__grid { grid-template-columns: 1fr; text-align: center; gap: var(--space-l); }
  .site-footer__brand img { margin-inline: auto; }
  .site-footer__brand p { margin-inline: auto; max-width: 40ch; }
  .site-footer__legal { text-align: center; }
}

/* --- Barre d'action fixe mobile --- */
.mobile-actions {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .25);
  padding-bottom: env(safe-area-inset-bottom); /* au-dessus de la barre d'accueil iOS */
}
.mobile-actions a {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .95rem .5rem; font-weight: 700; font-size: var(--step--1); color: #fff; white-space: nowrap;
}
.mobile-actions__call { background: var(--c-ink-2); }
.mobile-actions__quote { background: var(--c-red); }

/* --- Comparateur avant / après --- */
.before-after {
  position: relative; max-width: 920px; margin: var(--space-m) auto 0;
  aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--radius-lg);
  user-select: none; touch-action: pan-y; background: var(--c-ink-2);
  container-type: inline-size; box-shadow: var(--shadow);
}
.ba__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba__clip { position: absolute; inset: 0; width: 50%; overflow: hidden; }
/* L'image "avant" garde la largeur du comparateur (100cqw) pour ne pas se déformer quand le clip rétrécit */
.ba__clip .ba__img { width: 100cqw; max-width: none; }
.ba__tag {
  position: absolute; top: .75rem; padding: .25rem .65rem; z-index: 3;
  background: rgba(22, 22, 26, .82); color: #fff; font-size: var(--step--1);
  font-weight: 700; border-radius: var(--radius); text-transform: uppercase; letter-spacing: .05em;
}
.ba__tag--before { left: .75rem; }
.ba__tag--after { right: .75rem; }
.ba__range {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4;
  opacity: 0; cursor: ew-resize; margin: 0;
}
.ba__handle {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; z-index: 2;
  background: var(--c-red); transform: translateX(-50%); pointer-events: none;
}
.ba__handle::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 42px; height: 42px; transform: translate(-50%, -50%);
  background: var(--c-red); border-radius: 50%; box-shadow: 0 0 0 3px #fff, var(--shadow-soft);
}
.ba__handle::before {
  content: "‹ ›"; position: absolute; top: 50%; left: 50%; z-index: 1;
  transform: translate(-50%, -50%); color: #fff; font-weight: 700; font-size: .9rem; letter-spacing: -1px;
}

/* --- Galerie + lightbox --- */
.gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .75rem; margin-top: var(--space-m);
}
.gallery__item { overflow: hidden; border-radius: var(--radius); }
.gallery__item img { aspect-ratio: 1; object-fit: cover; cursor: pointer; transition: transform var(--transition); width: 100%; }
.gallery__item:hover img, .gallery__item:focus-visible img { transform: scale(1.05); }
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .93); align-items: center; justify-content: center;
}
.lightbox.is-open { display: flex; }
.lightbox__img { max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: var(--radius); }
.lightbox button { background: none; border: 0; color: #fff; font-size: 2.6rem; line-height: 1; cursor: pointer; padding: 1rem; }
.lightbox button:hover { color: var(--c-red-bright); }
.lightbox__close { position: absolute; top: .5rem; right: 1rem; }
.lightbox__prev { position: absolute; left: .5rem; }
.lightbox__next { position: absolute; right: .5rem; }

/* --- Apparition au scroll --- */
/* Le masquage n'est appliqué QUE si le JS est actif (classe .js posée sur <html>) :
   sans JS, ou s'il échoue, le contenu reste pleinement visible. */
html.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
html.js .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; transition: none; }
}

/* --- Formulaire de contact --- */
.contact__form { display: grid; gap: var(--space-s); background: var(--c-paper); padding: var(--space-m); border-radius: var(--radius-lg); }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 600; }
.field input, .field select, .field textarea {
  padding: .7rem .8rem; border: 1px solid var(--c-grey-light); border-radius: var(--radius);
  font: inherit; background: #fff; color: var(--c-text);
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--c-red); outline: 2px solid var(--c-red); outline-offset: 0; }
.field input:user-invalid, .field textarea:user-invalid, .field select:user-invalid { border-color: var(--c-error); }
.field--check { grid-template-columns: auto 1fr; align-items: start; gap: .55rem; }
.field--check input { margin-top: .25rem; }
.field--check label { font-weight: 400; font-size: var(--step--1); color: var(--c-text-muted); }
.field--check a { color: var(--c-red); text-decoration: underline; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { font-weight: 600; min-height: 1.4em; }
.form-status--ok { color: var(--c-success); }
.form-status--err { color: var(--c-error); }
.required-note { font-size: var(--step--1); color: var(--c-text-muted); }

/* --- Appel à l'avis Google (réutilisable sur toutes les pages) --- */
.review-cta {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: var(--space-m) var(--space-l);
  background: var(--c-paper); border-left: 4px solid var(--c-red);
  border-radius: var(--radius-lg); padding: var(--space-m);
}
.review-cta__stars {
  color: var(--c-gold); font-size: var(--step-1);
  letter-spacing: .12em; line-height: 1; margin-bottom: .5rem;
}
.review-cta .section-title { font-size: var(--step-2); }
.review-cta .section-title::after { margin-top: .5rem; }
.review-cta .section__lead { margin-top: .7rem; max-width: 46ch; }
.review-cta__action { display: grid; justify-items: center; gap: .6rem; }
.review-cta__btn:hover { box-shadow: var(--shadow-soft); }
/* Le « G » Google reste sur fond blanc (respect de la charte Google) */
.review-cta__g {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 26px; width: 26px; height: 26px;
  background: #fff; border-radius: 50%;
}
.review-cta__note { font-size: var(--step--1); color: var(--c-text-muted); text-align: center; }

@media (max-width: 800px) {
  .review-cta {
    grid-template-columns: 1fr; justify-items: center; text-align: center;
    padding: var(--space-m) var(--space-s);
  }
  .review-cta .section-title::after { margin-inline: auto; }
  .review-cta__text p { margin-inline: auto; }
  .review-cta__action { width: 100%; max-width: 420px; }
  .review-cta__btn { width: 100%; padding-inline: 1.25rem; font-size: var(--step-0); }
}

/* --- Responsive : nav mobile --- */
@media (max-width: 920px) {
  :root { --header-h: 64px; }
  .site-header__logo img { height: 60px; }
  .nav-toggle { display: flex; }
  .primary-nav {
    position: fixed; inset: 0 0 0 25%; z-index: 55;
    background: var(--c-ink); flex-direction: column; align-items: stretch;
    justify-content: flex-start; gap: 0;
    padding: calc(var(--header-h) + 1rem) 1.5rem calc(2rem + env(safe-area-inset-bottom));
    transform: translateX(100%); transition: transform var(--transition);
    overflow-y: auto; overscroll-behavior: contain; box-shadow: var(--shadow);
  }
  .primary-nav.is-open { transform: translateX(0); }
  .primary-nav__list { flex-direction: column; gap: 0; }
  .primary-nav__list > li { border-bottom: 1px solid var(--c-ink-3); }
  .primary-nav__list > li > a { display: block; padding: .9rem 0; font-size: var(--step-1); }
  .primary-nav__sub { position: static; display: block; background: none; box-shadow: none; border: 0; padding: 0 0 .6rem .8rem; min-width: 0; }
  .primary-nav__sub li a { padding: .45rem 0; }
  .primary-nav__actions { flex-direction: column; align-items: stretch; gap: .6rem; margin-top: 1.25rem; }
  .mobile-actions { display: flex; }
  /* La barre fixe disparaît quand le menu plein écran est ouvert
     (elle faisait doublon et masquait le bas du menu, dont le bouton « Devis gratuit »). */
  body.nav-open .mobile-actions { display: none; }
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom)); } /* réserve la place de la barre mobile + zone sûre iOS */
}
