:root {
  --blush: #e8c4c4;
  --blush-deep: #d4a5a5;
  --ivory: #faf7f2;
  --ivory-warm: #f5efe6;
  --champagne: #c9a96e;
  --gold: #b8956a;
  --gold-dark: #8b6f47;
  --sage: #9aab8e;
  --sage-light: #c5d4bc;
  --sage-muted: #7d8f72;
  --purple: #6b4c9a;
  --purple-deep: #4a3470;
  --purple-light: #9b7ec8;
  --purple-pale: #f3eef9;
  --text: #4a4035;
  --text-soft: #6b5f52;
  --bg: #ebe4d8;
  --white: #ffffff;
  --shadow: 0 8px 32px rgba(74, 64, 53, 0.1);
  --shadow-purple: 0 12px 40px rgba(107, 76, 154, 0.25);
  --radius: 12px;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-script: 'Great Vibes', cursive;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 4rem; }

body {
  font-family: var(--font-serif);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--gold-dark); text-decoration: none; }
a:hover { color: var(--champagne); }

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

.script { font-family: var(--font-script); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border: 1px solid var(--champagne);
  background: linear-gradient(180deg, #f0e4d0 0%, #e8d5b0 100%);
  color: var(--gold-dark);
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-transform: uppercase;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  color: var(--gold-dark);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--champagne);
}

.btn-sage {
  background: linear-gradient(180deg, #d5e0cc 0%, var(--sage-light) 100%);
  border-color: var(--sage);
}

.btn-purple {
  background: linear-gradient(180deg, var(--purple-light) 0%, var(--purple) 100%);
  border-color: var(--purple-deep);
  color: var(--white);
}

.btn-purple:hover {
  color: var(--white);
  box-shadow: var(--shadow-purple);
}

.secret-banner {
  background: linear-gradient(90deg, var(--purple-deep), var(--purple));
  color: var(--white);
  text-align: center;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hero-invitation {
  padding: 2rem 0 3rem;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(155, 126, 200, 0.15), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(201, 169, 110, 0.12), transparent 45%),
    var(--purple-pale);
}

.invitation-card {
  max-width: min(380px, 92vw);
  margin: 1rem auto 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-purple);
  border: 3px solid rgba(255, 255, 255, 0.6);
  background: var(--white);
}

.invitation-image {
  width: 100%;
  height: auto;
  display: block;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.hero-welcome {
  max-width: 560px;
  margin: 0 auto;
  font-size: 1.1rem;
  color: var(--text-soft);
  font-style: italic;
  line-height: 1.7;
}

.map-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 2rem;
  text-align: center;
  background: var(--purple-pale);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 247, 242, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(201, 169, 110, 0.25);
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0;
}

.brand {
  font-family: var(--font-script);
  font-size: 1.5rem;
  color: var(--gold-dark);
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero {
  position: relative;
  padding: 4rem 0 3rem;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(232, 196, 196, 0.25), transparent 50%),
    radial-gradient(ellipse at 80% 30%, rgba(197, 212, 188, 0.2), transparent 45%),
    var(--ivory);
  z-index: -1;
}

.hero-badge {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--sage-muted);
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-family: var(--font-script);
  font-size: clamp(2.4rem, 8vw, 4rem);
  color: var(--gold-dark);
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.hero-number {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 600;
  color: var(--champagne);
  line-height: 1;
  margin: 0.5rem 0 1rem;
}

.section {
  padding: 3.5rem 0;
}

.section-title {
  text-align: center;
  margin-bottom: 2rem;
}

.section-title h2 {
  font-family: var(--font-script);
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  color: var(--gold-dark);
}

.section-title p {
  color: var(--text-soft);
  font-style: italic;
  margin-top: 0.35rem;
}

.card {
  background: var(--ivory);
  border: 1px solid rgba(201, 169, 110, 0.35);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.grid-2 {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  max-width: 480px;
  margin: 0 auto;
}

.countdown-item {
  text-align: center;
  padding: 1rem 0.5rem;
  background: var(--ivory);
  border: 1px solid rgba(201, 169, 110, 0.3);
  border-radius: var(--radius);
}

.countdown-item strong {
  display: block;
  font-size: 1.75rem;
  color: var(--gold-dark);
  line-height: 1;
}

.countdown-item span {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sage-muted);
}

.detail-row {
  display: flex;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(201, 169, 110, 0.15);
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  min-width: 90px;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--champagne);
  font-weight: 600;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.photo-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.photo-admin-card {
  padding: 1rem;
}

.photo-admin-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(201, 169, 110, 0.25);
}

.map-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(201, 169, 110, 0.3);
  min-height: 260px;
  background: var(--ivory-warm);
}

.map-wrap iframe {
  width: 100%;
  height: 280px;
  border: 0;
}

