/* ==========================================================================
   MAIRIE DE PLAN (Isère · 38590) — Design System « Sillon » v2
   Direction artistique : photographie du terroir + administration premium
   Village de ~310 habitants, entre plaine de Bièvre et plateau de Chambaran
   ========================================================================== */

:root {
  /* --- Couleurs de marque --- */
  --pine-950: #0a2019;
  --forest-900: #0e2a20;
  --forest-800: #123829;
  --forest-700: #184a37;
  --forest-600: #1f5c45;
  --forest-500: #2c7457;
  --forest-400: #4a9b76;
  --forest-300: #7bbd9d;
  --forest-100: #dfeee5;
  --forest-50: #eff7f2;

  --gold-700: #9a6f21;
  --gold-600: #b98a2c;
  --gold-500: #cf9f43;
  --gold-400: #e2be6d;
  --gold-100: #f7edd6;

  --clay-600: #a94f28;
  --clay-500: #c56a3c;
  --clay-100: #f8e6da;

  --ink-950: #121613;
  --ink-900: #171d19;
  --ink-700: #39423d;
  --ink-500: #6a736e;
  --ink-300: #a6ada8;
  --ink-200: #cdd3ce;
  --ink-100: #e4e8e3;

  --paper-0: #ffffff;
  --paper-50: #faf7f1;
  --paper-100: #f2ede3;
  --paper-200: #e9e2d4;

  --ok-600: #2c7457;
  --warn-600: #b98a2c;
  --danger-600: #b3402c;
  --info-600: #286a92;

  /* --- Tokens sémantiques (thème clair) --- */
  --color-bg: var(--paper-50);
  --color-surface: var(--paper-0);
  --color-surface-alt: var(--paper-100);
  --color-text: var(--ink-900);
  --color-text-muted: var(--ink-700);
  --color-border: #e7e0d3;
  --color-primary: var(--forest-700);
  --color-primary-hover: var(--forest-800);
  --color-primary-contrast: #ffffff;
  --color-accent: var(--gold-500);
  --color-accent-contrast: var(--ink-900);
  --color-focus: #1b62d6;
  --color-on-photo: #ffffff;

  --shadow-xs: 0 1px 2px rgba(14, 42, 32, 0.06);
  --shadow-sm: 0 2px 6px rgba(14, 42, 32, 0.07), 0 1px 2px rgba(14, 42, 32, 0.05);
  --shadow-md: 0 14px 34px -14px rgba(14, 42, 32, 0.28), 0 4px 10px rgba(14, 42, 32, 0.06);
  --shadow-lg: 0 34px 60px -22px rgba(10, 32, 25, 0.42);
  --shadow-photo: 0 30px 60px -28px rgba(10, 32, 25, 0.55);

  /* --- Typo --- */
  --font-display: 'Fraunces', ui-serif, Georgia, serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;

  --step--1: clamp(0.82rem, 0.79rem + 0.14vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.09rem);
  --step-1: clamp(1.18rem, 1.1rem + 0.38vw, 1.4rem);
  --step-2: clamp(1.45rem, 1.28rem + 0.85vw, 1.95rem);
  --step-3: clamp(1.85rem, 1.55rem + 1.45vw, 2.7rem);
  --step-4: clamp(2.3rem, 1.85rem + 2.2vw, 3.6rem);
  --step-5: clamp(2.9rem, 2.1rem + 3.9vw, 5.2rem);
  --step-6: clamp(3.4rem, 2.2rem + 5.6vw, 6.4rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 6.5rem;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;
  --radius-full: 999px;
  --container: 1220px;
  --container-wide: 1400px;

  --ease: cubic-bezier(0.22, 0.72, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 0.18s;
  --dur-med: 0.4s;
  --dur-slow: 0.7s;

  color-scheme: light;
}

/* --- Thème sombre --- */
[data-theme='dark'] {
  color-scheme: dark;
  --color-bg: #0c1310;
  --color-surface: #121b16;
  --color-surface-alt: #18231d;
  --color-text: #eef2ee;
  --color-text-muted: #b4bfb8;
  --color-border: #26332b;
  --color-primary: var(--forest-400);
  --color-primary-hover: #63b48d;
  --color-primary-contrast: #08120d;
  --color-accent: var(--gold-400);
  --color-accent-contrast: #12160f;
  --color-border: #27332c;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 16px 40px -16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 34px 60px -20px rgba(0, 0, 0, 0.7);
  --shadow-photo: 0 30px 60px -26px rgba(0, 0, 0, 0.75);
}

/* --- Contraste renforcé (RGAA) --- */
[data-contrast='high'] {
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-surface-alt: #ffffff;
  --color-text: #000000;
  --color-text-muted: #000000;
  --color-border: #000000;
  --color-primary: #003321;
  --color-primary-hover: #000000;
  --color-primary-contrast: #ffffff;
  --color-accent: #7a4a00;
  --color-accent-contrast: #ffffff;
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-photo: none;
}
[data-contrast='high'] .card,
[data-contrast='high'] .btn,
[data-contrast='high'] .badge {
  border: 2px solid #000 !important;
}
[data-contrast='high'] .photo-scrim,
[data-contrast='high'] .hero-overlay {
  background: rgba(0, 0, 0, 0.6) !important;
}

/* --- Taille de texte --- */
[data-fontsize='lg'] {
  font-size: 112%;
}
[data-fontsize='xl'] {
  font-size: 126%;
}

/* --- FALC --- */
[data-falc='on'] .falc-hide {
  display: none !important;
}
[data-falc='on'] body {
  line-height: 1.9;
  letter-spacing: 0.01em;
}
[data-falc='on'] p,
[data-falc='on'] li {
  font-size: 1.1em;
  max-width: 62ch;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition:
    background var(--dur-med) var(--ease),
    color var(--dur-med) var(--ease);
  overflow-x: hidden;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  margin: 0 0 var(--space-4);
  color: var(--color-text);
  letter-spacing: -0.015em;
}
h1 {
  font-size: var(--step-5);
  font-weight: 600;
}
h2 {
  font-size: var(--step-3);
}
h3 {
  font-size: var(--step-2);
}
h4 {
  font-size: var(--step-1);
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: -0.01em;
}
p {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
}
a {
  color: inherit;
}
ul {
  padding: 0;
  margin: 0;
  list-style: none;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}
button {
  font-family: inherit;
}
svg {
  flex-shrink: 0;
}
.icon,
.plus {
  display: inline-block;
  vertical-align: -3px;
  flex-shrink: 0;
}
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--color-surface-alt);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 1000;
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus {
  top: 1rem;
}

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
.container-wide {
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
.section {
  padding-block: var(--space-9);
}
.section-sm {
  padding-block: var(--space-8);
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-7);
  flex-wrap: wrap;
}
.section-head > div {
  max-width: 60ch;
}
.section-head p {
  margin: 0.4rem 0 0;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 2px;
  background: var(--color-accent);
  border-radius: 2px;
}
.eyebrow.on-photo {
  color: #fff;
}
.eyebrow.on-photo::before {
  background: var(--color-accent);
}
.kicker-line {
  height: 4px;
  width: 60px;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
}
.lede {
  font-size: var(--step-1);
  color: var(--color-text-muted);
  max-width: 56ch;
}

/* --- Grain premium (texture discrète) --- */
.grain::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Reveal au défilement (seulement si JS actif : dégradation gracieuse) --- */
html.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
}
html.js .reveal.in {
  opacity: 1;
  transform: none;
}
.reveal.d1 {
  transition-delay: 0.08s;
}
.reveal.d2 {
  transition-delay: 0.16s;
}
.reveal.d3 {
  transition-delay: 0.24s;
}
.reveal.d4 {
  transition-delay: 0.32s;
}

