/* ===== PIFFRET — static enhancement CSS ===== */

/* Anti-débordement horizontal sur mobile : les grilles auto-fit ont un minmax(Xpx,…)
   dont le X dépasse le conteneur sous ~320px → on force une colonne unique sur téléphone. */
@media (max-width: 480px) {
  [style*="repeat(auto-fit"] { grid-template-columns: 1fr !important; }
  /* min-width:0 laisse la piste 1fr rétrécir sous le min-content de l'item (sinon débordement) */
  [style*="repeat(auto-fit"] > * { min-width: 0 !important; }
}

/* ===== Header : grille symétrique (logo | nav centrée | actions) ===== */
.dchx {
  position: sticky; top: 0; z-index: 1000;
  background: #ffffff; border-bottom: 1px solid #E4E6E9;
  font-family: 'IBM Plex Sans', sans-serif;
  transition: box-shadow .3s ease;
}
.dchx[data-scrolled] { box-shadow: 0 2px 18px rgba(20, 24, 28, .09); }
.dchx-bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
  max-width: 1320px; margin: 0 auto; padding: 14px clamp(18px, 4vw, 40px);
}
.dchx-brand { grid-column: 1; justify-self: start; display: flex; align-items: center; gap: 13px; text-decoration: none; }
.dchx-brand img { width: 46px; height: 46px; display: block; }
.dchx-brand-tx { display: flex; flex-direction: column; line-height: 1; }
.dchx-brand-name { font-family: 'Archivo', sans-serif; font-weight: 900; font-size: 23px; letter-spacing: .01em; color: #2B2E33; }
.dchx-brand-sub { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .22em; color: #8A9099; margin-top: 4px; }

.dchx-nav { grid-column: 2; justify-self: center; display: flex; align-items: center; gap: 30px; }
.dchx-actions { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 18px; }
.dchx-mobile { grid-column: 3; justify-self: end; display: none; align-items: center; gap: 14px; }

.dchx-nav > a, .dchx-svc-trigger {
  position: relative; text-decoration: none; color: #2B2E33; font-weight: 600; font-size: 14.5px;
  padding: 6px 0; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  transition: color .2s;
}
.dchx-nav > a:hover, .dchx-svc-trigger:hover { color: #E2231A; }
.dchx-caret { font-size: 9px; color: #9097A0; }

/* Active underline */
.dchx[data-page="accueil"] a[data-nav="accueil"]::after,
.dchx[data-page="histoire"] a[data-nav="histoire"]::after,
.dchx[data-page="societe"] a[data-nav="societe"]::after,
.dchx[data-page="contact"] a[data-nav="contact"]::after,
.dchx[data-page="assainissement"] a[data-nav="services"]::after,
.dchx[data-page="inspection"] a[data-nav="services"]::after,
.dchx[data-page="nettoyage"] a[data-nav="services"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: #E2231A;
}

/* Services dropdown */
.dchx-svc { position: relative; }
.dchx-dropdown { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); padding-top: 14px; display: none; }
.dchx-svc:hover .dchx-dropdown { display: block; }
.dchx-dropdown-inner {
  position: relative; width: 330px; background: #fff; border: 1px solid #E4E6E9;
  box-shadow: 0 18px 44px rgba(20, 24, 28, .16); padding: 8px;
}
.dchx-dropdown-arrow {
  position: absolute; top: -6px; left: 50%; margin-left: -5px; width: 11px; height: 11px; background: #fff;
  border-left: 1px solid #E4E6E9; border-top: 1px solid #E4E6E9; transform: rotate(45deg);
}
.dchx-dropdown-inner a { display: block; text-decoration: none; padding: 13px 14px; border-left: 2px solid transparent; transition: background .15s, border-color .15s; }
.dchx-dropdown-inner a:hover { background: #F5F6F7; border-left-color: #E2231A; }
.dchx-dropdown-inner .t { display: block; color: #2B2E33; font-weight: 600; font-size: 14px; }
.dchx-dropdown-inner .s { display: block; color: #8A9099; font-size: 12px; margin-top: 3px; }

/* Phone block (right) */
.dchx-phone { display: flex; flex-direction: column; align-items: flex-end; text-decoration: none; line-height: 1; transition: transform .2s ease; }
.dchx-phone:hover { transform: translateY(-1px); }
.dchx-phone-lbl { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .18em; color: #8A9099; }
.dchx-phone-num { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 18px; color: #E2231A; margin-top: 4px; }

/* Devis button (header) */
.dchx-devis-btn {
  background: #E2231A; color: #fff; text-decoration: none; font-weight: 700; font-size: 14px;
  padding: 13px 22px; letter-spacing: .01em; box-shadow: 0 6px 18px rgba(226, 35, 26, .28);
  transition: background .2s, box-shadow .25s, transform .25s; will-change: transform;
}
.dchx-devis-btn:hover { background: #c11910; box-shadow: 0 12px 26px rgba(226, 35, 26, .42); }

/* Mobile controls */
.dchx-mob-call { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: #E2231A; border-radius: 2px; text-decoration: none; transition: transform .2s; }
.dchx-mob-call:active { transform: scale(.94); }
.dchx-burger { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: #2B2E33; border: none; border-radius: 2px; cursor: pointer; transition: transform .2s; }
.dchx-burger:active { transform: scale(.94); }

/* Mobile menu panel */
.dchx-panel {
  position: fixed; inset: 0; background: #2B2E33; z-index: 1200; flex-direction: column;
  padding: 22px clamp(18px, 5vw, 40px); font-family: 'IBM Plex Sans', sans-serif; overflow-y: auto;
}
.dchx-panel[hidden] { display: none !important; }
.dchx-panel { display: flex; }
.dchx-panel-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 36px; }
.dchx-close { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: rgba(255,255,255,.08); border: none; border-radius: 2px; cursor: pointer; }
.dchx-panel-lg { color: #fff; text-decoration: none; font-family: 'Archivo', sans-serif; font-weight: 700; font-size: 26px; padding: 15px 0; border-bottom: 1px solid rgba(255,255,255,.1); transition: padding-left .2s, color .2s; }
.dchx-panel-lg:hover { color: #E2231A; padding-left: 6px; }
.dchx-panel-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .18em; color: #E2231A; padding: 22px 0 8px; }
.dchx-panel-sm { color: #D7DADE; text-decoration: none; font-size: 17px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.08); transition: padding-left .2s, color .2s; }
.dchx-panel-sm:hover { color: #fff; padding-left: 6px; }
.dchx-panel-phone { display: flex; flex-direction: column; margin-top: 32px; text-decoration: none; }
.dchx-panel-cta { margin-top: 24px; background: #E2231A; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; text-align: center; padding: 18px; border-radius: 2px; transition: background .2s, transform .2s; }
.dchx-panel-cta:active { transform: scale(.98); background: #c11910; }
body.dchx-lock { overflow: hidden; }

/* Responsive switch at 1120px */
@media (max-width: 1120px) {
  .dchx-desktop { display: none !important; }
  .dchx-mobile { display: flex !important; }
  .dchx-bar { grid-template-columns: 1fr auto; }
  .dchx-mobile { grid-column: 2; }
}
@media (min-width: 1121px) { .dchx-mobile { display: none; } }
@media (max-width: 480px) {
  .dchx-brand-sub { font-size: 8.5px; letter-spacing: .12em; white-space: nowrap; }
  .dchx-brand img { width: 42px; height: 42px; }
  .dchx-brand { min-width: 0; }
  .dchx-brand-tx { min-width: 0; }
}
@media (max-width: 360px) {
  .dchx-bar { padding-left: 14px; padding-right: 14px; gap: 12px; }
  .dchx-brand { gap: 9px; }
  .dchx-brand img { width: 38px; height: 38px; }
  .dchx-brand-name { font-size: 20px; }
  .dchx-brand-sub { font-size: 8px; letter-spacing: .08em; }
}

/* ===== Animations boutons (CTA rouges inline + secondaires) =====
   Les styles inline sont sérialisés en rgb() par le pré-rendu, d'où ces sélecteurs. */
a[style*="226, 35, 26"], button[style*="226, 35, 26"] {
  transition: transform .25s cubic-bezier(.22,1,.36,1), box-shadow .25s ease, filter .25s ease !important;
  will-change: transform;
}
a[style*="226, 35, 26"]:hover, button[style*="226, 35, 26"]:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 16px 32px rgba(226, 35, 26, .42) !important;
  filter: saturate(1.08) brightness(.96);
}
a[style*="226, 35, 26"]:active, button[style*="226, 35, 26"]:active { transform: translateY(-1px) scale(.985) !important; }
/* Boutons clairs / fantômes du hero (téléphone) */
a[style*="255, 255, 255, 0.12"] { transition: background .2s ease, transform .25s cubic-bezier(.22,1,.36,1) !important; }
a[style*="255, 255, 255, 0.12"]:hover { background: rgba(255,255,255,.22) !important; transform: translateY(-3px) !important; }
a[style*="255, 255, 255, 0.12"]:active { transform: translateY(-1px) scale(.99) !important; }

/* ===== Reveal on scroll (progressive enhancement, flash-free) ===== */
.has-js [data-reveal] {
  opacity: 0; transform: translateY(22px);
  will-change: opacity, transform;
}
.has-js [data-reveal="left"]  { transform: translateX(24px); }
.has-js [data-reveal="right"] { transform: translateX(-24px); }
.has-js [data-reveal].is-revealed {
  opacity: 1; transform: none;
  transition: opacity .8s cubic-bezier(.22,.61,.36,1), transform .8s cubic-bezier(.22,.61,.36,1);
}
@media (prefers-reduced-motion: reduce) {
  .has-js [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ===== Sticky mobile CTA ===== */
.m-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1400; display: none; gap: 10px;
  padding: 10px 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(22,24,26,.97); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 2px solid #E2231A; box-shadow: 0 -8px 24px rgba(0,0,0,.18);
  font-family: 'IBM Plex Sans', sans-serif;
}
.m-cta__btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 15px; padding: 14px 10px; text-decoration: none; border-radius: 3px; transition: transform .2s ease; }
.m-cta__call { flex: 0 0 40%; background: rgba(255,255,255,.12); color: #fff; border: 1.5px solid rgba(255,255,255,.32); }
.m-cta__devis { background: #E2231A; color: #fff; box-shadow: 0 6px 16px rgba(226,35,26,.4); }
.m-cta__call:active { background: rgba(255,255,255,.22); transform: scale(.97); }
.m-cta__devis:active { background: #c11910; transform: scale(.97); }
@media (max-width: 760px) {
  .m-cta { display: flex; }
  body { padding-bottom: 74px; }
}

/* ===== Fix carte : aspect-ratio 21/9 + min-height force une largeur >viewport sur mobile ===== */
@media (max-width: 760px) {
  div[style*="aspect-ratio: 21 / 9"] {
    aspect-ratio: auto !important;
    width: 100% !important;
    min-height: 0 !important;
    height: 240px !important;
  }
}
