/* Site vitrine (accueil et /app), chargé après styles.css : cf. docs/spec-site-vitrine.md.
   Les pages légales n'utilisent que styles.css (colonne étroite). */

.vitrine .header,
.vitrine .footer {
  max-width: 1080px;
}

.vitrine main {
  max-width: none;
  padding: 0;
}

.vitrine .header {
  position: sticky;
  top: 0;
  z-index: 10;
  max-width: none;
  padding: 12px max(16px, calc((100% - 1048px) / 2));
  gap: 16px;
  background: var(--bg);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.logo img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.nav-vitrine {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-vitrine a:not(.bouton) {
  color: var(--text-secondary);
  text-decoration: none;
}

.nav-vitrine a:not(.bouton):hover {
  color: var(--text-primary);
}

.nav-vitrine .bouton {
  margin-top: 0;
  padding: 8px 16px;
  font-size: 15px;
}

@media (max-width: 720px) {
  .nav-vitrine a:not(.bouton) {
    display: none;
  }
}

/* Bouton 3D : il s'enfonce au clic, comme dans l'app. */
.bouton {
  transition: transform 80ms ease, border-bottom-width 80ms ease;
}

.bouton:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

/* Un <button> n'hérite ni de la police ni des bords : on le ramène au bouton 3D. */
button.bouton {
  font: inherit;
  font-weight: 800;
  border: 0;
  border-bottom: 4px solid var(--brand-dark);
  cursor: pointer;
}

.bouton-clair {
  background: var(--on-brand);
  color: var(--brand);
  border-bottom-color: rgba(0, 0, 0, 0.18);
}

.bouton-contour {
  background: transparent;
  color: var(--on-brand);
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-bottom-width: 4px;
}

.bouton-secondaire {
  background: var(--bg);
  color: var(--text-primary);
  border: 2px solid var(--border);
  border-bottom: 4px solid var(--border-strong);
}

.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 72px 16px;
}

.bande-surface {
  background: var(--surface);
}

.surtitre {
  display: inline-block;
  color: var(--brand);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.section h2 {
  font-size: 30px;
  line-height: 1.2;
  margin: 0 0 12px;
}

.chapo {
  color: var(--text-secondary);
  font-size: 19px;
  max-width: 640px;
  margin: 0 0 32px;
}

/* --- Hero ---------------------------------------------------------------- */

.hero-vitrine {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: var(--on-brand);
}

/* Personnage à gauche, coupé aux genoux et posé sur le bas du hero ; texte à droite. */
.hero-grille {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 48px;
  align-items: center;
  padding-top: 40px;
  padding-bottom: 0;
}

.personnage {
  display: block;
  align-self: end;
  width: auto;
  height: 600px;
  max-width: 40vw;
  object-fit: contain;
  object-position: bottom;
}

.hero-texte {
  padding: 32px 0 64px;
}

@media (max-width: 860px) {
  .hero-grille {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 48px;
    text-align: center;
  }

  /* Sur mobile, le texte d'abord, le personnage dessous. */
  .personnage {
    order: 1;
    justify-self: center;
    height: 380px;
    max-width: none;
  }

  .hero-texte {
    padding: 0 0 24px;
  }
}

.hero-vitrine .surtitre {
  color: var(--on-brand);
  opacity: 0.85;
}

.hero-vitrine h1 {
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.1;
  margin: 0 0 20px;
}

.hero-vitrine .chapo {
  color: var(--on-brand);
  opacity: 0.92;
  margin: 0 0 32px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 12px 16px;
}

.hero-actions .bouton {
  margin-top: 0;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 40px 0 0;
}

.stats li {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 15px;
}

.stats strong {
  font-weight: 800;
}

/* Arrière-plan du hero : les décors du chemin (components/learn/Decor.tsx), en grand,
   qui dérivent lentement derrière un voile flou. Position, taille et mouvement de
   chacun sont réglés dans index.html par variables (--x, --y, --t, --dx, --dy, --r, --d). */
.hero-fond {
  position: absolute;
  inset: 0;
  filter: blur(5px);
  opacity: 0.6;
  pointer-events: none;
}

.decor {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--t);
  height: var(--t);
  animation: derive var(--d, 16s) ease-in-out infinite;
  animation-delay: var(--delai, 0s);
}

@keyframes derive {
  0%, 100% { transform: translate(0, 0) rotate(calc(var(--r) * -1)); }
  33% { transform: translate(var(--dx), calc(var(--dy) * -1)) rotate(var(--r)); }
  66% { transform: translate(calc(var(--dx) * -0.6), var(--dy)) rotate(0deg); }
}

@media (max-width: 860px) {
  .decor { width: calc(var(--t) * 0.6); height: calc(var(--t) * 0.6); }
  .hero-vitrine .chapo { margin-left: auto; margin-right: auto; }
  .hero-actions, .stats { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .decor { animation: none; }
  .bouton { transition: none; }
}

/* --- L'app ---------------------------------------------------------------- */

.app-grille {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

@media (max-width: 860px) {
  .app-grille {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.atouts {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: grid;
  gap: 16px;
}

.atouts li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.atouts img {
  flex: none;
  width: 44px;
  height: 44px;
}

.atouts strong {
  display: block;
  font-weight: 800;
}

.atouts span {
  color: var(--text-secondary);
}

.stores {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.stores a {
  display: inline-block;
  line-height: 0;
}

/* Les deux badges officiels à la même hauteur (PNG Google recadré sur son contour). */
.badge-apple,
.badge-google {
  height: 52px;
  width: auto;
}

/* Téléphones : captures défilantes, au doigt ou par les flèches (vitrine.js). */
.carrousel {
  min-width: 0;
}

.telephones {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 8px 4px 4px;
  scrollbar-width: none;
}

.telephones::-webkit-scrollbar {
  display: none;
}

.fleches {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

/* Bouton rond 3D, comme les nœuds du chemin. */
.fleche {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-primary);
  border: 2px solid var(--border);
  border-bottom: 4px solid var(--border-strong);
  cursor: pointer;
  transition: transform 80ms ease, border-bottom-width 80ms ease;
}

.fleche:active:not(:disabled) {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.fleche:disabled {
  opacity: 0.4;
  cursor: default;
}

.fleche svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.telephone {
  flex: none;
  width: 220px;
  scroll-snap-align: center;
  margin: 0;
}

.telephone img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 28px;
  border: 8px solid var(--text-primary);
  background: var(--bg);
}

.telephone figcaption {
  text-align: center;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 15px;
  margin-top: 10px;
}

/* --- Cartes ---------------------------------------------------------------- */

.cartes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 860px) {
  .cartes {
    grid-template-columns: 1fr;
  }
}

.carte {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 2px solid var(--border);
  border-bottom-width: 4px;
  border-radius: var(--radius-lg);
  padding: 24px;
}

.carte > img {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
}

.carte h3 {
  font-size: 20px;
  margin: 0 0 8px;
}

.carte p {
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.carte .liens {
  margin-top: auto;
  display: grid;
  gap: 6px;
  font-size: 16px;
}

.carte .liens a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

/* Icônes lucide (chevron-right, circle-play) peintes à la couleur du lien. */
.lien-suite::after,
.lien-video::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--icone) center / contain no-repeat;
  mask: var(--icone) center / contain no-repeat;
}

.lien-suite::after {
  --icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
}

.lien-video::before {
  --icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m10 8 6 4-6 4z' fill='black'/%3E%3C/svg%3E");
}

.carte .liens a:hover {
  text-decoration: underline;
}

/* Cartes des trois thèmes, aux couleurs de l'app (accents de theme/tokens.ts). */
.theme-incendie { --accent: var(--incendie); --accent-dark: var(--incendie-dark); --accent-soft: var(--incendie-soft); }
.theme-surete { --accent: var(--surete); --accent-dark: var(--surete-dark); --accent-soft: var(--surete-soft); }
.theme-secourisme { --accent: var(--secourisme); --accent-dark: var(--secourisme-dark); --accent-soft: var(--secourisme-soft); }

.carte-theme {
  background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--bg);
  border-color: var(--accent);
  border-bottom-color: var(--accent-dark);
}

.carte-theme .liens a {
  color: var(--accent);
}

.pastille {
  align-self: flex-start;
  background: var(--accent);
  color: var(--on-brand);
  font-weight: 800;
  font-size: 13px;
  border-radius: 999px;
  padding: 2px 12px;
  margin-bottom: 12px;
}

/* --- Vidéos : façade, le lecteur ne se charge qu'au clic (cf. /confidentialite) --- */

.media-grille {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 32px;
  align-items: center;
}

@media (max-width: 860px) {
  .media-grille {
    grid-template-columns: 1fr;
  }
}

.facade {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  background: var(--lecteur-bg);
  color: var(--lecteur-text);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
}

.facade-youtube {
  aspect-ratio: 16 / 9;
}

.facade-tiktok {
  min-height: 420px;
}

.facade p {
  margin: 0;
  max-width: 360px;
  font-size: 14px;
  opacity: 0.75;
}

.facade .bouton {
  margin-top: 4px;
}

.facade img {
  width: 72px;
  height: 72px;
}

.lecteur-youtube {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius-lg);
}

.lecteur-tiktok {
  display: flex;
  justify-content: center;
  min-height: 420px;
}

.media-texte h3 {
  margin-top: 0;
  font-size: 20px;
}

.media-texte p {
  color: var(--text-secondary);
}

.media-texte .bouton {
  margin-top: 8px;
}

/* --- Appel final ---------------------------------------------------------- */

.appel {
  text-align: center;
}

.appel .chapo {
  margin-left: auto;
  margin-right: auto;
}

.appel .stores {
  justify-content: center;
}

.icone-app {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  margin-bottom: 16px;
}

.vitrine .footer {
  margin-top: 0;
}

/* --- Page /app (QR code) --------------------------------------------------- */

.page-qr {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-qr main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 16px;
}

.page-qr .icone-app {
  width: 112px;
  height: 112px;
  border-radius: 26px;
}

.page-qr h1 {
  font-size: 30px;
}

.page-qr p {
  color: var(--text-secondary);
  max-width: 420px;
  margin: 0 auto 28px;
}

.page-qr .stores {
  flex-direction: column;
  justify-content: center;
}

/* --- Bandeau de consentement (lecteurs YouTube et TikTok) -------------------- */

/* En bas à droite sur ordinateur, pleine largeur (marges de 16 px) sur mobile. */
.bandeau-cookies {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  margin: 0;
  background: var(--bg);
  border: 2px solid var(--border);
  border-bottom-width: 4px;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  font-size: 15px;
}

@media (min-width: 640px) {
  .bandeau-cookies {
    left: auto;
    width: 400px;
  }
}

.bandeau-cookies[hidden] {
  display: none;
}

.bandeau-cookies p {
  margin: 0 0 8px;
  color: var(--text-secondary);
}

.bandeau-cookies p strong {
  color: var(--text-primary);
  font-size: 17px;
}

/* Accepter et Refuser : même taille, Refuser aussi visible qu'Accepter (CNIL). */
.bandeau-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.bandeau-actions .bouton {
  flex: 1;
  margin-top: 0;
  padding: 10px 16px;
}

button.bouton-secondaire {
  border: 2px solid var(--border);
  border-bottom: 4px solid var(--border-strong);
}
