/* ==========================================================================
   La Cuarta Voz — Página "Próximamente"
   --------------------------------------------------------------------------
   1. Variables de diseño (paleta, tipografía, medidas, tiempos)
   2. Base / reset
   3. Fondo (imagen + canvas de ondas + viñeta + grano)
   4. Composición central
   5. Logotipo
   6. Indicador de estado
   7. Tipografía del mensaje
   8. Animaciones de entrada
   9. Adaptación a pantallas
   10. Movimiento reducido
   ========================================================================== */

/* 1. Variables de diseño ---------------------------------------------------
   Cambia aquí los colores y medidas: el canvas (js/main.js) también lee
   las variables --wave-* para dibujar las ondas. */
:root {
  /* Paleta base (tonos vino / carmesí) */
  --color-bg-deep:     #3d000a;
  --color-bg:          #5c0010;
  --color-bg-mid:      #7a0716;
  --color-bg-light:    #9e0b1f;

  /* Acentos metálicos */
  --color-gold:        #e8b86a;
  --color-gold-light:  #f8dc9a;
  --color-gold-deep:   #b9813f;

  /* Texto */
  --color-text:        #fbeedd;
  --color-text-muted:  rgba(251, 238, 221, 0.78);

  /* Colores que usa el canvas de ondas (formato R, G, B) */
  --wave-ribbon:       176, 18, 36;   /* cintas translúcidas  */
  --wave-ribbon-dark:  70, 0, 10;     /* sombra de las cintas */
  --wave-line:         232, 184, 106; /* líneas doradas       */
  --wave-ring:         196, 30, 50;   /* anillos concéntricos */

  /* Fondo */
  --bg-image: url("../assets/Fondo4Voz.webp");
  --bg-blur: 3px;                    /* 0px = imagen nítida */

  /* Logotipo */
  --logo-max-width: 340px;           /* ancho máximo configurable */
  --logo-glow: rgba(232, 184, 106, 0.28);

  /* Tipografía */
  --font-sans: "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
  --fs-title:  clamp(1.35rem, 1rem + 1.9vw, 2.35rem);
  --fs-text:   clamp(0.95rem, 0.88rem + 0.35vw, 1.1rem);
  --fs-status: clamp(0.68rem, 0.64rem + 0.18vw, 0.78rem);

  /* Tiempos */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --reveal-duration: 1.4s;
}

/* 2. Base / reset ---------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

/* 3. Fondo ----------------------------------------------------------------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 55% 10%, var(--color-bg-light) 0%, transparent 55%),
    linear-gradient(160deg, var(--color-bg) 0%, var(--color-bg-deep) 100%);
}

/* Imagen de fondo: ligeramente sobredimensionada para permitir el
   desplazamiento parallax (variables --px / --py desde JS).
   Se difumina un poco para que sus líneas fijas queden como un brillo
   atmosférico y las ondas animadas del canvas sean las protagonistas. */
.backdrop__image {
  position: absolute;
  inset: -6%;
  transform: translate3d(calc(var(--px, 0) * -14px), calc(var(--py, 0) * -10px), 0);
  will-change: transform;
}

.backdrop__image::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  filter: blur(var(--bg-blur, 3px)) saturate(1.05);
  opacity: 0.85;
  /* Deriva lenta: la propia imagen también se mueve */
  animation: bg-drift 28s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes bg-drift {
  0%   { transform: translate3d(-1.5%, 0.8%, 0) scale(1.03) rotate(-0.4deg); }
  50%  { transform: translate3d(0.5%, -1%, 0) scale(1.06) rotate(0.2deg); }
  100% { transform: translate3d(1.5%, 0.6%, 0) scale(1.04) rotate(0.5deg); }
}

.backdrop__waves {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 2.4s ease;
}

.backdrop__waves.is-ready {
  opacity: 1;
}

/* Viñeta: oscurece bordes y crea un halo suave detrás del contenido
   para asegurar el contraste del logotipo y del texto. */
.backdrop__vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(42% 46% at 50% 50%, rgba(60, 0, 10, 0.55) 0%, rgba(60, 0, 10, 0.18) 60%, transparent 100%),
    radial-gradient(130% 110% at 50% 50%, transparent 55%, rgba(25, 0, 4, 0.6) 100%);
}

