/*
 * Museo del Ferroviario de Cistierna · visita virtual
 * Sistema visual: marino de la gorra FEVE, ámbar de señal, verde de la
 * locomotora La Robla 48, papel de oficio y cartón de billete.
 */

@font-face {
  font-family: "Sofia Sans Condensed";
  src: url("../../fonts/sofia-sans-condensed-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sofia Sans";
  src: url("../../fonts/sofia-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../../fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../../fonts/source-serif-4-latin-opsz-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Color */
  --navy: #172a3f;          /* gorra FEVE */
  --navy-2: #22384f;
  --navy-glass: rgba(23, 42, 63, 0.78);
  --navy-glass-strong: rgba(23, 42, 63, 0.92);
  --amber: #e8a33d;         /* señal */
  --amber-deep: #b87412;
  --green: #1f5b45;         /* La Robla 48 */
  --green-hover: #174636;
  --red: #b23a2c;           /* franja de la gorra */
  --paper: #f1f2ee;         /* papel de oficio */
  --paper-2: #e6e8e2;
  --buff: #e4d4a6;          /* cartón de billete */
  --ink: #1c2630;
  --muted: #56636e;
  --line: #d3d7cf;
  --white: #fff;

  /* Tipografía */
  --display: "Sofia Sans Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --ui: "Sofia Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --read: "Source Serif 4", Georgia, "Times New Roman", serif;

  /* Escala 1.25 */
  --fs-xs: 0.8rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-read: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5625rem;
  --fs-2xl: 1.953rem;
  --fs-3xl: 2.441rem;

  /* Medidas */
  --edge: 16px;
  --btn: 44px;
  --gap: 8px;
  --panel-w: clamp(360px, 33vw, 470px);
  --radius: 6px;
  --shadow: 0 10px 30px rgba(10, 20, 32, 0.28);
  --focus: 0 0 0 3px var(--paper), 0 0 0 6px var(--amber);
}

body.mobile {
  --edge: 12px;
  --btn: 46px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--navy);
  color: var(--white);
  font-family: var(--ui);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#pano {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}
button:disabled { cursor: default; opacity: 0.4; }
a { color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.noscript {
  position: absolute; inset: auto 0 0 0; margin: 0; padding: 16px;
  background: var(--paper); color: var(--ink);
}

/* ------------------------------------------------------------ Botones base */

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: inherit;
  transition: background-color .15s;
}
.icon-button svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.no-touch .icon-button:hover { background: rgba(23, 42, 63, 0.08); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 4px;
  font-family: var(--ui);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0.005em;
  text-decoration: none;
  transition: background-color .15s, color .15s, border-color .15s;
}
.button svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.button-primary { background: var(--green); color: var(--white); }
.no-touch .button-primary:hover { background: var(--green-hover); }
.button-quiet { border: 1.5px solid currentColor; color: var(--navy); background: transparent; }
.no-touch .button-quiet:hover { background: rgba(23, 42, 63, 0.06); }

.text-button {
  color: var(--green);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

/* --------------------------------------------------------- Barra superior */

.tour-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: var(--gap);
  padding: var(--edge);
  padding-top: max(var(--edge), env(safe-area-inset-top));
  pointer-events: none;
  transition: right .3s ease;
  isolation: isolate;
}
.tour-top > * { pointer-events: auto; }
/* Oscurece suavemente la esquina de la foto para que el logotipo se lea */
.tour-top::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  z-index: -1;
  width: 460px; height: 210px;
  background: radial-gradient(ellipse farthest-side at top left, rgba(10, 18, 28, 0.75), rgba(10, 18, 28, 0.45) 50%, rgba(10, 18, 28, 0));
}
body.mobile .tour-top::before { width: 220px; height: 150px; }
body.desktop.ficha-open .tour-top { right: var(--panel-w); }

/* Logotipo directamente sobre la foto; en móvil, el sello redondo */
.brand {
  justify-self: start;
  display: inline-flex;
  filter: drop-shadow(0 1px 3px rgba(10, 18, 28, 0.6));
}
.brand-logo { width: auto; height: 64px; }
.brand-seal { display: none; }
body.mobile .brand-logo { display: none; }
body.mobile .brand-seal { display: block; width: 60px; height: 60px; }

/* Nombre de la escena: una placa esmaltada de estación */
#titleBar { justify-self: center; text-align: center; max-width: min(560px, 60vw); }
.station {
  display: inline-block;
  max-width: 100%;
  padding: 7px 22px 9px;
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--white);
  box-shadow: inset 0 0 0 4px var(--navy), inset 0 0 0 5.5px rgba(255, 255, 255, 0.82), var(--shadow);
}
.station-place {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.7);
}
.sceneName {
  margin: 1px 0 0;
  font-family: var(--display);
  font-size: var(--fs-xl);
  font-weight: 760;
  line-height: 1.05;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.mobile #titleBar { max-width: calc(100vw - 2 * var(--edge) - 2 * var(--btn) - 56px); }
body.mobile .station { padding: 5px 14px 7px; }
body.mobile .sceneName { font-size: var(--fs-lg); }

.top-actions { justify-self: end; display: flex; gap: var(--gap); }
.round-button {
  display: grid; place-items: center;
  width: var(--btn); height: var(--btn);
  border-radius: 50%;
  background: var(--navy-glass);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow);
  transition: background-color .15s, border-color .15s;
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .round-button, .dock-button, #viewControls {
    -webkit-backdrop-filter: blur(10px) saturate(130%);
    backdrop-filter: blur(10px) saturate(130%);
  }
}
.round-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#autorotateToggle .icon.off { fill: currentColor; stroke: none; }
.no-touch .round-button:hover { background: var(--navy-glass-strong); }
.round-button.enabled { border-color: var(--amber); color: var(--amber); }
.round-button .icon.on { display: none; }
.round-button.enabled .icon.on { display: block; }
.round-button.enabled .icon.off { display: none; }
#fullscreenToggle { display: none; }
body.fullscreen-enabled #fullscreenToggle { display: grid; }
body.mobile #autorotateToggle { display: none; }

