/* South Yorkshire control room.
   Layout: the live map takes two thirds with the "now" panels stacked beside it;
   "tomorrow" runs full width underneath. Everything is scoped under .syc so
   nothing reaches the site header, and the tokens live on body.syc-page so
   they cover the strip either side of the content. */

body.syc-page{
  --bg:#f3f3f2; --panel:#ffffff; --ink:#2d2d2d; --muted:#6b6b6b; --line:#dad9d5;
  --accent:#f26b21; --soft:#efeeeb;
  --early:#3987e5; --ontime:#383835; --late:#ec835a; --vlate:#d03b3b; --unknown:#898781;
  --ok:#2f6b3a; --warn:#b45309; --bad:#b42318; --works:#7c3aed;
  --lvl1:#fde8c8; --lvl1-ink:#7a4a05; --lvl2:#f9c9c4; --lvl2-ink:#7d1710;
  background:var(--bg); color:var(--ink);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) body.syc-page{
    --bg:#151515; --panel:#212121; --ink:#ececec; --muted:#a3a3a3; --line:#383838; --soft:#2b2b2b;
    --accent:#ff8a4c; --early:#5ea2f2; --ontime:#d8d8d4; --late:#f09a76; --vlate:#ef6b6b; --unknown:#8f8d86;
    --ok:#6cc184; --warn:#f0b35c; --bad:#ff8a80; --works:#a78bfa;
    --lvl1:#4a3512; --lvl1-ink:#f3d29a; --lvl2:#5a1f1a; --lvl2-ink:#ffc9c3;
  }
}
:root[data-theme="dark"] body.syc-page{
  --bg:#151515; --panel:#212121; --ink:#ececec; --muted:#a3a3a3; --line:#383838; --soft:#2b2b2b;
  --accent:#ff8a4c; --early:#5ea2f2; --ontime:#d8d8d4; --late:#f09a76; --vlate:#ef6b6b; --unknown:#8f8d86;
  --ok:#6cc184; --warn:#f0b35c; --bad:#ff8a80; --works:#a78bfa;
  --lvl1:#4a3512; --lvl1-ink:#f3d29a; --lvl2:#5a1f1a; --lvl2-ink:#ffc9c3;
}

.syc, .syc *{box-sizing:border-box}
.syc{
  max-width:1480px; margin:0 auto; font-family:Inter,system-ui,"Segoe UI",Arial,sans-serif;
  font-size:14px; line-height:1.45;
  padding-block:20px 48px;
  padding-left:max(16px, env(safe-area-inset-left, 0px));
  padding-right:max(16px, env(safe-area-inset-right, 0px));
  display:flex; flex-direction:column; gap:18px;
}
.syc h1{font-size:24px; font-weight:700; letter-spacing:-.01em; margin:0; text-wrap:balance}
.syc h2{font-size:12px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; margin:0; color:var(--muted)}
.syc p{margin:0}
.syc-head{display:flex; justify-content:space-between; align-items:flex-end; gap:12px 24px; flex-wrap:wrap}
.syc-sub{color:var(--muted); margin-top:4px; max-width:70ch}
.syc-stamp{color:var(--muted); font-size:12px; font-variant-numeric:tabular-nums}

.syc-grid{display:grid; grid-template-columns:minmax(0,1.55fr) minmax(0,1fr); gap:16px; align-items:start}
.side{display:flex; flex-direction:column; gap:12px; min-width:0}

.card{background:var(--panel); border:1px solid var(--line); border-radius:6px; padding:14px 16px;
      display:flex; flex-direction:column; gap:10px; min-width:0}
.card-head{display:flex; justify-content:space-between; align-items:center; gap:8px}
.muted{color:var(--muted); font-size:12px}
.empty{color:var(--muted)}
.note{color:var(--muted); font-size:12px; max-width:90ch}
.error{color:var(--bad); font-size:13px}

.map-card{position:sticky; top:8px}
.controls{display:flex; flex-wrap:wrap; align-items:flex-end; gap:8px 14px}
.ms{position:relative}
.ms summary{list-style:none; cursor:pointer; display:flex; flex-direction:column; gap:2px; font-size:11px; color:var(--muted);
  min-width:170px; max-width:260px}
.ms summary::-webkit-details-marker{display:none}
.ms-value{font-size:13px; color:var(--ink); background:var(--panel); border:1px solid var(--line); border-radius:4px;
  padding:5px 26px 5px 8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; position:relative}
.ms-value::after{content:""; position:absolute; right:9px; top:50%; width:6px; height:6px; margin-top:-5px;
  border-right:2px solid var(--muted); border-bottom:2px solid var(--muted); transform:rotate(45deg)}
