
:root {
  --sign: #0F2740;        /* station sign navy */
  --sign-text: #FFFFFF;
  --sign-muted: #A9BACB;
  --bg: #F2F4F3;
  --surface: #FFFFFF;
  --ink: #0F1B26;
  --muted: #5B6875;
  --line: #DCE2E5;
  --go: #0A8F4B;          /* boarding */
  --go-wash: #E2F4EA;
  --hold: #B87400;        /* full, leaving */
  --hold-wash: #FBF0D9;
  --warn: #B3261E;
  --seat-taken: #C9D0D6;
  --stop-fill: #FFFFFF;
  /* corridor colours */
  --c-west: #EE8222;
  --c-jerid: #0C9C9C;
  --c-oasis: #8B5E34;
  --c-mines: #2F6FD6;
  --c-north: #8E44AD;
  --c-south: #D7263D;
  --c-other: #7A8590;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sign: #0B1D30;
    --bg: #0B141C;
    --surface: #121E29;
    --ink: #E8EEF2;
    --muted: #93A3B1;
    --line: #22313E;
    --go: #3DD68C;
    --go-wash: #0F2E22;
    --hold: #F2B544;
    --hold-wash: #2E2513;
    --warn: #FF8A80;
    --seat-taken: #34434F;
    --stop-fill: #121E29;
    --c-west: #FF9A45;
    --c-jerid: #2CC4C4;
    --c-oasis: #C08A5A;
    --c-mines: #5C93F0;
    --c-north: #B57AD6;
    --c-south: #FF5468;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 "Readex Pro", "Noto Sans Arabic", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--c-mines); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ---------- Station sign ---------- */
.sign { background: var(--sign); color: var(--sign-text); }
.sign-inner { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: end; padding-top: 18px; padding-bottom: 18px; }
.sign-top { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.mark { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--sign-muted); }
.mark svg { flex: none; }
.station { margin: 0; font-weight: 600; font-size: clamp(30px, 7.5vw, 52px); line-height: 1.05; }
.station-alt { margin: 6px 0 0; color: var(--sign-muted); font-size: 15px; font-weight: 300; }
.clock { text-align: end; }
.clock .time { font-size: clamp(34px, 8vw, 56px); font-weight: 300; line-height: 1; letter-spacing: .02em; direction: ltr; display: inline-block; }
.clock .time .colon { animation: blink 2s steps(1) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.strip {
  background: #0A1C2E;
  border-top: 1px solid #1E3A57;
  font-size: 14px;
  color: var(--sign-muted);
}
@media (prefers-color-scheme: dark) { .strip { background: #08131F; } }
.strip .wrap { display: flex; flex-wrap: wrap; gap: 6px 20px; padding-top: 9px; padding-bottom: 9px; }
.strip span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3DD68C; flex: none; }
.dot.off { background: #FF8A80; }
.dot.idle { background: #F2B544; }

/* ---------- Search ---------- */
.find { margin-top: 18px; position: relative; }
.find input {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 14px 48px 14px 16px;
  font-size: 18px;
}
[dir="ltr"] .find input { padding: 14px 16px 14px 48px; }
.find input:focus { outline: none; border-color: var(--ink); }
.find > svg { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 16px; color: var(--muted); pointer-events: none; }
.banner { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--surface); border-inline-start: 4px solid var(--warn); font-size: 15px; }

h2 { font-size: 20px; font-weight: 600; margin: 0; }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; margin: 30px 0 12px; }
.sec-head p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- Departure board ---------- */
.board { background: var(--surface); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.board-cols, .dep {
  display: grid;
  grid-template-columns: 6px minmax(0, 1.6fr) minmax(0, 1.4fr) auto;
  align-items: center;
  column-gap: 14px;
}
.board-cols { padding: 8px 16px 8px 0; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
[dir="rtl"] .board-cols { padding: 8px 0 8px 16px; }
.board-cols span:last-child, .dep .fare { text-align: end; }
.dep { padding: 0 16px 0 0; min-height: 76px; border-bottom: 1px solid var(--line); cursor: pointer; }
[dir="rtl"] .dep { padding: 0 0 0 16px; }
.dep:last-child { border-bottom: none; }
.dep .bar { align-self: stretch; }
.dep .dest { padding: 12px 0; }
.dep .dest b { display: block; font-size: 20px; font-weight: 600; line-height: 1.2; }
.dep .dest small { color: var(--muted); font-size: 13px; }
.dep .fare { font-size: 18px; font-weight: 600; white-space: nowrap; }
.cur { font-size: .72em; color: var(--muted); font-weight: 400; margin-inline-start: 3px; }
.state { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.go { background: var(--go-wash); color: var(--go); }
.pill.hold { background: var(--hold-wash); color: var(--hold); }
.pill.go::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: board 1.6s ease-in-out infinite; }
@keyframes board { 50% { opacity: .2; } }
.board-empty { padding: 22px 18px; color: var(--muted); }
.board-empty b { color: var(--ink); display: block; font-weight: 500; margin-bottom: 4px; }

/* seats: 8 per louage */
.seats { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.van { display: inline-grid; grid-template-columns: repeat(4, 11px); grid-template-rows: 9px 9px; gap: 3px; direction: ltr; }
.van i { border-radius: 3px 3px 2px 2px; background: var(--seat-taken); }
.van i.free { background: transparent; box-shadow: inset 0 0 0 2px var(--go); }

@media (max-width: 560px) {
  .board-cols { display: none; }
  .dep { grid-template-columns: 6px minmax(0, 1fr) auto; grid-template-areas: "bar dest fare" "bar state state"; row-gap: 0; }
  .dep .bar { grid-area: bar; }
  .dep .dest { grid-area: dest; padding-bottom: 6px; }
  .dep .fare { grid-area: fare; }
  .dep .state { grid-area: state; flex-direction: row; align-items: center; flex-wrap: wrap; padding-bottom: 14px; }
}

/* ---------- Network map ---------- */
.map-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.map-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.map { display: block; width: 100%; min-width: 620px; height: auto; direction: ltr; }
.map .track { fill: none; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.map .stop { fill: var(--stop-fill); stroke: var(--ink); stroke-width: 2.2; }
.map .stop.live { stroke: var(--go); stroke-width: 3; fill: var(--go); }
.map .halo { fill: none; stroke: var(--go); stroke-width: 2; opacity: 0; }
.map .halo.live { animation: halo 2.2s ease-out infinite; }
@keyframes halo { 0% { r: 6; opacity: .8; } 100% { r: 16; opacity: 0; } }
.map text { font-family: inherit; font-size: 11px; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.map text.live { font-weight: 600; fill: var(--go); }
.map .hub-label { font-size: 13px; font-weight: 700; }
.map .st { cursor: pointer; }
.map .st:hover text, .map .st:focus text { text-decoration: underline; }
.map .st:focus { outline: none; }
.map .st:focus-visible .stop { stroke: var(--c-mines); stroke-width: 4; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 6px 10px 6px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 5px; border-radius: 3px; }
.legend .lv { width: 10px; height: 10px; border-radius: 50%; background: var(--go); }

/* ---------- Line diagrams ---------- */
.lines { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.line { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 6px; }
.line-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.badge { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 15px; }
.line-head h3 { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.2; }
.line-head small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.stops { list-style: none; margin: 0; padding: 0; }
.stp { position: relative; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; column-gap: 10px; min-height: 52px; padding: 6px 0; border-radius: 8px; transition: background-color .6s; }
.stp::before { content: ""; position: absolute; inset-inline-start: 10px; top: 0; bottom: 0; width: 6px; background: var(--lc); }
.stp:first-child::before { top: 50%; }
.stp:last-child::before { bottom: 50%; }
.stp .node { position: relative; z-index: 1; width: 16px; height: 16px; margin-inline-start: 5px; border-radius: 50%; background: var(--stop-fill); border: 3px solid var(--lc); }
.stp.origin .node { width: 20px; height: 20px; margin-inline-start: 3px; border-radius: 6px; border-color: var(--ink); border-width: 3px; }
.stp.live .node { background: var(--go); border-color: var(--go); box-shadow: 0 0 0 3px var(--go-wash); }
.stp .nm b { font-weight: 500; font-size: 16px; }
.stp.live .nm b { font-weight: 600; }
.stp .nm small { display: block; font-size: 13px; color: var(--muted); }
.stp.live .nm small { color: var(--go); font-weight: 500; }
.stp .fare { font-weight: 600; white-space: nowrap; font-size: 15px; }
.stp.origin .nm small { color: var(--muted); font-weight: 400; }
.flash { background: var(--hold-wash); }
.empty { color: var(--muted); padding: 10px 0; }

footer { margin-top: 36px; border-top: 1px solid var(--line); }
footer .wrap { padding-top: 18px; padding-bottom: 36px; color: var(--muted); font-size: 13px; }
footer a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  .clock .time .colon, .pill.go::before, .map .halo.live { animation: none; }
  .stp { transition: none; }
}

/* ---------- v3 additions ---------- */
a { color: inherit; }
.langs { display: inline-flex; border: 1px solid #3A5572; border-radius: 9px; overflow: hidden; }
.langs a { padding: 4px 11px; font-size: 14px; text-decoration: none; color: var(--sign-muted); }
.langs a + a { border-inline-start: 1px solid #3A5572; }
.langs a[aria-current="true"] { background: var(--sign-text); color: var(--sign); font-weight: 600; }
.langs a:hover:not([aria-current="true"]) { background: #1B3A5A; color: var(--sign-text); }
.mark a { text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }

.dep { text-decoration: none; color: inherit; }
.dep:hover .dest b { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.eta { font-size: 13px; color: var(--ink); font-weight: 500; }
.eta::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-inline-end: 5px; vertical-align: -1px;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M8 4.5V8l2.5 1.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M8 4.5V8l2.5 1.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat; }
.stp .nm a { text-decoration: none; }
.stp .nm a:hover b { text-decoration: underline; text-underline-offset: 3px; }

/* footer index of destinations */
.dest-index h2 { font-size: 15px; margin: 0 0 10px; color: var(--ink); }
.dest-index ul { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.dest-index a { text-decoration: none; font-size: 14px; color: var(--ink); }
.dest-index a:hover { text-decoration: underline; }
.dest-index i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-inline-end: 6px; }

/* ---------- destination page ---------- */
.crumbs { padding-top: 14px; font-size: 14px; }
.crumbs a { color: var(--sign-muted); text-decoration: none; }
.crumbs a:hover { color: var(--sign-text); text-decoration: underline; }
.route-title { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.route-title .badge { width: 42px; height: 42px; font-size: 20px; border-radius: 10px; flex: none; }
.route-title h1 { margin: 0; font-weight: 600; font-size: clamp(28px, 7vw, 46px); line-height: 1.1; }
.route-sub { color: var(--sign-muted); margin: 8px 0 0; font-size: 15px; }
.sign-pg { padding-bottom: 22px; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 18px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.fact .lbl { font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.fact .big { font-size: 34px; font-weight: 600; line-height: 1.1; }
.fact .big .cur { font-size: 16px; }
.now-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 4px; }
.now-state .van { grid-template-columns: repeat(4, 16px); grid-template-rows: 13px 13px; gap: 4px; }
.now-none { color: var(--muted); margin: 6px 0 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.panel p { margin: 0 0 6px; }
.panel .note { color: var(--muted); font-size: 14px; }
.summary { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 12px; }
.summary p { margin: 0; font-weight: 500; }

.bars { direction: ltr; display: grid; grid-template-columns: 30px 1fr; grid-template-rows: 170px auto; margin-top: 10px; }
.bars .yax { position: relative; }
.bars .yax span { position: absolute; right: 8px; transform: translateY(50%); font-size: 12px; color: var(--muted); }
.bars .plot { position: relative; display: grid; grid-template-columns: repeat(var(--cols), 1fr); align-items: end; border-bottom: 1px solid var(--muted); }
.bars .gl { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); }
.bars .col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; padding: 0 2px; outline: none; cursor: default; }
.bars .bar { display: block; width: 100%; max-width: 46px; border-radius: 4px 4px 0 0; min-height: 0; }
.bars .col:hover .bar, .bars .col:focus .bar { opacity: .75; }
.bars .col:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); border-radius: 4px; }
.bars .nowline { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px dashed var(--ink); pointer-events: none; }
.bars .nowline b { position: absolute; top: -2px; left: 4px; font-size: 12px; font-weight: 600; font-style: normal; color: var(--ink); background: var(--surface); padding: 0 2px; }
.bars .xax { grid-column: 2; display: grid; grid-template-columns: repeat(var(--cols), 1fr); }
.bars .xax span { text-align: center; font-size: 12px; color: var(--muted); padding-top: 4px; }
@media (max-width: 480px) { .bars .col { padding: 0 1px; } .bars .xax span { font-size: 11px; } }
.chart-wrap { position: relative; }
.tip { position: absolute; z-index: 2; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 13px; padding: 5px 9px; border-radius: 7px; white-space: nowrap; transform: translate(-50%, -100%); opacity: 0; transition: opacity .1s; }
.bars .nowline.flip b { left: auto; right: 4px; }

.prose { max-width: 68ch; line-height: 1.75; }
.prose p { margin: 0 0 10px; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq details:last-child { border-bottom: none; }
.faq summary { cursor: pointer; font-weight: 500; }
.faq details p { margin: 8px 0 0; color: var(--muted); max-width: 68ch; }

.station-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 24px; }
.station-info dt { font-size: 13px; color: var(--muted); }
.station-info dd { margin: 2px 0 0; font-weight: 500; }
.station-info a { color: var(--c-mines); }
.two-col { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .two-col { grid-template-columns: 1.4fr 1fr; align-items: start; } }

/* voice search */
.find.has-mic input { padding-inline-end: 58px; }
.mic {
  position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 6px;
  width: 44px; height: 44px; border-radius: 10px; border: none; background: transparent;
  color: var(--ink); display: grid; place-items: center; cursor: pointer;
}
.mic[hidden] { display: none; }
.mic:hover { background: var(--bg); }
.mic[aria-pressed="true"] { background: var(--warn); color: #fff; }
.mic[aria-pressed="true"]::after {
  content: ""; position: absolute; inset: -4px; border-radius: 13px; border: 2px solid var(--warn);
  animation: micpulse 1.2s ease-out infinite;
}
@keyframes micpulse { from { opacity: .8; transform: scale(.92); } to { opacity: 0; transform: scale(1.15); } }
.mic-status { margin: 8px 2px 0; font-size: 14px; color: var(--muted); }
.mic-status.err { color: var(--warn); }
@media (prefers-reduced-motion: reduce) { .mic[aria-pressed="true"]::after { animation: none; } }
