/* Geoportal IDE Comodoro Rivadavia - main stylesheet.
   Hand-edited; armar_sitio.py copies it to the published site as is. */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --marca: #134768;
  --marca-clara: #1d6291;
  --marca-oscura: #071c29;
  --bg: #e4e5e5;
  --titulo: #1b1b1b;
  --tinta: #16232b;
  --suave: #5a6670;
  --linea: #c9cccd;
  --tarjeta: #ffffff;
  --chip-tema: #9aa4ab;
  --chip-tema-linea: #dfe2e3;
  --pie-bg: #f5f5f5;
  --acento: #134768;
  --ancho: 68rem;
  /* Hero backdrop: swap the file or tune the opacity here, nowhere else. */
  --hero-imagen: url("img/hero_background.png");
  --hero-opacidad: .35;
  /* Contour backdrop for the page body. Colour, strength and fade live here;
     the stroke width lives on the root element of img/curvas_nivel.svg. */
  --curvas-imagen: url("img/curvas_nivel.svg");
  --curvas-color: var(--marca);
  --curvas-opacidad: .10;
  --curvas-corte: 90%;
  /* Height of curvas_nivel.svg once stretched to the full width, from its
     313 x 230 viewBox. Not a free knob: change it and drawing and fade stop
     lining up. */
  --curvas-alto: calc(100vw * 230 / 313);
  /* Hero bottom margin. Shared so the contour backdrop can cancel it out and
     sit flush against the divider. */
  --portada-margen: 2.25rem;
  --radio: 10px;
}

* { box-sizing: border-box; }

/* Always reserve the scrollbar gutter. Without this, filtering down to a few
   cards removes the scrollbar and the whole page jumps wider. */
