/* The «No cuadra» series: /nocuadra (the hub), /zapopan and /tlajomulco. Each page keeps its base and Talavera blocks
   inline, as every page does; what the series shares is here. */

/* Chart colours: orange for a month over the limit, grey for the rest (dark mode picks its own steps). --s2-text is
   that orange for a figure set as text, at 4.5:1 or more on the page (4.66 light, 5.76 dark). */
:root { --s1: #2a78d6; --s2: #eb6834; --s2-text: #c74614; --s3: #1baf7a; --grid: #e1e0d9; --axis: #c3c2b7 }
@media (prefers-color-scheme: dark) { :root { --s1: #3987e5; --s2: #d95926; --s2-text: #eb6834; --s3: #199e70; --grid: #2a3a6e; --axis: #4a5a8e } }

/* Above the headline: the series and the municipio. */
.kicker { margin: 18px 0 0; font-size: .95rem; color: var(--muted) }
.kicker a { color: var(--brand-deep); font-weight: 600 }

/* A quote set apart, with its source under it. */
.cita { margin: 16px 0 20px; padding: 2px 0 2px 18px; border-left: 3px double var(--brand); max-width: 68ch; font-size: 1.05rem }
.cita cite { display: block; margin-top: 6px; font-size: .85rem; font-style: normal; color: var(--muted) }

/* Figures at the top: a double rule, three or four numbers in ink; only one over a limit takes the chart's orange. */
.contador { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); margin: 24px 0 8px; padding: 0; list-style: none; border-top: 3px double var(--brand); border-bottom: 1px solid var(--line) }
.contador li { padding: 16px 20px }
.contador li:first-child { padding-left: 0 }
.contador li + li { border-left: 1px solid var(--line) }
.contador .n { display: block; margin-bottom: 4px; font-size: 1.6rem; font-weight: 500; letter-spacing: -.02em; line-height: 1.2; color: var(--fg); font-variant-numeric: tabular-nums }
.contador .n.sobre { color: var(--s2-text) }
.contador .t { font-size: .9rem; color: var(--muted) }
@media (max-width: 760px) { .contador { grid-template-columns: 1fr } .contador li { padding: 12px 0 } .contador li + li { border-left: 0; border-top: 1px solid var(--line) } }

/* Every comparison has the same three parts: what was said, what the record shows, and the gap. */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 0 24px; border-top: 3px double var(--brand); border-bottom: 1px solid var(--line); background: transparent }
.duo > div { padding: 20px 24px }
.duo .prometido { padding-left: 0 }
.duo .entregado { border-left: 1px solid var(--line) }
.duo h3 { margin: 0 0 12px; font-size: .9rem; letter-spacing: 0; color: var(--muted); font-weight: 500; font-style: normal }
.duo .cifra { display: block; font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 400; letter-spacing: -.02em; line-height: 1.1; margin: 0 0 12px; color: var(--fg); font-variant-numeric: tabular-nums }
.duo .de { font-size: .95rem; color: var(--muted); margin: 12px 0 0 }
.duo blockquote { margin: 0; padding: 0; border: 0; font-size: 1rem }
.duo .diferencia { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--warn-bg); color: var(--warn) }
.duo .diferencia strong { font-size: .85rem; font-weight: 600; white-space: nowrap }
.duo .diferencia span { font-size: .95rem }
@media (max-width: 760px) { .duo { grid-template-columns: 1fr } .duo > div { padding: 20px 0 } .duo .entregado { border-left: 0; border-top: 1px solid var(--line) } .duo .diferencia { display: block; padding: 12px } .duo .diferencia strong { display: block; margin-bottom: 4px } }

/* A paper card with cuts of an official document (pipelines/documentos.py writes the card; the figure and caption
   around it are written by hand). The paper keeps its own colours in both themes: it is a picture of paper. */
