/* ───────── Fuentes (autoalojadas) ───────── */
@font-face { font-family: "Bricolage Grotesque"; font-weight: 300; font-style: normal; font-display: swap; src: url("fonts/bricolage-300.ttf") format("truetype"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/bricolage-500.ttf") format("truetype"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/bricolage-700.ttf") format("truetype"); }
@font-face { font-family: "Literata"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/literata-400.ttf") format("truetype"); }
@font-face { font-family: "Literata"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/literata-600.ttf") format("truetype"); }
@font-face { font-family: "Literata"; font-weight: 400; font-style: italic; font-display: swap; src: url("fonts/literata-400i.ttf") format("truetype"); }

/* ───────── Tokens ─────────
   Paleta derivada de Cividis, la rampa que el protocolo del proyecto
   recomienda para que los mapas sean legibles con daltonismo. */
:root {
  --hielo-0: #00204d;
  --hielo-1: #31446b;
  --roca: #666970;
  --arena: #c8b866;
  --oasis: #ffe945;
  --nieve: #f2f5f7;
  --papel: #ffffff;
  --tinta: #0d1b2e;
  --tinta-suave: #4a5668;
  --linea: #d3dae2;

  /* cinco campos de un nombre de archivo (distinguibles sin color: se rotulan) */
  --c1: #00204d; --c2: #5b4b00; --c3: #31446b; --c4: #6b5a00; --c5: #2b5f8a;

  --f-titulo: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --f-texto: "Literata", Georgia, "Times New Roman", serif;

  --paso--1: clamp(.875rem, .85rem + .1vw, .9375rem);
  --paso-0: clamp(1.0625rem, 1rem + .3vw, 1.1875rem);
  --paso-1: clamp(1.25rem, 1.1rem + .7vw, 1.6rem);
  --paso-2: clamp(1.75rem, 1.4rem + 1.6vw, 2.6rem);
  --paso-5: clamp(2.5rem, 1.4rem + 5.2vw, 5.6rem);

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --ancho: 72rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--nieve);
  color: var(--tinta);
  font-family: var(--f-texto);
  font-size: var(--paso-0);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--f-titulo); margin: 0; line-height: 1.08; letter-spacing: -.02em; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--oasis); outline-offset: 3px; box-shadow: 0 0 0 6px var(--hielo-0); border-radius: 2px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--ancho)); margin-inline: auto; }
.skip { position: absolute; left: var(--gutter); top: -4rem; background: var(--oasis); color: var(--hielo-0); padding: .6rem 1rem; z-index: 10; font-family: var(--f-titulo); font-weight: 500; }
.skip:focus { top: .75rem; }

