/* ── Self-hosted fonts (latin only) ── */
@font-face {
  font-family: 'Great Vibes';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/great-vibes-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/cormorant-garamond-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/fonts/cormorant-garamond-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/static/fonts/cormorant-garamond-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --color-bg: #f4efe6;
  --color-card: #fdfbf7;
  --color-text: #3a3a3a;
  --color-text-muted: #666;
  --color-accent: #b8972f;
  --color-accent-light: #d4b44a;
  --color-border: #e0dbd2;
  --color-error: #c0392b;
  --color-success: #27ae60;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Great Vibes", cursive;
  --font-heading: "Cormorant Garamond", "Georgia", serif;
  --max-width: 680px;
}

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

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

/* ── Card ── */
.card {
  max-width: var(--max-width);
  margin: 1.5rem 1rem 0;
  background:
    url(/static/paper-noise.webp) repeat,
    var(--color-card);
  background-blend-mode: multiply;
  border: 1px solid #e8e0d0;
  border-radius: 2px;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
  padding: 3rem 1.25rem 1rem;
  text-align: center;
}

/* ── Foil shimmer gradient ── */
.foil {
  background: linear-gradient(110deg,
      #9a7b2c 0%,
      #b8972f 18%,
      #a08030 32%,
      #edd9a0 44%,
      #faf0cc 49%,
      #fff8e0 50%,
      #faf0cc 51%,
      #edd9a0 56%,
      #a08030 68%,
      #b8972f 82%,
      #9a7b2c 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-position: 80% 0;
}

/* ── Sparkle field ── */
.sparkle-field {
  position: relative;
  display: inline-block;
}

.sparkle {
  position: absolute;
  width: 1px;
  height: 1px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  animation: twinkle var(--dur) ease-in-out var(--delay) infinite;
}

@keyframes twinkle {

  0%,
  100% {
    opacity: 0;
  }

  50% {
    opacity: var(--peak);
  }
}

/* ── Title / hero area ── */
.title {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 400;
  line-height: 1.2;
  margin-top: -0.2em;
  margin-bottom: 0.4rem;
  padding-top: 0.2em;
  padding-bottom: 0.1em;
}

.title .amp {
  display: block;
  font-size: 1.6rem;
  line-height: 1.6;
}

.subtitle {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.4rem;
}

.date {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  opacity: 0.75;
  margin-bottom: 2rem;
}

.divider {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c9a84c, transparent);
  margin: 0 auto 2rem;
}

/* ── Section titles ── */
.section-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: var(--color-accent);
  margin-bottom: 1.25rem;
}

.section-title::after {
  content: "";
  display: block;
  width: 40px;
  height: 1px;
  background: #c9a84c;
  margin: 0.4rem auto 0;
}

/* ── RSVP Container — prevent CLS ── */
.rsvp-container {
  min-height: 400px;
}

/* Hide form when success message is visible */
.rsvp-container:has(.success-message:not([hidden])) #rsvp-form {
  display: none;
}

/* ── Form ── */
.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.form-group textarea {
  resize: none;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  font-family: var(--font-stack);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(184, 151, 47, 0.12);
}

/* ── Your Party section ── */
.your-party {
  border: none;
  padding: 0;
  text-align: left;
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin: 0;
  transition: grid-template-rows 0.5s ease, opacity 0.4s ease 0.1s, margin 0.5s ease;
}

.your-party>* {
  overflow: hidden;
}

.your-party.is-active {
  grid-template-rows: 1fr;
  opacity: 1;
  margin: 1.5rem 0;
}

.your-party legend {
  font-family: var(--font-heading);
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.guest-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.guest-row {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--color-bg);
  border-radius: 4px;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--color-border);
}

.guest-row .guest-name {
  flex: 1;
  margin: 0;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.95rem;
}

.guest-row .guest-name:focus {
  outline: none;
  box-shadow: none;
}

.guest-row--primary .guest-name {
  color: var(--color-text);
  cursor: default;
}

