/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:   #2e7d32;
  --yellow:  #f57f17;
  --red:     #c62828;
  --grey:    #757575;
  --bg:      #f5f5f0;
  --card-bg: #ffffff;
  --border:  #e0e0d8;
  --text:    #555555;
  --muted:   #616161;
  --radius:  8px;
  --shadow:  0 2px 8px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
p { padding: 0.5em 0; }
footer p { text-align: center; }
a { color: #9a6200; text-decoration: none; font-weight: 600; }
a:hover { text-decoration: none; }


/* ===== PAGE TITLES ===== */
main h1 { font-size: 1.6rem; }

/* ===== HEADER ===== */
header {
  background: var(--green);
  color: #fff;
  padding: 0 1.5rem;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
}

/* ── Site nav bar ── */
.site-nav {
  background: #245a27;
  padding: 0 1.5rem;
}

.site-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
}

.site-nav a {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.7rem;
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover,
.site-nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.site-nav a svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
}

.site-nav-links {
  display: flex;
  align-items: center;
}

/* Hamburger toggle — hidden on desktop, shown on mobile */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 1rem;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── Welcome card (index only) ── */
.welcome-strip {
  background: linear-gradient(135deg, #e8f5e9 0%, #fff8e1 100%);
  border: 1px solid #c8e6c9;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.welcome-strip svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  fill: var(--green);
  margin-top: 0.1rem;
}

.welcome-strip-body {
  flex: 1;
  min-width: 0;
}

.welcome-strip-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1b5e20;
  margin-bottom: 0.25rem;
}

.welcome-strip-text {
  font-size: 0.88rem;
  color: var(--text);
  padding: 0;
  margin: 0;
}

.welcome-strip-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: 0.5rem;
}

.welcome-strip-links a {
  font-size: 0.85rem;
  font-weight: 600;
}

.site-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo {
  height: 99px;
  display: block;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.site-title:hover { text-decoration: none; }

.site-title span { font-weight: 400; opacity: 0.8; white-space: nowrap; }

/* ── Header summary bubble ── */
.header-summary-bubble {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 0.5rem 1rem;
}

.header-summary-bubble.below-header {
  max-width: 900px;
  margin: 1rem auto;
  padding: 0.75rem 1.25rem;
  background: var(--green);
  opacity: 0.85;
  border-radius: 10px;
  text-align: left;
  color: #fff;
}

.header-summary-title {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  margin-bottom: 0.15rem;
}

.header-summary {
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.4;
  margin: 0;
}

/* ── Header condition cards ── */
.header-cards {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.header-card {
  background: #fff;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 6px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 90px;
  flex-shrink: 0;
}

.header-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.header-card-icon img {
  width: 48px;
  height: 48px;
}

.header-card-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1.2;
  white-space: nowrap;
}

.header-card-label {
  font-size: 0.58rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 1px;
  font-weight: 700;
}


nav a {
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  margin-left: 1.5rem;
}
nav a:hover { color: #fff; text-decoration: none; }


.weather-summary {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 20px;
  padding: 0.2rem 0.65rem;
}

/* ===== THAMES AT A GLANCE ===== */
.thames-glance {
  background: #fff;
  border-bottom: 1px solid var(--border);
  border-left: 4px solid var(--green);
  margin: 1rem 0;
}

.thames-glance-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.thames-glance-left {
  flex: 1;
  min-width: 0;
}

.thames-glance-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.thames-glance-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--green);
  margin-bottom: 0.25rem;
}

.thames-glance-text {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
  display: block;
}

.thames-glance-time {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ===== MAIN LAYOUT ===== */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 0.5rem 1.5rem;
}

/* ===== CONDITIONS CARD ===== */
.conditions-card {
  margin: 1.5rem auto;
  max-width: 1100px;
  padding: 1rem 0.75rem;
}
.conditions-card h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }

/* ===== BRANCH FLOW CAROUSEL ===== */
.cond-carousel { display: flex; flex-direction: column; }

