/* Rail Explorer private preview — cinematic Nordic dark theme
   Brand-aligned with Railroading with JM static site; English UI. */

:root {
  --re-bg0: #07080c;
  --re-bg1: #0b0c10;
  --re-bg2: #12141c;
  --re-bg3: #1a1d28;
  --re-bg4: #232735;
  --re-text: #f3f5f7;
  --re-muted: #9aa7b2;
  --re-faint: #6b7782;
  --re-accent: #4fc3f7;
  --re-accent-soft: rgba(79, 195, 247, 0.16);
  --re-warn: #ffd54f;
  --re-ok: #81c784;
  --re-border: rgba(255, 255, 255, 0.08);
  --re-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --re-radius: 14px;
  --re-focus: 0 0 0 3px rgba(79, 195, 247, 0.55);
  --re-header-h: auto;
  --re-touch: 44px;
  --re-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

.re-body {
  font-family: var(--re-font);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(79, 195, 247, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(129, 199, 132, 0.08), transparent 50%),
    linear-gradient(180deg, #0a0b10 0%, var(--re-bg0) 40%, #08090d 100%);
  color: var(--re-text);
  line-height: 1.45;
  max-width: 100%;
  overflow-x: clip;
  width: 100%;
}

.re-site-bar,
.re-header,
.re-main,
.re-results,
.re-footer {
  max-width: 100%;
  min-width: 0;
}

.re-site-bar {
  padding: 0.65rem 1rem 0.35rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.re-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  align-items: stretch;
  padding: 1rem 1.25rem 0.95rem;
  border-bottom: 1px solid var(--re-border);
  background: rgba(11, 12, 16, 0.92);
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
}
.re-explore-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 28rem);
  gap: 0;
  align-items: stretch;
  border: 1px solid #2a3140;
  border-radius: 16px;
  background: linear-gradient(160deg, #12161e 0%, #0e1218 55%, #0c1016 100%);
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}
.re-site-bar .site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  align-items: center;
  margin: 0 0 0.45rem;
  padding: 0.55rem 0.85rem;
  background: var(--re-bg2);
  border: 1px solid var(--re-border);
  border-radius: 10px;
  font-size: 1.05rem;
}
.re-site-bar .site-nav a,
.re-site-bar .site-nav a:link,
.re-site-bar .site-nav a:visited {
  color: var(--re-accent);
  text-decoration: none;
  font-weight: 600;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.re-site-bar .site-nav a:hover,
.re-site-bar .site-nav a:focus-visible {
  color: #fff;
  text-decoration: underline;
  background: transparent;
  border: none;
  box-shadow: none;
}
.re-site-bar .site-nav a[aria-current="page"],
.re-site-bar .site-nav a[aria-current="page"]:link,
.re-site-bar .site-nav a[aria-current="page"]:visited {
  color: #ffeb3b;
  text-decoration: none;
  background: transparent;
  border: none;
  box-shadow: none;
}
.re-site-bar .site-nav a[aria-current="page"]:hover,
.re-site-bar .site-nav a[aria-current="page"]:focus-visible {
  color: #fff59d;
  text-decoration: underline;
}

.re-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--re-accent);
  color: #041018;
  padding: 0.75rem 1rem;
  z-index: 100;
  font-weight: 700;
}
.re-skip:focus {
  left: 1rem;
  top: 1rem;
}


