:root {
  --bg: #f5f1e8;
  --bg-alt: #ffffff;
  --ink: #1a1d2b;
  --ink-soft: #4a4e63;
  --muted: #8a8e9e;
  --accent: #2f4a36;
  --accent-hover: #23382a;
  --accent-soft: rgba(47, 74, 54, 0.08);
  --gold: #b08a3e;
  --line: #e6dfce;
  --line-soft: #efe9db;
  --danger: #a8443a;
  --danger-soft: rgba(168, 68, 58, 0.08);
  --shadow-sm: 0 4px 14px rgba(26, 29, 43, 0.06);
  --shadow-md: 0 12px 40px rgba(26, 29, 43, 0.10);
  --shadow-lg: 0 24px 70px rgba(26, 29, 43, 0.14);
  --radius: 18px;
  --radius-sm: 10px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(47, 74, 54, 0.06), transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 90%, rgba(176, 138, 62, 0.05), transparent 60%),
    var(--bg);
  padding: 40px 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ---------- Stage / split layout ---------- */
.stage {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  transition: max-width 0.7s var(--ease), grid-template-columns 0.7s var(--ease);
  padding: 40px 0;
}

.stage.rsvp-open {
  max-width: 1120px;
  grid-template-columns: 1fr 1fr;
}

.card {
  background: var(--bg-alt);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 56px 48px;
  transition: all 0.6s var(--ease);
}

/* ---------- Invitation ---------- */
.invitation {
  text-align: center;
  animation: fadeUp 0.8s var(--ease) both;
}

.logo-wrap {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo {
  max-height: 110px;
  max-width: 160px;
  height: auto;
  width: auto;
  object-fit: contain;
}

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 22px;
}

.personal-lead {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  font-weight: 400;
  color: var(--ink-soft);
  margin-bottom: 14px;
  line-height: 1.4;
}

.personal-lead #personalFirst {
  color: var(--accent);
  font-weight: 500;
  font-style: italic;
}

.eyebrow-sm {
  font-size: 0.72rem;
  margin-bottom: 12px;
}

.title {
  font-family: var(--serif);
  font-weight: 300;
  line-height: 1.0;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.title-line-1 {
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.title-line-2 {
  font-size: clamp(2.6rem, 6.5vw, 4rem);
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
}

.title-line-3 {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  line-height: 1.05;
  margin-top: 2px;
}

/* Thanks-page sub line — smaller italic that stays on one line */
.title-line-sub {
  display: block;
  margin-top: 10px;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3.2vw, 2rem);
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  line-height: 1.15;
}

/* Add-to-calendar row */
.cal-label {
  margin-top: 6px;
  margin-bottom: 10px;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.cal-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.btn-cal {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.18s var(--ease);
  white-space: nowrap;
}

.btn-cal:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.title-in {
  font-style: normal;
  color: var(--ink-soft);
  font-weight: 300;
  margin: 0 4px;
}

.venue-line {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink);
  font-weight: 400;
  margin-bottom: 4px;
}

.venue-line strong { font-weight: 500; }

.host-line {
  font-size: 0.98rem;
  color: var(--ink-soft);
  margin-bottom: 28px;
}

.host-line strong {
  color: var(--ink);
  font-weight: 500;
}

.rule {
  width: 60px;
  height: 1px;
  background: var(--gold);
  margin: 0 auto 28px;
  opacity: 0.6;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 36px;
  text-align: center;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-item-wide {
  grid-column: 1 / -1;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.info-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.info-value {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.35;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--sans);
  font-size: 0.96rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 14px 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s var(--ease);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 4px 14px rgba(26, 29, 43, 0.15);
}

.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(47, 74, 54, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-lg {
  padding: 16px 44px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
  padding: 16px 24px;
  font-size: 1rem;
  margin-top: 8px;
}

/* ---------- RSVP panel ---------- */
.rsvp-panel {
  position: relative;
  opacity: 0;
  transform: translateX(40px) scale(0.98);
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
  padding: 0 48px;
  margin: 0;
  box-shadow: none;
  background: transparent;
}

.stage.rsvp-open .rsvp-panel {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
  max-height: none;
  overflow: visible;
  padding: 56px 48px;
  background: var(--bg-alt);
  box-shadow: var(--shadow-md);
  transition: opacity 0.5s 0.15s var(--ease), transform 0.6s var(--ease), padding 0.6s var(--ease), background 0.6s var(--ease), box-shadow 0.6s var(--ease);
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--line-soft);
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.close-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.rsvp-header {
  margin-bottom: 32px;
}

.rsvp-greeting {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3.5vw, 2.1rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.rsvp-sub {
  color: var(--ink-soft);
  font-size: 0.98rem;
}

/* ---------- Form ---------- */
.rsvp-form { display: flex; flex-direction: column; gap: 20px; }

.field { display: flex; flex-direction: column; gap: 8px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-label {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}

.optional {
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.76rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fdfcf8;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder, textarea::placeholder { color: #b5b8c4; }

textarea { resize: vertical; min-height: 60px; }

.hidden { display: none; }

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  padding-top: 4px;
  font-style: italic;
}

/* ---------- Attending yes/no toggle ---------- */
.toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toggle-group input { position: absolute; opacity: 0; pointer-events: none; }

.toggle-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fdfcf8;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.18s var(--ease);
  user-select: none;
}

.toggle-option svg { opacity: 0; transform: scale(0.8); transition: opacity 0.18s, transform 0.18s; }

.toggle-option:hover {
  border-color: var(--ink-soft);
  background: #fff;
}

.toggle-group input:checked + .toggle-yes {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.toggle-group input:checked + .toggle-no {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 600;
}

.toggle-group input:checked + .toggle-option svg { opacity: 1; transform: scale(1); }

/* ---------- Guest count pills ---------- */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-group input { position: absolute; opacity: 0; pointer-events: none; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fdfcf8;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.18s var(--ease);
  user-select: none;
}

.pill:hover {
  border-color: var(--ink-soft);
  background: #fff;
}

.pill-group input:checked + .pill {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}

/* ---------- Guest name slots ---------- */
.guest-names { display: flex; flex-direction: column; gap: 20px; }
.guest-names:empty { display: none; }

.guest-slot {
  padding: 18px;
  background: #faf7ed;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guest-slot-label {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 48px 24px 36px;
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
  font-family: var(--serif);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .stage.rsvp-open {
    grid-template-columns: 1fr;
    max-width: 560px;
  }
  .card { padding: 44px 32px; }
  .stage.rsvp-open .rsvp-panel { padding: 44px 32px; }
}

@media (max-width: 560px) {
  body { padding: 20px 16px 0; }
  .card { padding: 36px 24px; }
  .stage.rsvp-open .rsvp-panel { padding: 36px 24px; }
  .info-grid { grid-template-columns: 1fr; gap: 16px; }
  .info-item-wide { grid-column: auto; padding-top: 14px; }
  .field-row { grid-template-columns: 1fr; }
  .toggle-group { grid-template-columns: 1fr; }
  .btn-lg { padding: 15px 38px; }
}

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