/* Kde je MHD — content pages: a line, a stop, the lists, delays.
   Same identity as the map: the plate carries the line, hue means transport mode,
   delay is ochre or ink. Paper background, hairlines, one type family. */

html { height: auto; scroll-padding-top: 72px; }

body.doc-body {
    height: auto;
    min-height: 100%;
    overflow: visible;
    background: var(--paper);
    font-size: 15px;
    line-height: 1.5;
}

.doc-body a { color: var(--ink); text-underline-offset: 2px; }
.doc-body ul, .doc-body ol { margin: 0; padding: 0; list-style: none; }

/* ── Top bar ─────────────────────────────────────────────────────── */
.site-top {
    position: sticky;
    top: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 8px 20px;
    min-height: 56px;
    padding: 0 20px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.site-brand {
    font: 700 22px/1 var(--font-cond);
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
}
.site-brand small { margin-left: 6px; font: 500 13px/1 var(--font); color: var(--ink-2); letter-spacing: 0; }

.site-nav { display: flex; gap: 2px; }
.site-nav a {
    padding: 8px 11px;
    border-radius: 8px;
    color: var(--ink-2);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--line-soft); color: var(--ink); font-weight: 600; }

.site-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.site-lang { font-size: 13px; font-weight: 500; color: var(--ink-2) !important; }
.site-theme {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
}
.site-theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Page frame ──────────────────────────────────────────────────── */
.doc {
    max-width: 1040px;
    margin: 0 auto;
    padding: 28px 20px 64px;
}

/* a page with a map: text on the left, the map stays in view on the right */
.doc-split {
    display: grid;
    grid-template-columns: minmax(0, 640px) minmax(0, 1fr);
    grid-template-areas: "intro map" "rest map";
    grid-template-rows: auto 1fr;
    max-width: none;
    padding: 0;
}
.doc-intro { grid-area: intro; padding: 24px 32px 0; }
.doc-rest { grid-area: rest; padding: 0 32px 64px; }
.doc-map {
    grid-area: map;
    position: sticky;
    top: 56px;
    height: calc(100dvh - 56px);
    isolation: isolate;
    border-left: 1px solid var(--line);
}
.pmap { width: 100%; height: 100%; background: var(--ground); }
.pmap .leaflet-bar { border: 1px solid var(--line); border-radius: var(--r-ctl); box-shadow: var(--shadow); overflow: hidden; }
.pmap .leaflet-bar a { background: var(--paper); color: var(--ink); border-bottom-color: var(--line); }
.pmap .leaflet-bar a:hover { background: color-mix(in srgb, var(--paper) 90%, var(--ink)); }
.pmap-open {
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 800;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
    background: var(--paper);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow);
}

.crumbs { font-size: 13px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a::before { content: '‹'; margin-right: 6px; }
.crumbs a:hover { color: var(--ink); }

.page-head { display: flex; align-items: center; gap: 16px; margin: 10px 0 16px; }
.page-head h1 { font: 700 clamp(34px, 6vw, 50px)/1 var(--font-cond); letter-spacing: 0.005em; }
.lede { margin-top: 8px; max-width: 58ch; font-size: 16px; color: var(--ink-2); }

.plate-xl { min-width: 78px; height: 66px; padding: 0 12px; border-radius: 12px; font-size: 44px; }

.doc section { margin-top: 40px; }
.doc h2 { margin-bottom: 12px; font: 700 25px/1.15 var(--font-cond); letter-spacing: 0.005em; }
.doc h3 { margin: 0; font: 600 15px/1.3 var(--font); }
.doc p { max-width: 66ch; }
.doc div > h2:not(:first-child) { margin-top: 36px; }

.status-line { font-size: 17px; line-height: 1.45; }
.status-line b { font-weight: 600; }
.stamp { margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.note { margin-top: 10px; font-size: 13px; color: var(--ink-2); }

.plates { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-body .plate { color: #fff; text-decoration: none; }
a.plate:hover { filter: brightness(1.12); }

.btn {
    display: inline-flex;
    padding: 10px 14px;
    border-radius: var(--r-ctl);
    background: var(--ink);
    color: var(--paper) !important;
    font-weight: 600;
    text-decoration: none;
}

/* ── Line: the route as a rail with stops and vehicles on it ─────── */
.routes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 32px 24px; }
.route-meta { margin-top: 2px; font-size: 13px; color: var(--ink-2); }

.rail { position: relative; margin-top: 12px !important; }
.rail::before {
    content: '';
    position: absolute;
    left: 13px;
    top: 15px;
    bottom: 15px;
    width: 4px;
    border-radius: 2px;
    background: var(--mode);
}

.rail-stop, .rail-gap { position: relative; display: flex; align-items: center; gap: 10px; }
.rail-stop { min-height: 30px; }
.rail-gap { height: 20px; }

.rail-mark { flex: none; display: flex; align-items: center; justify-content: center; width: 30px; min-height: 20px; }
.rail-stop > .rail-mark:empty::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 3px solid var(--mode);
    border-radius: 50%;
    background: var(--paper);
}
.rail-stop.is-end > .rail-mark:empty::before { width: 16px; height: 16px; background: var(--mode); }

.rail-stop a { padding: 3px 0; text-decoration: none; }
.rail-stop a:hover { text-decoration: underline; }
.rail-stop.has-veh a, .rail-stop.is-end a { font-weight: 600; }
.rail-badges { display: inline-flex; gap: 4px; }
.rail-badges .badge { padding: 1px 6px; }

.route-more > summary { cursor: pointer; list-style: none; }
.route-more > summary::-webkit-details-marker { display: none; }
.route-more > summary h3::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 10px;
    border-right: 2px solid var(--ink-2);
    border-bottom: 2px solid var(--ink-2);
    transform: translateY(-3px) rotate(45deg);
}
.route-more[open] > summary h3::after { transform: translateY(1px) rotate(-135deg); }

/* a vehicle on the rail: a small plate with an arrow in the direction of travel */
.veh {
    position: relative;
    display: block;
    width: 24px;
    height: 18px;
    border: 2px solid var(--paper);
    border-radius: 5px;
    background: var(--mode);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.veh + .veh { margin-left: -12px; }
.veh::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 5px;
    height: 5px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: translate(-50%, -70%) rotate(45deg);
}

/* ── Stop: the departure board ───────────────────────────────────── */
.board-wrap { margin-top: 28px !important; }
.board { border-top: 1px solid var(--line); }
.dep {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-soft);
}
.dep .plate { min-width: 46px; height: 32px; font-size: 19px; }
.dep-to b { display: block; overflow: hidden; font-size: 16px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.dep-to small { font-size: 12px; color: var(--ink-2); }
.dep-when { text-align: right; white-space: nowrap; }
.dep-when > b { display: block; font: 700 25px/1 var(--font-cond); font-variant-numeric: tabular-nums; }
.dep-when small { display: block; margin-top: 3px; font-size: 12px; color: var(--ink-2); }
.dep-when i { font-style: normal; }
.dep-when .badge { margin-left: 4px; padding: 0 5px; font-size: 11px; }
.dep.is-live .dep-when > b::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: currentColor;
    vertical-align: 4px;
}
.dep:not(.is-live) .dep-when > b { color: var(--ink-2); font-weight: 600; }