/* ==========================================================================
   BOUTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.94rem;
  line-height: 1;
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius-full);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}
.btn:active {
  transform: translateY(1px) scale(0.99);
}
.btn svg {
  transition: transform var(--dur-fast) var(--ease);
}
.btn:hover svg:last-child {
  transform: translateX(3px);
}
.btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.btn-accent {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  box-shadow: var(--shadow-sm);
}
.btn-accent:hover {
  filter: brightness(1.04);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.btn-outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-surface-alt);
}
.btn-ghost {
  background: transparent;
  color: var(--color-text);
}
.btn-ghost:hover {
  background: var(--color-surface-alt);
}
.btn-light {
  background: #fff;
  color: var(--ink-900);
}
.btn-light:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.btn-on-photo {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(6px);
}
.btn-on-photo:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #fff;
}
.btn-sm {
  padding: 0.6rem 1.05rem;
  font-size: 0.86rem;
}
.btn-lg {
  padding: 1.05rem 1.8rem;
  font-size: 1rem;
}
.btn-icon {
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
}

/* ==========================================================================
   TOPBAR ACCESSIBILITÉ
   ========================================================================== */
.a11y-bar {
  background: var(--pine-950);
  color: #dcebe2;
  font-size: 0.8rem;
}
[data-theme='dark'] .a11y-bar {
  background: #050b08;
}
.a11y-bar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.5rem;
  flex-wrap: wrap;
}
.a11y-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.a11y-links a {
  text-decoration: none;
  opacity: 0.85;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.a11y-links a:hover {
  opacity: 1;
  text-decoration: underline;
}
.a11y-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.a11y-tools button {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 0.32rem 0.8rem;
  font-size: 0.76rem;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition:
    background var(--dur-fast),
    color var(--dur-fast);
}
.a11y-tools button:hover,
.a11y-tools button[aria-pressed='true'] {
  background: var(--color-accent);
  color: var(--ink-900);
  border-color: var(--color-accent);
}

/* ==========================================================================
   BANDEAU ALERTE
   ========================================================================== */
.alert-bar {
  background: linear-gradient(90deg, var(--clay-500), var(--clay-600));
  color: #fff;
  font-weight: 500;
  font-size: 0.9rem;
}
.alert-bar .container {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-block: 0.7rem;
}
.alert-bar a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
  margin-left: auto;
  white-space: nowrap;
}

/* ==========================================================================
   HEADER / NAV
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--color-surface) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--dur-med) var(--ease);
}
.site-header.scrolled {
  box-shadow: var(--shadow-sm);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding-block: 0.85rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}
.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(155deg, var(--forest-500), var(--forest-800));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  padding: 0;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-text span {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}
.main-nav a {
  display: block;
  padding: 0.6rem 0.82rem;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  transition:
    background var(--dur-fast),
    color var(--dur-fast);
}
.main-nav a:hover,
.main-nav a.active {
  background: var(--color-surface-alt);
  color: var(--color-primary);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-toggle {
  display: none;
}

@media (max-width: 1080px) {
  .main-nav a {
    padding: 0.6rem 0.66rem;
    font-size: 0.86rem;
  }
}
@media (max-width: 1000px) {
  .main-nav {
    display: none;
  }
  .main-nav.nav-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem var(--space-5) 1.25rem;
    box-shadow: var(--shadow-md);
    max-height: 80vh;
    overflow: auto;
  }
  .main-nav.nav-open a {
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
  }
  .nav-toggle {
    display: inline-flex;
  }
}
@media (max-width: 520px) {
  .header-actions .btn-outline .lbl {
    display: none;
  }
  .brand-text span {
    display: none;
  }
}

/* ==========================================================================
   HERO CINÉMATIQUE (plein cadre photo)
   ========================================================================== */
.hero-full {
  position: relative;
  min-height: min(88vh, 820px);
  min-height: min(88svh, 820px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
}
.hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(
      180deg,
      rgba(10, 32, 25, 0.28) 0%,
      rgba(10, 32, 25, 0.05) 30%,
      rgba(10, 32, 25, 0.55) 78%,
      rgba(8, 20, 15, 0.9) 100%
    ),
    linear-gradient(90deg, rgba(10, 32, 25, 0.6) 0%, rgba(10, 32, 25, 0.1) 55%, transparent 100%);
}
.hero-full .container {
  width: 100%;
  padding-block: var(--space-8);
  position: relative;
  z-index: 2;
}
.hero-content {
  max-width: 44rem;
  color: #fff;
}
.hero-content h1 {
  color: #fff;
  font-weight: 600;
  margin-bottom: var(--space-5);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.25);
}
.hero-content .lede {
  color: rgba(255, 255, 255, 0.92);
  font-size: var(--step-1);
  max-width: 46ch;
}
.hero-actions {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: var(--space-6);
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: var(--space-5);
  letter-spacing: 0.02em;
}
.hero-badge .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--forest-300);
  box-shadow: 0 0 0 0 rgba(123, 189, 157, 0.7);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(123, 189, 157, 0.6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(123, 189, 157, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(123, 189, 157, 0);
  }
}
.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hero-scroll svg {
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(6px);
  }
}