html {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

body {
  margin: 0;
  /* Column flex plus a growing main: the footer stays at the bottom even on a
     page with almost no content. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--tinta);
  line-height: 1.6;
  /* The contour backdrop is 100vw wide and the scrollbar gutter is always
     reserved, so without this it would push a horizontal scrollbar. `clip`
     rather than `hidden`: it does not create a scroll container. */
  overflow-x: clip;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.contenedor {
  /* width: 100% is load bearing. body is a flex column and `margin: 0 auto`
     cancels the stretch, so without it the container shrinks to fit its
     content: filter down to one dataset card and the whole page narrows. */
  width: 100%;
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 0 1.25rem;
}

a { color: var(--acento); }

main {
  flex: 1 0 auto;
  /* Positioning context and stacking context for the contour backdrop below. */
  position: relative;
  isolation: isolate;
}

/* --- contour backdrop --- */

/* The texture hangs off <main>, so on every page it starts right under the
   hero divider without any page needing its own markup. The SVG is used as a
   mask over a flat colour, which is what keeps --curvas-color working on an
   external file. */
main::before {
  content: "";
  position: absolute;
  z-index: -1;
  /* Pulled up over the hero margin so the drawing touches the divider, and
     ending with main. The box must not be taller than main: sizing it by the
     drawing instead made it overflow on short pages, which added scroll below
     the footer and read as a footer that would not stay down. */
  top: calc(-1 * var(--portada-margen));
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  pointer-events: none;
  background: var(--curvas-color);
  opacity: var(--curvas-opacidad);
  /* Two mask layers, the drawing and the fade. `intersect` keeps only what
     both cover, which is what makes the texture die out downwards. */
  -webkit-mask-image: var(--curvas-imagen),
    linear-gradient(to bottom, #000 0%, transparent var(--curvas-corte));
  mask-image: var(--curvas-imagen),
    linear-gradient(to bottom, #000 0%, transparent var(--curvas-corte));
  /* Both layers get the drawing's natural size: full width, and the height its
     313 x 230 viewBox implies. The fade then ends exactly where the drawing
     ends, at any screen width, without the box having to match that height. */
  -webkit-mask-size: 100% var(--curvas-alto), 100% var(--curvas-alto);
  mask-size: 100% var(--curvas-alto), 100% var(--curvas-alto);
  -webkit-mask-position: center top, center top;
  mask-position: center top, center top;
  -webkit-mask-repeat: no-repeat, no-repeat;
  mask-repeat: no-repeat, no-repeat;
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

/* --- brand bar --- */

.barra-marca {
  background: var(--marca);
  color: #fff;
}

.barra-marca .contenedor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 5.5rem;
  padding-top: .5rem;
  padding-bottom: .5rem;
}

.marca {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: #fff;
  text-decoration: none;
}

.marca img {
  height: 3.4rem;
  width: auto;
  display: block;
}


/* --- header tabs --- */

.solapas {
  display: flex;
  gap: .25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.solapas a {
  display: inline-block;
  padding: .3rem .65rem;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.507);
  text-decoration: none;
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}

.solapas a:hover,
.solapas a:focus-visible {
  background: rgba(255, 255, 255, .16);
  color: #fff;
}

/* A section that exists in the navigation but has no page behind it yet. Same
   box as a tab, dimmer, and nothing to click. */
.solapas .inactiva {
  display: inline-block;
  padding: .3rem .65rem;
  color: rgba(255, 255, 255, .28);
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

.solapas a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.507);
  color: #fff;
}

/* --- hero --- */

.portada {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  text-align: center;
  padding: 3.25rem 0 2.5rem;
  border-bottom: 1px solid var(--linea);
  margin-bottom: var(--portada-margen);
}

/* The image lives on its own layer so the text keeps full contrast. */
.portada::before {
  content: "";
  position: absolute;
  inset: -6%;
  z-index: -1;
  background: var(--hero-imagen) center / cover no-repeat;
  opacity: var(--hero-opacidad);
  /* app.js writes the two offsets on pointer move; both default to 0. */
  transform: translate3d(var(--hero-x, 0px), var(--hero-y, 0px), 0);
  transition: transform .5s cubic-bezier(.22, .61, .36, 1);
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .portada::before { transition: none; transform: none; }
}

.portada h1 {
  margin: 0 0 .75rem;
  font-size: clamp(1rem, 5vw, 5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.05em;
  color: var(--titulo);
}

.bajada {
  margin: 0 auto;
  color: var(--marca-oscura);
  line-height: 1.25;
  font-size: 1rem;
  font-weight: 600;
}

/* Inner pages: shorter hero, no backdrop. The image belongs to the home.
   Title and standfirst are left aligned here; the home hero stays centred. */
.portada-interior { padding: 2.25rem 0 0.5rem; }
.portada-interior::before { content: none; }
.portada-interior h1 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); text-align: left; }
.portada-interior .bajada { text-align: left; }

/* --- map popups --- */

/* Colours stay neutral for now: the layer palette per light/dark/satellite
   mode is still being decided, and the popup should follow it later. */
.leaflet-popup-content {
  margin: .75rem .9rem;
  font-size: .75rem;
  line-height: 1.35;
}

/* Leaflet ships `.leaflet-popup-content p { margin: 1.3em 0 }`, which is more
   specific than a bare class and wins no matter the load order. Both lines of
   the header are <p>, so they were carrying 1.3em of dead space above and
   below. These two rules are scoped to beat it; keep the prefix if you move
   them. */
.leaflet-popup-content .popup-capa {
  margin: 0;
  font-size: .6rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--chip-tema);
}

.leaflet-popup-content .popup-nombre {
  margin: .15rem 0 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--marca);
}

.popup-datos {
  margin-top: .50rem;
  border-collapse: collapse;
  width: 100%;
}

.popup-datos th,
.popup-datos td {
  padding: .2rem 0;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--linea);
}

.popup-datos th {
  padding-right: .8rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--chip-tema);
}

.popup-datos tr:first-child th,
.popup-datos tr:first-child td { border-top: 0; }

/* --- control bar --- */