/* --------------------------------------------------------- Dock inferior */

.tour-dock {
  position: absolute;
  left: var(--edge);
  bottom: max(var(--edge), env(safe-area-inset-bottom));
  display: flex;
  gap: var(--gap);
}
.dock-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: var(--btn);
  padding: 0 18px 0 14px;
  border-radius: 999px;
  background: var(--navy-glass);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--white);
  font-weight: 700;
  font-size: var(--fs-md);
  box-shadow: var(--shadow);
  transition: background-color .15s, border-color .15s;
}
.dock-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dock-button circle { fill: var(--navy); }
.no-touch .dock-button:hover { background: var(--navy-glass-strong); }
.dock-button[aria-expanded="true"] { border-color: var(--amber); }
.dock-button[aria-expanded="true"] svg { color: var(--amber); }
body.mobile .tour-dock { left: 50%; transform: translateX(-50%); }
body.mobile.ficha-open .tour-dock { display: none; }

/* Controles de vista */
#viewControls {
  position: absolute;
  right: var(--edge);
  bottom: var(--edge);
  display: grid;
  grid-template-columns: repeat(6, 36px);
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--navy-glass);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow);
  transition: right .3s ease;
}
.viewControlButton { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--white); }
.viewControlButton svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.no-touch .viewControlButton:hover { background: rgba(255, 255, 255, 0.14); }
body.desktop.ficha-open #viewControls { right: calc(var(--panel-w) + var(--edge)); }
body.mobile #viewControls { display: none; }

/* ------------------------------------------------------------- Hotspots */

.hotspot {
  position: relative;
  display: block;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.hotspot-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translate(-50%, 4px);
  width: max-content;
  max-width: 260px;
  padding: 6px 12px 7px;
  border-radius: 4px;
  background: var(--navy);
  color: var(--white);
  font-family: var(--display);
  font-size: var(--fs-md);
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
}
.hotspot-label small {
  display: block;
  font-family: var(--ui);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--amber);
}
.no-touch .hotspot:hover .hotspot-label,
.hotspot:focus-visible .hotspot-label,
.info-hotspot.is-active .hotspot-label {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Punto de información: disco de señal ámbar */
.info-hotspot {
  width: 40px; height: 40px;
  margin: -20px 0 0 -20px;
}
.info-hotspot-disc {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--amber);
  color: var(--navy);
  box-shadow: 0 0 0 3px var(--white), 0 6px 16px rgba(0, 0, 0, 0.45);
  transition: transform .18s ease, background-color .18s, color .18s;
}
.info-hotspot-disc svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.info-hotspot-disc circle { fill: currentColor; stroke: none; }
.no-touch .info-hotspot:hover .info-hotspot-disc { transform: scale(1.12); }
.info-hotspot.is-visited .info-hotspot-disc { background: var(--navy); color: var(--amber); box-shadow: 0 0 0 3px var(--amber), 0 6px 16px rgba(0, 0, 0, 0.45); }
.info-hotspot.is-active .info-hotspot-disc { transform: scale(1.18); background: var(--amber); color: var(--navy); box-shadow: 0 0 0 3px var(--white), 0 0 0 9px rgba(232, 163, 61, 0.45), 0 6px 16px rgba(0, 0, 0, 0.45); }
.info-hotspot:focus-visible { outline: none; }
.info-hotspot:focus-visible .info-hotspot-disc { box-shadow: 0 0 0 3px var(--white), 0 0 0 7px var(--amber); }

