*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.6 var(--font-body); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Layered backdrop on every theme: three light pools, then the faded metro-map tile masked to the top-right and bottom-left. */
body::before, body::after { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
body::before {
  background:
    radial-gradient(52vw 46vh at 88% 6%, var(--pool-b), transparent 70%),
    radial-gradient(46vw 54vh at 4% 34%, var(--pool-a), transparent 72%),
    radial-gradient(50vw 42vh at 70% 102%, var(--pool-c), transparent 70%);
}
body::after {
  background: var(--map-tile) 0 0 / 420px 420px repeat;
  opacity: var(--map-alpha);
  -webkit-mask-image: radial-gradient(60vw 58vh at 100% 0, #000 10%, transparent 72%), radial-gradient(56vw 54vh at 0 100%, #000 10%, transparent 72%);
  mask-image: radial-gradient(60vw 58vh at 100% 0, #000 10%, transparent 72%), radial-gradient(56vw 54vh at 0 100%, #000 10%, transparent 72%);
}
body.modal-open { overflow: hidden; }
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.08; margin: 0; letter-spacing: -.02em; font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

.wrap { width: min(var(--wrap), 100% - 48px); margin-inline: auto; }
.narrow { max-width: 760px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; }
.skip:focus { top: 12px; }
.mute { color: var(--mute); }
[hidden] { display: none !important; }

/* ---------- line badge ---------- */
.lb {
  display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--lc, var(--ink)); color: var(--lon, var(--paper));
  font: 700 12px/1 var(--font-display); font-style: normal; letter-spacing: 0;
}
.lb.xl { width: 46px; height: 46px; font-size: 22px; }
.lb.xxl { width: 84px; height: 84px; font-size: 42px; background: #fff; color: var(--lc); }

/* ---------- progress ---------- */
#progress { position: fixed; inset: 0 0 auto; height: 5px; z-index: 60; pointer-events: none; }
#progress span { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--red); border-radius: 0 3px 3px 0; }

/* ---------- header ---------- */
#top {
  position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule);
}
#top.stuck { box-shadow: 0 8px 24px -18px rgba(0, 0, 0, .5); }
.bar { width: min(1360px, 100% - 40px); margin-inline: auto; min-height: 66px; display: flex; align-items: center; gap: 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 23px var(--font-display); letter-spacing: -.03em; color: var(--ink); }
.logo-mark { width: 34px; height: 34px; color: var(--ink); }
.nav-row { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-width: 0; }
.lines { display: flex; gap: 6px; }
.lbadge {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 13px 5px 5px; border-radius: 999px;
  font: 600 14px var(--font-body); color: var(--ink); border: 1.5px solid transparent; white-space: nowrap;
}
.lbadge i {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--lc); color: var(--lon); font: 700 14px var(--font-display); font-style: normal;
}
.lbadge:hover { background: var(--lt); }
.lbadge.on { border-color: var(--lc); background: var(--lt); }
.pages { display: flex; gap: 4px; }
.pages a { padding: 8px 12px; border-radius: 8px; font: 600 14px var(--font-body); color: var(--ink-2); white-space: nowrap; }
.pages a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.pages a.on { color: var(--ink); box-shadow: inset 0 -3px 0 var(--ink); border-radius: 0; }
.tools { display: flex; align-items: center; gap: 4px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; background: none; border: 0; border-radius: 10px; }
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.ic { width: 20px; height: 20px; display: inline-block; vertical-align: -4px; }
.admin-link { margin-left: 6px; padding: 6px 12px; border: 1.5px solid var(--ink); border-radius: 8px; font: 600 13px var(--font-body); }

.menu-btn { display: none; }
.lines-scroll { position: relative; min-width: 0; }

@media (max-width: 1180px) { .lbadge span { display: none; } .lbadge { padding: 5px; } }
@media (max-width: 820px) {
  .bar { flex-wrap: wrap; gap: 0 6px; padding-top: 6px; min-height: 58px; }
  .brand { order: 1; }
  .tools { order: 2; margin-left: auto; }
  .menu-btn { display: grid; }
  .nav-row { order: 3; flex: 1 1 100%; padding: 2px 0 8px; }
  .pages { display: none; } /* phones: page links live in the service menu */
  .lines-scroll { flex: 1; }
  .lines { overflow-x: auto; scrollbar-width: none; padding: 2px 2px; scroll-snap-type: x proximity; }
  .lines::-webkit-scrollbar { display: none; }
  .lbadge { scroll-snap-align: start; }
  .lbadge span { display: inline; }
  .lbadge { padding: 4px 11px 4px 4px; }
  /* fade-edge scroll hint: the edge with more badges behind it fades out and shows a chevron */
  .lines-scroll::before, .lines-scroll::after {
    content: ''; position: absolute; top: 0; bottom: 0; width: 44px; pointer-events: none; opacity: 0; transition: opacity .2s; z-index: 1;
    background-repeat: no-repeat; background-size: 14px 14px;
  }
  .lines-scroll::before { left: 0; background-image: linear-gradient(90deg, var(--paper) 30%, transparent); }
  .lines-scroll::after {
    right: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M5 3l4 4-4 4' fill='none' stroke='%23767684' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"), linear-gradient(270deg, var(--paper) 40%, transparent);
    background-position: right 4px center, 0 0; background-size: 14px 14px, 100% 100%;
  }
  .lines-scroll[data-edge="start"]::after, .lines-scroll[data-edge="middle"]::after { opacity: 1; }
  .lines-scroll[data-edge="end"]::before, .lines-scroll[data-edge="middle"]::before { opacity: 1; }
}