/* Barre de recherche flottante */
.quick-search {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 5;
}
.hero-search {
  margin-top: calc(-1 * var(--space-7));
}
.quick-search-row {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.search-field {
  flex: 1 1 320px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.35rem 0.35rem 1.1rem;
  transition: border-color var(--dur-fast);
}
.search-field:focus-within {
  border-color: var(--color-primary);
}
.search-field input {
  border: 0;
  background: transparent;
  flex: 1;
  font-size: var(--step-0);
  color: var(--color-text);
  outline: none;
  padding-block: 0.55rem;
}
.quick-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: var(--space-4);
  align-items: center;
}
.quick-chips .lbl-inline {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-right: 0.2rem;
}
.chip {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.42rem 0.9rem;
  border-radius: var(--radius-full);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.chip:hover,
.chip[aria-current='true'],
.chip.active {
  border-color: var(--color-primary);
  color: var(--color-primary-contrast);
  background: var(--color-primary);
}

@media (max-width: 640px) {
  .hero-full {
    min-height: 78vh;
  }
  .hero-scroll {
    display: none;
  }
}

/* --- Ancienne page-hero (pages internes) : rafraîchie --- */
.page-hero {
  position: relative;
  padding-block: var(--space-8) var(--space-7);
  background:
    radial-gradient(120% 100% at 90% 0%, var(--forest-50), transparent 60%), var(--color-bg);
  overflow: hidden;
}
[data-theme='dark'] .page-hero {
  background:
    radial-gradient(120% 100% at 90% 0%, rgba(74, 155, 118, 0.08), transparent 60%), var(--color-bg);
}
.page-hero h1 {
  font-size: var(--step-4);
}
/* page-hero avec photo */
.page-hero-photo {
  position: relative;
  min-height: clamp(280px, 42vh, 460px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
}
.page-hero-photo img.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}
.page-hero-photo .scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(10, 32, 25, 0.15),
    rgba(10, 32, 25, 0.35) 55%,
    rgba(8, 20, 15, 0.82)
  );
}
.page-hero-photo .container {
  padding-block: var(--space-7);
  color: #fff;
  position: relative;
  z-index: 2;
}
.page-hero-photo h1 {
  color: #fff;
  font-size: var(--step-4);
}
.page-hero-photo .lede {
  color: rgba(255, 255, 255, 0.92);
}
.breadcrumb {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.82rem;
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
  flex-wrap: wrap;
}
.page-hero-photo .breadcrumb {
  color: rgba(255, 255, 255, 0.8);
}
.breadcrumb a {
  text-decoration: none;
}
.breadcrumb a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   STAT BAND / TRUST
   ========================================================================== */
.stat-band {
  background: var(--forest-900);
  color: #eaf3ee;
}
[data-theme='dark'] .stat-band {
  background: #0a120d;
}
.stat-band .grid {
  padding-block: var(--space-7);
  text-align: center;
}
.stat-band strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-3);
  color: #fff;
  line-height: 1;
  margin-bottom: 0.35rem;
}
.stat-band .accent {
  color: var(--gold-400);
}
.stat-band span {
  color: #a9c2b5;
  font-size: 0.86rem;
}

.trust-strip {
  background: var(--color-surface-alt);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.trust-strip .grid-4 {
  text-align: center;
  padding-block: var(--space-6);
}
.trust-strip strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-3);
  color: var(--color-primary);
}
.trust-strip span {
  color: var(--color-text-muted);
  font-size: var(--step--1);
}

/* ==========================================================================
   GRIDS
   ========================================================================== */
.grid {
  display: grid;
  gap: var(--space-5);
}
.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
.grid-6 {
  grid-template-columns: repeat(6, 1fr);
}
@media (max-width: 1000px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }
}
/* Carte : sidebar 320px + plan côte à côte en desktop, empilés en mobile */
.carte-grid {
  grid-template-columns: 320px 1fr;
}
@media (max-width: 860px) {
  .carte-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   CARTES
   ========================================================================== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
  transition:
    transform var(--dur-med) var(--ease),
    box-shadow var(--dur-med) var(--ease),
    border-color var(--dur-med) var(--ease);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}
a.card:hover,
.card.hover:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
}

.service-card {
  align-items: flex-start;
  gap: 0.55rem;
}
.service-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    150deg,
    var(--forest-100),
    color-mix(in srgb, var(--gold-100) 60%, var(--forest-100))
  );
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  transition: transform var(--dur-med) var(--ease);
}
[data-theme='dark'] .service-icon {
  background: rgba(74, 155, 118, 0.16);
}
a.card:hover .service-icon {
  transform: scale(1.08) rotate(-3deg);
}
.service-card h4 {
  margin-bottom: 0.25rem;
}
.service-card p {
  margin: 0;
  font-size: 0.9rem;
}
.card-arrow {
  margin-top: auto;
  padding-top: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--color-primary);
}
a.card:hover .card-arrow svg {
  transform: translateX(4px);
}
.card-arrow svg {
  transition: transform var(--dur-fast) var(--ease);
}