/* Paso a otra escena */
.link-hotspot {
  width: 56px; height: 56px;
  margin: -28px 0 0 -28px;
}
.link-hotspot-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(23, 42, 63, 0.62);
  border: 2.5px solid var(--white);
  color: var(--white);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  transition: background-color .18s;
}
.link-hotspot-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.link-hotspot.is-virtual .link-hotspot-icon { border-style: dashed; border-color: var(--amber); }
.no-touch .link-hotspot:hover .link-hotspot-icon { background: var(--navy); }
.link-hotspot:focus-visible { outline: none; }
.link-hotspot:focus-visible .link-hotspot-icon { box-shadow: 0 0 0 4px var(--amber); }

.tooltip-fallback .hotspot-label { display: none; }

/* --------------------------------------------------------------- Ficha */

.ficha {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: var(--panel-w);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  box-shadow: -18px 0 40px rgba(8, 18, 30, 0.35);
  animation: ficha-in .32s cubic-bezier(.2, .7, .2, 1);
  -webkit-user-select: text;
  user-select: text;
}
@keyframes ficha-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.ficha-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px 14px 20px;
  border-bottom: 1px solid var(--line);
}

/* El billete de cartón: código del punto y escena como origen */
.ticket {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  min-height: 46px;
  border-radius: 3px;
  background: var(--buff);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(28, 38, 48, 0.18), inset 0 0 0 1px rgba(28, 38, 48, 0.12);
}
.ticket-code {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0 12px 0 13px;
  font-family: var(--display);
  font-size: var(--fs-xl);
  font-weight: 820;
  letter-spacing: 0.01em;
  color: var(--red);
  border-right: 1.5px dashed rgba(28, 38, 48, 0.38);
  font-variant-numeric: tabular-nums;
}
/* muescas de la perforación */
.ticket-code::before,
.ticket-code::after {
  content: "";
  position: absolute;
  right: -6px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--paper);
}
.ticket-code::before { top: -6px; }
.ticket-code::after { bottom: -6px; }
.ticket-route {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 5px 30px 5px 12px;
  font-size: var(--fs-xs);
  line-height: 1.25;
}
.ticket-route span:first-child { color: #5c5236; font-weight: 600; }
.ticket-route span:last-child { font-family: var(--display); font-size: var(--fs-md); font-weight: 700; }
/* taladro del revisor */
.ticket::after {
  content: "";
  position: absolute;
  right: 10px; top: 50%;
  width: 9px; height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 1px 1px rgba(28, 38, 48, 0.35);
}

.ficha-steps { display: flex; align-items: center; gap: 2px; color: var(--navy); }
.ficha-pos { min-width: 52px; text-align: center; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.ficha-close { margin-left: 4px; }

.ficha-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 24px 28px;
  scrollbar-width: thin;
}
#fichaTitle {
  margin: 0 0 16px;
  font-family: var(--display);
  font-size: var(--fs-2xl);
  font-weight: 760;
  line-height: 1.06;
  letter-spacing: 0.002em;
  color: var(--navy);
  text-wrap: balance;
}
#fichaTitle:focus, #fichaTitle:focus-visible { outline: none; }

.ficha-photo { margin: 0 0 18px; }
.ficha-photo .photo-open {
  display: block;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-2);
  cursor: zoom-in;
}
.ficha-photo img { display: block; width: 100%; height: auto; max-height: 46vh; object-fit: cover; }
.ficha-photo.is-portrait img { max-height: 52vh; object-fit: contain; background: var(--paper-2); }
.ficha-photo figcaption { margin-top: 6px; font-size: var(--fs-xs); color: var(--muted); }

.ficha-lead {
  margin: 0 0 20px;
  font-family: var(--read);
  font-size: var(--fs-lg);
  font-weight: 450;
  line-height: 1.5;
  font-variation-settings: "opsz" 20;
  color: var(--ink);
}

