/* ============================================================
   L'espuma — mise au point mobile
   Chargée en dernier : corrige la version mobile du prototype
   (photos du hero masquées, titres qui touchent les bords,
   sauts de ligne forcés, cibles tactiles trop petites…)
   ============================================================ */

@media (max-width: 900px) {

  /* ---------- confort de lecture général ---------- */
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }
  img { max-width: 100%; height: auto; }

  /* ---------- en-tête : on allège (le CTA est dans le menu et en flottant) ---------- */
  header a[style*="border-radius:999px"] { display: none !important; }
  header { gap: 10px !important; }

  /* ---------- HERO ---------- */
  section#top {
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 26px !important;
    min-height: 0 !important;
    padding: 96px 20px 60px !important;
    text-align: center;
  }
  /* le texte d'abord, sur toute la largeur disponible */
  section#top > div:not([data-hero-side]) {
    order: 1;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    align-self: stretch !important;
    gap: 20px !important;
  }
  /* tous les blocs internes du hero restent dans l'écran */
  section#top > div:not([data-hero-side]) > * { max-width: 100%; }
  section#top h1 {
    font-size: clamp(34px, 10.4vw, 54px) !important;
    line-height: 1.02 !important;
    letter-spacing: -0.02em !important;
    overflow-wrap: break-word;
  }
  section#top p { font-size: 16px !important; line-height: 1.65 !important; }

  /* les photos reviennent, en bande sous le texte */
  [data-hero-side="left"] {
    display: flex !important;
    flex-direction: row !important;
    order: 2;
    width: 100%;
    gap: 8px !important;
    align-items: stretch !important;
    margin: 0 !important;
  }
  [data-hero-side="left"] img {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: 116px !important;
    aspect-ratio: auto !important;
    object-fit: cover !important;
    transform: none !important;
    margin: 0 !important;
    border-radius: 4px !important;
  }
  [data-hero-side="right"] { display: none !important; }

  /* cercles décoratifs : discrets, jamais devant le texte */
  section#top > div[aria-hidden="true"] { opacity: .12 !important; z-index: 0 !important; }

  /* ---------- boutons : lisibles, à leur juste largeur, jamais coupés ---------- */
  a[style*="border-radius:999px"],
  button[style*="border-radius:999px"] {
    min-height: 48px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;          /* le libellé ne passe plus sur deux lignes */
    width: auto !important;        /* plus d'étirement sur toute la largeur */
    max-width: 100%;
    align-self: flex-start;        /* dans une colonne, le bouton garde sa taille */
    padding-top: 15px !important;
    padding-bottom: 15px !important;
    padding-left: 26px !important;
    padding-right: 26px !important;
    box-sizing: border-box;
  }
  /* quand le bloc est centré, le bouton le reste aussi */
  div[style*="align-items:center"] > a[style*="border-radius:999px"],
  div[style*="justify-content:center"] > a[style*="border-radius:999px"],
  div[style*="text-align:center"] a[style*="border-radius:999px"] { align-self: center; }
  /* les deux CTA du hero : empilés, pleine largeur, dans l'écran */
  section#top > div > div[style*="display:flex"][style*="gap:12px"] {
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  section#top a[style*="border-radius:999px"] {
    width: auto !important;
    max-width: 100%;
    align-self: center;
  }
  /* la ligne d'avis reste centrée et lisible */
  section#top > div > div[style*="letter-spacing:0.08em"] { justify-content: center !important; row-gap: 6px !important; }

  /* ---------- onglet flottant « réserver » ---------- */
  [data-book-tab] {
    top: auto !important;
    bottom: max(14px, env(safe-area-inset-bottom)) !important;
    right: 14px !important;
    left: auto !important;
    writing-mode: horizontal-tb !important;
    transform: none !important;
    border-radius: 999px !important;
    padding: 14px 22px !important;
    font-size: 11px !important;
    letter-spacing: .12em !important;
    box-shadow: 0 12px 30px rgba(16,35,63,.28);
    z-index: 55;
  }
  /* on lui laisse de la place en bas de page */
  footer { padding-bottom: 88px !important; }

  /* ---------- sections ---------- */
  section { padding-left: 20px !important; padding-right: 20px !important; }
  section h2 { overflow-wrap: break-word; }
  /* grands titres de section : on évite les débordements */
  section h2[style*="clamp"] { font-size: clamp(30px, 8.6vw, 46px) !important; line-height: 1.04 !important; }
  section h3[style*="font-size:34px"] { font-size: 26px !important; }

  /* ---------- rails de photos horizontaux ---------- */
  [data-scroll-x] { overflow-x: auto !important; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  [data-scroll-x]::-webkit-scrollbar { display: none; }
  [data-scroll-x] > div { transform: none !important; width: max-content !important; gap: 10px !important; padding: 0 20px !important; }
  [data-scroll-x] img { min-width: 78vw !important; height: 46vh !important; max-height: 380px; border-radius: 4px; }

  [data-photo-row] { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  [data-photo-row] img { min-width: 78% !important; height: 40vh !important; }

  /* ---------- cartes / blocs à gros padding ---------- */
  div[style*="padding:60px"], div[style*="padding:44px"],
  div[style*="padding:40px"], div[style*="padding:34px"] { padding: 24px !important; }

  /* ---------- tableaux de prix (carte) ---------- */
  div[style*="justify-content:space-between"][style*="gap:16px"],
  div[style*="justify-content:space-between"][style*="gap:20px"] {
    flex-wrap: wrap;
    gap: 4px 12px !important;
  }

  /* ---------- pied de page ---------- */
  footer a { display: inline-block; padding: 4px 0; }
}

/* ---------- petits écrans ---------- */
@media (max-width: 480px) {
  section#top { padding-top: 96px !important; }
  section#top h1 { font-size: clamp(30px, 9.6vw, 44px) !important; }
  [data-hero-side="left"] img { height: 96px !important; }
  section h2[style*="clamp"] { font-size: clamp(27px, 8.4vw, 38px) !important; }
  /* le bandeau défilant reste lisible sans écraser la page */
  div[style*="espuma-marquee"] span { font-size: 21px !important; gap: 18px !important; }
}

/* ---------- champs de formulaire : jamais de débordement ---------- */
input, select, textarea, button {
  box-sizing: border-box;
  max-width: 100%;
  font-family: inherit;
}
/* 16px minimum : évite le zoom automatique d'iOS à la saisie */
@media (max-width: 900px) {
  input, select, textarea { font-size: 16px !important; width: 100% !important; }
  form div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  form { max-width: 100%; }
}

/* ---------- confort tactile ---------- */
@media (hover: none) {
  a, button { touch-action: manipulation; }
}
@media (max-width: 900px) {
  /* toute zone cliquable atteint la taille recommandée (44px) */
  main a:not([style*="border-radius:999px"]),
  footer a { min-height: 44px; display: inline-flex; align-items: center; }
  /* les liens à l'intérieur d'un paragraphe restent dans le flux du texte */
  p a, li a, .lead a, summary a { min-height: 0 !important; display: inline !important; }
  footer a { padding: 6px 0; }
}

/* le décor du hero ne dépasse jamais de l'écran */
@media (max-width: 900px) {
  section#top { overflow: hidden !important; }
}

/* ---------- carte : les catégories en barre horizontale (au lieu d'une longue pile) ---------- */
@media (max-width: 900px) {
  div[style*="flex-wrap:wrap"][style*="gap:10px"][style*="padding-top:44px"] {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-top: 28px !important;
    margin: 0 -20px;
    padding-left: 20px !important;
    padding-right: 20px !important;
    scroll-snap-type: x proximity;
  }
  div[style*="flex-wrap:wrap"][style*="gap:10px"][style*="padding-top:44px"]::-webkit-scrollbar { display: none; }
  div[style*="flex-wrap:wrap"][style*="gap:10px"][style*="padding-top:44px"] > a {
    flex: 0 0 auto;
    white-space: nowrap;
    scroll-snap-align: start;
    min-height: 44px;
  }
}


/* ---------- adresse : plus de texte coupé ---------- */
@media (max-width: 900px) {
  h2[style*="font-size:clamp"], h3[style*="font-size:clamp"] { overflow-wrap: break-word; hyphens: auto; }
  /* le bloc adresse de la page contact */
  section h2[style*="Instrument Serif"][style*="clamp(28px"],
  section h2[style*="clamp(30px"] { font-size: clamp(24px, 6.6vw, 34px) !important; line-height: 1.14 !important; }
}

/* ---------- très petits écrans : libellés un peu plus compacts ---------- */
@media (max-width: 400px) {
  a[style*="border-radius:999px"], button[style*="border-radius:999px"] {
    font-size: 11px !important;
    letter-spacing: .1em !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
}
