/* ============================================================================
   RARA · mapa.css — EL MAPA DE ORÍGENES (RIG mission 2026-07-20g).
   Owner ruling on mobile QA: "mejor pone un mapa en donde se vea de dónde
   vienen los perfumes" — the /origen/ default becomes an engraved (intaglio/
   banknote) world map instead of the country-card list. Origen-only overlay
   (?v=1), loaded only from templates/catalog/origen.html.

   Idiom: hairline coastlines + a fine-line hatch fill (SVG <pattern>, no solid
   color mass), a sparse low-opacity graticule — ink on paper, never a colorful
   web-map tile. Markers reuse --stamp-ink exactly like the philatelic sheet
   (origen-marea.css); the fallback when a country's family doesn't resolve to
   an aqua/floral-green bucket is the site's single scarce accent, --burgundy
   (never an arbitrary per-country rainbow — that idiom is the stamps' alone).
   ============================================================================ */

.mapa { margin-top: 8px; }

.mapa-frame {
  position: relative; width: 100%;
  background: var(--surface); border: 1px solid var(--line-2);
  overflow: hidden;
}
.mapa-svg { display: block; width: 100%; height: auto; }

/* Hatch + hairlines: fill is a diagonal fine-line pattern, never solid — the
   land only reads as "land" through line density, exactly like an engraved
   plate. vector-effect keeps both the coastline and the hatch lines a true
   sub-pixel hairline at any responsive width (no scaling with the viewBox). */
.mapa-hatchline {
  stroke: var(--ink); stroke-width: .6; opacity: .38;
  vector-effect: non-scaling-stroke;
}
.mapa-mass {
  fill: url(#mapa-hatch);
  stroke: var(--ink); stroke-width: .75; opacity: .82;
  vector-effect: non-scaling-stroke;
}
/* The 12 origin countries' real landmass, drawn a second time on top of
   .mapa-mass in that country's resolved --stamp-ink (same variable the pins
   and the sellos frame plate already read) at low opacity — "recognizable
   fill", not a solid poster color; the hatch base keeps showing through.
   Falls back to --burgundy (the site's single scarce accent) exactly like
   the pin dot/tooltip, never an arbitrary rainbow. */
.mapa-origin-fill {
  fill: var(--stamp-ink, var(--burgundy)); opacity: .22;
  stroke: none;
}
.mapa-grid-line {
  stroke: var(--line-2); stroke-width: .6; opacity: .55;
  vector-effect: non-scaling-stroke;
}
.mapa-grid-equator, .mapa-grid-meridian { opacity: .8; }

/* ---- Pins: real percentage position (server-computed, catalog/views.py
   _map_xy()), fixed CSS-pixel tap area regardless of map scale. ------------- */
.mapa-pins { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; }
.mapa-pin-wrap {
  position: absolute; transform: translate(-50%, -50%);
  /* z-index sets a stable default stack order (view's count-desc iteration);
     :hover/:focus-within below always wins regardless of this base value. */
}
.mapa-pin-wrap:hover, .mapa-pin-wrap:focus-within { z-index: 999 !important; }

.mapa-pin {
  position: relative; display: inline-flex; align-items: center; gap: 3px;
  /* The 44px-minimum tap target (WCAG 2.5.8): padding expands the hit area,
     the equal negative margin cancels its effect on the visual layout so the
     dot itself stays pinned exactly at the true lat/lon point. In the crowded
     Western-Europe cluster (7 of the 12 origin countries sit within a few
     degrees of each other) neighboring pins' hit areas can still overlap at
     small viewport widths — an inherent limit of a full world map at phone
     scale, not something padding alone can fix. The Índice list below is the
     guaranteed, non-overlapping way to reach every country; these pins are a
     map-surface enhancement on top of it. */
  padding: 17px; margin: -17px;
  text-decoration: none; color: inherit;
}
.mapa-dot {
  display: block; width: var(--mr, 8px); height: var(--mr, 8px);
  border-radius: 50%;
  background: var(--stamp-ink, var(--burgundy));
  box-shadow: 0 0 0 1px var(--surface, #fff);
  transition: transform var(--dur-fast, .2s) var(--ease-out, ease);
}
.mapa-pin:hover .mapa-dot, .mapa-pin:focus-visible .mapa-dot { transform: scale(1.25); }

/* Always-on count read-out beside the dot (honest, no invented tiers) — a
   soft backing keeps it legible over both the hatch and neighboring labels. */
.mapa-n {
  font-size: 8px; line-height: 1; letter-spacing: .01em;
  color: var(--stamp-ink, var(--burgundy));
  background: rgba(255, 255, 255, .72); padding: 1px 2px;
  white-space: nowrap;
}

/* Hover/focus tooltip — the mist-chip idiom (matches .cel-raw-tip, pdp.css):
   opaque cream chip, oxblood-tinted hairline, ink text. Pure CSS (no JS
   required) so it works identically for mouse hover and keyboard focus. */
.mapa-tip {
  position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 2;
  transform: translateX(-50%);
  background: rgba(238, 240, 234, .95); color: var(--ink);
  border: 1px solid rgba(74, 22, 34, .4); border-radius: 3px;
  font-size: 11px; letter-spacing: .02em; white-space: nowrap; padding: 3px 7px;
  opacity: 0; pointer-events: none;
  transition: opacity 180ms var(--ease-out, ease);
}
.mapa-pin:hover .mapa-tip, .mapa-pin:focus .mapa-tip, .mapa-pin:focus-visible .mapa-tip {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .mapa-dot, .mapa-tip { transition: none; }
}

/* ---------------------------------------------------------------------------
   Índice — the guaranteed, uncluttered a11y/no-JS list under the map. Same
   links as the pins; full-height rows clear the 44px tap target on their own
   (no padding trick needed, block-level rows already have the room).
   --------------------------------------------------------------------------- */
.mapa-index { margin-top: 30px; }
.mapa-index-head {
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--warm-grey);
  border-top: 1px solid var(--line-2); padding-top: 14px; margin-bottom: 4px;
}
.mapa-index-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  column-gap: 24px;
}
.mapa-index-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; box-sizing: border-box; padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  text-decoration: none; color: var(--ink);
  transition: color var(--dur-fast, .2s) var(--ease-out, ease);
}
.mapa-index-list a:hover, .mapa-index-list a:focus-visible { color: var(--burgundy); }
.mapa-index-name { font-family: var(--serif); font-size: 15px; }
.mapa-index-n { font-family: var(--mono); font-size: 11px; color: var(--warm-grey); white-space: nowrap; }
.mapa-index-list a:hover .mapa-index-n, .mapa-index-list a:focus-visible .mapa-index-n { color: var(--burgundy); }