/* Grano muy sutil para dar textura y evitar bandas en los degradados */
.backdrop__grain {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* 4. Composición central --------------------------------------------------- */
.hero {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;               /* ocupa el alto disponible sobre el pie */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.9rem, 2.2vh, 1.5rem);
  padding: clamp(1.5rem, 5vh, 3.5rem) 1rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  text-align: center;
}

/* 5. Logotipo -------------------------------------------------------------- */
.hero__brand {
  /* Ancho real del logotipo en pantalla */
  --logo-w: min(var(--logo-max-width), 64vw, 44vh);
  margin: 0;
  line-height: 0;
  /* El PNG incluye aire transparente alrededor (~13 % arriba, ~14 % abajo);
     se compensa en proporción al ancho, dejando un pequeño respiro */
  margin-top: calc(var(--logo-w) * -0.11);
  margin-bottom: calc(var(--logo-w) * -0.07);
}

.hero__logo {
  width: var(--logo-w);
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(0 0 22px var(--logo-glow))
    drop-shadow(0 12px 30px rgba(20, 0, 4, 0.45));
  user-select: none;
  -webkit-user-drag: none;
}

/* Brillo suave y lento sobre el logotipo (solo opacidad del resplandor) */
.hero__brand {
  position: relative;
}

.hero__brand::after {
  content: "";
  position: absolute;
  inset: 18%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(232, 184, 106, 0.16), transparent);
  animation: logo-halo 6s ease-in-out infinite alternate;
}

@keyframes logo-halo {
  from { opacity: 0.45; transform: scale(0.94); }
  to   { opacity: 1;    transform: scale(1.06); }
}

/* 6. Indicador de estado --------------------------------------------------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.65em;
  margin: 0;
  padding: 0.55em 1.15em;
  font-size: var(--fs-status);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-gold-light);
  border: 1px solid rgba(232, 184, 106, 0.32);
  border-radius: 999px;
  background: rgba(40, 0, 8, 0.38);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(248, 220, 154, 0.08);
}

.status__dot {
  position: relative;
  flex: none;
  width: 0.62em;
  height: 0.62em;
  border-radius: 50%;
  background: var(--color-gold);
  box-shadow: 0 0 10px rgba(232, 184, 106, 0.8);
  animation: dot-pulse 2.2s ease-in-out infinite;
}

/* Onda expansiva del punto (transform + opacity) */
.status__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--color-gold);
  animation: dot-ring 2.2s var(--ease-out-expo) infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1;    transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(0.82); }
}

@keyframes dot-ring {
  0%   { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0;   transform: scale(3.2); }
}

.status__sep {
  width: 1px;
  height: 1.1em;
  background: rgba(232, 184, 106, 0.35);
}

.status__extra {
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0.12em;
}

/* 7. Tipografía del mensaje ------------------------------------------------ */
.hero__title {
  margin: 0;
  max-width: 22ch;
  font-size: var(--fs-title);
  font-weight: 300;
  line-height: 1.22;
  letter-spacing: -0.01em;
  color: var(--color-text);
  text-wrap: balance;
  text-shadow: 0 2px 18px rgba(20, 0, 4, 0.5);
}

