/* ========= RESET & BASE ========= */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: url("../image/fond.png") no-repeat top center fixed;
  background-size: cover;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e5e7eb;
}

body.modal-open { overflow: hidden; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

.hidden { display: none !important; }

/* ========= TYPOGRAPHY ========= */
h1 {
  font-family: "Great Vibes", cursive;
  font-size: clamp(2.4rem, 6vw, 4rem);
  margin: 130px 0 50px;
  letter-spacing: 0.1em;
  text-align: center;
  color: #3d1f0a;
}

.subtitle {
  margin: 12px auto 12px;
  max-width: 900px;
  line-height: 1.5;
  font-size: clamp(1.05rem, 3vw, 1.35rem);
  font-weight: 700;
  color: #3d1f0a;
}

.subtitle-big { animation: subtitlePulse 3s ease-in-out infinite; }

@keyframes subtitlePulse {
  0%   { transform: translateY(0);    opacity: 0.55; }
  20%  { opacity: 1; }
  50%  { transform: translateY(-6px); }
  100% { transform: translateY(0);    opacity: 0.85; }
}

/* ========= WAIT IMAGE ========= */
.wait-image {
  display: block;
  margin: 0 auto;
  /* S'adapte à la hauteur de fenêtre disponible sous le texte */
  max-height: calc(100vh - 220px);
  width: auto;
  max-width: min(38vw, 320px);
  height: auto;
  object-fit: contain;
}
@media (max-width: 1024px) {
  .wait-image { max-width: min(50vw, 260px); max-height: calc(100vh - 200px); }
}
@media (max-width: 600px) {
  .wait-image { max-width: min(55vw, 180px); max-height: calc(100vh - 180px); }
}

/* ========= CONTROLS (tri) ========= */
.controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 18px;
}

.pill {
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.25);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  backdrop-filter: blur(6px);
  transition: transform 0.15s ease, background 0.15s ease;
}
.pill:hover  { transform: translateY(-1px); background: rgba(0,0,0,0.35); }
.pill.active { background: rgba(205,177,96,0.75); color: #111827; border-color: rgba(205,177,96,0.9); }

/* ========= GRID ========= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 14px;
  justify-items: center;
  max-width: 760px;
  margin: 0 auto;
}
.grid.few-cards {
  grid-template-columns: repeat(auto-fit, minmax(140px, 200px));
  justify-content: center;
}
@media (max-width: 768px) {
  .grid           { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 100%; }
  .grid.few-cards { grid-template-columns: repeat(auto-fit, minmax(120px, 170px)); }
}

/* ========= CARD ========= */
.card {
  cursor: pointer;
  user-select: none;
  width: 100%;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover  { transform: translateY(-4px) scale(1.03); }
.card:active { transform: translateY(0) scale(0.98); }

.card-inner { position: relative; width: 100%; }

.card img.card-main-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  background: #CDB160;
}

.card-number-overlay {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  height: 28px;
  width: auto;
  object-fit: contain;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.2s ease;
}
body.random-order .card-number-overlay { opacity: 0; }

/* ========= SHUFFLE ANIMATION ========= */
.grid.shuffling .card { animation: gather 320ms ease-in forwards; transform-origin: center; }
@keyframes gather {
  0%   { transform: translate(0,0)    scale(1);    opacity: 1;    filter: blur(0); }
  100% { transform: translate(0,18px) scale(0.78); opacity: 0.15; filter: blur(2px); }
}
.card.deal { animation: deal 420ms cubic-bezier(.2,.8,.2,1) both; }
@keyframes deal {
  0%   { transform: translate(0,14px) scale(0.86); opacity: 0; filter: blur(2px); }
  100% { transform: translate(0,0)    scale(1);    opacity: 1; filter: blur(0); }
}

/* ========= OVERLAY ========= */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

/* ========= MODAL ========= */
.modal {
  background: url("../image/fond.png") top center/cover no-repeat;
  backdrop-filter: blur(4px);
  border-radius: 18px;
  max-width: 1060px;
  width: min(1060px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.9);
  overflow: hidden;
  position: relative;
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 9999;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #CDB160;
  padding: calc(15px + env(safe-area-inset-top)) 20px 15px 20px;
  border-bottom: 1px solid rgba(148,163,184,0.25);
}

.modal-title {
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  color: #ffffff;
  line-height: 1.25;
}

.modal-controls { display: flex; align-items: center; gap: 8px; }

.icon-button {
  border: none;
  background: rgba(15,23,42,0.8);
  color: #e5e7eb;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}
.icon-button:hover  { background: rgba(30,64,175,0.9); transform: translateY(-1px); }
.icon-button:active { transform: translateY(0); }

.modal-body {
  display: block;
  padding: 12px 16px 16px;
  overflow-y: auto;
  max-height: calc(90vh - 70px);
}

@media (max-width: 768px) {
  .modal      { max-height: 92vh; border-radius: 0; width: 100%; }
  .modal-body { padding: 10px 12px 12px; max-height: calc(92vh - 70px); }
  #popupImage { max-height: 55vh; }
}

/* ========= POPUP CARTE ========= */
.popup-image-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 0 10px;
}

#popupImage {
  max-height: 60vh;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 12px 35px rgba(0,0,0,0.6);
}