@media (max-width: 600px) {
  .mapa-index-list { grid-template-columns: 1fr; }
}

/* ============================================================================
   CARTOGRAFÍA DE LAS CASAS, Phase 2 — SEMANTIC ZOOM UI (RIG mission
   2026-07-22). Loaded from templates/catalog/origen_carto.html ONLY
   (?origen=carto review param); reuses every primitive above (.mapa-frame,
   .mapa-svg, .mapa-mass, .mapa-hatchline, .mapa-origin-fill, .mapa-pin*,
   .mapa-index*) — this block adds ONLY the level-chrome furniture: the
   multi-segment breadcrumb, the data panel, the honest-zero Índice row
   treatment, the editorial-plate mark/hairline, and the mobile índice-first
   layout order. No new color system — editorial furniture reuses --warm-grey/
   --line-2 mono treatment already established by .mapa-index-head.
   ============================================================================ */

.carto-crumb { display: block; }
.carto-crumb a, .carto-crumb-current { font-size: 11px; letter-spacing: .04em; }
.carto-crumb-current { color: var(--ink); }
/* Editorial breadcrumb/Índice segments carry an explicit mono "RECORRIDO
   EDITORIAL" mark + a distinct (dashed, not solid) hairline treatment so a
   camera preset can never be mistaken for canonical M49 geography at a
   glance (owner law: "M49 clearly separated from editorial plates"). */
.carto-editorial-mark {
  font-size: 9px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--burgundy); border: 1px dashed var(--burgundy);
  border-radius: 2px; padding: 1px 4px; margin-right: 4px;
}
.carto-crumb a.is-editorial, .carto-crumb-current.is-editorial { color: var(--burgundy); }