.ms[open] .ms-value{border-color:var(--accent)}
.ms summary:focus-visible .ms-value{outline:2px solid var(--accent); outline-offset:2px}
.ms-panel{position:absolute; z-index:5; top:100%; left:0; margin-top:3px; min-width:260px; max-width:min(340px,86vw);
  background:var(--panel); border:1px solid var(--line); border-radius:6px; box-shadow:0 8px 24px rgba(0,0,0,.2); padding:8px 10px}
.ms-clear{font:inherit; font-size:12px; background:none; border:0; color:var(--accent); cursor:pointer; padding:0 0 6px}
.ms-list{max-height:260px; overflow:auto; display:flex; flex-direction:column; gap:1px}
.ms-item{display:flex; align-items:center; gap:8px; padding:4px 2px; font-size:13px; color:var(--ink); cursor:pointer}
.ms-item:hover{background:var(--soft)}
.ms-item input{margin:0}
.ctl-check{display:flex; align-items:center; gap:6px; font-size:12.5px; padding-bottom:5px}
.showing{margin-left:auto; font-size:12px; color:var(--muted); padding-bottom:5px; font-variant-numeric:tabular-nums}
.map-holder{position:relative}
.bus-card{position:absolute; z-index:3; min-width:194px; max-width:260px; padding:9px 11px 10px; border-radius:8px;
  border:1px solid var(--line); background:var(--panel); box-shadow:0 6px 22px rgba(0,0,0,.18);
  font-size:12.5px; line-height:1.45; color:var(--muted); pointer-events:none}
.bus-card .row-line{display:flex; align-items:baseline; gap:7px; margin-bottom:2px}
.bus-card .line{font-weight:700; font-size:15px; color:var(--ink)}
.bus-card .operator{font-size:11.5px; color:var(--muted)}
.bus-card .dest{color:var(--ink); margin-bottom:5px}
.bus-card .state{font-weight:600; display:block; margin-bottom:4px}
.bus-card .state.early{color:var(--early)} .bus-card .state.on-time{color:var(--ok)}
.bus-card .state.late{color:var(--late)} .bus-card .state.very-late{color:var(--vlate)}
.bus-card .state.unknown{color:var(--muted); font-weight:400}
.bus-card dl{margin:0; display:grid; grid-template-columns:auto 1fr; gap:1px 9px}
.bus-card dt{color:var(--muted)} .bus-card dd{margin:0; color:var(--ink)}
.bus-card .pending{color:var(--muted); font-style:italic}
.bus-card .stale-note{display:block; margin-top:5px; padding-top:5px; border-top:1px solid var(--line); color:var(--bad)}
.map{height:640px; border-radius:4px; overflow:hidden; background:var(--soft)}
.live{display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--muted)}
.live i{width:8px; height:8px; border-radius:50%; background:var(--unknown)}
.live.on i{background:var(--ok)}
.live.stale i{background:var(--warn)}
.legend{display:flex; flex-wrap:wrap; gap:6px 16px; font-size:12px; color:var(--muted)}
.legend span{display:inline-flex; align-items:center; gap:6px}
.dot{width:10px; height:10px; border-radius:50%; display:inline-block}
.dot.early{background:var(--early)} .dot.ontime{background:var(--ontime)} .dot.late{background:var(--late)}
.dot.vlate{background:var(--vlate)} .dot.unknown{background:var(--unknown)}
.sq{width:10px; height:10px; display:inline-block; background:var(--works); transform:rotate(45deg)}

.tiles{display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px}
.tile{background:var(--panel); border:1px solid var(--line); border-radius:6px; padding:10px 12px;
      display:flex; flex-direction:column; gap:2px; min-width:0}
.tile b{font-size:26px; font-weight:700; font-variant-numeric:tabular-nums; line-height:1.1}
.tile span{font-size:12px; color:var(--muted)}
.tile small{font-size:11px; color:var(--muted); min-height:1em}

.wx{display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px}
.wx-d{border:1px solid var(--line); border-radius:4px; padding:8px 10px; display:flex; flex-direction:column; gap:2px}
.wx-d.l1{background:var(--lvl1); color:var(--lvl1-ink); border-color:transparent}
.wx-d.l2{background:var(--lvl2); color:var(--lvl2-ink); border-color:transparent}
.wx-d b{font-size:13px}
.wx-d .big{font-size:22px; font-weight:700; font-variant-numeric:tabular-nums}
.wx-d span{font-size:12px; font-variant-numeric:tabular-nums}

