/* --------- RESET --------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #fa0032;
  --secondary: #fd92bb;
  --muted: #ffcc00;
  --dark: #050505;
  --light: #e3e3e3;
  --grey: #888;
}

/* --------- BASE --------- */
h1, h2, h3, h4, p {
  margin-bottom: 1em;
  line-height: 1.35em;
}

hr {
  border-top: 1px solid var(--muted);
  margin: 1em 0;
}

strong {
  letter-spacing: 1px;
}

body {
  background: var(--dark);
  color: var(--light);
  font-size: 20px;
  line-height: 1.35em;
  font-family: "Poppins", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  overflow: hidden;
  padding: 5px;
}

.started {
  width: 100%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#start-button {
  top: 50%;
  left: 50%;
  position: relative;
  margin-bottom: 2em;
  font-size: larger;
  translate: -50%;
  border: none;
  border-radius: 15px;
  padding: 0.5em 1em;
  box-shadow:
    0 0 0 1px #b93802 inset,
    0 0 0 2px rgba(255, 255, 255, 0.15) inset,
    5px 8px 0 0 #aa0000,
    0 8px 8px 1px rgba(0, 0, 0, 0.5);
  background-color: #d73814;
  font-family: "Poppins";
  font-weight: bolder;
  color: white;
  width: min-content;
  animation: pulse 1s infinite;
}

#start-button:hover {
  cursor: pointer;
  background-color: #ff4500;
}

#start-button:active {
  box-shadow:
    0 0 0 1px #b93802 inset,
    0 0 0 1px rgba(255, 255, 255, 0.15) inset,
    0 1px 3px 1px rgba(0, 0, 0, 0.3);
  background-color: #aa0000;
  transform: translateY(6px) translateX(5px);
  animation: none;
}

.started.camera-container {
  left: 50%;
  transform: translateX(-50%);
}

.hidden {
  display: none;
}

a {
  color: var(--dark);
  text-decoration-color: var(--primary);
  text-decoration-style: dotted;
}

/* --------- LIENS AVEC COINS --------- */
.text a {
  position: relative;
  color: var(--muted);
  text-decoration: none;
  border: 1px dashed #ffcc00;
  transition: color 0.1s ease;
}

.text a:hover {
  color: var(--primary);
  border-color: rgba(250, 0, 50, 0.5);
}

.text a::before, .text a::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-color: var(--muted);
  border-style: solid;
  transition: all 0.1s ease;
  transform: translateZ(0);
}

/* Coin haut gauche */
.text a::before {
  top: -4px;
  left: -4px;
  border-width: 2px 0 0 2px;
}
/* Coin bas droit */
.text a::after {
  bottom: -4px;
  right: -4px;
  border-width: 0 2px 2px 0;
}
.text a:hover::before, .text a:hover::after {
  border-color: var(--primary);
}
.text a:hover::before {
  top: -2px;
  left: -2px;
}

.text a:hover::after {
  bottom: -2px;
  right: -2px;
}

blockquote {
  --b: 2px; /* épaisseur de bordure */
  --s: 30px; /* taille des coins */
  --g: 2px; /* espace intérieur */
  --c: var(--muted);
  text-decoration: none;
  color: inherit;
  position: relative;
  padding: calc(var(--b) + var(--g));
  overflow: visible;
  margin: 2em;

  background-image:
    conic-gradient(
      from 90deg at top var(--b) left var(--b),
      #0000 25%,
      var(--c) 0
    ),
    conic-gradient(
    from -90deg at bottom var(--b) right var(--b),
    #0000 25%,
    var(--c) 0
  );
  background-position:
    0% 0%,
    0% 0%; /* Position initiale : coin en haut à gauche */
  background-size: var(--s) var(--s);
  background-repeat: no-repeat;

  /* Animation initiale : texte invisible */
  opacity: 0;
  transform: translateY(20px);
}

/* Animation quand l'élément est visible */
blockquote.visible {
  animation:
    slideCorner 0.8s ease-out forwards,
    fadeInText 0.8s ease-out 0.4s forwards;
}

@keyframes slideCorner {
  0% {
    background-position: 0% 0%, 0% 0%;
  }
  100% {
    background-position: 0% 0%, 100% 100%;
  }
}