.carto-nav { display: flex; gap: 18px; margin-top: 16px; }
.carto-nav-link {
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  color: var(--warm-grey); text-decoration: none;
  border-bottom: 1px solid var(--line-2);
  transition: color var(--dur-fast, .2s) var(--ease-out, ease);
}
.carto-nav-link:hover, .carto-nav-link:focus-visible { color: var(--burgundy); border-color: var(--burgundy); }

/* Layout (owner rejection #2, 2026-07-22: "media queries no funcionan,
   desorganización total" at ~1017px and ~2000px) — three real breakpoints,
   DOM order (map, folio, índice — templates/catalog/origen_carto.html was
   reordered to match, never a CSS `order` trick that would desync visual
   from reading/focus order):
     <=640   mobile: single column, map full-width, folio right after it,
             índice last (the world-tier rail below becomes its own
             horizontal-scroll strip so it never wraps into chip soup).
     641-1024: still single column (stacked) but the rail's two tiers get a
             visually distinct register (below) instead of both looking like
             one undifferentiated pill soup.
     >=1025: map+índice beside a fixed-width folio column — "index" shares
             the SAME grid-area column as "map" across two rows so the
             Índice always sits directly under the map, never pushed below
             a tall folio.
     >=1680: an internal max-width cap independent of the site-wide --wrap
             (tokens.css grows --wrap to 2400px on 4K/ultra-wide, which is
             tuned for product grids, not this atlas) — the map stops
             ballooning and the folio never detaches into dead whitespace. */
.carto-layout { display: flex; flex-direction: column; gap: 22px; margin-top: 24px; }
.carto-map-col, .carto-index-col, .carto-panel-col { min-width: 0; }

@media (min-width: 1025px) {
  .carto-layout {
    display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 340px);
    grid-template-areas: "map panel" "index panel";
    column-gap: 40px; row-gap: 22px; align-items: start;
  }
  .carto-map-col { grid-area: map; }
  .carto-panel-col { grid-area: panel; position: sticky; top: 88px; }
  .carto-index-col { grid-area: index; }
}

@media (min-width: 1680px) {
  .carto-layout { max-width: 1900px; margin-inline: auto; }
}

/* Outer plate margins (owner rejection 2026-07-23: "muchos espacios vacíos…
   disminuir los márgenes externos para permitir que sea más grande") — the
   atlas's own <div class="wrap dir-page carto-page"> (origen_carto.html)
   deserves more width than the site's shared --wrap default (tokens.css,
   tuned for text directories/product grids). A two-class selector beats the
   plain `.wrap` rule (base.css) in specificity, so ONLY this page's wrap
   instance widens — every other .wrap page on the site is byte-identical,
   untouched. Inner rhythm (.carto-layout's own gap/column-gap/row-gap, the
   rail/panel/índice spacing below) is completely unchanged — only the dead
   frame around the whole plate shrinks. */
.wrap.carto-page {
  max-width: 1680px;
  padding-inline: clamp(12px, 2vw, 32px);
}
@media (min-width: 1920px) {
  .wrap.carto-page { max-width: 2040px; }
}
@media (min-width: 2560px) {
  .wrap.carto-page { max-width: 2300px; }
}

/* Aggregate node markers (region/subregion/placa) vs. country pins: the SAME
   .mapa-pin/.mapa-dot primitive, differentiated by a slightly larger,
   squared dot so a "zoom into this continent" control never reads as a
   country reference at a glance. Editorial-plate markers get the dashed
   hairline ring, same idiom as the breadcrumb mark above. */