.cond-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1rem;
}
.cond-tab {
  flex: 1;
  padding: 0.5rem 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.cond-tab:hover { color: var(--text); }
.cond-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.cond-slides { position: relative; }
.cond-slide { display: none; }
.cond-slide.active {
  display: block;
}

.cond-slide-info {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}
.cond-slide-desc {
  margin: 0 0 0.25rem;
}
.cond-slide-stats {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.cond-slide-gauges-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.cond-slide-gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 1rem;
  min-width: 0;
}
.cond-gauge-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}
.cond-chart-wrap {
  position: relative;
  height: 100px;
  margin-top: 0.4rem;
}
.cond-range-info {
  display: block;
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.cond-chart-label {
  display: block;
  text-align: center;
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* Legacy 4-col layout (kept for reference) */
.cond-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.cond-col { padding: 0 0.4rem; }
.cond-col + .cond-col { border-left: 1px solid var(--border); }
.cond-col-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--green);
  padding-bottom: 0.4rem;
  margin-bottom: 0.4rem;
  border-bottom: 2px solid var(--green);
}
.cond-col .gauge-table { margin-bottom: 0; }

/* ===== BRANCH CONDITION PLACE ROWS ===== */
.cond-place { margin-bottom: 0.85rem; }
.cond-place:last-child { margin-bottom: 0; }
.cond-place-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}
.cond-place-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cond-place-reading {
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.cond-range-bar {
  position: relative;
  height: 10px;
  background: #eae8e4;
  border-radius: 3px;
  margin-bottom: 0.15rem;
}
.cond-range-caution {
  position: absolute;
  top: 0;
  height: 100%;
  background: #fff3e0;
  border-radius: 3px;
}
.cond-range-safe {
  position: absolute;
  top: 0;
  height: 100%;
  background: #c8e6c9;
  border-radius: 3px;
}
.cond-range-needle {
  position: absolute;
  top: 1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translateX(-4px);
}
.cond-range-utrca {
  position: absolute;
  top: -1px;
  width: 2px;
  height: 12px;
  background: #1b5e20;
  transform: translateX(-1px);
  border-radius: 1px;
}
.cond-range-utrca-label {
  position: absolute;
  top: 12px;
  font-size: 0.58rem;
  color: #1b5e20;
  font-weight: 700;
  transform: translateX(-50%);
  white-space: nowrap;
}
.gauge-card-range {
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.cond-range-label {
  position: absolute;
  top: 12px;
  font-size: 0.58rem;
  color: var(--muted);
  font-weight: 600;
  transform: translateX(-50%);
}
.cond-range-label:first-of-type { transform: none; }
.cond-range-label:last-of-type { transform: translateX(-100%); }

@media (max-width: 900px) {
  .cond-columns { grid-template-columns: repeat(2, 1fr); }
  .cond-col:nth-child(2) { border-left: 1px solid var(--border); }
  .cond-col:nth-child(3) { border-left: none; margin-top: 1rem; }
  .cond-col:nth-child(4) { margin-top: 1rem; }
}
@media (max-width: 500px) {
  .cond-columns { grid-template-columns: 1fr; }
  .cond-col + .cond-col { border-left: none; margin-top: 1rem; }
}

/* ===== ROUTE GRID (legacy) ===== */
.branch-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.branch-cards .route-card {
  flex: 0 0 260px;
}

/* ===== ROUTE CARD ===== */
.route-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
  text-decoration: none;
  color: inherit;

}

.route-card-header {
  padding: 0.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: auto;
  background: var(--green);
}

.route-card-header .route-name {
  color: #fff;
}

.route-card-header .route-endpoints {
  color: rgba(255,255,255,0.9);
  font-size: 0.82rem;
  font-weight: 700;
}

.route-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.route-card-conditions {
  padding: 0.75rem 1.25rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
}

.route-card-map {
  height: 160px;
  border-bottom: 1px solid var(--border);
}

.route-card-meta {
  padding: 0.6rem 1.25rem;
  font-size: 0.82rem;
  color: var(--text);
}
.route-card-meta-stats {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.route-card-cta {
  padding: 0.65rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  text-align: center;
  background: var(--green);
}

.gauge-bullet-dot {
  display: inline-block;
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.gauge-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  margin-bottom: 0.5rem;
}
.gauge-table tbody {
  vertical-align: top;
}
a .gauge-table thead th,
.gauge-table thead th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding: 0 0.4rem 0.25rem;
}
.gauge-table thead th:first-child { padding-left: 0; }
.gauge-table thead th:nth-child(2),
.gauge-table thead th:nth-child(3) { text-align: center; }
.gauge-table tbody td {
  padding: 0.1rem 0.4rem;
  color: var(--text);
  vertical-align: middle;
}
.gauge-table tbody td:first-child { padding-left: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.gauge-tbl-flow { font-weight: 600; white-space: nowrap; min-width: 100px; }
.cond-dot-cell { text-align: center; width: 2rem; }
.cond-pill-cell { text-align: center; }
.cond-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 2rem;
  text-align: center;
}
.cond-pill-safe { background: #e8f5e9; color: #2e7d32; }
.cond-pill-caution { background: #fff8e1; color: #f57f17; }
.cond-pill-danger { background: #ffebee; color: #c62828; }
.cond-pill-unknown { background: #f5f5f5; color: #9e9e9e; }
.cond-status-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0,0,0,0.3);
}
.gauge-tbl-trend { text-align: center; font-size: 1rem; font-weight: 700; }

.flow-bar-wrap { display: flex; align-items: flex-start; gap: 6px; padding-top: 0.3rem; }
.flow-bar {
  position: relative;
  width: 80px;
  flex-shrink: 0;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: visible;
}
.flow-bar-caution {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(245,127,23,0.35);
  border-radius: 3px;
}
.flow-bar-safe {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(46,125,50,0.45);
  border-radius: 3px;
}
.flow-bar-pip {
  position: absolute;
  top: 50%;
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 2px rgba(0,0,0,0.3);
  z-index: 1;
}
.flow-bar-col {
  flex: 1;
  min-width: 40px;
}
.flow-bar-range-labels {
  position: relative;
  height: 0.85rem;
  font-size: 0.63rem;
  color: var(--muted);
  font-weight: 600;
}
.flow-bar-range-labels span {
  position: absolute;
  top: 1px;
  transform: translateX(-50%);
}
.flow-bar-val {
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  width: 1.8em;
  text-align: right;
  flex-shrink: 0;
}
.gauge-table tr.has-tooltip { position: relative; cursor: default; }
.gauge-tbl-tooltip-cell { position: absolute; left: 0; top: 0; width: 0; height: 0; overflow: visible; padding: 0 !important; border: none !important; }
.gauge-tbl-tooltip {
  position: absolute;
  bottom: 6px;
  left: -10px;
  background: #333;
  color: #fff;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 100;
}
.gauge-table tr.has-tooltip:hover .gauge-tbl-tooltip { opacity: 1; }
.card-water-temp { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.82rem; padding-top: 0.4rem; margin-top: auto; border-top: 1px solid var(--border); width: 100%; align-self: flex-end; }

.flow-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text);
  margin: 1rem 0.5rem;
  padding: 0.75rem 1rem;
  padding: 0.6rem 1.25rem;
  background: var(--card-bg);
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--border);
  background: none;
  padding: 0.6rem 0 0;
  margin: 0.5rem 0 0;
}