.guest-row--additional {
  background: #fff;
}

.guest-badge {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  background: var(--color-border);
  border-radius: 10px;
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 0.5rem;
}

.btn-remove {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0 0 0 0.5rem;
  line-height: 1;
  transition: color 0.2s;
  margin-left: 0.5rem;
}

.btn-remove:hover {
  color: var(--color-error);
}

.btn-remove:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.btn-secondary {
  background: none;
  border: none;
  padding: 0.5rem 0;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: var(--font-stack);
  color: var(--color-text-muted);
  transition: color 0.2s;
  text-align: left;
}

.btn-secondary:hover {
  color: var(--color-accent);
}

.btn-secondary:focus {
  outline: none;
  text-decoration: underline;
  text-underline-offset: 4px;
  color: var(--color-accent);
}

button[type="submit"] {
  display: block;
  width: 100%;
  margin-top: 3rem;
  margin-bottom: 0;
  padding: 0.85rem;
  font-size: 1rem;
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-light) 100%);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(184, 151, 47, 0.2);
}

button[type="submit"]:hover {
  box-shadow: 0 4px 14px rgba(184, 151, 47, 0.3);
}

button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button[type="submit"]:focus {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 2px;
}

/* ── Form message states ── */
#form-message {
  margin-top: 0.5rem;
  padding: 0;
  text-align: center;
  font-size: 0.95rem;
  min-height: 0;
}

#form-message.loading {
  color: var(--color-accent);
}

#form-message.success {
  display: none;
}

#form-message.error {
  color: var(--color-error);
}

/* ── Success message ── */
.success-message {
  text-align: center;
  padding: 4rem 1rem 2rem;
  animation: fadeInUp 0.5s ease both;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 350px;
}

.success-message[hidden] {
  display: none;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.success-message h3 {
  margin-bottom: 1.5rem;
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 400;
  line-height: 1.2;
  padding-top: 0.2em;
  padding-bottom: 0.1em;
  margin-top: -0.2em;
}

.success-message p {
  margin-bottom: 2rem;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: 1.3rem;
  line-height: 1.4;
}

/* ── Success actions ── */
.success-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
}

.calendar-actions {
  display: flex;
}

.calendar-buttons {
  display: flex;
  gap: 0.5rem;
}

.calendar-buttons[hidden] {
  display: none;
}

.btn-action {
  display: inline-block;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.55rem 1.5rem;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  cursor: pointer;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-align: center;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.btn-action[hidden] {
  display: none;
}

.btn-action:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.btn-action:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Details section (below card) ── */
.details {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem;
  text-align: center;
}

.venue-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
}

.venue-address {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.venue-address a {
  color: inherit;
  text-decoration: none;
}

.map-fallback a {
  color: var(--color-accent);
}

.map-frame {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
}

/* ── Detail grid ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem 3rem;
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}

.detail-item p {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--color-text);
  line-height: 1.5;
}

.detail-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.4rem;
}

@media (max-width: 479px) {
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .detail-item {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--color-border);
  }

  .detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .detail-item:first-child {
    padding-top: 0;
  }
}

/* ── Fade-in animation ── */
[data-animate] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

footer a {
  color: var(--color-accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ── Responsive ── */
@media (min-width: 480px) {
  .card {
    margin: 2.5rem auto 0;
    padding: 3.5rem 2rem 3rem;
  }

  .title {
    font-size: 3.2rem;
  }

  .title .amp {
    display: inline;
    font-size: inherit;
    line-height: inherit;
  }
}

@media (min-width: 768px) {
  .card {
    padding: 5rem 3rem 4rem;
    margin: 4rem auto 0;
  }

  .title {
    font-size: 5rem;
  }

  .subtitle {
    font-size: 1.3rem;
  }

  .date {
    font-size: 1.1rem;
  }

  .details {
    padding: 3rem 2rem;
  }

  .btn-secondary {
    width: auto;
    min-width: 200px;
  }
}