@import url('https://fonts.googleapis.com/css2?family=Fleur+De+Leah&family=Sour+Gummy:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Tangerine:wght@400;700&display=swap');

/* ============================================
   VARIABLES DE COLOR
   ============================================ */
:root {
  --pink-deep:    #d63a7a;
  --pink-main:    #ff5fa2;
  --pink-mid:     #ff77c8;
  --pink-light:   #ffb3d9;
  --pink-pale:    #ffe0f0;
  --pink-glow:    rgba(255, 87, 171, 0.55);
  --white-soft:   rgba(255, 255, 255, 0.92);
  --dark-overlay: rgba(20, 5, 15, 0.82);
}

/* ============================================
   BASE
   ============================================ */
html {
  background-image: url('https://w0.peakpx.com/wallpaper/824/557/HD-wallpaper-hearts-background-love-red.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background: shadowed 0 0 0 100vw rgba(20, 5, 15, 0.85);
  min-height: 100%;
}

body {
  margin: 0;
  font-size: 110%;
  font-family: "Sour Gummy", sans-serif;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 30px 0 50px;
  box-sizing: border-box;
}

/* ============================================
   CONTAINER — el marco principal de la carta
   ============================================ */
.container {
  position: relative;
  z-index: 50;
  max-width: 440px;
  width: 94%;
  text-align: center;
  padding: 28px 22px 28px;
  box-sizing: border-box;

  /* Fondo semitransparente con textura */
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 18px,
      rgba(255, 255, 255, 0.100) 18px,
      rgba(255, 255, 255, 0.100) 19px
    ),
    linear-gradient(160deg, rgba(40, 5, 25, 0.88) 0%, rgba(20, 3, 12, 0.93) 100%);

  /* Borde doble en rosa */
  border: 2px solid var(--pink-mid);
  outline: 1px solid var(--pink-light);
  outline-offset: 5px;
  border-radius: 18px;

  /* Sombra exterior suave */
  box-shadow:
    0 0 0 6px rgba(255, 100, 180, 0.12),
    0 0 40px rgba(255, 60, 160, 0.35),
    0 8px 32px rgba(0, 0, 0, 0.6);
}

/* ── Líneas decorativas horizontales (arriba y abajo del borde) ── */
.deco-line {
  position: absolute;
  left: 18px;
  right: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--pink-mid), var(--pink-light), var(--pink-mid), transparent);
}
.deco-line.top    { top: 14px; }
.deco-line.bottom { bottom: 14px; }

/* ── Esquinas ornamentales ── */
.corner-deco {
  position: absolute;
  font-size: 20px;
  color: var(--pink-light);
  line-height: 1;
  text-shadow: 0 0 8px var(--pink-main);
}
.corner-deco.top-left     { top: 6px;  left: 8px;  }
.corner-deco.top-right    { top: 6px;  right: 8px; transform: scaleX(-1); }
.corner-deco.bottom-left  { bottom: 6px; left: 8px;  transform: scaleY(-1); }
.corner-deco.bottom-right { bottom: 6px; right: 8px; transform: scale(-1); }

/* ============================================
   WRAPPER DEL SOBRE
   ============================================ */
.envelope-wrapper {
  position: relative;
  width: 100%;
  margin: 0 auto 4px;
}

/* Florecitas flotantes */
.flower {
  z-index: 199;
  position: absolute;
  font-size: 125%;
  opacity: 0.85;
  animation: flowerFloat 3s ease-in-out infinite;
  pointer-events: none;
}
.flower.f1 { top: -10px; left:  -8px; animation-delay: 0s; }
.flower.f2 { top: -10px; right: -8px; animation-delay: 0.8s; }
.flower.f3 { bottom: 8px; left: -8px;  animation-delay: 1.6s; }
.flower.f4 { bottom: 8px; right: -8px; animation-delay: 2.4s; }

@keyframes flowerFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%       { transform: translateY(-6px) rotate(10deg); }
}

