/* ============ THIỆP MỜI ============ */
.invite-page {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(217, 184, 102, 0.12), transparent 50%),
    linear-gradient(180deg, #042616 0%, #063019 45%, #031910 100%);
  color: var(--cream);
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
}

.invite-page .site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  flex: none;
  background: rgba(4, 38, 22, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(217, 184, 102, 0.28);
}

.invite-page > main.container {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.invite-page .site-footer {
  display: none;
}

.invite-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 0.9rem;
  align-items: stretch;
}

.invite-controls {
  background: #f7f3e8;
  color: #123c26;
  border-radius: 14px;
  padding: 0.85rem 0.9rem 1rem;
  border: 1.5px solid rgba(201, 168, 90, 0.45);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  align-self: start;
  max-height: calc(100dvh - 5.5rem);
  overflow: auto;
}

.invite-controls h2 {
  margin: 0 0 0.65rem;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.05rem;
  color: #0a3d24;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.invite-field {
  margin-bottom: 0.65rem;
}

.invite-field label {
  display: block;
  margin-bottom: 0.22rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a675c;
}

.invite-field input,
.invite-field textarea,
.invite-field select {
  width: 100%;
  border: 1px solid rgba(150, 140, 110, 0.45);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.88rem;
  color: #123c26;
  background: #fffdf7;
  resize: vertical;
}

.invite-field select {
  cursor: pointer;
  resize: none;
}

.invite-field input:focus,
.invite-field textarea:focus,
.invite-field select:focus {
  outline: 2px solid rgba(201, 168, 90, 0.55);
  outline-offset: 1px;
}

.invite-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.invite-actions .btn {
  width: 100%;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.invite-hint {
  margin: 0.1rem 0 0.55rem;
  font-size: 0.72rem;
  color: #6a756c;
  line-height: 1.35;
}

.invite-preview-wrap {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(217, 184, 102, 0.28);
  border-radius: 14px;
  padding: 0.45rem;
  overflow: hidden;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Photo-accurate template — scale to fit viewport */
.invite-card--photo {
  position: relative;
  width: min(100%, calc(100dvh - 5.5rem), 680px);
  max-height: calc(100dvh - 5.5rem);
  margin: 0 auto;
  display: block;
  aspect-ratio: 1 / 1;
  background: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  border-radius: 4px;
  overflow: hidden;
}

.invite-card--photo .invite-base {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}

.invite-guest-layer {
  position: absolute;
  left: 54.7%;
  top: 31.25%;
  width: 40%;
  height: 6.8%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  background: transparent;
  overflow: visible;
  z-index: 2;
}

.inv-guest-photo {
  margin: 0;
  max-width: 100%;
  color: #c62828;
  font-family: "Great Vibes", "Playfair Display", cursive;
  font-weight: 400;
  font-style: normal;
  font-size: clamp(0.7rem, 1.9vw, 1.1rem);
  line-height: 1.2;
  letter-spacing: 0.02em;
  padding: 0 0.15rem;
  word-break: break-word;
  background: transparent;
  box-shadow: none;
  border: none;
}

.inv-guest-photo.font-script {
  font-family: "Great Vibes", cursive;
  font-weight: 400;
  letter-spacing: 0.03em;
}

.inv-guest-photo.font-dancing {
  font-family: "Dancing Script", cursive;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.inv-guest-photo.font-classic {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.inv-guest-photo.font-display {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.inv-guest-photo.font-noto {
  font-family: "Noto Serif Display", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.inv-guest-photo.font-sans {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 800;
  letter-spacing: 0.01em;
}

/* Chỉ áp dụng khi JS xác nhận còn đúng 1 hàng và vừa khung */
.inv-guest-photo.is-single {
  font-size: clamp(1.05rem, 3vw, 1.7rem);
  line-height: 1.25;
  word-break: normal;
  overflow-wrap: normal;
}

.inv-guest-photo.is-single.font-script {
  font-size: clamp(1.25rem, 3.6vw, 2.1rem);
}

.inv-guest-photo.is-single.font-dancing {
  font-size: clamp(1.1rem, 3.2vw, 1.85rem);
}

@media (max-width: 960px) {
  .invite-page > main.container {
    overflow: auto;
  }

  .invite-workspace {
    grid-template-columns: 1fr;
    flex: none;
  }

  .invite-controls {
    position: static;
    max-height: none;
    order: 2;
  }

  .invite-preview-wrap {
    order: 1;
    min-height: min(70dvh, 520px);
  }

  .invite-card--photo {
    width: min(100%, calc(100dvh - 6.5rem), 560px);
    max-height: calc(100dvh - 6.5rem);
  }
}

@media (max-width: 720px) {
  .invite-preview-wrap {
    padding: 0.35rem;
    min-height: min(62dvh, 420px);
  }

  .invite-card--photo {
    width: min(100%, calc(100dvh - 6rem));
    max-height: calc(100dvh - 6rem);
  }

  .inv-guest-photo {
    font-size: clamp(0.55rem, 2.8vw, 0.85rem);
  }

  .inv-guest-photo.is-single {
    font-size: clamp(0.78rem, 3.6vw, 1.15rem);
  }
}

/* Export helper: keep photo card size stable */
.invite-card--photo.invite-card--export {
  width: 1024px !important;
  height: 1024px !important;
  aspect-ratio: 1 / 1 !important;
}

.invite-card--photo.invite-card--export .inv-guest-photo {
  font-size: 16px !important;
}

.invite-card--photo.invite-card--export .inv-guest-photo.is-single {
  font-size: inherit !important;
}
