/* ============================================================
   invite.css — Card flip invitation page
   Variables heredadas del tema (inyectadas por inline script)
   ============================================================ */

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

html {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  background: var(--paper);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 60px;
  overflow-x: hidden;
}

/* ── Estado de carga / error ───────────────────── */
.inv-loading,
.inv-unavailable {
  text-align: center;
  padding: 60px 24px;
}
.inv-loading-mark,
.inv-unavail-mark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 20px;
  color: var(--ink-mute);
}
.inv-unavail-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 32px;
  color: var(--ink);
  margin: 16px 0 8px;
  letter-spacing: -0.02em;
}
.inv-unavail-sub {
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.6;
}

/* ── Botón volver ──────────────────────────────── */
.inv-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  text-decoration: none;
  margin-bottom: 14px;
  transition: color 0.15s;
}
.inv-back:hover { color: var(--ink); }

/* ── Wrapper de la card ────────────────────────── */
.inv-scene {
  width: 100%;
  max-width: 380px;
  perspective: 1200px;
}

/* ── Card principal ────────────────────────────── */
.inv-card {
  position: relative;
  width: 100%;
  height: min(580px, 82vh);
  height: min(580px, 82dvh);
  background: #fff;
  border: 1px solid var(--hairline);
  box-shadow: 0 30px 80px rgba(42, 38, 32, 0.12);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  will-change: transform;
  transition: box-shadow 0.4s ease;
}
.inv-card:hover {
  box-shadow: 0 40px 100px rgba(42, 38, 32, 0.16);
}
.inv-card:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 8px;
}

/* ── Paneles ───────────────────────────────────── */
.inv-panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow-y: auto;
}
.inv-panel.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
[data-flip-panel="location"] {
  overflow: hidden;
}

/* ── Panel 1 — Invitación ──────────────────────── */
.p1-photo {
  height: 66%;
  background-color: var(--cream);
  background-size: cover;
  background-position: center 40%;
  position: relative;
  flex-shrink: 0;
}
.p1-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(42, 38, 32, 0.55));
}
.p1-photo-names {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  z-index: 1;
  text-align: center;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 34px;
  line-height: 1;
  color: white;
  letter-spacing: -0.02em;
}
.p1-photo-names .amp {
  display: block;
  font-style: italic;
  font-size: 22px;
  margin: 4px 0;
  color: rgba(255, 255, 255, 0.72);
}
.p1-body {
  min-height: 34%;
  padding: 18px 28px 58px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fff;
}

.p1-music {
  align-items: center;
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--terracotta);
  font: 700 9px/1 var(--sans);
  justify-content: center;
  letter-spacing: 0.14em;
  margin-top: 12px;
  max-width: 250px;
  overflow: hidden;
  padding: 9px 13px;
  text-decoration: none;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.inv-thanks-note {
  margin: 12px auto 0;
  max-width: 280px;
  border: 1px solid rgba(190, 110, 75, 0.24);
  border-radius: 6px;
  padding: 9px 12px;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-soft);
  background: rgba(190, 110, 75, 0.08);
  text-align: center;
}

/* ── Panel 2 — El día ──────────────────────────── */
.p2-paper {
  height: 100%;
  min-height: 0;
  padding: 26px 24px 54px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,244,236,0.96));
  display: flex;
  flex-direction: column;
}
.p2-paper.is-single-event {
  justify-content: flex-start;
}
.p2-location-name {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(30px, 8.5vw, 38px);
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: var(--terracotta);
  margin: 8px 0 4px;
  text-align: center;
}
.p2-location-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  line-height: 1.25;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 10px;
}
.p2-map {
  height: 96px;
  margin-bottom: 8px;
  position: relative;
  border: 1px solid var(--hairline);
  background: var(--bone);
  overflow: hidden;
  border-radius: 2px;
}
.p2-map.is-single-location {
  height: 128px;
  margin-bottom: 10px;
}
.p2-paper.is-single-event .p2-map {
  flex: 1 1 150px;
  height: auto;
  min-height: 132px;
  max-height: 188px;
}
.p2-paper.is-single-event .p2-map.is-single-location {
  height: auto;
}
.p2-map iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  filter: saturate(0.68) contrast(0.96);
}
/* Capa transparente que cubre todo el mapa: tocar cualquier parte abre
   Google Maps en la dirección. Va por encima del iframe. */