/* Compact streaming-library Explore introduction */
.re-explore-intro {
  padding: 1rem 1.15rem;
  max-width: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 0;
  background: transparent;
  border: none;
  border-right: 1px solid rgba(42, 49, 64, 0.85);
  box-sizing: border-box;
}
.re-header-search {
  padding: 0.95rem 1.05rem;
  background: rgba(7, 8, 12, 0.28);
}
.re-header-brand.re-explore-intro .re-title {
  letter-spacing: 0.015em;
  font-size: clamp(1.35rem, 2.3vw, 1.85rem);
}
.re-header-brand.re-explore-intro .re-subtitle {
  font-size: 0.92rem;
  line-height: 1.4;
  max-width: 34rem;
  color: #8a98a4;
}
@media (max-width: 900px) {
  .re-explore-workspace {
    grid-template-columns: 1fr;
  }
  .re-explore-intro {
    padding: 0.9rem 0.95rem 0.7rem;
    border-right: none;
    border-bottom: 1px solid rgba(42, 49, 64, 0.85);
  }
  .re-header-search {
    padding: 0.85rem 0.95rem 0.95rem;
  }
}

/* ---------- Header ---------- */
.re-eyebrow {
  margin: 0 0 0.2rem;
  color: var(--re-accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
}

.re-title {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  letter-spacing: 0.08em;
  font-weight: 800;
  line-height: 1.1;
}

.re-subtitle {
  margin: 0.35rem 0 0;
  color: var(--re-muted);
  font-size: 1.05rem;
}

.re-header-search {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.re-search-label {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--re-warn);
}

.re-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: stretch;
  width: 100%;
}

.re-search-form > .re-btn,
.re-search-form > .re-btn-primary {
  flex: 0 0 auto;
}

.re-journey-search-input {
  display: block;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  min-width: 0;
  min-height: var(--re-touch);
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(79, 195, 247, 0.45);
  background: var(--re-bg2);
  color: var(--re-text);
  font-size: 1.05rem;
}

.re-journey-search-input:focus-visible {
  outline: none;
  box-shadow: var(--re-focus);
  border-color: var(--re-accent);
}

.re-search-hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--re-faint);
  line-height: 1.35;
}

.re-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  grid-column: 1 / -1;
}

.re-btn {
  min-height: var(--re-touch);
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--re-border);
  background: var(--re-bg3);
  color: var(--re-text);
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.re-btn:hover {
  background: var(--re-bg4);
  border-color: rgba(255, 255, 255, 0.18);
}
.re-btn:focus-visible {
  outline: none;
  box-shadow: var(--re-focus);
}
.re-btn-primary {
  background: var(--re-accent);
  color: #041018;
  border-color: transparent;
}
.re-btn-primary:hover {
  background: #73d2fa;
}
.re-btn.has-active-filters .re-filter-btn-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #041018;
  color: var(--re-accent);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 820px) {
  .re-search-form {
    flex-direction: column;
  }
  .re-station-combo,
  .re-journey-search-input,
  .re-search-form .re-btn {
    width: 100%;
  }
}

/* ---------- Main map + panel ---------- */
.re-main {
  display: grid;
  gap: 0;
  /* Content-driven height — do not fill the viewport with empty space */
  align-items: start;
}

.re-map-section {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 30%),
    var(--re-bg1);
  border-bottom: 1px solid var(--re-border);
}

.re-map-wrap {
  position: relative;
  width: 100%;
  min-height: 0;
  max-height: none;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(7, 8, 12, 0.35);
}

.re-map {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 420px;
  touch-action: manipulation;
}

.re-map-section,
.re-panel,
.re-panel-inner {
  min-width: 0;
  max-width: 100%;
}

.re-map-note {
  position: sticky;
  bottom: 0;
  margin: 0;
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  color: var(--re-faint);
  background: linear-gradient(transparent, rgba(7, 8, 12, 0.92));
  pointer-events: none;
}

.re-loading,
.re-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
  background: rgba(7, 8, 12, 0.82);
  z-index: 5;
  font-size: 1.15rem;
}
/* Author display:grid must not override the hidden attribute */
.re-loading[hidden],
.re-error[hidden] {
  display: none !important;
}
.re-error {
  color: #ffab91;
}

