/* Portada en paneles: fondo carbón, una idea por pantalla, el oliva como único brillo. */
:root {
  --night: #1f1e1a;
  --night-2: #191814;
  --night-3: #141310;
  --line-d: rgba(244, 243, 239, .14);
  --txt-d: #e9e7df;
  --txt-d2: #b4b1a6;
}
html.panels { scroll-snap-type: y proximity; background: var(--night); }
@media (max-width: 860px), (max-height: 620px) { html.panels { scroll-snap-type: y proximity; } }
.panels body { background: var(--night); color: var(--txt-d); }
.panels ::selection { background: var(--olive); color: var(--night); }
.panels :focus-visible { outline-color: var(--olive); }

/* Cabecera flotante */
.bar { position: fixed; z-index: 60; left: 0; right: 0; top: 0; pointer-events: none; }
.bar .wrap { max-width: none; display: flex; align-items: center; gap: 36px; height: 88px; padding: 0 clamp(20px, 4vw, 56px); }
.bar a, .bar button { pointer-events: auto; }
.bar .brand img { height: 30px; width: auto; display: block; }
.bar nav { display: flex; gap: clamp(18px, 2.4vw, 34px); margin-left: auto; }
.bar nav a { color: var(--txt-d2); text-decoration: none; font-size: 15.5px; letter-spacing: .02em; transition: color .3s; }
.bar nav a:hover, .bar nav a.on { color: var(--txt-d); }
.bar .lang { display: flex; gap: 4px; font-size: 14px; letter-spacing: .08em; }
.bar .lang a, .bar .lang span { color: var(--txt-d2); text-decoration: none; padding: 4px 6px; }
.bar .lang span { color: var(--txt-d); box-shadow: inset 0 -1.5px 0 var(--olive); }
.bar .menu-btn { display: none; color: var(--txt-d); }