.carto-node-pin.is-node .carto-dot { border-radius: 2px; width: 10px; height: 10px; }
.carto-node-pin.is-editorial .carto-dot { outline: 1px dashed var(--burgundy); outline-offset: 2px; }
.carto-node-pin.is-current .carto-dot {
  width: 14px; height: 14px;
  box-shadow: 0 0 0 3px var(--surface, #fff), 0 0 0 4px var(--stamp-ink, var(--burgundy));
}

/* Honest-zero markers (owner rejection 2026-07-22 15:39): a real pin for a
   0-coverage node, hollow/muted so it never reads as phantom inventory next
   to a populated (filled) dot — never a lock/deficit idiom, matching the
   Índice's own "abierto" treatment. Populated pins (.mapa-dot's base filled
   rule) are completely untouched by this. */
.carto-node-pin.is-empty .carto-dot {
  background: transparent; border: 1.5px solid var(--warm-grey);
  box-shadow: none;
}
.carto-node-pin.is-empty:hover .carto-dot, .carto-node-pin.is-empty:focus-visible .carto-dot {
  border-color: var(--stamp-ink, var(--burgundy)); transform: none;
}

/* Country landmass fills that ARE real navigation (subregion/placa levels):
   a visible hover/focus lift so the shape reads as interactive, matching the
   pin idiom's own hover scale. Decorative fills (.mapa-origin-fill without
   .carto-fill-link) are untouched, unchanged from the default map. */
.carto-fill-link { transition: opacity var(--dur-fast, .2s) var(--ease-out, ease); cursor: pointer; }
.carto-origin-land-live a:hover .carto-fill-link,
.carto-origin-land-live a:focus-visible .carto-fill-link { opacity: .42; }
.carto-fill-current { opacity: .34; }

/* Índice: honest-zero rows read as OPEN, not deficient — a quiet "abierto"
   tag, never a greyed-out/disabled treatment (owner law: never a lock, never
   a rank). Editorial rows (via the plates lane) get the same dashed-hairline
   mark as the breadcrumb/marker idiom above, on the row's LEFT edge instead
   of a bottom rule, so the plates lane never visually merges with the M49
   Índice above it despite sharing the exact same list markup. */
.carto-idx-row.is-empty .carto-idx-n { color: var(--warm-grey); font-style: italic; }
.carto-idx-row.is-editorial > a { border-left: 2px dashed var(--burgundy); padding-left: 10px; }
.carto-plates-lane { margin-top: 18px; }
/* Vertical rhythm (owner rejection #2, "poor space/color use" — seas of
   whitespace between plate/folio/índice): scoped to the atlas ONLY (the
   plain /origen/ map's own .mapa-index base rule above, origen.html, is
   untouched) — .carto-layout's own flex/grid gap already separates
   map/panel/índice as blocks, so the FIRST block inside the índice column
   doesn't also need the generic page's full 30px stacked on top of that gap.
   Higher specificity than .carto-plates-lane above so it only zeroes the
   column's first child (whichever of the two that is); the plates lane
   still gets its own 18px separation from the índice list above it in the
   normal (both-present) case, where it is NOT :first-child. */
.carto-index-col > .mapa-index:first-child { margin-top: 0; }
.carto-editorial-head { color: var(--burgundy); }
.carto-editorial-note {
  font-size: 12px; color: var(--warm-grey); max-width: 46ch;
  margin: 4px 0 12px;
}

/* Data panel: opaque --surface card, never overlaid on the map itself, so
   WCAG contrast never depends on whatever ink/hatch happens to sit behind it
   (owner law: "WCAG floors on the data panel over any fills"). */
.carto-panel {
  background: var(--surface); border: 1px solid var(--line-2);
  padding: 20px 22px;
}
.carto-panel-stats {
  display: flex; gap: 22px; flex-wrap: wrap; margin: 0 0 14px;
}
.carto-stat dt {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--warm-grey); margin: 0 0 3px;
}
.carto-stat dd { font-size: 20px; margin: 0; color: var(--ink); }
.carto-dominant {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink); margin: 0 0 14px;
}
.carto-dominant-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--stamp-ink, var(--burgundy));
}
.carto-rep {
  display: flex; gap: 14px; text-decoration: none; color: inherit;
  border-top: 1px solid var(--line); padding-top: 16px;
}
.carto-rep-img { width: 64px; height: 64px; flex: none; background: var(--cream); }
.carto-rep-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carto-rep-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.carto-rep-label { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--warm-grey); }
.carto-rep-house { font-size: 10px; color: var(--warm-grey); }
.carto-rep-name { font-family: var(--serif); font-size: 15px; }
.carto-rep-status { font-size: 10px; color: var(--burgundy); }
.carto-rep:hover .carto-rep-name, .carto-rep:focus-visible .carto-rep-name { color: var(--burgundy); }
.carto-open-note {
  font-size: 13px; color: var(--warm-grey); font-style: italic;
  border-top: 1px solid var(--line); padding-top: 16px; margin: 0;
}