/* SVG interaction states */
.re-line-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.25s ease, stroke-width 0.25s ease, filter 0.25s ease;
  cursor: pointer;
}
.re-map.is-dimming .re-line-path {
  opacity: 0.28;
}
.re-map.is-dimming .re-line-path.is-active,
.re-map.is-dimming .re-line-path.is-hover,
.re-line-path:focus-visible {
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.28));
}
.re-line-path.is-hover,
.re-line-path:focus-visible {
  filter: drop-shadow(0 0 5px rgba(79, 195, 247, 0.35));
}
.re-line-path.is-active {
  filter: drop-shadow(0 0 7px rgba(79, 195, 247, 0.5));
}
/* Uncovered: dashed + muted; selection must not look "covered" */
.re-line-path.is-uncovered {
  stroke-linecap: butt;
}
.re-map.is-dimming .re-line-path.is-uncovered.is-active,
.re-map.is-dimming .re-line-path.is-uncovered.is-hover,
.re-line-path.is-uncovered:focus-visible {
  opacity: 0.92;
  filter: none;
  outline: 2px solid #cfd8dc;
  outline-offset: 3px;
}
.re-coverage-label {
  fill: #b0bec5;
  font-size: 12px;
  font-family: var(--re-font);
  font-weight: 600;
  pointer-events: none;
  user-select: none;
}
.re-coverage-callout-bg {
  fill: rgba(26, 29, 40, 0.92);
  stroke: #5c6b7a;
  stroke-width: 1.5;
  pointer-events: none;
}
.re-coverage-callout-title {
  fill: #e8eef2;
  font-size: 13px;
  font-family: var(--re-font);
  font-weight: 700;
  pointer-events: none;
}
.re-coverage-callout-sub {
  fill: #b0bec5;
  font-size: 12px;
  font-family: var(--re-font);
  font-weight: 600;
  pointer-events: none;
}
.re-extension-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  cursor: pointer;
  transition: opacity 0.25s ease;
}
.re-extension-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  cursor: pointer;
  pointer-events: stroke;
}
.re-map.is-dimming .re-extension-path {
  opacity: 0.22;
}
.re-map.is-dimming .re-extension-path.is-active,
.re-extension-path:focus-visible {
  opacity: 1;
  outline: 2px solid #90a4ae;
  outline-offset: 3px;
}
.re-extension-label {
  fill: #90a4ae;
  font-size: 11px;
  font-family: var(--re-font);
  font-weight: 600;
  pointer-events: none;
  user-select: none;
}
.re-line-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 22;
  cursor: pointer;
  pointer-events: stroke;
}

.re-station {
  cursor: pointer;
}
.re-station circle {
  transition: transform 0.18s ease, fill 0.2s ease, stroke 0.2s ease, stroke-width 0.18s ease;
  transform-box: fill-box;
  transform-origin: center;
}
.re-station:hover circle,
.re-station:focus-visible circle,
.re-station.is-hover circle,
.re-station.is-active circle {
  stroke: #fff;
  stroke-width: 2.5;
  transform: scale(1.18);
}
.re-station.is-extension-endpoint circle {
  stroke-dasharray: 3 2;
}
.re-station-label {
  fill: var(--re-muted);
  font-size: 13px;
  font-family: var(--re-font);
  pointer-events: none;
  user-select: none;
  transition: fill 0.18s ease, opacity 0.18s ease;
}
.re-station:hover .re-station-label,
.re-station:focus-visible .re-station-label,
.re-station.is-hover .re-station-label,
.re-station.is-active .re-station-label {
  fill: #f3f5f7;
}
.re-map.is-dimming .re-station:not(.is-related) {
  opacity: 0.35;
}
.re-map.is-dimming .re-station.is-related,
.re-map.is-dimming .re-station.is-active {
  opacity: 1;
}

