/* ============================================================
   ATLAS · capa de inmersión
   Transición entre folios, revelado tipográfico, atmósfera,
   parálaje y raíl de capítulos.
   Sólo transform/opacity: nada aquí toca layout ni pinta canvas.
   ============================================================ */

/* ── 1. Telón entre folios ─────────────────────────────────── */
.atx-veil {
  position: fixed;
  z-index: 400;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  pointer-events: none;
}
.atx-veil__panel {
  position: relative;
  background: var(--void);
  transform-origin: top;
  transform: scaleY(1);
  animation: atx-veil-out 1.05s cubic-bezier(0.76, 0, 0.24, 1) forwards;
}
.atx-veil__panel:nth-child(1) { animation-delay: 0.05s; }
.atx-veil__panel:nth-child(2) { animation-delay: 0.11s; }
.atx-veil__panel:nth-child(3) { animation-delay: 0.17s; }
.atx-veil__panel:nth-child(4) { animation-delay: 0.23s; }
.atx-veil__panel:nth-child(5) { animation-delay: 0.29s; }
.atx-veil__panel:nth-child(6) { animation-delay: 0.35s; }
@keyframes atx-veil-out { from { transform: scaleY(1); } to { transform: scaleY(0); } }

.atx-veil__mark {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}
.atx-veil__mark b {
  font: 400 clamp(30px, 7vw, 68px)/1 "Cormorant Garamond", Georgia, serif;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  color: var(--ink);
}
.atx-veil__mark i {
  font: 400 8px/1 "JetBrains Mono", monospace;
  font-style: normal;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: var(--bronze-light);
}
.atx-veil__rule {
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--bronze), transparent);
}

/* salida: los paneles suben desde abajo y el rótulo del destino entra */
.atx-veil.is-leaving { pointer-events: all; }
.atx-veil.is-leaving .atx-veil__panel {
  transform-origin: bottom;
  animation: atx-veil-in 0.62s cubic-bezier(0.76, 0, 0.24, 1) forwards;
}
.atx-veil.is-leaving .atx-veil__panel:nth-child(1) { animation-delay: 0.18s; }
.atx-veil.is-leaving .atx-veil__panel:nth-child(2) { animation-delay: 0.14s; }
.atx-veil.is-leaving .atx-veil__panel:nth-child(3) { animation-delay: 0.1s; }
.atx-veil.is-leaving .atx-veil__panel:nth-child(4) { animation-delay: 0.06s; }
.atx-veil.is-leaving .atx-veil__panel:nth-child(5) { animation-delay: 0.03s; }
.atx-veil.is-leaving .atx-veil__panel:nth-child(6) { animation-delay: 0s; }
@keyframes atx-veil-in { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.atx-veil.is-leaving .atx-veil__mark { animation: atx-mark 0.66s 0.3s ease forwards; }
.atx-veil.is-leaving .atx-veil__rule { animation: atx-rule 0.7s 0.34s cubic-bezier(0.16, 0.7, 0.2, 1) forwards; }
@keyframes atx-mark { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes atx-rule { from { width: 0; } to { width: min(300px, 46vw); } }

/* ── 2. Atmósfera: aurora de bronce + grano de película ────── */
.atx-air {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  contain: strict;
}
.atx-air__glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 118vmax;
  height: 118vmax;
  margin: -59vmax 0 0 -59vmax;
  background:
    radial-gradient(closest-side, rgba(173, 130, 72, 0.16), transparent 68%),
    conic-gradient(from 0deg, transparent 0deg, rgba(173, 130, 72, 0.09) 60deg, transparent 150deg, rgba(120, 150, 180, 0.06) 250deg, transparent 340deg);
  opacity: 0.55;
  will-change: transform;
  animation: atx-drift 96s linear infinite;
}
@keyframes atx-drift {
  from { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.12); }
  to   { transform: rotate(360deg) scale(1); }
}
.atx-air__grain {
  position: absolute;
  inset: -160px;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: atx-grain 900ms steps(6) infinite;
}
@keyframes atx-grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-42px, 26px); }
  40%  { transform: translate(30px, -38px); }
  60%  { transform: translate(-24px, -22px); }
  80%  { transform: translate(38px, 30px); }
  100% { transform: translate(0, 0); }
}
/* todo el contenido real por encima de la atmósfera.
   La cabecera y el logotipo ya son fixed: sólo se les toca el apilado. */