@keyframes fadeInText {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------- INTERTITRES --------- */
h2.visor {
  border-left: 5px solid var(--primary);
  padding-left: 0.5em;
  margin-top: 3em;
}

h3.visor {
  border-left: 4px solid var(--primary);
  padding-left: 0.4em;
  margin-top: 3em;
}

/* --------- HERO CONTAINER --------- */
.hero {
  position: relative;
  height: 100vh;
  width: 100%;
  background-color: #050505;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
.hero .hint {
  position: absolute;
  bottom: 8vh;
  inset-inline: 0;
  width: max-content;
  margin-inline: auto;
  font-size: 0.9rem;
  background: var(--primary);
  padding: 10px 20px;
  border-radius: 50px;
  color: white;
  animation: downup 1.1s ease-in-out infinite;
  text-align: center;
  z-index: 10;
}

@keyframes downup {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(15px);
  }
}

/* Sticky Navigation */
.sticky-nav {
  position: fixed;
  top: 0;
  text-align: center;
  z-index: 9999;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  background-color: whitesmoke;
  max-height: 50px;
  width: 100%;
}

.nav-links {
  display: flex;
  justify-content: start;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  text-decoration: none;
  margin: 0 20px;
}

.nav-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  font-size: 1.2rem;
  color: var(--dark);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}

/* Barre de progression */
.scroll-progress {
  position: absolute;
  bottom: -5px;
  left: 0;
  height: 5px;
  width: 0%;
  background: var(--primary);
  transition: width 0.2s ease-out;
  z-index: 5;
}

/* Quand la nav devient "active" (après le hero) */
.sticky-nav.active .nav-title {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.share-links {
  display: flex;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0 auto;
  position: relative;
  left: 50%;
  transform: translate(-50%);
  pointer-events: all;
}

.share-links li {
  margin: 0 20px;
}

.share-links a {
  color: var(--primary);
  font-weight: bold;
  font-size: 1.2rem;
  transition: color var(--transition-speed);
  text-decoration: none;
  width: 45px;
  height: 45px;
  display: block;
}

.share-links svg {
  fill: var(--primary);
  background: white;
  padding: 7px;
  border-radius: 25px;
}

.logo {
  height: 25px;
  z-index: 50;
}

.logo img:hover {
  background: none;
  filter: drop-shadow(0 0 5px var(--muted));
}

.next-articles {
  border-left: 1px solid var(--primary);
  padding: 1em;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-gap: 20px;
  grid-auto-rows: minmax(150px, auto);
}

.linky {
  background: var(--light);
  color: black;
  padding: 1em;
  border-radius: 7px;
}

.linky img {
  width: 100%;
  display: block;
}

.next-articles a {
  color: black;
  text-decoration: underline;
  font-weight: bold;
}

.fade {
  opacity: 0.6;
}

/* --------- HEADLINE + VISEUR --------- */
.headline {
  position: relative;
  display: inline-block;
  grid-column: 1 / -1;
  align-self: center;
  font-size: clamp(2rem, 6vw, 5rem);
  color: #fff;
  text-transform: uppercase;
  text-align: center;
  z-index: 5;
  opacity: 0;
  animation: headlineAppear 1.5s ease-out 1s forwards;
}

.headline span {
  position: relative;
  display: inline-block;
  padding: 0 0.05em;
}

@keyframes headlineAppear {
  0% {
    opacity: 0;
    transform: scale(0.9);
    filter: blur(4px);
  }
  60% {
    opacity: 1;
    transform: scale(1.02);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

.viseur {
  position: absolute;
  top: 0;
  left: 0;
  width: 1.4em;
  height: 1.4em;
  pointer-events: none;
  transition:
    top 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 200, 0, 0.1) 2px,
    rgba(255, 200, 0, 0.1) 3px
  );
}

.viseur::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 200, 0, 0.9);
  box-shadow:
    0 0 10px rgba(255, 200, 0, 0.6),
    inset 0 0 10px rgba(255, 200, 0, 0.3);
  animation: scan 1.5s ease-in-out infinite;
}