/* Índice vertical */
.index { position: fixed; z-index: 55; right: clamp(16px, 2.6vw, 40px); top: 50%; transform: translateY(-50%); list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.index a { display: flex; align-items: center; justify-content: flex-end; gap: 14px; text-decoration: none; color: var(--txt-d2); font-size: 13.5px; letter-spacing: .04em; }
.index a span { opacity: 0; transform: translateX(6px); transition: opacity .35s var(--ease), transform .35s var(--ease); }
.index a i { width: 18px; height: 1px; background: var(--txt-d2); transition: width .45s var(--ease), background .3s; }
.index a:hover span, .index a:focus-visible span, .index a.on span { opacity: 1; transform: none; }
.index a.on { color: var(--txt-d); }
.index a.on i { width: 34px; background: var(--olive); }

/* Paneles */
.panel { position: relative; min-height: 100svh; scroll-snap-align: start; display: flex; align-items: center; overflow: hidden; }
.panel > .wrap { position: relative; z-index: 2; width: 100%; max-width: 1240px; padding: 120px clamp(24px, 6vw, 96px) 96px; }
.p-1 { background: var(--night); }
.p-2 { background: var(--night-2); }
.p-3 { background: var(--night); }
.p-4 { background: var(--night-2); }
.p-6 { background: var(--night-3); }

.rule-o { display: block; width: 64px; height: 1px; background: var(--olive); margin: 0 0 36px; border: 0; }
.p-1 h1 { margin: 0; font-weight: 300; font-size: clamp(2.7rem, 6.4vw, 6rem); line-height: 1.02; letter-spacing: -.02em; color: #f4f3ef; }
.p-1 h1 em { font-style: normal; color: var(--olive); display: block; }
.p-1 .sub { margin: 40px 0 0; max-width: 46ch; font-size: clamp(1.05rem, 1.3vw, 1.2rem); line-height: 1.6; color: var(--txt-d2); font-weight: 300; }
.scrollcue { position: absolute; left: clamp(24px, 6vw, 96px); bottom: 40px; z-index: 2; display: flex; align-items: center; gap: 14px; color: var(--txt-d2); font-size: 13.5px; letter-spacing: .08em; text-decoration: none; }
.scrollcue i { position: relative; width: 1px; height: 46px; background: var(--line-d); overflow: hidden; }
.scrollcue i::after { content: ''; position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--olive); animation: cue 2.4s var(--ease) infinite; }
@keyframes cue { to { top: 100%; } }

.statement { margin: 0; font-weight: 300; font-size: clamp(2rem, 4.2vw, 3.7rem); line-height: 1.12; letter-spacing: -.012em; color: #f4f3ef; max-width: 18ch; }
.two { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(40px, 7vw, 120px); align-items: end; }
.two p { color: var(--txt-d2); margin: 0 0 1.1em; max-width: 56ch; font-size: 17.5px; line-height: 1.7; }
.two p:last-child { margin-bottom: 0; }

.area { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(40px, 7vw, 120px); align-items: start; }
.area.mirror { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
.area.mirror .area-h { order: 2; }
.area h2 { margin: 0 0 22px; font-weight: 300; font-size: clamp(2.6rem, 5.6vw, 5.2rem); line-height: 1; letter-spacing: -.02em; color: #f4f3ef; }
.area .area-h p { margin: 0; color: var(--txt-d2); max-width: 36ch; font-size: 17.5px; line-height: 1.65; }
.area ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-d); }
.area li { display: grid; grid-template-columns: 2rem 1fr; gap: 8px; padding: 15px 0 14px; border-bottom: 1px solid var(--line-d); color: var(--txt-d); font-size: 17px; line-height: 1.45; }
.area li::before { content: ''; width: 14px; height: 1px; background: var(--olive); margin-top: .72em; }
.area .note { margin: 26px 0 0; color: var(--txt-d2); font-size: 15.5px; }

.p-5 { background: var(--night); }
.p-5 .bg { position: absolute; inset: 0; z-index: 0; }
/* Plano de la provincia con un punto por ámbito (lo genera build.py) */
.p-5 .bg { overflow: hidden; }
.p-5 .plano { position: absolute; top: 11%; bottom: 13%; right: clamp(120px, 11vw, 200px); width: 50%; height: auto; max-height: 76%; margin: auto 0; transform: scale(1.04); transition: transform 2.4s var(--ease); }
.p-5.on .plano { transform: scale(1); }
.plano .t path { fill: none; stroke: #3a3831; stroke-width: .9; }
.plano .w path { fill: rgba(175, 163, 17, .09); stroke: rgba(175, 163, 17, .4); stroke-width: 1; }
.plano .prov { fill: none; stroke: #7d7a70; stroke-width: 1.6; }
.plano .pts circle { fill: var(--c); stroke: #1f1e1a; stroke-width: 2.5; opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(.2); transition: opacity .5s, transform .7s var(--ease); transition-delay: calc(.4s + var(--i) * 9ms); }
.p-5.on .plano .pts circle { opacity: .95; transform: scale(1); }
.p-5 .bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(31, 30, 26, .96) 0%, rgba(31, 30, 26, .75) 34%, rgba(31, 30, 26, 0) 58%); }
@media (max-width: 860px) {
  .p-5 { align-items: flex-end; }
  .p-5 .plano { top: 76px; bottom: auto; left: 0; right: 0; width: 100%; height: clamp(140px, calc(100% - 520px), 42%); max-height: none; margin: 0 auto; }
  .p-5 .bg::after { background: linear-gradient(180deg, rgba(31, 30, 26, 0) 0%, rgba(31, 30, 26, 0) 34%, rgba(31, 30, 26, .9) 52%, rgba(31, 30, 26, .97) 100%); }
}
@media (prefers-reduced-motion: reduce) { .p-5 .plano, .plano .pts circle { transition: none; transform: none; } .plano .pts circle { opacity: .95; } }
.p-5 h2 { margin: 0 0 26px; font-weight: 300; font-size: clamp(2.6rem, 5.6vw, 5.2rem); line-height: 1; letter-spacing: -.02em; color: #f4f3ef; }
.p-5 .lead-d { margin: 0 0 40px; max-width: 48ch; color: var(--txt-d); font-size: clamp(1.1rem, 1.4vw, 1.3rem); line-height: 1.6; font-weight: 300; }
.go { display: inline-flex; align-items: center; gap: 14px; color: #f4f3ef; text-decoration: none; font-size: 17px; padding: 16px 26px 15px; border: 1px solid rgba(244, 243, 239, .5); transition: background .3s, color .3s, border-color .3s; }
.go:hover { background: var(--olive); border-color: var(--olive); color: var(--night); }
.go svg { width: 20px; height: 12px; transition: transform .35s var(--ease); }
.go:hover svg { transform: translateX(4px); }
.ticker { position: absolute; z-index: 2; left: 0; right: 0; bottom: 44px; overflow: hidden; border-block: 1px solid var(--line-d); padding: 16px 0 14px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.ticker ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; width: max-content; animation: tick 120s linear infinite; }
.ticker li { white-space: nowrap; color: var(--txt-d2); font-size: 15px; padding: 0 28px; position: relative; }
.ticker li b { color: var(--txt-d); font-weight: 500; }
.ticker li::after { content: ''; position: absolute; right: -2px; top: 50%; width: 4px; height: 4px; margin-top: -2px; background: var(--olive); }
.ticker:hover ul { animation-play-state: paused; }
@keyframes tick { to { transform: translateX(-50%); } }

.p-6 h2 { margin: 0 0 18px; font-weight: 300; font-size: clamp(2.2rem, 4.4vw, 3.8rem); line-height: 1.05; letter-spacing: -.015em; color: #f4f3ef; }
.p-6 .lead-d { margin: 0 0 48px; color: var(--txt-d2); max-width: 46ch; font-size: 17.5px; line-height: 1.65; }
.reach { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line-d); }
.reach a, .reach div { padding: 22px 0 24px; border-bottom: 1px solid var(--line-d); text-decoration: none; display: block; }
.reach > :nth-child(odd) { padding-right: 32px; }
.reach > :nth-child(even) { padding-left: 32px; border-left: 1px solid var(--line-d); }
.reach .k { display: block; color: var(--txt-d2); font-size: 14px; letter-spacing: .06em; margin-bottom: 8px; }
.reach .v { display: block; color: #f4f3ef; font-weight: 300; font-size: clamp(1.35rem, 2.4vw, 2.1rem); line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; transition: color .3s; }
.reach a:hover .v { color: var(--olive); }
.reach .v.small { font-size: 17px; line-height: 1.6; font-weight: 400; color: var(--txt-d); }
.end { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; margin-top: 64px; color: #8f8c81; font-size: 13.5px; }
.end nav { display: flex; gap: 20px; margin-left: auto; }
.end a { color: inherit; text-decoration: none; }
.end a:hover { color: var(--txt-d); text-decoration: underline; }
.p-6 .credits { color: #7d7a70; font-size: 12px; margin-top: 10px; }
.p-6 .credits a { color: inherit; }

/* Aparición encadenada (solo con JS; sin JS todo es visible) */
.js [data-r] { opacity: 0; transform: translateY(26px); filter: blur(6px); transition: opacity 1s var(--ease), transform 1.1s var(--ease), filter 1s var(--ease); transition-delay: calc(var(--d, 0) * 90ms); }
.js .on [data-r] { opacity: 1; transform: none; filter: none; }

/* Menú móvil a pantalla completa */
.sheet-menu { position: fixed; inset: 0; z-index: 70; background: var(--night-3); display: none; flex-direction: column; justify-content: center; padding: 0 32px; }
.sheet-menu.open { display: flex; }
.sheet-menu a { color: #f4f3ef; text-decoration: none; font-size: 2rem; font-weight: 300; padding: 12px 0; border-bottom: 1px solid var(--line-d); }
.sheet-menu .close { position: absolute; top: 22px; right: 18px; background: none; border: 0; color: #f4f3ef; padding: 10px; cursor: pointer; }
.sheet-menu .close svg { width: 24px; height: 24px; display: block; }

@media (max-width: 1000px) {
  .two, .area, .area.mirror { grid-template-columns: 1fr; gap: 36px; align-items: start; }
  .area.mirror .area-h { order: 0; }
  .index { display: none; }
}
@media (max-width: 860px) {
  .bar .wrap { height: 70px; }
  .bar nav, .bar .lang { display: none; }
  .bar .menu-btn { display: block; margin-left: auto; }
  .bar .brand img { height: 26px; }
  .panel > .wrap { padding: 104px 24px 84px; }
  .reach { grid-template-columns: 1fr; }
  .reach > :nth-child(odd), .reach > :nth-child(even) { padding: 18px 0 20px; border-left: 0; }
  .ticker { bottom: 22px; }
  .p-5 > .wrap { padding-bottom: 130px; }
  .end nav { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html.panels { scroll-snap-type: none; }
  .js [data-r] { opacity: 1; transform: none; filter: none; }
  .ticker ul { animation: none; }
  .scrollcue i::after { animation: none; }
}
.index ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
/* Cabecera sólida en páginas interiores */
.bar.solid { position: sticky; background: var(--night); pointer-events: auto; }
.bar.solid nav a[aria-current="page"] { color: var(--txt-d); box-shadow: inset 0 -1.5px 0 var(--olive); padding-bottom: 4px; }
.bar.solid ~ main .xp-map { top: 88px; height: calc(100svh - 88px); }
@media (max-width: 860px) { .bar.solid ~ main .xp-map { top: 70px; height: 48svh; } }
html.panels { scroll-padding-top: 0; }
.bar:not(.solid) { background: linear-gradient(180deg, rgba(20, 19, 16, .82) 0%, rgba(20, 19, 16, .45) 60%, rgba(20, 19, 16, 0) 100%); }
/* Página de experiencia: cabecera de página en carbón, mapa y relación en claro */
.bar.solid ~ main .page-head { background: var(--night); border-bottom: 0; color: #f4f3ef; }
.bar.solid ~ main .page-head h1 { color: #f4f3ef; }
.bar.solid ~ main .page-head .lead, .bar.solid ~ main .page-head .facts { color: var(--txt-d2); }
.bar.solid ~ main .page-head .facts b { color: #f4f3ef; }
.bar.solid ~ main .crumbs, .bar.solid ~ main .crumbs a { color: var(--txt-d2); }
.bar.solid ~ main .crumbs a:hover { color: var(--olive); }
.bar.solid ~ main .page-head h1::before { content: ''; display: block; width: 64px; height: 1px; background: var(--olive); margin-bottom: 30px; }
.panels .note { color: var(--txt-d2); border-top: 1px solid var(--line-d); padding-top: 20px; margin-top: 30px; max-width: none; }
.p-6 .credits { color: #8f8c81; }
.reach .k, .index a, .bar .lang { letter-spacing: .03em; }
.scrollcue { letter-spacing: .04em; }

/* ---- Mejoras: apilado con transición, progreso, márgenes, superficies del navegador ---- */
html.panels { color-scheme: dark; scrollbar-color: #4a4840 #141310; }
.panels ::-webkit-scrollbar-track { background: #141310; }
.panels ::-webkit-scrollbar-thumb { background: #4a4840; border: 3px solid #141310; }
.panel.leaving > .wrap { transform: translateY(var(--lag, 0)) scale(calc(1 - var(--c, 0) * .06)); filter: blur(calc(var(--c, 0) * 5px)) brightness(calc(1 - var(--c, 0) * .55)); transform-origin: 50% 40%; will-change: transform, filter; }
.panel + .panel { box-shadow: 0 -1px 0 var(--line-d); }
.panel .bg img { filter: grayscale(.6) contrast(1.05) brightness(calc(1 - var(--c, 0) * .5)); }
.bar .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--olive); transform: scaleX(0); transform-origin: left; pointer-events: none; }
.bar .where { display: none; color: var(--txt-d2); font-size: 14px; letter-spacing: .03em; margin-left: auto; }
.two { align-items: start; }
.two .rule-o { margin-bottom: 30px; }
@media (min-width: 1001px) { .panel > .wrap { padding-right: clamp(150px, 15vw, 240px); } }
@media (max-width: 860px) {
  .bar .where { display: block; }
  .bar .menu-btn { margin-left: 14px; }
  .p-1 h1 { font-size: clamp(3.1rem, 12vw, 4.2rem); }
  .p-1 .sub { font-size: 1.12rem; }
}
@media (prefers-reduced-motion: reduce) { .panel > .wrap { transform: none; filter: none; } }

/* Página de experiencia en carbón: relación y filtros */
.bar.solid ~ main .xp-side { background: var(--night); border-left: 1px solid var(--line-d); color: var(--txt-d); }
.bar.solid ~ main .xp-block { border-bottom-color: var(--line-d); }
.bar.solid ~ main .xp-block h2 { font-weight: 300; font-size: 1.6rem; color: #f4f3ef; margin-bottom: 18px; }
.bar.solid ~ main .filters button { color: var(--txt-d); }
.bar.solid ~ main .filters button:hover { background: #2a2924; }
.bar.solid ~ main .filters button[aria-pressed="false"] { color: #8f8c81; }
.bar.solid ~ main .filters .dot { box-shadow: 0 0 0 2px var(--night), 0 0 0 3px var(--c); }
.bar.solid ~ main .filters button[aria-pressed="false"] .dot { background: var(--night); }
.bar.solid ~ main .filters .n { color: var(--txt-d2); }
.bar.solid ~ main .legend-term { border-top-color: var(--line-d); color: var(--txt-d2); }
.bar.solid ~ main .offsheet { color: var(--txt-d2); }
.bar.solid ~ main .offsheet button, .bar.solid ~ main .filtro button { color: var(--olive); }
.bar.solid ~ main .filtro { background: #2a2924; color: var(--txt-d); }
.bar.solid ~ main .group h3 { color: #f4f3ef; font-weight: 400; }
.bar.solid ~ main .group ol { border-top-color: var(--line-d); }
.bar.solid ~ main .row { color: var(--txt-d); border-bottom-color: var(--line-d); }
.bar.solid ~ main .row:hover { background: #26251f; }
.bar.solid ~ main .row.on { background: #2a2924; box-shadow: inset 0 0 0 1px rgba(244, 243, 239, .55); }
.bar.solid ~ main .row .a { color: #f4f3ef; font-weight: 500; }
.bar.solid ~ main .row .y { color: var(--txt-d2); }
.bar.solid ~ main .row .m { color: var(--olive); }
.bar.solid ~ main .row .d { color: var(--txt-d2); }
.bar.solid ~ main .small, .bar.solid ~ main .vacio { color: #8f8c81; }
.bar.solid ~ main .xp { border-bottom: 0; }
.panels-xp body, .bar.solid ~ main { background: var(--night); }
.panel { isolation: isolate; }

/* Foco y páginas interiores en el mundo oscuro */
.bar :focus-visible, .sheet-menu :focus-visible, .bar.solid ~ main .xp-side :focus-visible, .bar.solid ~ main .page-head :focus-visible, .foot :focus-visible { outline-color: var(--olive); }
.bar.solid ~ main.legal { max-width: none; margin: 0; padding: clamp(48px, 6vw, 88px) clamp(24px, 8vw, 160px) 96px; background: var(--night); color: var(--txt-d); }
.bar.solid ~ main.legal > * { max-width: 72ch; }
.bar.solid ~ main.legal h1 { color: #f4f3ef; }
.bar.solid ~ main.legal h2 { color: #f4f3ef; font-weight: 400; }
.bar.solid ~ main.legal p { color: var(--txt-d2); }
.bar.solid ~ main.legal a { color: var(--txt-d); }
.bar.solid ~ main.legal mark { background: #4a4520; color: #f4f3ef; }

/* Ajustes pedidos: logo algo mayor, datos de contacto más contenidos */
.bar .brand img { height: 38px; }
@media (max-width: 860px) { .bar .brand img { height: 31px; } }
.reach .v { font-size: clamp(1.15rem, 1.7vw, 1.5rem); }

/* Plano oscuro en la página de experiencia */
.bar.solid ~ main .xp-map { background: #24231e; }
.bar.solid ~ main .tlabel { color: #d9d6cb; text-shadow: 0 0 2px #1f1e1a, 0 0 3px #1f1e1a, 0 0 4px #1f1e1a, 0 0 6px #1f1e1a; }
.bar.solid ~ main .map-view { background: #1f1e1a; border-color: rgba(244, 243, 239, .25); }
.bar.solid ~ main .map-view button { color: var(--txt-d2); }
.bar.solid ~ main .map-view button[aria-pressed="true"] { background: var(--olive); color: #141310; }
.bar.solid ~ main .maplibregl-ctrl-group { background: #1f1e1a !important; border: 1px solid rgba(244, 243, 239, .25); }
.bar.solid ~ main .maplibregl-ctrl-group button + button { border-top-color: rgba(244, 243, 239, .18) !important; }
.bar.solid ~ main .maplibregl-ctrl-icon { filter: invert(.85); }
.bar.solid ~ main .maplibregl-ctrl-scale { background: rgba(31, 30, 26, .8) !important; color: var(--txt-d2) !important; border-color: var(--txt-d2) !important; }
.bar.solid ~ main .maplibregl-ctrl-attrib { background: rgba(31, 30, 26, .75) !important; color: var(--txt-d2); }
.bar.solid ~ main .maplibregl-ctrl-attrib a { color: var(--txt-d2) !important; }
.bar.solid ~ main .legend-term i { background: rgba(175, 163, 17, .18); border-color: var(--olive); }
@media (max-width: 480px) {
  .bar .wrap { gap: 12px; padding: 0 16px; }
  .bar .brand { flex: 0 1 auto; min-width: 0; }
  .bar .brand img { height: auto; max-height: 31px; max-width: 100%; }
  .bar .where { display: none; }
  .bar .menu-btn { flex: none; margin-left: auto; }
}
