/* ============================================
   Convite Digital — Livia & André
   Azul escuro & dourado · Elegante · Interativo
   ============================================ */

:root {
  --navy: #0f2744;
  --navy-mid: #1a365d;
  --navy-soft: #2c5282;
  --gold: #c9a227;
  --gold-light: #e8d48b;
  --gold-bright: #f0e0a0;
  --gold-dark: #a67c00;
  --cream: #fbf8f3;
  --cream-warm: #f5f0e8;
  --text: #0f2744;
  --card-pad-h: 10%;
  --card-pad-v: 9%;
  /* Escala de espaçamento para ritmo visual consistente */
  --space-xs: 15px;   /* entre itens muito próximos (ex: divisor e nome) */
  --space-sm: 0.5rem;   /* dentro de um bloco (ex: após citação) */
  --space-md: 0.85rem;  /* entre blocos relacionados (ex: bênção e convite) */
  --space-lg: 1.25rem;  /* entre seções (ex: data e cerimônia) */
  --space-xl: 1.6rem;   /* entre blocos grandes (ex: cerimônia e recepção) */
  --space-2xl: 2rem;    /* antes dos botões / fim do convite */
}

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

html {
  scroll-behavior: smooth;
  /* Evita que 100vh antigo force altura maior que a área visível em mobile */
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh; /* fallback antigo */
  min-height: min(100svh, 100dvh);
  /* Chrome Android (ex.: Poco): altura real via JS — ver js/viewport-height.js */
  min-height: calc(var(--app-vh, 1vh) * 100);
  font-family: 'Montserrat', sans-serif;
  color: var(--text);
  background: var(--cream);
  overflow-x: hidden;
}

/* ========== Splash — Tela de abertura ========== */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 100vh;
  min-height: min(100svh, 100dvh);
  min-height: calc(var(--app-vh, 1vh) * 100);
}

.splash.is-open {
  pointer-events: none;
}

.splash-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 100% 80% at 50% 20%, rgba(201, 162, 39, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(15, 39, 68, 0.4) 0%, transparent 55%),
    linear-gradient(165deg, #1a365d 0%, #0f2744 50%, #0a1c30 100%);
}

.splash-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 0%,
    rgba(240, 224, 160, 0.08) 45%,
    rgba(232, 212, 139, 0.12) 50%,
    transparent 55%
  );
  animation: splashShine 4s ease-in-out infinite;
}

@keyframes splashShine {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.splash-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
}

.splash-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  font-weight: 600;
  letter-spacing: 0.35em;
  color: var(--gold-light);
  margin: 0 0 0.5rem;
  opacity: 0.9;
}

.splash-names {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(2.5rem, 12vw, 4.5rem);
  font-weight: 400;
  color: #fff;
  text-shadow: 0 0 40px rgba(201, 162, 39, 0.4);
  margin: 0;
  letter-spacing: 0.02em;
}

.splash-curtain {
  position: absolute;
  inset: 0;
  background: linear-gradient(165deg, #1a365d 0%, #0f2744 100%);
  z-index: 3;
  transform-origin: top center;
}

/* ========== Main — Convite ========== */
.invitation-wrapper {
  position: relative;
  min-height: 100vh;
  min-height: min(100svh, 100dvh);
  min-height: calc(var(--app-vh, 1vh) * 100);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.5rem, 2vw, 1.5rem);
  opacity: 0;
  visibility: hidden;
}

.invitation-wrapper.is-visible {
  opacity: 1;
  visibility: visible;
}

.bg-pattern {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(201, 162, 39, 0.12) 0%, transparent 45%),
    radial-gradient(ellipse 70% 50% at 50% 110%, rgba(26, 54, 93, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(201, 162, 39, 0.06) 0%, transparent 25%),
    var(--cream);
  z-index: 0;
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  width: 120%;
  height: 80%;
  top: 10%;
  left: -10%;
  background: radial-gradient(
    ellipse 60% 50% at 50% 40%,
    rgba(201, 162, 39, 0.08) 0%,
    transparent 60%
  );
  z-index: 0;
  pointer-events: none;
}