/* One-time initial map reveal */
.re-map.is-revealing .re-line-path,
.re-map.is-revealing .re-extension-path {
  animation: re-map-line-in 0.9s ease both;
}
.re-map.is-revealing .re-line-group:nth-child(2) .re-line-path { animation-delay: 0.06s; }
.re-map.is-revealing .re-line-group:nth-child(3) .re-line-path { animation-delay: 0.12s; }
.re-map.is-revealing .re-line-group:nth-child(4) .re-line-path { animation-delay: 0.18s; }
.re-map.is-revealing .re-line-group:nth-child(5) .re-line-path { animation-delay: 0.24s; }
.re-map.is-revealing .re-station {
  opacity: 0;
  animation: re-map-station-in 0.55s ease 0.55s both;
}
@keyframes re-map-line-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes re-map-station-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.re-legend-list {
  margin: 0.35rem 0 1rem;
  padding-left: 1.15rem;
  color: var(--re-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.re-legend-list li {
  margin: 0.35rem 0;
}
.re-coverage-note {
  margin: 0.85rem 0 1rem;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid #7a8494;
  background: rgba(255, 255, 255, 0.03);
}
.re-coverage-note h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}
.re-coverage-note ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--re-muted);
  font-size: 0.92rem;
}
.re-muted-note {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--re-faint);
}

.re-line-label-float {
  position: absolute;
  pointer-events: none;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: rgba(18, 20, 28, 0.95);
  border: 1px solid var(--re-border);
  color: var(--re-text);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--re-shadow);
  z-index: 6;
  transform: translate(-50%, -120%);
}

/* Panel */
.re-panel {
  background: var(--re-bg2);
  border-top: 1px solid var(--re-border);
  max-height: 42vh;
  overflow: auto;
}

.re-panel-handle {
  width: 48px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0.55rem auto 0.25rem;
}

.re-panel-inner {
  padding: 0.75rem 1.25rem 1.5rem;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.re-panel-inner.is-panel-swap {
  opacity: 0.55;
  transform: translateY(5px);
}

.re-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
}
.re-panel h3 {
  margin: 1.15rem 0 0.45rem;
  font-size: 1.05rem;
  color: var(--re-accent);
  letter-spacing: 0.03em;
}
.re-panel p {
  margin: 0.35rem 0;
  color: var(--re-muted);
}
.re-panel .re-lead {
  color: var(--re-text);
  font-size: 1.05rem;
}

.re-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.65rem;
  margin: 0.9rem 0 0.4rem;
}
.re-train-type-list {
  list-style: none;
  margin: 0.35rem 0 0.5rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.re-train-type-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
}
.re-train-type-count {
  font-size: 0.9rem;
  color: var(--re-muted);
}
.re-meta-card {
  background: #12161e;
  border: 1px solid #262d3a;
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
}
.re-meta-card strong {
  display: block;
  font-size: 1.25rem;
  color: var(--re-text);
}
.re-meta-card span {
  display: block;
  font-size: 0.82rem;
  color: var(--re-muted);
  margin-top: 0.15rem;
}

.re-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}
.re-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--re-bg4);
  border: 1px solid var(--re-border);
  font-size: 0.85rem;
  color: var(--re-text);
}
.re-chip button {
  border: 0;
  background: transparent;
  color: var(--re-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.1rem;
  min-width: 1.4rem;
  min-height: 1.4rem;
}
.re-chip-line {
  border-color: transparent;
  color: #041018;
  font-weight: 700;
}
.re-chip-format {
  background: var(--re-accent-soft);
  color: var(--re-accent);
  border-color: rgba(79, 195, 247, 0.25);
}
.re-chip-stock {
  background: rgba(255, 213, 79, 0.12);
  color: #ffe082;
  border-color: rgba(255, 213, 79, 0.28);
  font-weight: 700;
}
.re-chip-discovery {
  background: rgba(206, 147, 216, 0.12);
  color: #ce93d8;
  border-color: rgba(206, 147, 216, 0.3);
  font-weight: 650;
}
.re-chip-row-stock {
  margin: 0.25rem 0 0.15rem;
}
.re-chip-row-discovery {
  margin: 0.15rem 0 0.1rem;
}
.re-filter-count {
  opacity: 0.65;
  font-weight: 600;
  font-size: 0.92em;
}

.re-latest-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.re-latest-list button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--re-border);
  background: var(--re-bg3);
  color: var(--re-text);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  font-size: 0.95rem;
  min-height: var(--re-touch);
}
.re-latest-list button:hover {
  border-color: rgba(79, 195, 247, 0.4);
}
.re-latest-list button:focus-visible {
  outline: none;
  box-shadow: var(--re-focus);
}

