﻿/* ===== Sobre con imÃ¡genes (cerrado Â· abierto Â· sello) ===== */

.envelope-stage {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.25rem;
  padding-top: max(1.25rem, env(safe-area-inset-top, 0px));
  background: var(--bg-tint, #faf9fb);
  overflow: hidden;
  isolation: isolate;
}

.envelope-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 40%, rgba(154, 138, 158, 0.12) 0%, transparent 68%),
    linear-gradient(180deg, #ffffff 0%, var(--lilac-pale, #f0ecf2) 100%);
  pointer-events: none;
}

.envelope-stage__vignette,
.envelope-stage__texture,
.envelope-stage__glow,
.envelope-stage__title,
.envelope-stage__sparkles {
  pointer-events: none;
}

.envelope-stage__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(154, 138, 158, 0.08) 100%);
}

.envelope-stage__texture {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.envelope-stage__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
}

.envelope-stage__glow--1 {
  width: min(340px, 85vw);
  height: min(340px, 85vw);
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(197, 212, 195, 0.35);
}

.envelope-stage__glow--2 {
  width: min(200px, 50vw);
  height: min(200px, 50vw);
  bottom: 18%;
  right: 8%;
  background: rgba(212, 202, 216, 0.4);
}

.envelope-stage__title {
  position: relative;
  z-index: 5;
  font-family: var(--font-display);
  font-size: clamp(0.55rem, 2.5vw, 0.65rem);
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--mauve);
  opacity: 0.55;
  margin-bottom: -0.5rem;
}

.envelope-scene {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: min(96vw, 560px);
}

