/* Galerie invité, version épurée : les photos sont la vedette, l'interface s'efface.
   La couleur de l'événement (--accent, --accent-texte posées sur <body>) ne sert que de fond au bouton principal
   et de repère « nouvelle photo », jamais de couleur de texte : elle reste lisible même très claire ou très foncée. */
:root {
  --fond: #f6f6f6; --surface: #ffffff; --surface-2: #ececec; --texte: #0c0c0c; --doux: #646464; --trait: #e2e2e2;
  --erreur: #c62828; --bulle: rgba(16, 16, 16, .58);
  --accent: #0f766e; --accent-texte: #ffffff;
  --rayon: 16px;
  --haut: env(safe-area-inset-top, 0px); --bas: env(safe-area-inset-bottom, 0px);
  --gauche: env(safe-area-inset-left, 0px); --droite: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --fond: #000000; --surface: #141414; --surface-2: #1f1f1f; --texte: #f4f4f4; --doux: #8e8e8e; --trait: #232323;
    --erreur: #ff5a52; --accent: #2bb3a5; --accent-texte: #0b1f1d; color-scheme: dark; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1.45;
  background: var(--fond); color: var(--texte); min-height: 100vh; display: flex; flex-direction: column;
  padding: var(--haut) var(--droite) 0 var(--gauche);
}
main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 1.5rem 1.25rem 2rem; }
a { color: var(--texte); text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
[hidden] { display: none !important; }
svg.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--texte); outline-offset: 2px; }

/* ---------- en-tête de l'événement ---------- */
.entete { max-width: 520px; margin: 1.5rem auto 1.75rem; }
.entete .logo { display: block; max-height: 56px; max-width: 60%; margin-bottom: .9rem; }
.surtitre { margin: 0; font-size: 13px; color: var(--doux); }
.entete h1 { margin: .35rem 0 .15rem; font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; text-wrap: balance; }
.date { margin: 0; color: var(--doux); }
/* Une fois dans la galerie, l'en-tête se fait discret */
#app[data-ecran="galerie"] .entete { margin: 0 0 .5rem; }
#app[data-ecran="galerie"] .entete .logo, #app[data-ecran="galerie"] .date { display: none; }
#app[data-ecran="galerie"] .entete h1 { font-size: 15px; font-weight: 500; color: var(--doux); letter-spacing: 0; margin: 0; }
#app[data-ecran="galerie"] .surtitre { display: none; }

.ecran { max-width: 520px; margin: 0 auto; }
#ecran-galerie { max-width: none; }
.centre { text-align: center; }
.intro { margin: 0 0 1.25rem; font-size: 16px; color: var(--doux); }

/* ---------- consentement et selfie ---------- */
.consentement { display: flex; gap: .8rem; align-items: flex-start; background: var(--surface); border-radius: var(--rayon);
  padding: 14px; margin: 0 0 14px; font-size: 14.5px; cursor: pointer; }
.consentement input { width: 24px; height: 24px; flex: none; margin: 1px 0 0; accent-color: var(--accent); }

.bouton { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; border: 0; border-radius: var(--rayon);
  font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; padding: 0 1.2rem; min-height: 48px; }
.bouton.principal { width: 100%; min-height: 56px; font-size: 17px; background: var(--accent); color: var(--accent-texte);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--texte) 16%, transparent); }
.bouton.principal:disabled { opacity: .35; cursor: not-allowed; }
.bouton.secondaire { background: var(--surface); color: var(--texte); }
.bouton.lien { width: 100%; min-height: 44px; padding: .5rem; background: none; color: var(--texte); font-weight: 500; }
.bouton.lien:disabled { opacity: .4; }
.bouton.petit { min-height: 44px; padding: 0 1rem; font-size: 14px; }
.conseil { margin: 1rem 0 0; color: var(--doux); font-size: 13px; text-align: center; }

.roue { width: 2.75rem; height: 2.75rem; margin: 3rem auto 1rem; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--texte) 15%, transparent); border-top-color: var(--texte); animation: tourne .9s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .roue { animation-duration: 3s; } }

.message { max-width: 520px; margin: 0 auto 1rem; padding: 12px 14px; border-radius: var(--rayon); background: var(--surface); }
.message.erreur { color: var(--erreur); }