/* ============================================
   SOBRE / ENVELOPE
   ============================================ */
.envelope {
  position: relative;
  width: 100%;
  height: 210px;
  background: linear-gradient(170deg, #ff77c8 0%, #ff5fa2 55%, #d63a7a 100%);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 4px 20px rgba(180, 30, 100, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 8px rgba(0, 0, 0, 0.2);
  border: 1.5px solid rgba(255, 180, 220, 0.4);
}

/* ── Pliegues laterales del sobre ── */
.envelope-fold {
  position: absolute;
  pointer-events: none;
}
.envelope-fold.left {
  top: 0; left: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 210px 0 0 120px;
  border-color: transparent transparent transparent rgba(180, 30, 100, 0.22);
}
.envelope-fold.right {
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 210px 120px 0 0;
  border-color: transparent rgba(255, 255, 255, 0.10) transparent transparent;
}
/* ── Triángulo inferior (pliegue del fondo del sobre) ── */
.envelope-fold.bottom-triangle {
  bottom: 0; left: 0; right: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 90px;
  border-left-width: 50%;
  border-right-width: 50%;
  border-color: transparent transparent rgba(180, 30, 100, 0.28) transparent;
}

/* ── Sello postal ── */
.stamp {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 44px;
  height: 52px;
  background: var(--pink-pale);
  border: 2px dashed var(--pink-main);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 1px 1px 4px rgba(0,0,0,0.3);
}
.stamp-inner {
  text-align: center;
  font-size: 10px;
  color: var(--pink-deep);
  font-weight: 700;
  line-height: 1.3;
  font-family: "Sour Gummy", sans-serif;
}
.stamp-inner span {
  font-size: 8px;
  letter-spacing: 1px;
  display: block;
}

/* ── Matasellos ── */
.postmark {
  position: absolute;
  top: 8px;
  right: 62px;
  z-index: 10;
  opacity: 0.7;
  transform: rotate(-12deg);
}
.postmark-circle {
  width: 54px;
  height: 54px;
  border: 2px solid var(--pink-pale);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  color: var(--pink-pale);
  font-family: "Sour Gummy", sans-serif;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.4;
  text-align: center;
}
.postmark-date { font-size: 6.5px; }

/* ── Lacre / wax seal ── */
.wax-seal {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 42px;
  height: 42px;
  background: radial-gradient(circle at 35% 35%, #ff77c8, #c0186a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  z-index: 15;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.4),
    inset 0 1px 2px rgba(255,200,230,0.5);
  border: 1.5px solid rgba(255,150,200,0.5);
}

/* ── FLAP (solapa animada) ── */
.flap {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #ffaadc 0%, #ff77c8 60%);
  clip-path: polygon(0 0, 50% 58%, 100% 0);
  transform-origin: top center;
  transition: transform 2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
  box-shadow: inset 0 -4px 12px rgba(180, 30, 100, 0.3);
}

/* Corazón en la punta de la solapa */
.flap-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 22px;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 0 8px rgba(216, 176, 197, 0.8);
  
}

/* Estado abierto */
.open .flap {
  transform: rotateX(180deg);
}
.open .flap-heart {
  opacity: 0;
}
.open .wax-seal {
  animation: sealPop 0.4s ease 1.2s both;
}
@keyframes sealPop {
  0%   { transform: translateX(-50%) scale(1); }
  50%  { transform: translateX(-50%) scale(1.3); opacity: 0.5; }
  100% { transform: translateX(-50%) scale(0); opacity: 0; }
}

/* ============================================
   ÁREA DE TÍTULO
   ============================================ */
.title-area {
 font-size: 100%;
  margin: 16px 0 4px;
}

.title-ornament {
  font-size: 12px;
  color: var(--pink-light);
  letter-spacing: 6px;
  opacity: 0.8;
}

h2 {
  margin: 6px 0;
  font-family: "Tangerine", cursive;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--pink-pale);
  text-shadow:
    0 0 20px var(--pink-glow),
    0 2px 4px rgba(0,0,0,0.5);
}

