/* =========================================================
   RSVP MODAL — FINAL PROFESSIONAL VERSION
   - Overlay never blocks page when hidden
   - Parchment-style modal
   - White framed form container (Google UI behaves)
   - Close button belongs to the modal, not the iframe
========================================================= */

/* ---------------------------------------------------------
   HARD SAFETY — hidden overlay never intercepts clicks
--------------------------------------------------------- */
#rsvp-overlay[hidden]{
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ---------------------------------------------------------
   Overlay
--------------------------------------------------------- */
.rsvp-overlay{
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;
}

/* ---------------------------------------------------------
   Backdrop
--------------------------------------------------------- */
.rsvp-backdrop{
  position: absolute;
  inset: 0;

  background: radial-gradient(
    circle at top,
    rgba(0,0,0,0.55),
    rgba(0,0,0,0.72)
  );
}

/* ---------------------------------------------------------
   Modal container (parchment)
--------------------------------------------------------- */
.rsvp-modal{
  position: relative;
  z-index: 1;

  width: min(840px, 92vw);
  max-height: min(88vh, 860px);

  background: #F8F3EE;
  border-radius: 20px;

  box-shadow: 0 30px 80px rgba(0,0,0,0.28);

  overflow: hidden;
  display: flex;
  flex-direction: column;

  transform: translateY(8px) scale(0.985);
  opacity: 0;
}

/* Open animation */
.rsvp-overlay.is-open .rsvp-modal{
  transition: transform 240ms ease, opacity 240ms ease;
  transform: translateY(0) scale(1);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce){
  .rsvp-overlay.is-open .rsvp-modal{
    transition: none;
  }
}

/* ---------------------------------------------------------
   Paper texture overlay
--------------------------------------------------------- */
.rsvp-modal::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;

  background-image: url("../images/paper-texture.png");
  background-repeat: repeat;
  background-size: 650px;

  opacity: 0.14;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* Ensure content above texture */
.rsvp-modal > *{
  position: relative;
  z-index: 1;
}

/* ---------------------------------------------------------
   Close button (belongs to modal, not iframe)
--------------------------------------------------------- */
.rsvp-close{
  position: absolute;
  top: 16px;
  right: 16px;

  width: 34px;
  height: 34px;

  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  color: #333;

  font-size: 20px;
  line-height: 1;
  cursor: pointer;

  z-index: 5;
}

.rsvp-close:hover{
  background: rgba(0,0,0,0.14);
}

/* ---------------------------------------------------------
   Header (parchment)
--------------------------------------------------------- */
.rsvp-header{
  padding: 20px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.rsvp-title{
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.04em;
}

.rsvp-subtitle{
  margin: 8px 0 0;
  font-size: 13px;
  opacity: 0.75;
  line-height: 1.4;
}

/* ---------------------------------------------------------
   Loader (parchment)
--------------------------------------------------------- */
.rsvp-loader{
  display: none;
  padding: 18px 20px 0;
  gap: 10px;
  align-items: center;
}

.rsvp-loader.is-visible{
  display: flex;
}

.rsvp-spinner{
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,0.15);
  border-top-color: rgba(0,0,0,0.55);
  animation: rsvpSpin 900ms linear infinite;
}

@keyframes rsvpSpin{
  from{ transform: rotate(0deg); }
  to{ transform: rotate(360deg); }
}

.rsvp-loader-text{
  font-size: 12px;
  opacity: 0.75;
}

/* ---------------------------------------------------------
   Form area
   White framed container — iframe stays clean
--------------------------------------------------------- */
.rsvp-form-wrap{
  padding: 20px;
  flex: 1;
  min-height: 0;

  display: flex;
  flex-direction: column;
  gap: 12px;

  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 14px;

  box-shadow:
    0 10px 26px rgba(0,0,0,0.06),
    inset 0 0 0 1px rgba(255,255,255,0.60);
}

/* Iframe stays neutral */
.rsvp-iframe{
  width: 100%;
  flex: 1;
  min-height: 58vh;

  border: 0;
  border-radius: 10px;
  background: transparent;
  display: block;
}

/* Hint under the form */
.rsvp-hint{
  margin: 0;
  font-size: 12px;
  opacity: 0.65;
  text-align: center;
}

/* ---------------------------------------------------------
   Closed state
--------------------------------------------------------- */
.rsvp-closed{
  padding: 20px;
  text-align: center;
}

.rsvp-closed-title{
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.03em;
}

.rsvp-closed-body{
  margin: 10px 0 0;
  font-size: 13px;
  opacity: 0.8;
  line-height: 1.45;
}

/* ---------------------------------------------------------
   FORCE loader to be visually invisible (no layout shift)
--------------------------------------------------------- */
.rsvp-loader{
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}


/* ---------------------------------------------------------
   Responsive
--------------------------------------------------------- */
@media (max-width: 480px){
  .rsvp-overlay{ padding: 12px; }
  .rsvp-modal{ width: 100%; }
  .rsvp-form-wrap{ padding: 16px; }
}