/* Carte à média photo */
.news-card {
  padding: 0;
  overflow: hidden;
}
.news-media {
  aspect-ratio: 16/10;
  position: relative;
  overflow: hidden;
  background: var(--color-surface-alt);
}
.news-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}
a.card:hover .news-media img,
.card.hover:hover .news-media img {
  transform: scale(1.06);
}
.news-media .badge {
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
  z-index: 2;
  box-shadow: var(--shadow-sm);
}
.news-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  flex: 1;
}
.news-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: auto;
  padding-top: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.32rem 0.72rem;
  border-radius: var(--radius-full);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
}
.badge-forest {
  background: var(--forest-100);
  color: var(--forest-700);
}
[data-theme='dark'] .badge-forest {
  background: rgba(74, 155, 118, 0.2);
  color: var(--forest-300);
}
.badge-gold {
  background: var(--gold-100);
  color: var(--gold-700);
}
.badge-clay {
  background: var(--clay-100);
  color: var(--clay-600);
}
[data-theme='dark'] .badge-gold {
  background: rgba(207, 159, 67, 0.2);
  color: var(--gold-400);
}
[data-theme='dark'] .badge-clay {
  background: rgba(197, 106, 60, 0.22);
  color: #e9a882;
}
.badge.solid {
  background: var(--color-primary);
  color: #fff;
}

.date-badge {
  width: 60px;
  text-align: center;
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}
.date-badge strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--color-primary);
  line-height: 1;
}
.date-badge span {
  font-size: 0.66rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

.agenda-row {
  display: flex;
  gap: 1rem;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--color-border);
  align-items: center;
}
.agenda-row:last-child {
  border-bottom: 0;
}

/* ==========================================================================
   SECTION ÉDITORIALE (image + texte)
   ========================================================================== */
.feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: center;
}
.feature.reverse .feature-media {
  order: 2;
}
.feature-media {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-photo);
  aspect-ratio: 5/4;
}
.feature-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.feature-media.tall {
  aspect-ratio: 4/5;
}
.feature-cap {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
[data-theme='dark'] .feature-cap {
  background: rgba(18, 27, 22, 0.86);
}
.feature-cap .fc-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--forest-100);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
[data-theme='dark'] .feature-cap .fc-icon {
  background: rgba(74, 155, 118, 0.2);
}
.feature-cap strong {
  display: block;
  font-size: 0.95rem;
}
.feature-cap span {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
@media (max-width: 820px) {
  .feature {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  .feature.reverse .feature-media {
    order: 0;
  }
}

/* ==========================================================================
   MOSAÏQUE PHOTO (galerie asymétrique)
   ========================================================================== */
.mosaic {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 200px;
  gap: var(--space-3);
}
.mosaic-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
}
.mosaic-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}
.mosaic-item:hover img {
  transform: scale(1.07);
}
.mosaic-item .cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.4rem 0.9rem 0.7rem;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  background: linear-gradient(transparent, rgba(8, 20, 15, 0.75));
  opacity: 0;
  transition: opacity var(--dur-med);
}
.mosaic-item:hover .cap,
.mosaic-item:focus-within .cap {
  opacity: 1;
}
.mosaic-item.wide {
  grid-column: span 2;
}
.mosaic-item.tall {
  grid-row: span 2;
}
.mosaic-item.big {
  grid-column: span 2;
  grid-row: span 2;
}
@media (max-width: 820px) {
  .mosaic {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 150px;
  }
  .mosaic-item.big {
    grid-column: span 2;
  }
}

/* Photo générique avec légende overlay */
.photo {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-photo);
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 40%, rgba(8, 20, 15, 0.72));
}
.photo-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.6rem;
  color: #fff;
}

/* ==========================================================================
   FORMULAIRES
   ========================================================================== */
label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}
input,
select,
textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  transition: border-color var(--dur-fast);
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
}
.field {
  margin-bottom: var(--space-5);
}
.field-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
}
fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin: 0 0 var(--space-5);
}
legend {
  font-weight: 700;
  padding: 0 0.5rem;
  font-family: var(--font-display);
  font-size: var(--step-1);
}
.radio-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  cursor: pointer;
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast);
}
.radio-card:hover {
  border-color: var(--color-primary);
}
.radio-card:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--forest-50);
}
[data-theme='dark'] .radio-card:has(input:checked) {
  background: rgba(74, 155, 118, 0.12);
}
.radio-card input {
  width: auto;
  margin-top: 0.2rem;
}

.stepper {
  display: flex;
  gap: 0.5rem;
  margin-bottom: var(--space-7);
  flex-wrap: wrap;
  counter-reset: step;
}
.stepper li {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-muted);
}
.stepper li.active {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
}
.stepper li.done {
  background: var(--forest-100);
  color: var(--forest-700);
}

/* ==========================================================================
   TABS / ACCORDION
   ========================================================================== */
.tabs {
  display: flex;
  gap: 0.3rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}
.tabs button {
  background: none;
  border: none;
  padding: 0.85rem 1.1rem;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color var(--dur-fast);
}
.tabs button:hover {
  color: var(--color-text);
}
.tabs button.active {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.accordion-item {
  border-bottom: 1px solid var(--color-border);
}
.accordion-item summary {
  cursor: pointer;
  padding: 1.15rem 0;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  list-style: none;
}
.accordion-item summary::-webkit-details-marker {
  display: none;
}
.accordion-item p {
  padding-bottom: 1.15rem;
  margin-top: -0.3rem;
}
.accordion-item summary .plus {
  transition: transform var(--dur-fast);
  color: var(--color-primary);
}
.accordion-item[open] summary .plus {
  transform: rotate(45deg);
}

/* ==========================================================================
   DIVERS COMPOSANTS
   ========================================================================== */
.map-mock {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
.map-legend {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 1rem;
  font-size: 0.82rem;
  z-index: 10;
}
.map-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--forest-500), var(--forest-700));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 1.3rem;
}

.progress-track {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-alt);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--forest-500), var(--forest-400));
  border-radius: var(--radius-full);
}

.timeline {
  position: relative;
  padding-left: 2.1rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--color-border);
}
.timeline-item {
  position: relative;
  padding-bottom: var(--space-6);
}
.timeline-item:last-child {
  padding-bottom: 0;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.1rem;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 3px solid var(--color-border);
}
.timeline-item.done::before {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.timeline-item .yr {
  font-family: var(--font-display);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 1.05rem;
}

.table-clean {
  width: 100%;
  border-collapse: collapse;
}
.table-clean th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--color-border);
}
.table-clean td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.92rem;
}
.table-clean tr:hover td {
  background: var(--color-surface-alt);
}

.swatch {
  border-radius: var(--radius-md);
  height: 92px;
  display: flex;
  align-items: flex-end;
  padding: 0.6rem;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}

