/* =========================================================
   Composants réutilisables
   ========================================================= */

/* ---------- Boutons ---------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.7rem 1.25rem;
  border: 1.5px solid var(--btn-border);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease,
              color var(--dur-fast) ease, transform var(--dur-fast) ease, box-shadow var(--dur) ease;

  & .icon { width: 1.15em; height: 1.15em; transition: translate var(--dur) var(--ease-out); }
  &:hover .icon:last-child:not(:first-child) { translate: 3px 0; }
  &:active { transform: translateY(1px) scale(0.99); }
}

.btn-primary {
  --btn-bg: var(--brand);
  --btn-fg: #fff;
  box-shadow: 0 8px 20px -10px color-mix(in oklch, var(--brand), transparent 20%);
  &:hover { --btn-bg: var(--brand-600); box-shadow: 0 14px 28px -12px color-mix(in oklch, var(--brand), transparent 10%); }
}
.btn-outline {
  --btn-border: var(--line-strong);
  --btn-bg: color-mix(in oklch, var(--surface), transparent 30%);
  &:hover { --btn-border: var(--ink); --btn-bg: var(--surface); }
}
.btn-ghost {
  --btn-bg: var(--brand-50);
  --btn-fg: var(--brand-800);
  &:hover { --btn-bg: var(--brand-100); }
}
.btn-light {
  --btn-bg: #fff;
  --btn-fg: var(--brand-800);
  &:hover { --btn-bg: var(--brand-50); }
}

.btn-sm { min-height: 40px; padding: 0.5rem 1rem; }
.btn-lg { min-height: 52px; padding: 0.9rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }

.text-link {
  color: var(--brand);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
  &:hover { text-decoration-thickness: 2px; }
}

/* ---------- Sur-titre ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);

  &::before {
    content: '';
    width: 22px; height: 1.5px;
    background: currentColor;
  }
  &:has(.dot)::before { display: none; }
}
.eyebrow--light { color: var(--brand-300); }

.dot {
  position: relative;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand);
  &::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    background: inherit;
    animation: ping 2.2s var(--ease-out) infinite;
  }
}
@keyframes ping { 0% { transform: scale(1); opacity: .6; } 80%, 100% { transform: scale(3); opacity: 0; } }

/* ---------- En-têtes de section ---------- */
.section { padding-block: var(--space-section); }

.section-head {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  max-width: 44rem;
}
.section-head--split {
  max-width: none;
  @media (min-width: 900px) {
    grid-template-columns: 1.3fr 1fr;
    align-items: end;
    gap: var(--space-xl);
  }
}
.section-title { font-size: var(--fs-2xl); }
.section-intro {
  color: var(--ink-2);
  font-size: var(--fs-lg);
  max-width: 38rem;
}

/* ---------- Photos ---------- */
.photo {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--brand-100);

  & img { width: 100%; height: 100%; object-fit: cover; }
}
.photo--tall { aspect-ratio: 4 / 5; }
.photo--wide { aspect-ratio: 3 / 2; }
.photo-caption {
  margin-top: var(--space-sm);
  font-size: var(--fs-sm);
  color: var(--ink-3);
}

/* ---------- Bandeau promo ---------- */
.promo-bar {
  position: relative;
  z-index: 60;
  background: var(--brand-900);
  color: var(--on-dark);
  font-size: var(--fs-sm);
}
.promo-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding-block: 0.5rem;
  padding-right: 3rem;
  text-align: center;

  & .icon { color: var(--brand-300); }
  & strong { font-weight: 700; }
  & a { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
}
.promo-bar-close {
  position: absolute;
  top: 50%; right: max(var(--gutter), 8px);
  translate: 0 -50%;
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--on-dark-2);
  cursor: pointer;
  &:hover { background: var(--line-dark); color: #fff; }
}