/* Folio -> catálogo CTA (owner spec "Folio / conexión a catálogo"): a real
   link, styled as an opaque cream chip — same mist-chip idiom as .mapa-tip
   (opaque cream over imagery, never a solid poster color) — that carries the
   removable "País de la casa" filter through to /catalogo/?origin=...; the
   × mark is decorative here (aria-hidden), the ACTUAL removable-chip control
   is the destination catalog page's own existing chips bar. */
.carto-cta {
  display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12px; letter-spacing: .02em; color: var(--ink); text-decoration: none;
}
.carto-cta:hover, .carto-cta:focus-visible { color: var(--burgundy); }
.carto-cta-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .02em;
  background: rgba(238, 240, 234, .95); color: var(--ink);
  border: 1px solid rgba(74, 22, 34, .4); border-radius: 3px;
  padding: 4px 8px; min-height: 24px;
}

@media (prefers-reduced-motion: reduce) {
  .carto-nav-link, .carto-fill-link, .carto-rep-name { transition: none; }
}

/* Folio composición, increment 1 (owner order 2026-07-24: "usar tooodo ese
   espacio, siempre te quedas con lo mínimo") — a real riel of up to 6
   references for THIS ámbito, DIRECTLY below the single .carto-rep pick, and
   (país only) up to 4 clickable dominant accords. Same idiom as everything
   else in this panel: hairline separators (var(--line)), one quiet mono
   eyebrow label, serif product names, and the single scarce accent
   (--burgundy) reserved for hover/focus — no new color, no new type scale. */
.carto-folio-rail, .carto-folio-acordes {
  border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px;
}
.carto-folio-label {
  font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--warm-grey); margin: 0 0 10px;
}
.carto-folio-list { list-style: none; margin: 0; padding: 0; }
.carto-folio-item + .carto-folio-item { margin-top: 10px; }
.carto-folio-item a {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; text-decoration: none; color: inherit;
}
.carto-folio-img { width: 40px; height: 40px; flex: none; background: var(--cream); }
.carto-folio-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carto-folio-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.carto-folio-house {
  font-size: 10px; letter-spacing: .02em; color: var(--warm-grey);
}
.carto-folio-name {
  font-family: var(--serif); font-size: 13px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.carto-folio-status { font-size: 9px; letter-spacing: .04em; color: var(--warm-grey); }
.carto-folio-item a:hover .carto-folio-name,
.carto-folio-item a:focus-visible .carto-folio-name { color: var(--burgundy); }

.carto-folio-acordes-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.carto-folio-acordes-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 36px; padding: 4px 0;
  text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--line);
  font-size: 12px; letter-spacing: .02em;
}
.carto-folio-acorde-n { font-size: 10px; color: var(--warm-grey); }
/* Herbario grabado (owner 2026-07-24): glyph lives inside .carto-folio-acorde-name
   itself (not a 3rd flex child of the <a>) so the existing name<->count
   space-between layout is untouched; components.css .glifo sets size/color. */
.carto-folio-acorde-name .glifo { vertical-align: -2px; }
.carto-folio-acordes-list a:hover, .carto-folio-acordes-list a:focus-visible { color: var(--burgundy); }
.carto-folio-acordes-list a:hover .carto-folio-acorde-n,
.carto-folio-acordes-list a:focus-visible .carto-folio-acorde-n { color: var(--burgundy); }

@media (prefers-reduced-motion: reduce) {
  .carto-folio-item a, .carto-folio-acordes-list a { transition: none; }
}

/* Scale rail (owner rejection 2026-07-22 15:39, refined 2026-07-22 rejection
   #2 "poor space/color use"): persistent, docked to the map plate itself
   (.carto-map-col, ABOVE the SVG) so all children of the current level are
   always visible — never buried below the fold like the Índice further down
   can be on a tall viewport.
   Tier A (.carto-rail-world) = the 5 continents, ALWAYS present — QUIET,
   secondary register: mono/uppercase, hairline-only, muted ink, so it reads
   as a persistent compass rather than competing with the page's own subject.
   Tier B (.carto-rail-current) = the CURRENT level's own children — the
   PROMINENT register: serif name, opaque card, --line-2 border — this is
   what the visitor is actually choosing among right now. Both real <a href>,
   44px targets at every width (a11y floor, never traded for density). */
