/* ══════════════════════════════════════════════════════════════
   Shell común — rediseño 2026
   Fuente de verdad: rediseño-2026/PRD-rediseno-web-2026.md §7–§8.
   Lo cargan la home (amf-main-site) y Atlas (otro proyecto Pages, vía
   router): por eso todas las rutas son absolutas (/assets/…).
   ══════════════════════════════════════════════════════════════ */

/* ── Fuentes autoalojadas (OFL; licencias en /assets/fonts/OFL-*.txt) ── */
/* Geist — latin-ext */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url(/assets/fonts/geist-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Geist — latin */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url(/assets/fonts/geist-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Newsreader — latin-ext */
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 300 500;
  font-display: swap;
  src: url(/assets/fonts/newsreader-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Newsreader — latin */
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 300 500;
  font-display: swap;
  src: url(/assets/fonts/newsreader-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Reservas ajustadas en métrica (PRD §7, producción): mientras llega la fuente web, Arial y
   Georgia ocupan casi lo mismo y el texto no salta al cambiar. Medidas en Chrome con
   measureText sobre una frase de la home (rediseño-2026/plan-f4-qa.md, tarea 2). */
@font-face {
  font-family: 'Geist Fallback';
  src: local('Arial');
  size-adjust: 101.62%; ascent-override: 98.9%; descent-override: 29.03%; line-gap-override: 0%;
}
@font-face {
  font-family: 'Newsreader Fallback';
  src: local('Georgia');
  size-adjust: 100.65%; ascent-override: 73.02%; descent-override: 26.33%; line-gap-override: 0%;
}

/* ── Tokens ── */
:root {
  --matiz: 1;                         /* multiplicador del croma de los fondos */

  --ink:   #1A1A1A;
  --ink-2: #4A4945;
  --ink-3: #6B6A65;
  --rule:  #E9E8E3;

  --serif: 'Newsreader', 'Newsreader Fallback', Georgia, 'Times New Roman', serif;
  --sans:  'Geist', 'Geist Fallback', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --dur-fast: 140ms;
  --dur-focus: 260ms;
  --dur-bg: 320ms;
  --retardo-titular: 40ms;
  --retardo-contenido: 120ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --blur-focus: 8px;

  --carril: 184px;
  --barra: 56px;

  /* Corte (lo leen también artefactos.js y atlas.js: el JS no repite las consultas) */
  --contenido-movil: 0;   /* 1 en móvil y en el corte Duo: el contenido usa la composición de móvil */
  --corte-duo: 0;         /* 1 con el iPhone Duo abierto como un libro (PRD v8 §7.1) */
  --pliegue: 50vw;        /* fin de la pantalla izquierda */
  --derecha: 50vw;        /* inicio de la pantalla derecha */
}
/* Donde el navegador ve la bisagra (plegables en Chrome; Safari tras una opción
   experimental), su posición real. Sin segmentos, la mitad de la pantalla. */
@media (horizontal-viewport-segments: 2) {
  :root {
    --pliegue: env(viewport-segment-right 0 0, 50vw);
    --derecha: env(viewport-segment-left 1 0, 50vw);
  }
}

/* Un matiz de blanco y un acento por sección. Valores en OKLCH (PRD §8.2). */
:root[data-seccion="home"],
:root[data-seccion="servicios"] {
  --fondo: oklch(0.995 calc(0.0015 * var(--matiz)) 95);
  --acento: oklch(0.665 0.10 45);
}
:root[data-seccion="atlas"] {
  --fondo: oklch(0.994 calc(0.003 * var(--matiz)) 75);
  --acento: oklch(0.67 0.105 52);
}
:root[data-seccion="artefactos"] {
  --fondo: oklch(0.993 calc(0.0025 * var(--matiz)) 235);
  --acento: oklch(0.655 0.095 32);
}
:root[data-seccion="blog"] {
  --fondo: oklch(0.995 calc(0.001 * var(--matiz)) 100);
  --acento: oklch(0.665 0.10 45);
}
:root[data-seccion="publicaciones"] {
  --fondo: oklch(0.991 calc(0.003 * var(--matiz)) 85);
  --acento: oklch(0.65 0.09 40);
}
:root[data-seccion="sistemas"] {
  --fondo: oklch(0.994 calc(0.0022 * var(--matiz)) 210);
  --acento: oklch(0.64 0.10 42);
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--fondo);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; color: inherit; }   /* los controles no heredan la fuente */
em, i, cite { font-style: normal; }   /* sin cursivas: el énfasis va en peso */
em { font-weight: 500; color: var(--ink); }
img, svg, video { max-width: 100%; }
h1, h2, h3, p { margin: 0; }

a:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

/* ── Contenido y tipografía de página (PRD §8.1, §8.3) ── */
.contenido {
  max-width: 1424px;                       /* 1200 px de texto + márgenes */
  padding: 56px clamp(24px, 6vw, 112px) 48px;
}
.linea-superior {
  display: flex; justify-content: space-between; gap: 24px;
  font-size: 11px; line-height: 1.3; letter-spacing: 0.16em;
  text-transform: uppercase; font-weight: 450; color: var(--ink-2);
}
.titular {
  font-family: var(--serif); font-optical-sizing: auto;
  font-size: clamp(48px, 6vw, 96px); line-height: 1.0;
  letter-spacing: -0.02em; font-weight: 360;
}
.titular--display {
  font-size: clamp(56px, 8.5vw, 132px); line-height: 0.98;
  letter-spacing: -0.025em; font-weight: 340;
}
.entradilla {
  max-width: 34ch; margin-top: 28px;
  font-size: 20px; line-height: 1.45; font-weight: 350; color: var(--ink-2);
}

.linea-superior + .titular { margin-top: 120px; }   /* misma altura en todas las secciones */

/* Etiqueta: versalitas pequeñas del sistema (token label) */
.etiqueta {
  font: 450 11px/1.3 var(--sans); letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-2);
}

/* ── Botón en cápsula de cristal: el lenguaje de la barra móvil ──
   Todos los enlaces de acción de la web van así, sin flecha (17/11). Las flechas
   solo quedan en los enlaces de «Dónde encontrarme», en la ficha técnica. */
.boton-capsula {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 24px; border-radius: 999px;
  font-size: 15px; line-height: 1.2; font-weight: 500; color: var(--ink);
  background: rgb(255 255 255 / 0.62);
  -webkit-backdrop-filter: blur(12px) saturate(170%);
  backdrop-filter: blur(12px) saturate(170%);
  border: 1px solid rgb(26 26 26 / 0.12);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.95), 0 1px 3px rgb(26 26 26 / 0.10);
  transition: background-color 200ms var(--ease), box-shadow 200ms var(--ease);
}
.boton-capsula:hover {
  background: rgb(255 255 255 / 0.9);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 1), 0 4px 14px rgb(26 26 26 / 0.12);
}

