/* =====================================================================
   Les Alpinistes Newsletter — popup d'inscription (cf. src/Frontend/Popup.php)
   Modale centrée sur desktop, bottom sheet compacte ≤ 767 px (listes
   masquées : toutes cochées, envoyées quand même). Reprend les champs de
   frontend.css (.lan-field, .lan-check, .lan-btn) et les variables Swyft
   (--cs-*) du thème pour le clair/sombre.
   ===================================================================== */

.lan-popup {
  --lan-alpine: #0057b8;
  --lan-alpine-light: #1a6fd4;
  --lan-popup-bg: var(--cs-layout-background, var(--cs-site-background, #fff));
  --lan-popup-fg: var(--cs-color-primary, #1d1d1d);
  --lan-popup-muted: var(--cs-color-secondary, #6e6e6e);
  --lan-popup-line: var(--cs-color-border, #e4e4e4);
  --lan-popup-ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  box-sizing: border-box;
  width: min(100% - 32px, 460px);
  max-height: min(100dvh - 32px, 760px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--lan-popup-fg);
  font-family: var(--cs-font-base-family, "Helvetica Neue", Arial, sans-serif);
  background: var(--lan-popup-bg);
  border: 1px solid var(--lan-popup-line);
  border-top: 2px solid var(--lan-alpine);
  border-radius: 0;
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.35);
}
.lan-popup *,
.lan-popup *::before,
.lan-popup *::after {
  box-sizing: border-box;
}
.lan-popup::backdrop {
  background: rgb(0 0 0 / 0.55);
}

/* Page figée sous la modale (le <dialog> ne bloque pas le scroll seul). */
html:has(.lan-popup[open]) {
  overflow: hidden;
}

.lan-popup__panel {
  position: relative;
  padding: 32px 28px 24px;
}

.lan-popup__close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--lan-popup-muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}
.lan-popup__close:hover {
  color: var(--lan-popup-fg);
}
.lan-popup__close:focus-visible,
.lan-popup__later:focus-visible,
.lan-popup__title:focus-visible {
  outline: 2px solid var(--lan-alpine-light);
  outline-offset: 2px;
}
/* Focus posé par script à l'ouverture : pas d'anneau au clic de souris. */
.lan-popup__title:focus:not(:focus-visible) {
  outline: none;
}

.lan-popup__eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--lan-alpine);
}
.lan-popup__title {
  margin: 0 40px 8px 0;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--lan-popup-fg);
}
.lan-popup__subtitle {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--lan-popup-muted);
}

.lan-popup .lan-notice {
  margin-bottom: 16px;
  color: var(--lan-popup-fg);
}

/* `.lan-field label` (frontend.css) met les libellés en capitales espacées :
   pas les cases à cocher (listes, consentement), lues comme du texte courant. */
.lan-popup .lan-check {
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.lan-popup__names {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 16px;
}

.lan-popup__lists {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.lan-popup__lists .lan-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.lan-popup__error {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #e5484d;
}

.lan-popup__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.lan-popup__actions .lan-btn {
  flex: 1 1 auto;
}
.lan-popup__later {
  margin-top: 8px;
  padding: 12px 4px;
  font: inherit;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--lan-popup-muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}
.lan-popup__later:hover {
  color: var(--lan-popup-fg);
}

.lan-popup .lan-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Entrée : fondu + légère montée (desktop), glissement depuis le bas (sheet). */
.lan-popup[open] {
  animation: lan-popup-in 0.32s var(--lan-popup-ease) both;
}
.lan-popup[open]::backdrop {
  animation: lan-popup-fade 0.32s ease both;
}
@keyframes lan-popup-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}
@keyframes lan-popup-sheet {
  from {
    transform: translateY(100%);
  }
}
@keyframes lan-popup-fade {
  from {
    opacity: 0;
  }
}

/* Mobile : bottom sheet compacte (e-mail + consentement). */
@media (max-width: 767px) {
  .lan-popup {
    width: 100%;
    max-width: none;
    max-height: 85dvh;
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    box-shadow: 0 -12px 40px rgb(0 0 0 / 0.3);
  }
  .lan-popup[open] {
    animation-name: lan-popup-sheet;
  }
  .lan-popup__panel {
    padding: 24px 20px calc(16px + env(safe-area-inset-bottom));
  }
  .lan-popup__title {
    font-size: 20px;
  }
  .lan-popup__subtitle {
    margin-bottom: 16px;
  }
  .lan-popup__lists {
    display: none;
  }
  .lan-popup .lan-privacy-note {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lan-popup[open],
  .lan-popup[open]::backdrop {
    animation: none;
  }
}