.subtitle {
  margin: 4px 0 12px;
  font-size: 90%;
  color: var(--pink-light);
  opacity: 0.9;
}
.hint {
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ============================================
   INPUT Y BOTÓN
   ============================================ */
.input-wrapper {
  position: relative;
  margin-top: 8px;
}
.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  z-index: 2;
}

input {
  font-family: "Sour Gummy", sans-serif;
  width: 100%;
  padding: 12px 12px 12px 42px;
  border-radius: 12px;
  border: 2px solid var(--pink-mid);
  margin-top: 0;
  font-size: 15px;
  background: rgba(255, 200, 230, 0.1);
  color: #fff;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}
input::placeholder { color: rgba(255, 180, 210, 0.6); }
input:focus {
  border-color: var(--pink-light);
  box-shadow: 0 0 12px var(--pink-glow);
}

/* Botón principal */

button {
  font-family: "Sour Gummy", sans-serif;
  font-size: 1rem;
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  border: none;
  margin-top: 12px;
  background: linear-gradient(135deg, #ff4da6, #d63a7a);
  color: white;
  cursor: pointer;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 14px rgba(200, 30, 100, 0.45);
  transition: transform 0.25s ease, filter 0.25s ease, box-shadow 0.25s ease;
  box-sizing: border-box;
}
button:hover {
  transform: scale(1.03) translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(255, 51, 150, 0.6);
}
.btn-icon { font-size: 0.85em; }

/* ============================================
   CARTA DESPLEGADA / .content
   ============================================ */
.content {
  display: none;
  width: 100%;
  font-size: 110%;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(255, 100, 180, 0) 27px,
      rgba(255, 100, 180, 0) 28px
    ),
    linear-gradient(160deg, rgba(47, 3, 65, 0.651), rgba(21, 7, 27, 0.699));
  margin-top: 18px;
  padding: 20px 18px 16px;
  border-radius: 16px;
  animation: fadeUp 2s ease;
  box-shadow:
    0 0 30px var(--pink-glow),
    inset 0 1px 0 rgba(58, 7, 34, 0.808);
  border: 1.5px solid rgba(255, 120, 180, 0.3);
  box-sizing: border-box;
  text-align: left;
  line-height: 1.7;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Primera línea estilizada ── */
.content .amor {
  font-family: "Tangerine", cursive;
  font-size: 220%;
  text-shadow:
    0 0 24px rgba(64, 75, 235, 0.8),
    0 0 40px rgba(2, 5, 177, 0.7),
    0 3px 6px rgba(0, 0, 0, 0.7);
}

.content p {
  margin: 10px 0;
  color: rgba(255, 235, 245, 0.95);
}

/* ── Encabezado de carta ── */
.carta-header {
  text-align: center;
  margin-bottom: 14px;
}
.carta-hearts {
  font-size: 13px;
  color: var(--pink-mid);
  letter-spacing: 3px;
  opacity: 0.7;
  text-shadow: 0 0 6px var(--pink-main);
}
.carta-lace {
  height: 10px;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 6px,
    rgba(255, 150, 200, 0.4) 6px,
    rgba(255, 150, 200, 0.4) 7px
  );
  margin-top: 6px;
  border-radius: 2px;
}
.carta-lace.bottom { margin-bottom: 6px; margin-top: 0; }

/* ── Divisores ── */
.divider {
  text-align: center;
  color: var(--pink-mid);
  font-size: 0.9rem;
  margin: 12px 0;
  opacity: 0.75;
  letter-spacing: 4px;
}

/* ── Galería de fotos ── */
.gallery {
  margin: 14px 0;
}
.photo-frame {
  margin-top: 14px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(255, 120, 180, 0.45);
  box-shadow:
    0 0 20px rgba(255, 87, 171, 0.35),
    inset 0 1px 0 rgba(255, 200, 230, 0.15);
  position: relative;
  background: rgba(0,0,0,0.3);
}
.photo-frame img {
  width: 100%;
  display: block;
  border-radius: 10px;
  max-width: 100%;
  height: auto;
}
.photo-caption {
  text-align: center;
  padding: 6px 0 8px;
  font-size: 100%;
  color: var(--pink-light);
  letter-spacing: 2px;
  background: rgba(180, 20, 80, 0.25);
}

/* ── Pie de carta ── */
.carta-footer {
  text-align: center;
  margin-top: 10px;
}
.last {
  font-family: "Tangerine", cursive;
  font-size: 220%;
  text-align: center;
  line-height: 1.4;
  text-shadow:
    0 0 24px rgba(86, 89, 255, 0.9),
    0 0 40px rgba(2, 14, 177, 0.8),
    0 3px 6px rgba(0, 0, 0, 0.7);
  margin: 10px 0 6px !important;
}
.firma-ornament {
  font-size: 100%;
  color: var(--pink-light);
  letter-spacing: 6px;
  opacity: 0.6;
  margin-top: 2px;
}

/* ============================================
   EFECTO "TE AMO" CAYENDO (lluvia de texto)
   ============================================ */
.teAmoMatrix {
  position: fixed;
  color: #ff69b4;
  opacity: 0.7;
  pointer-events: none;
  z-index: 1;
  font-family: "Sour Gummy", sans-serif;
  white-space: nowrap;
  animation: teAmoFall linear infinite;
}


@keyframes teAmoFall {
  0%   { transform: translateY(-40px); opacity: 0.8; }
  100% { transform: translateY(200vh);  opacity: 0; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
  .container { padding: 20px 14px; }
  h2 { font-size: 1.8rem; }
  .content { font-size: 0.92rem; padding: 16px 14px; }
  .last { font-size: 1.8rem !important; }
}

/* ============================================
   DISEÑO DE DISPOSITIVO PEQUEÑO (MÓVIL)
   ============================================ */

/* ── Tablet (max 1024px) ── */
@media (max-width: 1024px) {
  .contenedor {
    width: 95%;
  }

  .caja {
    width: 45%;
    font-size: 1rem;
  }

  h1 { font-size: 2.2rem; }

  img {
    width: 100%;
    height: auto;
  }
}

/* ── Mobile (max 768px) ── */
@media (max-width: 768px) {
  .contenedor {
    flex-direction: column; /* Apila los elementos verticalmente */
    width: 100%;
    padding: 10px;
  }

  .caja {
    width: 100%;
    font-size: 0.95rem;
    padding: 10px;
  }

  h1 { font-size: 1.8rem; }
  p  { font-size: 0.9rem; }

  img {
    width: 100%;
    height: auto; /* Mantiene proporción */
  }
}

/* ── Mobile pequeño (max 480px) ── */
@media (max-width: 480px) {
  h1 { font-size: 1.4rem; }
  p  { font-size: 0.85rem; }

  .caja {
    padding: 8px;
  }
}

/* ============================================
   AUTO ESCALA DE IMAGENES
   ============================================ */

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   BOTÓN — ESTADO "OCULTAR CARTA"
   ============================================ */
button#btnPrincipal {
  transition:
    transform 0.25s ease,
    filter 0.25s ease,
    box-shadow 0.25s ease,
    background 0.4s ease;
}

/* Cuando la carta está abierta el botón cambia a tono más frío/oscuro */
button#btnPrincipal.btn-cerrar {
  background: linear-gradient(135deg, #a0246a, #6b0f44);
  box-shadow: 0 4px 14px rgba(100, 10, 60, 0.55);
}
button#btnPrincipal.btn-cerrar:hover {
  box-shadow: 0 6px 20px rgba(160, 30, 90, 0.7);
  filter: brightness(1.15);
}