.site-footer {
  text-align: center;
  padding: 2.5rem 0;
  color: var(--text-soft);
  font-style: italic;
  border-top: 1px solid rgba(201, 169, 110, 0.2);
  background: var(--ivory);
}

/* Forms */
.form-card {
  max-width: 560px;
  margin: 0 auto;
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--champagne);
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(201, 169, 110, 0.4);
  border-radius: 8px;
  background: var(--white);
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text);
}

.form-control:focus {
  outline: none;
  border-color: var(--champagne);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.15);
}

.radio-group {
  display: grid;
  gap: 0.75rem;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid rgba(201, 169, 110, 0.3);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
}

.radio-option:has(input:checked) {
  border-color: var(--champagne);
  background: rgba(232, 213, 176, 0.15);
}

.alert {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
}

.alert-success {
  background: rgba(197, 212, 188, 0.25);
  border: 1px solid var(--sage-light);
  color: var(--sage-muted);
}

.alert-error {
  background: rgba(232, 196, 196, 0.25);
  border: 1px solid var(--blush);
  color: #8b5a5a;
}

.pass-card {
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
  padding: 2rem;
  background: var(--ivory);
  border: 2px solid var(--champagne);
  border-radius: var(--radius);
}

.pass-card .qr {
  margin: 1.25rem auto;
  padding: 0.75rem;
  background: white;
  border: 1px solid rgba(201, 169, 110, 0.3);
  display: inline-block;
  border-radius: 8px;
}

.hidden { display: none !important; }

.fade-in {
  animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Admin */
.admin-body { background: #f3f0ea; }
.admin-nav {
  background: var(--text);
  color: var(--ivory);
  padding: 1rem 0;
}
.admin-nav .inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.admin-nav a { color: var(--ivory-warm); }
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: white;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid rgba(201, 169, 110, 0.2);
  text-align: center;
}
.stat-card strong {
  display: block;
  font-size: 1.75rem;
  color: var(--gold-dark);
}
.stat-card span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
}
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
  font-size: 0.95rem;
}
th {
  background: var(--ivory-warm);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--champagne);
}
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: capitalize;
}
.badge-confirmed { background: #e0ead8; color: #5a6b50; }
.badge-declined { background: #f0e0e0; color: #8b5a5a; }
.badge-pending { background: #f5efe6; color: #8b6f47; }

.checkin-body {
  min-height: 100vh;
  background: var(--text);
  color: var(--ivory);
  padding: 1.5rem;
}
#reader { width: 100%; max-width: 400px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; }
.checkin-result {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  text-align: center;
}
.checkin-result.valid { background: rgba(154, 171, 142, 0.2); border: 1px solid var(--sage); }
.checkin-result.warning { background: rgba(232, 213, 176, 0.2); border: 1px solid var(--champagne); }
.checkin-result.invalid { background: rgba(232, 196, 196, 0.2); border: 1px solid var(--blush); }

/* ── RSVP loading overlay ─────────────────────────────────── */

body.rsvp-loading-active {
  overflow: hidden;
}

.rsvp-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(45, 28, 68, 0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.rsvp-loading-overlay.is-active {
  display: flex !important;
}

.rsvp-loading-panel {
  text-align: center;
  max-width: 380px;
  width: 100%;
  padding: 2rem 1.5rem 1.75rem;
  background: #ffffff;
  border: 2px solid var(--champagne);
  border-radius: 18px;
  box-shadow: 0 28px 72px rgba(30, 15, 45, 0.45);
}

.rsvp-loading-spinner {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  border: 5px solid #e8dff5;
  border-top-color: var(--purple);
  border-right-color: var(--champagne);
  border-radius: 50%;
  animation: rsvpSpin 0.85s linear infinite;
}

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

.rsvp-loading-title {
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.rsvp-loading-message {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--purple-deep);
  line-height: 1.5;
  min-height: 3rem;
  margin: 0 0 1.25rem;
}

.rsvp-loading-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
}

.rsvp-loading-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--text-soft);
  padding: 0.4rem 0;
  line-height: 1.4;
  transition: color 0.25s ease;
}

.rsvp-loading-steps li.is-active {
  color: var(--purple-deep);
  font-weight: 600;
}

.rsvp-loading-steps li.is-done {
  color: var(--sage-muted);
}

.rsvp-loading-steps li::before {
  content: '';
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: #d4c8e8;
}

.rsvp-loading-steps li.is-active::before {
  background: var(--purple);
  box-shadow: 0 0 0 3px rgba(107, 76, 154, 0.25);
}

.rsvp-loading-steps li.is-done::before {
  background: var(--sage);
}

.rsvp-success-banner {
  max-width: 640px;
  margin: 0 auto 2rem;
  text-align: center;
  line-height: 1.65;
}

.rsvp-pass-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .rsvp-pass-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rsvp-loading-spinner {
    animation: none;
    border-top-color: var(--purple);
    border-right-color: var(--champagne);
  }
}