.p2-map-cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  cursor: pointer;
}
.p2-events {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  margin-top: 4px;
  min-height: 0;
}
.p2-paper.is-single-event .p2-events {
  background: rgba(248, 244, 236, 0.46);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  flex: 0 0 auto;
  margin-top: 8px;
  padding: 2px 12px;
}
.p2-paper.is-single-event .p2-event {
  padding: 10px 0;
}
.p2-no-events {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-mute);
  text-align: center;
  padding: 24px 0 8px;
  line-height: 1.6;
}
.p2-event {
  padding: 8px 0;
  border-top: 1px solid var(--hairline);
}
.p2-event:first-child { border-top: none; }
.p2-event-label {
  font-size: 8px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 3px;
}
.p2-event-val {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  font-weight: 300;
  color: var(--ink);
  line-height: 1.18;
}
.p2-event-addr {
  font-size: 10px;
  color: var(--ink-mute);
  margin-top: 2px;
}
.p2-event-dress {
  align-items: center;
  background: rgba(248, 244, 236, 0.88);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  grid-template-columns: 92px 1fr;
  margin-top: 8px;
  margin-bottom: 0;
  padding: 9px 12px;
}
.p2-event-dress .p2-event-label {
  margin-bottom: 0;
}
.p2-event-dress .p2-event-val {
  font-size: 13px;
}

/* ── Panel 3 — Regalos ─────────────────────────── */
[data-flip-panel="gifts"] {
  display: flex;
  flex-direction: column;
}
.p3-head {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
  background: var(--paper);
}
.p3-couple {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 18px;
  color: var(--ink);
}
.p3-couple .amp { color: var(--terracotta); font-style: normal; }
.p3-body {
  padding: 18px 20px 24px;
  background: var(--paper);
  flex: 1;
  display: flex;
  flex-direction: column;
}
.p3-code-box {
  background: var(--ink);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.p3-code-label {
  font-size: 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
.p3-code-value {
  font-size: 22px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.18em;
  font-family: var(--sans);
}
.p3-copy-btn {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--terracotta);
  color: white;
  border: none;
  border-radius: 5px;
  padding: 7px 12px;
  cursor: pointer;
  font-family: var(--sans);
  transition: opacity 0.15s;
}
.p3-copy-btn:active { opacity: 0.75; }
.p3-copy-btn.copied { background: var(--sage-deep); }
.p3-gifts-list { display: grid; gap: 0; }
.p3-footer {
  margin-top: auto;
  padding-top: 20px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 11px;
  color: var(--ink-mute);
  text-align: center;
  letter-spacing: 0.04em;
}
.p3-gift-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--hairline);
}
.p3-gift-row:last-child { border-bottom: none; }
.p3-gift-swatch {
  width: 38px;
  height: 38px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--cream);
}
.p3-gift-info { flex: 1; min-width: 0; }
.p3-gift-name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p3-gift-price {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 2px;
  letter-spacing: 0.03em;
}
.p3-gift-btn {
  font-size: 9px;
  letter-spacing: 0.08em;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--terracotta);
  border-radius: 5px;
  padding: 7px 12px;
  white-space: nowrap;
  cursor: pointer;
  font-family: var(--sans);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
  display: inline-block;
}
.p3-gift-btn:hover {
  background: var(--terracotta);
  color: white;
  border-color: var(--terracotta);
}
.p3-gift-btn.is-disabled,
.p3-gift-btn.is-disabled:hover {
  background: rgba(42, 38, 32, 0.05);
  border-color: rgba(42, 38, 32, 0.09);
  color: var(--ink-mute);
  cursor: default;
  pointer-events: none;
}
.p3-gift-row.is-sold-out .p3-gift-name,
.p3-gift-row.is-sold-out .p3-gift-price {
  opacity: 0.45;
}