.ficha-more { width: 100%; justify-content: space-between; }
.ficha-more .label-open { display: none; }
.ficha-more[aria-expanded="true"] .label-open { display: inline; }
.ficha-more[aria-expanded="true"] .label-closed { display: none; }
.ficha-more[aria-expanded="true"] { background: transparent; color: var(--green); box-shadow: inset 0 0 0 1.5px var(--green); }
.ficha-more[aria-expanded="true"] svg { transform: rotate(180deg); }
.ficha-more svg { transition: transform .2s; }

.ficha-more-body { padding-top: 18px; }
.ficha-more-body p,
.ficha-extra p {
  margin: 0 0 1em;
  font-family: var(--read);
  font-size: var(--fs-read);
  line-height: 1.62;
  font-variation-settings: "opsz" 16;
  hyphens: auto;
  -webkit-hyphens: auto;
}
.ficha-extra { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.ficha-extra h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: var(--fs-xl);
  font-weight: 720;
  line-height: 1.1;
  color: var(--navy);
}
.ficha-extra .ficha-extra-lead { font-style: italic; color: var(--muted); }

.ficha-subhead {
  margin: 28px 0 10px;
  font-family: var(--display);
  font-size: var(--fs-lg);
  font-weight: 720;
  color: var(--navy);
}

.ficha-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0; padding: 0; list-style: none;
}
.ficha-gallery .photo-open { display: block; width: 100%; aspect-ratio: 1; border-radius: 3px; overflow: hidden; background: var(--paper-2); cursor: zoom-in; }
.ficha-gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.no-touch .ficha-gallery .photo-open:hover img { transform: scale(1.04); }

.ficha-related ul,
.ficha-further ul { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.ficha-related li,
.ficha-further li { border-bottom: 1px solid var(--line); }
.related-link {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 12px;
  width: 100%;
  padding: 12px 4px;
  text-align: left;
  color: var(--ink);
}
.related-code {
  min-width: 64px;
  padding: 3px 6px 4px;
  border-radius: 2px;
  background: var(--buff);
  color: var(--red);
  font-family: var(--display);
  font-size: var(--fs-sm);
  font-weight: 800;
  text-align: center;
}
.related-text { display: flex; flex-direction: column; gap: 2px; }
.related-title { font-weight: 700; line-height: 1.3; }
.related-where { font-size: var(--fs-sm); color: var(--muted); }
.no-touch .related-link:hover .related-title { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }

.ficha-further a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 4px;
  text-decoration: none;
  color: var(--green);
}
.ficha-further a span { font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.ficha-further small { font-size: var(--fs-sm); color: var(--muted); }

.ficha-foot {
  padding: 12px 24px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.ficha-back { width: 100%; }

/* En móvil, la ficha es una hoja inferior */
body.mobile .ficha {
  top: auto;
  left: 0;
  width: 100%;
  max-height: 62vh;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -12px 40px rgba(8, 18, 30, 0.4);
  animation-name: sheet-in;
  transition: max-height .3s ease;
}
body.mobile .ficha.is-expanded { max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); }
@keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
body.mobile .ficha-bar { padding: 10px 8px 10px 14px; }
body.mobile .ficha-pos { display: none; }
body.mobile .ficha-scroll { padding: 16px 16px 20px; }
body.mobile #fichaTitle { font-size: var(--fs-xl); }
body.mobile .ficha-photo img { max-height: 30vh; }
body.mobile .ficha-lead { font-size: var(--fs-read); }
body.mobile .ficha-foot { display: none; }

/* ------------------------------------------------------------ Recorrido */

.route {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 340px;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: var(--white);
  box-shadow: 18px 0 40px rgba(8, 18, 30, 0.35);
  animation: route-in .28s cubic-bezier(.2, .7, .2, 1);
  z-index: 5;
}
@keyframes route-in { from { transform: translateX(-20px); opacity: 0; } to { transform: none; opacity: 1; } }
.route-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 12px 0 24px; }
.route-head h2 { margin: 0; font-family: var(--display); font-size: var(--fs-2xl); font-weight: 760; }
.route-close { color: var(--white); }
.no-touch .route-close:hover { background: rgba(255, 255, 255, 0.1); }
.route-intro { margin: 6px 24px 8px; color: rgba(255, 255, 255, 0.72); font-size: var(--fs-sm); line-height: 1.45; }
.route-lines { flex: 1; overflow-y: auto; padding: 6px 12px 28px 24px; scrollbar-width: thin; }

