/* C. TP — design system
   Direction : sobre, solide, qui inspire confiance.
   Palette béton/asphalte avec accent jaune chantier. */

:root {
  --bg: #f5f4f1;
  --bg-alt: #ebe8e2;
  --bg-dark: #131313;
  --bg-dark-alt: #1c1c1c;
  --text: #0a0a0a;
  --text-muted: #4a4a47;
  --text-light: #f5f4f1;
  --text-light-muted: #a5a5a0;
  --accent: #f5a800;
  --accent-deep: #d68d00;
  --border: #d6d3cb;
  --border-dark: #2a2a2a;
  --max-width: 1200px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  /* Plan de réseaux du héros : couleurs normalisées des grillages avertisseurs (NF P98-332),
     éclaircies pour se lire sur le fond sombre, et dosées par .rx-reseaux. */
  --reseau-eau: #4f9de0;
  --reseau-assainissement: #b27a4b;
  --reseau-electricite: #e2553f;
  --reseau-telecom: #46ad67;
  /* Courbe du motion design : départ franc, arrivée très amortie. */
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ── Layout helpers ── */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.section { padding: 96px 24px; }
.section--dark { background: var(--bg-dark); color: var(--text-light); }
.section--alt { background: var(--bg-alt); }
.section__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent-deep); font-weight: 600;
  margin-bottom: 16px;
  display: inline-flex; align-items: center; gap: 10px;
}
.section--dark .section__eyebrow { color: var(--accent); }
.section__eyebrow::before {
  content: ""; width: 24px; height: 2px; background: currentColor;
}
.section__title {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 800; letter-spacing: -0.02em;
  line-height: 1.1; margin-bottom: 16px;
}
.section__intro { color: var(--text-muted); max-width: 640px; font-size: 1.05rem; }
.section--dark .section__intro { color: var(--text-light-muted); }

/* ── Nav ── */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  background: rgba(245, 244, 241, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s var(--ease-soft);
}
/* Posée par nav_shadow_controller dès qu'on quitte le haut de page. */
.nav--scrolled { box-shadow: 0 8px 28px -14px rgba(0, 0, 0, 0.35); }
.nav__logo {
  font-weight: 800; font-size: 1.15rem; letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 10px;
}
.nav__logo::before {
  content: ""; width: 28px; height: 28px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 70%, 70% 100%, 0 100%);
}
.nav__logo strong { color: var(--text); }
.nav__logo span { color: var(--text-muted); font-weight: 500; }
.nav__links { display: flex; gap: 28px; list-style: none; font-size: 0.95rem; }
.nav__links a { color: var(--text-muted); transition: color 0.15s; }
.nav__links a:hover { color: var(--text); }
.nav__cta {
  padding: 10px 18px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600; font-size: 0.9rem;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s;
}
.nav__cta:hover { background: var(--accent); color: var(--text); }

/* ── Hero ──
   Fond : le plan de réseaux (PlanReseaux, section « Plan de réseaux » plus bas), sur l'aplat
   sombre. La photo de chantier qui le précédait brouillait les traits du plan : il la
   remplace. */
