/* ─────────────────────────────────────────────────────────────────────────────
   Bar/Bat Mitsva Ruben & Rebecca — habillage « Doré Classique »
   Portage du mockup « High Defined ». Mobile-first, un seul thème (clair).
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  --cream:      #f4eede;
  --paper:      #fffdf8;
  --paper-2:    #efe8d6;
  --gold:       #a8813c;
  --gold-deep:  #8a6a2f;
  --gold-line:  #d9c7a0;
  --gold-bg:    #f0e7d2;
  --ink:        #33302a;
  --ink-2:      #7a7160;
  --danger:     #a3352c;
  --ok:         #3f6b2f;

  --radius:     16px;
  --shadow:     0 4px 18px rgba(92, 71, 30, .08);
  --title-font: "Great Vibes", "Snell Roundhand", cursive; /* surchargé par le serveur */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 14px;
  scroll-padding-bottom: 96px;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  overflow-x: hidden; /* filet de sécurité : .hero-names ne doit jamais créer de scroll latéral */
  padding-bottom: 96px;
  background: var(--cream);
  color: var(--ink);
  font-family: "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

img, svg { max-width: 100%; }
.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex: none; }

.wrap { max-width: 430px; margin: 0 auto; padding: 20px 18px 0; }

section, .hero { scroll-margin-top: 14px; }

h2 {
  margin: 2.6rem 0 .2rem;
  text-align: center;
  font-weight: 500;
  font-size: 1.6rem;
  letter-spacing: .01em;
  color: var(--ink);
}
.sub {
  margin: 0 0 1.3rem;
  text-align: center;
  color: var(--ink-2);
  font-size: .95rem;
  font-style: italic;
}

/* ── En-tête ─────────────────────────────────────────────────────────────── */

.hero {
  margin-top: 8px;
  padding: 26px 20px 22px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--gold-line);
  border-radius: 18px;
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px var(--gold-line), var(--shadow);
}
/* Phrase d'intro (kicker) + occasion : lues d'un trait, avant le monogramme. */
.hero-kicker {
  max-width: 26em;
  margin: 0 auto;
  font-family: "EB Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink-2);
  white-space: pre-line; /* honore les \n de content.toml comme retours à la ligne */
}
.hero-occasion {
  margin: .6rem 0 0;
  font-size: .82rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
  /* par défaut (sans JS) : paragraphe normal, retour à la ligne standard */
}
/* .measuring : posée brièvement par app.js pour mesurer si la phrase tient sur
   une ligne. .wrap-2 : posée si non — deux lignes, sans le point milieu. */
.hero-occasion.measuring { white-space: nowrap; }
.hero-occasion.wrap-2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
}
.hero-occasion.wrap-2 .occ-sep { display: none; }
.hero-orn { margin: .8rem 0 .1rem; color: var(--gold); font-size: .8rem; }
.hero-connector {
  margin: .55rem 0 .05rem;
  font-size: .74rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
}
.hero-monogram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: .4rem 0 .2rem;
}
.medallion {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border: 1.5px solid var(--gold-line);
  border-radius: 50%;
  font-family: var(--title-font);
  font-size: 1.7rem;
  line-height: 1;
  color: var(--gold);
  padding-bottom: .1em;
}
.hero-monogram .amp { color: var(--gold); font-size: 1.1rem; }
.hero-names {
  margin: .15rem 0 0;
  font-family: var(--title-font);
  font-weight: 400;
  font-size: clamp(2.6rem, 12vw, 3.4rem); /* taille de départ ; app.js réduit si besoin */
  line-height: 1.05;
  color: var(--ink);
  white-space: nowrap; /* jamais coupé en 2 lignes, quitte à rétrécir (voir app.js) */
}

/* ── Cartes (programme + réponses) ───────────────────────────────────────── */

.card {
  margin: 14px 0;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.card-ic {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--gold-bg);
  color: var(--gold);
  flex: none;
}
.card-ic .ic { width: 18px; height: 18px; }
.card h3, .rsvp-block .legend {
  margin: 0;
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--ink);
}