.chatbot-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  border: none;
  cursor: pointer;
  transition: transform var(--dur-fast);
}
.chatbot-fab:hover {
  transform: scale(1.08);
}
.chatbot-fab::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--gold-500);
  border: 2px solid var(--color-primary);
}

/* CTA panneau */
.cta-panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  color: #fff;
  background: linear-gradient(135deg, var(--forest-700), var(--forest-900));
}
.cta-panel h2 {
  color: #fff;
}
.cta-panel p {
  color: rgba(255, 255, 255, 0.86);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  background: var(--pine-950);
  color: #cfe0d6;
  margin-top: 0;
  position: relative;
}
.site-footer a {
  color: #bcd0c5;
  text-decoration: none;
}
.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}
.footer-top {
  padding-block: var(--space-8);
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: var(--space-6);
}
.footer-top h5 {
  color: #fff;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}
.footer-top li {
  margin-bottom: 0.55rem;
  font-size: 0.9rem;
}
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-block: 1.3rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: #8ba99a;
}
.footer-bottom .flex a {
  font-size: 0.8rem;
}
@media (max-width: 900px) {
  .footer-top {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   UTILITAIRES
   ========================================================================== */
.pill-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.text-center {
  text-align: center;
}
.mt-0 {
  margin-top: 0;
}
.mb-0 {
  margin-bottom: 0;
}
.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.items-start {
  align-items: flex-start;
}
.justify-between {
  justify-content: space-between;
}
.gap-2 {
  gap: 0.5rem;
}
.gap-3 {
  gap: 0.75rem;
}
.gap-4 {
  gap: 1rem;
}
.wrap {
  flex-wrap: wrap;
}
.muted {
  color: var(--color-text-muted);
}
.max-w {
  max-width: 60ch;
}
.on-dark {
  color: #fff;
}
.hidden {
  display: none !important;
}

/* ==========================================================================
   MÉGA-MENU de navigation (dropdowns catégorisés)
   ========================================================================== */
.main-nav .nav-item {
  position: relative;
}
.main-nav .nav-item > a {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}
.main-nav .nav-item > a .caret {
  opacity: 0.55;
  transition: transform var(--dur-fast) var(--ease);
}
.main-nav .nav-item:hover > a .caret,
.main-nav .nav-item:focus-within > a .caret {
  transform: rotate(180deg);
  opacity: 1;
}
.mega {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 120;
  margin-top: 0.45rem;
  min-width: 250px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.9rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition:
    opacity var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease),
    visibility var(--dur-fast);
}
.mega::before {
  content: '';
  position: absolute;
  top: -0.5rem;
  left: 0;
  right: 0;
  height: 0.6rem;
}
.main-nav .nav-item:hover > .mega,
.main-nav .nav-item:focus-within > .mega {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.mega-right {
  left: auto;
  right: 0;
}
.mega-cols {
  display: grid;
  grid-template-columns: repeat(var(--mega-cols, 1), minmax(190px, 1fr));
  gap: 0.1rem 1.4rem;
}
.mega-lg {
  min-width: 600px;
}
.mega-lg .mega-cols {
  --mega-cols: 3;
}
.mega-title {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  font-weight: 700;
  margin: 0.3rem 0.55rem 0.35rem;
}
.mega a {
  display: block;
  padding: 0.5rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  white-space: nowrap;
}
.mega a:hover {
  background: var(--color-surface-alt);
  color: var(--color-primary);
}
.mega-foot {
  margin-top: 0.5rem;
  padding: 0.7rem 0.55rem 0.2rem;
  border-top: 1px solid var(--color-border);
}
.mega-foot a {
  color: var(--color-primary);
  font-weight: 700;
}

/* Méga-menu enrichi : entrées à icône + carte illustrée */
.mega-grid {
  display: flex;
  gap: 1.3rem;
  align-items: stretch;
}
.mega .mega-link {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.5rem 0.55rem;
  border-radius: var(--radius-sm);
  white-space: normal;
}
.mega .mega-link:hover {
  background: var(--color-surface-alt);
}
.mega-ic {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    150deg,
    var(--forest-100),
    color-mix(in srgb, var(--gold-100) 55%, var(--forest-100))
  );
  color: var(--color-primary);
}
[data-theme='dark'] .mega-ic {
  background: rgba(74, 155, 118, 0.16);
}
.mega-link b {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.25;
}
.mega-link small {
  display: block;
  font-size: 0.76rem;
  color: var(--color-text-muted);
  margin-top: 1px;
}
.mega .mega-feature {
  position: relative;
  width: 218px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  text-decoration: none;
  display: flex;
  padding: 0;
  min-height: 190px;
}
.mega-feature img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mega-feature .mf-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 32, 25, 0.1), rgba(8, 20, 15, 0.82));
}
.mega-feature .mf-txt {
  position: relative;
  align-self: flex-end;
  padding: 1rem;
}
.mega-feature .mf-txt strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: #fff;
}
.mega-feature .mf-txt span {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.88);
}
.mega-feature .mf-tag {
  position: absolute;
  top: 0.8rem;
  left: 0.8rem;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}
