/* Arhiva unificată GTFS a transportului feroviar (CFR + privați) */
/* Dual theme: Dark & Light mode strictly conforming to WCAG AAA contrast */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Default Dark Mode */
  --bg-base: #0c1116;
  --bg-surface: #141c24;
  --bg-card: #1b2631;
  --bg-hover: #22303e;
  --border-subtle: #2d3c4d;
  --border-strong: #42556b;
  --text-primary: #f6f8fa;
  --text-secondary: #cad5e2;
  --text-muted: #9ab0c5;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-subtle: rgba(56, 189, 248, 0.12);
  --success: #34d399;
  --warning: #fbbf24;

  /* Operator semantic colors (Dark) */
  --op-cfr: #60a5fa;
  --op-cfr-bg: rgba(96, 165, 250, 0.15);
  --op-tfc: #34d399;
  --op-tfc-bg: rgba(52, 211, 153, 0.15);
  --op-regio: #fbbf24;
  --op-regio-bg: rgba(251, 191, 36, 0.15);
  --op-irc: #c084fc;
  --op-irc-bg: rgba(192, 132, 252, 0.15);
  --op-astra: #f472b6;
  --op-astra-bg: rgba(244, 114, 182, 0.15);
  --op-softrans: #22d3ee;
  --op-softrans-bg: rgba(34, 211, 238, 0.15);
  --op-fero: #fb923c;
  --op-fero-bg: rgba(251, 146, 60, 0.15);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #f1f5f9;
  --bg-hover: #e2e8f0;
  --border-subtle: #cbd5e1;
  --border-strong: #94a3b8;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;
  --accent: #075985;
  --accent-hover: #03537b;
  --accent-subtle: rgba(2, 132, 199, 0.1);
  --success: #059669;
  --warning: #d97706;

  /* Operator semantic colors (Light) */
  --op-cfr: #1d4ed8;
  --op-cfr-bg: rgba(29, 78, 216, 0.1);
  --op-tfc: #047857;
  --op-tfc-bg: rgba(4, 120, 87, 0.1);
  --op-regio: #b45309;
  --op-regio-bg: rgba(180, 83, 9, 0.1);
  --op-irc: #6d28d9;
  --op-irc-bg: rgba(109, 40, 217, 0.1);
  --op-astra: #be185d;
  --op-astra-bg: rgba(190, 24, 93, 0.1);
  --op-softrans: #0e7490;
  --op-softrans-bg: rgba(14, 116, 144, 0.1);
  --op-fero: #c2410c;
  --op-fero-bg: rgba(194, 65, 12, 0.1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--accent);
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 600;
  z-index: 100;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header & Topbar */
.site-header {
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand:hover {
  color: var(--accent);
}

.brand-icon {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-control {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-control:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-control:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hero section */
.hero {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-base) 100%);
}

.hero-kicker {
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: 2.25rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3rem;
  }
}

.hero-deck {
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 860px;
  margin-bottom: 2rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .hero-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-val {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  font-feature-settings: "tnum";
}

.stat-val .unit {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-left: 0.2rem;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Quick jumps */
.quick-jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
}

.jump-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  background-color: var(--accent-subtle);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.jump-link:hover {
  background-color: var(--accent);
  color: #ffffff;
}

/* Sections */
.section {
  padding: 3rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.section-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.section-intro {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 820px;
  margin-bottom: 2rem;
}

/* Station Explorer / Departure Board */
.explorer-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}

/* Mode Switcher Tabs */
.mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.mode-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.55rem 1.15rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
}

.mode-tab:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.mode-tab.active {
  background-color: var(--bg-card);
  border-color: var(--border-subtle);
  color: var(--accent);
}

/* Route Search Layout */
.route-search-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .route-search-form {
    flex-direction: row;
    align-items: flex-end;
  }
}

.route-swap-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 0.35rem;
}

.swap-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.swap-btn:hover {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  transform: rotate(180deg);
}

.fastest-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background-color: rgba(6, 95, 70, 0.12);
  color: #065f46;
  border: 1px solid rgba(6, 95, 70, 0.3);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

[data-theme="dark"] .fastest-pill {
  background-color: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.35);
}

