/* Ocultar insignia y marcos inyectados de Netlify */
#nl-badge-frame,
#nl-hud-frame,
iframe[id^="nl-"],
iframe[title*="Netlify" i],
iframe[title*="Powered by Netlify" i] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  position: absolute !important;
  top: -99999px !important;
  left: -99999px !important;
  z-index: -999 !important;
}

:root {
  --paper: #fff1f5;
  --white: #ffffff;
  --ink: #2c2c2c;
  --muted: #75666a;
  --rose: #e67696;
  --rose-soft: #fbdde6;
  --rose-mist: #fff0f4;
  --rose-deep: #bd4b6d;
  --berry: #77394c;
  --gold: #b98a3b;
  --gold-light: #f5d485;
  --gold-dark: #8c631e;
  --line: rgba(185, 138, 59, 0.2);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Montserrat", Arial, sans-serif;
  --shadow-lux: 0 20px 50px rgba(189, 75, 109, 0.12);
  --shadow-gold: 0 10px 30px rgba(185, 138, 59, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-family: var(--sans);
  color: var(--ink);
  background-color: #fff5f8;
}

body {
  overflow-x: hidden;
  background: linear-gradient(180deg, #fff7fa 0%, #fff1f5 35%, #fae8ee 70%, #fff0f4 100%);
  min-height: 100vh;
}

/* Tipografías */
.font-serif {
  font-family: var(--serif);
}

.font-sans {
  font-family: var(--sans);
}

/* Lienzo de partículas de fondo */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 40;
}

/* Pantalla de Apertura (Sobre de Lujo) - 100% Mobile First */
#envelope-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(circle at center, #fff2f6 0%, #fbd5e2 60%, #e8aabf 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 1.2s;
  touch-action: manipulation;
}

#envelope-screen.opened {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Contenedor del Sobre 3D - Adaptable a cualquier ancho de celular */
.envelope-wrapper {
  position: relative;
  width: min(340px, calc(100vw - 32px));
  height: min(230px, calc((100vw - 32px) * 0.68));
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(119, 57, 76, 0.28), 0 0 0 1px rgba(185, 138, 59, 0.35);
  cursor: pointer;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  perspective: 1000px;
  overflow: visible;
}

@media (min-width: 640px) {
  .envelope-wrapper {
    width: 400px;
    height: 270px;
  }
}

.envelope-wrapper:active {
  transform: scale(0.98);
}

.envelope-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #fff2f5, #fbdde6);
  border-radius: 14px;
  border: 1px solid rgba(185, 138, 59, 0.25);
}

/* Solapas usando clip-path para escalabilidad milimétrica en cualquier resolución */
.envelope-flap-left {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #f8dce6, #f3cad8);
  clip-path: polygon(0 0, 50% 50%, 0 100%);
  z-index: 2;
  border-radius: 14px 0 0 14px;
}

.envelope-flap-right {
  position: absolute;
  inset: 0;
  background: linear-gradient(225deg, #f8dce6, #f3cad8);
  clip-path: polygon(100% 0, 50% 50%, 100% 100%);
  z-index: 2;
  border-radius: 0 14px 14px 0;
}

.envelope-flap-bottom {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #fce5ee 0%, #f1c5d4 100%);
  clip-path: polygon(0 100%, 50% 46%, 100% 100%);
  z-index: 3;
  border-radius: 0 0 14px 14px;
}

.envelope-flap-top {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #f6d1df 0%, #fdeaf0 100%);
  clip-path: polygon(0 0, 50% 56%, 100% 0);
  z-index: 4;
  transform-origin: top center;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 14px 14px 0 0;
}

.envelope-wrapper.opening .envelope-flap-top {
  transform: rotateX(180deg);
  z-index: 1;
}

/* Sello de Lacre Dorado con tamaño táctil óptimo */
.wax-seal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fae69e 0%, #d4a046 45%, #916117 85%, #664109 100%);
  box-shadow: 0 8px 25px rgba(119, 57, 76, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.6), inset 0 -3px 6px rgba(0, 0, 0, 0.4);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: pulseSeal 2.4s infinite ease-in-out;
  transition: transform 0.3s ease, opacity 0.5s ease;
  border: 1px solid rgba(255, 245, 200, 0.6);
  user-select: none;
}

@media (min-width: 640px) {
  .wax-seal {
    width: 76px;
    height: 76px;
  }
}

.envelope-wrapper:hover .wax-seal,
.envelope-wrapper:active .wax-seal {
  transform: translate(-50%, -50%) scale(1.06);
}

.envelope-wrapper.opening .wax-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.4);
}

@keyframes pulseSeal {
  0%, 100% {
    box-shadow: 0 8px 25px rgba(185, 138, 59, 0.4), 0 0 0 0 rgba(212, 160, 70, 0.5);
  }
  50% {
    box-shadow: 0 12px 30px rgba(185, 138, 59, 0.6), 0 0 0 12px rgba(212, 160, 70, 0);
  }
}

/* Reproductor Flotante Optimizado para Móvil */
.music-player-pill {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom, 16px));
  right: 16px;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(185, 138, 59, 0.35);
  border-radius: 9999px;
  padding: 6px 14px 6px 8px;
  box-shadow: 0 12px 30px rgba(189, 75, 109, 0.2), 0 2px 8px rgba(185, 138, 59, 0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  transition: all 0.3s ease;
}

.vinyl-disc {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle, #bd4b6d 0%, #77394c 50%, #2c2c2c 85%, #000 100%);
  border: 2px solid #b98a3b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.vinyl-disc.playing {
  animation: spinVinyl 5s linear infinite;
}

@keyframes spinVinyl {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.vinyl-center {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f5d485;
  border: 2px solid #77394c;
}

/* Estilo Polaroid Táctil */
.polaroid-card {
  background: #ffffff;
  padding: 10px 10px 18px 10px;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(80, 62, 45, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  cursor: pointer;
  border: 1px solid rgba(251, 221, 230, 0.7);
  touch-action: manipulation;
}

.polaroid-card:active {
  transform: scale(0.98);
}

.polaroid-img-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 4px;
  background-color: #f7e6ec;
}

.polaroid-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

/* Cuadrícula de fotos compacta para móviles */
.grid-photo-card {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(185, 138, 59, 0.15);
  background-color: #f9eef2;
  touch-action: manipulation;
}

.grid-photo-card:active {
  transform: scale(0.97);
}

.grid-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Lightbox Modal optimizado para pantallas táctiles */
#lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(14, 8, 11, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 12px;
  touch-action: pan-y;
}

#lightbox-modal.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-img {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(185, 138, 59, 0.4);
}

/* Destello dorado */
.gold-shimmer {
  background: linear-gradient(90deg, #b98a3b 0%, #fae69e 50%, #b98a3b 100%);
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shine 4s linear infinite;
}

@keyframes shine {
  to { background-position: 200% center; }
}

/* Animación de latido */
.heart-beat {
  animation: heartPulse 1.8s infinite ease-in-out;
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.18); }
  28% { transform: scale(1); }
  42% { transform: scale(1.12); }
  70% { transform: scale(1); }
}

/* Botón de amor con retroalimentación táctil */
.love-btn {
  background: linear-gradient(135deg, #bd4b6d 0%, #e67696 100%);
  box-shadow: 0 10px 25px rgba(189, 75, 109, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 48px;
}

.love-btn:active {
  transform: scale(0.95);
}
