/* ==========================================================
   Landing — Eulalio Guzmán Ovelar
   ========================================================== */

:root {
  --crimson-950: #1c0102;
  --crimson-900: #3d0406;
  --crimson-800: #7a0a0e;
  --white: #ffffff;

  --ease-out-expo: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.77, 0, .18, 1);

  /* Ancho del logo: se ajusta al ancho y al alto de la pantalla */
  --logo-w: min(88vw, 960px, 150vh);
}

@supports (height: 100svh) {
  :root { --logo-w: min(88vw, 960px, 150svh); }
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--crimson-900);
  color: var(--white);
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Telón de entrada ---------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 50%, #4f060a 0%, var(--crimson-950) 72%);
  will-change: transform;
}

.intro::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85), transparent);
}

html:not(.js) .intro { display: none; }

.intro__bar {
  position: relative;
  width: min(220px, 50vw);
  height: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, .15);
  transition: opacity .3s ease;
}

.intro__bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--white);
  transform: translateX(-100%);
  animation: loader 1.1s var(--ease-in-out) infinite;
}

.is-ready .intro { animation: curtain 1s var(--ease-in-out) .15s forwards; pointer-events: none; }
.is-ready .intro__bar { opacity: 0; }

@keyframes loader { to { transform: translateX(100%); } }
@keyframes curtain { to { transform: translateY(-100%); visibility: hidden; } }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.hero__bg,
.hero__silk,
.hero__sheen,
.hero__bokeh,
.hero__vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Fondo de seda en CSS: se ve al instante y queda como respaldo si no hay WebGL */
.hero__bg {
  z-index: 0;
  background: var(--crimson-800) url("../img/fondo-seda.jpg") center / cover no-repeat;
  transform: scale(1.09);
  will-change: transform;
}

.is-ready:not(.has-silk) .hero__bg { animation: kenburns 26s ease-in-out infinite alternate; }

@keyframes kenburns {
  from { transform: scale(1.09) translate3d(0, 0, 0); }
  to   { transform: scale(1.2) translate3d(-2%, -1.5%, 0); }
}

/* Seda animada (WebGL) */
.hero__silk {
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.hero__silk.is-on { opacity: 1; }

/* Destello de luz que recorre la tela */
.hero__sheen {
  z-index: 2;
  inset: -20%;
  background: linear-gradient(115deg,
    transparent 36%,
    rgba(255, 255, 255, .16) 45%,
    rgba(255, 255, 255, .30) 50%,
    rgba(255, 255, 255, .16) 55%,
    transparent 64%);
  mix-blend-mode: soft-light;
  transform: translate3d(-65%, 0, 0);
  will-change: transform;
}

.is-ready .hero__sheen { animation: sheen 10s ease-in-out 2.4s infinite; }

@keyframes sheen {
  0%        { transform: translate3d(-65%, 0, 0); }
  55%, 100% { transform: translate3d(65%, 0, 0); }
}

/* Partículas de luz */
.hero__bokeh {
  z-index: 3;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 2.5s ease 1.6s;
}

.is-ready .hero__bokeh { opacity: 1; }

.hero__vignette {
  z-index: 4;
  background:
    radial-gradient(120% 95% at 50% 45%, transparent 38%, rgba(30, 0, 1, .62) 100%),
    linear-gradient(180deg, rgba(30, 0, 1, .25) 0%, transparent 22%, transparent 78%, rgba(30, 0, 1, .35) 100%);
}

/* ---------- Contenido ---------- */

.hero__content {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 3.2vw, 36px);
  padding: 88px 16px 112px;
  transform:
    perspective(1100px)
    rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg))
    translate3d(var(--tx, 0px), var(--ty, 0px), 0);
  will-change: transform;
}

.logo {
  position: relative;
  width: var(--logo-w);
  margin: 0;
  line-height: 0;
  font-size: 0;
}

.is-ready .logo { animation: float 7s ease-in-out 2.8s infinite; }

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(0, -8px, 0); }
}

.logo__line {
  position: relative;
  display: block;
}

.logo__line img {
  width: 100%;
  filter: drop-shadow(0 10px 26px rgba(45, 0, 2, .45));
}

.logo__line--1 { --d: .85s; }
.logo__line--2 { --d: 1.1s; }

/* Barrido: un bloque blanco entra, se retira y deja el texto */
.js .logo__line img { opacity: 0; }

.js .logo__line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--white);
  transform: scaleX(0);
  transform-origin: left center;
}

.is-ready .logo__line::after { animation: wipe 1.1s var(--ease-in-out) var(--d) both; }
.is-ready .logo__line img    { animation: reveal 1s var(--ease-out-expo) calc(var(--d) + .5s) both; }

@keyframes wipe {
  0%   { transform: scaleX(0); transform-origin: left center; }
  45%  { transform: scaleX(1); transform-origin: left center; }
  55%  { transform: scaleX(1); transform-origin: right center; }
  100% { transform: scaleX(0); transform-origin: right center; }
}

@keyframes reveal {
  0%   { opacity: 0; transform: translate3d(-14px, 0, 0); }
  8%   { opacity: 1; }
  100% { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* Resplandor que respira detrás del logo */
.logo__glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  filter: blur(26px);
  will-change: opacity;
}

.logo__glow img { width: 100%; }

html:not(.js) .logo__glow { opacity: .3; }
.is-ready .logo__glow { animation: glow 4.5s ease-in-out 2.3s infinite alternate; }

@keyframes glow {
  from { opacity: 0; }
  to   { opacity: .45; }
}

.divider {
  display: block;
  width: calc(var(--logo-w) * .34);
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .95), transparent);
}

.js .divider { transform: scaleX(0); }
.is-ready .divider { animation: grow 1.3s var(--ease-out-expo) 2s both; }

@keyframes grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.tagline {
  margin: 0;
  font-weight: 800;
  font-style: italic;
  font-size: clamp(1.6rem, 4.2vw, 3rem);
  line-height: 1;
  --ls: .28em;
  letter-spacing: var(--ls);
  padding-left: var(--ls); /* compensa el espaciado final para centrar */
  text-transform: uppercase;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 2px 14px rgba(45, 0, 2, .5);
}

.js .tagline { opacity: 0; }
.is-ready .tagline { animation: tracking 1.5s var(--ease-out-expo) 2.15s both; }

@keyframes tracking {
  from { opacity: 0; letter-spacing: 1.2em; padding-left: 1.2em; filter: blur(8px); }
  to   { opacity: 1; letter-spacing: var(--ls); padding-left: var(--ls); filter: blur(0); }
}

.hero__footer {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .62);
}

.hero__credit {
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: none;
  color: rgba(255, 255, 255, .5);
}

.hero__credit a {
  color: rgba(255, 255, 255, .85);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .3);
  transition: color .25s ease, border-color .25s ease;
}

.hero__credit a:hover,
.hero__credit a:focus-visible {
  color: var(--white);
  border-color: var(--white);
}

.js .hero__footer { opacity: 0; }
.is-ready .hero__footer { animation: fade 1.2s ease 2.8s both; }

@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- Pantallas pequeñas ---------- */

@media (max-width: 600px) {
  .hero__content { padding: 72px 16px 96px; }
  .tagline { --ls: .22em; }
  .hero__footer { font-size: .62rem; letter-spacing: .14em; }
  .hero__credit { font-size: .62rem; letter-spacing: .06em; }
}

/* ---------- Movimiento reducido ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0s !important;
  }
  .hero__sheen { display: none; }
}
