/* Railglobe — atlas ferroviario clásico, modernizado. Entorno claro. */

/* ---------- Fuentes autoalojadas (OFL) ---------- */
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/source-serif-4-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/source-serif-4-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/source-serif-4-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/source-serif-4-cyrillic-ext-600-normal.woff2) format("woff2"); unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/source-serif-4-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/source-serif-4-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/source-serif-4-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/source-serif-4-cyrillic-ext-400-normal.woff2) format("woff2"); unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }

@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-sans-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-sans-cyrillic-ext-400-normal.woff2) format("woff2"); unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-sans-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-sans-cyrillic-ext-500-normal.woff2) format("woff2"); unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-cyrillic-ext-600-normal.woff2) format("woff2"); unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }

@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-mono-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-mono-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }

/* ---------- Variables ---------- */
:root {
  --paper: #f4efe3;
  --paper-2: #ebe3d0;
  --card: #fbf8f1;
  --ink: #2b2a26;
  --ink-soft: #5e5a50;
  --ink-faint: #6b6558; /* ≥4,5:1 sobre --card */
  --rule: #cdc2a8;
  --sea: #c8d3d5;
  --accent: #8a2f24;      /* rojo óxido, librea ferroviaria */
  --ok: #3e7a4c;
  --mid: #b07d1f;
  --late: #a3392b;
  --unk: #8f8b82;
  --nodata: #ddd6c6;
  --board: #1f2421;
  --board-ink: #f1b33f;
  --serif: "Source Serif 4", "Noto Serif", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --head-h: 56px;
  --radius: 3px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  text-rendering: optimizeLegibility;
}
body[data-lang="zh"] { --serif: "Source Serif 4", "Songti SC", "Noto Serif CJK SC", "SimSun", serif; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: #5e1f18; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.005em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 6px 10px; z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--ink-soft); }

/* ---------- Cabecera ---------- */
.masthead {
  position: sticky; top: 0; z-index: 30;
  height: var(--head-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 1px 0 #fff8 inset;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; }
.brand-name { font: 600 21px/1 var(--serif); letter-spacing: .01em; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  color: var(--ink-soft); text-decoration: none; padding: 6px 10px; border-radius: var(--radius);
  font-weight: 500; font-size: 14px;
}
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.lang select {
  font: 500 13px var(--sans); color: var(--ink);
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 5px 26px 5px 9px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.lang-hint {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 40;
  box-shadow: 0 6px 18px -10px #3a2e1a66;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 6px 6px 6px 12px; display: flex; align-items: center; gap: 6px; font-size: 14px;
}
.lang-hint[hidden] { display: none; }
.lang-hint-close { border: 0; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: var(--ink-soft); padding: 2px 6px; }

/* ---------- Pie ---------- */
.foot { border-top: 1px solid var(--rule); padding: 20px 16px 28px; font-size: 13px; color: var(--ink-soft); text-align: center; }
.foot p { margin: 4px 0; }
.foot-links a { margin: 0 8px; color: var(--ink-soft); }
.foot-osm a { color: var(--ink-soft); }
.is-map .foot { display: none; }

/* ---------- Mapa ---------- */
.is-map { overflow: hidden; }
.mapwrap { position: relative; height: calc(100dvh - var(--head-h)); }
.mapwrap .map { position: absolute; inset: 0; background: var(--sea); }
.maplibregl-ctrl-group { background: var(--card); border: 1px solid var(--rule); box-shadow: none !important; border-radius: var(--radius); }
.maplibregl-ctrl-group button + button { border-top-color: var(--rule); }
.maplibregl-ctrl-attrib { background: #fbf8f1d9 !important; font-size: 11px; }
.maplibregl-ctrl-attrib a { color: var(--ink-soft); }

/* Fichas de papel */
.sheet {
  position: absolute; z-index: 10;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 #00000008, 0 6px 18px -12px #3a2e1a55;
  overflow: auto;
  overscroll-behavior: contain;
}
.sheet-grip { display: none; }
.sheet-info { top: 14px; left: 14px; width: 320px; max-height: calc(100% - 28px); padding: 16px 18px; }
.sheet-side { top: 14px; right: 14px; width: 340px; max-height: calc(100% - 130px); padding: 0; display: flex; flex-direction: column; }
.sheet-train { bottom: 14px; left: 348px; width: 380px; max-height: calc(100% - 28px); padding: 0; }
.sheet[hidden], .mobile-tabs[hidden] { display: none !important; }
.sheet-title { margin: 2px 0 10px; font-size: 26px; }
.crumbs { font-size: 12.5px; color: var(--ink-faint); display: flex; gap: 6px; text-transform: uppercase; letter-spacing: .06em; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.seo-text p { margin: 0 0 10px; }
.continent-list, .country-links { list-style: none; margin: 10px 0 4px; padding: 0; border-top: 1px solid var(--rule); }
.continent-list li, .country-links li { border-bottom: 1px solid var(--rule); }
.continent-list a { display: flex; flex-direction: column; padding: 8px 2px; text-decoration: none; color: var(--ink); }
.continent-list a:hover, .continent-list a.is-hover { background: var(--paper); }
.cl-name { font: 600 17px var(--serif); }
.cl-count { font-size: 13px; color: var(--ink-soft); }
.cl-count b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.country-links li { display: flex; justify-content: space-between; padding: 6px 2px; font-size: 14px; }
.country-links span { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.controls { margin: 12px 0 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; font-size: 13px; color: var(--ink-soft); }
.controls select { width: 100%; min-width: 0; font: 14px var(--sans); padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; color: var(--ink); }
.controls select + label { margin-top: 6px; }
.controls select:disabled { color: var(--ink-soft); background: transparent; }
.controls optgroup { font-style: normal; font-weight: 600; color: var(--ink-soft); }
.controls option { color: var(--ink); font-weight: 400; }
.live-line { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; display: flex; align-items: center; gap: 6px; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px #3e7a4c22; animation: pulse 2.4s ease-in-out infinite; }
.dot-live.is-stale { background: var(--late); animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px #3e7a4c00; } }

/* Leyenda: forma + color */
.sheet-links { margin: 10px 0 0; font-size: 12px; display: flex; gap: 14px; }
.sheet-links a { color: var(--ink-soft); }
.legend { margin-top: 14px; border-top: 1px solid var(--rule); padding-top: 10px; font-size: 13px; }
.legend summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.legend ul, ul.plain { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 5px; }
.legend li, ul.plain li { display: flex; align-items: center; gap: 9px; }
.sym { flex: none; width: 14px; height: 14px; display: inline-block; }
.sym-ok { border-radius: 50%; background: var(--ok); border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--ok); }
.sym-mid { background: var(--mid); transform: rotate(45deg) scale(.82); border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--mid); }
.sym-late { background: var(--late); border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--late); transform: scale(.86); }
.sym-unk { border-radius: 50%; background: var(--unk); transform: scale(.75); }
.sym-est { border-radius: 50%; border: 2.5px solid var(--ok); background: var(--card); }
.sym-alert { height: 0; border-top: 3px dashed var(--late); width: 22px; }
.sym-nodata { background: repeating-linear-gradient(45deg, var(--nodata) 0 3px, #cfc7b4 3px 5px); border: 1px solid #bfb59c; }

/* Pestañas y listas */
.tabs { display: flex; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--card); z-index: 1; }
.tabs button {
  flex: 1; border: 0; background: none; cursor: pointer; padding: 12px 8px 10px;
  font: 600 13.5px var(--sans); color: var(--ink-soft); border-bottom: 2px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.badge { display: inline-block; min-width: 20px; padding: 0 5px; margin-left: 4px; border-radius: 10px; background: var(--paper-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.tabpanel { padding: 4px 14px 12px; overflow: auto; }
.tabpanel[hidden] { display: none; }
.panel-note { font-size: 12px; color: var(--ink-faint); margin: 8px 0; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { border-top: 1px solid var(--rule); padding: 9px 0; font-size: 13.5px; }
.feed button.item { all: unset; cursor: pointer; display: block; width: 100%; }
.feed button.item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.feed .item-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.feed .item-title { font-weight: 600; }
.feed .item-meta { color: var(--ink-soft); font-size: 12.5px; }
.feed .empty { color: var(--ink-faint); border: 0; font-style: italic; }
.sev { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 2px; white-space: nowrap; }
.sev-severe { background: #a3392b1a; color: var(--late); }
.sev-warning { background: #b07d1f1f; color: #7d5810; }
.sev-info { background: var(--paper-2); color: var(--ink-soft); }
.alert-desc { margin: 4px 0 0; color: var(--ink-soft); white-space: pre-line; }
.delay-pill { font: 500 13px var(--mono); padding: 1px 6px; border-radius: 2px; white-space: nowrap; }
.delay-pill.ok { color: var(--ok); background: #3e7a4c18; }
.delay-pill.mid { color: #7d5810; background: #b07d1f22; }
.delay-pill.late { color: var(--late); background: #a3392b18; }
.delay-pill.unk { color: var(--ink-soft); background: var(--paper-2); }

/* Detalle del tren con panel de estación */
.close { position: absolute; top: 8px; right: 8px; z-index: 2; border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: #f1e6cf; padding: 4px 8px; }
.board { background: var(--board); color: #e9e2d0; padding: 14px 16px 12px; border-radius: var(--radius) var(--radius) 0 0; }
.board-line { font: 500 12px var(--mono); color: #b9b19c; letter-spacing: .08em; text-transform: uppercase; display: flex; gap: 10px; align-items: center; }
.board-num { font: 600 24px/1.15 var(--serif); color: #fff6e3; margin: 4px 0 2px; }
.board-route { font-size: 14px; color: #e9e2d0; }
.board-grid { display: grid; grid-template-columns: 1fr auto auto; gap: 2px 14px; margin-top: 12px; align-items: end; }
.board-grid .lbl { font: 500 10.5px var(--mono); color: #9d967f; text-transform: uppercase; letter-spacing: .1em; }
.board-grid .val { font: 500 22px/1 var(--mono); color: var(--board-ink); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.board-grid .val.strike { color: #9d967f; text-decoration: line-through; font-size: 16px; }
.board-grid .stop { font: 500 15px var(--sans); color: #fff6e3; }
.postype { display: inline-flex; align-items: center; gap: 5px; font: 500 11px var(--mono); padding: 1px 6px; border: 1px solid #ffffff30; border-radius: 2px; }
.postype svg { width: 11px; height: 11px; }
.train-meta { padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; border-bottom: 1px solid var(--rule); color: var(--ink-soft); }
.stops { list-style: none; margin: 0; padding: 6px 16px 14px; }
.stops li { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center; padding: 4px 0; font-size: 13.5px; position: relative; }
.stops li::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--rule); }
.stops li:first-child::before { top: 50%; }
.stops li:last-child::before { bottom: 50%; }
.stops .tick { width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink-faint); position: relative; z-index: 1; margin-left: 2px; }
.stops li.past { color: var(--ink-faint); }
.stops li.past .tick { background: var(--ink-faint); }
.stops li.next .tick { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px #8a2f2425; }
.stops li.next .name { font-weight: 600; }
.stops .t { font: 500 13px var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.stops .t s { color: var(--ink-faint); margin-right: 4px; font-size: 12px; }
.stops-loading { padding: 10px 16px; color: var(--ink-faint); font-size: 13px; }

/* Continentes en el mapamundi (marcadores DOM, solo 6) */
.cont-marker {
  all: unset; cursor: pointer; text-align: center;
  background: var(--card); border: 1px solid var(--ink); border-radius: var(--radius);
  padding: 6px 11px 7px; box-shadow: 3px 3px 0 #2b2a2620; transition: transform .12s;
}
.cont-marker:hover, .cont-marker:focus-visible { transform: translateY(-2px); box-shadow: 3px 5px 0 #2b2a2626; }
.cont-marker:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.cont-marker .n { display: block; font: 600 16px/1.15 var(--serif); }
.cont-marker .c { display: block; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.cont-marker .c b { color: var(--ink); font-variant-numeric: tabular-nums; }
.cont-marker.is-empty .c { color: var(--ink-faint); }

.map-tip { font-size: 13px; }
.maplibregl-popup-content { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 7px 10px; box-shadow: none; font: 13px var(--sans); }
.maplibregl-popup-tip { display: none; }
.noscript { padding: 20px; }

/* ---------- Páginas de texto ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 32px 16px 48px; }
.page h1 { font-size: 36px; margin: 0 0 14px; }
.page h2 { font-size: 22px; margin: 32px 0 10px; padding-top: 14px; border-top: 1px solid var(--rule); }
.page .lead { font: 400 19px/1.5 var(--serif); color: var(--ink-soft); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; }
.card h3 { margin: 0 0 8px; font-size: 19px; }
.card-sub { font: 400 14px var(--sans); color: var(--ink-soft); margin-left: 4px; }
.card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13.5px; }
.card dt { color: var(--ink-faint); }
.card dd { margin: 0; overflow-wrap: anywhere; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.table-wrap { overflow-x: auto; }
.table th, .table td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.status .table { font-size: 13px; }
.status-ok { color: var(--ok); font-weight: 600; white-space: nowrap; }
.status-bad { color: var(--late); font-weight: 600; white-space: nowrap; }
.page-404 { text-align: center; }
.page-404 .big { font: 600 96px/1 var(--serif); color: var(--paper-2); -webkit-text-stroke: 1px var(--rule); margin: 20px 0 0; }
.btn { display: inline-block; padding: 9px 16px; border: 1px solid var(--ink); border-radius: var(--radius); color: var(--ink); text-decoration: none; font-weight: 500; }
.btn:hover { background: var(--ink); color: var(--paper); }

/* ---------- Móvil: hojas que suben desde abajo ---------- */
@media (max-width: 860px) {
  .masthead { gap: 10px; padding: 0 12px; }
  .brand-name { font-size: 19px; }
  .nav { gap: 0; }
  .nav a { padding: 6px 7px; font-size: 13px; }
  .nav a:first-child { display: none; }
  .sheet { left: 0 !important; right: 0 !important; width: auto !important; bottom: 0; top: auto !important;
    border-radius: 12px 12px 0 0; border-bottom: 0; max-height: 42dvh; }
  .sheet-grip { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--rule); margin: 8px auto 2px; }
  .sheet-info { padding: 4px 16px 14px; }
  .sheet { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .sheet-info.is-collapsed { max-height: 118px; overflow: hidden; }
  .sheet-side { display: none; }
  .sheet-side.is-open { display: flex; z-index: 12; }
  .sheet-train { z-index: 14; max-height: 62dvh; }
  .sheet-train .sheet-grip { position: absolute; left: 0; right: 0; top: 0; background: #ffffff40; }
  .sheet-title { font-size: 22px; }
  .mobile-tabs { display: flex; }
  .controls select, #lang-select { font-size: 16px; } /* evita el zoom de iOS */
  .lang-hint { top: calc(var(--head-h, 56px) + 8px); bottom: auto; }
  .page h1 { font-size: 28px; }
}
@media (min-width: 861px) {
  .mobile-tabs { display: none; }
}
@media (min-width: 861px) and (max-width: 1180px) {
  .sheet-train { left: auto; right: 14px; bottom: 14px; z-index: 12; }
}
.mobile-tabs {
  position: absolute; z-index: 11; left: 12px; top: 12px; gap: 6px;
}
.mobile-tabs button {
  border: 1px solid var(--rule); background: var(--card); border-radius: var(--radius);
  font: 600 13px var(--sans); padding: 7px 10px; color: var(--ink); cursor: pointer;
}
@media (max-width: 400px) {
  .brand-name { display: none; }
}
:root { color-scheme: light; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