.hero__title em {
  font-style: normal;
  font-weight: 800;
  background: linear-gradient(100deg, var(--color-gold-light) 0%, var(--color-gold) 45%, var(--color-gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* text-shadow no se ve con background-clip: se usa filtro */
  filter: drop-shadow(0 2px 12px rgba(20, 0, 4, 0.45));
}

.hero__text {
  margin: 0;
  max-width: 34rem;
  font-size: var(--fs-text);
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-text-muted);
  text-wrap: pretty;
  text-shadow: 0 1px 12px rgba(20, 0, 4, 0.6);
}

/* 8. Animaciones de entrada ------------------------------------------------
   Los elementos .reveal empiezan ocultos solo cuando JS está activo
   (clase .js en <html>), así el contenido siempre es visible sin JS. */
.js .reveal {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  filter: blur(6px);
}

.js.is-loaded .reveal {
  animation: reveal-up var(--reveal-duration) var(--ease-out-expo) forwards;
}

.js.is-loaded .reveal--1 { animation-delay: 0.15s; }
.js.is-loaded .reveal--2 { animation-delay: 0.55s; }
.js.is-loaded .reveal--3 { animation-delay: 0.75s; }
.js.is-loaded .reveal--4 { animation-delay: 0.95s; }
.js.is-loaded .reveal--5 { animation-delay: 1.2s; }

/* El logotipo tiene su propio filtro (resplandor): se anima sin blur */
.js .hero__logo.reveal {
  filter:
    drop-shadow(0 0 22px var(--logo-glow))
    drop-shadow(0 12px 30px rgba(20, 0, 4, 0.45));
  transform: translate3d(0, 28px, 0) scale(0.96);
}

.js.is-loaded .hero__logo.reveal {
  animation-name: reveal-logo;
  animation-duration: 1.8s;
}

@keyframes reveal-up {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
}

@keyframes reveal-logo {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* 7b. Pie de página: contacto y redes -------------------------------------- */
.footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding: 1.25rem 1rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  text-align: center;
}

.footer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon .icon--fill,
.icon.icon--fill {
  fill: currentColor;
  stroke: none;
}

.footer__mail {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.35em 0.2em;
  font-size: clamp(0.85rem, 0.82rem + 0.15vw, 0.95rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-gold-light);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.4s var(--ease-out-expo), color 0.3s ease;
}

.footer__mail:focus-visible {
  color: #fff4dc;
  background-size: 100% 1px;
}

.footer__sep {
  width: 1px;
  height: 1.4rem;
  background: rgba(232, 184, 106, 0.3);
}

.social {
  display: flex;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social__link {
  display: grid;
  place-items: center;
  width: 2.6rem;                /* área táctil ≥ 40px */
  height: 2.6rem;
  font-size: 1.05rem;
  color: var(--color-gold-light);
  border: 1px solid rgba(232, 184, 106, 0.32);
  border-radius: 50%;
  background: rgba(40, 0, 8, 0.35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform 0.35s var(--ease-out-expo), background-color 0.3s ease,
              border-color 0.3s ease, color 0.3s ease;
}

.social__link:focus-visible {
  color: var(--color-bg-deep);
  background-color: var(--color-gold);
  border-color: var(--color-gold);
  transform: translateY(-2px);
}

.footer a:focus-visible {
  outline: 2px solid var(--color-gold-light);
  outline-offset: 3px;
}

.footer__copy {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(251, 238, 221, 0.55);
}

/* Hover solo en dispositivos con ratón (evita estados "pegados" al tocar) */
@media (hover: hover) {
  .footer__mail:hover {
    color: #fff4dc;
    background-size: 100% 1px;
  }

  .social__link:hover {
    color: var(--color-bg-deep);
    background-color: var(--color-gold);
    border-color: var(--color-gold);
    transform: translateY(-2px);
  }
}

/* Respuesta inmediata al toque en móviles */
.footer a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* 9. Adaptación a pantallas ------------------------------------------------ */
@media (max-width: 640px) {
  .status {
    letter-spacing: 0.14em;
  }

  /* En móvil se muestra solo la etiqueta principal del estado */
  .status__sep,
  .status__extra {
    display: none;
  }

  .hero__text {
    line-height: 1.6;
  }

  .footer__sep {
    display: none;
  }

  .footer__row {
    flex-direction: column;
    gap: 0.6rem;
  }
}

/* Dispositivos táctiles: sin backdrop-filter (se recalcula en cada
   fotograma sobre el fondo animado y es costoso en móviles) */
@media (pointer: coarse) {
  .status,
  .social__link {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background-color: rgba(40, 0, 8, 0.62);
  }
}

/* Pantallas bajas (móvil en horizontal) */
@media (max-height: 520px) and (orientation: landscape) {
  .hero {
    gap: 0.5rem;
    padding-top: 1rem;
    padding-bottom: 0.5rem;
  }

  .hero__brand {
    --logo-w: min(var(--logo-max-width), 36vh);
  }

  .footer {
    gap: 0.4rem;
    padding-top: 0.5rem;
  }

  .hero__text {
    max-width: 44rem;
  }
}

/* Pantallas muy grandes */
@media (min-width: 1800px) and (min-height: 1000px) {
  :root {
    --logo-max-width: 420px;
  }
}

/* 10. Movimiento reducido --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .js .hero__logo.reveal {
    transform: none;
    filter:
      drop-shadow(0 0 22px var(--logo-glow))
      drop-shadow(0 12px 30px rgba(20, 0, 4, 0.45));
  }

  .backdrop__image {
    transform: none;
  }
}