.barra {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.buscador { flex: 1 1 20rem; }

.buscador input {
  width: 100%;
  padding: .5rem .75rem;
  font: inherit;
  font-size: .9375rem;
  color: var(--tinta);
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 6px;
}

.buscador input:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 1px;
}

.conteo {
  margin: 0;
  font-size: .875rem;
  color: var(--suave);
  font-variant-numeric: tabular-nums;
}

/* --- home --- */

.intro { margin-bottom: 2.5rem; }

.intro h2,
.institucional h2,
.seccion h2 {
  margin: 0 0 .75rem;
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--marca);
}

.intro p,
.institucional p,
.seccion p { margin: 0 0 .9rem; }

/* --- text sections --- */
/* A run of headed prose blocks on an inner page. The section already sits
   inside main.contenedor, so it sets no width of its own: nesting a second
   .contenedor would double the gutter and cap the width twice. */

.seccion { margin-bottom: 2.25rem; }

.seccion:last-child { margin-bottom: 3rem; }

.seccion > p:last-child { margin-bottom: 0; }

.seccion ul {
  margin: 0 0 .9rem;
  padding-left: 1.1rem;
}

.seccion li { margin-bottom: .3rem; }

.seccion .cita-modelo {
  margin: 0 0 .9rem;
  padding: .7rem .9rem;
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  font-size: .875rem;
}

/* Placeholder for a section still to be written. Delete the class once the
   prose is in: it is a note to the editor, not a style. */
.pendiente {
  color: var(--suave);
  font-style: italic;
}

/* A fact still to be confirmed inside prose that is otherwise final: a file
   number, a date, an office name. Highlighted so it cannot go live unnoticed.
   Remove the tag, keep the text. */
.dato-pendiente {
  background: #fff3bf;
  color: inherit;
  padding: 0 .15rem;
  border-radius: 3px;
}

.tarjetas {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 1.75rem;
  row-gap: 1rem;
  margin-bottom: 1.5rem;
}

.tarjeta {
  position: relative;
  display: block;
  padding: 1.1rem 1.1rem;
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, transform .15s ease;
}

/* Hover wash: a tint that fills the card from the bottom up, like something
   loading. It is a pseudo element so nothing about the card itself moves, and
   it sits under the text because the text is raised a layer. */
.tarjeta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
              color-mix(in srgb, var(--marca) 5%, transparent),
              color-mix(in srgb, var(--marca) 5%, transparent) 80%,
              transparent);
  opacity: 0;
  transform: translateY(35%);
  pointer-events: none;
  transition: opacity .5s cubic-bezier(.22, .61, .36, 1),
              transform .5s cubic-bezier(.22, .61, .36, 1);
}

.tarjeta:hover::before,
.tarjeta:focus-visible::before {
  opacity: 1;
  transform: translateY(0);
}

.tarjeta:hover,
.tarjeta:focus-visible {
  border-color: var(--marca);
  transform: translateY(-2px);
}

.tarjeta h3 {
  position: relative;
  margin: 0 0 .35rem;
  font-size: 1rem;
  color: var(--marca);
}

.tarjeta p {
  position: relative;
  margin: 0;
  font-size: .875rem;
  color: var(--suave);
}

.institucional {
  padding-top: 2rem;
  border-top: 1px solid var(--linea);
}

.institucional .contacto { margin-top: 1.25rem; font-size: .9375rem; }

@media (prefers-reduced-motion: reduce) {
  .tarjeta { transition: none; }
  .tarjeta:hover { transform: none; }
  .tarjeta::before { transition: none; transform: none; }
}

/* --- map viewer --- */
/* The viewer breaks out of the shared container: a map wants the screen. The
   side gutters keep it from touching the edge. */

.visor-ancho {
  width: 100%;
  max-width: 110rem;
  margin: 0 auto;
  padding: 0 2rem;
}

.visor {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 1rem;
  /* Header, hero and footer already took their share of the viewport. */
  height: calc(100vh - 17rem);
  min-height: 26rem;
  margin-bottom: .6rem;
}

.panel {
  padding: 1rem;
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  overflow-y: auto;
}

