/* The row of version links (gen.py writes it on every prototype): it stays at the top, and the sticky scenes below
   sit under it. */
:root { --barra-v: 40px }
html { scroll-padding-top: calc(var(--barra-v) + 8px) }
.versiones { position: sticky; top: 0; z-index: 1100; display: flex; align-items: center; gap: 0; height: var(--barra-v); box-sizing: border-box; margin: 0 0 8px; overflow-x: auto; scrollbar-width: none; background: var(--bg); border-bottom: 1px solid var(--line); white-space: nowrap }
.versiones::-webkit-scrollbar { display: none }
.versiones .et { margin-right: 4px; font-size: .8rem; color: var(--muted) }
.versiones a { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 100%; padding: 0 6px; color: var(--muted); font-size: .8rem; text-decoration: none }
.versiones a b { font-weight: 600; font-variant-numeric: tabular-nums }
.versiones a:hover { color: var(--fg) }
.versiones a[aria-current="page"] { color: var(--fg) }
.versiones a[aria-current="page"]::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 0; height: 2px; background: var(--brand) }
@media (max-width: 1080px) { .versiones a:not([aria-current]) span { display: none } }
.versiones a:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px }

/* Shared by the /nocuadra-pN prototypes (noindex). The scrolling story: a scene that stays put while the steps scroll
   past it; NC.relato() in nocuadra-lab.js adds .vivo and switches the scene's layers. Without the script every layer
   simply follows in the page. */
.relato { margin: 28px 0 0 }
.relato.vivo { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 32px }
.relato.vivo .escena { grid-column: 2; grid-row: 1; position: sticky; top: max(8vh, calc(var(--barra-v) + 12px)); height: 84vh; align-self: start }
.relato.vivo .pasos { grid-column: 1; grid-row: 1 }
.pasos { margin: 0; padding: 0; list-style: none }
.escena { position: relative }
.capa { margin: 0 0 20px }
.relato.vivo .capa { position: absolute; inset: 0; margin: 0; display: flex; flex-direction: column; justify-content: center; opacity: 0; visibility: hidden; transition: opacity .4s, visibility 0s .4s; overflow: hidden }
.relato.vivo .capa.on { opacity: 1; visibility: visible; transition: opacity .4s }
.relato.vivo .capa.mapa { justify-content: stretch }
.capa .documento { margin: 0; max-width: none }
.capa .serie { width: 100% }
.capa h3 { margin: 0 0 8px; font-size: 1rem; font-weight: 500; color: var(--muted) }
.capa .puntos-mapa { height: 100%; min-height: 300px }
.relato:not(.vivo) .capa .puntos-mapa { height: 360px }
.capa .nota-mapa { position: absolute; right: 8px; top: 8px; max-width: 60%; z-index: 500; margin: 0; padding: 4px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; font-size: .8rem }
.capa .nota-mapa:empty { display: none }
.cien.grande { width: min(100%, 420px); gap: 4px; margin: 0 auto }
.cien span { transition: background .3s }
.cuenta-cien { margin: 16px 0 0; text-align: center; font: 400 1.4rem var(--serif) }
.cuenta-cien b { font-size: 2.4rem; font-weight: 400; color: var(--s1); font-variant-numeric: tabular-nums }
.foto-flota { position: absolute; right: 8px; bottom: 8px; z-index: 500; width: min(44%, 232px); margin: 0 }
.foto-flota .foto { padding: 4px }
.foto-flota figcaption { margin-top: 4px; padding: 4px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; font-size: .8rem; font-weight: 600; line-height: 1.3 }
.foto-flota figcaption .sub { display: block; font-weight: 400; color: var(--muted) }
.capa .keys.sobre { position: absolute; left: 8px; bottom: 8px; z-index: 500; margin: 0; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; font-size: .8rem }
.keys .sw.none { background: transparent; border: 1.5px solid var(--muted) }

.paso { min-height: 72vh; display: flex; align-items: center }
.paso:first-child { min-height: 48vh; align-items: flex-start }
.paso:last-child { min-height: 60vh }
.relato:not(.vivo) .paso { min-height: 0; margin: 0 0 12px }
.tarjeta { padding: 20px; background: var(--surface); border: 3px double var(--brand); border-radius: 4px; max-width: 46ch; transition: opacity .3s }
.relato.vivo .paso:not(.activo) .tarjeta { opacity: .5 }
.tarjeta p { margin: 0 0 8px; max-width: none }
.tarjeta p:last-child { margin-bottom: 0 }
.tarjeta .mun { font-size: .85rem; font-weight: 600; color: var(--brand-deep) }
.tarjeta .grande { font: italic 400 1.5rem/1.2 var(--serif) }
.tarjeta .fuente { font-size: .85rem; color: var(--muted) }
.tarjeta .dif { padding: 12px; background: var(--warn-bg); color: var(--warn); font-size: .95rem }
.tarjeta .dif strong { display: block; font-size: .85rem }
.tarjeta .lados { display: grid; gap: 8px; margin: 0 0 8px }
.tarjeta .lados p { margin: 0; padding: 8px 12px; border-left: 3px double var(--brand); background: var(--bg); font-size: .95rem }
.tarjeta .lados b { display: block; font-size: .8rem; font-weight: 600; color: var(--muted) }
/* A chapter opener between the two municipios. */
.paso.capitulo .tarjeta { border: 0; border-top: 3px double var(--brand); border-bottom: 3px double var(--brand); border-radius: 0; background: none; padding: 20px 0 }
.paso.capitulo .grande { font-size: clamp(1.8rem, 3.4vw, 2.6rem) }