.re-coverage-note {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(129, 199, 132, 0.1);
  border: 1px solid rgba(129, 199, 132, 0.28);
  color: #c8e6c9;
  font-size: 0.95rem;
}
.re-coverage-prep {
  background: rgba(255, 213, 79, 0.08);
  border-color: rgba(255, 213, 79, 0.28);
  color: #ffe082;
}

@media (min-width: 960px) {
  .re-main {
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.9fr);
    align-items: start;
  }
  .re-map-section {
    border-bottom: 0;
    border-right: 1px solid var(--re-border);
  }
  .re-map-wrap {
    max-height: none;
    height: auto;
    min-height: 0;
  }
  .re-map {
    min-height: 480px;
  }
  .re-panel {
    max-height: none;
    border-top: 0;
    overflow: visible;
    align-self: start;
  }
  .re-panel-handle {
    display: none;
  }
}

/* ---------- Results ---------- */
.re-results {
  padding: 1.1rem 1.5rem 2.5rem;
  margin-top: 0;
  border-top: 1px solid var(--re-border);
  background: rgba(7, 8, 12, 0.65);
}

.re-results-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.re-results-heading {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.re-results-title {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.4rem);
  font-weight: 780;
  letter-spacing: 0.01em;
}
.re-results-count {
  margin: 0;
  color: var(--re-muted);
  font-weight: 550;
  font-size: 0.95rem;
}
.re-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--re-muted);
}
.re-sort select {
  min-height: var(--re-touch);
  border-radius: 10px;
  border: 1px solid var(--re-border);
  background: var(--re-bg3);
  color: var(--re-text);
  padding: 0.4rem 0.7rem;
  font-size: 1rem;
}
.re-sort select:focus-visible {
  outline: none;
  box-shadow: var(--re-focus);
}

