/* ==========================================================================
   LOFTIC · Página de espera
   Fuentes alojadas en local (SIL Open Font License 1.1). Sin dependencias.
   Solo se animan transform, opacity, filter y background-position.
   ========================================================================== */

/* Playfair está precargada: "block" evita que la animación empiece con
   una fuente provisional. Manrope usa "swap". */
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("../fonts/playfair-display-400.woff2") format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400;
  font-display: block;
  src: url("../fonts/playfair-display-400-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("../fonts/manrope-300.woff2") format("woff2");
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/manrope-400.woff2") format("woff2");
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/manrope-500.woff2") format("woff2");
}

:root {
  --verde: #01472E;
  --verde-luz: #0B5A3D;
  --verde-sombra: #00170F;
  --marfil: #F6F3EE;
  --marfil-suave: rgba(246, 243, 238, 0.72);
  --linea: rgba(246, 243, 238, 0.25);

  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;

  --margen: max(24px, 6vw);
  --espacio-letras: 0.2em;

  /* Coreografía (segundos desde la carga) */
  --t-fondo: 0s;
  --t-letras: 0.3s;
  --paso-letra: 90ms;
  --t-destello: 1.9s;
  --t-lema: 1.55s;
  --t-descripcion: 1.8s;
  --t-estado: 2.05s;
  --t-carga: 2.2s;
  --t-pie: 2.45s;

  --curva-suave: cubic-bezier(0.22, 1, 0.36, 1);
  --curva-carga: cubic-bezier(0.65, 0, 0.35, 1);

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--verde);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background-color: var(--verde);
  color: var(--marfil);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  text-align: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding:
    max(48px, env(safe-area-inset-top))
    max(var(--margen), env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom))
    max(var(--margen), env(safe-area-inset-left));
}

::selection {
  background-color: var(--marfil);
  color: var(--verde);
}

/* ==========================================================================
   Fondo: capas separadas, fijas y recortadas por su contenedor
   ========================================================================== */

.fondo {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Capa de luz: 160 % de la pantalla. El contenedor aparece una vez;
   el pseudoelemento respira (solo transform y opacity). */
.fondo-luz {
  position: absolute;
  inset: -30%;
  opacity: 0;
  animation: aparece-fondo 1.8s ease-out var(--t-fondo) forwards;
}

.fondo-luz::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    closest-side,
    var(--verde-luz) 0%,
    var(--verde) 55%,
    rgba(1, 71, 46, 0) 100%
  );
  will-change: transform, opacity;
  animation: respira-luz 18s ease-in-out infinite;
}

.fondo-vineta {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    ellipse at 50% 50%,
    rgba(0, 23, 15, 0) 40%,
    rgba(0, 23, 15, 0.55) 80%,
    var(--verde-sombra) 115%
  );
}

/* Grano de película: ruido SVG estático, 6 % de opacidad. */
.fondo-grano {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}

@keyframes aparece-fondo {
  to { opacity: 1; }
}

@keyframes respira-luz {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate3d(1.2%, -0.8%, 0) scale(1.04);
    opacity: 0.86;
  }
}

/* ==========================================================================
   Composición
   ========================================================================== */

.espera,
.pie {
  position: relative;
  z-index: 1;
}

.espera {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding-block: 40px;
}

/* El padre da la perspectiva; el bloque es lo que se inclina. */
.escena {
  width: 100%;
  perspective: 1200px;
}

.bloque {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .bloque {
    will-change: transform;
  }
}

/* ==========================================================================
   LOFTIC
   ========================================================================== */

.titulo {
  position: relative;
  /* Volumen: sombra en el contenedor, nunca en las letras. */
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.35));
}

.marca,
.destello {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.75rem, 13vw, 6.5rem);
  line-height: 1;
  /* Sin kerning: así el duplicado del destello coincide al píxel
     con las letras separadas en máscaras. */
  font-kerning: none;
  font-feature-settings: "kern" 0;
}

.marca {
  display: flex;
  justify-content: center;
}

/* Cada máscara recorta la subida de su letra. El relleno lateral deja
   sitio al desenfoque y el margen negativo lo compensa en el diseño. */
.mascara {
  display: block;
  overflow: hidden;
  padding: 0.12em 0.1em;
  margin-inline: -0.1em;
  animation: asienta-espacio 1.5s var(--curva-suave) both;
  animation-delay: calc(var(--t-letras) + var(--i) * var(--paso-letra));
}

.mascara + .mascara {
  margin-left: calc(var(--espacio-letras) - 0.1em);
}

.letra {
  display: block;
  color: var(--marfil);
  will-change: transform, filter, opacity;
  animation: sube-letra 1.2s var(--curva-suave) both;
  animation-delay: calc(var(--t-letras) + var(--i) * var(--paso-letra));
}

/* --i: orden de aparición. --d: distancia al centro de la palabra,
   para que el espaciado se asiente desde más amplio. */