.viseur::after {
  content: "";
  position: absolute;
  inset: -4px;
  background:
    linear-gradient(
      90deg,
      #ffcc00 0%,
      #ffcc00 25%,
      transparent 25%,
      transparent 75%,
      #ffcc00 75%,
      #ffcc00 100%
    ),
    linear-gradient(
    0deg,
    #ffcc00 0%,
    #ffcc00 25%,
    transparent 25%,
    transparent 75%,
    #ffcc00 75%,
    #ffcc00 100%
  );
  background-size: 100% 2px, 2px 100%;
  background-position: 0 0, 0 0;
  background-repeat: no-repeat;
  opacity: 0.8;
  filter: drop-shadow(0 0 3px rgba(255, 200, 0, 0.8));
}

@keyframes scan {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

/* --------- SILHOUETTE --------- */
.observer {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-55%);
  height: 700px;
  max-height: 65vh;
  z-index: 10;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 80%,
    rgba(0, 0, 0, 0) 100%
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 80%,
    rgba(0, 0, 0, 0) 100%
  );
}

/* --------- GRID OF SCREENS --------- */
.screens-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
  width: 85vw;
  max-width: 1400px;
  aspect-ratio: 2 / 1;
  position: relative;
}

.screens-grid::before {
  content: "";
  position: absolute;
  inset: -20px;
  background: radial-gradient(
    circle at center,
    rgba(50, 50, 50, 0.3) 0%,
    rgba(0, 0, 0, 0.9) 100%
  );
  filter: blur(10px);
  z-index: 0;
  pointer-events: none;
}

.screen {
  background-color: #0a0a0a;
  border: 1px solid #222;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  position: relative;
  opacity: 0;
  transform: scale(0.95);
  animation:
    flicker 0.8s ease-in-out infinite alternate,
    powerOn 0.5s ease-out forwards;
  animation-delay: 0s, calc(var(--i) * 0.08s);
}

.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.04) 1px,
    transparent 2px
  );
  mix-blend-mode: overlay;
  pointer-events: none;
}

.screen img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

@keyframes flicker {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.97;
  }
}

@keyframes powerOn {
  0% {
    opacity: 0;
    filter: brightness(0.2) blur(3px);
  }
  60% {
    opacity: 1;
    filter: brightness(1.4);
  }
  100% {
    opacity: 1;
    filter: brightness(1);
  }
}

/* --------- TEXT --------- */
.part {
  max-width: 700px;
  margin: 1em auto;
}
.part.intro {
  padding: 1em;
  margin: 1em auto 4em;
  box-shadow: inset 2px 0 0 var(--muted);
  font-weight: bold;
  letter-spacing: 1px;
  font-size: 1.1em;
  text-align: justify;
}
.highlight-number {
  color: var(--grey);
  padding: 2em;
  font-size: 0.9em;
  font-weight: 300;
  text-align: center;
}

.big-number {
  display: block;
  font-weight: 700;
  font-size: clamp(3rem, 10vw, 8rem);
  color: var(--muted, #ffcc00);
  line-height: 1;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.8s ease-out;
  text-align: center;
}

/* Quand visible */
.big-number.visible {
  opacity: 1;
  transform: scale(1);
}

.lr-line {
  display: flex;
  gap: 1em;
  margin-bottom: 1.5em;
  line-height: 1.2em;
}
.lefty {
  width: 45%;
  text-align: right;
  font-weight: 200;
  color: var(--grey);
}
.righty {
  width: 45%;
  text-align: left;
}

#part1::first-letter {
  font-size: 7rem;
  font-weight: bold;
  float: left;
  line-height: 1;
  margin-right: 8px;
  color: var(--primary);
}

.hors-texte {
  float: left;
  width: 30%;
  background: var(--light);
  color: black;
  padding: 1em;
  font-size: 0.75em;
  line-height: 1.3em;
  margin: 0 2em 1em;
  letter-spacing: 0.3px;
}
.hors-texte h4 {
  margin-top: 0;
  font-size: 1.1em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.2em;
}

.inside {
  padding: 1em;
  color: white;
  font-size: 1.5em;
  line-height: 1.5em;
  font-weight: 700;
}

.inside span {
  color: #a6a6a6;
  font-size: 0.7em;
  font-weight: 200;
}

/* ------ MAP ---- */
#map {
  width: 100%;
  max-width: 900px;
  height: 100vh;
  max-height: 650px;
  margin: 0 auto 3em;
  box-shadow: rgba(96, 96, 96, 0.3) 0px 4px 15px;
}

