/* =========================================================
   Bar Mitsvah — Yohav Azoulay
   Invitation numérique · mobile-first
   ========================================================= */

:root {
  --bg: #95a192;
  --bg-deep: #8a9687;
  --ink: #ffffff;
  --ink-soft: rgba(255, 255, 255, 0.78);
  --ink-mute: rgba(255, 255, 255, 0.6);
  --line: rgba(255, 255, 255, 0.34);
  --line-soft: rgba(255, 255, 255, 0.2);
  --glass: rgba(255, 255, 255, 0.07);
  --font: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --heb: 'Frank Ruhl Libre', 'Cormorant Garamond', 'Times New Roman', serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.18, 1);
  --gutter: clamp(20px, 6vw, 40px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.45;
  text-align: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
body.is-locked { overflow: hidden; height: 100vh; height: 100svh; }
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 1px solid var(--ink); outline-offset: 4px;
}

/* ---------- Fond fixe ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg);
  background-image: url('assets/background.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  pointer-events: none;
  transform: translateZ(0);
}
@media (min-aspect-ratio: 4/5) {
  .bg { background-size: auto 100%; }
}

/* =========================================================
   POP-UP D'OUVERTURE
   ========================================================= */
.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.intro__panel {
  position: absolute;
  top: 0; bottom: 0;
  width: 50.5%;
  background: var(--bg);
  will-change: transform;
  transition: transform 1.25s var(--ease-in-out);
}
.intro__panel--left { left: 0; }
.intro__panel--right { right: 0; }
.intro.is-leaving .intro__panel--left { box-shadow: 8px 0 30px rgba(0,0,0,0.08); }
.intro.is-leaving .intro__panel--right { box-shadow: -8px 0 30px rgba(0,0,0,0.08); }

.intro__frame {
  position: absolute;
  inset: calc(14px + var(--safe-top)) 14px calc(14px + var(--safe-bottom));
  border: 1px solid var(--line-soft);
  pointer-events: none;
  opacity: 0;
  animation: introFrame 1.6s var(--ease-out) 0.3s forwards;
}
@keyframes introFrame { to { opacity: 1; } }