/* ── Elementos compartidos ─────────────────────── */
.inv-eyebrow {
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 10px;
}
.inv-date {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14.5px;
  line-height: 1.28;
  color: var(--ink-mute);
  max-width: 260px;
  margin: 0 auto;
  text-wrap: balance;
}

/* ── Flip hint ─────────────────────────────────── */
.flip-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--terracotta);
  text-shadow: none;
  opacity: 0;
  animation: hint-rise 0.6s ease-out 1.6s forwards;
  transition: opacity 0.5s ease;
  white-space: nowrap;
}
.flip-hint.touched { opacity: 0 !important; animation: none; pointer-events: none; }
@keyframes hint-rise {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.flip-hint.on-paper {
  position: static;
  transform: none;
  justify-content: center;
  margin-top: 24px;
  color: var(--terracotta);
  text-shadow: none;
  opacity: 1;
  animation: none;
}
.p3-body > .flip-hint.on-paper {
  margin-top: 14px;
  flex-shrink: 0;
  font-size: 8px;
}
.flip-hint i {
  display: block;
  width: 32px;
  height: 1px;
  background: currentColor;
  position: relative;
  animation: hint-nudge 2s ease-in-out 2.4s infinite;
}
.flip-hint.on-paper i { animation: hint-nudge 2s ease-in-out infinite; }
@keyframes hint-nudge {
  0%, 100% { transform: translateX(0); opacity: 1; }
  45%  { transform: translateX(6px); opacity: 0.65; }
  75%  { transform: translateX(3px); opacity: 0.85; }
}
.flip-hint i::after {
  content: "";
  position: absolute;
  right: 0;
  top: -4px;
  width: 7px;
  height: 7px;
  border-right: 1px solid currentColor;
  border-top: 1px solid currentColor;
  transform: rotate(45deg);
}

/* ── Flip dots ─────────────────────────────────── */
.flip-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 20px;
}
.flip-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--line);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: width 0.4s cubic-bezier(0.34, 1.14, 0.64, 1), background 0.25s ease;
}
.flip-dot.active { width: 22px; background: var(--terracotta); }

/* ── Marca inferior ────────────────────────────── */
.inv-footer-mark {
  margin-top: 24px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  color: var(--ink-mute);
}
.inv-footer-mark .dot { color: var(--terracotta); }