.leaflet-interactive.missing-hatch {
  fill: url(#diagonalHatch) !important;
  fill-opacity: 1 !important;
}

.legend.leaflet-control {
  background: #1b1b1b;
  padding: 0.5em 1em;
}

.legend .swatch {
  display: inline-block;
  width: 20px;
  height: 10px;
  margin-right: 6px;
  border-radius: 2px;
  vertical-align: middle;
}

.legend .hatch-swatch {
  border: 1px solid #777;
  background: repeating-linear-gradient(
    45deg,
    #cfcfcf 0 6px,
    #8a8a8a 6px 8px
  );
}

/* --------- PANNEAU D’INFORMATION --------- */
.info-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 350px;
  height: 100vh;
  background: #1b1b1b;
  color: #fff;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.5);
  transition: right 0.4s ease;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  will-change: transform;
  backface-visibility: hidden;
  overflow: auto;
}

.info-panel.open {
  right: 0;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: var(--muted, #ffcc00);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.close-btn:hover {
  transform: scale(1.2);
}

/* --------- BAR CHART --------- */
.bar-container {
  position: relative;
  width: 80%;
  height: 20px;
  background: #222;
  margin: 0.5rem auto 2em;
}

.bar-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, #fff5f0, #fb6a4a, #67000d);
}

.bar-average {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--grey);
  left: 50%;
  z-index: 3;
}

.bar-average::before {
  content: "Moyenne";
  position: relative;
  left: -4ch;
  font-size: 0.6em;
  top: 1em;
  color: var(--grey);
}

.bar-indicator {
  position: absolute;
  top: -8px;
  width: 2px;
  height: 28px;
  background: var(--muted, #ffcc00);
  box-shadow: 0 0 8px rgba(255, 204, 0, 0.5);
  z-index: 4;
  transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#barIndicator::before {
  content: "Ma commune";
  font-size: 0.6em;
  width: max-content;
  position: absolute;
  top: -10px;
  left: -50%;
  background: var(--muted);
  padding: 0 0.3em 0;
  height: 13px;
  line-height: 1em;
  color: black;
  transform: translateX(-50%);
}

.bar-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--grey);
  margin-top: 1.1rem;
  padding-top: 1.2em;
}

.info-content h2 {
  color: var(--muted);
  margin-bottom: 1rem;
  margin-top: 1em;
}

.info-content p {
  font-size: 1rem;
  line-height: 1.2;
}

.comment {
  padding: 1em;
  border-radius: 10px;
  border: 1px solid var(--muted);
  margin-top: 2em;
}

.metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2em;
}

.metric .label {
  font-size: 1rem;
  color: #ccc;
}

.label {
  font-size: 1rem;
  color: #ccc;
}

.metric .value {
  font-size: 2rem;
  font-weight: 700;
  color: white;
}

/* -------- STYLE DE LA LÉGENDE DE LA CARTE -------- */
.legend.leaflet-control {
  padding: 0.5em 1em;
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 0.9rem;
  line-height: 1.4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  background: rgba(88, 88, 88, 0.6);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(5px);
}

.legend.leaflet-control strong {
  display: block;
}

.legend.leaflet-control i {
  display: inline-block;
  width: 18px;
  height: 10px;
  margin-right: 6px;
  vertical-align: middle;
}

.search-box-map {
  position: relative;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(300px, 50%, 600px);
  z-index: 1200;
}

#search {
  width: 100%;
  padding: 1rem 3rem 1rem 1.5rem;
  background: var(--dark);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  transition: all 0.3s ease;
}

#search:focus {
  outline: none;
  border-color: var(--muted);
  box-shadow: 0 0 20px rgba(255, 204, 0, 0.2);
}

#search::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

#search::-webkit-calendar-picker-indicator {
  display: none;
}

#search {
  background-image: url("data:image/svg+xml,%3Csvg fill='white' xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath d='M10 2a8 8 0 015.292 13.708l4 4a1 1 0 01-1.414 1.414l-4-4A8 8 0 1110 2zm0 2a6 6 0 100 12 6 6 0 000-12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 18px;
}

.legend-map {
  position: absolute;
  bottom: 30px;
  left: 10px;
  background: white;
  padding: 8px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  font-family: sans-serif;
  font-size: 13px;
  line-height: 1.2em;
}