.documento { max-width: 760px; margin: 20px 0 28px }
.hoja { display: flex; flex-direction: column; gap: 14px; padding: 20px 24px 24px; background: #fbfaf6; border: 1px solid #ddd7c6; border-radius: 4px; box-shadow: 0 14px 30px -22px rgb(20 33 61 / .55) }
.hoja img { display: block; width: 100%; height: auto; mix-blend-mode: multiply }
.hoja .membrete { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 12px; border-bottom: 2px dashed rgb(0 0 0 / .18) }
.hoja .renglones { display: flex; flex-direction: column; align-items: flex-start; gap: 4px }
.hoja .renglon { position: relative; display: block; max-width: 100%; border-radius: 3px }
.hoja .renglon.marca { background: rgb(242 200 75 / .55) }
.hoja .salto { padding-left: 4px; font-size: .9rem; line-height: 1; color: #6b6b6b }
.hoja .anillo { position: absolute; aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid #1d3f9e; border-radius: 50%; pointer-events: none }
.hoja .etiqueta { position: absolute; transform: translate(-50%, -50%); padding: 2px 8px; border-radius: 4px; background: #1d3f9e; color: #fff; font: 600 clamp(11px, 1.7vw, 15px)/1.25 var(--font); font-style: normal; white-space: nowrap; font-variant-numeric: tabular-nums; pointer-events: none }
.documento figcaption { margin-top: 10px; font-size: .85rem; color: var(--muted); max-width: 80ch }
@media (prefers-color-scheme: dark) { .hoja { border-color: #3a4670; box-shadow: none } }
@media (max-width: 560px) { .hoja { padding: 14px 14px 16px; gap: 10px } .hoja .renglones { gap: 3px } .hoja .anillo { border-width: 2px } }

/* The hub's cards, one per municipio. */
.municipios { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 20px 0 8px; padding: 0; list-style: none }
.municipios li { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border: 3px double var(--brand); border-radius: 4px; background: var(--surface) }
.municipios li.pendiente { border: 1px dashed var(--line); background: transparent; color: var(--muted) }
.municipios h2 { margin: 0; font-size: 1.3rem; line-height: 1.2 }
.municipios h2 a { text-decoration: none }
.municipios .n { font-size: 1.5rem; color: var(--brand-deep); font-variant-numeric: tabular-nums; line-height: 1.2 }
.municipios p { margin: 0; font-size: .95rem }

/* A monthly series drawn by the page's script, with the limit as a dashed line. */
.serie { position: relative; margin: 8px 0 0 }
.serie svg { display: block; width: 100%; height: auto; overflow: visible }
.serie text { font: 12px var(--font); fill: var(--muted); font-variant-numeric: tabular-nums }
.serie .gl { stroke: var(--grid); stroke-width: 1 }
.serie .base { stroke: var(--axis); stroke-width: 1 }
.serie .bajo { fill: var(--axis) }
.serie .sobre { fill: var(--s2) }
/* A series with no limit to cross (pipas, litres a day) is one blue. */
.serie .uno { fill: var(--s1) }
.serie .limite { stroke: var(--fg); stroke-width: 1.5; stroke-dasharray: 5 4 }
.serie .limite-t { fill: var(--fg); font-weight: 600 }
.serie .nota { fill: var(--fg) }
.serie .nota-l { stroke: var(--fg); stroke-width: 1 }
.serie .col:hover .hit, .serie .col.on .hit { fill: var(--subtle); opacity: .7 }
.serie .tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: .88rem; line-height: 1.35; box-shadow: 0 6px 18px rgb(3 14 22 / .16); min-width: 150px }
.serie .tip b { display: block; margin-bottom: 2px }
.grafica { margin: 20px 0 8px }
.grafica figcaption { margin-top: 10px; font-size: .85rem; color: var(--muted); max-width: 80ch }
.tabla { margin: 12px 0 0; font-size: .92rem }
.tabla summary { cursor: pointer; color: var(--link) }
.tabla table { border-collapse: collapse; margin: 10px 0 0; font-variant-numeric: tabular-nums }
.tabla th, .tabla td { padding: 3px 18px 3px 0; border-bottom: 1px solid var(--line); text-align: left }
.tabla td.v { text-align: right }
.keys { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; list-style: none; font-size: .92rem }
.keys li { display: inline-flex; align-items: center; gap: 7px }
.keys .sw { width: 14px; height: 14px; border-radius: 3px; background: var(--sw); border: 1px solid rgb(0 0 0 / .2) }
.keys .sw.linea { height: 0; border: 0; border-top: 2px dashed var(--fg); border-radius: 0 }

/* Side by side: the same month in each year, at the text's width so it stays smaller than the main chart. */
.anios { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; max-width: 70ch; margin: 16px 0 0; padding: 0; list-style: none; align-items: end }
.anios li { display: flex; flex-direction: column; align-items: stretch; gap: 4px; font-size: .85rem; text-align: center }
.anios .b { align-self: center; width: min(100%, 40px); height: var(--h); min-height: 2px; background: var(--axis); border-radius: 2px 2px 0 0 }
.anios .b.sobre { background: var(--s2) }
.anios .v { font-variant-numeric: tabular-nums; font-weight: 600 }
.anios .a { color: var(--muted); border-top: 1px solid var(--axis); padding-top: 4px }

/* One hundred squares, one per announced unit; the blue ones are those a document lists. */
.cien { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; width: min(100%, 320px); margin: 16px 0 0 }
.cien span { aspect-ratio: 1; border-radius: 2px; background: var(--grid) }
.cien span.si { background: var(--s1) }

/* A dated chronology: day on the left, what happened on the right. */
.cronologia { margin: 8px 0 0; padding: 0; list-style: none; max-width: 820px }
.cronologia li { display: grid; grid-template-columns: 9.5rem 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line) }
.cronologia li:last-child { border-bottom: 1px solid var(--line) }
.cronologia time, .cronologia .dia { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums }
.cronologia p { margin: 0 }
.cronologia .quien { display: block; font-size: .85rem; color: var(--muted) }
@media (max-width: 560px) { .cronologia li { grid-template-columns: 1fr; gap: 2px } }

/* What the authorities say exists, and whether anyone has handed it over. */
.ausencias { width: 100%; max-width: 900px; border-collapse: collapse; margin: 10px 0 0; font-size: .95rem }
.ausencias th, .ausencias td { text-align: left; padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top }
.ausencias thead th { font-size: .85rem; font-weight: 600; color: var(--muted); border-bottom: 3px double var(--brand) }
.ausencias td.estado { width: 14rem }
.ausencias .estado strong { font-weight: 600 }
.ausencias .falta strong { color: var(--warn) }
.ausencias .pedido strong { color: var(--brand-deep) }
@media (max-width: 760px) { .ausencias thead { display: none } .ausencias tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line) } .ausencias td { display: block; padding: 2px 0; border: 0 } .ausencias td.estado { width: auto } }

/* A map of points named in a document. */
.puntos-mapa { height: clamp(360px, 60vh, 560px); border-radius: 8px; border: 1px solid var(--line); background: var(--subtle) }
.puntos-mapa:focus-visible { outline: 3px solid var(--brand) }
@media (prefers-color-scheme: dark) { .puntos-mapa .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) } .puntos-mapa.leaflet-container { background: #0c1e2c } }
.map-label { background: var(--surface); color: var(--fg); border: 1px solid var(--line); font: 600 13px/1.3 var(--font); box-shadow: var(--shadow); padding: 6px 8px; white-space: normal; width: max-content; max-width: 260px }
.map-label::before { display: none }
.map-label .sub { display: block; font-weight: 500; color: var(--muted) }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--fg) }
.leaflet-popup-content { font: 600 14px/1.35 var(--font); margin: 10px 14px }
.leaflet-popup-content .sub { display: block; font-weight: 500; color: var(--muted) }
/* A document's photographs, cut whole from its pages (pipelines/documentos.py writes each <img>), on the cards' paper
   and numbered with the map's badge; a click on a map point marks its figure .activa. */
