/* ==========================================================================
   Estilos Globales y Sistema de Diseño
   ========================================================================== */

body {
  margin: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: linear-gradient(to bottom, #001a33, #003366, #1a3a5c);
  background-attachment: fixed;
  color: #fff;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Canvas y Efectos de Fondo */
canvas#animation-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.corazon {
  position: fixed;
  top: -20px;
  font-size: 20px;
  animation: flotar 5s linear infinite;
  color: #ff99cc;
  z-index: 10;
  pointer-events: none; /* Evita interferir con los toques del usuario en móvil */
}

@keyframes flotar {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}

.corazon::before {
  content: "❤️";
}

/* ==========================================================================
   Cabecera (Hero Section)
   ========================================================================== */

.header-with-text {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
  padding: 20px;
}

.header-with-text img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  filter: brightness(0.45); /* Mejor contraste para el texto */
}

.header-with-text .intro-text {
  position: relative;
  z-index: 2;
  background: rgba(0, 5, 25, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 35px 30px;
  border-radius: 16px;
  color: white;
  text-align: center;
  max-width: 750px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
}

h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin-top: 0;
  margin-bottom: 15px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ==========================================================================
   Efecto Máquina de Escribir (Typewriter)
   ========================================================================== */

.typewriter {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(0.95rem, 3.5vw, 1.2rem);
  line-height: 1.6;
  margin: 10px 0;
  border-right: 2px solid transparent;
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  word-wrap: break-word;
  box-sizing: border-box;
}

/* Solo se aplica el cursor parpadeante si está escribiendo activamente */
.typewriter.typing {
  border-right-color: #ff99cc;
  animation: blink-caret 0.75s step-end infinite;
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: #ff99cc; }
}

/* ==========================================================================
   Contador de Amor (Contador Grid)
   ========================================================================== */

.contador-container {
  text-align: center;
  margin: 60px auto 40px auto;
  max-width: 600px;
  padding: 0 20px;
  box-sizing: border-box;
}

.titulo-contador {
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  margin-bottom: 15px;
  font-weight: 300;
  color: #aad6ff;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.contador-main {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  padding: 12px 28px;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 20px;
}

.dias-numero {
  font-size: clamp(2.8rem, 10vw, 4.5rem);
  font-weight: 800;
  color: #ffffcc;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 255, 204, 0.3);
}

.dias-etiqueta {
  font-size: clamp(1.1rem, 3.5vw, 1.5rem);
  color: #ffffff;
  font-weight: 400;
}

.contador-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 450px;
  margin: 0 auto;
}

.contador-item {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  padding: 12px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s ease, background 0.3s ease;
}

.contador-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
}

.contador-val {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 700;
  color: #ffb6c1;
  line-height: 1.1;
}

.contador-lbl {
  font-size: clamp(0.7rem, 2vw, 0.85rem);
  color: #e0e0e0;
  text-transform: uppercase;
  margin-top: 4px;
  letter-spacing: 1px;
}

.juntos-texto {
  font-size: clamp(1rem, 3vw, 1.25rem);
  color: #ffccff;
  margin-top: 15px;
  font-style: italic;
  letter-spacing: 1px;
}

/* ==========================================================================
   Secciones de Contenido (Historias / Frases)
   ========================================================================== */

section {
  width: 90%;
  max-width: 700px;
  margin: 40px auto;
  padding: 25px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}

section p {
  font-size: clamp(0.95rem, 3vw, 1.1rem);
  line-height: 1.7;
  color: #f0f5fa;
  margin: 0;
}

.body-image {
  width: 100%;
  height: auto;
  border-radius: 12px;
  margin-bottom: 20px;
  display: block;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Frase Semanal Rotativa e Indicadores
   ========================================================================== */

.frase-rotativa {
  text-align: center;
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  font-weight: 500;
  color: #ffffff;
  padding: 0.5rem;
  max-width: 95%;
  margin: 0 auto;
  line-height: 1.5;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.progress-bar-container {
  width: 70%;
  max-width: 250px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  margin: 20px auto 5px auto;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ff99cc, #ff66a3, #ff3385);
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(255, 102, 163, 0.8);
}

.progress-bar.active {
  animation: progressRun 10s linear forwards;
}

@keyframes progressRun {
  from { width: 0%; }
  to { width: 100%; }
}

/* Animaciones de Entrada */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.8s ease-out forwards;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
    transform: translateY(15px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Pie de Página (Footer)
   ========================================================================== */

.floating-text {
  text-align: center;
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  color: #ffccff;
  padding: 30px 20px 40px 20px;
  margin-top: 50px;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  animation: floatText 5s ease-in-out infinite;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

@keyframes floatText {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ==========================================================================
   Media Queries para Pantallas Pequeñas
   ========================================================================== */

@media (max-width: 600px) {
  .header-with-text {
    padding: 15px;
  }
  
  .header-with-text .intro-text {
    padding: 24px 20px;
  }

  section {
    padding: 20px;
    margin: 30px auto;
  }

  .contador-grid {
    gap: 8px;
  }

  .contador-item {
    padding: 10px 5px;
  }
}
