/* Común a los dos modos: sistema visual (colores, letra, retícula de 8 px), apertura, cabecera,
   capas, avisos y foco. Colores y letra del manual de marca de Anamórfico. */
:root {
  --tinta: #0E0D0F;
  --crema: #F4F1EA;
  --laton: #C9A46A;
  --rec: #F01A1A;
  --tenue: rgba(244, 241, 234, 0.66);      /* texto secundario: 7:1 sobre tinta */
  --linea: rgba(244, 241, 234, 0.14);      /* línea fina de 1 px */
  --linea-2: rgba(244, 241, 234, 0.32);
  --calido: linear-gradient(90deg, #7A0E12, #F01A1A 28%, #FF6A1F 54%, #FFB000 78%, #FFE23A);
  --grot: "Neue Haas Grotesk Display Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --curva: cubic-bezier(0.2, 0.7, 0.1, 1);
  --curva-io: cubic-bezier(0.65, 0, 0.35, 1);
  --margen: 32px;
  color-scheme: dark;
}
@media (max-width: 720px) { :root { --margen: 16px; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--tinta);
  color: var(--crema);
  font: 400 16px/1.5 var(--grot);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
.sin-js { padding: 96px var(--margen) 32px; line-height: 2; list-style: none; margin: 0; }
.sin-js a { color: var(--crema); }

/* Foco de teclado: siempre visible, mismo trazo en todo el sitio. */
:focus-visible { outline: 2px solid var(--laton); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }

/* Rótulo pequeño: mono, mayúsculas, espaciado ancho. */
.et, .cab-contacto, .ctl {
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Control único del sitio (Contacto, Volver): rectángulo de línea fina. */
.cab-contacto, .ctl {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 20px 0 22px; /* el espaciado de letra deja aire a la derecha */
  border: 1px solid var(--linea-2);
  border-radius: 2px;
  background: transparent;
  color: var(--crema);
  cursor: pointer;
  transition: border-color 0.3s var(--curva), background-color 0.3s var(--curva), color 0.3s var(--curva);
}
.cab-contacto:hover, .ctl:hover { border-color: var(--crema); background-color: rgba(244, 241, 234, 0.06); }
.cab-contacto:active, .ctl:active { background-color: rgba(244, 241, 234, 0.12); }

/* ---------- cabecera ---------- */
.cab {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(24px + env(safe-area-inset-top)) calc(var(--margen) + env(safe-area-inset-right)) 24px calc(var(--margen) + env(safe-area-inset-left));
  pointer-events: none;
}
.cab > * { pointer-events: auto; }
/* Marca: "anamórfico" en minúsculas, negrita, espaciado cerrado. Sin sombras ni giros. */
.marca {
  display: flex; align-items: baseline; gap: 12px;
  margin: 0;
  font: 700 15px/1.3 var(--grot);
  letter-spacing: -0.04em;
  font-variant-ligatures: none;
  white-space: nowrap;
  color: var(--crema);
  pointer-events: none; user-select: none; -webkit-user-select: none;
}
.marca .af { font-size: 24px; line-height: 1; }
.marca-sep { align-self: center; width: 1px; height: 16px; background: var(--linea-2); }
/* En teléfono, al pasar la foto la cabecera necesita fondo: vidrio contenido y una línea. */
.cab::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgba(14, 13, 15, 0.82);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--linea);
  opacity: 0; transition: opacity 0.4s var(--curva);
  pointer-events: none;
}
.cab.solida::before { opacity: 1; }
@media (max-width: 720px) {
  .cab { padding-top: calc(12px + env(safe-area-inset-top)); padding-bottom: 12px; }
  .marca .af { font-size: 22px; }
  .marca .nombre { font-size: 14px; }
}

/* ---------- apertura ---------- */
/* Pantalla tinta en dos mitades (arriba y abajo). Al terminar la carga se abren como un formato
   scope 2,39:1 y siguen hasta el cuadro completo; la marca viaja a la cabecera. */
.intro {
  position: fixed; inset: 0; z-index: 90;
  overflow: hidden;
  color: var(--crema);
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
html.sin-intro .intro { display: none; }
html.con-intro, html.con-intro body { overflow: hidden; }
.intro-barra {
  position: absolute; left: 0; right: 0; height: calc(50% + 1px);
  background: var(--tinta);
  will-change: transform;
}
.intro-arriba { top: 0; transform-origin: 50% 0; }
.intro-abajo { bottom: 0; transform-origin: 50% 100%; }
/* Grano de película fijo (un solo mosaico SVG, sin animación). */
.intro-grano, .capa::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.intro-centro { position: absolute; inset: 0; display: grid; place-items: center; }
.intro-bloque { position: relative; }
/* La marca es una fila: a + [namórfico ] + (f + [ilms]). Al empezar solo se ven "a" y "f", juntas y
   comprimidas a la mitad (lente anamórfica 2x). Al abrirse, la f corre a la derecha y va destapando las
   letras, que no se mueven: cada tramo es una ventana que se desliza sobre su texto fijo. Todo son
   transformaciones (sin recalcular la página en cada cuadro). --w1 y --w2 los mide el script de index.html. */
.intro-marca {
  --w1: 4.72em; --w2: 1.85em;
  --im-t: 0.9s var(--curva-io) 0.45s forwards;
  font: 700 clamp(30px, 9vw, 96px)/1.3 var(--grot);
  letter-spacing: -0.04em;
  font-variant-ligatures: none;
  white-space: nowrap;
  scale: 0.5 1;
  opacity: 0;
  animation: im-aparece 0.4s var(--curva) 0.1s forwards, im-abre var(--im-t);
  will-change: transform, scale, opacity;
}
.im-fila { display: flex; translate: calc((var(--w1) + var(--w2)) / 2) 0; animation: im-centra var(--im-t); will-change: translate; }
.im-fila span { display: block; flex: none; }
.im-g { display: flex !important; translate: calc(-1 * var(--w1)) 0; animation: im-centra var(--im-t); will-change: translate; }
.im-seg { overflow: hidden; translate: -100% 0; animation: im-centra var(--im-t); will-change: translate; }
.im-seg > span { translate: 100% 0; animation: im-centra var(--im-t); will-change: translate; }
.im-s2 { padding-right: 0.08em; margin-right: -0.08em; } /* la s final no se recorta */
@keyframes im-aparece { to { opacity: 1; } }
@keyframes im-abre { to { scale: 1 1; } }
@keyframes im-centra { to { translate: 0 0; } }
.intro-lema {
  position: absolute; left: 50%; top: 100%;
  margin: 8px 0 0;
  font: 400 clamp(13px, 1.3vw, 17px)/1.4 var(--grot);
  white-space: nowrap;
  color: var(--tenue);
  opacity: 0; translate: -50% 6px;
  animation: im-lema 0.6s var(--curva) 1.15s forwards;
}
@keyframes im-lema { to { opacity: 1; translate: -50% 0; } }
/* Destello anamórfico: una línea azul fina que cruza la pantalla a la altura de la marca. */
.intro-destello {
  position: absolute; left: -10%; right: -10%; top: 50%; height: 1px;
  pointer-events: none;
  opacity: 0;
  animation: im-destello 1.2s cubic-bezier(0.45, 0, 0.2, 1) 0.3s forwards;
  will-change: transform, opacity;
}
.intro-destello::before, .intro-destello::after {
  content: ""; position: absolute; left: 0; right: 0;
  background: linear-gradient(90deg, rgba(30, 80, 255, 0) 6%, #1E50FF 32%, #1FD0FF 46%, #EAF8FF 50%, #1FD0FF 54%, #1E50FF 68%, rgba(30, 80, 255, 0) 94%);
}
.intro-destello::before { top: 0; height: 1px; }
.intro-destello::after { top: -6px; height: 13px; filter: blur(6px); opacity: 0.7; }
@keyframes im-destello {
  0% { opacity: 0; transform: translateX(-56%) scaleX(0.22); }
  28% { opacity: 1; }
  50% { opacity: 1; transform: translateX(0) scaleX(1); }
  76% { opacity: 0.85; }
  100% { opacity: 0; transform: translateX(56%) scaleX(0.22); }
}
/* Carga real: línea fina y lectura en MB. */
.intro-carga {
  position: absolute;
  left: calc(var(--margen) + env(safe-area-inset-left)); right: calc(var(--margen) + env(safe-area-inset-right));
  bottom: calc(var(--margen) + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  font: 500 10px/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--tenue);
  opacity: 0;
  animation: im-aparece 0.5s var(--curva) 0.25s forwards;
}
.ic-barra { position: relative; height: 1px; background: var(--linea); }
.ic-barra i { position: absolute; inset: 0; background: var(--calido); clip-path: inset(0 100% 0 0); transition: clip-path 0.3s linear; }
.ic-dato { min-width: 14ch; text-align: right; font-variant-numeric: tabular-nums; color: var(--crema); }
/* Seguro: si el JavaScript no llega a arrancar, la apertura se retira sola. */
html:not(.intro-js) .intro { animation: im-seguro 0.01s linear 12s forwards; }
@keyframes im-seguro { to { visibility: hidden; } }

/* Con la apertura delante la cabecera espera; la marca grande aterriza sobre ella. */
html.con-intro .cab { visibility: hidden; }
html.intro-sale .cab { visibility: visible; }
html.intro-sale .cab .nombre { opacity: 0; }
html.intro-sale .cab .af, html.intro-sale .marca-sep, html.intro-sale .cab-contacto {
  opacity: 0; animation: im-aparece 0.6s var(--curva) 0.5s forwards;
}

/* ---------- capa (diálogo a pantalla completa) ---------- */
.capa {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 96px var(--margen) 48px;
  overflow: auto;
  background: rgba(14, 13, 15, 0.74);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  opacity: 0;
  transition: opacity 0.32s var(--curva);
}
.capa.abierta { opacity: 1; }
.capa::before { position: fixed; }
.capa-panel {
  position: relative;
  width: min(560px, 100%);
  transform: translateY(16px);
  transition: transform 0.56s var(--curva);
}
.capa.abierta .capa-panel { transform: none; }
.capa-panel:focus, .capa-panel:focus-visible { outline: none; }
.capa-ante {
  margin: 0 0 24px;
  font: 500 10px/1.4 var(--mono); letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--laton);
}
.capa-titulo {
  margin: 0 0 16px;
  font: 700 clamp(40px, 7vw, 72px)/1 var(--grot);
  letter-spacing: -0.04em;
  word-spacing: 0.08em;
}
.capa-texto { margin: 0 0 40px; max-width: 30em; font-size: 17px; line-height: 1.5; color: rgba(244, 241, 234, 0.8); }
.capa-texto:empty { display: none; }
.capa-acciones { display: grid; border-top: 1px solid var(--linea); }
/* Cada acción es una fila entre líneas finas; al pasar por encima se dibuja el espectro cálido de la marca. */
.boton {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
  min-height: 72px; padding: 16px 0;
  border-bottom: 1px solid var(--linea);
  color: var(--crema);
  text-decoration: none;
}
.boton::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: var(--calido);
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform 0.56s var(--curva);
}
.boton:hover::after, .boton:focus-visible::after { transform: none; }
.b-et { font: 700 22px/1.2 var(--grot); letter-spacing: -0.03em; word-spacing: 0.06em; }
.b-dato {
  display: inline-flex; align-items: center; gap: 12px;
  font: 500 12px/1.4 var(--mono); letter-spacing: 0.06em;
  color: var(--tenue);
  overflow-wrap: anywhere;
  transition: color 0.3s var(--curva);
}
.b-dato::after { content: "→"; font-size: 14px; color: var(--crema); transition: transform 0.4s var(--curva); }
.boton:hover .b-dato, .boton:focus-visible .b-dato { color: var(--crema); }
.boton:hover .b-dato::after, .boton:focus-visible .b-dato::after { transform: translateX(4px); }
.ctl.volver { justify-self: start; margin-top: 32px; }

/* ---------- aviso ---------- */
.aviso {
  position: fixed; left: 50%; bottom: calc(var(--margen) + env(safe-area-inset-bottom)); z-index: 70;
  transform: translate(-50%, 8px);
  padding: 14px 16px;
  border: 1px solid var(--linea-2);
  border-radius: 2px;
  background: rgba(14, 13, 15, 0.9);
  color: var(--crema);
  font: 500 11px/1 var(--mono); letter-spacing: 0.1em;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--curva), transform 0.4s var(--curva);
}
.aviso.visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .capa, .capa-panel, .aviso, .boton::after, .b-dato::after, .cab-contacto, .ctl { transition: none; }
  .capa-panel { transform: none; }
}
.capa:not(.abierta) { pointer-events: none; }