.carto-rail { margin-bottom: 18px; }
.carto-rail-tier + .carto-rail-tier { margin-top: 12px; }
.carto-rail-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.carto-rail-item a {
  display: flex; align-items: center; gap: 7px;
  min-height: 44px; box-sizing: border-box; padding: 6px 12px;
  background: var(--surface); border: 1px solid var(--line-2);
  text-decoration: none; color: var(--ink);
  font-size: 12px; letter-spacing: .02em;
  transition: border-color var(--dur-fast, .2s) var(--ease-out, ease),
              color var(--dur-fast, .2s) var(--ease-out, ease),
              background-color var(--dur-fast, .2s) var(--ease-out, ease);
}
.carto-rail-item a:hover, .carto-rail-item a:focus-visible {
  color: var(--burgundy); border-color: var(--burgundy);
}
.carto-rail-name { font-family: var(--serif); font-size: 13px; }
.carto-rail-n { font-size: 10px; color: var(--warm-grey); white-space: nowrap; }
.carto-rail-item.is-empty .carto-rail-n { font-style: italic; }
.carto-rail-item.is-editorial a { border-left: 2px dashed var(--burgundy); }

/* Tier A — quiet/secondary: no card surface, hairline underline only, small
   uppercase mono label (this is a compass, not a choice list). */
.carto-rail-world .carto-rail-item a {
  background: transparent; border: none; border-bottom: 1px solid var(--line-2);
  border-radius: 0; padding: 6px 10px 6px 2px;
}
.carto-rail-world .carto-rail-name {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--warm-grey);
}
.carto-rail-world .carto-rail-item a:hover .carto-rail-name,
.carto-rail-world .carto-rail-item a:focus-visible .carto-rail-name { color: var(--burgundy); }
.carto-rail-world .carto-rail-item a:hover,
.carto-rail-world .carto-rail-item a:focus-visible { border-color: var(--burgundy); }
/* The ONE saturated moment on the rail: the continent we're presently inside,
   a solid --burgundy fill (never just a border tint) — the single scarce
   accent this page spends, everything else on the rail stays quiet ink. */
.carto-rail-world .carto-rail-item a[aria-current="page"] {
  background: var(--burgundy); border-color: var(--burgundy);
}
.carto-rail-world .carto-rail-item a[aria-current="page"] .carto-rail-name,
.carto-rail-world .carto-rail-item a[aria-current="page"] .carto-rail-n {
  color: var(--cream);
}

/* Tier B — prominent/opaque card, the current level's real choice set. */
.carto-rail-current .carto-rail-item a { background: var(--surface); border: 1px solid var(--line-2); }
.carto-rail-current .carto-rail-name { font-family: var(--serif); font-size: 14px; }
.carto-rail-current .carto-rail-item a[aria-current="page"] {
  border-color: var(--burgundy); color: var(--burgundy);
}