/* Diagrama de línea: una vía con sus estaciones */
.route-group { margin-top: 14px; }
.route-group h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--amber);
}
.route-group ol { position: relative; margin: 0; padding: 0; list-style: none; }
.route-group ol::before {
  content: "";
  position: absolute;
  left: 8px; top: 18px; bottom: 18px;
  width: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
}
.route-stop {
  position: relative;
  display: grid;
  grid-template-columns: 20px 1fr;
  column-gap: 14px;
  width: 100%;
  padding: 8px 8px 8px 0;
  text-align: left;
  border-radius: 6px;
}
.route-dot {
  grid-row: span 2;
  align-self: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--navy);
  border: 4px solid rgba(255, 255, 255, 0.85);
  position: relative;
  z-index: 1;
}
.route-name { font-weight: 700; font-size: var(--fs-md); line-height: 1.25; }
.route-meta { font-size: var(--fs-xs); color: rgba(255, 255, 255, 0.64); line-height: 1.35; }
.no-touch .route-stop:hover { background: rgba(255, 255, 255, 0.07); }
.route-stop.current .route-dot { background: var(--amber); border-color: var(--white); box-shadow: 0 0 0 4px rgba(232, 163, 61, 0.35); }
.route-stop.current .route-name { color: var(--amber); }

body.mobile .route { width: 100%; }

/* ------------------------------------------- Lectura sin panorámica */

.reading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 20, 32, 0.62);
}
.reading-sheet {
  width: min(1040px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: ficha-in .3s cubic-bezier(.2, .7, .2, 1);
}
.reading-head { display: flex; justify-content: space-between; gap: 16px; padding: 26px 22px 6px 32px; }
.reading-head h2 { margin: 0; font-family: var(--display); font-size: var(--fs-3xl); font-weight: 780; line-height: 1; color: var(--navy); }
.reading-head p { margin: 8px 0 0; max-width: 60ch; color: var(--muted); line-height: 1.45; }
.reading-close { color: var(--navy); flex: none; }
.reading-tools { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 6px 16px; padding: 12px 32px 16px; border-bottom: 1px solid var(--line); }
.reading-tools label { grid-column: 1 / -1; font-size: var(--fs-sm); font-weight: 700; color: var(--navy); }
.reading-tools input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1.5px solid #8a949b;
  border-radius: 4px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  -webkit-user-select: text;
  user-select: text;
}
.reading-tools input:focus-visible { outline: 3px solid var(--amber); outline-offset: 1px; border-color: var(--navy); }
.reading-count { margin: 0; padding-bottom: 12px; font-size: var(--fs-sm); color: var(--muted); }
.reading-list { flex: 1; overflow-y: auto; padding: 8px 32px 40px; scrollbar-width: thin; }
.reading-group-title {
  margin: 26px 0 0;
  font-family: var(--display);
  font-size: var(--fs-2xl);
  font-weight: 760;
  color: var(--green);
}
.reading-scene { margin-top: 14px; }
.reading-scene-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--navy); }
.reading-scene-head h4 { margin: 0; font-family: var(--display); font-size: var(--fs-xl); font-weight: 720; color: var(--navy); }
.reading-scene-head h4 span { font-family: var(--ui); font-size: var(--fs-sm); font-weight: 600; color: var(--muted); margin-left: 6px; }
.reading-go { flex: none; font-size: var(--fs-sm); }
.reading-scene ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0 24px; margin: 0; padding: 0; list-style: none; }
.reading-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  width: 100%;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  color: var(--ink);
}
.reading-card img, .reading-noimg { width: 96px; height: 72px; object-fit: cover; border-radius: 3px; background: var(--paper-2); }
.reading-card-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.reading-code { font-family: var(--display); font-size: var(--fs-sm); font-weight: 800; color: var(--red); }
.reading-title { font-weight: 700; line-height: 1.25; }
.reading-lead {
  font-family: var(--read);
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.no-touch .reading-card:hover .reading-title { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }

body.mobile .reading { padding: 0; }
body.mobile .reading-sheet { border-radius: 0; }
body.mobile .reading-head { padding: 18px 10px 4px 16px; }
body.mobile .reading-head h2 { font-size: var(--fs-2xl); }
body.mobile .reading-tools, body.mobile .reading-list { padding-left: 16px; padding-right: 16px; }
body.mobile .reading-scene-head { flex-direction: column; gap: 4px; }

/* --------------------------------------------------- Visor de fotografías */

.lightbox {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 56px 72px 24px;
  background: rgba(8, 14, 22, 0.94);
}
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; max-width: 100%; max-height: 100%; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 160px); max-height: calc(100dvh - 160px); object-fit: contain; border-radius: 2px; }
.lightbox figcaption { display: flex; gap: 16px; justify-content: space-between; width: 100%; max-width: 760px; margin-top: 12px; font-size: var(--fs-sm); line-height: 1.45; color: rgba(255, 255, 255, 0.86); }
.lightbox-count { flex: none; color: var(--amber); font-weight: 700; }
.lightbox .icon-button { position: absolute; color: var(--white); width: 48px; height: 48px; }
.no-touch .lightbox .icon-button:hover { background: rgba(255, 255, 255, 0.12); }
.lightbox-close { top: 12px; right: 12px; }
.lightbox-prev { left: 12px; top: 50%; margin-top: -24px; }
.lightbox-next { right: 12px; top: 50%; margin-top: -24px; }
body.mobile .lightbox { padding: 60px 8px 16px; }
body.mobile .lightbox-prev, body.mobile .lightbox-next { top: auto; bottom: 10px; margin: 0; }