/* --------- CAMERA ANIMATION --------- */
.camera-container {
  position: relative;
  width: 100%;
  height: 200px;
}
.tracking-info {
  display: none;
}
/* Support mural */
.wall-mount {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 70px;
  background: linear-gradient(
    135deg,
    #2a2a2a 0%,
    #1a1a1a 100%
  );
  border-radius: 50%;
  z-index: 1;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
}
/* Corps de la caméra qui se déplace en cercle */
.camera-body {
  position: absolute;
  top: 50%;
  left: 50%;
  transition: transform 0.2s ease-out;
  z-index: 3;
}
/* Base de la caméra */
.camera-base {
  width: 120px;
  height: 70px;
  background: linear-gradient(
    180deg,
    #3a3a3a 0%,
    #1a1a1a 100%
  );
  border-radius: 10px;
  position: relative;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  border: 1px solid #333232;
}
/* Objectif de la caméra */
.camera-lens {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 55px;
  height: 55px;
  background: radial-gradient(circle at 30% 30%, #4a4a4a, #1a1a1a);
  border-radius: 50%;
  border: 3px solid #2a2a2a;
  z-index: 2;
  transform: translate(-50%, -50%);
  transform-origin: center;
  will-change: transform;
}
/* Lentille interne */
.lens-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 35px;
  height: 35px;
  background: radial-gradient(circle at 35% 35%, #667, #223);
  border-radius: 50%;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.9);
}
/* Reflet sur la lentille */
.lens-inner::after {
  content: "";
  position: absolute;
  top: 20%;
  left: 20%;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  filter: blur(1px);
}
/* LED rouge */
.led {
  position: absolute;
  bottom: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  background: #ff0000;
  border-radius: 50%;
  box-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000;
  }
  50% {
    opacity: 0.2;
    box-shadow: 0 0 5px #ff0000;
  }
}

/* -------- MOVING WORDS ------- */
.moving-word {
  position: relative;
  padding: 60px 0;
  color: var(--muted);
  transform: rotate(-4deg);
  overflow: hidden;
}

.scroll-line {
  font-size: 48px;
  font-weight: bold;
  white-space: nowrap;
  margin: 10px 0;
  will-change: transform;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1em;
}

.scroll-line.right {
  color: white;
}

/* -------- STRUCTURE -------- */
.density-comparison {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
  margin: -2em auto 2rem;
  perspective: 1500px;
  flex-wrap: wrap;
}

/* -------- ZONE (représentation 1 km²) -------- */
.zone {
  position: relative;
  width: 25vw;
  height: 25vw;
  min-width: 200px;
  min-height: 200px;
  background: var(--light);
  border: 1px solid #444;
  transform: rotateX(45deg) rotateZ(0deg);
  transform-style: preserve-3d;
  margin-bottom: 3rem;
  max-width: 450px;
  max-height: 450px;
}

/* effet de profondeur (ombre au sol) */
.zone::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), transparent 80%);
  transform: translateZ(-1px);
  pointer-events: none;
}

/* -------- PICTOS - Grille centrée -------- */
.cam,
.people {
  display: grid;
  place-items: center;
  padding: 0.5rem;
  width: 100%;
  height: 100%;
  transform-style: flat;
  overflow: hidden;
  justify-content: space-evenly;
}

.cam img,
.people img {
  display: block;
  max-width: 100%;
  height: auto;
}

.cam img {
  width: clamp(45px, 4.5vw, 80px);
}

.people img {
  width: clamp(12px, 1.5vw, 18px);
}

/* -------- LABEL -------- */
.zone::before {
  position: absolute;
  bottom: -2.5rem;
  left: 50%;
  transform: translateX(-50%) rotateX(-45deg);
  color: var(--muted);
  font-family: "Poppins", sans-serif;
  font-size: clamp(1rem, 1.8vw, 1.3rem);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

#zone-cams::before {
  content: "~1,9 caméra/km²";
}

#zone-people::before {
  content: "186 habitants/km²";
}

/* --------- DONUT SECTION --------- */
.donut-section {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 30vh;
  color: #fff;
  font-family: "Poppins", sans-serif;
  z-index: 5;
  position: relative;
  margin: 2em auto;
}

.donut-wrapper {
  position: relative;
  width: 240px;
  height: 240px;
}

