/*!
 * © 2026 Kde je MHD (kdejemhd.sk). Všetky práva vyhradené. All rights reserved.
 * Kód a dizajn tejto stránky sú autorským dielom prevádzkovateľa. Ich kopírovanie, šírenie,
 * úprava alebo použitie na iných stránkach či v aplikáciách bez písomného súhlasu je zakázané.
 * Copying, redistribution, modification or reuse without written permission is prohibited.
 */
/* Kde je MHD — the departure board of one stop (src/render/board.js, public/board.js).
   Two sizes of one page: a whole screen read from a few metres, where the type grows with
   the screen and the rows share its height; and a small board inside another site (.bd-embed),
   at the size of the frame it is given. Same identity as the site: the plate carries the
   line in the colour of its mode, delay is ochre or ink, everything else is ink on paper. */

html, body.bd-body { height: 100%; }
body.bd-body {
    margin: 0;
    overflow: hidden;
    background: var(--paper);
    color: var(--ink);
    font: 400 16px/1.25 var(--font);
}
.bd-body a { color: inherit; text-decoration: none; }
.bd-body a:hover { text-decoration: underline; text-underline-offset: 0.12em; text-decoration-thickness: 0.06em; }
.bd-body .plate:hover { text-decoration: none; filter: brightness(1.12); }
.bd-body ::selection { background: var(--ochre); color: var(--ochre-ink); }

/* ── Whole screen ────────────────────────────────────────────────── */
/* The height of one row: what is left of the screen after the head and the foot, shared by
   the rows asked for (--n); the type follows from it, held back by the width on a narrow
   or turned screen. */
.bd {
    --row: calc(74vh / var(--n, 8));
    --fs: min(calc(var(--row) * 0.47), 4.3vw);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding: 3.2vh max(3.4vw, env(safe-area-inset-right)) 2.4vh max(3.4vw, env(safe-area-inset-left));
    box-sizing: border-box;
}
.bd-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 2vw;
    min-width: 0;
    padding-bottom: 1.6vh;
    border-bottom: max(2px, 0.25vh) solid var(--ink);
}
.bd-head h1 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font: 700 min(8.4vh, 6vw)/1.05 var(--font-cond);
    letter-spacing: 0.005em;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bd-pcname { margin-left: 0.3em; color: var(--ink-2); font-weight: 600; font-size: 0.62em; }
.bd-clock {
    flex: none;
    font: 700 min(8.4vh, 6vw)/1.05 var(--font-cond);
    font-variant-numeric: tabular-nums;
}

/* DPB's notice of the stop, once, under the head: DPB's own title, linked */
.bd-dpb {
    display: flex;
    align-items: flex-start;
    gap: 0.4em;
    margin: 1.2vh 0 0;
    font-size: calc(var(--fs) * 0.62);
    line-height: 1.3;
    color: var(--ink-2);
}
.bd-dpb b { font-weight: 600; }
.bd-dpb a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 0.15em; }
.bd-dpb .lf-icon { flex: none; width: 1.1em; height: 1.1em; margin-top: 0.12em; vertical-align: 0; }
.bd-note, .bd-stale, .bd-empty {
    margin: 1.4vh 0 0;
    font-size: calc(var(--fs) * 0.62);
    color: var(--ink-2);
}
/* old times are never shown as fresh: the rows fade and the notice says since when, as large as a destination */
.bd-stale {
    font-size: calc(var(--fs) * 0.85);
    padding: 0.35em 0.7em;
    border-radius: var(--r-ctl);
    background: var(--ink);
    color: var(--paper);
    font-weight: 600;
}
.bd.is-stale .bd-list { opacity: 0.4; }
.bd.is-stale .bd-when, .bd.is-stale .bd-late { opacity: 0.6; }

/* The rows share one set of columns, so the minutes stand in one line whatever the marks:
   plate · destination · platform · marks · minutes · delay. */
