/*
 * envelope.css — abertura do convite (artboard 1).
 * Estado fechado por padrão; .abertura--aberta (posta pelo envelope.js) abre.
 */

.abertura {
  min-height: 100vh;
  min-height: 100svh;
  max-width: 30rem;
  margin: 0 auto;
  padding: 4rem 1.75rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  overflow: hidden;
}

.abertura__topo { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; text-align: center; }
.abertura__topo .rotulo { margin: 0; }
.abertura__nome { margin: 0; font-size: 2.6rem; }
.abertura__lugares {
  margin: 0.35rem 0 0;
  font-family: var(--fonte-titulo);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--tinta-suave);
}

/* ---------- o envelope ---------- */

.envelope {
  position: relative;
  width: min(320px, 100%);
  height: 340px;
  perspective: 900px;
}

.envelope__cartao {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 10px;
  height: 260px;
  padding: 1rem;
  background: var(--papel-claro);
  border: 1px solid var(--linha-clara);
  box-shadow: 0 10px 30px rgba(35, 51, 42, 0.10);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  text-align: center;
  transition: bottom 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.35s;
}
.envelope__rotulo { font-size: 0.62rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--tinta-suave); }
.envelope__nomes { font-size: 2.35rem; line-height: 1.15; }
.envelope__data { font-family: var(--fonte-titulo); font-size: 1.25rem; letter-spacing: 0.18em; }

.envelope__corpo {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 210px;
  background: var(--envelope-corpo);
  clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 -1px 0 var(--linha);
}

.envelope__aba {
  position: absolute;
  left: 0;
  right: 0;
  top: 130px;
  height: 120px;
  background: var(--envelope-aba);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform 0.7s ease, opacity 0.4s ease 0.3s;
}

.envelope__lacre {
  position: absolute;
  left: 50%;
  top: 200px;
  width: 84px;
  height: 84px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translateX(-50%);
  cursor: pointer;
  filter: drop-shadow(0 4px 8px rgba(110, 38, 38, 0.35));
  transition: top 0.7s ease, opacity 0.5s ease;
  animation: lacre-pulsa 2.4s ease-in-out infinite;
}
.envelope__lacre:focus-visible { outline: 2px solid var(--ouro); outline-offset: 4px; }

@keyframes lacre-pulsa {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%      { transform: translateX(-50%) scale(1.04); }
}

/* ---------- base ---------- */

.abertura__base {
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.9rem;
}
.abertura__dica {
  margin: 0;
  font-family: var(--fonte-titulo);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--tinta-suave);
}
.abertura__ver { min-height: 48px; padding: 0 2rem; }
.abertura .ramo { margin: 0; width: 140px; }

/* ---------- estados ---------- */

/* com JS: o botão "Ver o convite" só aparece depois de abrir */
.js .abertura:not(.abertura--aberta) .abertura__ver { display: none; }
.abertura--aberta .abertura__dica { display: none; }

.abertura--aberta .envelope__aba { transform: rotateX(180deg); opacity: 0; }
.abertura--aberta .envelope__lacre { top: 20px; opacity: 0; pointer-events: none; animation: none; }
.abertura--aberta .envelope__cartao { bottom: 120px; }

@media (prefers-reduced-motion: reduce) {
  .envelope__lacre { animation: none; }
}

@media (max-height: 700px) {
  .abertura { padding-top: 2rem; padding-bottom: 2rem; }
}

/* rolagem travada até tocar no lacre (classe posta pelo envelope.js) */
html.rolagem-travada,
html.rolagem-travada body {
  overflow: hidden;
  height: 100%;
  overscroll-behavior: none;
  touch-action: none;
}
html.rolagem-travada .envelope__lacre { touch-action: manipulation; }

/* "Ver o convite" fixo embaixo quando não cabe na tela (posto pelo envelope.js) */
.abertura--ver-fixo .abertura__ver {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 50;
  width: max-content;
  max-width: calc(100% - 2.5rem);
  margin: 0 auto;
  box-shadow: 0 6px 24px rgba(35, 51, 42, 0.25);
}
