/*
 * Estilos de los Recorridos Lumbre (formato lumbre-tour/1.0): galería /tours y página del recorrido.
 * Se cargan SÓLO en las vistas de /tours. Reutiliza los tokens de app.css (paleta, radios, espaciados)
 * — no define colores propios. Mobile-first: una columna en teléfono; controles grandes para táctil.
 * Sin JS la página ya es legible (todas las paradas en orden, §mejora progresiva): nada de aquí es
 * necesario para leer; el cover inmersivo y las franjas son capas visuales sobre el documento.
 */

/* Botón flotante de silencio compartido (lumbre-sound.js): una píldora discreta abajo a la derecha.
   Sin colores propios —todo tokens de app.css— y despejada del HUD y de la barra segura del móvil. */
.lumbre-sound-toggle { position: fixed; right: 14px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; font-size: 14px; font-weight: 500; line-height: 1; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm); cursor: pointer; }
.lumbre-sound-toggle:hover { border-color: var(--accent); color: var(--accent); }
.lumbre-sound-toggle.active { color: var(--accent); }
@media (max-width: 600px) { .lumbre-sound-toggle { right: 10px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); padding: 7px 11px; font-size: 13px; } }

/* ---------- Galería /tours ---------- */
.tours-gallery { padding-top: var(--space-6); }
.tours-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.tours-head h1 { margin: 0 0 var(--space-2); font: 400 clamp(30px, 5vw, 46px)/1.1 var(--font-reading); }
.tours-head .lede { margin: 0; max-width: 62ch; color: var(--muted); line-height: 1.55; }
.tours-count { margin: 0; color: var(--muted); font-size: 15px; white-space: nowrap; }
.tours-count strong { color: var(--accent); font-size: 22px; font-weight: 700; margin-right: 4px; }

/* Barra de filtros en una sola fila; controles grandes para táctil (§50/§51). */
.tour-filters { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin: var(--space-5) 0 var(--space-6); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.tour-filter-search { flex: 1 1 220px; }
.tour-filter-search input { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); color: var(--ink); font-size: 16px; }
.tour-filter-select select, .tour-filter-level { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); color: var(--ink); font-size: 15px; }
.tour-filter-go { min-height: 44px; }
.tour-filter-clear { color: var(--muted); text-decoration: underline; padding: 8px; }
.tour-filter-clear:hover { color: var(--accent); }

/* Rejilla plana a ANCHO COMPLETO: auto-fit colapsa los carriles vacíos y las 1fr hacen que las
   tarjetas se estiren ocupando todo el contenedor — sin agujero muerto a la derecha con pocos
   recorridos, y llenando filas completas cuando hay muchos. */