.re-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.re-video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: stretch;
}
/* Prefer readable card width: 1 → 2 → 3 only when cards stay comfortable */
@media (min-width: 640px) {
  .re-video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1320px) {
  .re-video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Thumbnail-first vertical archive cards */
.re-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  background: var(--re-bg2);
  border: 1px solid var(--re-border);
  border-radius: var(--re-radius);
  padding: 0;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.re-card:hover,
.re-card:focus-within {
  border-color: rgba(79, 195, 247, 0.38);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
}
.re-card.is-members-only {
  border-color: rgba(255, 235, 59, 0.35);
  background: linear-gradient(165deg, #151720 0%, #1a1810 100%);
}
.re-card.is-members-only:hover,
.re-card.is-members-only:focus-within {
  border-color: rgba(255, 235, 59, 0.55);
}
a.re-card-thumb {
  position: relative;
  display: block;
  width: 100%;
  flex: 0 0 auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #07080c;
  border-radius: 0;
  text-decoration: none;
  color: inherit;
  outline: none;
}
a.re-card-thumb:focus-visible {
  box-shadow: inset 0 0 0 3px rgba(79, 195, 247, 0.75);
}
.re-card-thumb img,
.re-card > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #07080c;
  border-radius: 0;
  transition: transform 0.25s ease, filter 0.25s ease;
}
a.re-card-thumb:hover img,
a.re-card-thumb:focus-visible img {
  transform: scale(1.02);
  filter: brightness(1.06);
}
.re-card.is-members-only .re-card-thumb img {
  filter: saturate(1.05) brightness(0.94);
}
.re-card.is-members-only a.re-card-thumb:hover img,
.re-card.is-members-only a.re-card-thumb:focus-visible img {
  filter: saturate(1.05) brightness(1.02);
}
.re-card-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.6rem;
  height: 2.6rem;
  margin: 0;
  border-radius: 999px;
  background: rgba(8, 10, 14, 0.62);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  transform: translate(-50%, -50%) scale(0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.re-card-play::before {
  content: "";
  position: absolute;
  left: 52%;
  top: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0.45rem 0 0.45rem 0.75rem;
  border-color: transparent transparent transparent #fff;
  transform: translate(-35%, -50%);
}
a.re-card-thumb:hover .re-card-play,
a.re-card-thumb:focus-visible .re-card-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.re-card-lock-overlay {
  position: absolute;
  inset: auto 0.5rem 0.5rem auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(11, 12, 16, 0.82);
  border: 1px solid rgba(255, 235, 59, 0.55);
  color: #ffeb3b;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 2;
}
.re-chip-locked {
  background: #3a3210;
  color: #ffeb3b;
}
.re-chip-sunday {
  background: #1a3a4a;
  color: #81d4fa;
}
.re-card-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  padding: 0.7rem 0.85rem 0.85rem;
}
.re-card-title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.3;
  color: #ffe082;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.re-card-meta {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--re-muted);
}
.re-card-route {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--re-text);
  font-weight: 650;
}
.re-card-access-note {
  margin: 0;
  font-size: 0.8rem;
  color: #fff59d;
}
.re-card .re-chip-row {
  gap: 0.28rem;
  margin-top: 0.05rem;
}
.re-card .re-chip {
  padding: 0.14rem 0.4rem;
  font-size: 0.68rem;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.re-card-actions {
  margin-top: auto;
  padding-top: 0.55rem;
  display: flex;
  justify-content: flex-start;
}
.re-card-actions a,
.re-card-actions a:link,
.re-card-actions a:visited,
.re-card-actions a:hover,
.re-card-actions a:focus-visible,
.re-card-actions a:active,
.re-card-cta,
.re-card-cta:link,
.re-card-cta:visited,
.re-card-cta:hover,
.re-card-cta:focus-visible,
.re-card-cta:active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.38rem 0.85rem;
  border-radius: 10px;
  background: var(--re-accent);
  color: #041018 !important;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.2;
  white-space: nowrap;
  width: auto;
  max-width: 100%;
}
.re-card-actions a:hover,
.re-card-actions a:focus-visible,
.re-card-cta:hover,
.re-card-cta:focus-visible {
  background: #81d4fa;
  color: #041018 !important;
}
.re-card-actions a:focus-visible,
.re-card-cta:focus-visible {
  outline: none;
  box-shadow: var(--re-focus);
}
@media (max-width: 430px) {
  .re-card-actions a,
  .re-card-cta {
    width: 100%;
  }
}

.re-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--re-muted);
}
.re-load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1.25rem;
}

/* ---------- Filters modal ---------- */
.re-modal[hidden] {
  display: none !important;
}
.re-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
}
.re-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}
.re-modal-sheet {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(640px, calc(100% - 1.5rem));
  max-height: min(86vh, 820px);
  overflow: auto;
  background: var(--re-bg2);
  border: 1px solid var(--re-border);
  border-radius: 18px;
  box-shadow: var(--re-shadow);
  display: flex;
  flex-direction: column;
}
@media (max-width: 700px) {
  .re-modal-sheet {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: 88vh;
    transform: none;
    border-radius: 18px 18px 0 0;
  }
}
.re-modal-header,
.re-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--re-border);
}
.re-modal-footer {
  border-bottom: 0;
  border-top: 1px solid var(--re-border);
}
.re-modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}
.re-modal-body {
  padding: 1rem 1.1rem 1.25rem;
  overflow: auto;
}
.re-filter-section {
  margin-bottom: 1.15rem;
}
.re-filter-section h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--re-accent);
}
.re-filter-section .re-hint {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
  color: var(--re-faint);
}
.re-check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.4rem;
  margin: 0.15rem 0;
  font-size: 1rem;
}
.re-check input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--re-accent);
}
.re-search {
  width: 100%;
  min-height: var(--re-touch);
  border-radius: 12px;
  border: 1px solid var(--re-border);
  background: var(--re-bg3);
  color: var(--re-text);
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
}
.re-search:focus-visible {
  outline: none;
  box-shadow: var(--re-focus);
}