.hero {
  position: relative;
  padding: 120px 24px 96px;
  background: var(--bg-dark);
  color: var(--text-light);
  overflow: hidden;
}
.hero .hero__sub { color: #e0ddd5; }
.hero__inner { position: relative; z-index: 2; max-width: var(--max-width); margin: 0 auto; }
/* Voile sous le texte, au-dessus du plan : les rues et les réseaux qui passent derrière
   le titre s'y estompent. Le plan est à z-index -2, le voile à -1, le texte au-dessus. */
.hero__inner::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  inset: -120px auto -96px -50vw; width: calc(50vw + 62%);
  background: linear-gradient(90deg, rgba(19,19,19,0.9) 0%, rgba(19,19,19,0.78) 55%, rgba(19,19,19,0) 100%);
}
.hero__badge {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
  margin-bottom: 32px;
}
.hero__badge::before {
  content: ""; width: 8px; height: 8px;
  background: var(--accent); border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(245, 168, 0, 0.18);
}
/* Le point du badge bat au rythme du repère du siège (3 s, cf. rx-pouls) : un seul signal
   dans le héros, pas deux pulsations qui se contrarient. Animé seulement dans la section
   « Mouvement ». */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(245, 168, 0, 0.18); }
  50% { box-shadow: 0 0 0 7px rgba(245, 168, 0, 0.08); }
}
.hero__title {
  font-size: clamp(2.5rem, 5.5vw, 4.4rem);
  font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.05;
  max-width: 16ch;
  margin-bottom: 24px;
}
.hero__title em { font-style: normal; color: var(--accent); }
.hero__sub {
  font-size: 1.15rem; color: var(--text-light-muted);
  max-width: 56ch; margin-bottom: 36px;
}
.hero__buttons { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Plan de réseaux (héros) ──
   Les rues réelles autour du siège (OpenStreetMap), et des réseaux qui s'y tracent façon
   plan de récolement : app/models/plan_reseaux.rb. Ici, l'état final — c'est ce que voient
   l'impression et prefers-reduced-motion ; le mouvement est dans la section « Mouvement ».

   .hero__siege est le point où se pose le repère : sans taille, ni transform ni opacité
   (ils en feraient un contexte d'empilement, et le plan qu'il porte passerait au-dessus
   du texte). Sur grand écran, il flotte à droite du texte ; sur téléphone, il suit les
   boutons. */
.hero__siege { position: absolute; left: min(78%, calc(100% - 250px)); top: 52%; width: 0; height: 0; }
.rx-ancre { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.rx-plan {
  position: absolute; z-index: -2; pointer-events: none;
  left: calc(var(--pw) / -2); top: calc(var(--ph) / -2);
  width: var(--pw); height: var(--ph);
}
.rx-plan svg { display: block; width: 100%; height: 100%; transform-origin: 50% 50%; }
.rx-plan path { stroke: rgba(255, 255, 255, 0.17); }
.rx-plan .rx-v-grande { stroke: rgba(255, 255, 255, 0.23); }
.rx-plan .rx-v-pieton { stroke: rgba(255, 255, 255, 0.12); stroke-dasharray: 3 5; }
.rx-plan .rx-fer { stroke: rgba(255, 255, 255, 0.14); stroke-width: 1.8; stroke-dasharray: 12 8; }
.rx-plan .rx-eau-libre { stroke: rgba(255, 255, 255, 0.06); }
.rx-plan .rx-parcs { fill: rgba(255, 255, 255, 0.045); stroke: none; }
/* Réseaux : sobres, le texte reste le premier plan. */
.rx-plan .rx-reseaux { opacity: 0.72; }
.rx-plan .rx-eau path { stroke: var(--reseau-eau); stroke-width: 1.6; }
.rx-plan .rx-assainissement path { stroke: var(--reseau-assainissement); stroke-width: 2.2; }
.rx-plan .rx-electricite path { stroke: var(--reseau-electricite); stroke-width: 1.6; }
.rx-plan .rx-telecom path { stroke: var(--reseau-telecom); stroke-width: 1.4; }
.rx-plan .rx-regards circle { fill: var(--bg-dark); stroke: var(--reseau-assainissement); stroke-width: 1.4; }
.rx-plan .rx-topo path { stroke: rgba(245, 244, 241, 0.7); stroke-width: 1.4; stroke-linecap: square; }

.rx-repere {
  position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(19, 19, 19, 0.9), 0 0 0 5.5px rgba(245, 168, 0, 0.55), 0 6px 18px rgba(0, 0, 0, 0.45);
}
.rx-repere::before, .rx-repere::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--accent); opacity: 0;
}
.rx-onde { display: none; }

/* Une annotation de plan : « Siège » à la couleur d'accent, l'adresse dessous. */
.hero__siege-label {
  position: absolute; left: 20px; top: -1.45em; padding: 3px 8px;
  white-space: nowrap; background: rgba(19, 19, 19, 0.78);
  font-family: var(--font-mono); font-size: 0.72rem; line-height: 1.5; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-light-muted);
}
.hero__siege-label b { display: block; color: var(--accent); font-weight: 600; }
.hero__siege-label sup { font-size: 0.7em; text-transform: none; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 24px;
  font-size: 0.95rem; font-weight: 600;
  transition: all 0.15s; cursor: pointer; border: 1px solid transparent;
  font-family: var(--font-sans);
}
.btn--primary { background: var(--accent); color: var(--text); }
.btn--primary:hover { background: var(--accent-deep); }
.btn--ghost-light { background: transparent; color: var(--text-light); border-color: rgba(255,255,255,0.2); }
.btn--ghost-light:hover { border-color: var(--text-light); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--text); }

/* ── Hero stats strip ── */
.hero-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border-top: 1px solid var(--border-dark);
  margin-top: 64px;
}
.hero-strip__item {
  padding: 24px 24px 0 0;
  border-right: 1px solid var(--border-dark);
}
.hero-strip__item:last-child { border-right: none; }
.hero-strip__num {
  font-size: 2rem; font-weight: 800; color: var(--accent);
  font-family: var(--font-mono);
  line-height: 1;
}
.hero-strip__label {
  font-size: 0.82rem; color: var(--text-light-muted);
  margin-top: 8px;
  letter-spacing: 0.05em; text-transform: uppercase;
}

