/* Ávidas Aves V2 — #/foto/:id = Dirección E (Archivo editorial) + D.1
   (Contemplación).
   Puerto fiel del laboratorio aprobado:
   · E  → public/laboratorio-foto/archivo.css  (papel marfil, retículas
          asimétricas por ratio, metadatos, mosaico de afines)
   · D.1 → public/laboratorio-foto/observatorio.css (capa .obs-layer)
   Adaptaciones de producción (docs/v2-handoff.md §23):
   · el chrome fijo del sitio necesita aire: el padding superior de la
     página suma var(--header-h);
   · la ruta se pone en papel (html.route-foto) para que la cabecera
     fija no quede en blanco sobre negro;
   · se omiten las reglas ::view-transition-old/new(root) del
     laboratorio (afectarían a todas las rutas de V2); obs-shot y
     obs-paper se conservan;
   · chip de moderación en variante papel. */

/* =================== 1. Ruta en papel =================== */
html.route-foto {
  /* Oscuro: al pasarse de scroll por abajo se ve el pie, no papel. El papel lo pinta la propia publicación (.ar). */
  background: var(--bg);
  color-scheme: light;
}

/* Mismo patrón que el resto de V2: velo → sólido, con paradas equivalentes
   para que el fondo se interpole en lugar de saltar. El cero alfa va teñido
   (nunca `transparent`) para que no aparezca ningún halo gris. */
html.route-foto:not(.photo-room) .site-header {
  background-color: transparent;
  background-image: linear-gradient(to bottom, rgba(245, 241, 232, 0.96), rgba(245, 241, 232, 0.72) 70%, rgba(245, 241, 232, 0));
}

html.route-foto:not(.photo-room) .site-header.is-solid {
  background-image: linear-gradient(to bottom, rgba(245, 241, 232, 0.96), rgba(245, 241, 232, 0.96) 70%, rgba(245, 241, 232, 0.96));
  border-bottom: 1px solid rgba(23, 30, 25, 0.16);
}