.wx-top{display:flex; align-items:center; gap:8px}
.wxi{flex:none; color:var(--muted)}
.wxi.sun{color:var(--accent)} .wxi.moon{color:var(--early)} .wxi.wet{color:var(--early)}
.wx-d.l1 .wxi,.wx-d.l2 .wxi{color:inherit}
.wx-rain{font-size:12px; font-weight:600}
.wx-rain.dry{color:var(--ok)} .wx-rain.wet{color:var(--early)}
.wx-d.l1 .wx-rain,.wx-d.l2 .wx-rain{color:inherit}
.outlook{display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px}
.outlook-d{display:flex; align-items:center; gap:8px; border:1px solid var(--line); border-radius:4px; padding:8px 10px; min-width:0}
.outlook-d div{display:flex; flex-direction:column; min-width:0}
.outlook-d span{font-size:12px; font-variant-numeric:tabular-nums}
.outlook-d span.dry{color:var(--ok)} .outlook-d span.wet{color:var(--early)}
.list{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px}
.list li{border-top:1px solid var(--line); padding-top:8px; display:flex; flex-direction:column; gap:2px}
.list li:first-child{border-top:0; padding-top:0}
.list .t{font-weight:600}
.list .m{color:var(--muted); font-size:12px}
.sev{display:inline-block; font-size:11px; font-weight:600; padding:1px 7px; border-radius:99px; margin-right:6px;
     background:var(--soft); color:var(--ink)}
.sev.severe,.sev.verysevere{background:var(--lvl2); color:var(--lvl2-ink)}
.sev.normal{background:var(--lvl1); color:var(--lvl1-ink)}

.unlit{border-style:dashed}
.unlit p{color:var(--muted); font-size:13px}
.pill{font-size:11px; font-weight:600; padding:2px 8px; border-radius:99px; background:var(--soft); color:var(--muted)}
.pill.off{border:1px dashed var(--muted)}

.tomorrow{display:flex; flex-direction:column; gap:12px}
.tom-head{display:flex; align-items:baseline; gap:14px; flex-wrap:wrap; border-top:2px solid var(--ink); padding-top:14px}
.tom-head h2{font-size:18px; letter-spacing:0; text-transform:none; color:var(--ink)}
.tom-date{font-size:16px; color:var(--muted)}
.tom-grid{display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; align-items:start}
.card.wide{grid-column:1 / -1}

.flag{display:flex; gap:10px; align-items:flex-start; padding:8px 10px; border-radius:4px}
.flag.l1{background:var(--lvl1); color:var(--lvl1-ink)}
.flag.l2{background:var(--lvl2); color:var(--lvl2-ink)}
.flag b{min-width:110px}
.flag .when{font-variant-numeric:tabular-nums; white-space:nowrap}
.flag small{display:block; opacity:.85}
.flags-none{padding:8px 10px; border-radius:4px; background:var(--soft)}
#flags{display:flex; flex-direction:column; gap:6px}

.heat-wrap{overflow-x:auto}
.heat{border-collapse:separate; border-spacing:2px; font-size:11px; font-variant-numeric:tabular-nums}
.heat th{font-weight:500; color:var(--muted); text-align:center; padding:0 2px}
.heat th.row{text-align:left; padding-right:8px; white-space:nowrap; color:var(--ink); font-weight:600}
.heat td{min-width:30px; height:26px; text-align:center; border-radius:3px; background:var(--soft); color:var(--muted)}
.heat td.l1{background:var(--lvl1); color:var(--lvl1-ink); font-weight:700}
.heat td.l2{background:var(--lvl2); color:var(--lvl2-ink); font-weight:700}
.k{display:inline-block; min-width:18px; text-align:center; border-radius:3px; font-weight:700; padding:0 3px}
.k.r,.k.v,.k.i,.k.m{background:var(--lvl1); color:var(--lvl1-ink)}
.k.w{background:var(--lvl2); color:var(--lvl2-ink)}
.k.r{background:var(--lvl2); color:var(--lvl2-ink)}

.base-row{display:flex; justify-content:space-between; gap:8px; font-variant-numeric:tabular-nums}
.base-big{font-size:26px; font-weight:700}

.maplibregl-popup-content{font-family:inherit; font-size:12px; color:#2d2d2d}

@media (max-width: 1100px){
  .syc-grid{grid-template-columns:minmax(0,1fr)}
  .map-card{position:static}
  .map{height:480px}
}
@media (max-width: 900px){ .outlook{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (max-width: 700px){
  .tiles{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tom-grid{grid-template-columns:minmax(0,1fr)}
  .map{height:380px}
  .flag{flex-direction:column; gap:2px}
  .flag b{min-width:0}
}
@media (prefers-reduced-motion: reduce){ .syc *{transition:none !important} }
