/* CityBus Onboard — 1280×720 optimised */
@font-face{
  font-family:'FiraGO';font-style:normal;font-weight:500;font-display:swap;
  src:url('fonts/firago-medium.woff2') format('woff2');
}
@font-face{
  font-family:'FiraGO';font-style:normal;font-weight:600;font-display:swap;
  src:url('fonts/firago-semibold.woff2') format('woff2');
}
@font-face{
  font-family:'FiraGO';font-style:normal;font-weight:700;font-display:swap;
  src:url('fonts/firago-bold.woff2') format('woff2');
}

:root{
  /* CityBus brand — sampled from citybus.ge assets, confirmed 7 Sep 2026.
     Fleet livery blue is the accent; the logo's yellow sun is the highlight.
     Brand red (#E41800) is deliberately NOT used here: red means critical. */
  --bg:#070c18;
  --panel:#0f1730;
  --panel-2:#16203c;
  --line:#24305c;
  --ink:#eef2ff;
  --ink-dim:#9aa7c7;
  --ink-faint:#66719a;
  --accent:#12308f;          /* livery blue, deep */
  --accent-bright:#4a7cf0;   /* lifted for legibility on dark */
  --sun:#FCD400;             /* logo sun — highlight / current position */
  --amber:#e0a83c;
  --red:#e05555;
  /* Noto Sans Georgian for Georgian, Barlow for Latin — the original
     hall-slide pairing, kept as the boards' typefaces. */
  --ka:'Noto Sans Georgian',sans-serif;
  --en:'Barlow',sans-serif;
}
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%;width:100%}
body{
  background:var(--bg);
  color:var(--ink);
  font-family:var(--en);
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
}
.screen{
  height:100vh;height:100dvh;
  width:100vw;
  display:flex;flex-direction:column;
  padding:10px;
  gap:10px;
  max-width:1280px;
  margin:0 auto;
}

/* language rotation: one language at a time, crossfaded */
.i18n{transition:opacity .24s ease}
#screen.lang-fade .i18n{opacity:0}

/* delay chip — amber, the "overdue" colour; only ever shown with live GPS */
.eta-row{display:flex;align-items:center;gap:12px}
.delay-chip{
  font-family:var(--en);font-weight:700;font-variant-numeric:tabular-nums;
  font-size:15px;color:var(--amber);
  background:rgba(224,168,60,.12);border:1px solid rgba(224,168,60,.45);
  border-radius:8px;padding:.15em .5em;white-space:nowrap;
}
.delay-chip.small{font-size:12px;margin-left:8px;vertical-align:super}