@media (max-width: 1000px) {
  /* Accordéon mobile : chaque parent replié par défaut, un seul ouvert à la fois */
  .main-nav.nav-open .nav-item {
    display: block;
    border-bottom: 1px solid var(--color-border);
  }
  .main-nav.nav-open .nav-item > a {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 0.85rem 0.4rem;
    box-sizing: border-box;
    font-size: 1rem;
  }
  /* le chevron redevient visible et pivote à l'ouverture */
  .main-nav.nav-open .nav-item > a .caret {
    display: inline-flex;
    margin-left: auto;
    transition: transform var(--dur-fast) var(--ease);
    opacity: 0.6;
  }
  .main-nav.nav-open .nav-item.open > a .caret {
    transform: rotate(180deg);
    opacity: 1;
  }
  .main-nav.nav-open .nav-item.open > a {
    color: var(--color-primary);
  }
  /* état fermé : le sous-menu est réellement masqué */
  .main-nav.nav-open .mega {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    margin: 0;
    min-width: 0;
    padding: 0;
    display: none;
  }
  .main-nav.nav-open .nav-item.open > .mega {
    display: block;
    padding: 0 0 0.6rem 0.4rem;
  }
  .main-nav.nav-open .mega-grid {
    display: block;
  }
  .main-nav.nav-open .mega-feature {
    display: none;
  }
  .main-nav.nav-open .mega-cols {
    display: block;
  }
  .main-nav.nav-open .mega-lg {
    min-width: 0;
  }
  .main-nav.nav-open .mega a,
  .main-nav.nav-open .mega .mega-link {
    padding: 0.7rem 0.6rem;
    min-height: 44px;
  }
  /* aucune fuite horizontale : le texte des liens se replie */
  .main-nav.nav-open .mega a,
  .main-nav.nav-open .mega-foot a {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .main-nav.nav-open .mega-foot {
    padding-left: 0;
  }
  .main-nav.nav-open {
    overflow-x: hidden;
  }
}

/* ==========================================================================
   APP SHELL — Dashboards Espace citoyen & Admin
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--color-bg);
}
.side {
  background: var(--pine-950);
  color: #cfe0d6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: auto;
}
[data-theme='dark'] .side {
  background: #070d0a;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.2rem 1.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  color: #fff;
}
.side-brand .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}
.side-brand strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.side-brand span {
  font-size: 0.66rem;
  color: #8ba99a;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
}
.side-sec {
  padding: 0.9rem 1rem 0.3rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6f8b7d;
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.3rem 0.6rem;
}
.side-nav a,
.side-nav button {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 0.8rem;
  border-radius: 10px;
  color: #c3d5ca;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition:
    background 0.15s,
    color 0.15s;
}
.side-nav a:hover,
.side-nav button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.side-nav a.active,
.side-nav button.active {
  background: var(--color-primary);
  color: #fff;
}
.side-nav .badge-count {
  margin-left: auto;
  background: var(--gold-500);
  color: #12160f;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.05rem 0.45rem;
}
.side-foot {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
}
.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.dash-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.6rem;
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.dash-topbar h1 {
  font-size: 1.35rem;
  margin: 0;
}
.dash-topbar .spacer {
  flex: 1;
}
.dash-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  min-width: 220px;
}
.dash-search input {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  color: var(--color-text);
  width: 100%;
  padding: 0;
}
.dash-body {
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}
.dash-panel {
  display: none;
  flex-direction: column;
  gap: 1.4rem;
}
.dash-panel.active {
  display: flex;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.kpi {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-xs);
}
.kpi .kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.kpi .kpi-ic {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--forest-100);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
[data-theme='dark'] .kpi .kpi-ic {
  background: rgba(74, 155, 118, 0.18);
}
.kpi strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1.1;
  margin-top: 0.5rem;
}
.kpi .trend {
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 0.25rem;
}
.trend.up {
  color: var(--ok-600);
}
.trend.down {
  color: var(--danger-600);
}

.panel-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}
.panel-card .pc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.panel-card .pc-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-family: var(--font-body);
  font-weight: 700;
}
.panel-card .pc-body {
  padding: 1.2rem;
}
.panel-card .pc-body.flush {
  padding: 0;
}

/* Statuts / pills */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}
.status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.status.new {
  color: var(--info-600);
  background: color-mix(in srgb, var(--info-600) 12%, transparent);
}
.status.progress {
  color: var(--gold-700);
  background: var(--gold-100);
}
.status.done {
  color: var(--forest-700);
  background: var(--forest-100);
}
.status.late {
  color: var(--danger-600);
  background: var(--clay-100);
}
[data-theme='dark'] .status.progress {
  background: rgba(207, 159, 67, 0.18);
}
[data-theme='dark'] .status.done {
  background: rgba(74, 155, 118, 0.2);
}
[data-theme='dark'] .status.late {
  background: rgba(179, 64, 44, 0.2);
}

/* Segmented control / filtres */
.seg {
  display: inline-flex;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: 0;
  background: none;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-muted);
  cursor: pointer;
}
.seg button.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-xs);
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--ink-300);
  border-radius: 999px;
  transition: 0.2s;
  cursor: pointer;
}
.switch .track::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .track {
  background: var(--color-primary);
}
.switch input:checked + .track::before {
  transform: translateX(18px);
}
.switch input:focus-visible + .track {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* Kanban CRM */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
@media (max-width: 1100px) {
  .kanban {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .kanban {
    grid-template-columns: 1fr;
  }
}
.kanban-col {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.kanban-col h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin: 0.2rem 0.3rem 0.4rem;
  display: flex;
  justify-content: space-between;
}
.kcard {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  box-shadow: var(--shadow-xs);
  cursor: grab;
}
.kcard:hover {
  border-color: var(--color-primary);
}
.kcard .kc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}
.kcard .kc-ref {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 700;
}
.kcard strong {
  font-size: 0.9rem;
  display: block;
}
.kcard .kc-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.74rem;
  color: var(--color-text-muted);
}

/* Mini bar chart */
.barchart {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 170px;
  padding-top: 1rem;
}
.barchart .bar {
  flex: 1;
  background: linear-gradient(var(--forest-400), var(--forest-600));
  border-radius: 8px 8px 0 0;
  position: relative;
  min-height: 6px;
  transition: height 0.6s var(--ease-out);
}
.barchart .bar span {
  position: absolute;
  bottom: -1.5rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  color: var(--color-text-muted);
}
.barchart .bar b {
  position: absolute;
  top: -1.3rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  color: var(--color-text);
}
.chart-wrap {
  padding-bottom: 1.6rem;
}

