/*
 * transportmaps-web-ui  https://transportmaps.co.uk
 * Copyright (c) 2026 Optional Ltd. All rights reserved. See LICENSE.
 */
/* The chrome every map shares: the header and nav, buttons, the map panel, status pills,
   the key. A map adds its own stylesheet after this one for what is its own. */
/* ---- Header ------------------------------------------------------------------------- */
/* Train Map's header as of 24 Sep 2026: shown at every width, 48px on a phone, text links
   and dropdowns on a desktop and a hamburger's full-screen sheet below 840px. Positioned
   and lifted so its dropdowns and sheet paint over a map page's panels and dock (1100). */
.site-header { position: relative; z-index: 1200; border-bottom: 1px solid var(--line); background: #fff; }
.site-header .bar { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  max-width: 980px; margin: 0 auto; padding: 0 20px; height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px;
  color: var(--green); text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; flex: none; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.nav { display: flex; align-items: center; gap: 16px; flex-wrap: nowrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.nav a:hover { color: var(--green); }

/* Dropdowns: <details class="nav-item"><summary>Stations</summary><div class="drop">links</div>.
   ui/chrome.js navDropdowns() keeps one open at a time. */
.nav-item { position: relative; }
.nav-item > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.nav-item > summary::-webkit-details-marker { display: none; }
.nav-item > summary::marker { content: ""; }
.nav-item > summary::after { content: ""; width: 6px; height: 6px; margin-top: -3px; flex: none;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.nav-item[open] > summary::after { transform: rotate(-135deg); margin-top: 2px; }
.nav-item > summary:hover, .nav-item[open] > summary { color: var(--green); }
.nav-item .drop { position: absolute; right: 0; top: calc(100% + 10px); z-index: 1200; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 34px rgba(11, 45, 39, .18);
  padding: 8px; min-width: 250px; }
.nav-item .drop a { display: block; padding: 9px 12px; border-radius: 7px; color: var(--ink); font-size: 14.5px; }
.nav-item .drop a:hover { background: var(--wash); color: var(--green); }

/* The hamburger: <details class="menu"> as the nav's last child, its <summary> holding an
   .ico-open and an .ico-close glyph, then a .menu-panel: an .m-head (.m-brand and an
   optional .m-shop pill), .m-top links, and .m-grp headings over .m-kids of .m-sub links.
   Hidden on a desktop; below 840px it replaces the nav's own links. */
.menu { display: none; position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center;
  padding: 6px; border-radius: 7px; color: var(--green); }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::marker { content: ""; }
.menu > summary:hover, .menu[open] > summary { background: var(--wash); }
.menu > summary .ico-close { display: none; }
.menu-panel a { text-decoration: none; }
.menu-panel .m-brand { display: flex; align-items: center; gap: 9px; }
.menu-panel .brand-mark { width: 22px; height: 22px; }
@media (max-width: 840px) {
  .nav:has(> .menu) > a, .nav:has(> .menu) > .nav-item { display: none; }
  .menu { display: block; position: static; }
  .menu[open] > summary .ico-open { display: none; }
  .menu[open] > summary .ico-close { display: inline-flex; }
  .menu[open] > summary { position: relative; z-index: 1301; }
  .menu-panel { position: fixed; inset: 0; z-index: 1300; overflow-y: auto; background: #fff; padding: 0 22px 40px; }
  /* The sheet's top row sits on the header's own line, beside the close X (the summary's,
     painted over this row), so the row keeps its right end clear for it. */
  .menu-panel .m-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 58px; padding: 0 46px 0 0; margin: 0 0 16px; }
  .menu-panel .m-brand { font-size: 17px; font-weight: 800; color: var(--green); letter-spacing: -0.01em; }
  .menu-panel .m-shop { flex: none; padding: 7px 14px; border-radius: 999px; background: var(--wash);
    border: 1.5px solid var(--green); color: var(--green); font-size: 14px; font-weight: 700; }
  .menu-panel .m-grp { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
    font-weight: 700; margin: 22px 0 2px; }
  .menu-panel .m-top { display: block; padding: 13px 0; font-size: 18px; font-weight: 700; color: var(--green);
    border-bottom: 1px solid var(--line); }
  .menu-panel .m-kids { border-left: 2px solid var(--line); margin: 2px 0 0 2px; }
  .menu-panel .m-sub { display: block; padding: 11px 0 11px 16px; font-size: 16px; font-weight: 600; color: var(--ink); }
  body:has(.menu[open]) { overflow: hidden; }
}

/* The live switch: a map's live layer, in the bar between the brand and the nav, so on a
   desktop space-between centres it and on a phone it hugs the hamburger. The checkbox is
   visually hidden and the track drawn from a span, so it is a real checkbox (keyboard,
   screen reader, the label toggles it) that looks like a switch:
     <label class="live-switch"><input type="checkbox" role="switch" aria-label="Live buses">
       <span class="live-switch-track" aria-hidden="true"></span>
       <span class="live-switch-text">Live buses</span></label>
   The map writes the running count into the text, kept short ("2,268 trains", not "live
   trains": a 360px phone has about 118px for it), and adds .on while there is a live count,
   which puts a pulsing dot in front of it. The dot is what says live. */
.live-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  -webkit-user-select: none; min-width: 0; margin: 0 12px; position: relative; }
.live-switch input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.live-switch-track { width: 36px; height: 20px; border-radius: 999px; background: #b9c2be; position: relative;
  flex: none; transition: background .15s; }
.live-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .15s; }
.live-switch input:checked + .live-switch-track { background: var(--green); }
.live-switch input:checked + .live-switch-track::after { transform: translateX(16px); }
.live-switch input:focus-visible + .live-switch-track { outline: 2px solid var(--green); outline-offset: 2px; }
.live-switch-text { font-size: 13.5px; font-weight: 700; color: var(--green); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.live-switch-text.on::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #c41e3a; margin: 0 6px 1px 0; vertical-align: middle; animation: live-pulse 1.6s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-switch-text.on::before { animation: none; } }

/* A phone: a shorter bar and tighter gutters, since there the map is the product. */
@media (max-width: 600px) {
  .site-header .bar { height: 48px; padding: 0 10px 0 12px; gap: 10px; }
  .live-switch { margin: 0 4px 0 auto; }
  .menu { margin-left: 4px; }
  .menu-panel .m-head { min-height: 48px; }
}
/* Narrower still (a 320px phone): the wordmark gives up its text and keeps the mark, which
   is still the link home, so the live switch keeps its count. */
@media (max-width: 345px) {
  .brand { font-size: 0; gap: 0; }
  .brand-mark { width: 28px; height: 28px; }
}

/* ---- Buttons ------------------------------------------------------------------------ */
.btn { display: inline-block; background: var(--green); color: #fff; text-decoration: none;
  padding: 12px 22px; border-radius: 8px; font-weight: 700; font-size: 15px; border: 2px solid var(--green);
  cursor: pointer; font-family: inherit; line-height: 1.3; transition: background .15s; }
.btn:hover { background: var(--green-hover); border-color: var(--green-hover); }
.btn.small { padding: 7px 14px; font-size: 14px; }
.btn.ghost { background: #fff; color: var(--green); }
.btn.ghost:hover { background: var(--wash); border-color: var(--green); }
/* Amber for the one action a page most wants taken, as on Train Map's support button. */
.btn.accent { background: var(--amber); color: var(--green); border-color: var(--green); }
.btn.accent:hover { background: var(--amber-hover); border-color: var(--green); }
.nav .btn, .nav .btn:hover { color: #fff; }
.nav .btn.ghost, .nav .btn.ghost:hover { color: var(--green); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0; }

/* ---- Page head ---------------------------------------------------------------------- */
.page-head { background: linear-gradient(180deg, var(--wash), var(--paper)); border-bottom: 1px solid var(--line); }
.page-head .wrap { padding: 52px 20px 44px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.page-head h1 { font-size: 36px; line-height: 1.15; color: var(--green); letter-spacing: -0.02em; margin-bottom: 16px; max-width: 760px; }
.page-head p.lead { font-size: 18px; color: var(--muted); margin-bottom: 24px; max-width: 680px; }

/* ---- Sections and prose ------------------------------------------------------------- */
main .wrap { padding: 36px 20px; }
main section + section { margin-top: 36px; }
section h2 { font-size: 24px; color: var(--green); letter-spacing: -0.01em; margin-bottom: 8px; }
section p.sub { color: var(--muted); margin-bottom: 22px; max-width: 680px; }
.prose h2 { font-size: 21px; color: var(--green); margin: 30px 0 10px; }
.prose h2:first-child { margin-top: 0; }
.prose p { margin: 0 0 14px; }
.prose ul { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose strong { color: var(--ink); }

/* ---- Feature points ----------------------------------------------------------------- */
.points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 8px; }
.points div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.points h3 { font-size: 16px; color: var(--green); margin-bottom: 6px; }
.points p { font-size: 14.5px; color: var(--muted); }

/* ---- A standing-out aside, amber, as on Train Map ----------------------------------- */
.note-box { background: #fdf6e8; border: 1px solid #eeddba; border-left: 4px solid #d9a441;
  border-radius: 8px; padding: 12px 16px; margin: 18px 0; }

/* ---- Footer ------------------------------------------------------------------------- */
.site-footer { background: #fff; border-top: 1px solid var(--line); margin-top: 40px;
  padding: 34px 0 48px; color: var(--muted); font-size: 14px; }
.site-footer .cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.site-footer h2 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--green); margin-bottom: 10px; }
.site-footer a { display: block; color: var(--green); text-decoration: none; padding: 4px 0; font-weight: 600; }
.site-footer a:hover { text-decoration: underline; }
.site-footer .foot-mark { display: block; width: 30px; height: 30px; margin: 0 auto 10px; }
.site-footer .fine { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 13px; text-align: center; line-height: 1.6; }
.site-footer .fine a { display: inline; }

/* ---- Small screens ------------------------------------------------------------------ */
@media (max-width: 720px) {
  .cards, .cards.three, .points, .features { grid-template-columns: 1fr; }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .page-head .wrap { padding: 22px 20px 28px; }
  .page-head h1 { font-size: 28px; margin-bottom: 12px; }
  .page-head p.lead { font-size: 16px; margin-bottom: 18px; }
  main .wrap { padding: 24px 20px; }
  /* Two text links and a button beside a 17px wordmark do not fit a phone. The cards on
     the page carry the same links, so a page without a hamburger drops its text links and
     keeps the sign-in. */
  .nav:not(:has(> .menu)) > a:not(.btn) { display: none; }
  .brand { font-size: 15px; }
  .account-toggle { max-width: 150px; }
}
@media (max-width: 400px) { .site-footer .cols { grid-template-columns: 1fr; } }

/* ---- Map chrome ----------------------------------------------------------------- */
html, body.map-page { height: 100%; }
body.map-page { display: flex; flex-direction: column; overflow: hidden; }
.map-main { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; }

.panel { position: absolute; top: 12px; left: 12px; z-index: 5; width: min(360px, calc(100% - 24px));
  max-height: calc(100% - 24px); overflow: auto; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(11, 45, 39, .12); padding: 16px 18px; font-size: 14px; }
.panel h2 { font-size: 18px; color: var(--green); margin: 0 30px 4px 0; line-height: 1.3; }
.panel .sub { color: var(--muted); margin-bottom: 10px; }
.panel dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.panel dt { color: var(--muted); }
.panel dd { margin: 0; }
.line-badge { display: inline-block; background: var(--green); color: #fff; font-weight: 700;
  border-radius: 6px; padding: 1px 8px; margin-right: 6px; }

.status { position: absolute; bottom: 30px; left: 12px; z-index: 5; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; color: var(--muted); }
.status[hidden] { display: none; }
/* The zoom readout: plain small text in the corner, under the attribution when that opens. */
.zoom { position: absolute; bottom: 6px; left: 8px; z-index: 1; font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums; pointer-events: none; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.status.live { left: auto; right: 12px; bottom: 30px; cursor: pointer; font: inherit; font-size: 13px; }
.key { position: absolute; right: 12px; bottom: 68px; z-index: 5; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 30px 10px 12px; font-size: 12px; color: #1f2933; line-height: 1.7; }
.key[hidden] { display: none; }
.key-title { font-weight: 700; color: var(--green); }
.key .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line); margin-right: 7px; vertical-align: -2px; }
.key-note { color: var(--muted); font-size: 11px; line-height: 1.4; margin-top: 4px; max-width: 200px; }

/* Phones: the detail panel leaves most of the map visible, and the key waits to be asked for. */
@media (max-width: 640px) {
  .panel { max-height: 45%; }
}
.maplibregl-ctrl-attrib { font-size: 11px; }
/* Bigger zoom and locate buttons than MapLibre's 29px default, which is a small target on
   a phone. ui/map-controls.js puts them in the corner; this is what they look like. */
.maplibregl-ctrl-group button { width: 36px; height: 36px; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { background-size: 22px 22px; }

/* ---- Messages: a banner under the search box --------------------------------------- */
.message { padding: 10px; border-radius: 4px; font-size: 14px; margin-top: 10px; text-align: center; }
.message:empty { display: none; }
.message.note { position: relative; padding-left: 30px; padding-right: 30px; }
.msg-dismiss { position: absolute; top: 2px; right: 2px; width: 28px; height: 28px; padding: 0;
  display: flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 4px;
  font-size: 19px; line-height: 1; color: #7d8c87; cursor: pointer; }
.msg-dismiss:hover { background: rgba(11, 45, 39, 0.08); color: var(--green); }
.message.success { background: rgba(76, 175, 80, 0.1); color: #2e7d32; border: 1px solid rgba(76, 175, 80, 0.3); }
.message.error { background: rgba(196, 30, 58, 0.1); color: #c41e3a; border: 1px solid rgba(196, 30, 58, 0.3); }

/* ---- Icon buttons: one 32px box for every small control on a card ------------------ */
.icon-btn, .panel-why, .panel-min, .panel-share, .panel-close, .set-why {
  box-sizing: border-box; width: 32px; height: 32px; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center; line-height: 0;
  border: 1px solid #cddbd7; border-radius: 6px; background: #fff; color: var(--green);
  cursor: pointer; font-family: inherit; }
.icon-btn:hover, .panel-why:hover, .panel-min:hover, .panel-share:hover, .panel-close:hover, .set-why:hover { background: var(--wash); }
.icon-btn svg, .panel-why svg, .panel-min svg, .panel-share svg, .panel-close svg, .set-why svg { width: 17px; height: 17px; display: block; fill: currentColor; }
.panel-why.on, .set-why.on { background: var(--green); color: #fff; border-color: var(--green); }
.panel-share.shared, .icon-btn.shared { color: #2e7d32; }
.panel-share.shared svg, .icon-btn.shared svg { display: none; }
.panel-share.shared::after, .icon-btn.shared::after { content: '\2713'; font-size: 15px; font-weight: 700; line-height: 1; }

/* ---- Panel head: title left, controls right, a faint rule beneath ------------------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-bottom: 9px; margin-bottom: 8px; border-bottom: 1px solid #e2eae8; }
.panel-head strong { font-size: 15px; color: var(--green); }
.panel-head-btns { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.panel-note { font-size: 12px; line-height: 1.45; color: #6b7a75; margin: 0 0 8px; }
.panel-note[hidden] { display: none; }

/* ---- Option rows: a control, then an i that reveals its note ----------------------- */
/* At the foot of the Map panel (the Key) and a Live panel; ui/key.js adds the i. */
.set-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.set-row > label { flex: 1; min-width: 0; }
.set-note { font-size: 11.5px; line-height: 1.45; color: #6b7a75; margin: 6px 0 0; }
/* A note wraps to the panel rather than widening it: a docked panel is shrink-to-fit, so a
   paragraph's full length otherwise sets its width (Train Map's reset note stretched the
   Map panel to 900px on a desktop). */
.panel .set-note { width: 0; min-width: 100%; }
.set-note[hidden] { display: none; }
.set-hr { border: 0; border-top: 1px solid #e2eae8; margin: 10px 0 2px; }
.set-reset { width: 100%; margin-top: 12px; padding: 7px 10px; font-family: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--green); background: #fff; cursor: pointer; border: 1.5px solid #d5d5d5; border-radius: 8px; }
.set-reset:hover { background: var(--wash); border-color: var(--green); }
.set-row select { flex: none; margin-left: auto; max-width: 58%; padding: 5px 8px; font-family: inherit;
  font-size: 13px; color: var(--green); background: #fff; border: 1px solid #cddbd7; border-radius: 6px; }
.set-row select:hover { background: var(--wash); }

/* ---- The dock: folder tabs down the left edge, one panel open at a time ------------- */
.panel-dock { position: absolute; left: 0; top: 50%; transform: translateY(-50%); z-index: 1100;
  display: none; flex-direction: column; gap: 8px; }
.panel-dock[hidden] { display: none; }
.panel-tab { width: 30px; min-height: 84px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 7px; padding: 9px 0; border: 2px solid var(--green); border-left: none;
  border-radius: 0 10px 10px 0; background: rgba(255, 255, 255, 0.98); color: var(--green); cursor: pointer;
  font-family: inherit; font-size: 11px; font-weight: 700; box-shadow: 2px 2px 10px rgba(11, 45, 39, 0.18);
  transition: width .12s ease; }
.panel-tab svg { width: 18px; height: 18px; flex: 0 0 auto; }
.panel-tab span { writing-mode: vertical-rl; text-orientation: mixed; letter-spacing: .02em; }
.panel-tab.active { width: 40px; background: var(--green); color: #fff; }
/* Every dock-managed panel is marked data-dock by ui/dock.js; only the open one shows,
   docked bottom-left clear of the tabs and the attribution (--dock-pb is measured there). */
body.dock .panel-dock { display: flex; }
body.dock [data-dock] { display: none !important; }
body.dock [data-dock].dock-active { display: flex !important; flex-direction: column; box-sizing: border-box !important;
  left: 50px !important; right: auto !important; bottom: var(--dock-pb, 12px) !important; top: auto !important;
  transform: none !important; margin: 0 !important; max-height: calc(100dvh - 160px) !important;
  overflow-y: hidden; overflow-x: hidden; }
/* One scroller per panel: the body, so a pinned head stays put. */
body.dock [data-dock].dock-active > .panel-body { overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
@media (max-width: 600px) {
  /* Stop short of the control column rather than running to the edge: the zoom and locate
     buttons sit bottom-right (ui/map-controls.js) and a full-width card buries them. */
  body.dock [data-dock].dock-active { right: 54px !important; width: auto !important; max-width: none !important; }
}

/* ---- The exit pill for a mode, at the foot of the map ------------------------------- */
.mode-exit { position: absolute; left: 0; right: 0; margin-inline: auto; width: max-content; max-width: calc(100vw - 40px);
  bottom: var(--dock-pb, 12px); z-index: 1050; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mode-exit[hidden] { display: none; }
.mode-exit-btn { padding: 9px 16px; font-family: inherit; font-size: 13px; font-weight: 700; background: var(--green);
  color: #fff; border: 3px solid #fff; border-radius: 8px; box-shadow: 0 4px 18px rgba(11, 45, 39, 0.28); cursor: pointer; }
.mode-exit-btn:hover { background: #14453b; }
.mode-exit-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
@media (max-width: 600px) { body.dock-open .mode-exit { display: none; } }

/* ---- A modal that asks first ------------------------------------------------------ */
.app-modal { max-width: 380px; width: calc(100% - 32px); padding: 18px 18px 14px; border: none; border-radius: 12px;
  background: #fff; color: #33463f; font-family: inherit; font-size: 14px; line-height: 1.5;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28); }
.app-modal::backdrop { background: rgba(11, 45, 39, .55); }
.app-modal h2 { margin: 0 0 8px; font-size: 17px; color: var(--green); }
.app-modal-body p { margin: 0 0 10px; }
.app-modal-body p:last-child { margin-bottom: 0; }
.app-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.app-modal-actions button { padding: 9px 14px; border-radius: 7px; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.app-modal-cancel { border: 1.5px solid #cddbd7; background: #fff; color: var(--green); }
.app-modal-cancel:hover { background: var(--wash); }
.app-modal-go { border: 1.5px solid var(--green); background: var(--green); color: #fff; }
.app-modal-go:hover { background: #14453b; border-color: #14453b; }
.app-modal-actions button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