.panel h2 {
  margin: 0 0 .75rem;
  font-size: .8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--suave);
}

.capas {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: .875rem;
}

.grupo {
  margin: .9rem 0 .35rem;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--chip-tema);
}

.grupo:first-child { margin-top: 0; }

.capa label {
  display: flex;
  gap: .5rem;
  align-items: start;
  padding: .2rem 0;
  cursor: pointer;
  line-height: 1.35;
}

.capa input { margin-top: .25rem; accent-color: var(--marca); }

.capa.cargando span { opacity: .5; }
.capa.fallo span { color: #a33; }

.nota-visor { margin: 0; font-size: .8125rem; color: var(--suave); }

/* --- map and its floating controls --- */

.lienzo {
  position: relative;
  /* Control tokens, in the glass style of the transporte-demo viewer. */
  --vidrio-bg: rgba(255, 255, 255, .62);
  --vidrio-desenfoque: blur(20px) saturate(180%);
  --vidrio-brillo: rgba(255, 255, 255, .55);
  --vidrio-borde-arriba: rgba(255, 255, 255, .85);
  --vidrio-hair: #e1e0d9;
  --vidrio-tinta: #0b0b0b;
  --vidrio-apagado: #898781;
  --vidrio-lavado: rgba(11, 11, 11, .08);
}

/* Over a dark base the controls invert, or they glow like a lamp. */
.lienzo.oscuro {
  --vidrio-bg: rgba(46, 46, 44, .63);
  --vidrio-brillo: rgba(255, 255, 255, .16);
  --vidrio-borde-arriba: rgba(255, 255, 255, .22);
  --vidrio-hair: #2c2c2a;
  --vidrio-tinta: #fff;
  --vidrio-apagado: #a9a7a0;
  --vidrio-lavado: rgba(255, 255, 255, .11);
}

.mapa {
  height: 100%;
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  overflow: hidden;
  background: var(--bg);
}

.mapa.mapa-oscuro { background: #141414; }

.mapa .leaflet-container { font: inherit; font-size: .75rem; }

/* Leaflet's own bars follow the same skin. */
.mapa .leaflet-bar,
.mapa .leaflet-control-attribution { border-color: var(--vidrio-hair); }

.ctrl {
  position: absolute;
  z-index: 500;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--vidrio-bg);
  backdrop-filter: var(--vidrio-desenfoque);
  -webkit-backdrop-filter: var(--vidrio-desenfoque);
  border: 1px solid var(--vidrio-hair);
  border-top-color: var(--vidrio-borde-arriba);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(11, 11, 11, .18),
              inset 0 1px 0 var(--vidrio-brillo);
}

.ctrl[hidden] { display: none; }

.ctrl-zoom { top: .75rem; left: .75rem; }

.mando {
  top: .75rem;
  right: .75rem;
  flex-direction: row;
}

.ctrl button {
  font: inherit;
  font-size: .8125rem;
  font-weight: 500;
  display: grid;
  place-items: center;
  padding: 9px 10px;
  color: var(--vidrio-apagado);
  background: none;
  border: none;
  border-bottom: 1px solid var(--vidrio-hair);
  cursor: pointer;
  touch-action: manipulation;
  transition: background .15s ease, color .15s ease, transform .08s ease;
}

.ctrl button:last-child { border-bottom: none; }

/* A row group divides with vertical hairlines instead. */
.mando button {
  border-bottom: none;
  border-right: 1px solid var(--vidrio-hair);
}

.mando button:last-child { border-right: none; }

.ctrl button.ancho { padding: 9px 14px; }

.ctrl button:hover {
  background: var(--vidrio-lavado);
  color: var(--vidrio-tinta);
}

.ctrl button:active { transform: scale(.92); }

.ctrl button:focus-visible {
  outline: 2px solid var(--marca);
  outline-offset: -2px;
}

.ctrl button[aria-pressed="true"] {
  background: var(--marca);
  color: #fff;
}

.ctrl button:disabled {
  opacity: .35;
  pointer-events: none;
}

.ctrl svg { display: block; }

/* Mode button: the icon shows what the click will do, not the current state.
   Moon while the map is light, sun while it is dark. Same pair as the
   transporte-demo viewer. */
#modo[aria-pressed="true"] .icono-luna { display: none; }
#modo[aria-pressed="false"] .icono-sol { display: none; }

@media (prefers-reduced-motion: reduce) {
  .ctrl button { transition: none; }
  .ctrl button:active { transform: none; }
}

/* --- map legend --- */
/* Same glass shell as the other floating controls. It is only in the DOM with
   at least one layer on, so it never sits empty over the map. */

.leyenda {
  right: .75rem;
  bottom: 1.6rem;
  max-width: 13rem;
  max-height: calc(100% - 5rem);
  padding: .55rem .7rem;
  overflow-y: auto;
  gap: .55rem;
  font-size: .75rem;
  line-height: 1.35;
  color: var(--vidrio-tinta);
}

.leyenda-capa p {
  display: flex;
  gap: .4rem;
  align-items: center;
  margin: 0 0 .3rem;
  font-weight: 600;
}

.leyenda-capa:last-child p:last-child { margin-bottom: 0; }

/* Ramp classes: the swatch column lines up, the labels read as a range. */
.leyenda-rampa {
  list-style: none;
  margin: 0;
  padding: 0;
}

.leyenda-rampa li {
  display: flex;
  gap: .4rem;
  align-items: center;
  color: var(--vidrio-apagado);
  font-variant-numeric: tabular-nums;
}

.leyenda-rampa i {
  flex: none;
  width: 14px;
  height: 11px;
  border: 1px solid var(--vidrio-lavado);
  border-radius: 2px;
}

/* Flat layers get one swatch, shaped like the geometry it stands for: a
   rounded box for an area, a dot for a point. */
.leyenda .muestra {
  flex: none;
  width: 12px;
  height: 12px;
  border: 1.5px solid;
  border-radius: 3px;
}

.leyenda .muestra.punto {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.creditos {
  margin: 0 0 2rem;
  font-size: .6875rem;
  line-height: 1.5;
  color: var(--chip-tema);
}

.creditos a { color: inherit; }

@media (max-width: 46rem) {
  .visor-ancho { padding: 0 1.25rem; }
  .visor {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 11rem minmax(0, 1fr);
    height: calc(100vh - 14rem);
  }
}

/* --- dataset cards --- */

/* Two even columns inside the shared page container. The tracks are 1fr each
   so both cards are always the same width, whatever their content. */
.fichas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem 2rem;
  align-items: start;
}

/* The filter hides cards with [hidden]. A lone card keeps the width of one
   column and stays in the left one, so the list does not shift when the filter
   narrows. Nothing to do: it already falls in the first track. */

.ficha {
  position: relative;
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  padding: .85rem 1.05rem;
  font-size: .875rem;
}

@media (max-width: 46rem) {
  .fichas { grid-template-columns: minmax(0, 1fr); }
}

/* Theme chip, pinned to the card's top right corner. */
.etiqueta {
  position: absolute;
  top: .85rem;
  right: 1.05rem;
  white-space: nowrap;
  font-size: .5rem;
  font-weight: 500;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--chip-tema);
  border: 1px solid var(--chip-tema-linea);
  border-radius: 999px;
  padding: .1rem .5rem;
}