main, .footer { position: relative; z-index: 1; }

/* ── 3. Revelado tipográfico por palabra ───────────────────── */
.atx-w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.atx-w > span {
  display: inline-block;
  transform: translateY(112%) rotate(2.4deg);
  opacity: 0;
  transition: transform 1.05s cubic-bezier(0.16, 0.78, 0.16, 1), opacity 0.75s ease;
  transition-delay: var(--d, 0ms);
}
.atx-split.is-lit .atx-w > span { transform: none; opacity: 1; }

/* filete que se dibuja bajo cada encabezado de folio */
.page-head .display::after,
.hero-inner h1::after {
  content: "";
  display: block;
  width: 0;
  height: 1px;
  margin-top: 0.42em;
  background: linear-gradient(90deg, var(--bronze), transparent);
  transition: width 1.4s 0.5s cubic-bezier(0.16, 0.7, 0.2, 1);
}
.page-head .display.is-lit::after,
.hero-inner h1.is-lit::after { width: min(420px, 62%); }

/* ── 4. Cifras ─────────────────────────────────────────────── */
.figure strong { display: block; font-variant-numeric: tabular-nums; }

/* ── 5. Raíl de capítulos (escritorio) ─────────────────────── */
.atx-rail {
  position: fixed;
  z-index: 55;
  top: 50%;
  right: 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: translateY(-50%);
}
.atx-rail a {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  font: 400 8px/1 "JetBrains Mono", monospace;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--faint);
  transition: color 0.5s var(--ease);
}
.atx-rail a span {
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}
.atx-rail a i {
  display: block;
  width: 26px;
  height: 1px;
  background: currentColor;
  transform-origin: right;
  transform: scaleX(0.46);
  transition: transform 0.5s var(--ease);
}
.atx-rail a:hover, .atx-rail a[aria-current] { color: var(--bronze-light); }
.atx-rail a:hover span, .atx-rail a[aria-current] span { opacity: 1; transform: none; }
.atx-rail a:hover i, .atx-rail a[aria-current] i { transform: scaleX(1); }

/* ── 6. Cursor de precisión (sólo puntero fino) ────────────── */
.atx-dot, .atx-ring {
  position: fixed;
  z-index: 380;
  top: 0;
  left: 0;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.atx-dot { width: 4px; height: 4px; margin: -2px 0 0 -2px; background: var(--bronze-light); }
.atx-ring {
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 1px solid rgba(210, 177, 118, 0.5);
  transition: opacity 0.4s ease, width 0.4s var(--ease), height 0.4s var(--ease), margin 0.4s var(--ease), border-color 0.4s ease;
}
.atx-on .atx-dot, .atx-on .atx-ring { opacity: 1; }
.atx-hot .atx-ring { width: 62px; height: 62px; margin: -31px 0 0 -31px; border-color: var(--bronze-light); }
.atx-hot .atx-dot { opacity: 0; }

/* ── 7. Puertas de continuación ────────────────────────────── */
.atlas-next__card { position: relative; overflow: hidden; isolation: isolate; }
/* El romano de estas puertas duplicaba lenguaje: en la misma página
   ya viven los sectores 01-04. Son navegación, no una lista numerada. */
.atlas-next__card::after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--bronze);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.85s cubic-bezier(0.16, 0.7, 0.2, 1);
}
.atlas-next__card:hover::after, .atlas-next__card:focus-visible::after { transform: scaleX(1); }
.atlas-next__card i { transition: transform 0.26s var(--ease), color 0.24s ease; }
.atlas-next__card:hover i { transform: translateX(9px); }