/* Paper lies flat on every prototype. A document crop in the scene: the highlighter sweeps across its marked lines
   and the rings fade in each time the layer shows. */
.hoja { box-shadow: none }
.relato.vivo .capa .renglon.marca { background: linear-gradient(rgb(242 200 75 / .55), rgb(242 200 75 / .55)) no-repeat 0 0 / 0 100%; transition: background-size .6s .2s }
.relato.vivo .capa.on .renglon.marca { background-size: 100% 100% }
.relato.vivo .capa .renglon.marca:nth-child(2) { transition-delay: .5s }
.relato.vivo .capa .renglon.marca:nth-child(n+3) { transition-delay: .8s }
.relato.vivo .capa .anillo, .relato.vivo .capa .etiqueta { opacity: 0; transition: opacity .4s .9s }
.relato.vivo .capa.on .anillo, .relato.vivo .capa.on .etiqueta { opacity: 1 }

/* A printed clipping: paper keeps its own colours in both themes. */
.recorte { margin: 12px; padding: 28px; background: #fbfaf6; border: 1px solid #ddd7c6; border-radius: 4px; color: #14213d }
.recorte .q { margin: 0; font: italic 400 clamp(1.5rem, 3.2vw, 2.4rem)/1.15 var(--serif) }
.recorte .q mark { padding: 0 4px; background: rgb(242 200 75 / .6); color: inherit }
.recorte .de { margin: 16px 0 0; font-size: .9rem; color: #4f5b7a }

/* Pictograms that fill in (NC.matriz, NC.gotas, NC.vasos), from propuesta 9. */
.matriz { display: grid; gap: 3px; margin: 10px 0 0; max-width: 900px }
.matriz .fila { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) 2rem; gap: 10px; align-items: center; font-size: .78rem; font-variant-numeric: tabular-nums; color: var(--muted) }
.matriz .fila.max { color: var(--fg); font-weight: 600 }
.matriz .puntos { display: grid; grid-template-columns: repeat(45, minmax(0, 1fr)); gap: 2px }
.matriz .puntos i { aspect-ratio: 1; border-radius: 50%; border: 1.5px solid var(--axis); opacity: 0; transition: opacity .3s }
.matriz .puntos i.si { background: var(--s1); border-color: var(--s1) }
.matriz.ve .puntos i { opacity: 1 }
.matriz .n { text-align: right }
.matriz .eje { grid-template-columns: 4.2rem minmax(0, 1fr) 2rem }
.matriz .eje span:nth-child(2) { display: flex; justify-content: space-between; border-top: 2px dashed var(--fg); padding-top: 3px; color: var(--fg) }
.gotas { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 6px 4px; max-width: 640px; margin: 10px 0 0 }
.gotas svg { width: 100%; height: auto; color: var(--grid); transition: color .3s }
.gotas svg.si { color: var(--s1) }
.cuenta-g { font: 400 2rem var(--serif); margin: 10px 0 0 }
.cuenta-g b { font-weight: 400; color: var(--s1); font-size: 3rem }
.vasos { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 10px 0 0 }
.vasos .v { position: relative; width: 44px; height: 70px; border: 3px solid var(--fg); border-top: 0; border-radius: 0 0 10px 10px; overflow: hidden }
.vasos .v i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--s2); transition: height .5s }
.vasos.bajo .v i { background: var(--axis) }
.renglon-v { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 16px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--line) }
.renglon-v .q { font-size: .95rem }
.renglon-v .q b { display: block; font: 400 1.9rem/1.1 var(--serif); font-variant-numeric: tabular-nums }
.renglon-v .q b.sobre { color: var(--s2-text) }

@media (prefers-reduced-motion: reduce) {
  .matriz .puntos i, .gotas svg, .vasos .v i { transition: none }
  .relato.vivo .capa, .relato.vivo .capa.on, .tarjeta { transition: none }
  .relato.vivo .capa .renglon.marca, .relato.vivo .capa .anillo, .relato.vivo .capa .etiqueta { transition: none }
}
@media (max-width: 760px) {
  .matriz .fila { grid-template-columns: 3.4rem minmax(0, 1fr) 1.6rem; gap: 6px }
  .matriz .puntos { gap: 1px }
  .matriz .puntos i { border-width: 1px }
  .gotas { grid-template-columns: repeat(10, minmax(0, 1fr)) }
  .renglon-v { grid-template-columns: 1fr }
  .vasos .v { width: 34px; height: 54px }
}
@media (max-width: 860px) {
  .relato.vivo { display: block }
  .relato.vivo .escena { position: sticky; top: var(--barra-v); z-index: 2; height: 52vh; padding: 8px 0; background: var(--bg); border-bottom: 1px solid var(--line) }
  .relato.vivo .capa { inset: 8px 0 }
  /* The cards slide under the scene, so it's never covered. */
  .paso, .paso:first-child { min-height: 80vh; align-items: center; position: relative; z-index: 1 }
  .cien.grande { width: min(100%, 240px) }
  .relato.vivo .paso:not(.activo) .tarjeta { opacity: 1 }
  .recorte { margin: 4px; padding: 16px }
  .foto-flota { width: 34% }
  .foto-flota img { max-height: 20vh; width: auto; margin: 0 auto }
  .capa .keys.sobre { font-size: .75rem; padding: 4px 8px; gap: 2px 8px }
}