@media (max-width: 640px) {
  /* World tier becomes a compact horizontal-scroll rail ("carril horizontal")
     instead of wrapping — the current-tier chips below it still wrap freely
     (short list, 5 continents max never needs more than one scrollable row). */
  .carto-rail-world .carto-rail-list {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 4px; scrollbar-width: thin;
  }
  .carto-rail-world .carto-rail-item { flex: none; }
  .carto-rail-current .carto-rail-list { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .carto-rail-item a { transition: none; }
}

/* Índice carto: the long dual counts ("0 Disponible · 70 Próximamente") overflowed the
   210px auto-fill columns (nowrap) and collided with the neighbor name at world level.
   Wider min column + wrapping counts, right-aligned so the hairline row stays legible. */
.carto-index-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.carto-index-list .carto-idx-n { white-space: normal; text-align: right; max-width: 55%; }

/* ============================================================================
   ESTILO ATLAS DE LAS SALAS, ported into el mapa de orígenes (owner order
   2026-07-24, verbatim: "necesito que copies exactamente el estilo de ese
   mapa y lo pases también para el mapa de orígenes"). "Ese mapa" =
   templates/catalog/_soon_atlas.html + static/css/soon-atlas.css's own
   "immersive review: full-bleed cartographic cabinet" block (its final
   ~200 lines) — ported here as an ADDITIVE override, same technique that
   file itself uses (later rules of equal specificity win the cascade), so
   every rule ABOVE this point in mapa.css — the whole Phase-1 map, EVERY
   Phase-2 carto rule (rail/panel/índice/plates-lane grid areas, sticky
   panel, the 1025/1680px breakpoints) — stays byte-identical. Only the
   MAP's own framing/background changes; the grid-template-areas contract
   ("map panel" / "index panel") the owner's rejection #2 hardened is
   UNTOUCHED, so the panel/índice relationship never regresses.

   NOT SHARED WITH soon-atlas.css: the two pages load separate CSS files
   (soon.html -> soon-atlas.css; origen_carto.html -> mapa.css) and this
   worker's mission explicitly allows either shared extraction OR a
   documented local copy ("si es más seguro copiar con prefijo propio,
   hazlo pero deja comentario"). Copy-with-prefix was chosen: extracting a
   shared partial would require also editing _soon_atlas.html/soon-atlas.css
   — files for the ALREADY OWNER-APPROVED, separately-deployed Atlas de las
   Salas, outside this branch's own test coverage (catalog.test_soon_atlas
   isn't part of this mission's verification loop) — so touching them here
   would risk an unverified regression on a page this worker cannot
   re-certify. Every rule below is prefixed `.carto-*`/`.mapa-*` (already
   this page's own namespace), never `.soon-atlas-*`.
   ============================================================================ */

/* 1) EL MAPA GRANDE A SANGRE — full-bleed cabinet (item B1, the core ask).
   `.carto-layout` is a direct child of `.wrap.carto-page` (margin:0 auto,
   base.css .wrap rule) — already horizontally centered in the viewport, so
   the classic `width:100vw;margin-left:calc(50% - 50vw)` escape re-centers
   correctly on the true viewport edges (unconditional, no cap, exactly
   like .soon-atlas-layout — NOT the same shape as the `.wrap.carto-page`
   max-width escalation above, which still governs the page HEADER only). */
.carto-page { overflow-x: clip; }
.carto-layout {
  position: relative;
  width: 100vw;
  max-width: none; /* supersedes the @media(min-width:1680px) cap above — the
                       whole layout region now bleeds instead of centering
                       inside a fixed ceiling. */
  margin-left: calc(50% - 50vw);
  margin-inline-start: calc(50% - 50vw);
  padding: clamp(18px, 2.4vw, 40px) clamp(16px, 2.8vw, 48px) clamp(28px, 3.6vw, 56px);
  box-sizing: border-box;
  background:
    radial-gradient(circle at 15% 18%, rgba(73, 139, 132, .09), transparent 31%),
    radial-gradient(circle at 84% 72%, rgba(74, 22, 34, .07), transparent 34%),
    repeating-linear-gradient(101deg, rgba(74, 22, 34, .018) 0, rgba(74, 22, 34, .018) 1px, transparent 1px, transparent 13px),
    linear-gradient(126deg, #f9f7f2, #f4f0e9 52%, #faf8f4);
}
@supports (background: color-mix(in srgb, #000 10%, transparent)) {
  .carto-layout {
    background:
      radial-gradient(circle at 15% 18%, color-mix(in srgb, var(--carto-room-accent, #4a1622) 10%, transparent), transparent 31%),
      radial-gradient(circle at 84% 72%, rgba(74, 22, 34, .07), transparent 34%),
      repeating-linear-gradient(101deg, rgba(74, 22, 34, .018) 0, rgba(74, 22, 34, .018) 1px, transparent 1px, transparent 13px),
      linear-gradient(126deg, #f9f7f2, #f4f0e9 52%, #faf8f4);
  }
}
/* Secant-paper grain, identical recipe to .soon-atlas-layout::before. */
.carto-layout::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: radial-gradient(rgba(35, 24, 25, .15) .45px, transparent .55px);
  background-size: 7px 7px; mix-blend-mode: multiply;
}
.carto-layout > * { position: relative; z-index: 1; }

/* The map plate itself: bigger, generous framing, its own cabinet gradient +
   drop shadow — scoped to .carto-frame (Phase 2's own class on the inner
   bordered box) so the LEGACY /origen/ default map's plain .mapa-frame
   (templates/catalog/origen.html, ?origen=mapa) is completely untouched. */
.carto-map-col { position: relative; z-index: 1; width: 100%; max-width: 3200px; margin-inline: auto; }
.carto-frame {
  isolation: isolate;
  border-color: rgba(74, 22, 34, .28);
  background:
    linear-gradient(to right, transparent calc(25% - .5px), rgba(74, 22, 34, .09) 25%, transparent calc(25% + .5px)),
    linear-gradient(to right, transparent calc(50% - .5px), rgba(74, 22, 34, .09) 50%, transparent calc(50% + .5px)),
    linear-gradient(to right, transparent calc(75% - .5px), rgba(74, 22, 34, .09) 75%, transparent calc(75% + .5px)),
    linear-gradient(to bottom, transparent calc(50% - .5px), rgba(74, 22, 34, .09) 50%, transparent calc(50% + .5px)),
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, .94), rgba(250, 248, 243, .82) 68%, rgba(73, 139, 132, .055));
  box-shadow: 0 28px 74px rgba(35, 24, 25, .08), inset 0 0 0 1px rgba(255, 255, 255, .72);
}
.carto-frame .mapa-svg { min-height: 340px; }

/* 2) Secant-paper accent already applied at the layout level above (item B2)
   — the room-accent custom property is read straight off panel.accord_hex
   (catalog/views.py._origen_carto, accord_color.family_hex(dominant_family)),
   never invented here.

   3) Density fill + legend (item B3). `.carto-page` scoping keeps the plain
   /origen/ default map (origen.html, shares .mapa-origin-fill) on its
   original fixed .22 opacity — only this atlas gets the graduated read. */
.carto-page .mapa-origin-fill { opacity: var(--carto-fill-opacity, .22); }
.carto-page .mapa-origin-fill.is-empty {
  fill: url(#mapa-hatch); stroke: var(--warm-grey); stroke-width: .5; stroke-dasharray: 2 2;
}
.carto-map-notes {
  display: flex; justify-content: flex-end; padding: 10px 2px 0;
}
.carto-legend {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 14px;
  color: var(--warm-grey); font-family: var(--mono); font-size: 10px;
}
.carto-legend > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.carto-legend i { display: block; width: 13px; height: 9px; border: 1px solid var(--warm-grey); }
.carto-legend i.has-references { border-color: var(--burgundy); background: rgba(74, 22, 34, .18); }
.carto-legend i.is-open {
  background:
    repeating-linear-gradient(135deg, transparent 0, transparent 3px, rgba(74, 22, 34, .16) 3px, rgba(74, 22, 34, .16) 4px),
    rgba(73, 139, 132, .13);
}
.carto-legend i.is-current { border: 2px solid var(--burgundy); background: var(--surface); }

/* 4) Tooltip (item B4) — the mist-chip idiom, same opaque cream/oxblood-
   hairline treatment as .mapa-tip, but JS-positioned near the pointer over
   an irregular country-fill shape (a fixed CSS :hover position can't track
   an arbitrary polygon the way it can a small fixed-size pin dot). Ported
   from _soon_atlas.html's showTip()/hideTip() (see carto-zoom.js). */
.carto-tip {
  position: absolute; z-index: 9; left: 0; top: 0;
  max-width: min(240px, 70vw); padding: 6px 9px;
  border: 1px solid rgba(74, 22, 34, .4);
  background: rgba(238, 240, 234, .96);
  box-shadow: 0 10px 26px rgba(35, 24, 25, .12);
  color: var(--ink); font-family: var(--mono); font-size: 10px; letter-spacing: .02em; line-height: 1.4;
  opacity: 0; pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  transition: opacity 120ms ease;
}
.carto-tip[data-visible="true"] { opacity: 1; }

@media (min-width: 1025px) {
  .carto-map-notes { padding-top: 4px; }
}
@media (max-width: 640px) {
  .carto-legend { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .carto-tip { transition: none; }
}
@media (forced-colors: active) {
  .carto-page .mapa-origin-fill { fill: Canvas; stroke: CanvasText; }
  .carto-tip { border-color: CanvasText; }
}