.flow-legend-title {
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.flow-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  position: relative;
}
.flow-legend-item[data-tooltip] { cursor: default; }
.flow-legend-item[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 100;
}
.flow-legend-item[data-tooltip]:hover::after { opacity: 1; }

.flow-legend-dot {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.flow-legend-sep {
  width: 1px;
  height: 1rem;
  background: var(--border);
  flex-shrink: 0;
}

.card-temp-station {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}

.card-temp-warning {
  margin-top: 0.5rem;
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.card-water-temp {
  font-size: 0.8rem;
  color: var(--muted);
}

.no-gauge {
  font-size: 0.8rem;
  color: var(--muted);
}

.condition-value { font-weight: 600; }
.condition-warning {
  font-size: 0.78rem;
  font-weight: 600;
  background: #e3f2fd;
  color: #1565c0;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius);
}


.btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-primary { background: var(--green); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--green); color: var(--green); }
.btn-secondary { background: var(--border); color: var(--text); border: 1px solid #ccc; }

/* ===== STATUS BADGES ===== */
.route-card-status {
  padding: 0.45rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  min-height: 3.5rem;
  display: flex;
  align-items: center;
}
.route-card-status.status-safe    { background: #e8f5e9; color: var(--green); }
.route-card-status.status-caution { background: #fff8e1; color: #f59f00; }
.route-card-status.status-danger  { background: #ffebee; color: var(--red); }
.route-card-status.status-unknown { background: #f5f5f5; color: var(--grey); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-safe    { background: #e8f5e9; color: var(--green); }
.status-caution { background: #fff8e1; color: #f59f00; }
.status-low     { background: #ffebee; color: #e65100; }
.status-high    { background: #ffebee; color: var(--red); }
.status-unknown { background: #f5f5f5; color: var(--grey); }

.status-badge::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* ===== BRANCH NAV ===== */
.branch-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.branch-nav-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.25rem;
}

.branch-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  background: #e8f5e9;
  color: #2e7d32;
  border: 1.5px solid #a5d6a7;
  transition: background 0.15s, border-color 0.15s;
}

.branch-chip:hover {
  background: #c8e6c9;
  border-color: #66bb6a;
}

.branch-chip--active {
  background: #2e7d32;
  color: #fff;
  border-color: #2e7d32;
  cursor: default;
  pointer-events: none;
}

/* ===== ROUTE DETAIL PAGE ===== */
.route-detail-header {
  margin-bottom: 1.5rem;
}
.route-detail-header h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }


/* ===== MAP + SIDEBAR ROW ===== */
.map-sidebar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}
.conditions-sidebar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.map-sidebar-map {
  flex: 1 1 300px;
  min-width: 0;
}
.conditions-sidebar-meta {
  font-size: 0.72rem;
  color: var(--muted);
}
.conditions-sidebar #gauges-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.conditions-sidebar .cond-gauge-block {
  width: 200px;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}

@media (max-width: 600px) {
  .conditions-sidebar {
    width: 100%;
  }
  .conditions-sidebar #gauges-container {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .conditions-sidebar .cond-gauge-block {
    flex: 0 0 calc(50% - 0.25rem);
    width: auto;
  }
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 760px) {
  .detail-grid { grid-template-columns: 1fr; }
}

#route-map {
  height: 550px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #e8e0d0;
}

.conditions-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.conditions-bar-inner {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.conditions-bar #gauges-container {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.conditions-bar-meta {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}
.conditions-bar .cond-gauge-block {
  margin-top: 0;
  padding: 0.4rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 90px;
}

.conditions-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.conditions-panel-header { margin-bottom: 1rem; }
.conditions-panel-header h2 { font-size: 1rem; margin-bottom: 0.15rem; }
.conditions-panel-meta { font-size: 0.75rem; color: var(--muted); display: flex; flex-direction: column; gap: 0.1rem; }

.cond-gauge-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-top: 0.6rem;
}
.cond-gauge-block:first-child { margin-top: 0; }
.cond-gauge-block .condition-row { border-bottom: none; padding: 0.2rem 0; }
.cond-gauge-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.cond-gauge-name { font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.cond-gauge-flow { font-size: 1rem; font-weight: 700; color: var(--text); }
.cond-gauge-station { font-size: 0.72rem; color: var(--muted); }
.cond-flow-bar-wrap {
  margin: 0.4rem 0 0.2rem;
}
.cond-flow-bar {
  position: relative;
  width: 100%;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: visible;
}
.cond-flow-bar-labels {
  position: relative;
  height: 1rem;
  font-size: 0.62rem;
  color: var(--muted);
  font-weight: 600;
}
.cond-flow-bar-labels span {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
}

.cond-gauge-block[data-tooltip] { position: relative; cursor: default; }
.cond-gauge-block[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 100;
}
.cond-gauge-block[data-tooltip]:hover::after { opacity: 1; }


.cond-notes {
  margin: 1.25rem 3rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.4;
  border: 1px solid #e65100;
}
.cond-notes-info  { background: #e3f2fd; color: #1565c0; }
.cond-notes-alert { background: #fff3e0; color: #e65100; font-weight: 600; }

.condition-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  text-align: right;
}
.condition-row:last-child { border-bottom: none; }
.condition-row .label { color: var(--muted); }

.segments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.75rem;
}
.segments-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.segments-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

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

.info-cards .section-card {
  margin-top: 0;
  font-size: 0.875rem;
}

.info-cards.info-cards-3col {
  grid-template-columns: 1fr 1fr;
}

.info-cards.info-cards-3col .info-cards-stacked {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-attribution {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  background: #f5f9f5;
  border: 1px solid #c8dfc8;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
}

.info-attribution-logo {
  height: 72px;
  width: auto;
  flex-shrink: 0;
  border-radius: 4px;
  display: block;
  margin: 0 auto;
}

.info-attribution-text {
  flex: 1 1 200px;
  font-size: 0.875rem;
}

.info-attribution-text strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.info-attribution-text p {
  margin: 0;
  padding: 0;
  color: var(--text);
}

.info-disclaimer {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  line-height: 1.6;
}

.info-disclaimer strong {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
}

.section-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.0rem;
}
.section-card h2 { font-size: 1rem; margin-bottom: 0.75rem; }

/* ===== BRANCH INFO CARDS (bottom of branch page) ===== */
.branch-info-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.branch-info-cards .info-attribution {
  grid-column: 1 / -1;
}
@media (max-width: 600px) {
  .branch-info-cards { grid-template-columns: 1fr; }
  .branch-info-cards .info-attribution { grid-column: 1; }
}

/* ===== ROUTE PLANNER ===== */
.route-planner { display: flex; flex-direction: column; gap: 0.75rem; }
.planner-fields { display: flex; flex-direction: column; gap: 0.75rem; }
.planner-fields-row { flex-direction: row; }
.planner-fields-row .planner-field { flex: 1; min-width: 0; }
.planner-field { display: flex; flex-direction: column; gap: 0.3rem; }
.planner-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.planner-select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  background: #fff;
  color: var(--text);
  width: 100%;
}
.planner-select:disabled { background: #f5f5f5; color: var(--muted); }

.planner-combo { position: relative; width: 100%; }
.planner-combo-input {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  background: #fff;
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}
.planner-combo-input:disabled { background: #f5f5f5; color: var(--muted); }
.planner-combo-input::placeholder { color: var(--muted); }
.planner-combo-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.planner-combo-list.open { display: block; }
.planner-combo-group {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 6px 10px 2px;
  pointer-events: none;
}
.planner-combo-option {
  padding: 6px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
}
.planner-combo-option:hover,
.planner-combo-option.highlighted { background: #e8f5e9; }
.planner-combo-empty {
  padding: 8px 10px;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}
.planner-summary {
  display: flex;
  gap: 1rem;
  padding: 0.75rem;
  background: #f5f9f5;
  border: 1px solid #c8dfc8;
  border-radius: 6px;
}
.planner-stat { display: flex; flex-direction: column; gap: 0.1rem; }
.planner-stat-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.planner-stat-value { font-size: 1.1rem; font-weight: 700; color: var(--green); }
.planner-stops {
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
}
.planner-stop {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.planner-stop:last-child { border-bottom: none; }
.planner-stop--portage  { color: var(--red); font-style: italic; background: #fff8f8; }
.planner-stop--portage-end { background: #e8f5e9; font-weight: 600; }
.planner-stop--hazard   { background: #fff3e0; color: #e65100; }
.planner-stop--hazard .planner-stop-label { color: #e65100; }
.planner-stop-detail { font-size: 0.78rem; color: #555; margin-top: 0.25rem; font-style: normal; }
.planner-stop--putin    { background: #e8f5e9; font-weight: 600; position: sticky; top: 0; z-index: 1; }
.planner-stop--takeout  { background: #ffebee; font-weight: 600; position: sticky; bottom: 0; z-index: 1; }
.planner-stop--junction { background: #e3f2fd; color: var(--text); }
.planner-stop-icon      { display: inline-block; width: 1.4em; text-align: center; }
.planner-stop-meta      { margin-left: 0.4em; }
.planner-stop-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--green);
  margin-left: 0.4rem;
  font-style: normal;
}
.planner-stop--takeout .planner-stop-label { color: var(--red); }
.planner-stop-leg {
  display: block;
  font-size: 0.68rem;
  color: #555555;
  background: #eef1ee;
  text-align: center;
  padding: 3px 0;
  letter-spacing: 0.02em;
}

.planner-portages {
  font-size: 0.82rem;
  color: var(--red);
  padding: 0.4rem 0.6rem;
  background: #ffebee;
  border-radius: 4px;
}

.planner-stats-table {
  width: 100%;
  font-size: 0.85rem;
  margin: 0.75rem 0;
  background: #e8f5e9;
  border: 1px solid #c8dfc8;
  color: var(--text);
  border-radius: 6px;
}
.planner-stats-table td {
  padding: 0.35rem 0.6rem;
}
.planner-stats-table td:first-child {
  color: var(--muted);
  font-weight: 600;
  width: 5rem;
}
.planner-stats-table td:last-child {
  font-weight: 700;
  text-align: right;
  color: var(--green);
}

.planner-gpx-btn {
  width: 100%;
  margin-top: 0.75rem;
  background: var(--green);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.planner-gpx-btn:hover {
  opacity: 0.9;
}
.planner-clear-btn {
  width: 100%;
  margin-top: 0.75rem;
  background: var(--green);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.planner-clear-btn:hover {
  opacity: 0.85;
}
.planner-gpx-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.4rem;
  line-height: 1.4;
}

/* ===== ROUTE PLAYER ===== */
.planner-row {
  display: grid;
  grid-template-columns: 1.3fr 3fr;
  gap: 1rem;
  grid-column: 1 / -1;
}
.planner-row > .section-card { margin-top: 0; }

.route-player-map-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  flex: 1;
  aspect-ratio: 1 / 1;
}
#route-player-map {
  width: 100%;
  height: 100%;
}
#route-player-map .maplibregl-ctrl-bottom-right {
  top: 5px;
  bottom: auto;
  right: 5px;
}
.maplibregl-popup-content:has(.popup-ap) { min-width: 280px; }
.popup-ap { text-align: center; padding: 4px 2px; }
.popup-ap strong { display: block; font-size: 0.85rem; margin-bottom: 4px; }
.popup-ap-info { font-size: 0.75rem; margin-bottom: 10px; line-height: 1.4; }
.popup-ap-branch { font-weight: 600; font-size: 0.72rem; color: var(--green); }
.popup-ap-gauge { font-weight: 600; color: var(--muted); }
.popup-ap-flow { font-weight: 700; }
.popup-ap-status { font-size: 0.7rem; }
.popup-ap-range { font-size: 0.7rem; color: var(--muted); }
.popup-ap-detail-link { display: block; margin: 0.4rem 0; font-size: 0.78rem; }

.route-player-map-wrap { position: relative; }

/* Map style toggle */
.rp-style-toggle {
  position: absolute; top: 10px; left: 10px; z-index: 10;
  display: flex; gap: 0;
}
.route-player-map-wrap .maplibregl-ctrl-top-left {
  top: 38px;
}
.rp-style-toggle button {
  padding: 4px 10px; font-size: 0.72rem; font-family: inherit; font-weight: 600;
  border: 1px solid rgba(0,0,0,0.2); background: rgba(255,255,255,0.9); color: #555; cursor: pointer;
}
.rp-style-toggle button:first-child { border-radius: 4px 0 0 4px; }
.rp-style-toggle button:last-child { border-radius: 0 4px 4px 0; border-left: none; }
.rp-style-toggle button.active { background: var(--green); color: #fff; border-color: var(--green); }

/* Recenter overlay button on the access-point location map */
.ap-map-recenter {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px 5px 7px;
  background: rgba(255, 255, 255, 0.95);
  color: #555;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.ap-map-recenter:hover {
  background: #fff;
  color: var(--text);
}
.ap-map-recenter svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}
.popup-ap-btns { display: flex; gap: 6px; }
.popup-ap-btn {
  flex: 1; color: #fff; border: none; border-radius: 4px;
  padding: 5px 10px; font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.popup-ap-btn-putin { background: #2e7d32; }
.popup-ap-btn-putin:hover { background: #1b5e20; }
.popup-ap-btn-takeout { background: #1565c0; }
.popup-ap-btn-takeout:hover { background: #0d47a1; }
.route-player {
  display: flex;
  flex-direction: column;
}
.route-player-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.92);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 6px 10px;
  gap: 8px;
  z-index: 2;
}
.rp-bar-title {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
  margin-right: 0.25rem;
}
.route-player-bar button {
  background: none; border: none;
  font-size: 1.1rem; cursor: pointer;
  padding: 2px 5px; color: var(--text);
  flex-shrink: 0;
}
.route-player-bar button:hover { color: var(--green); }
.route-player-bar input[type="range"] { flex: 1; height: 5px; cursor: pointer; }
.rp-label {
  display: flex;
  flex-direction: column;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  gap: 2px;
  flex-shrink: 0;
}
.rp-label select {
  font-size: 0.78rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 4px;
  background: #fff;
  color: var(--text);
}
.rp-btn-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.75rem;
  padding: 0.6rem 0;
}
.rp-gpx-btn {
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1.2rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.rp-gpx-btn:hover { background: #1b7a3a; }
.rp-gpx-btn:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: default;
  opacity: 0.55;
}
.rp-gpx-btn:disabled:hover { background: var(--border); opacity: 0.55; }
.rp-btn-outline { background: #fff; color: var(--green); border: 2px solid var(--green); }
.rp-btn-outline:hover { background: #f0faf0; }
.rp-btn-outline:disabled { background: #fff; color: var(--muted); border-color: var(--border); }
.rp-btn-outline:disabled:hover { background: #fff; }
.rp-map-overlay-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  background: #fff;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.rp-map-overlay-btn:hover {
  background: #f5f5f5;
}
.rp-map-overlay-btn.active {
  background: var(--green);
  color: #fff;
}
.rp-explainer {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
  padding-top: 0.75rem;
  margin-bottom: 0.75rem;
}

/* ===== ACCESS POINTS ===== */
.access-points-list { list-style: none; }
.access-points-list li {
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.access-points-list li:last-child { border-bottom: none; }

.ap-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.ap-branch-start   { background: #e8f5e9; color: var(--green); }
.ap-branch-end     { background: #ffebee; color: var(--red); }
.ap-access         { background: #e0f2f1; color: #00838f; }

/* Access point Leaflet map markers (divIcon, matches POI marker style) */
.ap-map-marker {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  color: #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,0.45);
}
.ap-map-branch-start   { background: #00838f; }  /* teal  — branch start (default) */
.ap-map-branch-end     { background: #00838f; }  /* teal  — branch end   (default) */
.ap-map-access         { background: #2e7d32; }  /* green — access point (default) */
.ap-map-hazard         { background: #e65100; }  /* orange — hazard */
.ap-map-maintained     { border-color: #fdd835; border-width: 2.5px; }

/* Status-based overrides applied after conditions load */
.ap-status-safe    { background: #2e7d32; }  /* green  */
.ap-status-caution { background: #f57f17; }  /* orange */
.ap-status-danger  { background: #c62828; }  /* red    */
.ap-status-unknown { background: #9e9e9e; }  /* grey   */

/* "Set as put-in" button inside map popups */
.popup-putin-btn {
  display: block;
  margin: 0.4rem auto 0;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  background: #1976d2;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.popup-putin-btn:hover { background: #1565c0; }

/* ===== MAP LEGEND ===== */
.legend-card { margin-top: 1rem; }

.legend-mini-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.75rem;
}
.legend-mini-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.legend-mini-label::-webkit-details-marker { display: none; }
.legend-mini-label::before {
  content: '\25B6';
  font-size: 0.55rem;
  transition: transform 0.2s;
}
.legend-mini-card[open] .legend-mini-label::before {
  transform: rotate(90deg);
}
.legend-mini-label:hover { color: var(--text); }
.legend-mini-card[open] .legend-grid { margin-top: 0.4rem; }

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
}

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

.legend-marker {
  width: 22px;
  height: 22px;
  font-size: 11px;
  flex-shrink: 0;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.legend-line {
  display: inline-block;
  width: 28px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-dashed {
  background: transparent !important;
  border-top: 3px dashed;
  height: 0;
}

/* ===== FLOW TREND ===== */
.trend-rising  { color: #757575; font-weight: 700; }
.trend-rising-fast  { color: #757575; font-weight: 900; }
.trend-falling { color: #757575; font-weight: 700; }
.trend-falling-fast { color: #757575; font-weight: 900; }
.trend-steady  { color: #757575; font-weight: 700; }

/* ===== LOADING & ERROR STATES ===== */
.loading { color: var(--muted); font-size: 0.9rem; font-style: italic; }
.error   { color: var(--red);   font-size: 0.9rem; }

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.75rem;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.social-links a:hover {
  background: #2e7d32;
  color: #fff;
}

.social-links a svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .info-cards.info-cards-3col { grid-template-columns: 1fr; }
  .info-cards.info-cards-3col .info-attribution, .info-cards.info-cards-3col .info-disclaimer { grid-column: 1; }
  .planner-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: center; gap: 0.5rem; }
  .header-summary-bubble { text-align: center; }
  .header-cards { flex-wrap: wrap; justify-content: center; gap: 6px; }
  /* Mobile nav: hamburger + collapsible menu */
  .nav-toggle { display: flex; }
  .site-nav-links { display: none; flex-direction: column; width: 100%; }
  .site-nav-links.open { display: flex; }
  .site-nav-inner { flex-wrap: wrap; }
  .site-nav a { padding: 0.6rem 1rem; }
  .welcome-strip { flex-direction: column; gap: 0.5rem; }
  .branch-cards .route-card { flex: 0 0 85vw; }
  .info-cards { grid-template-columns: 1fr; }
  .info-cards-3col { grid-template-columns: 1fr; }
  .info-attribution, .info-disclaimer { grid-column: 1; }
}

/* ── Onboarding tour ── */
.nav-tour-btn {
  margin-left: auto;
  background: #fff;
  color: var(--green);
  border: 1px solid #fff;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-tour-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  line-height: 1;
  flex-shrink: 0;
}

/* intro.js popover theme — match the site's beige + green palette */
.introjs-tooltip.thames-tour {
  background: var(--card-bg);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-family: inherit;
  max-width: 480px;
  min-width: 320px;
}
.introjs-tooltip.thames-tour .introjs-tooltip-header {
  padding: 0;
  min-height: 0;
}
.introjs-tooltip.thames-tour .introjs-tooltip-title {
  display: none;
}
.introjs-tooltip.thames-tour .introjs-tooltiptext {
  font-size: 0.9rem;
  line-height: 1.45;
  padding: 14px 32px 8px 16px;
}
.thames-tour-counter {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.introjs-tooltip.thames-tour .introjs-tooltipbuttons {
  border-top: 1px solid var(--border);
  padding: 8px 12px;
}
.introjs-tooltip.thames-tour .introjs-button {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 0.82rem;
  text-shadow: none;
}
.introjs-tooltip.thames-tour .introjs-button:hover {
  background: var(--bg);
  border-color: var(--green);
  color: var(--text);
}
.introjs-tooltip.thames-tour .introjs-button.introjs-nextbutton,
.introjs-tooltip.thames-tour .introjs-button.introjs-donebutton {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.introjs-tooltip.thames-tour .introjs-button.introjs-nextbutton:hover,
.introjs-tooltip.thames-tour .introjs-button.introjs-donebutton:hover {
  background: #245a27;
  border-color: #245a27;
}
.introjs-tooltip.thames-tour .introjs-skipbutton {
  position: absolute;
  top: 4px;
  right: 6px;
  z-index: 1;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1;
  padding: 0;
  text-shadow: none;
  opacity: 1;
  cursor: pointer;
}
.introjs-tooltip.thames-tour .introjs-skipbutton:hover {
  color: #245a27;
}
.introjs-tooltip.thames-tour .introjs-progress {
  background: var(--border);
}
.introjs-tooltip.thames-tour .introjs-progressbar {
  background: var(--green);
}
.introjs-helperLayer {
  border-radius: var(--radius);
}