/* ===== HEADER ===== */
.topbar{
  display:flex;align-items:center;justify-content:space-between;
  gap:16px;
  padding:10px 16px;
  background:linear-gradient(180deg,var(--panel),var(--panel-2));
  border:1px solid var(--line);
  border-radius:12px;
  flex:0 0 auto;
}
.brand{display:flex;align-items:center;gap:10px;color:var(--accent-bright)}
.logo-img{
  height:26px;width:auto;display:block;border-radius:3px;
}
.logo{width:32px;height:auto;color:var(--accent-bright)}
.brand-name{
  font-family:var(--en);font-weight:700;letter-spacing:.02em;
  font-size:18px;color:var(--ink);
}
.route-id{display:flex;align-items:center;gap:12px;min-width:0}
.route-chip{
  font-family:var(--en);font-weight:700;
  background:var(--accent);color:#e8efff;
  border:1px solid #2b52c8;
  padding:.25em .55em;border-radius:8px;
  font-size:18px;letter-spacing:.02em;
}
.route-text{min-width:0}
.route-ka{
  font-family:var(--ka);font-weight:700;
  /* Georgian descenders (ჯ ქ ყ ღ ჭ) need a taller line box — 1.05 crops them */
  font-size:20px;line-height:1.3;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
/* the English name rotates into the same slot at the same size —
   one language on screen at a time */
.route-en{
  font-family:var(--en);font-weight:700;color:var(--ink);
  font-size:20px;line-height:1.3;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.route-text[data-lang="ka"] .route-en{display:none}
.route-text[data-lang="en"] .route-ka{display:none}
.clock{text-align:right;flex:0 0 auto}
.clock-time{
  font-family:var(--en);font-weight:700;font-variant-numeric:tabular-nums;
  font-size:24px;line-height:1;
}
.clock-status{
  display:flex;align-items:center;gap:6px;justify-content:flex-end;
  color:var(--ink-dim);font-family:var(--ka);font-weight:500;
  font-size:12px;margin-top:4px;line-height:1.35;
}
.dot{width:8px;height:8px;border-radius:50%;background:var(--accent-bright);
  box-shadow:0 0 0 3px rgba(74,124,240,.20)}
.dot.stopped{background:var(--amber);box-shadow:0 0 0 3px rgba(224,168,60,.16)}

/* ===== MAIN ===== */
.main{
  flex:1 1 auto;min-height:0;
  display:grid;
  grid-template-columns:1.8fr 1fr;
  gap:10px;
}
.map-wrap{
  position:relative;border-radius:12px;overflow:hidden;
  border:1px solid var(--line);background:#0e1730;
}
.map-canvas{
  position:absolute;inset:0;width:100%;height:100%;display:block;
}
/* which source is driving the display — never leave the viewer guessing
   whether they are looking at a live fix or the timetable */
.map-src{
  position:absolute;right:10px;bottom:10px;z-index:3;white-space:nowrap;
  font-family:var(--en);font-size:11px;font-weight:600;
  letter-spacing:.04em;text-transform:uppercase;
  color:var(--ink-faint);background:rgba(7,12,24,.72);
  border:1px solid var(--line);border-radius:6px;padding:3px 7px;
}
.map-src.gps{color:var(--accent-bright);border-color:#2b52c8}
.map-src.stale{color:var(--amber);border-color:#5a4620}
.map-overlay{
  position:absolute;inset:0;pointer-events:none;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.03),
             inset 0 -40px 60px -30px rgba(11,16,32,.5);
}
.bus-badge{
  position:absolute;left:10px;bottom:10px;
  background:rgba(11,16,32,.85);backdrop-filter:blur(4px);
  border:1px solid var(--line);border-radius:8px;
  font-family:var(--en);font-weight:700;letter-spacing:.04em;
  padding:.25em .5em;font-size:13px;
  color:var(--ink);
}
.map-loading{
  position:absolute;inset:0;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:10px;
  background:#0e1730;z-index:2;transition:opacity .4s;
}
.map-loading.hidden{opacity:0;pointer-events:none}
.spinner{
  width:28px;height:28px;border-radius:50%;
  border:2.5px solid var(--line);border-top-color:var(--accent-bright);
  animation:spin 1s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}
.map-loading-text{font-family:var(--ka);color:var(--ink-dim);font-size:13px;line-height:1.4}

.info{
  display:flex;flex-direction:column;gap:10px;min-height:0;
}
.info-card{
  background:linear-gradient(180deg,var(--panel),var(--panel-2));
  border:1px solid var(--line);border-radius:12px;
  padding:12px 14px;
  display:flex;flex-direction:column;justify-content:center;
}
.info-card.status-card{flex:1 1 auto;transition:border-color .3s,background .3s}
.info-card.status-card.at-stop{
  border-color:var(--accent-bright);
  background:linear-gradient(180deg,#11214a,#0d1a3a);
}
/* a rest stop is planned time, so it must not read as an exception — give it
   the brand's yellow highlight rather than an alert colour */
.info-card.status-card.at-stop.rest{
  border-color:var(--sun);
  background:linear-gradient(180deg,#241f08,#1a1706);
}
.info-card.eta{flex:1 1 auto}
.info-card.stats{flex:0 0 auto;flex-direction:row;gap:14px}
.info-label{
  font-family:var(--ka);font-weight:500;color:var(--ink-dim);
  font-size:11px;letter-spacing:.02em;margin-bottom:4px;line-height:1.35;
}
.info-value{
  font-family:var(--ka);font-weight:700;
  /* line box tall enough for Georgian descenders, plus a little padding
     where overflow:hidden could still clip them */
  line-height:1.32;padding-bottom:2px;
  font-size:24px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.info-value.big{font-family:var(--en);font-weight:700;font-variant-numeric:tabular-nums;
  font-size:36px}
.info-sub{
  font-family:var(--en);font-weight:600;color:var(--ink-dim);
  font-size:12px;margin-top:6px;
}



.stat{flex:1;text-align:center}
.stat-label{font-family:var(--ka);color:var(--ink-dim);font-size:11px;line-height:1.35}
.stat-value{
  font-family:var(--en);font-weight:700;font-variant-numeric:tabular-nums;
  font-size:28px;line-height:1;margin-top:4px;
}
.stat-unit{color:var(--ink-faint);font-size:10px;margin-top:2px}


/* ===== STOP TIMELINE ===== */
.timeline{
  position:relative;flex:0 0 auto;
  height:114px;
  background:linear-gradient(180deg,var(--panel),var(--panel-2));
  border:1px solid var(--line);border-radius:12px;
}
/* everything positions against this inset track, so % maths lines up */
/* end-of-trip: the progress strip swaps to the arrival message
   (thank-you + belongings reminder, following the language rotation) */
.tl-done{
  display:none;position:absolute;inset:0;
  flex-direction:column;align-items:center;justify-content:center;gap:8px;
  text-align:center;
}
.timeline.done .tl-track{display:none}
.timeline.done .tl-done{display:flex}
.tl-done-title{
  font-family:var(--ka);font-weight:700;font-size:26px;line-height:1.35;
  color:var(--ink);
}
.tl-done-sub{
  font-family:var(--ka);font-weight:500;font-size:16px;line-height:1.4;
  color:var(--sun);
}

.tl-track{position:absolute;left:52px;right:52px;top:0;bottom:0}
.tl-rail,.tl-rail-done{
  position:absolute;top:42px;height:5px;border-radius:99px;left:0;
}
.tl-rail{right:0;background:var(--line)}
.tl-rail-done{
  width:0;
  background:linear-gradient(90deg,var(--accent),var(--accent-bright));
  transition:width 1.2s cubic-bezier(.4,0,.2,1);
}
.tl-stops{position:absolute;inset:0}
.tl-stop{
  position:absolute;top:0;transform:translateX(-50%);
  display:flex;flex-direction:column;align-items:center;
  width:96px;
}
.tl-time{
  font-family:var(--en);font-weight:700;font-variant-numeric:tabular-nums;
  font-size:13px;color:var(--ink-dim);
  height:22px;line-height:22px;
}
.tl-dot{
  width:13px;height:13px;border-radius:50%;
  background:var(--bg);border:3px solid var(--line);
  margin-top:14px;
  transition:background .3s,border-color .3s,transform .3s;
}
.tl-label{
  display:flex;flex-direction:column;align-items:center;
  margin-top:8px;
}
.tl-name{
  font-family:var(--ka);font-weight:700;font-size:13px;line-height:1.35;
  color:var(--ink-dim);white-space:nowrap;
}
.tl-sub{
  font-family:var(--en);font-weight:600;font-size:10px;
  color:var(--ink-faint);margin-top:1px;white-space:nowrap;
}
/* Staggered stops: label drops to a clear second band and becomes a single
   line (name + time side by side), so it cannot collide with the row above. */
.tl-stop[data-row="1"] .tl-time{visibility:hidden}
.tl-stop[data-row="1"] .tl-label{
  flex-direction:row;align-items:baseline;gap:5px;
  margin-top:40px;
}
.tl-stop[data-row="1"] .tl-sub{
  font-weight:700;font-size:11px;color:var(--ink-dim);margin-top:0;
}
/* states */
.tl-stop.passed .tl-dot{background:var(--accent-bright);border-color:var(--accent-bright)}
.tl-stop.passed .tl-name{color:var(--ink)}
.tl-stop.current .tl-dot{
  background:var(--sun);border-color:#fff8d6;
  transform:scale(1.5);
  box-shadow:0 0 0 5px rgba(252,212,0,.22);
}
.tl-stop.current .tl-name{color:var(--ink);font-weight:800}
.tl-stop.current .tl-time{color:var(--sun)}
/* bus marker riding the rail */
.tl-bus{
  position:absolute;top:44px;left:0;
  transform:translate(-50%,-50%);
  color:var(--ink);z-index:3;
  filter:drop-shadow(0 2px 4px rgba(0,0,0,.55));
  transition:left 1.2s cubic-bezier(.4,0,.2,1);
}

/* ===== TICKER ===== */
.ticker{
  flex:0 0 auto;overflow:hidden;border-radius:10px;
  background:var(--panel);border:1px solid var(--line);
  padding:8px 0;
}
.ticker-track{
  display:flex;gap:40px;
  width:max-content;white-space:nowrap;
  animation:ticker 22s linear infinite;
  padding-left:100%;
}
.ticker-item{
  font-family:var(--ka);font-weight:500;color:var(--ink-dim);
  font-size:14px;line-height:1.4;
}
.ticker-item .mono{font-family:var(--en);font-weight:600;color:var(--ink)}
@keyframes ticker{to{transform:translateX(-50%)}}

/* ===== 1280×720 exact fit ===== */
@media (min-width:1280px) and (min-height:720px){
  .screen{padding:12px;gap:12px}
  .topbar{padding:12px 18px}
  .route-ka,.route-en{font-size:22px}
  .clock-time{font-size:26px}
  .info-value{font-size:26px}
  .info-value.big{font-size:38px}
}

/* ===== responsive: phones and small tablets =====
   The bus screens are 720p landscape; the same page is also a phone view
   (passengers, office staff), so below 900px it stacks: map on top, the
   two main cards side by side, stats full width, timeline and ticker as-is. */
@media (max-width:900px){
  .screen{padding:8px;gap:8px}
  .topbar{padding:8px 12px;gap:10px}
  .logo-img{height:22px}
  .route-chip{font-size:14px}
  .route-ka,.route-en{font-size:16px}
  .clock-time{font-size:20px}
  .clock-status{font-size:11px}
  .main{display:flex;flex-direction:column;overflow-y:auto}
  .map-wrap{flex:1 1 auto;min-height:180px}
  .info{
    display:grid;grid-template-columns:1fr 1fr;
    flex:0 0 auto;gap:8px;
  }
  .info-card{padding:10px 12px}
  /* On a phone the two top cards sat side by side, so a slide running to
     three lines stretched the arrival card and shoved its neighbour about on
     every change. The arrival card takes a full row of its own instead: the
     slides get the whole width, and the reserved height below keeps the
     tallest slide and the shortest one in the same box, so nothing moves as
     the deck turns. */
  .info-card.status-card{grid-column:1 / -1}
  .info-card.eta{grid-column:1 / -1}
  .eta-slides{min-height:92px}
  .info-card.stats{grid-column:1 / -1}
  .info-value{font-size:20px}
  .info-value.big{font-size:28px}
  .delay-chip{font-size:13px}
  .timeline{height:104px}
  .tl-track{left:22px;right:22px}
  .tl-stop{width:64px}
  .tl-name{font-size:11px}
  .tl-time{font-size:11px}
  .ticker-item{font-size:12px}
}
@media (max-width:480px){
  .stat-value{font-size:22px}
  .info-value.big{font-size:24px}
  /* header wraps: brand + clock on top, route on its own full row */
  .topbar{flex-wrap:wrap;row-gap:6px}
  .route-id{order:3;flex-basis:100%;justify-content:center}
}

/* narrow screens: the timeline cannot carry nine labels, so it keeps dots
   and times for every stop but words only where they matter — origin,
   destination, current and next */
@media (max-width:640px){
  .tl-time{display:none}
  .tl-label{display:none}
  .tl-stop.current .tl-label,.tl-stop.next .tl-label,
  .tl-stop:first-child .tl-label,.tl-stop:last-child .tl-label{display:flex}
  .tl-stop.current .tl-time,.tl-stop.next .tl-time,
  .tl-stop:first-child .tl-time,.tl-stop:last-child .tl-time{display:block;visibility:visible}
  .tl-stop[data-row="1"] .tl-label{margin-top:8px;flex-direction:column;align-items:center;gap:0}
  /* endpoint labels sit hard at 0%/100% with translateX(-50%), so half of
     them would fall off the card edge — pull them flush instead */
  .tl-stop:first-child{transform:none}
  .tl-stop:first-child .tl-label{align-items:flex-start}
  .tl-stop:last-child{transform:translateX(-100%)}
  .tl-stop:last-child .tl-label{align-items:flex-end}
  /* …and when current/next stands beside an endpoint, the endpoint yields
     entirely — its name already sits in the header route chip */
  .tl-stop.edge-hide .tl-label,.tl-stop.edge-hide .tl-time{display:none}
}

/* ---- destination weather + rotating passenger card (the variable box) ----
   Weather is for where the bus is GOING, not where it is: the arrival city is
   what passengers plan around. Hidden entirely when the feed is unreachable. */
.info-card.wxcard{flex:0 0 auto;gap:8px}
.wx-line{display:flex;align-items:center;gap:10px}
.wx-ico{width:34px;height:34px;flex:0 0 auto;display:block}
.wx-ico svg{width:100%;height:100%;display:block}
.wx-temp{
  font-family:var(--en);font-weight:700;font-size:26px;line-height:1;
  color:var(--ink);letter-spacing:-.01em;
}
.wx-where{display:flex;flex-direction:column;min-width:0;flex:1}
.wx-place{
  font-family:var(--ka);font-weight:600;font-size:13px;color:var(--ink);
  line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.wx-cond{
  font-family:var(--ka);font-weight:500;font-size:11px;color:var(--ink-dim);
  line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.wx-hilo{
  font-family:var(--en);font-weight:600;font-size:13px;color:var(--ink-dim);
  flex:0 0 auto;
}
.wx-note{
  border-top:1px solid var(--line);padding-top:7px;
  display:flex;flex-direction:column;gap:2px;
}
.wx-note-title{
  font-family:var(--ka);font-weight:700;font-size:10px;letter-spacing:.05em;
  color:var(--sun);text-transform:uppercase;
}
.wx-note-text{
  font-family:var(--ka);font-weight:500;font-size:11px;line-height:1.4;
  color:var(--ink-dim);
}
.wx-note-text b{color:var(--ink);font-family:var(--en);font-weight:700}
@media (min-width:1280px) and (min-height:720px){
  .wx-temp{font-size:30px}
  .wx-ico{width:38px;height:38px}
  .wx-place{font-size:14px}
  .wx-note-text{font-size:12px}
}

/* ===== ARRIVAL BLOCK — VARIABLE AREA =====
   The block's own figures stay at the top and never move; the deck is pinned
   to the bottom of the block so each slide occupies the same rectangle
   whatever it says. */
.info-card.eta{display:flex;flex-direction:column}
.eta-slides{
  margin-top:auto;padding-top:12px;
  border-top:1px solid rgba(255,255,255,.10);
}
.eta-slide{animation:slideIn .45s ease both}
@keyframes slideIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.eta-slide.slide-wx{display:flex;align-items:center;gap:12px}
.eta-slide.slide-note{display:block}
.slide-note .wx-note-title{
  display:block;font-family:var(--en);font-weight:700;font-size:12px;
  letter-spacing:.06em;color:var(--amber);margin-bottom:3px;
}
.slide-note .wx-note-text{
  display:block;font-family:var(--ka);font-size:15px;line-height:1.45;color:var(--ink);
}
/* the display rules above would otherwise beat the hidden attribute */
.eta-slide[hidden]{display:none}