/* ---------- service menu (phones): a destination blind that rolls down from the bar ---------- */
.blind { position: fixed; inset: 0; z-index: 95; background: rgba(10, 10, 14, .5); backdrop-filter: blur(2px); }
.blind[hidden] { display: none; }
.blind-roll {
  width: min(460px, 100%); margin-left: auto; max-height: 100dvh; overflow: auto;
  background: var(--board); color: #fff; border-bottom: 6px solid var(--amber); border-radius: 0 0 0 18px;
  padding: 16px 20px 22px; transform-origin: top; animation: blind .28s cubic-bezier(.2, .8, .3, 1);
}
@keyframes blind { from { transform: scaleY(.2); opacity: 0; } to { transform: none; opacity: 1; } }
.blind-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.blind-title, .blind-sub { font: 700 12px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }
.blind-sub { margin: 18px 0 10px; }
.blind-x { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, .08); border: 0; color: #fff; }
.blind-route { position: relative; display: grid; padding-left: 30px; }
.blind-route::before { content: ''; position: absolute; left: 9px; top: 18px; bottom: 18px; width: 6px; border-radius: 3px; background: var(--amber); }
.br-stop { position: relative; display: grid; padding: 10px 8px; border-radius: 10px; }
.br-stop::before { content: ''; position: absolute; left: -27px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; background: var(--board); border: 4px solid var(--amber); }
.br-stop b { font: 700 19px var(--font-display); letter-spacing: -.01em; }
.br-stop small { font-size: 13px; color: rgba(255, 255, 255, .62); }
.br-stop:hover, .br-stop:focus-visible { background: rgba(255, 255, 255, .07); }
.br-stop.on::before { background: var(--amber); }
.br-stop.on b { color: var(--amber); }
.blind-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.blind-lines .lbadge { color: #fff; padding: 5px 12px 5px 5px; }
.blind-lines .lbadge:hover { background: rgba(255, 255, 255, .08); }
.blind :focus-visible { outline-color: var(--amber); }

/* ---------- type helpers ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; font: 500 12px/1 var(--font-mono);
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 18px;
}
.eyebrow.light { color: rgba(255, 255, 255, .85); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229, 32, 46, .55); } 70% { box-shadow: 0 0 0 10px rgba(229, 32, 46, 0); } 100% { box-shadow: 0 0 0 0 rgba(229, 32, 46, 0); } }
h1 em { font-style: normal; color: var(--red); }
.lead { font-size: 19px; line-height: 1.55; color: var(--ink-2); max-width: 62ch; margin-top: 18px; }
.page-head { padding: 64px 0 36px; }
.page-head h1 { font-size: clamp(38px, 6vw, 68px); }
.sec { padding: 56px 0 8px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 26px; }
.sec-head h2 { font-size: clamp(26px, 3.4vw, 38px); }
.sec-head p { color: var(--mute); max-width: 52ch; }

/* ---------- buttons, fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 22px; border-radius: 999px;
  border: 2px solid var(--ink); font: 600 15px var(--font-body); background: transparent; color: var(--ink);
  transition: transform .15s, background .15s, color .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-line:hover { background: var(--ink); color: var(--paper); }
.btn-sun { background: var(--amber); border-color: var(--amber); color: #15151a; }
.btn.block { width: 100%; margin-top: 22px; }
.btn .ic { width: 18px; height: 18px; }

.field {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--rule); border-radius: 10px;
  background: var(--card); color: var(--ink); font: 500 16px var(--font-body);
}
.field:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 30%, transparent); }
textarea.field { resize: vertical; line-height: 1.5; }
.mono-area { font-family: var(--font-mono); font-size: 13.5px; }
.lbl { display: block; margin: 18px 0 6px; font: 500 12px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-weight: 500; }
.alert { background: var(--red-t); color: var(--red); border-radius: 8px; padding: 10px 14px; font-weight: 600; margin: 12px 0; }
.sub-form { display: grid; gap: 8px; }
.sub-row { display: flex; gap: 8px; align-items: stretch; }
.sub-row .field { flex: 1; min-width: 0; }
.sub-row .btn { flex: none; padding-block: 10px; }
.sub-form .btn[disabled] { opacity: .65; cursor: progress; transform: none; }
.sub-status { font-size: 13.5px; min-height: 1.2em; }
.sub-status:empty { display: none; }
.sub-status[data-kind="err"] { color: #ff8f8f; }
.sub-status[data-kind="ok"] { color: var(--amber); }
.sub-status a { text-decoration: underline; }
.field[aria-invalid="true"] { border-color: #ff6b6b; }

.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: 999px;
  border: 1.5px solid var(--rule); background: var(--card); font: 600 14px var(--font-body); color: var(--ink);
}
.chip:not(:has(.lb, .zg)) { padding-left: 14px; }
.chip .zg { margin-left: 4px; }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.on .zg-ring { stroke: var(--paper); }
.chip.on .zg-dot { fill: var(--paper); }
.chip-sep { width: 1px; background: var(--rule); margin: 4px 6px; }
.map-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }

/* zone glyph */
.zg { width: 18px; height: 18px; flex: none; }
.zg-ring { fill: var(--card); stroke: var(--ink); stroke-width: 2.4; }
.zg-dot { fill: var(--ink); }
.zg-solid { fill: var(--ink); }
.zpill { display: inline-flex; align-items: center; gap: 6px; font: 500 12px var(--font-mono); letter-spacing: .04em; color: var(--ink-2); }

/* ---------- search finder ---------- */
.finder { position: fixed; inset: 0; z-index: 90; background: rgba(10, 10, 14, .55); backdrop-filter: blur(3px); padding: 12vh 20px 20px; }
.finder[hidden] { display: none; }
.finder-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.finder-x { padding: 4px 10px; border: 1.5px solid var(--rule); border-radius: 8px; background: none; font: 500 11px var(--font-mono); color: var(--mute); }
.finder-x:hover { color: var(--ink); border-color: var(--ink); }
.finder-list a[aria-selected="true"] { background: color-mix(in srgb, var(--ink) 9%, transparent); box-shadow: inset 4px 0 0 var(--red); }
.finder-box { width: min(640px, 100%); margin-inline: auto; background: var(--card); border-radius: 16px; padding: 22px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); border-top: 6px solid var(--red); }
.finder-lbl { display: block; font: 500 12px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); margin-bottom: 8px; }
.finder-box input { width: 100%; border: 0; border-bottom: 2px solid var(--ink); background: none; color: var(--ink); font: 600 24px var(--font-display); padding: 6px 0 10px; outline: none; }
.finder-box input:focus { border-bottom-color: var(--red); box-shadow: 0 3px 0 var(--red); }
.finder-list { margin-top: 10px; max-height: 46vh; overflow: auto; }
.finder-list a { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--rule); font-weight: 600; }
.finder-list a:hover { background: var(--lt, color-mix(in srgb, var(--ink) 6%, transparent)); }
.finder-list a span { flex: 1; }
.finder-list a em { font: 500 12px var(--font-mono); color: var(--mute); font-style: normal; }
.finder-none, .finder-hint { color: var(--mute); font-size: 14px; padding-top: 12px; }