/* ── 8. Móvil y accesibilidad ──────────────────────────────── */
@media (max-width: 1180px) { .atx-rail { display: none; } }
@media (hover: none), (pointer: coarse) { .atx-dot, .atx-ring { display: none; } }
@media (max-width: 820px) {
  .atx-veil { grid-template-columns: repeat(3, 1fr); }
  .atx-air__glow { opacity: 0.4; animation-duration: 140s; }
  .atx-air__grain { opacity: 0.035; }
}

/* Área táctil: los enlaces del pie medían 334x27. Mínimo 44 de alto. */
.footer-columns a,.footer-bar a{ min-height:44px;display:inline-flex;align-items:center; }
.site-nav .nav-link{ min-height:44px;display:inline-flex;align-items:center; }
.nav-toggle{ min-width:44px;min-height:44px; }

/* ── 9. Magnetismo y masa ──────────────────────────────────── */
.button, .atlas-next__card i, .hero-scroll {
  will-change: transform;
  transform: translate3d(var(--mx, 0px), var(--my, 0px), 0);
  transition: transform 0.5s cubic-bezier(0.16, 0.7, 0.2, 1), background 0.45s ease, color 0.45s ease, border-color 0.45s ease;
}
.atx-magnet-live { transition: transform 0.08s linear, background 0.45s ease, color 0.45s ease, border-color 0.45s ease; }

/* inercia: el scroll rápido estira ligeramente las imágenes */
.sector-media img, .contact-media img, .hero-media img { transform-origin: center; }
.sector-media, .contact-media { transform: skewY(var(--atx-skew, 0deg)); transition: transform 0.5s cubic-bezier(0.16, 0.7, 0.2, 1); }

/* ── 10. Entradas escalonadas ──────────────────────────────── */
.sector-inner > *, .presence-route .office, .footer-columns > div, .fig-grid .figure {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.85s ease var(--sd, 0ms), transform 0.95s cubic-bezier(0.16, 0.78, 0.16, 1) var(--sd, 0ms);
}
.atx-stagger.is-lit > *,
.presence-route.is-lit .office,
.footer-columns.is-lit > div,
.fig-grid.is-lit .figure { opacity: 1; transform: none; }

/* menú móvil: los folios entran uno tras otro */
.site-nav.is-open .nav-link, .site-nav.is-open .button {
  animation: atx-menu 0.66s cubic-bezier(0.16, 0.78, 0.16, 1) both;
}
.site-nav.is-open .nav-link:nth-child(1) { animation-delay: 0.06s; }
.site-nav.is-open .nav-link:nth-child(2) { animation-delay: 0.12s; }
.site-nav.is-open .nav-link:nth-child(3) { animation-delay: 0.18s; }
.site-nav.is-open .nav-link:nth-child(4) { animation-delay: 0.24s; }
.site-nav.is-open .nav-link:nth-child(5) { animation-delay: 0.3s; }
.site-nav.is-open .nav-link:nth-child(6) { animation-delay: 0.36s; }
.site-nav.is-open .button { animation-delay: 0.44s; }
@keyframes atx-menu { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .sector-inner > *, .presence-route .office, .footer-columns > div, .fig-grid .figure { opacity: 1 !important; transform: none !important; }
  .sector-media, .contact-media { transform: none !important; }
  .site-nav.is-open .nav-link, .site-nav.is-open .button { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  .atx-veil, .atx-air, .atx-dot, .atx-ring { display: none !important; }
  .atx-w > span { transform: none !important; opacity: 1 !important; }
  .page-head .display::after, .hero-inner h1::after { width: min(420px, 62%); transition: none; }
}

/* el salto al contenido también es un control: 44 px de alto */
.skip-link:focus,.skip-link:focus-visible{ min-height:44px;display:inline-flex;align-items:center; }