/* ── Cápsula segmentada: elegir una opción entre varias (vista de Artefactos,
   filtros de Atlas). Mismo lenguaje que la barra móvil: la opción activa es
   una cápsula interior de cristal claro. ── */
.segmentado {
  display: inline-flex; gap: 2px; padding: 4px; max-width: 100%;
  border-radius: 999px; background: rgb(26 26 26 / 0.045); border: 1px solid rgb(26 26 26 / 0.06);
  overflow-x: auto; scrollbar-width: none;
}
.segmentado::-webkit-scrollbar { display: none; }
.segmentado__opcion {
  flex: 0 0 auto; min-height: 36px; padding: 0 16px; margin: 0;
  border: 0; border-radius: 999px; background: none; cursor: pointer;
  font-family: var(--sans); font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none;
  color: var(--ink-3); white-space: nowrap;
  transition: background-color 200ms var(--ease), color 200ms var(--ease), box-shadow 200ms var(--ease);
}
.segmentado__opcion:hover { color: var(--ink); }
.segmentado__opcion[aria-pressed="true"] {
  color: var(--ink); background: rgb(255 255 255 / 0.85);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 1), 0 1px 3px rgb(26 26 26 / 0.10), 0 0 0 0.5px rgb(26 26 26 / 0.08);
}
.segmentado__opcion:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* Variante con icono (16 px, en currentColor): misma píldora, más compacta. */
.segmentado__opcion--icono { display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; }
.segmentado__opcion--icono svg { display: block; width: 16px; height: 16px; }