.platforms { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px 28px; }
.dest { margin-top: 8px !important; }
.dest li { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.dest .plate { min-width: 34px; height: 24px; font-size: 14px; }

.near li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.near span { color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ── Lists ───────────────────────────────────────────────────────── */
.index { columns: 2 300px; column-gap: 36px; }
.index li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line-soft);
    break-inside: avoid;
}
.index-name { flex: 1; min-width: 0; text-decoration: none; }
.index-name:hover { text-decoration: underline; }
.index small { flex: none; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.index-stops { columns: 3 250px; }
.index-stops small { max-width: 46%; overflow: hidden; text-overflow: ellipsis; }

.filter input {
    width: 100%;
    max-width: 420px;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: 16px;
}
.filter input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }

.letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 18px 0 0; }
.letters a {
    display: grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    border-radius: 8px;
    background: var(--line-soft);
    font: 700 17px/1 var(--font-cond);
    text-decoration: none;
}
.letters a:hover { background: var(--ink); color: var(--paper); }

/* ── Tables, delay figures ───────────────────────────────────────── */
.plain { width: 100%; max-width: 640px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.plain th, .plain td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
.plain thead th { font-size: 12px; font-weight: 600; color: var(--ink-2); border-bottom-color: var(--line); }
.plain tbody th { font-weight: 500; }
.plain td { white-space: nowrap; }
.plain .plate { min-width: 40px; }

.dbar { display: inline-block; width: 84px; height: 6px; margin-left: 10px; border-radius: 3px; background: var(--line-soft); vertical-align: middle; }
.dbar i { display: block; height: 100%; border-radius: 3px; background: var(--ochre); }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px 36px; margin-top: 20px; }
.cols h3, .doc section > h3 { margin: 20px 0 8px; }

.hours { display: flex; align-items: flex-end; gap: 3px; height: 150px; max-width: 640px; margin-top: 14px !important; }
.hours li { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; }
.hours i { display: block; width: 100%; border-radius: 3px 3px 0 0; background: var(--ochre); }
.hours span { font-size: 11px; color: var(--ink-3); }

/* ── Footer ──────────────────────────────────────────────────────── */
.bottom { position: relative; z-index: 1; padding: 24px 20px 40px; border-top: 1px solid var(--line); background: var(--paper); font-size: 13px; color: var(--ink-2); }
.bottom nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 12px; }
.bottom nav a { font-weight: 600; }
.bottom p { max-width: 80ch; margin-top: 4px; }

/* ── Narrow screens: the map goes between the intro and the rest ─── */
@media (max-width: 999px) {
    .doc-split { display: block; }
    .doc-intro { padding: 18px 16px 0; }
    .doc-rest { padding: 0 16px 56px; }
    .doc-map {
        position: relative;
        top: auto;
        height: 46vh;
        min-height: 280px;
        max-height: 460px;
        margin-top: 22px;
        border-left: 0;
        border-block: 1px solid var(--line);
    }
    .doc { padding-inline: 16px; }
    .doc-split { padding-inline: 0; }
}

@media (max-width: 699px) {
    .site-top { flex-wrap: wrap; padding: 8px 12px 0; }
    .site-nav { order: 3; width: 100%; margin: 0 -4px; overflow-x: auto; scrollbar-width: none; }
    .site-nav::-webkit-scrollbar { display: none; }
    .site-nav a { padding: 9px 10px; }
    html { scroll-padding-top: 104px; }
    .plate-xl { min-width: 62px; height: 54px; font-size: 36px; }
    .index, .index-stops { columns: 1; }
    .plain th, .plain td { padding-right: 8px; }
    .dbar { width: 48px; }
}