.popup-text {
  padding: 14px 8px 6px;
  text-align: left;
  font-size: 1.08rem;
  line-height: 1.8;
  color: #000000;
  font-weight: bold;
}

.bio-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(229,231,235,0.25);
  padding-left: 20px;
}

.bio-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 1.15rem;
  margin: 0 0 10px;
  color: #000000;
}

.bio-content {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.8;
  color: #000000;
}

.bio-image-wrapper {
  display: flex;
  justify-content: center;
  margin: 10px 0 16px;
}
.bio-image-wrapper img {
  max-width: 500px;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

/* ========= FADE ANIMATIONS ========= */
.fade-in-image { animation: fadeIn 0.3s ease; }
.fade-in-text  { animation: fadeInText 0.4s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes fadeInText {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========= GATE INSCRIPTION ========= */
.gate-modal { max-width: 520px; }
.gate-body  { max-height: none; }

.gate-note {
  margin: 0 0 16px;
  color: #e5e7eb;
  text-align: left;
  line-height: 1.5;
  font-weight: 700;
}
.gate-note2 {
  margin: 0 0 12px;
  color: #000000;
  text-align: left;
  line-height: 1.5;
  font-weight: 700;
}

/* Groupe label + input généré dynamiquement */
.gate-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.gate-field label {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1rem;
  color: #e5e7eb;
  letter-spacing: 0.04em;
}
.gate-field label .required-star {
  color: #fbbf24;
  margin-left: 2px;
}

.gate-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.25);
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.gate-input:focus {
  border-color: rgba(205,177,96,0.9);
  box-shadow: 0 0 0 3px rgba(205,177,96,0.25);
}
.gate-input::placeholder { color: rgba(255,255,255,0.4); }

.gate-error {
  margin-top: 10px;
  color: #fecaca;
  font-weight: 800;
  display: none;
  text-align: left;
}

/* ========= CONTACT FOOTER ========= */
.contact-footer {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translate(-50%, 0);
  font-size: 1.2rem;
  color: #ffffff;
  background: rgba(0,0,0,0.35);
  padding: 10px 18px;
  border-radius: 14px;
  backdrop-filter: blur(6px);
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  letter-spacing: 0.03em;
  z-index: 999;
  opacity: 1;
  transition: transform 0.6s ease, opacity 0.6s ease;
}
.contact-footer.hidden {
  opacity: 0;
  transform: translate(-50%, 120%);
  pointer-events: none;
}
.contact-footer a { color: #fbbf24; text-decoration: none; font-weight: 700; }
.contact-footer a:hover { text-decoration: underline; }

/* ========= LIENS TÉLÉCHARGEABLES ========= */
.download-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 18px auto 6px;
  max-width: 760px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(205,177,96,0.45);
  color: #fbbf24;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  backdrop-filter: blur(6px);
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.download-link:hover {
  background: rgba(205,177,96,0.18);
  border-color: rgba(205,177,96,0.8);
  transform: translateY(-2px);
}
.download-link:active { transform: translateY(0); }
.download-link .dl-icon { font-size: 1.1rem; }
