/* Atlas en movimiento — exploración. Tokens tomados de app/src/lib/styles/app.css (navy, azul, bordes, sombra, tipografía). */
@font-face {
	font-family: 'Archivo Black';
	src: url('./fonts/archivo-black/ArchivoBlack-Regular.woff2') format('woff2');
	font-weight: 400;
	font-display: swap;
}
:root {
	color-scheme: light;
	--bg: #ffffff;
	--navy: #14213d;
	--primary: #2563eb;
	--primary-hover: #1d4fc4;
	--border: #d7dbe3;
	--border-strong: #8a93a5;
	--shadow: 0 2px 8px rgba(20, 33, 61, 0.1), 0 1px 2px rgba(20, 33, 61, 0.06);
	--sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	--display: 'Archivo Black', var(--sans);
	--bar: 56px; /* alto de la barra fija */
	--atr: 34px; /* hueco inferior reservado a la atribución del mapa */
	--gut: 16px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; font-family: var(--sans); color: var(--navy); background: var(--bg); -webkit-text-size-adjust: 100%; overflow-x: hidden; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.skip { position: fixed; left: 8px; top: -60px; z-index: 50; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 4px; }
.skip:focus { top: 8px; }

/* ── Barra fija: logo a la izquierda y un único enlace principal ── */
.top { position: fixed; z-index: 30; left: 0; right: 0; top: 0; height: var(--bar); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 var(--gut); background: #fff; border-bottom: 1px solid var(--border); box-shadow: 0 1px 4px rgba(20, 33, 61, 0.06); }
.logo { display: inline-flex; align-items: center; min-height: 44px; }
.logo img { display: block; height: 24px; width: auto; }
.cta { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 4px; background: var(--primary); color: #fff; font-weight: 600; font-size: 0.95rem; text-decoration: none; white-space: nowrap; }
.cta:hover { background: var(--primary-hover); }
.cta:active { background: #173f9e; }
.top .cta:focus-visible { outline-color: var(--navy); outline-offset: 3px; }

.pista { position: relative; }
.stage { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden; background: var(--bg); }
.mapa { position: absolute; inset: 0; }
.mascara { position: fixed; left: -10000px; top: 0; pointer-events: none; }
.maplibregl-ctrl-attrib { font-size: 11px; background: rgba(255, 255, 255, 0.88); }
.maplibregl-ctrl-attrib a { color: var(--navy); }
.maplibregl-ctrl-bottom-right { z-index: 12; }

.guia { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; overflow: visible; }
.guia path { fill: none; stroke: var(--primary); stroke-width: 1.6; opacity: 0; }

/* ── Estado de carga ── */
.estado { position: absolute; z-index: 14; left: 50%; top: calc(var(--bar) + 50%); transform: translate(-50%, -50%); margin: 0; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 2 * var(--gut)); padding: 10px 16px; border-radius: 22px; background: #fff; border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 0.9rem; font-weight: 600; transition: opacity 0.25s; }
.estado .giro { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #c7d3f0; border-top-color: var(--primary); animation: gira 0.9s linear infinite; }
.stage[data-estado='listo'] .estado { opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0s 0.25s; }
.stage[data-estado='aviso'] .estado .giro, .stage[data-estado='error'] .estado .giro { display: none; }
.stage[data-estado='aviso'] .estado { top: auto; bottom: calc(var(--atr) + 56px); transform: translateX(-50%); font-weight: 500; }
.stage[data-estado='aviso'].oculta-aviso .estado { opacity: 0; visibility: hidden; transition: opacity 0.4s, visibility 0s 0.4s; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ── Texto ── */
.copy { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.copy article { position: absolute; inset: 0; opacity: 0; visibility: hidden; }
.copy article.on { visibility: visible; }

.titular { position: absolute; left: var(--gut); top: calc(var(--bar) + 12px); right: var(--gut); margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(1.45rem, 6.4vw, 2rem); line-height: 1.08; letter-spacing: -0.01em; color: var(--navy); text-shadow: 0 0 14px #fff, 0 0 4px #fff; text-wrap: balance; }
.titular.medio { font-size: clamp(1.45rem, 6.6vw, 1.9rem); }
.cabeza { position: absolute; left: var(--gut); top: calc(var(--bar) + 12px); right: 28px; padding: 10px 14px 12px; background: rgba(255, 255, 255, 0.86); border-left: 3px solid var(--primary); border-radius: 0 4px 4px 0; }
.cabeza .titular { position: static; }
.sub { margin: 10px 0 0; font-size: 0.9rem; line-height: 1.4; max-width: 44ch; text-shadow: 0 0 10px #fff, 0 0 4px #fff; }
.lead { margin: 0 0 6px; font-size: 0.92rem; line-height: 1.4; max-width: 40ch; text-shadow: 0 0 10px #fff; }
.base { position: absolute; left: var(--gut); right: var(--gut); bottom: calc(var(--atr) + 6px); }
.aviso { margin: 0; font-size: 0.78rem; line-height: 1.4; color: #3f4b66; max-width: 46ch; text-shadow: 0 0 8px #fff; }

/* ── Leyenda (escena 2) ── */
.leyenda { position: absolute; left: var(--gut); bottom: calc(var(--atr) + 8px); margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.78rem; line-height: 1.2; color: #3f4b66; text-shadow: 0 0 8px #fff, 0 0 3px #fff; }
.leyenda li { display: inline-flex; align-items: center; gap: 6px; }
.leyenda svg { width: 16px; height: 16px; color: var(--navy); }
.k-reg { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--navy); background: #fff; }
.k-reg i { width: 10px; height: 10px; background: var(--navy); -webkit-mask: url('./assets/wheelchair.svg') center / contain no-repeat; mask: url('./assets/wheelchair.svg') center / contain no-repeat; }

/* ── Ficha ── */
.ficha { position: absolute; pointer-events: auto; left: var(--gut); right: var(--gut); bottom: calc(var(--atr) + 6px); background: #fff; border: 1px solid var(--border-strong); border-top: 3px solid var(--primary); border-radius: 4px; padding: 14px 16px 14px; box-shadow: var(--shadow); }
.ficha .kicker { margin: 0 0 4px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #3f4b66; }
.ficha h2 { margin: 0 0 10px; font-family: var(--display); font-weight: 400; font-size: 1.55rem; line-height: 1.1; }
.ficha dl { margin: 0; display: grid; gap: 8px; }
.ficha dt { font-size: 0.72rem; color: #4d5a76; }
.ficha dd { margin: 0; font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
.ficha .fuente { padding-left: 10px; border-left: 3px solid var(--primary); }
.ficha .fuente dd { font-size: 1.02rem; }
.ficha .aviso { text-shadow: none; margin-top: 12px; }

/* ── Marcadores: adaptados de app/src/lib/components/ParkingMap.svelte ── */
/* Estacionamiento: círculo blanco con borde navy y la silla de ruedas de app/src/lib/assets/wheelchair.svg (como máscara, hereda color). */
.sim { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; opacity: 0; transform: scale(0.6); --sel: 0; }
.sim__anillo { position: absolute; width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--primary); opacity: var(--sel); transform: scale(calc(0.7 + 0.3 * var(--sel))); }
.sim__cuerpo { position: relative; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--navy); background: color-mix(in srgb, var(--primary) calc(var(--sel) * 100%), #fff); color: color-mix(in srgb, #fff calc(var(--sel) * 100%), var(--navy)); box-shadow: 0 1px 4px rgba(20, 33, 61, 0.25); }
.sim__icono { width: 16px; height: 16px; background: currentColor; -webkit-mask: url('./assets/wheelchair.svg') center / contain no-repeat; mask: url('./assets/wheelchair.svg') center / contain no-repeat; }
/* Punto del país: el mismo registro seleccionado, visto desde lejos. */
.pt { position: relative; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--navy), 0 2px 6px rgba(20, 33, 61, 0.3); }
/* Anotación sobria del punto de país (decorativa; el mapa es aria-hidden): filete corto y rótulo. */
.pt::before { content: ''; position: absolute; left: 100%; top: 50%; width: 22px; height: 1px; background: var(--navy); margin-left: 3px; }
.pt::after { content: 'Santiago · un registro'; position: absolute; left: 100%; top: 50%; margin-left: 28px; transform: translateY(-50%); white-space: nowrap; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; color: var(--navy); text-shadow: 0 0 6px #fff, 0 0 3px #fff; }
/* Destino: pin de ubicación navy (nunca silla de ruedas), con la punta sobre la coordenada. */
.dest { position: relative; width: 30px; height: 30px; color: var(--navy); opacity: 0; filter: drop-shadow(0 2px 2px rgba(20, 33, 61, 0.3)); }
.dest svg { display: block; width: 100%; height: 100%; }
.dest .rot { position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%); width: max-content; max-width: 170px; text-align: center; background: rgba(255, 255, 255, 0.95); border-radius: 4px; padding: 4px 8px; box-shadow: var(--shadow); font-size: 0.76rem; line-height: 1.3; color: var(--navy); opacity: 0; }
.dest .rot b { display: block; font-size: 0.8rem; }
@media (max-width: 899px) { .dest .rot { left: -8px; transform: none; text-align: left; } }

/* ── Controles de la demostración ── */
.rail { position: absolute; z-index: 15; right: 0; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; }
.rail button { position: relative; display: flex; align-items: center; justify-content: flex-end; width: 44px; height: 44px; padding: 0 3px 0 0; border: 0; background: transparent; color: var(--navy); font: inherit; cursor: pointer; }
.rail button b, .rail button span { display: none; }
.rail button::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 1.5px solid var(--navy); }
.rail button[aria-current='step']::before { background: var(--navy); }
.rail button:focus-visible { outline-offset: -4px; }

@media (min-width: 900px) {
	:root { --gut: 56px; --bar: 64px; --atr: 40px; }
	.logo img { height: 28px; }
	.titular { top: calc(var(--bar) + 24px); right: auto; max-width: 20em; font-size: clamp(2.2rem, 3.1vw, 3rem); line-height: 1.06; }
	.titular.medio { font-size: clamp(2rem, 2.8vw, 2.6rem); max-width: 14em; }
	.cabeza { top: calc(var(--bar) + 24px); right: auto; width: min(32em, 44vw); }
	.sub { font-size: 1rem; }
	.base { display: contents; }
	.lead { position: absolute; top: calc(var(--bar) + 30px); right: var(--gut); width: min(300px, 26vw); margin: 0; font-size: 1rem; padding-left: 14px; border-left: 1px solid var(--navy); }
	.base .aviso { position: absolute; left: var(--gut); bottom: calc(var(--atr) + 14px); }
	.ficha { left: auto; right: var(--gut); bottom: auto; top: calc(50% + var(--bar) / 2); transform: translateY(-50%); width: 340px; padding: 18px 20px 18px; }
	.ficha h2 { font-size: 1.9rem; }
	.rail { right: auto; left: 50%; top: auto; bottom: 22px; transform: translateX(-50%); flex-direction: row; gap: 6px; }
	.rail button { width: auto; height: auto; min-width: 44px; min-height: 44px; justify-content: center; gap: 8px; padding: 0 14px 0 4px; border: 1.5px solid var(--navy); border-radius: 22px; background: rgba(255, 255, 255, 0.92); }
	.rail button::before { display: none; }
	.rail button b, .rail button span { display: inline; }
	.rail button b { width: 36px; text-align: center; font-size: 0.9rem; }
	.rail button span { font-size: 0.85rem; }
	.rail button[aria-current='step'] { background: var(--navy); color: #fff; }
	.rail button:hover:not([aria-current='step']) { background: #eef1f4; }
	.rail button:focus-visible { outline-offset: 2px; }
}
@media (max-width: 899px) and (max-height: 640px), (max-width: 359px) {
	:root { --bar: 52px; }
	.titular { font-size: clamp(1.3rem, 6.2vw, 1.6rem); }
	.titular.medio { font-size: clamp(1.3rem, 6.2vw, 1.6rem); }
	.leyenda { font-size: 0.72rem; }
	.lead { font-size: 0.86rem; line-height: 1.36; margin-bottom: 6px; }
	.aviso { font-size: 0.72rem; }
	.cta { padding: 0 12px; font-size: 0.88rem; }
	.ficha { padding: 10px 14px 10px; }
	.ficha h2 { font-size: 1.3rem; margin-bottom: 6px; }
	.ficha dl { gap: 4px; }
	.ficha dd { font-size: 0.88rem; }
	.ficha .aviso { margin-top: 8px; }
}
@media (max-width: 359px) {
	:root { --atr: 36px; }
	.maplibregl-ctrl-attrib { font-size: 9.5px; }
}

@media (prefers-reduced-motion: reduce) {
	.estado .giro { animation: none; border-top-color: #c7d3f0; border-right-color: var(--primary); }
	.estado, .stage[data-estado='listo'] .estado { transition: none; }
}