/* --- theme filter --- */
/* Hidden until app.js takes over: without JS the chips would do nothing and
   the full list is already on the page. */

.filtros {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1.25rem;
}

.filtros[hidden] { display: none; }

.chip {
  font: inherit;
  font-size: .78125rem;
  font-weight: 500;
  padding: .3rem .7rem;
  color: var(--tinta);
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 999px;
  cursor: pointer;
}

.chip:hover { border-color: var(--marca); }

.chip:focus-visible {
  outline: 2px solid var(--marca);
  outline-offset: 1px;
}

.chip[aria-pressed="true"] {
  background: var(--marca);
  border-color: var(--marca);
  color: #fff;
}

.chip .cuenta {
  font-variant-numeric: tabular-nums;
  opacity: .65;
}

/* --- collapsed detail --- */

.mas { margin: 0 0 .75rem; }

.mas summary {
  font-size: .78125rem;
  color: var(--suave);
  cursor: pointer;
}

.mas summary:hover { color: var(--marca); }

.mas dl { margin-top: .4rem; }

.ficha h2 {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: baseline;
  margin: 0 0 .35rem;
  font-size: 1rem;
  color: var(--marca);
}

.descripcion {
  margin: 0 0 .8rem;
  color: var(--suave);
}

.ficha dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .1rem .9rem;
  margin: 0 0 .75rem;
  font-size: .78125rem;
}