/* ── Saltar al contenido ── */
.saltar {
  position: fixed; top: -64px; left: 16px; z-index: 100;
  padding: 8px 12px; font-size: 13px;
  background: var(--ink); color: var(--fondo);
}
.saltar:focus { top: 16px; }

/* ── Índice persistente (PRD §7.1) ── */
.indice {
  position: fixed; inset: 0 auto 0 0; z-index: 10;
  width: var(--carril);
  display: flex; flex-direction: column;
  padding: 48px 0 40px 34px;
  border-right: 1px solid var(--rule);
  font-size: 13px; line-height: 1.3; letter-spacing: 0.01em;
}
.indice__marca {
  position: relative; align-self: flex-start;
  font-weight: 500; color: var(--ink);
}
.indice__item--sobre { align-self: flex-start; margin-top: 12px; }
.indice__lista {
  list-style: none; margin: 56px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 22px;
}
.indice__item {
  position: relative; display: inline-block;
  color: var(--ink-3);
  transition: color 200ms var(--ease);
}
/* Punto de acento: invisible en reposo, aparece en hover y fijo en el activo */
.indice__item::before,
.indice__marca::before {
  content: ""; position: absolute; left: -14px; top: 50%;
  width: 6px; height: 6px; margin-top: -3px; border-radius: 50%;
  background: var(--acento);
  opacity: 0; transition: opacity 200ms var(--ease);
}
.indice--cerca .indice__item,
.indice:focus-within .indice__item { color: var(--ink-2); }
.indice .indice__item:hover { color: var(--ink); }
.indice__item:hover::before { opacity: 1; }
.indice .indice__item[aria-current] { color: var(--ink); font-weight: 500; }
.indice__item[aria-current]::before,
.indice__marca[aria-current]::before { opacity: 1; }
.indice a:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 1px; }
.indice__burbuja { display: none; }   /* solo en la barra móvil */

/* «servicios», separado al fondo del carril por una raya de 90 px */
.indice__item--pie {
  align-self: flex-start;
  margin-top: auto; padding-top: 14px;
  background: linear-gradient(var(--rule), var(--rule)) top left / 90px 1px no-repeat;
}
.indice__item--pie::before { top: calc(50% + 7px); }

/* ── Home: titular + Sobre mí en una sola composición (PRD §7.3, v4) ──
   Izquierda: la foto arriba y la ficha técnica abajo (fijas mientras se lee).
   Derecha: el titular encabeza la columna y debajo baja «Sobre mí». */
html { scroll-behavior: smooth; }
.inicio__cuerpo {
  display: grid; grid-template-columns: 240px minmax(0, 1fr);
  gap: 64px; align-items: start; margin-top: 72px;
  container-type: inline-size;              /* referencia del titular en móvil (columna única) */
}
/* El aire final va dentro de la columna de texto, no en .inicio: así la fila de la rejilla
   llega al final de la página y la ficha técnica no se ve empujada hacia arriba al acabar. */
.inicio__texto { container-type: inline-size; max-width: 860px; padding-bottom: 120px; }
/* Cada frase en una línea: el tamaño sale del ancho de la columna, no de la ventana */
.inicio .titular { font-size: clamp(28px, 10.2cqi, 104px); }
.inicio .entradilla { margin-top: 28px; }