.event-meta { margin: 0; display: grid; gap: 8px; }
.event-meta > div {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
}
.event-meta dt { margin: 0; color: var(--gold); padding-top: 3px; }
.event-meta dt .ic { width: 16px; height: 16px; }
.event-meta dd { margin: 0; color: var(--ink); }
.event-meta .lbl {
  display: block;
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
}

.btn-outline {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: transparent;
  color: var(--gold);
  font-size: .9rem;
  text-decoration: none;
}
.btn-outline .ic { width: 15px; height: 15px; }
.btn-outline:hover { border-color: var(--gold); }

/* ── Formulaire de réponses ──────────────────────────────────────────────── */

.rsvp-block { min-width: 0; }
.rsvp-block .legend { font-size: 1.15rem; }

.toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.opt {
  appearance: none;
  padding: 12px 10px;
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink-2);
  font-family: inherit;
  font-size: .98rem;
  font-weight: 500;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.opt:hover { border-color: var(--gold); }
.opt.opt-yes[aria-pressed="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}
.opt.opt-no[aria-pressed="true"] {
  background: var(--paper-2);
  border-color: var(--ink-2);
  color: var(--ink);
}
.opt:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.guests {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.guest-row {
  display: grid;
  grid-template-columns: 20px 1fr 1fr 28px;
  gap: 8px;
  align-items: center;
}
.guest-ic { color: var(--gold); }
.guest-ic .ic { width: 16px; height: 16px; }
.guest-row input {
  width: 100%;
  padding: 8px 4px;
  border: none;
  border-bottom: 1px solid var(--gold-line);
  background: transparent;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
}
.guest-row input::placeholder { color: var(--ink-2); opacity: .7; }
.guest-row input:focus { outline: none; border-bottom-color: var(--gold); }
.guest-del {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-2);
  padding: 4px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.guest-del .ic { width: 15px; height: 15px; }
.guest-del:hover { color: var(--danger); }
.guest-row.solo .guest-del { visibility: hidden; }

.add-guest {
  margin-top: 10px;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--gold);
  font-family: inherit;
  font-size: .95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.add-guest .ic { width: 15px; height: 15px; }
.add-guest:hover { color: var(--gold-deep); }

.btn-whatsapp {
  margin-top: 22px;
  width: 100%;
  appearance: none;
  border: none;
  border-radius: 14px;
  background: var(--gold);
  color: #fff;
  padding: 16px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(168, 129, 60, .35);
}
.btn-whatsapp .ic { width: 20px; height: 20px; }
.btn-whatsapp:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-whatsapp:not(:disabled):hover { background: var(--gold-deep); }
a.btn-whatsapp { text-decoration: none; }

/* Écran de confirmation « déjà répondu » */
.done-panel { text-align: center; }
.done-title {
  margin: 0 0 .3rem;
  font-size: 1.25rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.done-title .ic { width: 22px; height: 22px; color: var(--ok); }
.done-when { margin: 0 0 .2rem; color: var(--ink-2); font-size: .9rem; }
.done-panel .btn-whatsapp { margin-top: 16px; text-transform: none; }
.linklike {
  margin-top: 14px;
  appearance: none;
  border: none;
  background: none;
  color: var(--ink-2);
  font-family: inherit;
  font-size: .82rem;
  text-decoration: underline;
  cursor: pointer;
}
.linklike:hover { color: var(--gold); }

.whatsapp-note {
  margin: .6rem 0 0;
  text-align: center;
  color: var(--ink-2);
  font-size: .82rem;
}

.form-msg {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  text-align: center;
  font-size: .92rem;
}
.form-msg.ok  { background: #e7f0e2; color: var(--ok); }
.form-msg.err { background: #f6e0dc; color: var(--danger); }

.noscript-warn {
  background: #f6e0dc;
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 14px;
  text-align: center;
}

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.closing {
  margin: 2.6rem 0 0;
  text-align: center;
  color: var(--gold);
  letter-spacing: .2em;
  text-transform: uppercase;
  font-size: .72rem;
}

/* ── Barre de navigation flottante ───────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  gap: 2px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  background: rgba(255, 253, 248, .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(92, 71, 30, .18);
  overflow-x: auto;
  scrollbar-width: none;
}
.bottom-nav::-webkit-scrollbar { display: none; }
.bottom-nav a {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 9px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-2);
  font-size: .62rem;
  letter-spacing: .03em;
  white-space: nowrap;
}
.bottom-nav a .ic { width: 18px; height: 18px; }
.bottom-nav a:hover { color: var(--gold); }
.bottom-nav a.active { background: var(--gold-bg); color: var(--gold-deep); }

/* ── Bouton musique ───────────────────────────────────────────────────────── */

.music-toggle {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 50;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  appearance: none;
  border: 1px solid var(--gold-line);
  border-radius: 50%;
  background: rgba(255, 253, 248, .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--gold);
  box-shadow: 0 6px 18px rgba(92, 71, 30, .16);
  cursor: pointer;
}
.music-toggle .ic { width: 19px; height: 19px; }
.music-toggle:hover { color: var(--gold-deep); }
.music-toggle.playing {
  background: var(--gold);
  color: #fff;
  animation: music-pulse 2.4s ease-in-out infinite;
}
@keyframes music-pulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(92, 71, 30, .16), 0 0 0 0 rgba(168, 129, 60, .35); }
  50%      { box-shadow: 0 6px 18px rgba(92, 71, 30, .16), 0 0 0 6px rgba(168, 129, 60, 0); }
}
@media (prefers-reduced-motion: reduce) { .music-toggle.playing { animation: none; } }

/* ── Écran de couverture (enveloppe) ──────────────────────────────────────── */
/* Masqué par défaut : sans JS pour l'afficher, la page normale reste visible
   directement, rien n'est bloqué. */

.cover {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.2rem;
  background: var(--cream);
  padding: 24px;
  transition: transform .75s cubic-bezier(.65, 0, .35, 1);
}
.cover.visible { display: flex; }
.cover.reveal { transform: translateY(-100%); }
@media (prefers-reduced-motion: reduce) { .cover { transition: none; } }

.envelope {
  position: relative;
  width: min(300px, 78vw);
  aspect-ratio: 3 / 2;
  perspective: 900px;
}
.envelope-body {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: .25rem;
  background: var(--paper);
  border: 1px solid var(--gold-line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1rem 1rem 1.2rem;
  text-align: center;
}
.envelope-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 1;
  height: 44%;
  background: linear-gradient(155deg, var(--paper), var(--gold-bg));
  border: 1px solid var(--gold-line);
  border-radius: 10px 10px 0 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform .55s cubic-bezier(.6, 0, .4, 1);
}
.cover.opening .envelope-flap { transform: rotateX(-165deg); }
@media (prefers-reduced-motion: reduce) { .envelope-flap { transition: none; } }

.env-line {
  margin: 0;
  font-family: var(--title-font);
  font-size: 1.35rem;
  color: var(--gold);
  line-height: 1.15;
}
.env-connector {
  margin: .1rem 0;
  font-size: .68rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
}
.env-names {
  margin: 0;
  font-family: var(--title-font);
  font-size: 1.9rem;
  color: var(--gold);
  line-height: 1.05;
  white-space: nowrap; /* jamais coupée en 2 lignes, voir app.js */
}

.cover-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  background: var(--gold);
  color: #fff;
  padding: .85rem 1.9rem;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1rem;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(168, 129, 60, .35);
}
.cover-btn:hover { background: var(--gold-deep); }

/* Le scroll de la page est verrouillé tant que l'enveloppe est affichée. */
html.cover-lock, html.cover-lock body { overflow: hidden; height: 100%; }