html.route-foto:not(.photo-room) .brand-text strong { color: #171e19; }
html.route-foto:not(.photo-room) .brand-text small { color: #5e6961; }

html.route-foto:not(.photo-room) .nav a { color: rgba(23, 30, 25, 0.78); }
html.route-foto:not(.photo-room) .nav a:hover,
html.route-foto:not(.photo-room) .nav a.is-active { color: #171e19; }
html.route-foto:not(.photo-room) .nav a::after { background: #8a6636; }

html.route-foto:not(.photo-room) .nav-cta { border-color: rgba(23, 30, 25, 0.3); }
html.route-foto:not(.photo-room) .nav-cta:hover { border-color: #8a6636; color: #8a6636 !important; }

html.route-foto:not(.photo-room) .menu-toggle { border-color: rgba(23, 30, 25, 0.3); color: #171e19; }

html.route-foto:not(.photo-room) .account-btn {
  border-color: var(--border-paper-strong);
  background: rgba(245, 241, 232, 0.72);
  color: #171e19;
}
html.route-foto:not(.photo-room) .account-avatar { background: #e7e1d3; border-color: var(--border-paper-strong); }
html.route-foto:not(.photo-room) .account-avatar span { color: var(--accent-paper); }
html.route-foto:not(.photo-room) .account-menu { background: var(--overlay-paper); border-color: var(--border-paper-subtle); }
html.route-foto:not(.photo-room) .account-item { color: rgba(23, 30, 25, 0.82); }
html.route-foto:not(.photo-room) .account-item:hover,
html.route-foto:not(.photo-room) .account-item.is-active { color: #171e19; background: rgba(138, 102, 54, 0.1); border-color: var(--border-paper-strong); }

@media (max-width: 800px) {
  html.route-foto:not(.photo-room) .nav {
    background: rgba(245, 241, 232, 0.98);
    border-bottom-color: rgba(23, 30, 25, 0.16);
  }
  html.route-foto:not(.photo-room) .nav a,
  html.route-foto:not(.photo-room) .nav-cta { border-bottom-color: rgba(23, 30, 25, 0.14) !important; }
}

@media (min-width: 801px) and (max-width: 980px) {
  html.route-foto:not(.photo-room) .nav {
    background: rgba(245, 241, 232, 0.98);
    border-bottom-color: rgba(23, 30, 25, 0.16);
  }
  html.route-foto:not(.photo-room) .nav a,
  html.route-foto:not(.photo-room) .nav-cta { border-bottom-color: rgba(23, 30, 25, 0.14) !important; }
}

/* =================== 2. Dirección E ===================
   Papel marfil de página completa, filetes, retículas asimétricas y
   fotografía dominante. Cada ratio compone su propia plancha; el orden
   narrativo es siempre fotografía · identidad · texto editorial ·
   En El Observatorio · Fotografías afines · colofón. */

/* Base tipográfica propia de la página de publicación (V2 no resetea
   márgenes de encabezados/párrafos a nivel global). */
.ar h1,
.ar h2,
.ar h3,
.ar p,
.ar figure { margin: 0; }

.ar {
  --dx: 0;
  --dy: 0;
  --ink: #171e19;
  --ink-2: #333c35;
  --muted: #5e6961;
  --rule: rgba(23, 30, 25, 0.26);
  --rule-soft: rgba(23, 30, 25, 0.13);
  --gold: #8a6636;
  --paper: #f5f1e8;
  min-height: 100svh;
  color: var(--ink);
  color-scheme: light;
  font-family: var(--font-ui);
  background:
    radial-gradient(ellipse 140% 90% at 50% -12%, #fbf8f1 0%, var(--paper) 52%, #efe9dd 100%);
}

.ar img { background: #e7e1d3; }

/* —— La página (pieza que se retira al entrar en contemplación D.1) —— */
.ar-page {
  width: min(94vw, 1480px);
  margin: 0 auto;
  padding: calc(var(--header-h) + 3vh) 5vw 6vh;
}
.ar-page.is-receding { opacity: 0; }

/* —— Cabecera de la publicación —— */
.ar-mast {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  padding-bottom: 1.3vh;
  border-bottom: 1px solid var(--rule);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.ar-brand { color: var(--ink); }
.ar-mast-title { color: var(--gold); }
/* «Copiar enlace» vive en la cabecera, justo encima del marco de la imagen (D-45 T1a). */
.ar-mast-r { display: inline-flex; align-items: baseline; gap: 22px; }
.ar-mast .ar-copy { padding: 4px 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--ink); background: none; border: 0; cursor: pointer; }
@media (pointer: coarse) {
  .ar-mast .ar-copy { min-height: 44px; padding-inline: 10px; margin-block: -10px; }
}

/* —— Banda de lectura: el texto empieza donde empieza la fotografía (D-45 T1a) —— */
.ar-band { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.ar-band-main { min-width: 0; }
.ar-band .ar-note { margin-top: 4vh; }
.ar-band .ar-conex { margin-top: 4vh; }

/* —— Primer acto —— */
.ar-act {
  display: flex;
  flex-direction: column;
  gap: 3vh;
  padding-top: 3vh;
}

.ar-col {
  display: flex;
  flex-direction: column;
  gap: 3vh;
  min-width: 0;
}

.ar-shot { margin: 0; min-width: 0; }

.ar-open {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: zoom-in;
}

.ar-shot img {
  width: 100%;
  height: auto;
  box-shadow:
    0 20px 48px -26px rgba(23, 30, 25, 0.55),
    0 2px 9px -3px rgba(23, 30, 25, 0.2);
  transform: translate3d(calc(var(--dx) * 2px), calc(var(--dy) * 1.6px), 0);
  transition: box-shadow 0.55s var(--ease), transform 0.9s var(--ease);
}
.ar-open:hover img,
.ar-open:focus-visible img {
  box-shadow:
    0 28px 60px -28px rgba(23, 30, 25, 0.6),
    0 3px 12px -3px rgba(23, 30, 25, 0.24);
}

/* —— Affordance: discreta, solo con puntero —— */
.ar-aff {
  position: absolute;
  left: 13px;
  bottom: 13px;
  padding: 7px 12px;
  border: 1px solid rgba(138, 102, 54, 0.42);
  background: rgba(250, 247, 240, 0.93);
  color: #171e19;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .ar-open:hover .ar-aff { opacity: 1; transform: none; }
}
.ar-open:focus-visible .ar-aff { opacity: 1; transform: none; }

/* —— Acción: archivo público en resolución original (no es D.1) —— */
.ar-shot-src {
  display: inline-block;
  margin-top: 10px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* —— Identidad —— */
.ar-id {
  display: flex;
  flex-direction: column;
  gap: 2.4vh;
  min-width: 0;
}

.ar-species {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(31px, 8.4vw, 46px);
  line-height: 1.03;
  letter-spacing: -0.015em;
  color: #12190f;
}

.ar-deck {
  margin-top: 1.1vh;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(15px, 4vw, 20px);
  line-height: 1.35;
  color: var(--muted);
}

.ar-sci {
  margin-top: 1vh;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.ar-sci[hidden] { display: none; }

.ar-facts { display: flex; flex-direction: column; }

.ar-fact {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 8.5px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.ar-facts .ar-fact:first-child { border-top: 1px solid var(--rule); }

.ar-fact-k {
  flex: none;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.ar-fact-v {
  font-size: 13.5px;
  line-height: 1.45;
  text-align: right;
  color: var(--ink-2);
}
/* Ausencia declarada, sin enlace: sobria y claramente distinta. */
.ar-fact-none {
  font-style: italic;
  color: var(--muted);
}

/* —— Contexto real —— */
.ar-note {
  border-top: 1px solid var(--rule);
  padding-top: 1.6vh;
  min-width: 0;
}
.ar-note[hidden] { display: none !important; }

.ar-note-k {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}
.ar-note-body { margin-top: 1.1vh; }
.ar-note-t {
  max-width: 60ch;
  font-family: var(--font-display);
  font-size: clamp(15px, 4.2vw, 17.5px);
  line-height: 1.58;
  color: #2b342d;
}
.ar-note-t + .ar-note-t { margin-top: 1.2vh; }

/* —— Conexiones (segundo acto) —— */
.ar-conex {
  margin-top: 4vh;
  padding-top: 2.4vh;
  border-top: 1px solid var(--rule);
}
.ar-conex-k {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}
.ar-conex-list {
  list-style: none;
  margin: 1.6vh 0 0;
  padding: 0;
}

.ar-conex-row {
  display: grid;
  grid-template-columns: minmax(84px, auto) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 16px;
  margin: 0 -10px;
  padding: 11px 10px;
  border-bottom: 1px solid var(--rule-soft);
  transition: background-color 0.3s ease;
}
.ar-conex-list li:first-child .ar-conex-row { border-top: 1px solid var(--rule-soft); }

.ar-conex-k2 {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.ar-conex-v {
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  transition: color 0.3s ease;
}
.ar-arrow {
  font-size: 13px;
  color: var(--gold);
  transition: transform 0.35s var(--ease);
}

.ar-conex-row:hover { background-color: rgba(138, 102, 54, 0.07); }
.ar-conex-row:hover .ar-conex-v { color: var(--gold); }
.ar-conex-row:hover .ar-arrow,
.ar-conex-row:focus-visible .ar-arrow { transform: translateX(4px); }
.ar-conex-row:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* —— Fotografías afines: pequeña selección fotográfica editorial ——
   Mosaico asimétrico (una principal + dos secundarias), ratios reales,
   sin recorte, sin tarjetas y sin carrusel (E.2). */
.ar-sim {
  margin-top: 4vh;
  padding-top: 2.4vh;
  border-top: 1px solid var(--rule);
}
.ar-sim[hidden] { display: none !important; }
.ar-sim-k {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}
.ar-sim-list {
  --rowh: clamp(170px, 19vw, 280px);
  list-style: none;
  margin: 2.2vh 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 3.2vh 1.8vw;
}

/* Filas justificadas (D-45 T1b): cada foto conserva su proporción y la fila reparte el ancho en función de ella. */
.ar-sim-item { min-width: 0; flex: var(--r, 1.5) 1 calc(var(--r, 1.5) * var(--rowh)); }

.ar-sim-row {
  display: block;
  color: inherit;
  text-decoration: none;
}
.ar-sim-img {
  display: block;
  width: 100%;
  height: auto;
  background: #e7e1d3;
  box-shadow:
    0 18px 38px -26px rgba(23, 30, 25, 0.5),
    0 2px 8px -3px rgba(23, 30, 25, 0.16);
  transition: box-shadow 0.5s var(--ease);
}

.ar-sim-cap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  min-width: 0;
}
.ar-sim-l {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.ar-sim-t {
  font-family: var(--font-display);
  font-size: clamp(15px, 1.45vw, 19px);
  line-height: 1.28;
  color: var(--ink);
  transition: color 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .ar-sim-row:hover .ar-sim-img {
    box-shadow:
      0 26px 52px -28px rgba(23, 30, 25, 0.58),
      0 3px 11px -3px rgba(23, 30, 25, 0.2);
  }
  .ar-sim-row:hover .ar-sim-t { color: var(--gold); }
}
.ar-sim-row:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}
.ar-sim-row:focus-visible .ar-sim-t { color: var(--gold); }

/* —— Colofón —— */
.ar-colophon {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px 24px;
  margin-top: 3.4vh;
  padding-top: 1.6vh;
  border-top: 1px solid var(--rule);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.ar-ext { margin-left: 6px; color: var(--gold); }

/* —— Enlaces editoriales: filete que se dibuja, nunca azul —— */
.ar-link {
  color: inherit;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  padding-bottom: 0.08em;
  transition: background-size 0.45s var(--ease), color 0.3s ease;
}
.ar-link:hover,
.ar-link:focus-visible {
  background-size: 100% 1px;
  color: var(--gold);
}
.ar-species-link { color: #12190f; }

.ar :focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* —— Entrada editorial —— */
.ar-mast { animation: ar-rise 0.7s 0.04s var(--ease) both; }
.ar-shot { animation: ar-rise 0.8s 0.1s var(--ease) both; }
.ar-col,
[data-format='p'] > .ar-id { animation: ar-rise 0.8s 0.22s var(--ease) both; }
.ar-band,
.ar-sim,
.ar-colophon { animation: ar-rise 0.8s 0.34s var(--ease) both; }

@keyframes ar-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

html[data-motion='reduce'] .ar-mast,
html[data-motion='reduce'] .ar-shot,
html[data-motion='reduce'] .ar-col,
html[data-motion='reduce'] .ar-band,
html[data-motion='reduce'] .ar-sim,
html[data-motion='reduce'] .ar-colophon,
html[data-motion='reduce'] [data-format='p'] > .ar-id {
  animation: none;
}
html[data-motion='reduce'] .ar-shot img {
  transform: none !important;
  transition: box-shadow 0.4s ease;
}

/* =================== Móvil / viewport estrecho ===================
   Orden fijo: 1 fotografía · 2 especie/título · 3 colaborador ·
   4 ubicación · 5 fecha · 6 contexto · 7 En El Observatorio ·
   8 Fotografías afines · 9 colofón. */
@media (max-width: 860px) {
  .ar-page { width: 100%; padding: calc(var(--header-h) + 2.6vh) 5vw 9vh; }
  .ar-act { gap: 2.8vh; padding-top: 2.6vh; }
  .ar-col { gap: 2.8vh; }
  .ar-species { font-size: clamp(30px, 8.6vw, 44px); }

  .ar-conex { margin-top: 3.4vh; }
  .ar-conex-row { gap: 12px; padding: 10px 8px; margin: 0 -8px; }
  .ar-conex-v { font-size: 13.5px; }

  /* Afines en móvil: dos por fila, con su proporción real. */
  .ar-sim-list { --rowh: 28vw; gap: 2.6vh 3vw; }
  .ar-sim-t { font-size: clamp(16px, 4.6vw, 19px); }

  [data-format='p'] .ar-shot {
    width: calc(100% + 10vw);
    margin-left: -5vw;
  }
}

/* Cabecera sin partirse en pantallas estrechas. */
@media (max-width: 560px) {
  .ar-mast {
    gap: 12px;
    font-size: 8.5px;
    letter-spacing: 0.14em;
  }
}

/* =================== Desktop ===================
   Lenguaje común (papel, filetes, jerarquía) con retícula adaptada
   a cada ratio: la fotografía manda, el texto se compacta a su lado. */
@media (min-width: 861px) {
  .ar-page { padding: calc(var(--header-h) + 3.4vh) 3.4vw 5vh; }

  .ar-act {
    flex-direction: row;
    align-items: flex-start;
    gap: 3vw;
    padding-top: 3.2vh;
  }
  .ar-band {
    grid-template-columns: minmax(0, 1fr) clamp(300px, 25vw, 380px);
    column-gap: 3vw;
    align-items: start;
  }
  .ar-band .ar-note-t { max-width: 62ch; }

  .ar-species { font-size: clamp(34px, 3.4vw, 58px); }
  .ar-deck { font-size: clamp(16px, 1.3vw, 21px); }

  /* 4:3 — fotografía grande a la izquierda, columna compacta a la derecha. */
  [data-format='h'] .ar-shot { flex: 1 1 auto; }
  [data-format='h'] .ar-col {
    flex: 0 0 clamp(300px, 25vw, 380px);
    display: flex;
    flex-direction: column;
    gap: 3vh;
  }

  /* 3:4 — plancha vertical; el lado editorial usa toda la columna. */
  [data-format='v'] { flex-direction: row-reverse; }
  [data-format='v'] .ar-shot { flex: 0 0 auto; }
  [data-format='v'] .ar-shot img {
    width: min(46vw, calc(84svh * 64 / 85));
  }
  [data-format='v'] .ar-col {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 3vh;
  }
  [data-format='v'] .ar-species { font-size: clamp(38px, 4.4vw, 64px); }

  /* 2:1 — banda dominante a todo el ancho, titular encima. */
  [data-format='p'] {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'id' 'shot';
    grid-template-rows: auto auto;
    row-gap: 2.4vh;
    align-content: start;
    min-height: 0;
  }
  [data-format='p'] .ar-id { grid-area: id; }
  [data-format='p'] .ar-shot { grid-area: shot; }
  [data-format='p'] .ar-shot img { width: 100%; }
}

/* Titular de la panorámica: identidad a la izquierda, ficha a la derecha. */
@media (min-width: 1180px) {
  [data-format='p'] .ar-id {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    column-gap: 3vw;
    align-items: end;
  }
  [data-format='p'] .ar-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0 1.6vw;
    min-width: min(44vw, 520px);
  }
  [data-format='p'] .ar-fact {
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    padding: 2px 0 2px 1.3vw;
    border: 0;
    border-left: 1px solid var(--rule-soft);
  }
  [data-format='p'] .ar-facts .ar-fact:first-child {
    border-top: 0;
    border-left: 0;
    padding-left: 0;
  }
  [data-format='p'] .ar-fact-v { text-align: left; }
}

/* =================== 3. Contemplación D.1 ===================
   Capa fullscreen verde-negro: fotografía completa, ×, zoom + pan y
   cápsula − Ajustar +. Puerto de observatorio.css (lab-gold → gold). */
.obs-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 110% 90% at 50% 42%, #0d1411 0%, #070b09 72%);
  cursor: zoom-out;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.obs-layer[hidden] { display: none; }

.obs-full {
  max-width: calc(100vw - 14vw);
  max-height: calc(100svh - 16vh);
  width: auto;
  height: auto;
  cursor: default;
  opacity: 1;
}

.obs-layer button {
  position: absolute;
  z-index: 2;
  padding: 10px 14px;
  line-height: 1;
  color: rgba(240, 238, 230, 0.78);
  cursor: pointer;
  transition: color 0.3s ease;
}
.obs-layer button:hover { color: var(--gold); }

.obs-x {
  top: 2.4vh;
  right: 2vw;
  font-size: 27px;
}

@media (max-width: 640px) {
  .obs-x { top: 8px; right: 6px; padding: 12px 16px; }
  .obs-full { max-width: calc(100vw - 6vw); max-height: calc(100svh - 20vh); }
}

/* —— Zoom de contemplación: cápsula − Ajustar + —— */
.obs-layer.is-zoomed .obs-full { cursor: grab; }
.obs-layer.is-zoomed.is-panning .obs-full { cursor: grabbing; }

.obs-zoom {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: max(1.7vh, calc(env(safe-area-inset-bottom, 0px) + 10px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  background: rgba(10, 15, 13, 0.88);
  border: 1px solid rgba(212, 175, 119, 0.28);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: border-color 0.45s ease, box-shadow 0.45s ease;
}

/* Luz sobre cristal: reflejo radial tenue que sigue al puntero. */
.obs-zoom::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(130px 60px at var(--mx, 50%) var(--my, 50%),
    rgba(255, 244, 226, 0.13), rgba(255, 244, 226, 0) 72%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.obs-zoom:hover::before,
.obs-zoom:focus-within::before { opacity: 1; }

.obs-zoom:hover,
.obs-zoom:focus-within {
  border-color: rgba(212, 175, 119, 0.55);
  box-shadow: 0 10px 26px -14px rgba(0, 0, 0, 0.8);
}

/* Al activar Ajustar, el filete de luz late y se recoge hacia el centro. */
.obs-zoom::after {
  content: '';
  position: absolute;
  inset: -1px;
  border: 1px solid rgba(212, 175, 119, 0.85);
  border-radius: inherit;
  opacity: 0;
  transform: scale(0.86);
  transition: opacity 0.45s ease, transform 0.45s var(--ease);
  pointer-events: none;
}
.obs-zoom:has(.obs-zfit:active)::after {
  opacity: 0.55;
  transform: scale(1);
  transition: opacity 0.1s ease, transform 0.1s ease;
}

.obs-zoom button {
  position: static;
  z-index: auto;
  padding: 7px 13px;
  font-size: 13px;
  color: rgba(240, 238, 230, 0.78);
  transform: translateY(0);
  transition: color 0.3s ease, transform 0.28s var(--ease);
}
.obs-zoom button:hover {
  color: var(--gold);
  transform: translateY(-1px);
}
.obs-zoom button:active {
  transform: translateY(0) scale(0.96);
  transition-duration: 0.14s;
}
.obs-zoom button:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 2px;
  border-radius: 999px;
  color: var(--gold);
}
.obs-zfit {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.obs-zbtn[aria-disabled='true'] { opacity: 0.34; cursor: default; }
.obs-zbtn[aria-disabled='true']:hover { color: rgba(240, 238, 230, 0.78); }

/* Sin movimiento: se conserva el contraste, se retira el desplazamiento
   y el destello del filete. */
@media (prefers-reduced-motion: reduce) {
  .obs-zoom button,
  .obs-zoom button:hover,
  .obs-zoom button:active {
    transition: color 0.3s ease;
    transform: none;
  }
  .obs-zoom::before { transition: none; }
  .obs-zoom::after { display: none; }
}
html[data-motion='reduce'] .obs-zoom button,
html[data-motion='reduce'] .obs-zoom button:hover,
html[data-motion='reduce'] .obs-zoom button:active {
  transition: color 0.3s ease;
  transform: none;
}
html[data-motion='reduce'] .obs-zoom::before { transition: none; }
html[data-motion='reduce'] .obs-zoom::after { display: none; }

/* La página se retira al entrar en contemplación (estado de VT). */
html.obs-lock { overflow: hidden; }

/* =================== View Transitions: publicación → contemplación ==== */
::view-transition-group(obs-shot) {
  animation-duration: 0.62s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
::view-transition-old(obs-shot),
::view-transition-new(obs-shot) {
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

::view-transition-old(obs-paper) {
  animation: obs-paper-out 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
::view-transition-new(obs-paper) {
  animation: obs-paper-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes obs-paper-out {
  to { opacity: 0; transform: translateY(-16px) scale(0.985); }
}
@keyframes obs-paper-in {
  from { opacity: 0; transform: translateY(-16px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* =================== 4. Integración de producción =================== */

/* Hueco del chip de moderación: invisible sin capacidad. */
.ar-mod-slot:empty { display: none; }

/* Chip de moderación en papel (variante del chip oscuro de fichas). */
.ar .ctx-mod {
  align-self: flex-start;
  margin-top: 0;
  background: rgba(23, 30, 25, 0.05);
  border-color: rgba(138, 102, 54, 0.45);
  color: #8a6636;
  backdrop-filter: none;
}
.ar .ctx-mod:hover {
  background: rgba(138, 102, 54, 0.12);
  border-color: #8a6636;
}

/* =================== 5. Cierre: del archivo al Observatorio ============= */

/* Umbral material CORTO: el canto del papel cae en sombra y la sala
   oscura empieza enseguida. Marfil residual, sombra de contacto, una luz
   dorada finísima y entrada rápida al verde-negro. Sin masa de degradado
   gris, sin blur y sin neblina: lo que ocupa la página es la sala. */
.photo-threshold {
  position: relative;
  height: clamp(84px, 11vh, 120px);
  background:
    linear-gradient(to bottom,
      rgba(2, 5, 4, 0) 7px,
      rgba(2, 5, 4, 0.55) 15px,
      rgba(2, 5, 4, 0.36) 32px,
      rgba(2, 5, 4, 0) 64px),
    linear-gradient(to bottom,
      #efe9dd 0px,
      #efe9dd 6px,
      #d8d2c4 8px,
      #9a9488 11px,
      #565b52 15px,
      #262c27 20px,
      #101513 27px,
      var(--bg) 46px,
      var(--bg) 100%);
}

/* Luz dorada en el canto del papel: una sola línea, muy tenue. */
.photo-threshold::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 6px;
  width: min(56%, 620px);
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg,
    rgba(212, 175, 119, 0) 0%,
    rgba(212, 175, 119, 0.5) 28%,
    rgba(230, 202, 154, 0.72) 50%,
    rgba(212, 175, 119, 0.5) 72%,
    rgba(212, 175, 119, 0) 100%);
}

/* —— Una sola pieza horizontal: anterior · siguiente · archivo ——
   El texto se alinea con la publicación; la fotografía entra desde el
   borde de la sala y se disuelve hacia el centro. */
.photo-foot-nav {
  --cierre-pad: calc((100vw - min(94vw, 1480px)) / 2 + 3.4vw);
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: 'prev next' 'back back';
  column-gap: clamp(24px, 4.4vw, 84px);
  row-gap: clamp(30px, 5vh, 54px);
  width: 100%;
  overflow: hidden;
  padding: clamp(20px, 2.8vh, 32px) var(--cierre-pad) clamp(46px, 7.5vh, 80px);
  background: var(--bg);
}
/* Espejo exacto de la previa: el bloque siguiente cierra contra el margen. */

/* Acción secundaria: centrada DESPUÉS de los dos umbrales. */
.foot-back {
  grid-area: back;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(242, 239, 230, 0.55);
  text-decoration: none;
  transition: color 0.3s ease;
}
.foot-back-ico { font-size: 13px; line-height: 1; }
.foot-back:hover,
.foot-back:focus-visible { color: var(--gold); }

/* —— Presencia fotográfica en reposo ——
   No es una miniatura: es una banda de atmósfera que entra desde el
   borde de cada lado, desaturada, muy tenue y disuelta hacia el centro.
   La fotografía nunca compite con el texto. */

/* Viñeta vertical: la banda queda entre la sombra superior y el fondo.
   Cubre también el tramo que se desborda hacia el borde de la sala. */
.foot-back:focus-visible {
  outline: 1px solid rgba(212, 175, 119, 0.6);
  outline-offset: 6px;
}


@media (max-width: 860px) {
  .photo-foot-nav {
    --cierre-pad: 5vw;
    grid-template-columns: 1fr;
    grid-template-areas: 'prev' 'next' 'back';
    column-gap: 0;
    row-gap: clamp(24px, 3.6vh, 38px);
    padding-top: clamp(22px, 3.4vh, 34px);
    padding-bottom: clamp(48px, 8vh, 72px);
  }


  .photo-threshold { height: clamp(76px, 10vh, 104px); }

}

/* =================== Sin movimiento ==================================== */
@media (prefers-reduced-motion: reduce) {
  .foot-back { transition: none; }
}

/* Aviso de identificación en revisión bajo el titular (mismo criterio que la ficha y el índice de especies). */
.ar-review { margin: 10px 0 0; padding: 8px 0 8px 14px; max-width: 52ch; border-left: 3px solid var(--accent-paper); font-size: 14px; line-height: 1.55; color: var(--muted-on-paper); }
.ar-review strong { color: var(--ink-dark); font-weight: 600; }

/* Pie de las fotografías afines al formato de Home: etiqueta, título y crédito. */
.ar-sim-c { display: block; margin-top: 3px; font-size: 11px; line-height: 1.5; letter-spacing: 0.02em; color: var(--muted-on-paper); }

/* —— Tanda 5: pulido de la vista de foto (D-25) —— */
html.route-foto:not(.photo-room) .account-signin { color: var(--accent-paper); border-color: var(--border-paper-strong); }
html.route-foto:not(.photo-room) .account-signin:hover { color: #171e19; }

/* —— Navegación anterior · Galería · siguiente con las tarjetas de la ficha de especie (D-25) —— */
.photo-foot-nav--cards {
  display: block;
  overflow: visible;
  padding: clamp(28px, 4vw, 52px) max(16px, calc((100% - var(--max)) / 2 + 16px)) clamp(56px, 8vw, 100px);
}
.photo-foot-nav--cards .next-card, .photo-foot-nav--cards .next-index { color: var(--ink); }
.photo-foot-nav--cards .next-card:focus-visible, .photo-foot-nav--cards .next-index:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.photo-foot-nav--cards .next-thumb { overflow: hidden; background: var(--bg-elevated, #101513); }

/* Pie de la web oscuro también en la ruta de foto (D-25): la sala oscura y el pie forman un solo final.
   `html.route-foto` redefine --line y --focus-ring para el papel; dentro del pie se devuelven a la variante oscura. */
html.route-foto .site-footer {
  --line: var(--border-observatory-subtle);
  --focus-ring: var(--accent-observatory);
}
/* Cabecera oscura mientras la sala oscura está bajo ella (clase `photo-room`, ver mountPhoto). */
html.route-foto.photo-room .site-header { --line: var(--border-observatory-subtle); --focus-ring: var(--accent-observatory); }


/* Origen del texto de la ficha (D-45 T2): aclaración bajo el rótulo y bloque general de la especie separado */
.ar-note-sub { margin: 4px 0 0; max-width: 60ch; font-size: 12.5px; font-style: italic; line-height: 1.5; color: var(--muted-on-paper); }
.ar-note-block + .ar-note-block { margin-top: 2.6vh; padding-top: 1.8vh; border-top: 1px solid var(--rule-soft); }

/* Etiqueta del origen del texto, solo para quien edita (D-45 T3) */

/* Pregunta «Apuntar para revisar» sobre el papel de la ficha (D-45 T5) */
.ar-mod-slot .confirm-box { margin-top: 10px; padding: 12px 14px; max-width: 46ch; background: #f6f2e8; color: #1a221d; border: 1px solid var(--gold); }
.ar-mod-slot .confirm-box p { margin: 0 0 8px; font-size: 13px; }
.ar-mod-slot .confirm-box label { display: block; font-size: 12px; color: #5c665e; }
.ar-mod-slot .confirm-box input { width: 100%; margin: 4px 0 10px; padding: 8px 10px; border: 1px solid #c9c2b0; background: #fff; color: #1a221d; font: inherit; }
.ctx-mod--flag { cursor: pointer; font: inherit; }

/* Ayuda de la etiqueta de origen del texto (D-46) */
.ctx-mod--help { min-width: 28px; justify-content: center; text-decoration: none; }
@media (pointer: coarse) { .ctx-mod--help { min-width: 44px; min-height: 44px; } }