/* Donut */
.donut {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.donut::after {
  content: '';
  width: 96px;
  height: 96px;
  background: var(--color-surface);
  border-radius: 50%;
  grid-area: 1/1;
}
.donut .dv {
  grid-area: 1/1;
  z-index: 1;
  text-align: center;
}
.donut .dv strong {
  font-family: var(--font-display);
  font-size: 1.5rem;
}

/* Drawer latéral */
.drawer-back {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 15, 0.45);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.drawer-back.open {
  opacity: 1;
  pointer-events: auto;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  width: min(460px, 94vw);
  background: var(--color-surface);
  z-index: 310;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.3s var(--ease-out);
  display: flex;
  flex-direction: column;
}
.drawer.open {
  transform: none;
}
.drawer-head {
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-body {
  padding: 1.3rem;
  overflow: auto;
}

/* Login card */
.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: radial-gradient(120% 80% at 80% 0%, var(--forest-50), var(--color-bg));
}
[data-theme='dark'] .auth-wrap {
  background: radial-gradient(120% 80% at 80% 0%, rgba(74, 155, 118, 0.08), var(--color-bg));
}
.fc-btn {
  background: linear-gradient(90deg, #000091, #e1000f);
  color: #fff;
  border: none;
  width: 100%;
  padding: 0.9rem;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  margin: 1.1rem 0;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* Responsive shell */
@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }
  .side {
    position: fixed;
    z-index: 320;
    width: 264px;
    transform: translateX(-100%);
    transition: transform 0.3s;
    box-shadow: var(--shadow-lg);
  }
  .side.open {
    transform: none;
  }
  .dash-menu-btn {
    display: inline-flex !important;
  }
}
.dash-menu-btn {
  display: none;
}

/* ==========================================================================
   CMS INLINE — barre d'édition + surbrillance des éléments éditables
   ========================================================================== */
.adminbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 400;
  background: var(--pine-950);
  color: #eaf3ee;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.6rem 1.1rem;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
  max-height: 50vh;
  max-height: 50dvh;
  overflow: auto;
}
.adminbar .ab-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.85rem;
}
.adminbar .ab-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold-500);
}
.adminbar .ab-entete {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.adminbar .ab-entete a {
  color: #eaf3ee;
  font-size: 0.8rem;
  text-decoration: underline;
}
.adminbar .ab-note {
  font-size: 0.8rem;
  color: #a9c2b5;
}
.adminbar .ab-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.adminbar .ab-actions .btn-outline {
  color: #fff;
  border-color: #a9c2b5;
}
.adminbar .ab-actions .btn-ghost {
  color: #eaf3ee;
}
.adminbar .ab-outils summary {
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.5rem;
}
.adminbar .ab-outils > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
@media (max-width: 800px) {
  .adminbar {
    grid-template-columns: minmax(0, 1fr);
  }
  .adminbar .ab-actions {
    grid-column: 1;
    grid-row: auto;
  }
}
@media print {
  .adminbar {
    display: none !important;
  }
  body.cms-edition-locale {
    padding-bottom: 0 !important;
  }
  body.cms-edition-locale:not(.cms-edition-partagee)::before {
    content: 'Aperçu local — modifications non publiées';
    display: block;
    font-size: 12pt;
    font-weight: bold;
    color: #000;
    padding: 0.5rem;
    border: 1px solid #000;
  }
}
html.edit-on [data-editable],
html.edit-mode [data-cms-fragment],
html.edit-mode [contenteditable='true'] {
  outline: 2px dashed var(--gold-500);
  outline-offset: 3px;
  border-radius: 4px;
}
html.edit-mode [data-cms-fragment]:hover,
html.edit-mode [contenteditable='true']:hover {
  background: color-mix(in srgb, var(--gold-100) 60%, transparent);
}
html.edit-mode [data-cms-fragment]:focus,
html.edit-mode [contenteditable='true']:focus {
  outline: 2px solid var(--color-primary);
  background: var(--color-surface-alt);
}
html.edit-mode [data-cms-fragment] {
  white-space: pre-wrap;
}
.edit-saved-flash {
  position: fixed;
  bottom: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--forest-700);
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  z-index: 401;
  box-shadow: var(--shadow-md);
  font-weight: 600;
  font-size: 0.85rem;
}

/* ==========================================================================
   FINITIONS MOBILE — polish responsive (nav, hero, barres, tactile, iOS)
   ========================================================================== */

/* Neutralise le flash gris au tap (garde un léger retour teinté marque) */
html {
  -webkit-tap-highlight-color: transparent;
}
a,
button,
.card,
.chip {
  -webkit-tap-highlight-color: rgba(24, 74, 55, 0.12);
}

/* Verrou du défilement de fond quand le menu mobile est ouvert */
body.nav-lock {
  overflow: hidden;
}

/* Voile derrière la sidebar des dashboards (mobile) */
.side-back {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 15, 0.45);
  z-index: 315;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.side-back.open {
  opacity: 1;
  pointer-events: auto;
}

/* Bouton « revenir en haut » (injecté par app.js) */
.to-top {
  position: fixed;
  right: 1.5rem;
  bottom: calc(1.5rem + 62px + 0.75rem + env(safe-area-inset-bottom));
  z-index: 190;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  transition:
    opacity var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}
.to-top:hover {
  transform: translateY(-2px);
}
.to-top[hidden] {
  display: none;
}