/* ---------- En-tête du site ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;

  /* Fond flouté porté par un pseudo-élément : un backdrop-filter posé directement
     sur l'en-tête deviendrait le repère des éléments position: fixed qu'il contient,
     et enfermerait le menu mobile dans les 72 px de l'en-tête (menu inutilisable). */
  &::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: color-mix(in oklch, var(--paper), transparent 15%);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
  }

  &[data-scrolled] {
    border-color: var(--line);
    box-shadow: 0 6px 24px -18px rgb(12 30 28 / 0.4);
  }
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  flex: none;
}
.brand-emblem {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.brand-text { display: grid; line-height: 1.1; }
.brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.26em;
  color: var(--brand);
}
.brand-sub {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2); /* petit texte sur fond translucide : contraste renforcé */
}
.brand--light .brand-name { color: #fff; }
.brand--light .brand-sub { color: var(--on-dark-2); }

.header-actions { display: flex; align-items: center; gap: var(--space-sm); }

.nav-toggle {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 18px; height: 1.75px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform var(--dur) var(--ease-out), background var(--dur-fast) ease;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before,
.nav-toggle-bars::after { content: ''; position: absolute; left: 0; }
.nav-toggle-bars::before { transform: translateY(-6px); }
.nav-toggle-bars::after { transform: translateY(6px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: rotate(-45deg); }

/* Menu mobile : panneau plein écran sous l'en-tête */
.main-nav {
  position: fixed;
  inset: var(--nav-top, var(--header-h)) 0 0 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-xl);
  padding: var(--space-lg) var(--gutter) calc(var(--space-lg) + env(safe-area-inset-bottom));
  background: var(--paper);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  translate: 0 -8px;
  transition: opacity var(--dur) var(--ease-out), translate var(--dur) var(--ease-out), visibility 0s linear var(--dur);

  & ul { display: grid; }
  & li a {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  & li a[aria-current="true"] { color: var(--brand); }
}
.main-nav-footer { display: grid; gap: var(--space-sm); }
.site-header[data-menu-open] .main-nav {
  opacity: 1;
  visibility: visible;
  translate: 0 0;
  transition: opacity var(--dur) var(--ease-out), translate var(--dur) var(--ease-out);
}

@media (min-width: 980px) {
  .nav-toggle, .main-nav-footer { display: none; }
  .main-nav {
    position: static;
    padding: 0;
    background: none;
    opacity: 1;
    visibility: visible;
    translate: none;
    overflow: visible;

    & ul { display: flex; gap: 0.25rem; }
    & li a {
      position: relative;
      padding: 0.5rem 0.85rem;
      border: 0;
      border-radius: var(--radius-pill);
      font-size: var(--fs-sm);
      font-weight: 600;
      letter-spacing: 0;
      color: var(--ink-2);
      transition: color var(--dur-fast) ease, background var(--dur-fast) ease;
    }
    & li a:hover { color: var(--ink); background: var(--brand-50); }
    & li a[aria-current="true"] { color: var(--brand-800); background: var(--brand-100); }
  }
}
@media (max-width: 420px) {
  .header-cta { display: none; }
  .brand-sub { display: none; }
}

/* ---------- Étiquettes ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-pill);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  color: var(--brand-800);
  font-size: var(--fs-xs);
  font-weight: 600;
}

/* ---------- Accordéon (FAQ) ---------- */
.accordion {
  border-bottom: 1px solid var(--line);

  & summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: 1.35rem 0;
    font-size: var(--fs-lg);
    font-weight: 700;
    letter-spacing: -0.015em;
    cursor: pointer;
    list-style: none;
    &::-webkit-details-marker { display: none; }
    &:hover { color: var(--brand); }
  }
  & .accordion-icon {
    display: grid; place-items: center;
    width: 36px; height: 36px;
    flex: none;
    border-radius: 50%;
    background: var(--brand-50);
    color: var(--brand);
    transition: rotate var(--dur) var(--ease-out), background var(--dur-fast) ease;
  }
  &[open] .accordion-icon { rotate: 45deg; background: var(--brand); color: #fff; }
  & .accordion-body {
    padding-bottom: 1.4rem;
    padding-right: 3rem;
    color: var(--ink-2);
  }
}
/* Ouverture animée (navigateurs récents), dégradation douce sinon */
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  .accordion::details-content {
    height: 0;
    overflow: clip;
    transition: height var(--dur) var(--ease-out), content-visibility var(--dur) allow-discrete;
  }
  .accordion[open]::details-content { height: auto; }
}

/* ---------- Champs de formulaire ---------- */
.field {
  display: grid;
  gap: 0.4rem;
  align-content: start;

  & label { font-size: var(--fs-sm); font-weight: 700; }
  & .optional { font-weight: 500; color: var(--ink-3); }

  & input, & select, & textarea {
    width: 100%;
    min-height: 50px;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 1rem; /* 16px : évite le zoom auto sur iPhone */
    transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;

    &::placeholder { color: var(--ink-3); opacity: .8; }
    &:hover { border-color: color-mix(in oklch, var(--ink), transparent 65%); }
    &:focus {
      outline: none;
      border-color: var(--brand);
      box-shadow: 0 0 0 4px color-mix(in oklch, var(--brand), transparent 85%);
    }
    &[aria-invalid="true"] {
      border-color: var(--danger);
      box-shadow: 0 0 0 4px color-mix(in oklch, var(--danger), transparent 88%);
    }
  }
  & textarea { resize: vertical; min-height: 110px; }
}
.select-wrap {
  position: relative;
  & select { appearance: none; padding-right: 2.6rem; cursor: pointer; }
  &::after {
    content: '';
    position: absolute;
    right: 1.1rem; top: 50%;
    width: 8px; height: 8px;
    border-right: 1.75px solid var(--ink-2);
    border-bottom: 1.75px solid var(--ink-2);
    translate: 0 -70%;
    rotate: 45deg;
    pointer-events: none;
  }
}
.field-error {
  min-height: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--danger);
  &:empty { display: none; }
}

/* ---------- Bouton WhatsApp flottant ---------- */
.fab-whatsapp {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  display: grid;
  place-items: center;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-lg);
  scale: 0.6;
  opacity: 0;
  pointer-events: none;
  transition: scale var(--dur) var(--ease-out), opacity var(--dur) ease, background var(--dur-fast) ease;

  & .icon { width: 26px; height: 26px; }
  &:hover { background: var(--brand-600); }
  &.is-visible { scale: 1; opacity: 1; pointer-events: auto; }

  @media (min-width: 980px) { display: none; }
}