.mascara:nth-child(1) { --i: 0; --d: -2.5; }
.mascara:nth-child(2) { --i: 1; --d: -1.5; }
.mascara:nth-child(3) { --i: 2; --d: -0.5; }
.mascara:nth-child(4) { --i: 3; --d: 0.5; }
.mascara:nth-child(5) { --i: 4; --d: 1.5; }
.mascara:nth-child(6) { --i: 5; --d: 2.5; }

@keyframes sube-letra {
  from {
    transform: translate3d(0, 105%, 0);
    filter: blur(8px);
    opacity: 0;
  }
  45% {
    opacity: 1;
  }
  to {
    transform: translate3d(0, 0, 0);
    filter: blur(0);
    opacity: 1;
  }
}

@keyframes asienta-espacio {
  from { transform: translate3d(calc(var(--d) * 0.12em), 0, 0); }
  to   { transform: translate3d(0, 0, 0); }
}

/* Destello: duplicado exacto del texto, con un brillo que cruza una vez. */
.destello {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  padding-block: 0.12em;
  white-space: nowrap;
  letter-spacing: var(--espacio-letras);
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-image: linear-gradient(
    105deg,
    rgba(255, 253, 248, 0) 42%,
    rgba(255, 253, 248, 0.9) 50%,
    rgba(255, 253, 248, 0) 58%
  );
  background-size: 300% 100%;
  background-repeat: no-repeat;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  pointer-events: none;
  user-select: none;
  animation: cruza-destello 1.3s cubic-bezier(0.45, 0, 0.25, 1) var(--t-destello) both;
}

@keyframes cruza-destello {
  from { background-position: 100% 0; }
  to   { background-position: 0% 0; }
}

/* ==========================================================================
   Textos
   ========================================================================== */

.lema {
  margin-top: clamp(28px, 5vh, 40px);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.25rem, 4.6vw, 1.875rem);
  line-height: 1.35;
  text-wrap: balance;
}

.descripcion {
  margin-top: 14px;
  font-weight: 300;
  font-size: clamp(1rem, 3.6vw, 1.125rem);
  color: var(--marfil-suave);
  text-wrap: balance;
}

.estado {
  margin-top: clamp(48px, 9vh, 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.estado-texto {
  font-weight: 500;
  font-size: 0.75rem;
  line-height: 1;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  /* Compensa el espaciado tras la última letra. */
  margin-right: -0.32em;
}

.lema,
.descripcion,
.estado,
.pie {
  animation: entra 1.2s var(--curva-suave) both;
}

.lema        { animation-delay: var(--t-lema); }
.descripcion { animation-delay: var(--t-descripcion); }
.estado      { animation-delay: var(--t-estado); }
.pie         { animation-delay: var(--t-pie); }

@keyframes entra {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* ==========================================================================
   Línea de carga
   ========================================================================== */

.carga {
  --ancho: 180px;
  --final: 0.8;
  position: relative;
  width: var(--ancho);
  height: 1px;
  margin-top: 20px;
  background-color: var(--linea);
}

.carga-relleno {
  position: absolute;
  inset: 0;
  background-color: var(--marfil);
  transform-origin: left center;
  transform: scaleX(var(--final));
  animation: llena 3.5s var(--curva-carga) var(--t-carga) both;
}

.carga-punto {
  position: absolute;
  top: -1.5px;
  left: -2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--marfil);
  transform: translate3d(calc(var(--ancho) * var(--final)), 0, 0);
  will-change: transform, opacity;
  animation:
    viaja 3.5s var(--curva-carga) var(--t-carga) both,
    pulso 2.4s ease-in-out calc(var(--t-carga) + 3.5s) infinite;
}

/* Halo estático; su respiración se hace con opacity y scale. */
.carga-punto::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 8px 3px rgba(246, 243, 238, 0.55);
  opacity: 0.35;
  animation: halo 2.4s ease-in-out calc(var(--t-carga) + 3.5s) infinite;
}

@keyframes llena {
  from { transform: scaleX(0); }
  to   { transform: scaleX(var(--final)); }
}

@keyframes viaja {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(calc(var(--ancho) * var(--final)), 0, 0); }
}

@keyframes pulso {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

@keyframes halo {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.6); }
}

/* ==========================================================================
   Pie
   ========================================================================== */

.pie {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.contacto {
  display: inline-block;
  padding: 10px 4px;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.9375rem;
  letter-spacing: 0.04em;
  color: var(--marfil);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

.contacto:hover {
  text-decoration-line: underline;
}

.contacto:focus {
  outline: none;
}

.contacto:focus-visible {
  outline: 1px solid var(--marfil);
  outline-offset: 4px;
  border-radius: 2px;
}

.copyright {
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  color: var(--marfil-suave);
}

/* ==========================================================================
   Movimiento reducido: todo en su sitio desde el principio
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
  }

  .fondo-luz {
    opacity: 1;
  }

  .destello {
    display: none;
  }

  .bloque {
    transform: none !important;
  }
}
