:root {
  --fondo: #0d0907;
  --tinta: #efe6da;
  --tinta-suave: #c9b8a3;
  --oro: #c9a86a;
  --oro-claro: #dcbd80;
  --marca: 'Jost', 'Futura', 'Century Gothic', sans-serif;
  --texto: 'Cormorant Garamond', 'Georgia', serif;
  --fundido: 3.6s; /* igual que FUNDIDO en portada.js */
}

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

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--fondo);
  color: var(--tinta);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

::selection {
  background: var(--oro);
  color: var(--fondo);
}

/* ───────── fondo ───────── */

.fondo,
.fondo > * {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#lienzo {
  display: block;
}

/* un velo apenas más oscuro detrás del logo, para que siempre se lea */
.velo {
  background:
    radial-gradient(ellipse 78% 50% at 50% 44%, rgba(13, 9, 7, 0.55), rgba(13, 9, 7, 0) 74%),
    linear-gradient(to top, rgba(13, 9, 7, 0.72), rgba(13, 9, 7, 0) 34%);
}

/* respaldo sin WebGL: las mismas dos imágenes, fundidas con CSS */
.respaldo {
  display: none;
  background-size: cover;
  opacity: 0;
  transition: opacity var(--fundido) ease-in-out;
  animation: deriva 34s ease-in-out infinite alternate;
  filter: brightness(0.62);
}
.respaldo[data-escena='fachada'] {
  background-image: url('img/fachada.webp');
  background-position: 60% 50%;
}
.respaldo[data-escena='escultura'] {
  background-image: url('img/escultura.webp');
  background-position: 62% 40%;
  filter: brightness(0.85);
  animation-direction: alternate-reverse;
}
.sin-gl .respaldo {
  display: block;
}
.sin-gl .respaldo.activa {
  opacity: 1;
}
.sin-gl #lienzo {
  display: none;
}

@keyframes deriva {
  from {
    transform: scale(1.02);
  }
  to {
    transform: scale(1.1) translate(-0.8%, 0.6%);
  }
}

/* ───────── portada ───────── */

.portada {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 1.25rem 11vh;
  text-align: center;
}

.logo {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--marca);
  font-weight: 400;
  line-height: 1;
  text-shadow:
    0 0 0.3em rgba(13, 9, 7, 0.5),
    0 0 2em rgba(13, 9, 7, 0.6);
}

.logo-letras {
  display: flex;
  font-size: clamp(2.1rem, 9.2vw, 8.4rem);
  letter-spacing: 0.5em;
  margin-right: -0.5em; /* compensa el espacio de la última letra */
}

.logo-letras span {
  display: inline-block;
  opacity: 0;
  will-change: opacity, transform, filter;
}

.logo-raya {
  width: clamp(1.1rem, 2.6vw, 2.5rem);
  height: clamp(2px, 0.32vw, 4px);
  margin-top: clamp(1rem, 2.4vw, 2.2rem);
  background: var(--tinta);
  transform: scaleX(0);
}

.proximamente {
  margin: clamp(1.8rem, 4.4vw, 3.4rem) 0 0;
  padding: 0 0.2em 0.14em; /* aire para que la cursiva no se recorte */
  font-family: var(--texto);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.5rem, 5.2vw, 4.4rem);
  line-height: 1.1;
  letter-spacing: 0.03em;
  /* dorado, con un brillo que lo recorre cada tanto */
  color: var(--oro-claro);
  background: linear-gradient(
      100deg,
      var(--oro-claro) 0%,
      var(--oro-claro) 42%,
      #fff3d6 50%,
      var(--oro-claro) 58%,
      var(--oro-claro) 100%
    )
    100% 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 0.4em rgba(13, 9, 7, 0.85));
  opacity: 0;
}

/* ───────── pie ───────── */

.pie {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 1.25rem calc(clamp(1.3rem, 3.4vh, 2.4rem) + env(safe-area-inset-bottom));
  text-align: center;
  opacity: 0;
}

.lugar {
  margin: 0.85rem 0 0;
  font-family: var(--marca);
  font-weight: 300;
  font-size: clamp(0.56rem, 0.85vw, 0.7rem);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--tinta-suave);
}
.lugar::before {
  content: '';
  display: block;
  width: 1px;
  height: clamp(0.9rem, 2.4vh, 1.5rem);
  margin: 0 auto 0.85rem;
  background: linear-gradient(transparent, var(--oro));
}

.enlaces {
  margin-top: 0.9rem;
  display: flex;
  justify-content: center;
  gap: 1.6rem;
}
.enlaces[hidden] {
  display: none;
}
.enlaces a {
  font-family: var(--marca);
  font-weight: 400;
  font-size: clamp(0.6rem, 0.9vw, 0.74rem);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--tinta);
  padding: 0.5rem 0.1rem;
  border-bottom: 1px solid rgba(201, 168, 106, 0.55);
  transition:
    color 0.3s,
    border-color 0.3s;
}
.enlaces a:hover,
.enlaces a:focus-visible {
  color: var(--oro);
  border-color: var(--oro);
  outline: none;
}

/* ───────── la entrada: todo aparece de a poco ───────── */

.listo .logo-letras span {
  animation:
    letra 1.9s cubic-bezier(0.2, 0.7, 0.2, 1) calc(0.35s + var(--n) * 0.17s) both,
    onda 8s ease-in-out calc(6.5s + var(--n) * 0.26s) infinite;
}
.listo .logo-raya {
  animation:
    raya 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) 1.75s both,
    pulso 8s ease-in-out 8.2s infinite;
}
.listo .proximamente {
  animation:
    subir 2.2s cubic-bezier(0.2, 0.7, 0.2, 1) 2.7s both,
    brillo 7s ease-in-out 5.6s infinite;
}
.listo .pie {
  animation: aparecer 2.4s ease 4.1s both;
}

@keyframes letra {
  from {
    opacity: 0;
    filter: blur(0.22em);
    transform: translateY(0.16em) scale(1.06);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}
/* después, una luz que recorre el logo letra por letra */
@keyframes onda {
  0%,
  22%,
  100% {
    opacity: 1;
  }
  11% {
    opacity: 0.58;
  }
}
@keyframes raya {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
@keyframes pulso {
  0%,
  24%,
  100% {
    transform: scaleX(1);
  }
  12% {
    transform: scaleX(1.5);
  }
}
@keyframes subir {
  from {
    opacity: 0;
    transform: translateY(0.7em);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes brillo {
  0% {
    background-position: 100% 0;
  }
  45%,
  100% {
    background-position: 0% 0;
  }
}
@keyframes aparecer {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ───────── pantallas chicas o muy bajas ───────── */

@media (max-width: 520px) {
  .logo-letras {
    font-size: 10.6vw;
    letter-spacing: 0.42em;
    margin-right: -0.42em;
  }
}

@media (max-height: 520px) {
  .portada {
    padding-bottom: 16vh;
  }
  .logo-letras {
    font-size: clamp(1.8rem, 13vh, 4rem);
  }
  .proximamente {
    margin-top: 0.9rem;
    font-size: 1.9rem;
  }
  .lugar::before {
    display: none;
  }
  .lugar {
    margin-top: 0;
  }
}

/* ───────── quien prefiere menos movimiento ───────── */

@media (prefers-reduced-motion: reduce) {
  .respaldo {
    animation: none;
  }
  .listo .logo-letras span {
    animation: aparecer 1.2s ease 0.2s both;
  }
  .listo .logo-raya {
    animation: raya 0.01s linear 0.2s both;
  }
  .listo .proximamente,
  .listo .pie {
    animation: aparecer 1.2s ease 0.6s both;
  }
}