/* Cartão — ocupa boa parte da tela, responsivo */
.invitation-card {
  position: relative;
  width: min(480px, 96vw);
  max-width: 96vw;
  aspect-ratio: 420 / 600;
  max-height: min(720px, 94vh, 94dvh);
  flex-shrink: 0;
  z-index: 1;
  background: linear-gradient(175deg, #fdfcfa 0%, var(--cream-warm) 50%, #f8f4ed 100%);
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(201, 162, 39, 0.15),
    0 25px 60px -20px rgba(15, 39, 68, 0.25),
    0 0 80px -20px rgba(201, 162, 39, 0.12);
}

.card-shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.card-shine::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.03) 45%,
    rgba(240, 224, 160, 0.06) 50%,
    transparent 55%
  );
  animation: cardShine 8s ease-in-out infinite;
}

@keyframes cardShine {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(2%, 2%) rotate(1deg); }
}

.frame-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.frame-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.frame-svg--landscape {
  display: none;
}

@media (min-width: 900px) {
  .frame-svg--portrait {
    display: none;
  }

  .frame-svg--landscape {
    display: block;
  }
}

.frame-path {
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
}

.corner {
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
}

.monogram {
  position: absolute;
  top: 5%;
  right: 6%;
  width: 12%;
  max-width: 56px;
  aspect-ratio: 1;
  z-index: 2;
  opacity: 0;
  transition: transform 0.4s ease, filter 0.4s ease;
}

.invitation-card:hover .monogram {
  transform: scale(1.05);
  filter: drop-shadow(0 2px 8px rgba(26, 54, 93, 0.2)) drop-shadow(0 0 16px rgba(201, 162, 39, 0.3));
}

.monogram-svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(26, 54, 93, 0.15));
}

.monogram-path {
  stroke-dasharray: 280;
  stroke-dashoffset: 280;
}

/* Conteúdo */
.invitation-content {
  position: absolute;
  inset: var(--card-pad-v) var(--card-pad-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-lg);
  text-align: center;
  overflow-x: hidden;
  z-index: 2;
  -webkit-overflow-scrolling: touch;
  transform-origin: center center;
}

.content-left {
  max-width: 100%;
}

.content-right {
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.invitation-content * {
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.divider {
  display: block;
  font-size: 0.6rem;
  color: var(--gold);
  margin: var(--space-xs) 0;
  opacity: 0;
  letter-spacing: 0.3em;
}

.quote {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.7rem, 2.5vw, 1rem);
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.45;
  color: var(--navy);
  margin: 0 0 var(--space-sm);
  opacity: 0;
  transition: color 0.35s ease, letter-spacing 0.35s ease;
}

.quote:hover {
  color: var(--navy-mid);
  letter-spacing: 0.12em;
}

.names {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(1.75rem, 6vw, 3.3rem);
  font-weight: 400;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 50%, var(--navy) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 var(--space-sm);
  line-height: 1.15;
  opacity: 0;
  transition: transform 0.4s ease, filter 0.4s ease;
}

.names:hover {
  transform: scale(1.02);
  filter: drop-shadow(0 2px 12px rgba(201, 162, 39, 0.25));
}

.blessing,
.invite-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.78rem, 2.2vw, 1.05rem);
  font-weight: 600;
  letter-spacing: 0.055em;
  color: var(--navy);
  margin: 0;
  line-height: 1.4;
  opacity: 0;
}

.blessing { margin-bottom: 0.25rem; }
.invite-text { margin-bottom: var(--space-md); }

.date-place {
  margin: 0 0 var(--space-lg);
  padding: var(--space-sm) 0;
  border-top: 1px solid rgba(201, 162, 39, 0.35);
  border-bottom: 1px solid rgba(201, 162, 39, 0.35);
  opacity: 0;
}

.date {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.85rem, 2.5vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--navy);
  margin: 0;
}

.separator {
  color: var(--gold);
  margin: 0 0.3em;
  font-weight: 400;
}

.venue {
  margin: 0 0 var(--space-lg);
}

.venue:last-of-type,
.content-right .venue.reception {
  margin-bottom: 0;
}

.venue-title {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(0.6rem, 1.8vw, 0.7rem);
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--gold-dark);
  margin: 0 0 0.25rem;  
  opacity: 0;
}

