@font-face {
  font-family: "PoliceGW";
  src: url("fonts/gw.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "PoliceHV";
  src: url("fonts/hv.otf") format("opentype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  color: #3f302d;
  font-family: "PoliceHV", Georgia, serif;
}

[hidden] {
  display: none !important;
}

/* Accueil */
.accueil {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f7f1ed;
  opacity: 1;
  transition: opacity 700ms ease;
}

.accueil.disparait {
  opacity: 0;
  pointer-events: none;
}

.accueil-cadre {
  position: relative;
  width: min(100vw, 56.25svh);
  aspect-ratio: 1080 / 1920;
}

.image-accueil {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bouton-ouvrir {
  position: absolute;
  left: 31.96517%;
  bottom: 23.63477%;
  width: 35.64815%;
  height: 6.015625%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.bouton-ouvrir img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.compte-a-rebours {
  position: absolute;
  left: 50%;
  bottom: 17.4987%;
  width: 90%;
  height: 3.04338%;
  max-height: 3.04338%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  overflow: hidden;
  transform: translateX(-50%);
  color: #3f302d;
  text-align: center;
  white-space: nowrap;
  font-family: "PoliceGW", Georgia, serif;
  font-size: clamp(11px, 3vw, 28px);
  line-height: 1;
}

/* Invitation et fond des slides */
.invitation {
  display: none;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background-color: #173553;
  background-image: url("images/fond.png");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}

.invitation.visible {
  display: block;
}

.pages {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  background: transparent;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 4%,
    #000 96%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 4%,
    #000 96%,
    transparent 100%
  );
}

.page {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 12px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.page > img {
  display: block;
  max-width: 100%;
  max-height: calc(100svh - 24px);
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Slide 2 et bouton Waze */
.slide-2-cadre {
  position: relative;
  width: min(100vw, 56.25svh);
  aspect-ratio: 1080 / 1920;
}

.slide-2-cadre > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bouton-waze {
  position: absolute;
  left: 50%;
  bottom: 2.59672%;
  width: 36.06966%;
  height: 6.08675%;
  display: block;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.bouton-waze.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.bouton-waze img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

/* Slide RSVP */
.page-rsvp {
  align-content: center;
}

.rsvp-cadre {
  position: relative;
  width: min(100vw, 56.25svh);
  aspect-ratio: 1080 / 1920;
}

.rsvp-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.rsvp-form,
.confirmation-personnalisee {
  position: absolute;
  left: 50%;
  bottom: 17.1088%;
  width: 62.60944%;
  height: 47.37895%;
  transform: translateX(-50%);
}

.rsvp-form {
  display: grid;
  align-content: center;
  gap: clamp(4px, 0.7vw, 10px);
  overflow-y: auto;
  background: transparent;
  font-family: "PoliceHV", Arial, sans-serif;
  font-size: clamp(11px, 1.3vw, 16px);
  opacity: 1;
  transition: opacity 700ms ease;
}

.rsvp-form.fade-out {
  opacity: 0;
}

.rsvp-form label {
  display: block;
  color: #1e3a5f;
}

.rsvp-form input[type="text"],
.rsvp-form input[type="number"],
.rsvp-form textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: clamp(5px, 0.7vw, 9px);
  border: 1px solid #f7beca;
  border-radius: 6px;
  color: #1e3a5f;
  background: rgba(255, 255, 255, 0.88);
  font: inherit;
}

.rsvp-form input:disabled {
  color: #1e3a5f;
  background: rgba(238, 232, 228, 0.88);
}

.rsvp-form fieldset {
  display: flex;
  gap: 16px;
  padding: 6px 10px;
  border: 1px solid #f7beca;
  border-radius: 6px;
  color: #1e3a5f;
  background: transparent;
}

.rsvp-form fieldset label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.rsvp-form input[type="radio"] {
  accent-color: #f7beca;
}

.rsvp-form button {
  padding: 9px;
  border: 1px solid #f7beca;
  border-radius: 6px;
  color: #fbfbfb;
  background: #f7beca;
  font: inherit;
  cursor: pointer;
}

/* Remerciement */
.confirmation-personnalisee:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 700ms ease;
}

.confirmation-personnalisee.visible {
  opacity: 1;
}

.image-merci {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Téléphone tenu à la verticale : affichage sans bandes */
@media (max-width: 600px) {
  .accueil,
  .invitation,
  .page {
    width: 100%;
    height: 100vh;
    height: 100svh;
  }

  .accueil-cadre,
  .slide-2-cadre,
  .rsvp-cadre {
    width: max(100vw, 56.25svh);
    height: max(177.7778vw, 100svh);
    aspect-ratio: 1080 / 1920;
    flex: none;
  }

  .image-accueil,
  .slide-2-cadre > img,
  .rsvp-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .page {
    padding: 0;
  }

  .page > img {
    width: max(100vw, 56.25svh);
    height: max(177.7778vw, 100svh);
    max-width: none;
    max-height: none;
    object-fit: cover;
  }

  .invitation {
    background-position: center center;
    background-size: cover;
  }

  .rsvp-form {
    gap: clamp(3px, 0.7svh, 7px);
    font-size: clamp(11px, 3vw, 14px);
  }

  .rsvp-form fieldset {
    gap: 10px;
    padding: 5px 7px;
  }
}

/* Téléphone tenu à l’horizontale : conserve l’image entière */
@media (max-width: 900px) and (orientation: landscape) {
  .accueil-cadre,
  .slide-2-cadre,
  .rsvp-cadre {
    width: min(100vw, 56.25svh);
  }

  .page {
    padding: 6px;
  }

  .page > img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100svh - 12px);
    object-fit: contain;
  }
}