/* ---------- mes photos ---------- */
.barre-galerie { position: sticky; top: var(--haut); z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin: 0 -1.25rem; padding: 8px 1.25rem 10px; background: var(--fond); }
.compteur { margin: 0; font-size: 17px; font-weight: 650; }
.bouton.rond { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: var(--surface); color: var(--texte); }
.vide { text-align: center; color: var(--doux); max-width: 520px; margin: 2.5rem auto; }
.grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 0 -1.25rem; }
.grille button { position: relative; border: 0; padding: 0; background: var(--surface-2); aspect-ratio: 1; cursor: pointer; overflow: hidden; }
.grille img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grille .nouvelle::after { content: ""; position: absolute; top: 7px; right: 7px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px #fff; }
@media (min-width: 600px) { .grille { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 0; } }
.actions-bas { max-width: 520px; margin: 1rem auto 0; }

.bloc-email { max-width: 520px; margin: 1.5rem auto 0; padding: 14px; border-radius: var(--rayon); background: var(--surface); }
.bloc-email .titre-bloc { margin: 0 0 .2rem; font-weight: 600; }
.bloc-email .doux { margin: 0 0 .8rem; color: var(--doux); font-size: 13px; }
.bloc-email p { margin: 0 0 .5rem; }
.form-email { display: flex; gap: 6px; }
.form-email input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 12px; font: inherit; font-size: 16px;
  border: 0; border-radius: 12px; background: var(--surface-2); color: var(--texte); }
.form-email .bouton { flex: none; background: var(--texte); color: var(--fond); border-radius: 12px; }

/* ---------- visionneuse ---------- */
.visionneuse { position: fixed; inset: 0; z-index: 10; background: #000; color: #fff; display: flex; flex-direction: column;
  padding: var(--haut) var(--droite) var(--bas) var(--gauche); }
.vis-haut { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 8px 10px; }
.vis-bouton { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #1c1c1c; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; }
#vis-position { font-size: 14px; color: #bdbdbd; padding-right: 6px; font-variant-numeric: tabular-nums; }
.vis-image { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.vis-image img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; }
.vis-nav { position: absolute; top: 0; bottom: 0; width: 28%; border: 0; background: transparent; color: transparent; cursor: pointer; font-size: 0; }
@media (hover: hover) { .vis-nav { color: rgba(255, 255, 255, .7); font-size: 2.2rem; } }
#vis-precedente { left: 0; }
#vis-suivante { right: 0; }
.vis-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 12px 6px; }
.vis-actions .bouton.principal { min-height: 54px; font-size: 16px; }
.vis-actions .bouton.secondaire { width: 54px; padding: 0; background: #1c1c1c; color: #fff; }
.vis-actions .bouton.lien { grid-column: 1 / -1; color: #a8a8a8; font-size: 14px; }

/* Téléphone couché : la photo prend tout l'écran, les boutons flottent en bulles */
@media (orientation: landscape) and (max-height: 500px) {
  .grille { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .vis-image { position: absolute; inset: 0; }
  .vis-haut { position: absolute; top: calc(10px + var(--haut)); left: max(12px, var(--gauche)); z-index: 2; padding: 0; gap: 8px; }
  .vis-bouton, #vis-position, .vis-actions .bouton.secondaire, .vis-actions .bouton.lien {
    background: var(--bulle); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  #vis-position { padding: 6px 12px; border-radius: 12px; color: #fff; }
  .vis-actions { position: absolute; right: max(12px, var(--droite)); bottom: calc(12px + var(--bas)); z-index: 2;
    display: flex; align-items: center; gap: 8px; padding: 0; }
  .vis-actions .bouton.principal { width: auto; min-height: 48px; padding: 0 18px; font-size: 15px; }
  .vis-actions .bouton.secondaire { width: 48px; min-height: 48px; }
  .vis-actions .bouton.lien { order: -1; width: auto; min-height: 48px; padding: 0 14px; border-radius: var(--rayon); color: #e0e0e0; }
}

/* ---------- pied de page ---------- */
.pied { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; justify-content: center; align-items: center;
  padding: 1.25rem 1rem calc(1.25rem + var(--bas)); color: var(--doux); font-size: 12.5px; }
.pied a, .lien-discret { color: var(--doux); text-decoration-color: currentColor; text-decoration-thickness: 1px; }
.lien-discret { background: none; border: 0; font: inherit; text-decoration: underline; cursor: pointer; padding: .5rem; }

/* ---------- pages de texte (confidentialité, e-mails, introuvable) ---------- */
.texte { max-width: 680px; }
.texte h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.02em; }
.texte h2 { font-size: 17px; margin-top: 1.75rem; }
.page-email { margin: 0 auto; text-align: center; }
.page-email .entete { text-align: center; }
.page-email .nom-evenement { margin: .3rem 0 0; font-weight: 600; }
.page-email form { margin: 1.5rem 0; }

/* Page /live (QR permanent) : liste des événements récents */
.liste-live { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: .7rem; }
.liste-live small { display: block; font-weight: 400; opacity: .75; margin-top: .15rem; }