.venue-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.8rem, 2.2vw, 1.05rem);
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 0.25rem;
  line-height: 1.3;
  opacity: 0;
}

.venue-address {
  font-size: clamp(0.65rem, 1.8vw, 0.8rem);
  font-weight: 400;
  color: var(--navy-soft);
  margin: 0;
  line-height: 1.4;
  opacity: 0;
}

.reception .venue-title {
  margin-top: 0;
}

.venue-cta {
  margin-top: var(--space-sm);
  opacity: 0;
}

.venue-cta .btn-invitation {
  display: inline-block;
}

.website-cta {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(201, 162, 39, 0.35);
  text-align: center;
  opacity: 0;
}

.website-cta-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.78rem, 2.1vw, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.055em;
  color: var(--navy-mid);
  margin: 0 0 var(--space-sm);
  line-height: 1.4;
}

.btn-website {
  font-weight: 600;
  padding: 0.6em 1.25em;
}

.btn-invitation {
  position: relative;
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(0.7rem, 2vw, 0.8rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.55em 1.1em;
  border: 1.5px solid var(--gold);
  color: var(--navy);
  background: transparent;
  border-radius: 2rem;
  text-decoration: none;
  overflow: hidden;
  transition: color 0.35s ease, border-color 0.35s ease, transform 0.25s ease, box-shadow 0.35s ease;
  white-space: nowrap;
}

.btn-invitation::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 0%, rgba(201, 162, 39, 0.15) 50%, transparent 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.btn-invitation:hover {
  color: var(--cream);
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 50%, var(--gold-light) 100%);
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px -6px rgba(201, 162, 39, 0.4);
}

.btn-invitation:hover::before {
  opacity: 1;
}

.btn-text {
  position: relative;
  z-index: 1;
}

[data-animate] {
  opacity: 0;
  transform: translateY(20px);
}

/* ========== Responsividade ========== */
/* Mobile: sem rolagem na página; convite = no máx. 95% da altura visível, centralizado */
@media (max-width: 899px) {
  :root {
    --card-pad-h: 7.5%;
    --card-pad-v: 6%;
    /* Gap entre content-left e content-right — valor fixo (não alterar com --space-*) */
    --invitation-column-gap: 0.4rem;
    --space-xs: 0.3rem;
    --space-sm: 0.55rem;
    --space-md: 0.8rem;
    --space-lg: 1.05rem;
    --space-xl: 1.25rem;
  }

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

  html,
  body {
    overflow: hidden;
    height: 100%;
    max-height: calc(var(--app-vh, 1vh) * 100);
    overscroll-behavior: none;
  }

  .invitation-wrapper {
    padding:
      max(0.5rem, env(safe-area-inset-top, 0px))
      max(0.5rem, env(safe-area-inset-right, 0px))
      max(0.5rem, env(safe-area-inset-bottom, 0px))
      max(0.5rem, env(safe-area-inset-left, 0px));
    height: calc(var(--app-vh, 1vh) * 100);
    max-height: calc(var(--app-vh, 1vh) * 100);
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
  }

  /* Base .invitation-card usa max-height ~94vh — sobrescreve com altura em px (95%) via JS */
  .invitation-card {
    width: min(520px, 100%);
    max-width: 100%;
    height: var(--app-card-max-height, 95dvh);
    max-height: var(--app-card-max-height, 95dvh);
    min-height: 0;
    aspect-ratio: auto !important;
    overflow: hidden;
    flex-shrink: 0;
  }

  .content-left {
    width: 90% !important;
  }
  .content-right {
    width: 90% !important;
  }

  .invitation-content {
    overflow: hidden;
    justify-content: center;
    gap: var(--invitation-column-gap);
    -webkit-overflow-scrolling: auto;
  }

  .date-place {
    margin: 0 0 var(--space-md);
    padding: var(--space-xs) 0;
  }

  /* Só no mobile: mais ar entre estrela e texto de convite */
  .divider.divider-bottom {
    margin-top: var(--space-xs);
    margin-bottom: var(--space-xl);
  }

  /* Só no mobile: Cerimônia / Recepção / Site */
  .content-right .venue:not(.reception) {
    margin-bottom: var(--space-lg);
  }

  .content-right .venue.reception {
    margin-top: var(--space-md);
    margin-bottom: 0;
  }

  /* Mesmo ritmo do desktop (base) — antes estava xl/lg e anulava a redução */
  .website-cta {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
  }

  .venue-cta {
    margin-top: var(--space-sm);
  }

  .venue-cta .btn-invitation,
  .website-cta .btn-invitation {
    margin-top: 0.4rem;
  }

  /*
   * Tipografia mobile: em telas estreitas o vw do estilo global é baixo e o texto
   * fica preso no min() (~0,78rem). Aqui usamos mínimo maior e vw mais alto.
   */
  .blessing,
  .invite-text {
    font-size: clamp(0.9rem, 3.6vw, 1.05rem);
    font-weight: 600;
    letter-spacing: 0.05em;
  }

  .website-cta-text {
    font-size: clamp(0.85rem, 3.3vw, 0.98rem);
    font-weight: 600;
  }
}