.tour-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-5); }
.tour-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.tour-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md, 0 10px 26px rgba(0, 0, 0, .16)); border-color: var(--accent); }
.tour-card-cover { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--accent-soft); }
.tour-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tour-card-cover .generated-cover { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--accent); }
.tour-card-diff { position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: var(--radius-pill, 999px); background: rgba(10, 14, 20, .72); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.tour-card-body { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); flex: 1 1 auto; }
.tour-card-eyebrow { margin: 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.tour-card-body h3 { margin: 0; font: 400 20px/1.25 var(--font-reading); }
.tour-card-body h3 a { color: var(--ink); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tour-card-body h3 a:hover { color: var(--accent); }
.tour-card-desc { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tour-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--space-2) 0 0; }
.tour-card-meta .chip { font-size: 12px; }
.tour-card-cta { margin-top: auto; }
.chip-tag { background: var(--bg); border-color: var(--line); color: var(--muted); }

/* Estado vacío y pie */
.tours-empty { text-align: center; padding: var(--space-8) var(--space-4); border: 1px dashed var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.tour-empty-icon { color: var(--accent); margin: 0 0 var(--space-3); }
.tours-empty h2 { margin: 0 0 var(--space-2); font: 400 22px/1.3 var(--font-reading); }
.tours-cta { margin-top: var(--space-7); text-align: center; }

/* ---------- Portada del recorrido (el umbral del viaje) ---------- */
.tour-shell { padding-top: var(--space-6); padding-bottom: var(--space-8); }
.tour-cover { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 46vh; padding: var(--space-7) var(--space-5); border-radius: var(--radius-lg); background: var(--accent-soft) center / cover no-repeat; overflow: hidden; }
.tour-cover-veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 14, 20, .18), rgba(10, 14, 20, .72)); }
.tour-cover-inner { position: relative; max-width: 720px; }
.tour-cover h1 { margin: 0 0 var(--space-3); font: 400 clamp(28px, 5vw, 44px)/1.12 var(--font-reading); color: #fff; text-wrap: balance; }
.tour-cover .eyebrow { color: rgba(255, 255, 255, .78); }
.tour-cover .lede { color: rgba(255, 255, 255, .92); line-height: 1.6; margin: 0 0 var(--space-3); }
.tour-chips { margin: 0 0 var(--space-4); font-size: 13px; color: rgba(255, 255, 255, .8); }
.tour-index { margin: var(--space-4) 0; }
.tour-index ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tour-index-item a { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 40px; color: rgba(255, 255, 255, .92); text-decoration: none; border-left: 2px solid rgba(255, 255, 255, .3); padding-left: var(--space-3); }
.tour-index-item a:hover { color: #fff; border-left-color: #fff; }
.tour-index-item.is-visited a { opacity: .62; }
.tour-index-item.is-visited a::before { content: "✓"; font-weight: 700; opacity: .9; }
.tour-resume .btn, .tour-begin .btn { background: #fff; color: var(--ink); }

/* ---------- Paradas (el viaje, escena a escena) ---------- */
.tour-stops { list-style: none; margin: var(--space-6) 0 0; padding: 0; display: grid; gap: var(--space-7); }
.tour-stop { display: grid; gap: var(--space-4); scroll-margin-top: var(--space-6); padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.tour-stop[hidden] { display: none; }   /* la runtime oculta las paradas no activas: el atributo gana al grid */
.tour-stop.is-active { border-color: var(--accent); box-shadow: var(--shadow-sm); animation: tourStopIn .32s ease both; }
.tour-stop.is-visited { border-color: var(--accent); }
@keyframes tourStopIn { from { opacity: 0; } to { opacity: 1; } }   /* SOLO opacidad: un transform en la tarjeta que el scroll persigue produce temblor */
.tour-stop-head { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.tour-stop-num { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.tour-stop-title { margin: 0; font: 400 clamp(20px, 3vw, 27px)/1.2 var(--font-reading); }
.tour-stop-summary { margin: 0; color: var(--muted); line-height: 1.6; }
.tour-stop-blocks > * { max-width: none; }

/* Multimedia con sus derechos a la vista (§44-48) */
.tour-media { margin: 0; display: grid; gap: 6px; }
.tour-media img, .tour-media video { width: auto; max-width: 100%; height: auto; max-height: min(62vh, 520px); margin: 0 auto; justify-self: center; object-fit: contain; border-radius: var(--radius-md); display: block; background: var(--bg); }
.tour-media audio { width: 100%; min-height: 44px; }
.tour-media figcaption { color: var(--muted); font-size: 14px; line-height: 1.5; }
.tour-rights { margin: 0; font-size: 12px; color: var(--muted); }
.tour-license { display: inline-block; padding: 1px 8px; border: 1px solid var(--line); border-radius: var(--radius-pill, 999px); background: var(--bg); font-weight: 600; }
.tour-pano { cursor: grab; }

/* Hotspots (base accesible sin JS; la superposición posicionada la monta tours.js sobre la figura) */
.tour-spot-stage { position: relative; }
.tour-spot { position: absolute; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; background: var(--accent); color: #fff; font-size: 16px; line-height: 1; display: grid; place-items: center; cursor: pointer; box-shadow: 0 0 0 4px rgba(0, 0, 0, .25); padding: 0; }
.tour-spot:hover, .tour-spot:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tour-spot.is-open { background: var(--ink); }
.tour-spot-tip { position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); width: min(260px, 70vw); padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-size: 14px; line-height: 1.5; text-align: left; z-index: 3; }
.tour-spot-tip[hidden] { display: none; }
.tour-hotspots, .tour-sources, .tour-credits { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); padding: var(--space-3) var(--space-4); }
.tour-hotspots summary, .tour-sources summary, .tour-credits summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 32px; }
.tour-hotspot-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.tour-hotspot { padding: var(--space-2) var(--space-3); border-left: 3px solid var(--accent-soft); background: var(--surface); border-radius: var(--radius-sm); line-height: 1.5; }
.tour-hotspot-emoji { font-size: 20px; }
.tour-scene { min-height: 120px; border: 1px dashed var(--line); border-radius: var(--radius-md); }

/* Escenas del Visual Engine montadas por tours.js (el bloque síntesis degrada a texto plano) */
.tour-scene .lve-tour-scene { padding: var(--space-3) var(--space-4); }
.tour-scene .lo-block-title { margin: 0 0 var(--space-2); font: 400 19px/1.3 var(--font-reading); }

/* Referencias y navegación entre paradas */
.tour-stop-oa { margin: 0; }
.tour-oa-link { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border: 1px solid var(--accent); border-radius: var(--radius-pill, 999px); color: var(--accent); text-decoration: none; font-weight: 600; }
.tour-oa-link:hover { background: var(--accent-soft); }
.tour-stop-next { margin: 0; font-size: 14px; color: var(--muted); }
.tour-stop-next a { color: var(--accent); }
.tour-sources ul, .tour-credits ul { margin: var(--space-3) 0 0; padding-left: var(--space-5); display: grid; gap: 6px; line-height: 1.5; }

/* Relacionados y pie */
.tour-related { margin-top: var(--space-7); padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.tour-related h2 { margin: 0 0 var(--space-3); font: 400 19px/1.3 var(--font-reading); }
.tour-related-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.tour-related-link { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--ink); text-decoration: none; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.tour-related-link:hover { border-color: var(--accent); color: var(--accent); }
.tour-related-kind { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tour-credits { margin-top: var(--space-5); }
.tour-foot { margin-top: var(--space-6); border-top: 1px solid var(--line); padding-top: var(--space-4); }

/* HUD de la reproducción (lo monta tours.js; sin JS no existe y todo queda legible) */
.tour-hud { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: center; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-5); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.tour-hud-btn { min-height: 44px; padding: 8px 18px; border: 1px solid var(--line); border-radius: var(--radius-pill, 999px); background: var(--bg); color: var(--ink); font: 600 15px/1 var(--font-reading); cursor: pointer; }
.tour-hud-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.tour-hud-btn:disabled { opacity: .45; cursor: default; }
.tour-hud-next { background: var(--accent); color: #fff; border-color: var(--accent); }
.tour-hud-next:hover:not(:disabled) { color: #fff; background: var(--accent); opacity: .9; }
.tour-hud-count { font-size: 13px; color: var(--muted); letter-spacing: .04em; }
.tour-hud-exit { font-weight: 500; }

/* HUD: botón de pantalla completa */
.tour-hud-fs { white-space: nowrap; }

/* ---------- Presentación inmersiva a pantalla completa (viaje enfocado) ---------- */
/* El propio shell pasa a ocupar la pantalla: se ocultan portada/relacionados/créditos/pie y la
   parada activa se centra como escenario, con el HUD fijo al pie. Reutiliza el patrón del Modo Guía. */
.tour-shell:fullscreen, .tour-shell:-webkit-full-screen {
    max-width: none; width: 100%; height: 100%; margin: 0; padding: 0;
    display: flex; flex-direction: column; background: var(--bg); overflow: hidden;
}
.tour-shell:fullscreen .tour-cover,
.tour-shell:fullscreen .tour-related,
.tour-shell:fullscreen .tour-credits,
.tour-shell:fullscreen .tour-foot,
.tour-shell:-webkit-full-screen .tour-cover,
.tour-shell:-webkit-full-screen .tour-related,
.tour-shell:-webkit-full-screen .tour-credits,
.tour-shell:-webkit-full-screen .tour-foot { display: none; }
/* El contenedor manda el scroll: align-items:flex-start para que la parada arranque en el borde
   superior (centrarla verticalmente choca con overflow-y:auto y rebota al cambiar de parada). */
.tour-shell:fullscreen .tour-stops,
.tour-shell:-webkit-full-screen .tour-stops {
    flex: 1 1 auto; margin: 0; padding: var(--space-6) var(--space-5); gap: 0;
    display: flex; align-items: flex-start; justify-content: center; overflow-y: auto;
}
/* Sin max-height/overflow-y en la parada: si ella también hiciera scroll, habría dos
   contenedores anidados peleando — el scroll lo maneja sólo .tour-stops. */
.tour-shell:fullscreen .tour-stop,
.tour-shell:-webkit-full-screen .tour-stop {
    width: min(1000px, 94vw); margin: 0 auto;
}
.tour-shell:fullscreen .tour-media img,
.tour-shell:fullscreen .tour-media video,
.tour-shell:-webkit-full-screen .tour-media img,
.tour-shell:-webkit-full-screen .tour-media video { max-height: min(70vh, 640px); }
.tour-shell:fullscreen .tour-hud,
.tour-shell:-webkit-full-screen .tour-hud {
    position: static; flex: 0 0 auto; margin-top: 0; border-radius: 0;
    border-left: 0; border-right: 0; border-bottom: 0;
}

/* ---------- Móvil y accesibilidad (§50/§51) ---------- */
@media (max-width: 640px) {
    .tour-cover { min-height: 38vh; padding: var(--space-6) var(--space-4); }
    .tour-stop { padding: var(--space-4); }
}
@media (prefers-reduced-motion: reduce) {
    .tour-stop, .tour-index-item a, .tour-oa-link, .tour-related-link, .tour-card { transition: none; }
    .tour-stop.is-active { animation: none; }
}