/* ---------- footer ---------- */
#foot { margin-top: 64px; background: var(--sign); color: var(--sign-ink); }
#foot .brand, #foot .logo-mark { color: var(--sign-ink); }
.foot-in { display: grid; grid-template-columns: 1.3fr .7fr .8fr 1.3fr; gap: 40px; padding: 64px 0 40px; }
.foot-brand p { margin-top: 16px; color: rgba(255, 255, 255, .62); max-width: 34ch; font-size: 15px; }
.foot-col { display: flex; flex-direction: column; gap: 8px; }
.foot-col h2, .foot-sub h2 { font: 500 12px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); margin-bottom: 8px; }
.foot-col a { color: rgba(255, 255, 255, .78); font-size: 15px; }
.foot-col a:hover { color: #fff; text-decoration: underline; }
.foot-sub p { color: rgba(255, 255, 255, .62); font-size: 14px; margin-bottom: 14px; }
.foot-sub .field { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); color: #fff; }
.foot-sub .btn-ink { background: var(--amber); border-color: var(--amber); color: #15151a; }
.foot-legal { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 0 34px; border-top: 1px solid rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .55); font-size: 14px; }
.foot-legal a { text-decoration: underline; }
@media (max-width: 900px) { .foot-in { grid-template-columns: 1fr 1fr; } .foot-brand, .foot-sub { grid-column: 1 / -1; } }

/* ---------- toast, motion ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow); animation: in .25s ease; }
main.enter { animation: in .35s ease; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