.bd-list {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
    /* the rows share what the head, a notice and the foot leave: a notice makes them a little lower, never cut */
    grid-template-rows: repeat(var(--n), minmax(0, 1fr));
    grid-auto-rows: 0;
    column-gap: calc(var(--fs) * 0.5);
    align-content: start;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    list-style: none;
}
.bd-row {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: center;
    min-height: 0;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    font-size: var(--fs);
}
/* browsers without subgrid (older TVs): fixed columns that still keep the minutes aligned */
@supports not (grid-template-columns: subgrid) {
    .bd-row { grid-template-columns: 2.7em minmax(0, 1fr) auto 3.4em 4.1em 2.1em; column-gap: 0.5em; }
}
.bd-plate.plate {
    justify-self: start;
    min-width: 2.3em;
    height: 1.42em;
    padding: 0 0.28em;
    border-radius: 0.18em;
    font-size: 1.08em;
    color: #fff;
}
.bd-to {
    min-width: 0;
    overflow: hidden;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* DPB says the line does not stop here or the stop has moved (src/notices.js): a line of grey
   ink under the destination, large enough to be read from where the destination is; the row
   keeps its place, and its time is on the clock */
.bd-dest { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-nt {
    display: flex;
    align-items: center;
    gap: 0.3em;
    overflow: hidden;
    margin-top: 0.06em;
    font-size: 0.64em;
    font-weight: 400;
    line-height: 1.2;
    color: var(--ink-2);
    white-space: nowrap;
}
.bd-nt span { overflow: hidden; text-overflow: ellipsis; }
.bd-nt .lf-icon { flex: none; width: 1.15em; height: 1.15em; vertical-align: 0; }
.bd-pc {
    justify-self: center;
    font: 700 0.78em/1 var(--font-cond);
    color: var(--ink);
}
.bd-pc:not(:empty) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.3em;
    height: 1.3em;
    padding: 0 0.15em;
    border: max(1.5px, 0.07em) solid var(--ink-2);
    border-radius: 0.2em;
    box-sizing: border-box;
}
.bd-mks {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.3em;
    color: var(--ink-2);
    font-size: 0.78em;
    white-space: nowrap;
}
.bd-mk { display: inline-flex; align-items: center; }
.bd-mk .lf-icon { width: 1.3em; height: 1.3em; vertical-align: 0; stroke-width: 2.3; }
/* steps are what someone in a wheelchair must see: in ink, not grey */
.bd-steps { color: var(--ink); font-weight: 700; }
.bd-when {
    justify-self: end;
    font: 700 1.3em/1 var(--font-cond);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    text-align: right;
}
/* a time from the vehicle's position has the site's dot; a time from the timetable is quieter */
.bd-row.is-live .bd-when::before {
    content: '';
    display: inline-block;
    width: 0.26em;
    height: 0.26em;
    margin-right: 0.24em;
    border-radius: 50%;
    background: currentColor;
    vertical-align: 0.18em;
}
.bd-row:not(.is-live) .bd-when { color: var(--ink-2); font-weight: 600; }
.bd-late { justify-self: start; min-width: 0; }
.bd-late .badge { display: inline-block; min-width: 2.4em; padding: 0.08em 0.25em; border-radius: 0.2em; font-size: 0.72em; line-height: 1.25; text-align: center; box-sizing: border-box; }
/* lf=1: a vehicle with steps stays on the board, faded, with its word */
.bd-row.bd-dim > :not(.bd-mks) { opacity: 0.4; }

.bd-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.3em 2em;
    margin-top: auto;
    padding-top: 1.2vh;
    color: var(--ink-2);
    font-size: max(12px, min(1.9vh, 1.5vw));
}
.bd-foot p { margin: 0; }
.bd-legend .bd-mk { vertical-align: -0.2em; }
.bd-legend .bd-steps { vertical-align: baseline; }
.bd-legend .bd-mk .lf-icon { width: 1.3em; height: 1.3em; }
.bd-src a { font-weight: 600; color: var(--ink); }

/* ── Inside another site ─────────────────────────────────────────── */
/* The frame is see-through: the board is a panel with round corners and no margin, at the
   size of the frame; rows keep their own height and those that do not fit are cut. */
html:has(body.bd-embed), body.bd-embed { background: transparent; }
.bd-embed .bd {
    --fs: 16px;
    height: auto;
    max-height: 100vh;
    padding: 12px 14px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
}
.bd-embed .bd-head { gap: 10px; padding-bottom: 8px; border-bottom-width: 2px; }
.bd-embed .bd-head h1, .bd-embed .bd-clock { font-size: 23px; }
.bd-embed .bd-list { grid-template-rows: none; grid-auto-rows: auto; column-gap: 8px; }
.bd-embed .bd-row { min-height: 46px; padding: 6px 0; }
/* a long destination takes a second line before it is cut */
.bd-embed .bd-to { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.15; white-space: normal; overflow-wrap: anywhere; }
.bd-embed .bd-plate.plate { font-size: 17px; height: 28px; min-width: 38px; border-radius: 5px; }
.bd-embed .bd-when { font-size: 21px; }
.bd-embed .bd-mks { font-size: 12px; gap: 3px; }
.bd-embed .bd-pc { font-size: 13px; }
.bd-embed .bd-mk .lf-icon { width: 17px; height: 17px; }
.bd-embed .bd-late .badge { font-size: 12px; border-radius: 4px; }
.bd-embed .bd-note, .bd-embed .bd-stale, .bd-embed .bd-empty { margin-top: 8px; font-size: 13px; }
/* a marked row: the destination keeps one line, DPB's words the next */
.bd-embed .bd-to:has(.bd-nt) { display: block; }
.bd-embed .bd-nt { font-size: 12px; white-space: normal; }
.bd-embed .bd-foot { flex-direction: column; gap: 4px; margin-top: 0; padding-top: 8px; font-size: 12px; line-height: 1.35; }
@media (max-width: 330px) {
    .bd-embed .bd { padding: 10px 10px 8px; }
    .bd-embed .bd-head h1, .bd-embed .bd-clock { font-size: 20px; }
    .bd-embed .bd-row { --fs: 15px; font-size: 15px; }
    .bd-embed .bd-list { column-gap: 6px; }
    .bd-embed .bd-plate.plate { min-width: 34px; font-size: 16px; }
    .bd-embed .bd-when { font-size: 19px; }
    .bd-embed .bd-mks { gap: 1px; }
    .bd-embed .bd-mk .lf-icon { width: 15px; height: 15px; }
    .bd-embed .bd-row.is-live .bd-when::before { margin-right: 3px; }
}

/* On a screen the plates keep the light theme's full colours in the dark one: white figures
   on the lighter dark-theme hues are too faint from a few metres. */
:root[data-theme="dark"] .bd-body .mode-T { --mode: #2358d6; }
:root[data-theme="dark"] .bd-body .mode-O { --mode: #17864a; }
:root[data-theme="dark"] .bd-body .mode-A { --mode: #d6252c; }

@media (prefers-reduced-motion: no-preference) {
    .bd-list { transition: opacity 0.4s ease-out; }
}

/* a row by the timetable that was late on most of its recent days (src/habit.js): plain ink */
.bd-hb { color: var(--ink-2); font-size: 0.72em; font-weight: 500; white-space: nowrap; }
.bd-legend .bd-hb { font-size: inherit; }