@media (max-width: 380px) {
  :root {
    --card-pad-h: 6.5%;
    --card-pad-v: 5.5%;
    /* Mantém o mesmo gap central entre colunas */
    --invitation-column-gap: 0.4rem;
    --space-sm: 0.48rem;
    --space-md: 0.72rem;
    --space-lg: 0.95rem;
  }

  .invitation-card {
    width: 98vw;
    height: var(--app-card-max-height, 95dvh);
    max-height: var(--app-card-max-height, 95dvh);
  }

  .quote { font-size: 0.65rem; }
  .names { font-size: 1.6rem; }
  /* Herda tamanhos legíveis do bloco max-width 899px — não reduzir de novo */
  .date { font-size: 0.8rem; }
  .venue-name { font-size: 0.75rem; }
  .venue-address { font-size: 0.6rem; }
  .invitation-content { gap: var(--invitation-column-gap); }
  .venue-cta .btn-invitation,
  .website-cta .btn-invitation { width: 100%; white-space: normal; text-align: center; }
}

/* Desktop: convite horizontal, maior, preenche boa parte da tela */
@media (min-width: 900px) {
  .invitation-card {
    width: min(920px, 94vw);
    max-width: 94vw;
    aspect-ratio: 800 / 480;
    max-height: min(560px, 92vh, 92dvh);
  }

  .invitation-content {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: clamp(2rem, 5vw, 3.5rem);
    padding: 5% 2%;
    text-align: center;
  }

  .content-left {
    flex: 0 1 auto;
    min-width: 0;
  }

  .content-right {
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    gap: 0;
  }

  .monogram {
    top: 8%;
    right: 6%;
    max-width: 52px;
  }
}

@media (min-width: 768px) and (max-width: 899px) {
  .invitation-card {
    width: min(500px, 94vw);
    height: var(--app-card-max-height, 95dvh);
    max-height: var(--app-card-max-height, 95dvh);
  }

  .monogram { max-width: 64px; }
}

@media (max-height: 500px) {
  :root {
    --space-lg: 1rem;
    --space-xl: 1.2rem;
    --space-2xl: 1.5rem;
  }

  /* Desktop paisagem: mantém proporção; mobile usa regras de max-width 899px */
  @media (min-width: 900px) {
    .invitation-card {
      max-height: 96vh;
      aspect-ratio: 420 / 700;
    }
  }

  .invitation-content { padding-top: 6%; padding-bottom: 6%; gap: var(--space-md); }
  .quote { font-size: 0.65rem; }
  .names { font-size: 1.5rem; }
  .blessing, .invite-text { font-size: clamp(0.82rem, 3.2vw, 0.95rem); font-weight: 600; }
  .website-cta-text { font-size: clamp(0.8rem, 3vw, 0.92rem); }
  .date { font-size: 0.75rem; }
  .venue-name { font-size: 0.75rem; }
  .venue-address { font-size: 0.6rem; }
  .website-cta { margin-top: var(--space-sm); padding-top: var(--space-xs); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .splash-shine,
  .card-shine::after {
    animation: none;
  }

  [data-animate] {
    opacity: 1;
    transform: none;
  }
}