/* ── Services grid ── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0;
  margin-top: 48px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.service-card {
  padding: 36px 28px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  position: relative;
}
.service-card:hover { background: #fff; }
.service-card__num {
  font-family: var(--font-mono);
  font-size: 0.78rem; color: var(--accent-deep);
  font-weight: 600; letter-spacing: 0.1em;
  margin-bottom: 24px;
}
.service-card__title {
  font-size: 1.25rem; font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.service-card__desc { color: var(--text-muted); font-size: 0.95rem; line-height: 1.65; }
.service-card__list {
  list-style: none; margin-top: 16px; padding-left: 0;
  font-size: 0.9rem; color: var(--text-muted);
}
.service-card__list li {
  padding: 4px 0; padding-left: 20px; position: relative;
}
.service-card__list li::before {
  content: "+"; position: absolute; left: 0; top: 4px;
  color: var(--accent-deep); font-weight: 700;
}

/* ── About / values ── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 48px;
  align-items: start;
}
.about-grid__visual {
  aspect-ratio: 4 / 5;
  position: relative;
  overflow: hidden;
}
.about-grid__visual img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.values-list { list-style: none; padding: 0; }
.values-list li {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 20px; align-items: start;
}
.values-list li:last-child { border-bottom: none; }
.values-list__num {
  font-family: var(--font-mono);
  color: var(--accent-deep);
  font-size: 0.95rem;
  font-weight: 600;
  min-width: 32px;
}
.values-list__body strong {
  display: block; margin-bottom: 4px;
  font-size: 1.05rem;
}
.values-list__body p { color: var(--text-muted); font-size: 0.95rem; }

/* ── Cases ── */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 48px;
}
.case {
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.case__media {
  aspect-ratio: 16 / 10;
  background: var(--bg-alt);
  overflow: hidden;
  position: relative;
}
.case__media img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
.case:hover .case__media img { transform: scale(1.04); }
.case__body { padding: 20px 24px; }
.case__type {
  font-family: var(--font-mono);
  font-size: 0.72rem; color: var(--accent-deep);
  font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 8px;
}
.case__title { font-weight: 700; margin-bottom: 4px; }
.case__meta { color: var(--text-muted); font-size: 0.88rem; }

/* ── Contact ── */
.contact-block {
  margin-top: 48px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border-dark);
  background: var(--bg-dark);
  color: var(--text-light);
}
.contact-block__col { padding: 36px 32px; border-right: 1px solid var(--border-dark); }
.contact-block__col:last-child { border-right: none; }
.contact-block__label {
  font-family: var(--font-mono);
  font-size: 0.78rem; color: var(--accent);
  letter-spacing: 0.18em; text-transform: uppercase;
  margin-bottom: 12px;
}
.contact-block__value {
  font-size: 1.3rem; font-weight: 700;
  word-break: break-word;
}
.contact-block__value a { color: var(--text-light); border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.contact-block__value a:hover { color: var(--accent); }
.contact-block__sub {
  color: var(--text-light-muted); font-size: 0.9rem; margin-top: 8px;
}

/* ── Footer ── */
.footer {
  padding: 48px 24px 32px;
  background: var(--bg-dark);
  color: var(--text-light-muted);
  border-top: 4px solid var(--accent);
}
.footer__inner {
  max-width: var(--max-width); margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
.footer__logo { color: var(--text-light); font-weight: 800; letter-spacing: 0.04em; }
.footer__links { display: flex; gap: 24px; list-style: none; font-size: 0.92rem; flex-wrap: wrap; }
.footer__links a:hover { color: var(--accent); }
.footer__copy {
  width: 100%; text-align: center; font-size: 0.82rem; padding-top: 24px;
  border-top: 1px solid var(--border-dark); margin-top: 24px;
  font-family: var(--font-mono); letter-spacing: 0.05em;
}

/* ── Legal pages ── */
.legal { padding: 80px 24px; }
.legal__container { max-width: 760px; margin: 0 auto; }
.legal__breadcrumb { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 24px; }
.legal__breadcrumb a:hover { color: var(--accent-deep); }
.legal h1 {
  font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 12px;
}
.legal__intro { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 40px; }
.legal__content h2 {
  font-size: 1.15rem; font-weight: 700; margin-top: 36px; margin-bottom: 12px;
}
.legal__content p, .legal__content ul { margin-bottom: 16px; color: var(--text); }
.legal__content ul { padding-left: 22px; }
.legal__content li { margin-bottom: 6px; }
.legal__content a { color: var(--accent-deep); }
.legal__content a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 880px) {
  .nav__links { display: none; }
  .section { padding: 64px 24px; }
  .hero { padding: 80px 24px 72px; }
  /* Plus de place à droite du texte pour le repère et son annotation : il suit les
     boutons, et le plan, réduit, passe sous le texte. Le voile devient vertical. */
  .hero__siege { position: relative; left: auto; top: auto; height: 18px; margin: 44px 0 0 9px; }
  .hero__siege-label { top: -0.75em; margin-top: -3px; }
  .hero__siege-label b { display: inline; margin-right: 0.5em; }
  .hero__inner::before { inset: -120px -50vw -72px; width: auto;
    background: linear-gradient(180deg, rgba(19,19,19,0.82) 0%, rgba(19,19,19,0.66) 62%, rgba(19,19,19,0) 88%); }
  .rx-plan { scale: 0.8; }
  .rx-plan .rx-reseaux { opacity: 0.6; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .contact-block { grid-template-columns: 1fr; }
  .contact-block__col { border-right: none; border-bottom: 1px solid var(--border-dark); }
  .contact-block__col:last-child { border-bottom: none; }
}

/* ── Mouvement ──
   Entrée du héros en CSS pur (le texte n'attend pas le script : le LCP n'est pas retardé
   au-delà de la cascade), puis le plan : repère qui se pose, plan dévoilé en onde depuis
   lui, réseaux tracés du siège vers l'extérieur (délai --d et durée --t calculés par
   PlanReseaux), regards et points de levé posés au passage, plan qui « respire ».
   Au défilement, les blocs [data-reveal] montent en fondu (reveal_controller). Tout est
   coupé par prefers-reduced-motion et absent à l'impression : l'état par défaut est
   l'état final. */
@keyframes monter { from { opacity: 0; transform: translateY(18px); } }
@keyframes rx-devoile { from { clip-path: circle(0 at 50% 50%); } to { clip-path: circle(72% at 50% 50%); } }
@keyframes rx-souffle { from { transform: scale(1); } to { transform: scale(1.06); } }
@keyframes rx-trace { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes rx-pose { from { transform: scale(0); opacity: 0; } }
@keyframes rx-pouls { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(3.4); opacity: 0; } }
@keyframes rx-onde {
  0% { opacity: 0.9; width: 0; height: 0; }
  70% { opacity: 0.2; }
  100% { opacity: 0; width: 3000px; height: 3000px; }
}

@media screen and (prefers-reduced-motion: no-preference) {
  .hero-in { animation: monter 0.9s var(--ease-soft) both; animation-delay: calc(80ms + var(--i, 0) * 90ms); }
  .hero__badge::before { animation: pulse 3s ease-in-out 2.2s infinite; }

  .rx-plan { clip-path: circle(0 at 50% 50%); animation: rx-devoile 2.4s cubic-bezier(0.3, 0.6, 0.2, 1) 0.35s forwards; }
  /* Deux allers-retours de 34 s, puis le plan se tient tranquille. */
  .rx-plan svg { animation: rx-souffle 34s ease-in-out 3.8s 2 alternate; }
  .rx-plan .rx-reseaux path {
    stroke-dasharray: 1; stroke-dashoffset: 1;
    animation: rx-trace var(--t, 1s) linear var(--d, 1s) forwards;
  }
  .rx-plan .rx-regards circle, .rx-plan .rx-topo path {
    transform-box: fill-box; transform-origin: center;
    animation: rx-pose 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) var(--d, 1s) both;
  }
  .rx-repere { animation: rx-pose 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) 0.1s both; }
  .rx-repere::before, .rx-repere::after { animation: rx-pouls 3s ease-out 2.2s infinite; }
  .rx-repere::after { animation-delay: 3.7s; }
  /* L'onde qui accompagne le dévoilement : un anneau qui part du repère, au bord du plan
     qui se découvre (même durée, même courbe). Animée en taille et non en scale, qui
     aurait grossi sa bordure avec elle. */
  .rx-onde {
    display: block; position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: -2;
    border-radius: 50%; border: 1.5px solid var(--accent); transform: translate(-50%, -50%);
    opacity: 0; pointer-events: none;
    animation: rx-onde 2.4s cubic-bezier(0.3, 0.6, 0.2, 1) 0.35s forwards;
  }

  .reveal-pending { opacity: 0; }
  .reveal-in { animation: monter 0.9s var(--ease-soft) var(--reveal-delay, 0ms) both; }
}

@media print {
  .hero__siege { display: none; }
}