.re-footer {
  padding: 1rem 1.5rem 1.75rem;
  color: var(--re-faint);
  font-size: 0.85rem;
  border-top: 1px solid var(--re-border);
}
.re-footer a,
.re-footer a:link,
.re-footer a:visited {
  color: var(--re-accent);
  text-decoration: underline;
}
.re-footer a:hover,
.re-footer a:focus-visible {
  color: #fff;
}
.re-footer code {
  color: var(--re-muted);
}

.re-body a,
.re-body a:link,
.re-body a:visited {
  color: var(--re-accent);
}
.re-body a.re-card-thumb,
.re-body a.re-card-thumb:link,
.re-body a.re-card-thumb:visited,
.re-body a.re-card-thumb:hover,
.re-body a.re-card-thumb:focus-visible {
  color: inherit;
}
.re-body a:hover,
.re-body a:focus-visible {
  color: #fff;
}
.re-body a.re-card-thumb:hover,
.re-body a.re-card-thumb:focus-visible {
  color: inherit;
}

/*
 * Phase 10C — Mobile Rail Explorer: return search/controls to normal document flow.
 *
 * Cause: .re-header { position: sticky; top: 0 } kept the entire search/filter
 * block (tabs, forms, actions) pinned over ~75–80% of the iPhone viewport while
 * map/results scrolled underneath. Below the site mobile breakpoint (900px),
 * sticky/fixed control shells and nested full-height scroll panels are disabled.
 *
 * Desktop (>=900px) may keep the sticky header; the live-journey sticky map is
 * overridden separately in rail-explorer-live.css for this same breakpoint.
 */
