/* ============================================================
   src/styles.css — Estilos globales de la interfaz
============================================================ */

/* ── Reset y base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-amarillo:   #FFD60A;
  --color-amarillo-d: #F4A300;
  --color-oscuro:     #0B1026;
  --color-texto:      #FFF8E1;
  --color-texto-dim:  rgba(255, 248, 225, 0.7);
  --font-title:       'Pacifico', cursive;
  --font-body:        'Lato', sans-serif;
  --radius:           1rem;
  --transition:       0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--color-oscuro);
  font-family: var(--font-body);
  color: var(--color-texto);
}

/* ── Utilidades ───────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Canvas 3D ────────────────────────────────────────────── */
#canvas-3d {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

/* ── Pantalla de bienvenida ───────────────────────────────── */
#welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1B2A5A 0%, #0B1026 70%);
  animation: bgPulse 6s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  from { background: radial-gradient(ellipse at center, #1B2A5A 0%, #0B1026 70%); }
  to   { background: radial-gradient(ellipse at center, #243570 0%, #0D1530 70%); }
}

.welcome-content {
  text-align: center;
  padding: 2rem;
  animation: fadeInUp 1s ease forwards;
}

.welcome-flowers {
  font-size: clamp(2.5rem, 8vw, 4rem);
  margin-bottom: 1rem;
  animation: flowerBounce 2s ease-in-out infinite;
}

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

.welcome-title {
  font-family: var(--font-title);
  font-size: clamp(2.5rem, 10vw, 5rem);
  color: var(--color-amarillo);
  text-shadow: 0 0 30px rgba(255, 214, 10, 0.6), 0 2px 4px rgba(0,0,0,0.5);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.welcome-subtitle {
  font-size: clamp(1rem, 4vw, 1.4rem);
  color: var(--color-texto-dim);
  margin-bottom: 2.5rem;
  font-weight: 300;
  letter-spacing: 0.05em;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2.5rem;
  background: linear-gradient(135deg, var(--color-amarillo), var(--color-amarillo-d));
  color: #1a0f00;
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 25px rgba(255, 214, 10, 0.5);
  transition: transform var(--transition), box-shadow var(--transition);
  letter-spacing: 0.05em;
}

.btn-primary:hover {
  transform: scale(1.06) translateY(-2px);
  box-shadow: 0 8px 35px rgba(255, 214, 10, 0.7);
}

.btn-primary:active {
  transform: scale(0.97);
}

/* ── Transición de entrada del overlay ───────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Overlay UI (sobre el canvas) ────────────────────────── */
#ui-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;        /* permite interactuar con el canvas */
}

#ui-overlay > * {
  pointer-events: auto;
}

/* Header */
.ui-header {
  position: absolute;
  top: env(safe-area-inset-top, 1rem);
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  padding: 0.75rem 1.5rem;
  background: rgba(11, 16, 38, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 214, 10, 0.25);
  animation: fadeInUp 0.8s ease forwards;
  max-width: 90vw;
}

.ui-title {
  font-family: var(--font-title);
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  color: var(--color-amarillo);
  text-shadow: 0 0 20px rgba(255, 214, 10, 0.5);
}

.ui-subtitle {
  font-size: clamp(0.75rem, 2.5vw, 1rem);
  color: var(--color-texto-dim);
  font-weight: 300;
}

.ui-date {
  font-size: 0.75rem;
  color: rgba(255, 214, 10, 0.6);
  margin-top: 0.25rem;
  letter-spacing: 0.08em;
}

/* Contador de días */
.days-counter {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  text-align: center;
  background: rgba(11, 16, 38, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 214, 10, 0.3);
  padding: 0.75rem 1rem;
  min-width: 90px;
}

.days-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-amarillo);
  line-height: 1;
}

.days-label {
  font-size: 0.7rem;
  color: var(--color-texto-dim);
}

/* Mensaje personal */
.message-section {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: min(90vw, 560px);
  background: rgba(11, 16, 38, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 214, 10, 0.3);
  padding: 1.5rem 1.75rem 1.75rem;
  animation: fadeInUp 0.5s ease forwards;
  max-height: 55vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-amarillo-d) transparent;
}

.message-text {
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  line-height: 1.8;
  color: var(--color-texto);
  font-weight: 300;
}