/* Ficha en dos zonas (17/11): arriba la foto; abajo, tras un filete, la ficha técnica
   (Disciplinas y Dónde encontrarme). La columna se fija a 56 px y su alto mínimo la hace
   acabar a 48 px del borde inferior; la ficha técnica se pega ahí (sticky) y no se mueve al
   leer, ni al cargar ni al final. 48 px = el margen inferior de .contenido. */
.ficha {
  position: sticky; top: 56px;
  display: flex; flex-direction: column; gap: 56px;   /* gap: aire mínimo entre foto y ficha técnica */
  min-height: calc(100svh - 104px);
}
/* Foto sin fondo (máscara de Vision): la línea marca el corte a la altura del cinturón */
.ficha__foto { margin: 0; border-bottom: 1px solid var(--ink-3); }
.ficha__foto img { display: block; width: 100%; height: auto; }
.ficha__datos {
  position: sticky; bottom: 48px;
  margin: auto 0 0; padding-top: 16px; border-top: 1px solid var(--rule);
  display: grid; gap: 18px; font-size: 13px; line-height: 1.55; color: var(--ink-2); overflow-wrap: anywhere;
}
/* Zona de la ficha técnica (18/11): ocupa lo que deja la foto (empieza 56 px bajo ella) y la
   lleva al fondo. Un sticky nunca sale de su contenedor: si la pantalla es baja y no cabe pegada
   abajo, se queda a 56 px de la foto y baja con ella, sin pisarla. (Fondo con justify-content y
   no con margin auto: el margen automático contaría como parte de la caja en algunos navegadores.) */
.ficha__tecnica { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: flex-end; }
.ficha__tecnica > .ficha__datos { margin-top: 0; }
.ficha__datos dd { margin: 6px 0 0; }
/* Disciplinas en línea: cada una entera, y el punto pegado a la anterior (espacio duro) */
.ficha__datos dd span { white-space: nowrap; }
.ficha__datos div:first-child dd { text-wrap: balance; }
.ficha__datos a { text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ficha__datos a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--acento); }
/* Ficha común de todas las páginas: solo se ve en el corte Duo (ver «Disposición por ancho») */
.ficha--duo { display: none; }

.sobre { margin-top: 72px; }
.sobre__entradilla {
  max-width: 24em; margin-top: 20px;
  font-family: var(--serif); font-optical-sizing: auto;
  font-size: clamp(24px, 2.4vw, 32px); line-height: 1.3;
  font-weight: 360; letter-spacing: -0.01em; color: var(--ink);
}
.sobre > p:not(.sobre__entradilla) { max-width: 60ch; margin-top: 18px; color: var(--ink-2); }
.sobre__entradilla + p { margin-top: 28px; }
.sobre h3.etiqueta { margin: 56px 0 4px; }
.sobre > .sobre__cta { margin-top: 28px; }
.sobre__enlaces { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }

/* ── Disposición por ancho ── */
@media (min-width: 768px) {
  body { padding-left: var(--carril); }
}
@media (min-width: 768px) and (max-width: 1023px) {
  :root { --carril: 148px; }
  .indice { padding-left: 26px; }
  .inicio__cuerpo { grid-template-columns: 200px minmax(0, 1fr); gap: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media (max-width: 767px) and (prefers-reduced-transparency: reduce) {
  .indice { background: var(--fondo); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (max-width: 767px) {
  body { padding: 0 0 calc(var(--barra) + 24px + env(safe-area-inset-bottom)); }
  /* Barra móvil: cápsula flotante, translúcida y deslizable, con píldoras
     tipo Apple. Caben los siete destinos porque se corre de un extremo a otro. */
  .indice {
    inset: auto 12px calc(12px + env(safe-area-inset-bottom)) 12px;
    width: auto; height: auto;
    flex-direction: row; align-items: center; gap: 2px;
    padding: 5px;
    border: 1px solid rgb(0 0 0 / 0.06); border-radius: 28px;
    background: color-mix(in oklch, var(--fondo) 72%, transparent);
    background-image: linear-gradient(rgb(26 26 26 / 0.045), rgb(26 26 26 / 0.045));
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity; scrollbar-width: none;
    font-size: 13px;
  }
  .indice::-webkit-scrollbar { display: none; }
  .indice__lista { display: contents; }   /* role="list" en el HTML conserva la semántica */
  .indice__marca,
  .indice__item {
    flex: 0 0 auto; align-self: center;
    display: inline-flex; align-items: center;
    min-height: 44px; margin: 0; padding: 0 12px;
    border-radius: 22px; white-space: nowrap;
    scroll-snap-align: center;
    background: none;
    transition: background-color 200ms var(--ease), color 200ms var(--ease);
  }
  .indice__marca::before,
  .indice__item::before { display: none; }       /* la píldora sustituye al punto */
  /* «Alberto Martín» no aparece en móvil: «sobre mí» es la entrada de la home */
  .indice .indice__marca { display: none; }
  .indice a {
    position: relative; z-index: 1;                 /* el texto, por encima de la burbuja */
    -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  }
  .indice .indice__item[aria-current],
  .indice .indice__item--objetivo { background: none; color: var(--ink); }
  .indice .indice__item[aria-current]:not(.indice__item--objetivo) { color: var(--ink-3); }
  .indice .indice__item[aria-current] { font-weight: 400; }   /* sin cambio de peso: nada se mueve al marcar */
  /* Cápsula interior: cristal líquido claro que se desliza entre opciones */
  .indice__burbuja {
    display: block; position: absolute; top: 5px; left: 0;
    width: 0; height: 44px; border-radius: 22px;
    pointer-events: none; z-index: 0;
    background: rgb(255 255 255 / 0.62);
    -webkit-backdrop-filter: blur(6px) saturate(170%);
    backdrop-filter: blur(6px) saturate(170%);
    border: 1px solid rgb(255 255 255 / 0.85);
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.95),
      inset 0 -1px 1px rgb(26 26 26 / 0.05),
      0 1px 3px rgb(26 26 26 / 0.10),
      0 0 0 0.5px rgb(26 26 26 / 0.08);
    transition: transform 280ms var(--ease), width 280ms var(--ease);
    will-change: transform;
  }
  .indice--arrastrando .indice__burbuja {
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.95),
      inset 0 -1px 1px rgb(26 26 26 / 0.05),
      0 6px 16px rgb(26 26 26 / 0.14),
      0 0 0 0.5px rgb(26 26 26 / 0.10);
  }
}

/* Contenido con la composición de móvil: en el teléfono y en la pantalla
   derecha del corte Duo. (La consulta Duo se repite idéntica en cada CSS de
   página: no hay @custom-media; la prueba duo-consulta-unica lo vigila.) */
@media (max-width: 767px), (horizontal-viewport-segments: 2), (min-width: 880px) and (max-width: 1000px) and (min-height: 520px) and (max-height: 720px) and (pointer: coarse) {
  :root { --contenido-movil: 1; }
  .inicio { padding-bottom: 72px; }
  .inicio__cuerpo { grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 48px; }
  .inicio .ficha, .inicio .ficha__tecnica, .inicio__texto { display: contents; }   /* sus hijos se ordenan en la rejilla */
  .inicio .titular { order: 1; }
  .inicio .entradilla { order: 2; }
  .inicio .ficha__foto { order: 3; width: 160px; margin-top: 48px; }
  .sobre { order: 4; margin-top: 48px; }
  .inicio .ficha__datos { order: 5; margin-top: 56px; }
  .ficha__datos { position: static; }                     /* sin columna: cierra la página y se desplaza con ella */
  .linea-superior { flex-direction: column; gap: 6px; }
  .linea-superior + .titular { margin-top: 64px; }
}

/* ── Corte iPhone Duo abierto como un libro (PRD v8 §7.1) ──
   Izquierda, fijos: el carril y la ficha. Derecha: el contenido.
   Se detecta por la forma (Safari no ve el pliegue con el teléfono plano) o
   por los segmentos, donde existen. Cerrado o girado, el Duo usa el móvil. */
@media (horizontal-viewport-segments: 2), (min-width: 880px) and (max-width: 1000px) and (min-height: 520px) and (max-height: 720px) and (pointer: coarse) {
  :root { --corte-duo: 1; --carril: 168px; }
  body { padding-left: var(--derecha); }
  .indice { padding: 40px 0 32px 28px; }
  .ficha--duo {
    display: flex; min-height: 0; gap: 32px;             /* foto arriba; ficha técnica al fondo de la pantalla */
    position: fixed; top: 0; bottom: 0; z-index: 9;
    left: var(--carril); width: calc(var(--pliegue) - var(--carril));
    padding: 40px 24px 32px;                              /* 24 px hasta el pliegue */
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  }
  .ficha--duo::-webkit-scrollbar { display: none; }
  .ficha--duo .ficha__foto { width: 144px; }
  .ficha--duo .ficha__datos { margin-top: auto; padding-top: 14px; gap: 14px; font-size: 12.5px; line-height: 1.45; }
  .ficha--duo .ficha__datos dd { margin-top: 6px; }
  .contenido .ficha { display: none; }                   /* home y Servicios: su ficha pasa a la izquierda */
  .contenido { padding: 40px 24px 48px; }                /* 24 px desde el pliegue y hasta el borde */
}

/* ══════════════════════════════════════════════════════════════
   Transición entre secciones (PRD §7.2)
   Fondo: fundido de la raíz. Índice: no se mueve. Contenido saliente: se
   apaga en --dur-fast. Contenido entrante: «vivo», entra con sus propias
   animaciones de carga, que son también la degradación sin View Transitions.
   ══════════════════════════════════════════════════════════════ */
@view-transition { navigation: auto; }

.indice      { view-transition-name: indice; }
.contenido   { view-transition-name: contenido; }
.ficha--duo  { view-transition-name: ficha; }    /* corte Duo: la ficha, como el índice, no se mueve */

::view-transition-group(root) {
  animation-duration: var(--dur-bg);
  animation-timing-function: var(--ease);
}
::view-transition-group(indice),
::view-transition-group(ficha),
::view-transition-group(contenido) { animation: none; }
::view-transition-old(indice),
::view-transition-new(indice),
::view-transition-old(ficha),
::view-transition-new(ficha) { animation-duration: 200ms; }
::view-transition-old(contenido),
::view-transition-new(contenido) { mix-blend-mode: normal; }
::view-transition-old(contenido) { animation: salir var(--dur-fast) var(--ease) both; }
::view-transition-new(contenido) { animation: none; }

/* Entrada: el titular «enfoca»; el resto aparece sin desplazarse */
.titular {
  animation: enfoque var(--dur-focus) var(--ease) var(--retardo-titular) both;
}
/* R1: bloques de primer nivel sin titular. R2: hijos (sin titular) de cualquier
   antepasado del titular, a cualquier profundidad. Son disjuntos: nada se anima dos veces. */
.contenido > :not(.titular):not(:has(.titular)),
.contenido :has(.titular) > :not(.titular):not(:has(.titular)) {
  animation: aparecer calc(var(--dur-bg) - var(--retardo-contenido)) var(--ease) var(--retardo-contenido) both;
}

@keyframes enfoque {
  from { filter: blur(var(--blur-focus)); opacity: 0; }
  to   { filter: blur(0); opacity: 1; }
}
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes salir    { from { opacity: 1; } to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .titular,
  .contenido > :not(.titular):not(:has(.titular)),
  .contenido :has(.titular) > :not(.titular):not(:has(.titular)) {
    animation: aparecer 120ms linear both;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation-duration: 120ms !important; }
}