.foto { position: relative; display: block; padding: 10px; background: #fbfaf6; border: 1px solid #ddd7c6; border-radius: 4px }
.foto img { display: block; width: 100%; height: auto }
.foto .punto { position: absolute; top: -9px; left: -9px; z-index: 1 }
.fotos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 16px; margin: 20px 0 0 }
.fotos figure { margin: 0 }
.fotos .foto { aspect-ratio: 1 }
.fotos .foto img { height: 100%; object-fit: contain }
.fotos figcaption { margin-top: 8px; font-size: .9rem; line-height: 1.35 }
.fotos figcaption .sub { display: block; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums }
.fotos .activa .foto, .foto-a.activa .foto { outline: 3px solid var(--brand); outline-offset: 3px }
.foto-a { max-width: 760px; margin: 20px 0 28px }
.foto-a figcaption { margin-top: 10px; font-size: .85rem; color: var(--muted); max-width: 80ch }
.plano { max-width: none }
@media (prefers-color-scheme: dark) { .foto { border-color: #3a4670 } }
@media (max-width: 760px) { .fotos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px } .foto { padding: 6px } }
.punto { display: inline-grid; place-items: center; flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--s2); color: #14213d; font: 600 12px/1 var(--font); font-style: normal; border: 2px solid var(--surface); box-shadow: 0 1px 4px rgb(0 0 0 / .3) }
.punto.otro { background: var(--brand); color: #fff }
.punto.sin { background: transparent; color: var(--fg); border: 2px dashed var(--muted); box-shadow: none }
.leaflet-div-icon.marca-punto { background: none; border: 0 }

/* The hub (/nocuadra): each municipio's main contrast, its chart or map and a document, then a button to its page.
   The buttons are the landing's. */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--primary); color: var(--on-primary); font: inherit; font-size: .95rem; font-weight: 500; line-height: 1.5; text-decoration: none; padding: 10px 16px; border: 1px solid transparent; border-radius: 4px; cursor: pointer }