/* ───────── Portada ───────── */
.hero { background: var(--hielo-0); color: #fff; position: relative; overflow: hidden; }
.hero__text { padding-top: clamp(2.5rem, 7vw, 5.5rem); position: relative; z-index: 1; }
.hero__org { font-family: var(--f-titulo); font-weight: 500; font-size: var(--paso--1); color: #b9c8de; letter-spacing: .01em; margin-bottom: 1.25rem; }
.hero h1 {
  font-weight: 700;
  font-size: var(--paso-5);
  line-height: .98;
  letter-spacing: -.035em;
  max-width: 17ch;
}
.hero__lead { margin-top: 1.5rem; max-width: 40ch; font-size: var(--paso-1); line-height: 1.45; color: #dbe5f3; }

.profile { display: block; width: 100%; height: auto; aspect-ratio: 1600 / 560; margin-top: 1rem; }
@media (max-width: 40rem) { .profile { aspect-ratio: auto; height: 14rem; margin-top: 0; } }
.ejes { display: flex; justify-content: space-between; gap: 1rem; margin-top: -.25rem; padding-top: .5rem; font-family: var(--f-titulo); font-weight: 500; font-size: var(--paso--1); color: #b9c8de; }
.profile .capa { transition: opacity .25s ease, filter .25s ease; }

/* El perfil se dibuja una sola vez al cargar. */
.profile path[data-capa="caudales"] { stroke-dasharray: 2600; stroke-dashoffset: 2600; animation: fluye 2.6s .3s cubic-bezier(.4,.1,.2,1) forwards; }
@keyframes fluye { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .profile path[data-capa="caudales"] { animation: none; stroke-dashoffset: 0; }
}

/* Al resaltar una capa, las demás bajan de intensidad. */
.profile.is-focus .capa { opacity: .22; }
.profile.is-focus .capa.is-on { opacity: 1; filter: drop-shadow(0 0 6px rgba(255, 233, 69, .55)); }

.capas {
  display: flex; flex-wrap: wrap; gap: .5rem .5rem;
  padding-block: 1.25rem 2rem;
  background: var(--hielo-0);
  margin-inline: auto;
}
.hero .capas { width: 100%; max-width: none; padding-inline: max(var(--gutter), calc((100% - var(--ancho)) / 2)); }
.capas a {
  font-family: var(--f-titulo); font-weight: 500; font-size: var(--paso--1);
  text-decoration: none; color: #fff;
  border: 1px solid rgba(255, 255, 255, .35);
  padding: .5rem .9rem; border-radius: 999px;
  transition: background-color .2s, color .2s, border-color .2s;
}
.capas a:hover, .capas a.is-on { background: var(--oasis); color: var(--hielo-0); border-color: var(--oasis); }

/* ───────── Secciones ───────── */
section { padding-block: clamp(3rem, 8vw, 6.5rem); }
h2 { font-size: var(--paso-2); font-weight: 700; }
.sub { margin-top: .9rem; color: var(--tinta-suave); max-width: 52ch; }

.intro h2 { max-width: 20ch; }
.intro__cols { margin-top: 2rem; display: grid; gap: 1.5rem 3rem; grid-template-columns: 1fr; max-width: 62ch; }
@media (min-width: 62rem) { .intro__cols { grid-template-columns: 1fr 1fr; max-width: none; } .intro__cols p { max-width: 58ch; } }

/* Módulos */
.mod-list { margin-top: 2.5rem; border-top: 2px solid var(--tinta); }
.mod { border-bottom: 1px solid var(--linea); scroll-margin-top: 1rem; }
.mod summary {
  display: grid; grid-template-columns: 3.25rem 1fr; gap: .1rem 1rem; align-items: baseline;
  padding: 1.25rem .25rem; cursor: pointer; list-style: none;
}
.mod summary::-webkit-details-marker { display: none; }
.mod__n { grid-row: 1 / span 2; font-family: var(--f-titulo); font-weight: 300; font-size: 2.6rem; line-height: 1; color: var(--hielo-1); font-variant-numeric: tabular-nums; text-align: right; }
.mod__t { font-family: var(--f-titulo); font-weight: 700; font-size: var(--paso-1); letter-spacing: -.015em; }
.mod__d { color: var(--tinta-suave); font-size: var(--paso--1); }
.mod summary:hover .mod__t { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.mod[open] { background: var(--papel); }
.mod[open] summary { border-bottom: 1px solid var(--linea); }
.mod::details-content { block-size: 0; overflow: hidden; transition: block-size .3s ease, content-visibility .3s allow-discrete; }
.mod[open]::details-content { block-size: auto; }
@supports (interpolate-size: allow-keywords) { :root { interpolate-size: allow-keywords; } }
.mod ul { margin: 0; padding: 1.25rem .25rem 1.75rem calc(3.25rem + 1.25rem); list-style: none; display: grid; gap: .9rem; max-width: 70ch; }
.mod li { padding-left: 1rem; border-left: 3px solid var(--arena); }
.mod li strong { font-weight: 600; }
@media (max-width: 40rem) { .mod ul { padding-left: .5rem; } .mod__n { font-size: 2rem; text-align: left; } .mod summary { grid-template-columns: 2.25rem 1fr; } }
.mod:target { outline: 3px solid var(--oasis); outline-offset: -3px; }

/* Flujo */
.flujo { background: var(--papel); border-block: 1px solid var(--linea); }
.pasos { list-style: none; margin: 2.75rem 0 0; padding: 0; display: grid; gap: 1.75rem; counter-reset: paso; grid-template-columns: 1fr; }
@media (min-width: 48rem) { .pasos { grid-template-columns: repeat(4, 1fr); gap: 0; } }
.pasos li { counter-increment: paso; position: relative; padding: 1.75rem 1.25rem 0 0; border-top: 6px solid var(--hielo-0); }
@media (min-width: 48rem) { .pasos li + li { padding-left: 1.5rem; border-top-color: var(--hielo-1); } .pasos li:nth-child(3) { border-top-color: var(--roca); } .pasos li:nth-child(4) { border-top-color: var(--arena); } }
.pasos li::before { content: counter(paso); position: absolute; top: -.1rem; right: .75rem; font-family: var(--f-titulo); font-weight: 300; font-size: 3.5rem; line-height: 1; color: var(--linea); transform: translateY(-110%); }
.pasos h3 { font-size: var(--paso-1); font-weight: 700; margin-bottom: .6rem; }
.pasos p { color: var(--tinta-suave); font-size: var(--paso--1); line-height: 1.6; }

.norma { margin-top: clamp(3rem, 7vw, 5rem); display: grid; gap: 2.5rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 62rem) { .norma { grid-template-columns: 1.35fr 1fr; gap: 4rem; } }
.norma__titulo { font-family: var(--f-titulo); font-weight: 700; font-size: var(--paso-1); margin-bottom: 1rem; }
.archivo {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: clamp(.7rem, .4rem + 1.1vw, 1.1rem); line-height: 1.5;
  background: var(--nieve); border: 1px solid var(--linea); border-left: 6px solid var(--hielo-0);
  padding: 1.1rem 1.25rem; overflow-wrap: anywhere; color: var(--tinta);
}
.archivo span, .leyenda dt { font-weight: 700; }
.p1 { color: var(--c1); } .p2 { color: var(--c2); } .p3 { color: var(--c3); } .p4 { color: var(--c4); } .p5 { color: var(--c5); }
.archivo .p1, .leyenda dt.p1 { text-decoration: underline; text-decoration-style: solid; }
.archivo .p2, .leyenda dt.p2 { text-decoration: underline; text-decoration-style: dashed; }
.archivo .p3, .leyenda dt.p3 { text-decoration: underline; text-decoration-style: dotted; }
.archivo .p4, .leyenda dt.p4 { text-decoration: underline; text-decoration-style: double; }
.archivo .p5, .leyenda dt.p5 { text-decoration: underline wavy; }
.archivo span, .leyenda dt { text-underline-offset: 5px; text-decoration-thickness: 2px; }
.leyenda { margin: 1.25rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .85rem 1.25rem; }
.leyenda div { display: grid; gap: .1rem; }
.leyenda dt { font-family: var(--f-titulo); font-size: var(--paso--1); }
.leyenda dd { margin: 0; color: var(--tinta-suave); font-size: var(--paso--1); }
.norma__nota { margin-top: 1.1rem; color: var(--tinta-suave); font-size: var(--paso--1); }

.reglas { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--linea); }
.reglas li { padding: .85rem 0; border-bottom: 1px solid var(--linea); font-size: var(--paso--1); line-height: 1.55; }
.reglas strong { font-family: var(--f-titulo); font-weight: 700; display: block; font-size: var(--paso-0); letter-spacing: -.01em; }

/* Más que un mapa */
.mas__grid { margin-top: 2.5rem; display: grid; gap: 2rem 3rem; grid-template-columns: 1fr; }
@media (min-width: 48rem) { .mas__grid { grid-template-columns: repeat(3, 1fr); } }
.mas article { padding-top: 1rem; border-top: 2px solid var(--tinta); }
.mas h3 { font-size: var(--paso-1); font-weight: 700; margin-bottom: .6rem; }
.mas p { color: var(--tinta-suave); max-width: 38ch; }
.enlace {
  display: inline-block; margin-top: 1rem;
  font-family: var(--f-titulo); font-weight: 700; font-size: var(--paso--1);
  color: var(--hielo-0); text-decoration: underline; text-decoration-thickness: 3px;
  text-decoration-color: var(--arena); text-underline-offset: 5px;
  transition: text-decoration-color .2s;
}
.enlace:hover { text-decoration-color: var(--hielo-0); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Mapa a la vista */
.mapa-sec { background: var(--papel); border-block: 1px solid var(--linea); padding-block: clamp(2.5rem, 6vw, 5rem); }
.mapa-sec__in { display: grid; gap: 1.75rem 3rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 62rem) { .mapa-sec__in { grid-template-columns: minmax(16rem, 1fr) 2.4fr; } .mapa-sec__texto { position: sticky; top: 2rem; } }
.mapa-sec__texto { display: grid; gap: 1rem; justify-items: start; }
.mapa-sec__texto p { color: var(--tinta-suave); max-width: 38ch; }
.mapa-sec__ayuda { font-size: var(--paso--1); }
.mapa-sec .enlace { margin-top: .25rem; }
.mapa-sec iframe { display: block; width: 100%; height: clamp(24rem, 72vh, 46rem); border: 1px solid var(--linea); border-left: 6px solid var(--hielo-0); background: var(--nieve); }

/* Voces */
.voces { background: var(--hielo-0); color: #fff; }
.voces .sub { color: #b9c8de; }
.voces__lista { list-style: none; margin: 2.5rem 0 0; padding: 0; display: grid; grid-template-columns: 1fr; }
@media (min-width: 62rem) { .voces__lista { grid-template-columns: 1fr 1fr; column-gap: 4rem; } }
.voces__lista li { display: grid; gap: .25rem; padding: 1.1rem 0; border-top: 1px solid rgba(255, 255, 255, .22); }
.quien { font-family: var(--f-titulo); font-weight: 700; font-size: var(--paso-1); letter-spacing: -.015em; }
.tema { color: #dbe5f3; font-size: var(--paso--1); line-height: 1.55; max-width: 52ch; }

/* Pie */
.pie { background: var(--tinta); color: #c9d4e3; padding-block: 2.5rem; font-size: var(--paso--1); }
.pie__in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; }
.pie strong { font-family: var(--f-titulo); color: #fff; font-weight: 700; }
.pie a { color: var(--oasis); text-underline-offset: 4px; }
.pie :focus-visible { box-shadow: none; }
