/* ==========================================================================
   TELA INICIAL & ENVELOPE (ESTILO OFICIAL VINICIUS & MAISA)
   100% IDÊNTICO À REFERÊNCIA VISUAL FORNECIDA
   ========================================================================== */

/* Palco geral centralizado */
.envelope-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  background-color: #273418;
  padding: 12px;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}

/* Quadro principal baseado na arte visual aprovada */
.stage-outer-frame {
  position: relative;
  width: 100%;
  max-width: 1024px;
  aspect-ratio: 1024 / 573;
  margin: auto;
  background-image: url('/assets/tela-inicial-base.jpg');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 4px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(194, 155, 56, 0.4);
  user-select: none;
}

/* Título Oficial dos Noivos na Aba Superior da Tela Inicial */
.stage-couple-title {
  position: absolute;
  top: 18.4%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-serif-title);
  font-size: clamp(20px, 3.2vw, 32px);
  font-weight: 500;
  letter-spacing: 0.16em;
  color: #eedbb0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .stage-outer-frame {
    aspect-ratio: auto;
    min-height: 520px;
    background-size: cover;
  }
}

/* Área do Lacre de Cera Interativo */
.wax-seal-interactive {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  pointer-events: none;
}

/* Inscrição Caligráfica em Cera (RV-07) */
.wax-seal-guest-name {
  font-family: var(--font-script);
  color: #f7e6be;
  font-size: 38px;
  line-height: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 -1px 1px rgba(255, 255, 255, 0.25);
  letter-spacing: 0.02em;
  transform: rotate(-3deg);
  text-align: center;
  padding: 0 6px;
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
  .wax-seal-interactive {
    width: 96px;
    height: 96px;
    top: 51.5%;
  }
  .wax-seal-guest-name {
    font-size: 30px;
    max-width: 76px;
  }
}

/* Metades do Lacre para a Animação de Rompimento (RV-08) */
.seal-crack-piece-left, .seal-crack-piece-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background-size: 100% 100%;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.65s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
}

.seal-crack-piece-left {
  left: 0;
  background-image: url('/assets/lacre-cera-esq.png');
}

.seal-crack-piece-right {
  right: 0;
  background-image: url('/assets/lacre-cera-dir.png');
}

/* Formulário de Identificação Sobreposto ao Envelope */
.stage-interactive-form {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: auto;
}

/* Campo de Entrada de Nome em Caligrafia Cursiva */
.stage-name-input {
  position: absolute;
  left: 50%;
  top: 67.7%;
  transform: translate(-50%, -50%);
  width: 360px;
  height: 44px;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-family: var(--font-script);
  font-size: 36px;
  font-style: italic;
  color: #273216;
  text-align: center;
  padding: 0 10px;
  letter-spacing: 0.02em;
  caret-color: #556B2F;
}

.stage-name-input::placeholder {
  font-family: var(--font-script);
  color: rgba(60, 75, 35, 0.45);
  font-size: 32px;
}

@media (max-width: 768px) {
  .stage-name-input {
    width: 290px;
    font-size: 28px;
    top: 67.5%;
  }
  .stage-name-input::placeholder {
    font-size: 25px;
  }
}

/* Botão "Abrir nossa carta" Sobre a Placa */
.stage-submit-button {
  position: absolute;
  left: 50%;
  top: 77.4%;
  transform: translate(-50%, -50%);
  width: 264px;
  height: 52px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: transparent; /* A placa já tem o texto visual idêntico gravado */
  transition: transform 0.2s ease, filter 0.2s ease;
}

.stage-submit-button:hover:not(:disabled) {
  transform: translate(-50%, -52%);
  filter: brightness(1.15) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

.stage-submit-button:active:not(:disabled) {
  transform: translate(-50%, -49%);
  filter: brightness(0.95);
}

.stage-submit-button:focus-visible {
  outline: 2px solid #c29b38 !important;
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .stage-submit-button {
    width: 210px;
    height: 42px;
    top: 77.2%;
  }
}

/* Mensagem de Feedback sobre o envelope */
.stage-feedback-message {
  position: absolute;
  left: 50%;
  top: 83.5%;
  transform: translate(-50%, 0);
  font-family: var(--font-serif-body);
  font-size: 14px;
  font-style: italic;
  color: #d13d30;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  pointer-events: none;
}

@media (max-width: 768px) {
  .stage-feedback-message {
    font-size: 12px;
    top: 83%;
  }
}

/* Botão Pular Abertura */
.skip-animation-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(44, 53, 28, 0.9);
  color: #f7e6be;
  border: 1px solid #c29b38;
  padding: 8px 16px;
  font-size: 15px;
  border-radius: 20px;
  z-index: 100;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* ANIMAÇÃO DE ABERTURA (SEÇÃO 6.1) */
.stage-outer-frame.is-animating .seal-crack-piece-left {
  opacity: 1;
  transform: translate(-25px, -15px) rotate(-16deg);
}

.stage-outer-frame.is-animating .seal-crack-piece-right {
  opacity: 1;
  transform: translate(25px, 15px) rotate(16deg);
}

.stage-outer-frame.is-animating .wax-seal-guest-name {
  opacity: 0;
}

.stage-outer-frame.is-animating {
  animation: fadeOutStage 0.8s ease 1.6s forwards;
}

@keyframes fadeOutStage {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05); }
}