.button:hover { background: var(--brand-deep) }
.button.alt { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--link); border: 1.5px solid var(--brand) }
.button.alt:hover { background: color-mix(in srgb, var(--brand) 22%, var(--surface)) }
.buttons { display: flex; flex-wrap: wrap; gap: 8px }
.saltos { margin: 20px 0 0 }
.caso { margin-top: 36px; padding: 28px 0 8px; border-top: 3px double var(--brand) }
.caso > .kicker { margin-top: 0 }
.caso > h2 { margin: 6px 0 20px; max-width: 34ch; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.2; text-wrap: balance }
.caso > h3 { margin: 28px 0 0 }
.vistas { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px; align-items: start }
.vistas > .grafica { margin-top: 0 }
.vistas h3 { margin: 0 0 4px; font-size: 1.05rem }
.puntos-mapa.chico { height: clamp(300px, 46vh, 440px) }
.visor-mapa { margin-top: 14px }
.visor { margin: 0 }
.visor .foto { display: flex; align-items: center; justify-content: center; box-sizing: border-box; height: 440px }
.visor .foto img { width: auto; max-width: 100%; height: auto; max-height: 100% }
.visor figcaption { margin-top: 10px; font-weight: 600 }
.visor figcaption .sub { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums }
.miniaturas { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0 0; padding: 0; list-style: none }
.miniaturas button { position: relative; display: block; width: 72px; height: 72px; padding: 4px; background: #fbfaf6; border: 1px solid #ddd7c6; border-radius: 4px; cursor: pointer }
.miniaturas img { display: block; width: 100%; height: 100%; object-fit: cover }
.miniaturas .punto { position: absolute; top: -8px; left: -8px; width: 22px; height: 22px; font-size: 11px }
.miniaturas button[aria-pressed="true"] { outline: 3px solid var(--brand); outline-offset: 2px }
.miniaturas button:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px }
.marca-punto.activa .punto { outline: 3px solid var(--brand); outline-offset: 1px }
.ir { margin: 24px 0 0 }
.ir .button { text-align: left }
@media (prefers-color-scheme: dark) { .miniaturas button { border-color: #3a4670 } }
@media (max-width: 760px) { .vistas { grid-template-columns: 1fr; gap: 24px } .visor .foto { height: 380px } .miniaturas button { width: 60px; height: 60px } }
@media (min-width: 761px) { .visor-mapa .puntos-mapa.chico { height: 440px } }