/* ------------------------------------------------------------- Bienvenida */

#welcome {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 20, 32, 0.55);
}
#welcome.enabled { display: flex; }
#welcome .panel {
  position: relative;
  width: min(460px, 100%);
  padding: 30px 30px 24px;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}
#welcome .close { position: absolute; top: 12px; right: 12px; color: var(--navy); }
.welcome-kicker { margin: 0 0 4px; font-size: var(--fs-sm); font-weight: 700; color: var(--green); }
#welcomeTitle { margin: 0 0 18px; font-family: var(--display); font-size: var(--fs-2xl); font-weight: 780; line-height: 1.04; color: var(--navy); }
#welcome .slides { overflow: hidden; margin: 0 -30px; }
#welcome .steps { display: flex; margin: 0; padding: 0; list-style: none; transition: transform .35s cubic-bezier(.2, .7, .2, 1); }
#welcome .steps li { flex: 0 0 100%; display: flex; flex-direction: column; padding: 0 30px; }
#welcome .title { display: block; margin: 16px 0 6px; font-family: var(--display); font-size: var(--fs-xl); font-weight: 720; color: var(--navy); }
#welcome .desc { display: block; font-family: var(--read); font-size: var(--fs-read); line-height: 1.55; color: var(--ink); min-height: 5em; }

.step-art {
  display: grid;
  place-items: center;
  height: 96px;
  border-radius: 8px;
  background: var(--navy);
  color: var(--white);
}
.step-art svg { width: 200px; height: 100px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.step-art .art-line { stroke: rgba(255, 255, 255, 0.45); stroke-width: 2.4; fill: none; }
.step-art .art-arrow { stroke: var(--amber); stroke-width: 2.4; }
.step-art .art-text { fill: var(--white); stroke: none; font-family: var(--display); font-size: 22px; font-weight: 800; }
.step-art.legend { display: flex; justify-content: center; gap: 22px; padding: 0 12px; }
.legend-item { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 600; text-align: center; color: rgba(255, 255, 255, 0.86); max-width: 120px; }
.mini-link { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 2.5px solid var(--white); background: rgba(255, 255, 255, 0.08); }
.mini-link.virtual { border-style: dashed; border-color: var(--amber); }
.mini-link svg { width: 24px; height: 24px; stroke: var(--white); stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mini-info { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--amber); color: var(--navy); font-family: var(--read); font-weight: 800; font-size: 20px; box-shadow: 0 0 0 3px var(--white); }
.mini-dock { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.35); font-size: var(--fs-sm); font-weight: 700; color: var(--white); }

#welcome .dots { display: flex; justify-content: center; gap: 8px; margin: 14px 0 18px; }
#welcome .dots button { width: 9px; height: 9px; border-radius: 50%; background: var(--line); transition: background-color .2s, width .2s; }
#welcome .dots button.current { width: 26px; border-radius: 5px; background: var(--navy); }
#welcome .actions { display: flex; gap: 10px; }
#welcome .prev { width: 46px; padding: 0; flex: none; }
#welcome .next { flex: 1; }

/* ------------------------------------------------- Movimiento reducido */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