.envelope-scene__hint--below {
  position: relative;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-size: clamp(0.62rem, 2.8vw, 0.72rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  padding: 0 0.5rem;
  margin: 0;
}

.envelope-stage__hint-icon { color: var(--mauve); }
.envelope-stage__hint-text--hover { display: none; }

@media (hover: hover) and (pointer: fine) {
  .envelope-stage__hint-text--tap { display: none; }
  .envelope-stage__hint-text--hover { display: inline; }
}

.envelope-stage.is-opening .envelope-scene__hint--below,
.envelope-stage.is-opening .envelope-stage__title {
  opacity: 0;
  transition: opacity 0.35s;
}

/* Contenedor sobre + sello */
.env-photo {
  position: relative;
  width: min(92vw, 520px);
  touch-action: manipulation;
}

.env-photo__stack {
  position: relative;
  width: 100%;
  line-height: 0;
}

.env-photo__sheet {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.env-photo__sheet--open {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.env-photo__sheet--closed {
  position: relative;
  opacity: 1;
  transition: opacity 0.45s ease;
}

.env-photo--open .env-photo__sheet--closed {
  opacity: 0;
}

.env-photo--open .env-photo__sheet--open {
  opacity: 1;
}

/* Texto sobre el interior del sobre abierto */
.env-photo__message {
  position: absolute;
  left: 14%;
  right: 14%;
  top: 38%;
  bottom: 14%;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease 0.12s;
}

.env-photo--open .env-photo__message {
  opacity: 1;
}

/* Marco sutil con jacarandas en las esquinas */
.env-photo__message-frame {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(181, 168, 184, 0.38);
  border-radius: 4px;
  box-shadow:
    inset 0 0 18px rgba(255, 255, 255, 0.45),
    0 0 0 4px rgba(212, 202, 216, 0.12);
  pointer-events: none;
  background-color: rgba(255, 255, 255, 0.28);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23b5a8b8' opacity='.42'%3E%3Cellipse cx='12' cy='28' rx='5' ry='7' transform='rotate(-18 12 28)'/%3E%3Cellipse cx='20' cy='26' rx='5' ry='7'/%3E%3Cellipse cx='28' cy='28' rx='5' ry='7' transform='rotate(18 28 28)'/%3E%3C/g%3E%3Cg fill='%23d4cad8' opacity='.38'%3E%3Cellipse cx='10' cy='14' rx='4' ry='6' transform='rotate(-28 10 14)'/%3E%3Cellipse cx='30' cy='12' rx='4' ry='6' transform='rotate(22 30 12)'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23b5a8b8' opacity='.42'%3E%3Cellipse cx='12' cy='28' rx='5' ry='7' transform='rotate(-18 12 28)'/%3E%3Cellipse cx='20' cy='26' rx='5' ry='7'/%3E%3Cellipse cx='28' cy='28' rx='5' ry='7' transform='rotate(18 28 28)'/%3E%3C/g%3E%3Cg fill='%23d4cad8' opacity='.38'%3E%3Cellipse cx='10' cy='14' rx='4' ry='6' transform='rotate(-28 10 14)'/%3E%3Cellipse cx='30' cy='12' rx='4' ry='6' transform='rotate(22 30 12)'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23b5a8b8' opacity='.42'%3E%3Cellipse cx='12' cy='28' rx='5' ry='7' transform='rotate(-18 12 28)'/%3E%3Cellipse cx='20' cy='26' rx='5' ry='7'/%3E%3Cellipse cx='28' cy='28' rx='5' ry='7' transform='rotate(18 28 28)'/%3E%3C/g%3E%3Cg fill='%23d4cad8' opacity='.38'%3E%3Cellipse cx='10' cy='14' rx='4' ry='6' transform='rotate(-28 10 14)'/%3E%3Cellipse cx='30' cy='12' rx='4' ry='6' transform='rotate(22 30 12)'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23b5a8b8' opacity='.42'%3E%3Cellipse cx='12' cy='28' rx='5' ry='7' transform='rotate(-18 12 28)'/%3E%3Cellipse cx='20' cy='26' rx='5' ry='7'/%3E%3Cellipse cx='28' cy='28' rx='5' ry='7' transform='rotate(18 28 28)'/%3E%3C/g%3E%3Cg fill='%23d4cad8' opacity='.38'%3E%3Cellipse cx='10' cy='14' rx='4' ry='6' transform='rotate(-28 10 14)'/%3E%3Cellipse cx='30' cy='12' rx='4' ry='6' transform='rotate(22 30 12)'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 36px 36px;
  background-position:
    left 2px top 2px,
    right 2px top 2px,
    left 2px bottom 2px,
    right 2px bottom 2px;
  background-repeat: no-repeat;
}

.env-photo__message-frame::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(212, 202, 216, 0.35);
  border-radius: 2px;
  background: repeating-linear-gradient(
      0deg,
      transparent,
      transparent 8px,
      rgba(181, 168, 184, 0.12) 8px,
      rgba(181, 168, 184, 0.12) 9px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 8px,
      rgba(181, 168, 184, 0.12) 8px,
      rgba(181, 168, 184, 0.12) 9px
    );
  opacity: 0.65;
  pointer-events: none;
}

.env-photo__message-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  max-width: 100%;
}

.env-photo__names {
  font-family: var(--font-script);
  font-size: clamp(2.1rem, 9vw, 3rem);
  line-height: 1.05;
  color: var(--lilac-deep);
  margin: 0;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

.env-photo__names span {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.42em;
  color: var(--mauve);
}

.env-photo__date {
  font-family: var(--font-display);
  font-size: clamp(0.75rem, 3.2vw, 0.95rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--mauve);
  margin: 0.15rem 0 0;
}

.env-photo__headline {
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 4vw, 1.15rem);
  font-style: italic;
  font-weight: 600;
  color: var(--lilac-deep);
  margin: 1.65rem 0 0;
}

/* Sello â€” click y hover */
.env-photo__seal {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 10;
  width: clamp(76px, 24vw, 118px);
  height: clamp(76px, 24vw, 118px);
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  transform: translate(-50%, -50%) scale(1);
  transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
}

.env-photo__seal img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(110, 101, 112, 0.25));
  pointer-events: none;
}

.env-photo__seal:hover,
.env-photo__seal:focus-visible {
  transform: translate(-50%, -50%) scale(1.1);
  outline: none;
}

.env-photo--open .env-photo__seal {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.85);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.envelope-stage.is-leaving {
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

@media (max-width: 640px) {
  .envelope-stage {
    padding: 0.75rem 0.5rem 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .env-photo {
    width: min(94vw, 400px);
  }

  .env-photo__message {
    top: 36%;
    bottom: 12%;
    left: 12%;
    right: 12%;
    padding: 0.28rem;
  }

  .env-photo__message-frame {
    background-size: 30px 30px;
  }

  .env-photo__message-inner {
    gap: 0.28rem;
    padding: 0.45rem 0.55rem;
  }

  .env-photo__seal {
    top: 51%;
    width: clamp(68px, 26vw, 100px);
    height: clamp(68px, 26vw, 100px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .env-photo__sheet--open,
  .env-photo__sheet--closed,
  .env-photo__seal,
  .envelope-stage.is-leaving {
    transition: none;
  }
}