.cell-duration {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.station-picker-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .station-picker-wrap {
    flex-direction: row;
    align-items: flex-end;
  }
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-select, .form-input {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  width: 100%;
}

.form-select:focus, .form-input:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

/* Searchable station comboboxes */
.route-search-help {
  max-width: 860px;
  margin: -0.35rem 0 1.25rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.route-station-field {
  flex: 2 1 0;
  min-width: 0;
}

.station-combobox {
  position: relative;
  z-index: 20;
}

.combobox-input {
  padding-right: 4.5rem;
}

.combobox-actions {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.1rem;
  transform: translateY(-50%);
}

.combobox-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.combobox-clear:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.combobox-clear:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.combobox-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

.combobox-listbox {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  left: 0;
  z-index: 30;
  max-height: 19rem;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
}

.combobox-listbox[hidden] {
  display: none;
}

.combobox-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.92rem;
  line-height: 1.3;
  cursor: pointer;
}

.combobox-option:hover,
.combobox-option.is-active {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.combobox-option[aria-selected="true"] .combobox-option-name {
  font-weight: 800;
}

.combobox-option-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-option-meta {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.combobox-empty {
  padding: 0.8rem 0.7rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.combobox-status {
  min-height: 1.2rem;
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.route-quick-section {
  margin-bottom: 1.25rem;
}

.route-quick-heading {
  margin-bottom: 0.55rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.station-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.chip-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.chip-btn.active {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Board filters */
.board-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  margin-bottom: 1.25rem;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-group {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
}

.filter-btn:hover {
  background-color: var(--bg-hover);
}

.filter-btn.active {
  background-color: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent);
}

/* Board table */
.board-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.board-count {
  font-weight: 700;
  color: var(--text-primary);
}

.table-container {
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--bg-card);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table-expand-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
}

.btn-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.35rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-expand:hover {
  background-color: var(--bg-hover);
  border-color: var(--accent);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background-color: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background-color: var(--bg-card);
}

.cell-time {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.overnight-tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background-color: var(--bg-hover);
  color: var(--accent);
  margin-left: 0.35rem;
  border: 1px solid var(--border-subtle);
  vertical-align: middle;
  white-space: nowrap;
}

.cell-train {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.train-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  background-color: var(--border-subtle);
  color: var(--text-primary);
}

.train-badge.ic {
  background-color: #ef4444;
  color: #ffffff;
}

.train-badge.ir, .train-badge.irn {
  background-color: #f97316;
  color: #ffffff;
}

.train-badge.re {
  background-color: #06b6d4;
  color: #ffffff;
}

.train-badge.r, .train-badge.rm {
  background-color: #64748b;
  color: #ffffff;
}

.op-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}

.op-tag.cfr { background-color: var(--op-cfr-bg); color: var(--op-cfr); }
.op-tag.tfc { background-color: var(--op-tfc-bg); color: var(--op-tfc); }
.op-tag.regio { background-color: var(--op-regio-bg); color: var(--op-regio); }
.op-tag.irc { background-color: var(--op-irc-bg); color: var(--op-irc); }
.op-tag.astra { background-color: var(--op-astra-bg); color: var(--op-astra); }
.op-tag.softrans { background-color: var(--op-softrans-bg); color: var(--op-softrans); }
.op-tag.fero { background-color: var(--op-fero-bg); color: var(--op-fero); }

/* Operator cards grid */
.operators-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .operators-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .operators-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.operator-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.operator-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.operator-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.operator-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.operator-type-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.operator-type-badge.state {
  background-color: var(--op-cfr-bg);
  color: var(--op-cfr);
}

.operator-type-badge.private {
  background-color: var(--accent-subtle);
  color: var(--accent);
}

.operator-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.op-metric {
  display: flex;
  flex-direction: column;
}

.op-metric-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  font-feature-settings: "tnum";
}

.op-metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.op-share-bar {
  height: 6px;
  background-color: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.op-share-fill {
  height: 100%;
  border-radius: 3px;
  background-color: var(--accent);
}

/* Corridors comparison */
.corridors-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.corridor-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.5rem;
}

.corridor-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .corridor-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.corridor-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.corridor-km {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.corridor-comparison-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.bar-cfr {
  background-color: var(--op-cfr);
  transition: width 0.3s ease;
}

.bar-private {
  background-color: var(--op-tfc);
  transition: width 0.3s ease;
}

.corridor-metrics {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.corridor-note {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Downloads Hub */
.downloads-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .downloads-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.download-card {
  background-color: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s, transform 0.2s;
}

.download-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.download-icon {
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
}

.download-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.download-file {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.download-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.download-btn:hover {
  background-color: var(--accent-hover);
}

/* Code box */
.code-block {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
  overflow-x: auto;
  margin-top: 1rem;
}

/* Historical Foundation box */
.foundation-card {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 2rem;
  margin-top: 2rem;
}

.foundation-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.foundation-text {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.foundation-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.foundation-btn {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.foundation-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Footer */
.site-footer {
  margin-top: auto;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 2.5rem 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-nav a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--accent);
}

/* Interactive Railway Station & Corridor Map */
.map-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.map-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.5rem;
}

.map-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  display: inline-block;
  border-radius: 50%;
}

.legend-dot.tier-hub {
  width: 12px;
  height: 12px;
  background-color: #a855f7;
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.3);
}

.legend-dot.tier-major {
  width: 10px;
  height: 10px;
  background-color: #f43f5e;
}

.legend-dot.tier-multi {
  width: 8px;
  height: 8px;
  background-color: #f59e0b;
}

.legend-dot.tier-single {
  width: 6px;
  height: 6px;
  background-color: #64748b;
}

.legend-line {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background-color: var(--accent);
}

#station-map {
  height: 460px;
  width: 100%;
  background-color: var(--bg-surface);
  z-index: 1;
}

@media (max-width: 640px) {
  #station-map {
    height: 340px;
  }
}

/* Dark mode Leaflet tile adjustment */
[data-theme="dark"] .leaflet-tile-pane {
  filter: brightness(0.65) invert(1) contrast(2.8) hue-rotate(200deg) saturate(0.3) brightness(0.75);
}

/* Leaflet UI resets to match theme tokens */
.leaflet-container {
  font-family: inherit;
  background-color: var(--bg-surface);
}

.leaflet-bar {
  border: 1px solid var(--border-subtle) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  border-radius: 6px !important;
  overflow: hidden;
}

.leaflet-bar a, .leaflet-bar a:hover {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
}

.leaflet-popup-content-wrapper {
  background-color: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-subtle);
  border-radius: 6px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  padding: 0.25rem;
}

.leaflet-popup-tip {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle);
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  padding: 4px 4px 0 0 !important;
}

.leaflet-container a.leaflet-popup-close-button:hover {
  color: var(--text-primary) !important;
}

.map-popup-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.map-popup-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.map-popup-btn {
  display: inline-block;
  background-color: var(--accent);
  color: #ffffff;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-align: center;
  width: 100%;
}

.map-popup-btn:hover {
  opacity: 0.9;
}

.leaflet-control-attribution {
  background-color: rgba(255, 255, 255, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 0.7rem !important;
}

[data-theme="dark"] .leaflet-control-attribution {
  background-color: rgba(15, 23, 42, 0.85) !important;
}

.leaflet-control-attribution a {
  color: var(--text-secondary) !important;
}

/* Historical route comparisons */
.historical-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.historical-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (min-width: 768px) {
  .historical-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .historical-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.historical-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.historical-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.historical-city {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.historical-km {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.historical-times {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.time-col {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.time-col.historical {
  border-right: 1px solid var(--border-subtle);
  padding-right: 0.5rem;
}

.time-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.time-val {
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.time-train {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.time-speed {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.historical-delta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.delta-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.delta-badge.slower {
  background-color: rgba(153, 27, 27, 0.12);
  color: #991b1b;
  border: 1px solid rgba(153, 27, 27, 0.3);
}

[data-theme="dark"] .delta-badge.slower {
  background-color: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.delta-badge.faster {
  background-color: rgba(6, 95, 70, 0.12);
  color: #065f46;
  border: 1px solid rgba(6, 95, 70, 0.3);
}

[data-theme="dark"] .delta-badge.faster {
  background-color: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.historical-note {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-secondary);
}