.ficha dt { color: var(--suave); }
.ficha dd { margin: 0; font-variant-numeric: tabular-nums; }

.descargas {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.descargas a {
  display: inline-block;
  padding: .28rem .65rem;
  border: 1px solid var(--linea);
  border-radius: 6px;
  text-decoration: none;
  font-size: .78125rem;
  font-weight: 500;
}

.descargas a:hover,
.descargas a:focus-visible {
  border-color: var(--marca);
  background: var(--marca);
  color: #fff;
}

.sin-resultados {
  padding: 2rem 0;
  text-align: center;
  color: var(--suave);
}

/* --- footer --- */

.pie {
  margin-top: 3.5rem;
  background: var(--pie-bg);
  border-top: 1px solid var(--linea);
  font-size: .75rem;
}

.pie .contenedor {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 3rem;
  justify-content: space-between;
  padding-top: 2rem;
  padding-bottom: 2.5rem;
}

.pie p { margin: 0 0 .3rem; }

.pie a {
  color: var(--suave);
  text-decoration: none;
}

.pie a:hover,
.pie a:focus-visible { color: var(--marca); text-decoration: underline; }

/* Left column: the chain of command, innermost unit first. */
.organigrama {
  border-left: 2px solid var(--linea);
  padding-left: 1rem;
  color: var(--suave);
}

.unidad-fuerte {
  color: var(--titulo);
  font-weight: 600;
}

.legal {
  margin-top: .9rem;
  font-size: .8125rem;
  color: var(--suave);
}

.navegacion .rotulo {
  margin-bottom: .6rem;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--suave);
}

.navegacion ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.navegacion li { margin-bottom: .3rem; }

.navegacion .inactiva {
  color: var(--suave);
  opacity: .55;
  cursor: default;
  user-select: none;
}

/* --- back to top --- */
/* app.js creates this button and toggles .visible. It never exists without
   JS, so there is no dead control to style for. */

.al-tope {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--marca);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18), 0 6px 16px rgba(0, 0, 0, .12);
  opacity: 0;
  transform: translateY(.5rem);
  transition: opacity .18s ease, transform .18s ease, background-color .15s ease;
}

.al-tope.visible {
  opacity: 1;
  transform: none;
}

.al-tope:hover { background: #1b5c85; }

.al-tope:focus-visible {
  outline: 2px solid var(--marca);
  outline-offset: 3px;
}

.al-tope svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-reduced-motion: reduce) {
  .al-tope { transition: none; transform: none; }
}

/* Hidden visually, still read by screen readers. */
.visualmente-oculto {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 46rem) {
  .barra-marca .contenedor { flex-wrap: wrap; }
}

@media (max-width: 40rem) {
  /* No room for a corner chip: it goes back into the flow. */
  .ficha { padding-right: 1.05rem; }
  .etiqueta {
    position: static;
    display: inline-block;
    max-width: none;
    text-align: left;
    margin-bottom: .5rem;
  }
}

@media (max-width: 30rem) {
  .ficha dl { grid-template-columns: 1fr; gap: 0 0; }
  .ficha dt { margin-top: .5rem; }
}