/* ── Mobile: fit the full shared card without losing key info ── */
@media (max-width: 430px) {
  body {
    justify-content: flex-start;
    padding: 18px 12px max(34px, env(safe-area-inset-bottom));
  }

  .inv-loading,
  .inv-unavailable {
    padding: 42px 18px;
  }

  .inv-scene {
    max-width: min(352px, 100%);
  }

  .inv-card {
    height: min(560px, calc(100vh - 92px));
    height: min(560px, calc(100dvh - 92px));
    min-height: 520px;
  }

  .p1-photo {
    height: 63%;
  }

  .p1-photo-names {
    bottom: 16px;
    font-size: 31px;
  }

  .p1-photo-names .amp {
    font-size: 20px;
  }

  .p1-body {
    min-height: 37%;
    padding: 15px 20px 48px;
  }

  .inv-eyebrow {
    font-size: 8px;
    margin-bottom: 8px;
  }

  .inv-date {
    max-width: 236px;
    font-size: 13px;
    line-height: 1.25;
  }

  .p1-music {
    max-width: 226px;
    padding: 8px 11px;
    font-size: 8px;
  }

  .p2-paper {
    padding: 20px 18px 42px;
  }

  .p2-location-name {
    font-size: 30px;
    margin: 4px 0 3px;
  }

  .p2-location-sub {
    font-size: 12px;
    margin-bottom: 7px;
  }

  .p2-map {
    height: 82px;
    margin-bottom: 6px;
  }

  .p2-map.is-single-location {
    height: 104px;
    margin-bottom: 8px;
  }

  .p2-paper.is-single-event .p2-events {
    margin-top: 6px;
    padding: 1px 10px;
  }

  .p2-event {
    padding: 6px 0;
  }

  .p2-event-label {
    font-size: 7px;
    letter-spacing: 0.2em;
  }

  .p2-event-val {
    font-size: 12.5px;
    line-height: 1.16;
  }

  .p2-event-addr {
    font-size: 9.5px;
    line-height: 1.25;
  }

  .p2-event-dress {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 8px;
    margin-top: 7px;
    padding: 8px 10px;
  }

  .p2-event-dress .p2-event-val {
    font-size: 12px;
  }

  .p3-head {
    padding: 16px 18px 10px;
  }

  .p3-couple {
    font-size: 16px;
  }

  .p3-body {
    padding: 14px 16px 18px;
  }

  .p3-code-box {
    border-radius: 7px;
    margin-bottom: 10px;
    padding: 10px 12px;
  }

  .p3-code-value {
    font-size: 18px;
  }

  .p3-copy-btn {
    padding: 6px 10px;
    font-size: 8px;
  }

  .p3-gift-row {
    gap: 9px;
    padding: 8px 0;
  }

  .p3-gift-swatch {
    width: 32px;
    height: 32px;
  }

  .p3-gift-name {
    font-size: 13px;
  }

  .p3-gift-price {
    font-size: 10px;
  }

  .p3-gift-btn {
    padding: 6px 9px;
    font-size: 8px;
  }

  .p3-footer {
    padding-top: 14px;
  }

  .flip-hint {
    bottom: 14px;
    font-size: 8px;
  }

  .flip-hint.on-paper {
    margin-top: auto;
    padding-top: 10px;
  }

  .flip-dots {
    margin-top: 14px;
  }

  .inv-footer-mark {
    margin-top: 18px;
  }
}

@media (max-width: 430px) and (max-height: 700px) {
  body {
    padding-top: 12px;
  }

  .inv-back {
    margin-bottom: 10px;
  }

  .inv-card {
    height: calc(100vh - 74px);
    height: calc(100dvh - 74px);
    min-height: 496px;
  }

  .p1-photo {
    height: 61%;
  }

  .p1-photo-names {
    bottom: 14px;
    font-size: 28px;
  }

  .p1-body {
    padding-top: 12px;
    padding-bottom: 40px;
  }

  .p2-paper {
    padding: 17px 17px 36px;
  }

  .p2-location-name {
    font-size: 27px;
  }

  .p2-map {
    height: 70px;
  }

  .p2-map.is-single-location {
    height: 92px;
  }

  .p2-event {
    padding: 5px 0;
  }

  .p2-event-dress {
    padding: 7px 9px;
  }
}

/* ── Final mobile fit: size the card by available height as well as width ── */
@media (max-width: 430px) {
  .inv-scene {
    width: min(100%, 352px, calc((100vh - 92px) * 0.655));
    width: min(100%, 352px, calc((100svh - 92px) * 0.655));
    width: min(100%, 352px, calc((100dvh - 92px) * 0.655));
    max-width: none;
  }

  .inv-card {
    height: auto;
    min-height: 0;
    aspect-ratio: 380 / 580;
  }
}

@media (max-width: 430px) and (max-height: 700px) {
  .inv-scene {
    width: min(100%, 334px, calc((100vh - 66px) * 0.655));
    width: min(100%, 334px, calc((100svh - 66px) * 0.655));
    width: min(100%, 334px, calc((100dvh - 66px) * 0.655));
  }

  .inv-card {
    height: auto;
    min-height: 0;
  }
}