.donut {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-bg {
  fill: none;
  stroke: #222;
  stroke-width: 10;
}

.donut-ring {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 2s ease-out;
}

.donut-center {
  position: absolute;
  top: 51%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--muted, #ffcc00);
  padding: 5px 0;
}

.donut-label {
  font-size: 0.85rem;
  color: #aaa;
  margin-top: 0.25rem;
}

.donut-wrapper--lg {
  width: 320px;
  height: 320px;
}

.donut-block {
  position: relative;
  margin-top: 3em;
}

.donut-links {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.donut-link {
  stroke: var(--line, #666);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

/* -------- TABLEAU TOP 5 -------- */
.table-container {
  width: 100%;
  max-width: 600px;
  margin: 2rem auto;
}
.search-box {
  position: relative;
  margin-bottom: 1.5rem;
}

#communeSearch {
  width: 100%;
  padding: 1rem 3rem 1rem 1.5rem;
  background: var(--dark);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  transition: all 0.3s ease;
}

#communeSearch {
  background-image: url("data:image/svg+xml,%3Csvg fill='white' xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath d='M10 2a8 8 0 015.292 13.708l4 4a1 1 0 01-1.414 1.414l-4-4A8 8 0 1110 2zm0 2a6 6 0 100 12 6 6 0 000-12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 18px;
}

#communeSearch:focus {
  outline: none;
  border-color: var(--muted);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

#communeSearch::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

#communeSearch::-webkit-calendar-picker-indicator {
  display: none;
}

.search-icon {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  pointer-events: none;
  opacity: 0.4;
}
.top5 {
  width: 100%;
  max-width: 600px;
  margin: 2rem auto;
  border-collapse: separate;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(96, 96, 96, 0.3);
  text-align: center;
}

.top5 th {
  background: var(--muted);
  color: black;
  padding: 1rem 0.5rem;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #444;
}

.top5 th:first-child {
  text-align: center;
  width: 100px;
}

.top5 tr {
  transition: all 0.3s ease;
}

.top5 tr:hover:not::nth-child(1) {
  transform: translateX(4px);
}

.top5 td {
  padding: 0.6rem 1.5rem;
  color: #fff;
  font-family: "Poppins", sans-serif;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.top5 tr:last-child td {
  border-bottom: none;
}

.top5 td:first-child {
  font-size: 0.9rem;
  color: var(--grey);
  width: 80px;
}

.search-result-row {
  background: rgba(100, 150, 255, 0.15) !important;
  box-shadow: -3px 0px 0px var(--muted);
  animation: slideIn 0.4s ease-out;
}

.search-result-row td {
  font-weight: 600 !important;
}

.top5 tbody tr.highlighted {
  background: rgba(150, 150, 150, 0.2) !important;
  box-shadow: -3px 0px 0px var(--muted);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------- RESPONSIVE --------- */
@media (max-width: 550px) {
  body {
    font-size: 16px;
  }
  .screens-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 4px;
    width: 95vw;
    aspect-ratio: 2 / 3;
  }
  .camera-section {
    float: none;
  }
  .camera-container {
    width: 100%;
  }
  .observer {
    height: 60%;
  }
  .headline {
    font-size: clamp(1.5rem, 6vw, 3rem);
    padding: 0.3em 0;
  }
  .zone {
    width: 80vw;
    height: 80vw;
    margin-bottom: 0;
  }
  .density-comparison {
    gap: 0;
  }
  .text a {
    display: initial;
  }
  .nav-title {
    font-size: 0.8rem;
  }
  #part1 p::first-letter {
    font-size: 5rem;
  }
  section {
    padding: 5px;
  }
  .part.intro {
    text-align: left;
  }
  .hors-texte {
    clear: both;
    width: initial;
  }
  .donut-section {
    margin: 4em auto;
  }
  .table-container {
    overflow: auto;
  }
  .top5 th {
    padding: 0.2rem 0.3rem;
    font-weight: 400;
    font-size: 0.7rem;
  }
  .top5 td {
    padding: 0.6rem 0.5rem;
  }
  blockquote {
    margin: 2rem 0.5rem;
  }
  .scroll-line {
    font-size: 2em;
  }
  .inside {
    font-size: 1.2em;
  }
  #map {
    height: 48vh;
  }
  .next-articles {
    padding: 0.5em;
    grid-template-columns: repeat(1, 1fr);
    grid-gap: 10px;
    grid-auto-rows: auto;
  }
}