.message-text p {
  margin-bottom: 1rem;
}

.message-text p:last-child {
  margin-bottom: 0;
  text-align: right;
  font-style: italic;
  color: var(--color-amarillo);
}

/* Botón de icono (cerrar, etc.) */
.btn-icon {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--color-texto-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.3rem;
  line-height: 1;
  transition: color var(--transition);
}

.btn-icon:hover { color: var(--color-amarillo); }

/* Modal de foto */
.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 8, 20, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.photo-modal-inner {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  text-align: center;
}

.photo-modal-inner img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: var(--radius);
  border: 2px solid rgba(255, 214, 10, 0.4);
  box-shadow: 0 0 60px rgba(255, 214, 10, 0.25);
  object-fit: contain;
}

.photo-modal-caption {
  margin-top: 0.75rem;
  color: var(--color-texto-dim);
  font-size: 0.9rem;
  font-style: italic;
}

#btn-close-photo {
  position: absolute;
  top: -2rem;
  right: 0;
  font-size: 1.5rem;
  color: var(--color-texto-dim);
}

/* Controles flotantes */
.controls {
  position: absolute;
  bottom: env(safe-area-inset-bottom, 1rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: rgba(11, 16, 38, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 50px;
  border: 1px solid rgba(255, 214, 10, 0.2);
}

.ctrl-btn {
  width: 2.8rem;
  height: 2.8rem;
  font-size: 1.25rem;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 214, 10, 0.3);
  background: rgba(255, 214, 10, 0.08);
  color: var(--color-texto);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition), border-color var(--transition);
}

.ctrl-btn:hover {
  background: rgba(255, 214, 10, 0.2);
  border-color: var(--color-amarillo);
  transform: scale(1.1);
}

.ctrl-btn.active {
  background: rgba(255, 214, 10, 0.25);
  border-color: var(--color-amarillo);
}

/* ── Fallback sin WebGL ──────────────────────────────────── */
#webgl-fallback {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  background: radial-gradient(ellipse at center, #1B2A5A 0%, #0B1026 100%);
  overflow: hidden;
}

.fallback-flowers {
  display: flex;
  gap: 1rem;
  font-size: 3rem;
}

.fallback-flower {
  animation: fallbackSway 3s ease-in-out infinite;
}

.fallback-flower:nth-child(1) { animation-delay: 0s; }
.fallback-flower:nth-child(2) { animation-delay: 0.4s; }
.fallback-flower:nth-child(3) { animation-delay: 0.8s; }
.fallback-flower:nth-child(4) { animation-delay: 1.2s; }
.fallback-flower:nth-child(5) { animation-delay: 1.6s; }

@keyframes fallbackSway {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50%       { transform: translateY(-18px) rotate(8deg); }
}

.fallback-content {
  text-align: center;
  padding: 1.5rem;
}

.fallback-title {
  font-family: var(--font-title);
  font-size: clamp(2rem, 8vw, 3.5rem);
  color: var(--color-amarillo);
  text-shadow: 0 0 30px rgba(255, 214, 10, 0.5);
  margin-bottom: 1rem;
}

.fallback-message {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: var(--color-texto-dim);
  max-width: 500px;
  line-height: 1.8;
  font-weight: 300;
}

.fallback-message p {
  margin-bottom: 1rem;
}

/* ── Animaciones globales ─────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Accesibilidad: reduce movimiento ────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .welcome-flowers,
  .fallback-flower {
    animation: none;
  }

  .welcome-content {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .btn-primary:hover {
    transform: none;
  }

  .ctrl-btn:hover {
    transform: none;
  }
}

/* ── Responsive adaptaciones ─────────────────────────────── */
@media (max-width: 480px) {
  .days-counter {
    top: auto;
    bottom: 80px;
    right: 0.5rem;
    transform: none;
    font-size: 0.85rem;
  }

  .days-number {
    font-size: 1.5rem;
  }

  .message-section {
    bottom: 72px;
    width: 95vw;
    max-height: 50vh;
  }

  .controls {
    gap: 0.5rem;
  }

  .ctrl-btn {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.1rem;
  }
}

/* Scrollbar estilizada */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-amarillo-d); border-radius: 2px; }