@media (max-width: 899.98px) {
  .re-body {
    overflow-x: clip;
    overflow-y: visible;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .re-header,
  .re-header-search,
  .re-header-actions,
  .re-archive-search-wrap,
  .re-live-search-wrap,
  .re-search-mode-tabs,
  .re-search-form,
  .re-main,
  .re-map-section,
  .re-map-wrap,
  .re-panel,
  .re-panel-inner,
  .re-results,
  .re-results-bar {
    position: static;
    top: auto;
    bottom: auto;
    left: auto;
    right: auto;
    inset: auto;
    transform: none;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    overflow-x: visible;
    overflow-y: visible;
    contain: none;
  }

  /* Explicit override of the base sticky header rule (same specificity, later + mobile). */
  .re-header {
    position: static;
    top: auto;
    z-index: auto;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .re-map {
    min-height: 280px;
  }

  /* Welcome/stats panel must not be a nested 42vh scroller on mobile. */
  .re-panel {
    max-height: none;
    overflow: visible;
  }

  .re-map-note {
    position: static;
    background: rgba(7, 8, 12, 0.72);
  }

  /* Live mode must not pin the map over scrolling content on mobile. */
  body.re-has-live-journey .re-map-section {
    position: static;
    top: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
  .re-card:hover,
  .re-card:focus-within {
    transform: none;
  }
  a.re-card-thumb:hover img,
  a.re-card-thumb:focus-visible img {
    transform: none;
  }
  .re-card-play {
    opacity: 0 !important;
  }
  .re-station:hover circle,
  .re-station:focus-visible circle,
  .re-station.is-hover circle,
  .re-station.is-active circle {
    transform: none;
  }
  .re-panel-inner.is-panel-swap {
    opacity: 1;
    transform: none;
  }
}

.re-overlay-toggle {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.45rem 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  border: 1px solid #2a3140;
  background: #12161e;
  color: var(--re-text);
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
  min-height: 2.7rem;
  width: calc(100% - 1.5rem);
  max-width: 28rem;
  box-sizing: border-box;
}
.re-overlay-toggle:last-of-type {
  margin-bottom: 0.85rem;
}
.re-overlay-toggle:hover,
.re-overlay-toggle:focus-within {
  border-color: rgba(79, 195, 247, 0.45);
  background: #151c26;
}
.re-overlay-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.re-overlay-toggle::before {
  content: "";
  flex: 0 0 auto;
  width: 2.4rem;
  height: 1.35rem;
  border-radius: 999px;
  background: #2a3140;
  border: 1px solid #3a4658;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  transition: background 0.15s ease, border-color 0.15s ease;
  background-image: radial-gradient(circle at 0.55rem 50%, #cfd8dc 0.45rem, transparent 0.5rem);
  background-repeat: no-repeat;
}
.re-overlay-toggle:has(input:checked)::before {
  background-color: rgba(79, 195, 247, 0.35);
  border-color: #4fc3f7;
  background-image: radial-gradient(circle at 1.75rem 50%, #ffeb3b 0.45rem, transparent 0.5rem);
}
.re-overlay-toggle:has(input:focus-visible) {
  outline: 2px solid #81d4fa;
  outline-offset: 2px;
}
.re-legend-details {
  margin: 0.85rem 0 0;
  border: 1px solid #2a3140;
  border-radius: 12px;
  background: rgba(12, 16, 22, 0.65);
  padding: 0.15rem 0.75rem 0.35rem;
}
.re-legend-details > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 0.95rem;
  color: #cfd8dc;
  padding: 0.55rem 0;
}
.re-legend-details > summary::-webkit-details-marker { display: none; }
.re-legend-details > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  color: #81d4fa;
}
.re-legend-details[open] > summary::before { content: "▾"; }
.re-legend-details .re-legend-list {
  margin: 0 0 0.55rem;
  padding-left: 1.1rem;
  color: var(--re-muted);
  font-size: 0.9rem;
}
.re-schematic-note {
  margin-top: 0.85rem;
  font-size: 0.86rem;
  color: var(--re-faint);
  line-height: 1.4;
}
.re-service-overlay {
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.re-service-overlay.is-active {
  opacity: 1;
}
.re-service-overlay-path { fill: none; }
.re-station.is-service-station circle {
  stroke: #e1bee7;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 3px rgba(225, 190, 231, 0.85));
}
.re-service-badge-inline {
  display: inline-block;
  margin: 0 0 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #3a2a45;
  color: #e1bee7;
  border: 1px solid #7e57c2;
}

/* Station autocomplete — wrapper fills the form row; dropdown matches input width */
.re-station-combo {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: none;
}
.re-station-suggest {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 0.25rem);
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  max-height: 14rem;
  overflow: auto;
  background: #12151f;
  border: 1px solid #3a4558;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.re-station-suggest[hidden] {
  display: none !important;
}
.re-station-suggest-option {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0;
  padding: 0.65rem 0.75rem;
  min-height: 2.6rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--re-text);
  font: inherit;
  cursor: pointer;
}
.re-station-suggest-option:hover,
.re-station-suggest-option[aria-selected="true"] {
  background: rgba(79, 195, 247, 0.16);
  color: #fff;
}
.re-station-search-msg {
  margin: 0.45rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 213, 79, 0.35);
  background: rgba(255, 213, 79, 0.08);
  color: #ffe082;
  font-size: 0.92rem;
}
.re-station-search-msg[hidden] {
  display: none !important;
}
#re-station-clear {
  flex: 0 0 auto;
  font-size: 0.88rem;
}
