:root {
  --forest: #123c2f;
  --forest-deep: #08271d;
  --leaf: #2e7b52;
  --lime: #caf46a;
  --paper: #e9e6da;
  --paper-light: #fbfaf5;
  --ink: #13231e;
  --muted: #657168;
  --line: #d3d0c3;
  --rust: #c85b35;
  --rail: #345d78;
  --display: "Unbounded", "Avenir Next Condensed", sans-serif;
  --body: "PT Sans", "Trebuchet MS", sans-serif;
  --shadow: 0 20px 55px rgba(16, 43, 33, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--paper); }
body { margin: 0; color: var(--ink); font: 16px/1.35 var(--body); background: var(--paper); }
button, a { font: inherit; }
a { color: inherit; }
.skip-link { position: fixed; top: 7px; left: 7px; z-index: 9999; padding: 9px 14px; background: white; transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.site-header { position: sticky; top: 0; z-index: 1000; min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 8px clamp(16px, 4vw, 58px); border-bottom: 1px solid var(--line); background: rgba(251,250,245,.96); backdrop-filter: blur(12px); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--lime); background: var(--forest); font: 650 16px var(--display); }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1; }
.brand strong { font: 650 14px var(--display); letter-spacing: -.4px; }
.brand small { margin-top: 4px; color: var(--leaf); font: 650 8px var(--display); letter-spacing: 1.8px; text-transform: uppercase; }
.site-header .page-nav { display: flex; gap: 4px; margin-left: auto; padding: 3px; overflow-x: auto; border: 1px solid #c4c8bf; border-radius: 30px; scrollbar-width: none; }
.site-header .page-nav::-webkit-scrollbar { display: none; }
.site-header .page-nav a { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 6px 12px; border-radius: 24px; color: #43524b; font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; transition: color .18s, background .18s; }
.site-header .page-nav a span { display: grid; place-items: center; min-width: 18px; height: 18px; color: var(--forest); font-size: 8px; font-weight: 700; }
.site-header .page-nav a:hover { color: var(--rust); background: #f1efe6; }
.site-header .page-nav .active-nav { color: white; background: var(--forest); }
.site-header .page-nav .active-nav span { color: var(--lime); }

.current-section, .map-section, .schedule-section, .insight-section { padding-inline: clamp(14px, 5vw, 74px); }
.current-section { padding-top: 24px; padding-bottom: 18px; background-image: radial-gradient(circle at 78% -15%, rgba(202,244,106,.42), transparent 30%); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; max-width: 1320px; margin: 0 auto 16px; }
.compact-heading h1, .section-heading h2, .map-toolbar h2, .insight-copy h2 { margin: 0; font-family: var(--display); letter-spacing: -1.8px; line-height: 1.05; }
.compact-heading h1 { font-size: clamp(27px, 3.2vw, 42px); }
.section-heading h2, .map-toolbar h2, .insight-copy h2 { font-size: clamp(25px, 3vw, 38px); }
.eyebrow { margin: 0 0 7px; color: var(--rust); font: 650 9px var(--display); letter-spacing: 1.8px; text-transform: uppercase; }

.source-status { display: flex; align-items: center; gap: 10px; min-width: 218px; padding: 9px 12px; border: 1px solid #c7c6ba; background: rgba(255,255,255,.58); }
.source-status .status-light { width: 9px; height: 9px; border-radius: 50%; background: #9da29d; }
.source-status[data-state="live"] .status-light { background: #38a461; box-shadow: 0 0 0 6px rgba(56,164,97,.13); }
.source-status[data-state="stale"] .status-light { background: #d4a52c; }
.source-status[data-state="error"] .status-light { background: var(--rust); }
.source-status div { display: flex; flex-direction: column; }
.source-status strong { font-size: 14px; }
.source-status small { margin-top: 1px; color: var(--muted); font-size: 11px; }

.direction-switch { display: flex; gap: 6px; max-width: 1320px; margin: 0 auto 8px; }
.direction-switch button { display: flex; align-items: center; gap: 7px; padding: 8px 13px; border: 1px solid #bebdaf; color: #506058; background: rgba(255,255,255,.45); cursor: pointer; transition: .18s; }
.direction-switch button small { color: #7a867f; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.direction-switch button b { color: var(--leaf); font-size: 17px; }
.direction-switch button.active { color: white; border-color: var(--forest); background: var(--forest); }
.direction-switch button.active small, .direction-switch button.active b { color: var(--lime); }

.active-trip { max-width: 1320px; margin: 0 auto; padding: 13px 17px 7px; overflow: hidden; border: 1px solid #c4c3b6; background: rgba(251,250,245,.82); box-shadow: 0 8px 25px rgba(16,43,33,.06); }
.active-trip.is-active { border-color: #84a544; background: #f6fae8; box-shadow: inset 4px 0 0 var(--lime), 0 8px 25px rgba(16,43,33,.06); }
.active-trip-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; margin-bottom: 7px; }
.active-trip-time, .active-trip-direction, .trip-meta { display: flex; flex-direction: column; }
.active-trip-time small { color: var(--rust); font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.active-trip-time strong { display: flex; align-items: center; gap: 7px; margin-top: 1px; font: 650 20px var(--display); }
.active-trip-time i { color: var(--leaf); font-family: var(--body); font-style: normal; }
.active-trip-direction { padding-left: 18px; border-left: 1px solid var(--line); }
.active-trip-direction span { font-weight: 700; }
.active-trip-direction small { color: var(--muted); font-size: 11px; }
.active-trip-countdown { align-self: flex-start; margin-top: 7px; padding: 6px 9px; color: white; background: var(--rust); box-shadow: 3px 3px 0 var(--lime); font: 750 11px/1.15 var(--display); letter-spacing: .01em; }
.trip-meta { align-items: flex-end; gap: 4px; }
.active-trip-badge { padding: 4px 7px; border: 1px solid #98a097; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.is-active .active-trip-badge { border-color: var(--forest); color: var(--forest); background: var(--lime); }
.trip-rail-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; scrollbar-width: thin; scrollbar-color: #a5ada5 transparent; }
.trip-rail-canvas { position: relative; min-width: 1040px; height: 61px; }
.trip-rail-base, .trip-rail-fill { position: absolute; top: 8px; left: 2.38%; height: 3px; border-radius: 2px; }
.trip-rail-base { right: 2.38%; background: #b5bdb5; }
.trip-rail-fill { z-index: 1; background: var(--leaf); transition: width .35s ease; }
.trip-rail-fill.has-progress::after { content: ""; position: absolute; top: -3px; right: -4px; width: 9px; height: 9px; border: 2px solid var(--forest); border-radius: 50%; background: var(--lime); }
.trip-rail-stops { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(21, 1fr); margin: 0; padding: 0; list-style: none; }
.trip-rail-stop { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; text-align: center; }
.rail-dot { width: 12px; height: 12px; border: 3px solid var(--paper-light); border-radius: 50%; background: #8b978f; box-shadow: 0 0 0 1px #6f7a73; }
.trip-rail-stop.passed .rail-dot { background: var(--leaf); box-shadow: 0 0 0 1px var(--leaf); }
.trip-rail-stop.current .rail-dot { width: 16px; height: 16px; margin-top: -2px; border-color: var(--forest); background: var(--lime); box-shadow: 0 0 0 4px rgba(202,244,106,.35); }
.rail-stop-name { max-width: 70px; color: #68736c; font-size: 8.5px; line-height: 1.05; }
.trip-rail-stop.current .rail-stop-name { color: var(--ink); font-weight: 700; }
.current-foot { display: flex; justify-content: space-between; padding-top: 5px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }

.map-section { padding-top: 17px; padding-bottom: 24px; }
.map-toolbar { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 18px; max-width: 1320px; margin: 0 auto 8px; }
.bus-callout { display: flex; align-items: center; gap: 10px; max-width: 370px; padding: 8px 11px; border-left: 4px solid var(--lime); background: #f1f5e5; }
.bus-symbol { display: grid; place-items: center; width: 39px; height: 32px; flex: 0 0 39px; border: 2px solid var(--forest); border-radius: 7px 7px 4px 4px; color: white; background: var(--forest); box-shadow: inset 0 -4px 0 var(--lime); }
.bus-symbol svg { width: 22px; height: 22px; fill: white; }
.bus-callout div:last-child { display: flex; flex-direction: column; }
.bus-callout small { color: var(--muted); font-size: 10px; }
.bus-callout strong { font-size: 13px; }
.bus-callout.is-empty { border-left-color: #b1b4ac; background: #efeee8; }
.map-legend { display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: flex-end; color: var(--muted); font-size: 11px; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; background: #84928a; }
.map-legend .passed { background: var(--leaf); }
.map-legend .next { border: 2px solid var(--forest); background: var(--lime); }
.map-legend .rail { border-radius: 3px; background: var(--rail); }
.map-panel { position: relative; max-width: 1320px; min-height: 440px; margin: 0 auto; overflow: hidden; border: 1px solid #b8beb4; background: #cfd8cc; box-shadow: var(--shadow); }
#map { z-index: 1; height: 440px; }
.map-unavailable { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 50px; text-align: center; background: #d9ded2; }
.map-unavailable[hidden] { display: none; }
.map-caption { position: absolute; z-index: 500; right: 16px; bottom: 16px; display: flex; gap: 16px; padding: 9px 12px; background: rgba(251,250,245,.93); box-shadow: 0 6px 20px rgba(20,44,35,.14); backdrop-filter: blur(9px); font-size: 11px; }
.map-caption small { color: var(--muted); }
.leaflet-container { font-family: var(--body); }
.leaflet-tile-pane { filter: saturate(.58) sepia(.07) brightness(1.04); }
.leaflet-control-attribution { color: #66716b; font-size: 9px; }
.bus-map-marker { display: grid; place-items: center; width: 47px !important; height: 38px !important; margin-top: -19px !important; margin-left: -23px !important; border: 3px solid white; border-radius: 9px 9px 5px 5px; color: var(--forest); background: var(--lime); box-shadow: 0 5px 15px rgba(9,41,31,.35); }
.bus-map-marker svg { width: 25px; height: 25px; fill: var(--forest); }
.bus-map-marker::after { content: ""; position: absolute; bottom: -7px; z-index: -1; width: 9px; height: 9px; background: var(--forest); transform: rotate(45deg); }
.map-stop-icon { width: 14px !important; height: 14px !important; margin-top: -7px !important; margin-left: -7px !important; border: 3px solid white; border-radius: 50%; background: #829188; box-shadow: 0 1px 5px rgba(9,41,31,.35); }
.map-stop-icon.passed { background: var(--leaf); }
.map-stop-icon.next { width: 19px !important; height: 19px !important; margin-top: -9px !important; margin-left: -9px !important; border: 4px solid var(--forest); background: var(--lime); box-shadow: 0 0 0 5px rgba(202,244,106,.28); }
.rail-map-marker { display: grid; place-items: center; width: 30px !important; height: 30px !important; margin-top: -15px !important; margin-left: -15px !important; border: 2px solid white; border-radius: 5px; color: white; background: var(--rail); box-shadow: 0 3px 10px rgba(9,41,31,.25); font-size: 9px; font-weight: 700; }
.rail-station-label { padding: 2px 5px; border: 0; color: #243c4b; background: rgba(255,255,255,.9); box-shadow: none; font-size: 10px; font-weight: 700; }
.rail-station-label::before { display: none; }

.schedule-section { padding-top: 34px; padding-bottom: 38px; color: white; background: var(--forest-deep); }
.light-heading { align-items: center; }
.schedule-verification { display: flex; align-items: center; gap: 9px; min-width: 215px; padding: 8px 11px; border: 1px solid rgba(255,255,255,.18); }
.schedule-verification > span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: var(--forest-deep); background: #a2aea8; font-weight: 700; }
.schedule-verification[data-state="match"] > span { background: var(--lime); }
.schedule-verification[data-state="changed"] > span { color: white; background: var(--rust); }
.schedule-verification div { display: flex; flex-direction: column; }
.schedule-verification strong { font-size: 13px; }
.schedule-verification small { color: #91a39a; font-size: 10px; }
.schedule-summary { display: grid; grid-template-columns: 1.5fr 1fr 1fr; max-width: 1320px; margin: 18px auto 13px; border: 1px solid rgba(255,255,255,.15); }
.schedule-summary div { display: flex; flex-direction: column; padding: 11px 16px; border-right: 1px solid rgba(255,255,255,.15); }
.schedule-summary div:last-child { border: 0; }
.schedule-summary small { color: #8da097; font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; }
.schedule-summary strong { margin-top: 3px; color: var(--lime); font: 650 18px var(--display); }
.schedule-list { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; max-width: 1320px; margin: 0 auto; }
.trip-card { position: relative; padding: 10px; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.035); }
.trip-card small { display: block; color: #7d9188; font-size: 9px; letter-spacing: .8px; text-transform: uppercase; }
.trip-card strong { display: block; margin: 4px 0 1px; font: 650 16px var(--display); }
.trip-card span { color: #95a89f; font-size: 11px; }
.trip-card.completed { opacity: .4; }
.trip-card.current { color: var(--forest-deep); border-color: var(--lime); background: var(--lime); transform: translateY(-3px); }
.trip-card.current small, .trip-card.current span { color: #3c6138; }
.trip-card.next-trip { border-color: var(--lime); }
.trip-card.next-trip::after { content: "следующий"; position: absolute; top: -7px; right: 5px; padding: 1px 4px; color: var(--forest); background: var(--lime); font-size: 7px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; }
.schedule-note { max-width: 1320px; margin: 15px auto 0; color: #82968c; font-size: 11px; }

.insight-section { display: grid; grid-template-columns: minmax(220px, .55fr) minmax(520px, 1.45fr); gap: 22px 5vw; align-items: end; padding-top: 32px; padding-bottom: 35px; background: var(--paper-light); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric-grid article { display: flex; flex-direction: column; padding: 15px 12px; border-right: 1px solid var(--line); }
.metric-grid article:last-child { border: 0; }
.metric-grid small { color: var(--muted); font-size: 9px; letter-spacing: .9px; text-transform: uppercase; }
.metric-grid strong { margin: 7px 0 2px; color: var(--forest); font: 650 clamp(22px, 2.7vw, 35px) var(--display); letter-spacing: -1.8px; }
.metric-grid span { color: var(--muted); font-size: 10px; }
.trip-analytics { grid-column: 1 / -1; display: grid; gap: 12px; margin-top: 5px; }
.direction-analytics { border: 1px solid var(--line); background: #f5f3ea; }
.direction-analytics > header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 11px 13px; border-bottom: 1px solid var(--line); background: white; }
.direction-analytics header small { color: var(--rust); font-size: 9px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.direction-analytics h3 { margin: 2px 0 0; font: 650 14px var(--display); letter-spacing: -.5px; }
.direction-analytics h3 span { color: var(--leaf); }
.direction-analytics header > strong { color: var(--forest); font-size: 12px; }
.trip-analytics-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.reliability-card { min-width: 0; min-height: 92px; padding: 9px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.58); }
.reliability-card:nth-child(8n) { border-right: 0; }
.reliability-card:nth-last-child(-n+8) { border-bottom: 0; }
.reliability-card > div { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; }
.reliability-card small { color: var(--muted); font-size: 7px; letter-spacing: .7px; text-transform: uppercase; }
.reliability-time { color: var(--ink); font: 650 13px var(--display); }
.reliability-percent { display: block; margin: 7px 0 3px; color: var(--leaf); font: 650 21px var(--display); letter-spacing: -1px; }
.reliability-detail { display: block; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.reliability-card.has-missed { background: #f7e5dc; }
.reliability-card.has-missed .reliability-percent, .reliability-card.has-missed .reliability-detail { color: #a3482c; }
.reliability-card.no-data { background: #eeece5; }
.reliability-card.no-data .reliability-percent { color: #929a94; }
.analytics-note { grid-column: 1 / -1; max-width: 920px; margin: -3px 0 0; color: var(--muted); font-size: 11px; }

footer { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 22px; align-items: center; padding: 20px clamp(18px, 5vw, 74px); color: #a5b7ae; background: #061c15; font-size: 11px; }
.footer-brand { color: white; }
.footer-brand .brand-mark { color: var(--forest); background: var(--lime); }
.footer-source { text-align: right; }
.footer-disclaimer { grid-column: 1 / -1; margin: 0; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); color: #7f978c; font-size: 10px; line-height: 1.55; text-align: center; }

@media (max-width: 1050px) {
  .map-toolbar { grid-template-columns: 1fr auto; }
  .map-legend { grid-column: 1 / -1; justify-content: flex-start; }
  .schedule-list { grid-template-columns: repeat(4, 1fr); }
  .insight-section { grid-template-columns: 1fr; }
  .trip-analytics { grid-column: auto; }
  .analytics-note { grid-column: auto; }
}

@media (max-width: 680px) {
  body { font-size: 15px; }
  .site-header { min-height: 56px; gap: 8px; padding: 6px 9px; }
  .brand-mark { width: 32px; height: 32px; }
  .site-header .brand > span:last-child { display: none; }
  .site-header .page-nav { gap: 1px; padding: 2px; }
  .site-header .page-nav a { gap: 3px; min-height: 29px; padding: 5px 7px; font-size: 10px; }
  .site-header .page-nav a span { min-width: 15px; height: 15px; font-size: 7px; }
  .current-section { padding-top: 18px; }
  .section-heading { display: block; }
  .source-status { width: 100%; margin-top: 10px; }
  .direction-switch { display: grid; grid-template-columns: 1fr 1fr; }
  .direction-switch button { flex-wrap: wrap; justify-content: center; gap: 3px; padding: 7px 5px; font-size: 11px; }
  .direction-switch button small { width: 100%; text-align: center; }
  .active-trip { padding: 11px 10px 6px; }
  .active-trip-head { grid-template-columns: 1fr auto; gap: 7px 10px; }
  .active-trip-direction { grid-column: 1 / -1; grid-row: 2; padding: 6px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .trip-meta { grid-column: 2; grid-row: 1; }
  .active-trip-countdown { margin-top: 6px; padding: 5px 7px; font-size: 9px; }
  .active-trip-time strong { font-size: 17px; }
  .trip-rail-canvas { min-width: 1130px; height: 59px; }
  .current-foot { gap: 10px; }
  .current-foot span:last-child { text-align: right; }
  .map-toolbar { display: block; }
  .bus-callout { max-width: none; margin-top: 10px; }
  .map-legend { justify-content: flex-start; margin-top: 9px; }
  .map-panel, #map { min-height: 350px; height: 350px; }
  .map-caption { right: 9px; bottom: 9px; left: 9px; justify-content: center; }
  .map-caption small { display: none; }
  .light-heading { display: block; }
  .schedule-verification { margin-top: 11px; }
  .schedule-summary { grid-template-columns: 1.35fr 1fr 1fr; }
  .schedule-summary div { padding: 9px 7px; }
  .schedule-summary strong { font-size: 13px; }
  .schedule-list { grid-template-columns: repeat(2, 1fr); }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid article:nth-child(2) { border-right: 0; }
  .metric-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .direction-analytics > header { align-items: flex-start; }
  .direction-analytics header > strong { max-width: 130px; text-align: right; }
  .trip-analytics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reliability-card:nth-child(8n) { border-right: 1px solid var(--line); }
  .reliability-card:nth-last-child(-n+8) { border-bottom: 1px solid var(--line); }
  .reliability-card:nth-child(2n) { border-right: 0; }
  .reliability-card:nth-last-child(-n+2) { border-bottom: 0; }
  footer { grid-template-columns: 1fr; text-align: left; }
  .footer-source { text-align: left; }
  .footer-disclaimer { grid-column: auto; text-align: left; }
}

@media (max-width: 360px) {
  .site-header .page-nav a { padding-inline: 5px; }
  .site-header .page-nav a span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
