:root {
  --bg: #141312;
  --surface: #1c1b19;
  --surface-2: #232220;
  --line: #3a3733;
  --line-soft: #2a2826;
  --text: #f3eee6;
  --muted: #a39d93;
  --faint: #6f6a63;
  --ivory: #efe9df;
  --error: #e4a593;
  --serif: 'Cormorant Garamond', 'Cormorant', Georgia, serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 24px 64px;
}

/* ---------- Cabecera ---------- */
.save-the-date {
  margin: 0 auto 36px;
  text-align: center;
  font-weight: 400;
  font-size: clamp(26px, 6vw, 34px);
  letter-spacing: .22em;
  line-height: 1.25;
  font-variant: small-caps;
  text-transform: lowercase;
}
.save-the-date span {
  display: inline-block;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--text);
}

.photo {
  width: 100%;
  height: auto;
  max-height: 78svh;
  aspect-ratio: 15 / 17;
  object-fit: cover;
  filter: grayscale(1) contrast(1.02);
  background: var(--surface);
}

/* ---------- Datos del evento ---------- */
.event { text-align: center; padding: 44px 0 8px; }

.names {
  margin: 0;
  font-weight: 400;
  font-size: clamp(20px, 5vw, 30px);
  letter-spacing: .28em;
  text-transform: uppercase;
  padding-left: .28em; /* compensa el tracking para centrar ópticamente */
}
.tagline {
  margin: 6px 0 28px;
  font-style: italic;
  font-size: clamp(24px, 5.5vw, 32px);
}
.weekday {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  letter-spacing: .3em;
  text-transform: uppercase;
  padding-left: .3em;
}
.date {
  margin: 2px 0 10px;
  font-weight: 500;
  font-size: clamp(30px, 7.4vw, 44px);
  letter-spacing: .1em;
  text-transform: uppercase;
  line-height: 1.15;
}
.detail {
  margin: 0 0 8px;
  font-size: clamp(16px, 3.6vw, 20px);
  letter-spacing: .3em;
  text-transform: uppercase;
  padding-left: .3em;
}
.rule {
  width: 210px;
  height: 1px;
  margin: 36px auto;
  background: var(--text);
  border: 0;
}
.dress {
  margin: 0 0 18px;
  font-size: clamp(15px, 3.5vw, 19px);
  letter-spacing: .3em;
  text-transform: uppercase;
  text-wrap: balance;
  padding-left: .3em;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 40px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 20px;
}
.links a, .links button {
  background: none;
  border: 0;
  padding: 2px 0;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: opacity .2s var(--ease);
}
.links a:hover, .links button:hover { opacity: .7; }
.links li:last-child { flex-basis: 100%; text-align: center; }

.divider { height: 1px; background: var(--line); border: 0; margin: 56px 0 52px; }

/* ---------- Formulario ---------- */
.rsvp-head { text-align: center; margin-bottom: 40px; }
.rsvp-head h2 {
  margin: 0;
  font-weight: 500;
  font-style: italic;
  font-size: clamp(30px, 7vw, 40px);
  line-height: 1.15;
}
.rsvp-head p { margin: 8px 0 0; color: var(--muted); font-size: 19px; }