.intro__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(22px, 5vh, 40px);
  padding: 0 var(--gutter);
  transition: opacity 0.55s ease, transform 0.7s var(--ease-in-out);
}
.intro__logo-wrap { position: relative; }
.intro__halo {
  position: absolute;
  inset: -30%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0) 65%);
  opacity: 0;
  animation: haloIn 2.4s var(--ease-out) 0.4s forwards, haloBreath 6s ease-in-out 2.8s infinite;
}
@keyframes haloIn { to { opacity: 1; } }
@keyframes haloBreath { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: 0.7; } }
.intro__logo {
  width: clamp(150px, 42vw, 220px);
  position: relative;
  opacity: 0;
  transform: scale(0.9) translateY(10px);
  animation: logoIn 1.6s var(--ease-out) 0.2s forwards, logoFloat 7s ease-in-out 1.8s infinite;
}
@keyframes logoIn { to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes logoFloat { 0%,100% { translate: 0 0; } 50% { translate: 0 -6px; } }

.intro__rule {
  display: flex; align-items: center; gap: 12px;
  width: clamp(120px, 40vw, 200px);
  opacity: 0;
  animation: fadeUp 1.2s var(--ease-out) 0.9s forwards;
}
.intro__rule span { flex: 1; height: 1px; background: var(--line); }
.intro__rule i { width: 5px; height: 5px; background: var(--ink); transform: rotate(45deg); opacity: 0.85; }

.btn--intro {
  opacity: 0;
  animation: fadeUp 1.2s var(--ease-out) 1.2s forwards;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* Fermeture */
.intro.is-leaving .intro__content { opacity: 0; transform: scale(1.06); }
.intro.is-leaving .intro__frame { opacity: 0; transition: opacity 0.4s ease; animation: none; }
.intro.is-leaving .intro__panel--left { transform: translateX(-102%); transition-delay: 0.3s; }
.intro.is-leaving .intro__panel--right { transform: translateX(102%); transition-delay: 0.3s; }
.intro.is-gone { display: none; }

/* =========================================================
   BOUTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 34px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  line-height: 1;
  position: relative;
  overflow: hidden;
  transition: color 0.45s ease, background-color 0.45s ease, transform 0.35s var(--ease-out), box-shadow 0.45s ease;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
.btn::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.55s var(--ease-in-out);
  z-index: 0;
}
.btn > * { position: relative; z-index: 1; }
@media (hover: hover) {
  .btn:hover { color: var(--bg); }
  .btn:hover::before { transform: scaleX(1); }
}
.btn:active { transform: scale(0.97); }
.btn--cta { background: var(--ink); color: var(--bg); }
.btn--cta::before { display: none; }
@media (hover: hover) { .btn--cta:hover { box-shadow: 0 10px 30px rgba(0,0,0,0.12); transform: translateY(-1px); } }

/* =========================================================
   MUSIQUE
   ========================================================= */
.music {
  position: fixed;
  top: calc(14px + var(--safe-top));
  left: 14px;
  z-index: 50;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(149,161,146,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.8s ease, transform 0.8s var(--ease-out);
}
.music.is-shown { opacity: 1; transform: none; }
.music__bars { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.music__bars i {
  width: 2px; height: 4px; background: var(--ink); border-radius: 1px;
  transform-origin: bottom;
  transition: height 0.3s ease;
}
.music.is-playing .music__bars i { animation: bar 1.1s ease-in-out infinite; }
.music.is-playing .music__bars i:nth-child(2) { animation-delay: 0.2s; }
.music.is-playing .music__bars i:nth-child(3) { animation-delay: 0.45s; }
.music.is-playing .music__bars i:nth-child(4) { animation-delay: 0.1s; }
@keyframes bar { 0%,100% { height: 4px; } 50% { height: 14px; } }

/* =========================================================
   SECTIONS
   ========================================================= */
main { position: relative; }
.section {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(56px, 10vh, 96px) var(--gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  font-size: clamp(15px, 4.2vw, 18px);
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink);
  padding-left: 0.34em; /* compensate letter-spacing */
}
.orn {
  display: flex; align-items: center; gap: 12px;
  width: min(240px, 60%);
  margin: 28px auto;
}
.orn span { flex: 1; height: 1px; background: var(--line); }
.orn i { width: 5px; height: 5px; background: var(--ink); transform: rotate(45deg); opacity: 0.85; }
.orn--small { width: 90px; margin: 18px auto; }

/* ---------- Reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1.2s var(--ease-out), transform 1.2s var(--ease-out);
  transition-delay: var(--d, 0s);
  will-change: opacity, transform;
}
[data-reveal].in { opacity: 1; transform: none; }

/* =========================================================
   SECTION 1 — HERO
   ========================================================= */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  justify-content: center;
  padding-top: calc(clamp(44px, 7vh, 80px) + var(--safe-top));
  padding-bottom: calc(92px + var(--safe-bottom));
}
.bsd {
  position: absolute;
  top: calc(16px + var(--safe-top));
  right: 18px;
  font-family: var(--heb);
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 0.05em;
}
.hero__logo {
  width: clamp(84px, 22vw, 116px);
  margin-bottom: clamp(20px, 3.5vh, 36px);
}

.parents {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  width: 100%;
  font-size: clamp(12px, 3.75vw, 18px);
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  margin-bottom: 14px;
}
.parents__left { text-align: left; }
.parents__right { text-align: right; }

.family {
  font-size: clamp(19px, 5.4vw, 24px);
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: clamp(20px, 3.5vh, 34px);
}
.lead {
  font-size: clamp(17px, 4.6vw, 20px);
  font-style: italic;
  font-weight: 300;
  color: var(--ink-soft);
}
.title {
  font-size: clamp(24px, 7vw, 34px);
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  padding-left: 0.32em;
  margin: 12px 0;
}
.name {
  font-size: clamp(84px, 24vw, 128px);
  font-weight: 300;
  line-height: 0.95;
  letter-spacing: 0.01em;
  margin-top: clamp(16px, 3vh, 30px);
}
.hebrew {
  font-family: var(--heb);
  font-weight: 300;
  font-size: clamp(26px, 7.5vw, 36px);
  letter-spacing: 0.08em;
  margin-top: 8px;
  color: var(--ink);
}

/* Flèche scroll */
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: calc(22px + var(--safe-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
}
[data-reveal].scroll-cue { transform: translate(-50%, 24px); }
[data-reveal].scroll-cue.in { transform: translate(-50%, 0); }
.scroll-cue__label { font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; padding-left: 0.3em; }
.scroll-cue__arrow { width: 26px; height: 26px; animation: cue 2.2s ease-in-out infinite; }
.scroll-cue__arrow svg { width: 100%; height: 100%; }
@keyframes cue {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(7px); opacity: 1; }
}

/* =========================================================
   SECTION 2 — SAVE THE DATE / COMPTE À REBOURS
   ========================================================= */
.save__date {
  white-space: nowrap;
  font-size: clamp(24px, 7.4vw, 40px);
  font-weight: 300;
  line-height: 1.15;
  margin-top: 16px;
}
.save__time {
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 300;
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 4px;
}
.countdown {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(8px, 2.5vw, 18px);
  width: 100%;
}
.countdown__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: clamp(56px, 17vw, 84px);
}
.countdown__num {
  font-size: clamp(40px, 12vw, 60px);
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  display: block;
}
.countdown__num.tick { animation: tick 0.6s var(--ease-out); }
@keyframes tick {
  0% { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 1; transform: translateY(0); }
}
.countdown__label {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding-left: 0.26em;
}
.countdown__sep {
  width: 1px;
  align-self: center;
  height: 44px;
  background: var(--line-soft);
}
.countdown__done {
  margin-top: 24px;
  font-size: clamp(22px, 6vw, 28px);
  font-style: italic;
  font-weight: 300;
}

/* =========================================================
   SECTIONS 3-5 — ÉVÉNEMENTS
   ========================================================= */
.event { padding-top: clamp(28px, 5vh, 48px); padding-bottom: clamp(28px, 5vh, 48px); }
.card {
  width: 100%;
  padding: clamp(32px, 7vw, 44px) clamp(22px, 6vw, 36px);
  border: 1px solid var(--line-soft);
  background: var(--glass);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  position: relative;
}
.card::before, .card::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border-color: var(--line);
  border-style: solid;
  pointer-events: none;
}
.card::before { top: 6px; left: 6px; border-width: 1px 0 0 1px; }
.card::after { bottom: 6px; right: 6px; border-width: 0 1px 1px 0; }

.event__date {
  white-space: nowrap;
  font-size: clamp(22px, 6.2vw, 32px);
  font-weight: 300;
  line-height: 1.2;
  margin-top: 14px;
}
.event__time {
  font-size: clamp(20px, 5.6vw, 24px);
  font-style: italic;
  font-weight: 300;
  color: var(--ink-soft);
  margin-top: 4px;
}
.event__venue {
  font-size: clamp(20px, 5.6vw, 24px);
  font-weight: 500;
}
.event__addr {
  font-size: clamp(16px, 4.5vw, 18px);
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 6px;
}

.waze {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 8px 18px 8px 14px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: background-color 0.4s ease, color 0.4s ease, transform 0.3s var(--ease-out);
  touch-action: manipulation;
}
.waze__icon { width: 20px; height: 20px; }
@media (hover: hover) { .waze:hover { background: var(--ink); color: var(--bg); } }
.waze:active { transform: scale(0.96); }

/* =========================================================
   SECTION 6 — RSVP
   ========================================================= */
.rsvp__title {
  font-size: clamp(22px, 6.2vw, 30px);
  font-weight: 300;
  line-height: 1.25;
  margin: 14px 0 30px;
}
.form { text-align: left; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.field { position: relative; margin-bottom: 26px; }
.field input, .field textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  font: inherit;
  font-size: 18px; /* ≥16px : évite le zoom iOS */
  padding: 12px 0 8px;
  transition: border-color 0.3s ease;
  -webkit-appearance: none; appearance: none;
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.4; }
.field label {
  position: absolute;
  left: 0; top: 12px;
  color: var(--ink-mute);
  font-size: 18px;
  letter-spacing: 0.04em;
  pointer-events: none;
  transition: transform 0.35s var(--ease-out), font-size 0.35s var(--ease-out), color 0.3s ease;
  transform-origin: left top;
}
.field input:focus, .field textarea:focus { border-bottom-color: var(--ink); outline: none; }
.field input:focus + label, .field input:not(:placeholder-shown) + label,
.field textarea:focus + label, .field textarea:not(:placeholder-shown) + label {
  transform: translateY(-20px);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.field.is-invalid input, .field.is-invalid textarea { border-bottom-color: #ffd9d9; }
.field.is-invalid label { color: #ffd9d9; }

.choices { border: 0; padding: 0; margin: 10px 0 26px; }
.choices legend {
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0;
  margin-bottom: 14px;
}
.choice { border-top: 1px solid var(--line-soft); }
.choice:last-child { border-bottom: 1px solid var(--line-soft); }
.check {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  margin-top: 3px;
  border: 1px solid var(--line);
  position: relative;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.check__box::after {
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid var(--bg);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.3s var(--ease-out);
}
.check input:checked + .check__box { background: var(--ink); border-color: var(--ink); }
.check input:checked + .check__box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .check__box { outline: 1px solid var(--ink); outline-offset: 3px; }
.check__text { font-size: 18px; line-height: 1.3; }
.check__text em { font-style: italic; font-weight: 300; color: var(--ink-soft); white-space: nowrap; }
.choice.is-disabled { opacity: 0.45; transition: opacity 0.3s ease; }
.choice { transition: opacity 0.3s ease; }
.choice--absent { margin-top: 6px; }

.counts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 0 0 16px 34px;
  animation: countsIn 0.5s var(--ease-out);
}
@keyframes countsIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.count { display: flex; flex-direction: column; gap: 4px; }
.count > span {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.count select {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  padding: 6px 28px 6px 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  background-size: 18px;
}
.count select option { color: #333; }

.form__error {
  color: #ffe3e3;
  font-size: 15px;
  font-style: italic;
  text-align: center;
  margin: -8px 0 18px;
}
.btn--submit { width: 100%; margin-top: 4px; }
.btn__spinner {
  display: none;
  width: 16px; height: 16px;
  border: 1px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-loading { pointer-events: none; opacity: 0.8; }
.btn.is-loading .btn__spinner { display: inline-block; }

.form.is-hiding { opacity: 0; transform: translateY(-10px); transition: opacity 0.6s ease, transform 0.6s ease; }

.success {
  animation: successIn 1.1s var(--ease-out);
  padding-top: clamp(36px, 8vw, 52px);
  padding-bottom: clamp(36px, 8vw, 52px);
}
@keyframes successIn { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
.success__logo { width: 78px; margin: 0 auto 18px; }
.success__title {
  font-size: clamp(28px, 8vw, 38px);
  font-weight: 300;
  line-height: 1.1;
}
.success__text {
  margin-top: 12px;
  font-size: clamp(17px, 4.6vw, 20px);
  font-style: italic;
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.45;
}
.success__sign {
  margin-top: 22px;
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding-left: 0.3em;
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  padding-top: clamp(56px, 10vh, 96px);
  padding-bottom: calc(clamp(56px, 10vh, 80px) + var(--safe-bottom));
  border-top: 1px solid var(--line-soft);
  max-width: none;
}
.footer__logo { width: 72px; margin-bottom: 22px; }
.footer__text {
  font-size: clamp(17px, 4.6vw, 20px);
  font-weight: 300;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink-soft);
  margin-bottom: 26px;
  max-width: 420px;
}
.btn--cta { font-size: 13px; padding: 12px 26px; letter-spacing: 0.22em; }

/* =========================================================
   ACCESSIBILITÉ / MOUVEMENT RÉDUIT
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.2s !important; }
  [data-reveal] { transform: none; }
}