/* Encoche / home-indicator iOS (nécessite viewport-fit=cover dans le <meta>) */
.chatbot-fab {
  bottom: calc(1.5rem + env(safe-area-inset-bottom));
  right: calc(1.5rem + env(safe-area-inset-right));
}
/* Chatbot et bouton haut-de-page s'effacent quand le menu mobile est ouvert */
body.nav-lock .chatbot-fab,
body.nav-lock .to-top {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Ancrages : compensation du header collant */
:target {
  scroll-margin-top: 90px;
}

@media (max-width: 640px) {
  /* — Barre d'accessibilité : cibles plus grandes, on masque le bruit — */
  .a11y-bar .container {
    justify-content: center;
    gap: 0.4rem 0.5rem;
  }
  .a11y-links {
    display: none;
  }
  .a11y-tools {
    width: 100%;
    justify-content: space-between;
    gap: 0.4rem;
  }
  .a11y-tools button {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 40px;
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
  }

  /* — Bannière d'alerte : passe en colonne, lien sur sa propre ligne — */
  .alert-bar .container {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.35rem 0.7rem;
  }
  .alert-bar a {
    margin-left: 0;
    white-space: normal;
  }

  /* — En-tête plus compact — */
  .site-header .container {
    padding-block: 0.6rem;
  }
  .brand-mark {
    width: 40px;
    height: 40px;
  }
  .header-actions {
    gap: 0.35rem;
  }
  .header-actions .btn-sm {
    min-height: 44px;
  }

  /* — Hero : titre maîtrisé, aucun débordement — */
  .hero-full .container {
    padding-block: var(--space-6);
  }
  .hero-content h1 {
    font-size: clamp(2rem, 8.5vw, 2.9rem);
    line-height: 1.12;
    text-wrap: balance;
    overflow-wrap: break-word;
  }
  .hero-content h1 br {
    display: none;
  }
  .hero-content .lede {
    font-size: 1rem;
    line-height: 1.5;
    max-width: 40ch;
  }
  .page-hero h1 {
    font-size: clamp(1.8rem, 7vw, 2.3rem);
  }
  .page-hero-photo h1 {
    font-size: clamp(1.75rem, 7vw, 2.3rem);
    text-wrap: balance;
  }
  .page-hero-photo .container {
    padding-block: var(--space-6);
  }

  /* — Présentation (deck) : slides flex 100vh -> flux normal, contenu qui se replie — */
  [id^='slide-'] {
    min-height: auto !important;
    display: block !important;
  }
  [id^='slide-'] > .container {
    min-width: 0;
    width: 100%;
  }

  /* — Cibles tactiles — */
  .chip {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  /* — iOS : empêche le zoom auto au focus des champs (< 16px) — */
  .dash-search input {
    font-size: 16px;
  }
  input,
  select,
  textarea {
    font-size: max(16px, var(--step-0));
  }

  /* — Tableaux larges : défilement horizontal interne au lieu de rogner/casser — */
  /* tout conteneur direct d'un tableau devient défilable (devis, cartes, dashboards) */
  /* !important pour surclasser les style="overflow:hidden" inline des cartes du devis */
  :has(> .table-clean) {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .panel-card .pc-body .table-clean {
    min-width: 560px;
  }
  .table-clean th,
  .table-clean td {
    padding: 0.6rem 0.7rem;
  }

  /* — Chatbot un peu plus discret — */
  .chatbot-fab {
    width: 54px;
    height: 54px;
  }
}

@media (max-width: 480px) {
  /* Boutons du hero pleine largeur, empilés proprement */
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-actions .btn {
    width: 100%;
  }
  /* Récupère de la largeur utile sur très petits écrans */
  .container {
    padding-inline: var(--space-4);
  }
}

/* ==========================================================================
   RENDU « WHOUA » — hero cinématique, typo éditoriale, nav vivante
   ========================================================================== */

/* — Typographie du hero : plus éditoriale, optical sizing Fraunces — */
.hero-content h1 {
  font-optical-sizing: auto;
  font-size: clamp(2.9rem, 2rem + 4.5vw, 5.6rem);
  letter-spacing: -0.022em;
  line-height: 1.01;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.35);
}
.hero-content .lede {
  line-height: 1.55;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.28);
}
.hero-badge {
  box-shadow:
    0 8px 24px -12px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* — Vignette cinéma + halo doré discret (profondeur) — */
.hero-full::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(115% 75% at 80% 6%, rgba(226, 190, 109, 0.16), transparent 46%),
    radial-gradient(150% 130% at 50% 108%, transparent 52%, rgba(6, 16, 12, 0.55) 100%);
}
/* — Grain éditorial très léger — */
.hero-full::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* — CTA or : halo lumineux — */
.hero-actions .btn-accent {
  box-shadow: 0 12px 34px -10px rgba(207, 159, 67, 0.55);
}
.hero-actions .btn-accent:hover {
  box-shadow: 0 18px 44px -10px rgba(226, 190, 109, 0.7);
  filter: brightness(1.05);
}

/* — Nav vivante : souligné or animé (survol + page active) — */
.main-nav > a,
.main-nav .nav-item > a {
  position: relative;
}
.main-nav > a::after,
.main-nav .nav-item > a::after {
  content: '';
  position: absolute;
  left: 0.82rem;
  right: 0.82rem;
  bottom: 0.34rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-400), var(--gold-600));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s var(--ease);
}
.main-nav > a:hover::after,
.main-nav > a.active::after,
.main-nav .nav-item:hover > a::after,
.main-nav .nav-item > a.active::after {
  transform: scaleX(1);
}

/* — En-tête « givré » qui se densifie au défilement — */
.site-header {
  transition:
    box-shadow 0.3s var(--ease),
    background 0.3s var(--ease),
    backdrop-filter 0.3s var(--ease);
}
.site-header.scrolled {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px) saturate(1.25);
  box-shadow: var(--shadow-md);
}
[data-theme='dark'] .site-header.scrolled {
  background: rgba(14, 20, 17, 0.78);
}

/* — Mouvement : uniquement si l'utilisateur l'accepte — */
@media (prefers-reduced-motion: no-preference) {
  /* Ken Burns : zoom + pan très lents sur la photo */
  .hero-media img {
    animation: kenburns 28s ease-in-out infinite alternate;
    transform-origin: 62% 42%;
    will-change: transform;
  }
  @keyframes kenburns {
    from {
      transform: scale(1.04);
    }
    to {
      transform: scale(1.13) translate3d(-1.6%, -1.2%, 0);
    }
  }
  /* Entrée en cascade du contenu du hero */
  .hero-content > * {
    animation: heroRise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .hero-content > .hero-badge {
    animation-delay: 0.12s;
  }
  .hero-content > h1 {
    animation-delay: 0.26s;
  }
  .hero-content > .lede {
    animation-delay: 0.44s;
  }
  .hero-content > .hero-actions {
    animation-delay: 0.6s;
  }
  @keyframes heroRise {
    from {
      transform: translateY(22px) scale(0.985);
    }
    to {
      transform: none;
    }
  }
}

/* Champ anti-robots hors écran, hors navigation au clavier et des lecteurs d’écran. */
.mdp-piege {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
[data-mdp='demo-notice'][hidden] {
  display: none;
}

/* Gestion partagée du portail */
.gestion-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.gestion-ligne p {
  margin: 0.25rem 0 0;
}
.gestion-form {
  display: grid;
  gap: 1rem;
  max-width: 640px;
  margin-bottom: 1.5rem;
}
.gestion-form input {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
}