.label {
  display: block;
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.hint { margin: -4px 0 16px; color: var(--muted); font-size: 17px; }

fieldset { border: 0; margin: 0 0 36px; padding: 0; min-width: 0; }

/* Botones Sí / No: misma altura, texto centrado y alineado */
.choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  padding: 14px 12px;
  text-align: center;
  text-wrap: balance;
  font-size: clamp(15px, 3.6vw, 19px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: .16em;
  text-transform: uppercase;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.choice label:hover { border-color: var(--muted); }
.choice input:focus-visible + label { outline: 1px solid var(--text); outline-offset: 3px; }
.choice input:checked + label { background: var(--ivory); color: var(--bg); border-color: var(--ivory); }

/* Asistentes */
.guest {
  position: relative;
  padding: 24px 22px 22px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  animation: rise .35s var(--ease);
}
.guest-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.guest-remove {
  position: absolute;
  top: 16px; right: 14px;
  background: none; border: 0;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: .08em;
  cursor: pointer;
  padding: 4px 6px;
}
.guest-remove:hover { color: var(--text); }
.field-label { display: block; margin: 16px 0 8px; font-style: italic; font-size: 16px; color: var(--muted); }

.input, .textarea {
  width: 100%;
  padding: 14px 14px;
  font-size: 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  transition: border-color .2s var(--ease);
  -webkit-appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus { border-color: var(--muted); }
.input.invalid { border-color: var(--error); }
.textarea { min-height: 96px; resize: vertical; }

.btn {
  display: block;
  width: 100%;
  min-height: 62px;
  padding: 16px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: .24em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  transition: background .25s var(--ease), opacity .25s var(--ease), border-color .25s var(--ease);
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--ivory); color: var(--bg); border-color: var(--ivory); }
.btn-primary:hover { opacity: .9; }
.btn[disabled] { opacity: .5; cursor: progress; }

.dietary-wrap[hidden] { display: none; }

/* Casilla "Queremos ir en autobús" */
.check {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  font-size: 19px;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  transition: border-color .2s var(--ease);
}
.check:hover { border-color: var(--muted); }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  flex: none;
  position: relative;
  width: 22px; height: 22px;
  border: 1px solid var(--muted);
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.check-box::after {
  content: '';
  position: absolute;
  left: 7px; top: 3px;
  width: 6px; height: 11px;
  border: solid var(--bg);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .2s var(--ease);
}
.check input:checked + .check-box { background: var(--ivory); border-color: var(--ivory); }
.check input:checked + .check-box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .check-box { outline: 1px solid var(--text); outline-offset: 3px; }

/* Autobuses */
#bus-options { margin-top: 26px; animation: rise .35s var(--ease); }
.bus-group + .bus-group { margin-top: 30px; }
.bus-group-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.bus-group-title span { font-weight: 400; letter-spacing: .04em; text-transform: none; font-style: italic; color: var(--muted); font-size: 17px; }
.bus-list { display: grid; gap: 10px; }
.bus-list input { position: absolute; opacity: 0; pointer-events: none; }
.bus-card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.bus-card:hover { border-color: var(--muted); }
.bus-list input:checked + .bus-card { border-color: var(--ivory); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--ivory); }
.bus-list input:focus-visible + .bus-card { outline: 1px solid var(--text); outline-offset: 3px; }
.bus-card.is-full { opacity: .45; cursor: not-allowed; }
.bus-time {
  flex: none;
  min-width: 64px;
  font-size: 26px;
  font-weight: 500;
  line-height: 1.1;
  font-variant-numeric: lining-nums tabular-nums;
}
.bus-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bus-label { font-size: 19px; font-weight: 500; line-height: 1.3; }
.bus-address { color: var(--muted); font-size: 16px; }
.bus-map { font-size: 16px; }
.bus-map a { color: var(--text); text-decoration: none; border-bottom: 1px solid currentColor; }
.bus-notes { color: var(--muted); font-size: 16px; font-style: italic; }
.bus-seats { margin-top: 2px; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: #ecd49a; }
.bus-none { align-items: center; min-height: 56px; }
.bus-none .bus-label { color: var(--muted); font-weight: 400; font-style: italic; }

.form-error { min-height: 24px; margin: 14px 0 0; text-align: center; color: var(--error); font-size: 17px; }

/* Gracias */
.thanks { text-align: center; padding: 24px 0 8px; animation: rise .5s var(--ease); }
.thanks h2 { margin: 0 0 12px; font-weight: 500; font-style: italic; font-size: clamp(30px, 7vw, 40px); }
.thanks p { margin: 0 auto 8px; max-width: 460px; color: var(--muted); font-size: 19px; }

/* Respuesta ya enviada */
.existing {
  padding: 30px 26px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  animation: rise .4s var(--ease);
}
.existing-kicker {
  margin: 0 0 14px;
  font-size: 15px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
}
.existing-status { margin: 0 0 6px; font-size: clamp(26px, 6vw, 32px); font-style: italic; font-weight: 500; }
#existing-summary p { margin: 0 0 4px; font-size: 19px; }
#existing-summary p.muted { color: var(--muted); font-size: 17px; }
.existing .btn { margin-top: 24px; }

.link-btn {
  display: inline-block;
  margin-top: 18px;
  padding: 2px 0;
  font-size: 17px;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 1px solid currentColor;
  cursor: pointer;
}
.link-btn:hover { color: var(--text); }

.edit-link {
  margin: 28px auto 0;
  padding: 22px 22px 20px;
  max-width: 500px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.edit-link p { margin: 0 0 16px !important; font-size: 17px !important; }

footer {
  margin-top: 64px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: .24em;
  text-transform: uppercase;
}

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 420px) {
  .page { padding: 44px 18px 52px; }
  .choice { gap: 10px; }
  .choice label { letter-spacing: .12em; min-height: 78px; }
  .btn { letter-spacing: .16em; font-size: 15px; }
  .links { gap: 10px 24px; font-size: 18px; }
  .detail, .dress { letter-spacing: .2em; padding-left: .2em; }
  .names { letter-spacing: .2em; padding-left: .2em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
