/* Shared styles for every departures screen. The screen-specific settings live in /config/*.js. */
@font-face {
  font-family: "Roboto"; font-style: normal; font-weight: 100 900; font-stretch: 100%; font-display: swap;
  src: url("/assets/fonts/roboto-latin.woff2") format("woff2");
}
  /* Laid out at 1920x1080 and scaled to fit any screen (HD, 4K or a browser window), keeping 16:9. */
  html { font-size: 20px; }
  :root {
    --bg: #0d0f13; --card: rgba(20,24,31,.94); --card-2: #1d222b;
    --ink: #f4f5f7; --muted: #a3abb9; --rule: #2a303b;
    --accent: #e3002b; --late: #ffb020; --ok: #3ddc84; --walk: #ffd84d;
    --walk-text: #ffd84d; --walk-under: rgba(13,15,19,.6);
    --overlay: rgba(13,15,19,.88); --map-bg: #12151b; --route: #9aa6bd;
    --tile-filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.85) saturate(0.3); --tile-opacity: 0.62;
    --card-shadow: 0 1rem 3rem rgba(0,0,0,.45);
    --logo: #ffffff;
    --logo-mask: url("/ecolint-logo.png");
  }
  /* Light theme (used at the -light address, or with #light) */
  html.light {
    --logo: #001489;
    --bg: #eeece6; --panel: #ffffff; --panel-2: #f5f4f0; --card: rgba(255,255,255,.96); --card-2: #f5f4f0;
    --ink: #14161b; --muted: #555c68; --rule: #dcd9d1;
    --accent: #d0021b; --late: #a85800; --ok: #0f7a43;
    --walk: #e08a00; --walk-text: #a35f00; --walk-under: rgba(255,255,255,.9);
    --overlay: rgba(255,255,255,.93); --map-bg: #f4f3ef; --route: #7c879e;
    --tile-filter: grayscale(1) contrast(0.9); --tile-opacity: 0.55;
    --card-shadow: 0 0.6rem 2rem rgba(20,22,27,.16);
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
  body { overflow: hidden; }
  body.idle { cursor: none; }   /* pointer hides after a few seconds without movement */
  #stage {
    position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; overflow: hidden;
    font-family: Roboto, system-ui, sans-serif;
    display: grid; grid-template-rows: 91.8px 1fr 43.2px;
  }
  header { display: flex; align-items: center; justify-content: space-between; padding: 0 38.4px; border-bottom: 1px solid var(--rule); }
  .title { display: flex; align-items: center; gap: 23px; }
  .logo { height: 2.9rem; aspect-ratio: 441 / 120; flex: none; background: var(--logo);
    -webkit-mask-image: var(--logo-mask); mask-image: var(--logo-mask); -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
  .hdr-sep { width: 2px; height: 2.6rem; background: var(--rule); flex: none; }
  .title h1 { margin: 0; line-height: 1; font-size: 2.5rem; font-weight: 900; letter-spacing: -0.02em; }
  .title .where { font-size: 1.45rem; color: var(--muted); font-weight: 500; }
  .clock { font-size: 3.4rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
  .clock .secs { font-size: 1.5rem; color: var(--muted); margin-left: 0.3rem; font-weight: 600; }

  main { position: relative; min-height: 0; overflow: hidden; }
  #map { position: absolute; inset: 0; background: var(--map-bg); }
  #map .leaflet-tile-pane { filter: var(--tile-filter); opacity: var(--tile-opacity); }
  #leaders { position: absolute; inset: 0; z-index: 450; pointer-events: none; color: var(--ink); }

  /* ---------- Pole cards ---------- */
  .card {
    position: absolute; z-index: 500; width: var(--card-w, 547.2px);
    background: var(--card); border: 1px solid var(--rule); border-radius: 1.3rem;
    padding: 1.1rem 1.3rem 0.6rem; box-shadow: var(--card-shadow);
    display: flex; flex-direction: column;
  }
  .card.tl { left: 30.7px; top: 23.8px; }  .card.bl { left: 30.7px; bottom: 23.8px; }
  .card.tr { right: 30.7px; top: 23.8px; } .card.br { right: 30.7px; bottom: 23.8px; }
  .c-head { display: flex; align-items: center; gap: 0.8rem; }
  .pole-dot {
    width: 2.8rem; height: 2.8rem; border-radius: 50%; flex: none; display: grid; place-items: center;
    font-weight: 900; font-size: 1.5rem; color: var(--bg); background: var(--ink);
  }
  .c-name { font-size: 2.1rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1; white-space: nowrap; }
  .c-walk { margin-left: auto; text-align: right; color: var(--walk-text); font-weight: 800; font-size: 1.5rem; line-height: 1; white-space: nowrap; }
  .c-walk small { display: block; color: var(--muted); font-weight: 600; font-size: 1rem; margin-top: 0.25rem; }
  .c-dir {
    margin: 0.8rem 0 0.2rem; font-size: 1.15rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.08em; display: flex; gap: 0.5rem; align-items: center;
  }
  .c-dir .arrow { color: var(--ink); font-size: 1.4rem; }
  .dep {
    display: grid; grid-template-columns: 4.6rem 1fr auto; align-items: center; gap: 0.9rem;
    padding: 0.75rem 0; border-top: 1px solid var(--rule); min-width: 0;
  }
  .badge { height: 3.3rem; border-radius: 0.65rem; display: grid; place-items: center; font-weight: 900; font-size: 2rem; color: #fff; }
  .dest { min-width: 0; }
  .dest .to { font-size: 1.6rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
  .dest .sub { font-size: 1.1rem; color: var(--muted); margin-top: 0.15rem; white-space: nowrap; }
  .late { color: var(--late); font-weight: 700; } .live { color: var(--ok); font-weight: 600; }
  .when { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .when .n { font-size: 3.6rem; font-weight: 900; letter-spacing: -0.03em; line-height: 1; }
  .when .u { font-size: 1.2rem; font-weight: 700; color: var(--muted); margin-left: 0.2rem; }
  .when .now { font-size: 2.5rem; font-weight: 900; color: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
  .when .clocktime { font-size: 2.4rem; font-weight: 800; }
  .when.tight .n, .when.tight .now { color: var(--late); }
  @keyframes pulse { 50% { opacity: 0.45; } }
  .none { color: var(--muted); font-size: 1.4rem; font-weight: 600; padding: 1.4rem 0; border-top: 1px solid var(--rule); }

  /* ---------- Map markers ---------- */
  .m-campus { background: var(--accent); border: 0.3rem solid #fff; border-radius: 0.5rem; box-shadow: 0 0 1.4rem rgba(227,0,43,.8); }
  .m-pole {
    border-radius: 50%; display: grid; place-items: center; font: 900 1.35rem Roboto, sans-serif;
    color: var(--bg); background: var(--ink); border: 0.22rem solid var(--bg); box-shadow: 0 0 0 0.18rem var(--ink);
  }
  .leaflet-tooltip.m-label {
    background: var(--overlay); color: var(--ink); border: 1px solid var(--rule); border-radius: 0.5rem;
    font: 900 1.45rem Roboto, sans-serif; padding: 0.25rem 0.7rem; box-shadow: none; letter-spacing: -0.01em;
  }
  .leaflet-tooltip.m-label.campus { background: var(--accent); border-color: var(--accent); color: #fff; font-size: 1.3rem; }
  .leaflet-tooltip.m-walk {
    background: var(--walk); color: #111; border: none; border-radius: 1rem; box-shadow: none;
    font: 800 1.05rem Roboto, sans-serif; padding: 0.1rem 0.6rem;
  }
  .leaflet-tooltip.m-label::before, .leaflet-tooltip.m-walk::before { display: none; }
  .m-chips { display: flex; gap: 0.25rem; }
  .m-chips b { font: 900 1rem Roboto, sans-serif; color: #fff; border-radius: 0.35rem; padding: 0.1rem 0.4rem; box-shadow: 0 0 0 0.15rem var(--bg); }

  .legend {
    position: absolute; z-index: 500; left: 50%; transform: translateX(-50%); bottom: 23.8px;
    display: flex; gap: 1.6rem; align-items: center; font-size: 1.1rem; color: var(--muted); font-weight: 600;
    background: var(--overlay); border: 1px solid var(--rule); border-radius: 0.7rem; padding: 0.5rem 1rem;
  }
  .legend i { display: inline-block; width: 2.2rem; height: 0; vertical-align: middle; margin-right: 0.5rem; }
  .legend .w { border-top: 0.25rem dotted var(--walk); }
  .legend .b { border-top: 0.45rem solid var(--route); border-radius: 1rem; }

  /* ---------- Phone layout (portrait and landscape) ---------- */
  html.phone { font-size: 11px; height: auto; }
  html.phone body { height: auto; overflow: auto; cursor: auto; }
  html.phone #stage { position: static; width: auto; height: auto; transform: none !important; display: block; overflow: visible; }
  html.phone header { padding: 10px 14px; gap: 12px; }
  html.phone .title { gap: 12px; min-width: 0; }
  html.phone .title h1 { font-size: 2.2rem; white-space: nowrap; }
  html.phone .title .where { font-size: 1.3rem; white-space: nowrap; }
  html.phone .clock { font-size: 2.8rem; white-space: nowrap; }
  html.phone .clock .secs { display: none; }
  html.phone .when .n { font-size: 3.2rem; }
  html.phone footer { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 14px 16px; line-height: 1.4; }
  @media (orientation: portrait) {
    /* logo and clock on the first line, title underneath */
    html.phone header { display: grid; grid-template-columns: 1fr auto; align-items: center; row-gap: 8px; }
    html.phone .title { display: contents; }
    html.phone .hdr-sep { display: none; }
    html.phone .logo { grid-column: 1; grid-row: 1; }
    html.phone .clock { grid-column: 2; grid-row: 1; }
    html.phone .title h1 { grid-column: 1 / -1; grid-row: 2; }
    html.phone .title .where { grid-column: 1 / -1; grid-row: 3; margin-top: -4px; }
  }
  html.phone main { overflow: visible; display: flex; flex-direction: column; gap: 12px; padding: 12px; }
  html.phone #leaders, html.phone .legend { display: none; }
  html.phone #cards { order: 1; display: grid; gap: 12px; }
  html.phone .card { position: static; width: auto; box-shadow: none; }
  html.phone #map { order: 2; position: relative; inset: auto; height: 80vw; min-height: 260px; max-height: 70vh; border: 1px solid var(--rule); border-radius: 1.1rem; overflow: hidden; }
  @media (orientation: landscape) {
    /* cards on the left, map pinned on the right */
    html.phone main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
    html.phone #cards { grid-column: 1; grid-row: 1; }
    html.phone #map { grid-column: 2; grid-row: 1; position: sticky; top: 12px; height: calc(100vh - 24px); height: calc(100dvh - 24px); max-height: none; min-height: 200px; }
  }

  footer { display: flex; align-items: center; justify-content: space-between; padding: 0 38.4px; font-size: 1.05rem; color: var(--muted); border-top: 1px solid var(--rule); }
  footer .dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--ok); margin-right: 0.5rem; vertical-align: middle; }
  footer.stale .dot { background: var(--late); }

  /* ---------- Shared extras ---------- */
  .badge.long { font-size: 1.6rem; }
  .none.unavail { color: var(--late); }
  .stale-note { color: var(--late); font-size: 1rem; font-weight: 700; margin-top: 0.5rem; }
  .tomorrow { color: var(--late); font-weight: 700; }
  .c-name.long { font-size: 1.9rem; }

  /* ---------- Board layout: small map on the left, two stop panels on the right ---------- */
  .layout-board main { display: grid; grid-template-columns: 576px 1fr; gap: 26.9px; padding: 17.3px 38.4px; }
  .layout-board .map-wrap { position: relative; border-radius: 1.3rem; overflow: hidden; background: var(--map-bg); border: 1px solid var(--rule); }
  .layout-board .map-caption { position: absolute; left: 1rem; bottom: 1rem; z-index: 500; font-size: 1rem; color: var(--muted); background: var(--overlay); padding: 0.4rem 0.7rem; border-radius: 0.5rem; }
  .layout-board .stops { display: grid; grid-template-rows: 1fr 1fr; gap: 17.3px; min-height: 0; }
  .layout-board .stop { background: var(--panel, var(--card)); border: 1px solid var(--rule); border-radius: 1.3rem; padding: 15.1px 30.7px 17.3px; display: grid; grid-template-rows: auto 1fr; min-height: 0; }
  .layout-board .stop-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 13px; }
  .layout-board .pin { width: 3rem; height: 3rem; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 900; font-size: 1.7rem; flex: none; }
  .layout-board .stop-name { font-size: 2.6rem; font-weight: 900; letter-spacing: -0.02em; }
  .layout-board .stop-head .stale-note { margin: 0 0 0 0.6rem; font-size: 1.1rem; }
  .layout-board .walk { margin-left: auto; font-size: 1.35rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
  .layout-board .walk svg { width: 1.4rem; height: 1.4rem; fill: var(--muted); }
  .layout-board .dirs { display: grid; grid-template-columns: 1fr 1fr; gap: 23px; min-height: 0; }
  .layout-board .dir { background: var(--card-2); border-radius: 0.9rem; padding: 10.8px 21.1px; display: flex; flex-direction: column; min-height: 0; }
  .layout-board .dir-head { font-size: 1.2rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; padding-bottom: 8.6px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; overflow: hidden; }
  .layout-board .dir-head .arrow { color: var(--ink); font-size: 1.4rem; }
  .layout-board .dir-head .pole { margin-left: auto; font-size: 1rem; background: var(--rule); color: var(--ink); padding: 0.1rem 0.6rem; border-radius: 0.4rem; letter-spacing: 0.04em; }
  .layout-board .deps { flex: 1; display: grid; grid-template-rows: 1fr 1fr; }
  .layout-board .dep { grid-template-columns: 4.8rem 1fr auto; padding: 0; border-top: 0; border-bottom: 1px solid var(--rule); }
  .layout-board .dep:last-child { border-bottom: none; }
  .layout-board .badge { height: 3.6rem; min-width: 4.8rem; border-radius: 0.7rem; font-size: 2.2rem; letter-spacing: -0.02em; }
  .layout-board .badge.long { font-size: 1.7rem; }
  .layout-board .dest .to { font-size: 1.75rem; }
  .layout-board .dest .sub { font-size: 1.2rem; margin-top: 0.2rem; }
  .layout-board .when .n { font-size: 4.2rem; }
  .layout-board .when .u { font-size: 1.3rem; margin-left: 0.25rem; }
  .layout-board .when .now, .layout-board .when .clocktime { font-size: 2.8rem; }
  .layout-board .none { display: grid; place-items: center; font-size: 1.5rem; grid-row: 1 / span 2; border-top: 0; padding: 0; }
  .m-pin { background: var(--ink); color: var(--bg); border-radius: 50%; border: 0.25rem solid var(--bg); display: grid; place-items: center; font: 900 1.5rem Roboto, sans-serif; box-shadow: 0 0 0 0.2rem var(--ink); }
  .layout-board .leaflet-tooltip.m-label { font: 800 1.25rem Roboto, sans-serif; padding: 0.3rem 0.7rem; }

  html.phone .layout-board .stops { order: 1; grid-template-rows: none; gap: 12px; }
  html.phone .layout-board .stop { display: block; padding: 12px 14px 6px; }
  html.phone .layout-board .stop-head { margin-bottom: 8px; flex-wrap: wrap; row-gap: 2px; }
  html.phone .layout-board .stop-name { font-size: 2.2rem; }
  html.phone .layout-board .dirs { grid-template-columns: 1fr; gap: 10px; margin-bottom: 8px; }
  html.phone .layout-board .dir { padding: 8px 12px 2px; }
  html.phone .layout-board .deps { display: block; }
  html.phone .layout-board .dep { padding: 0.65rem 0; }
  html.phone .layout-board .none { padding: 1.2rem 0; }
  html.phone .layout-board .when .n { font-size: 3.2rem; }
  html.phone .layout-board .map-wrap { order: 2; height: 80vw; min-height: 260px; max-height: 70vh; }
  html.phone .layout-board #map { position: absolute; inset: 0; height: auto; min-height: 0; max-height: none; border: 0; border-radius: 0; }
  @media (orientation: landscape) {
    html.phone .layout-board main { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
    html.phone .layout-board .stops { grid-column: 1; grid-row: 1; }
    html.phone .layout-board .map-wrap { grid-column: 2; grid-row: 1; position: sticky; top: 12px; height: calc(100vh - 24px); height: calc(100dvh - 24px); max-height: none; min-height: 200px; }
  }

  /* ---------- Journey layout (Cornavin): one stop, a longer list, and where to get off ---------- */
  .layout-journey .dep { padding: 0.6rem 0; }
  .layout-journey .when .st { display: block; font-size: 1rem; font-weight: 600; color: var(--muted); margin-top: 0.2rem; }
  .layout-journey .when .st.late { color: var(--late); font-weight: 700; } .layout-journey .when .st.live { color: var(--ok); }
  .layout-journey .dest .sub { overflow: hidden; text-overflow: ellipsis; font-size: 1.2rem; }
  .layout-journey .dest .sub b { color: var(--ink); font-weight: 700; }
  .layout-journey .card.info { width: 520px; padding: 1.1rem 1.3rem 1rem; }
  .info h2 { margin: 0 0 0.2rem; font-size: 1.15rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
  .off { display: grid; grid-template-columns: auto 1fr; gap: 0.9rem; align-items: center; padding: 0.7rem 0; border-top: 1px solid var(--rule); }
  .off:first-of-type { border-top: 0; }
  .off .m-chips b { font-size: 1.3rem; padding: 0.2rem 0.55rem; box-shadow: none; }
  .off .name { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
  .off .walk { font-size: 1.1rem; color: var(--walk-text); font-weight: 700; margin-top: 0.15rem; }
  .info .ride { border-top: 1px solid var(--rule); padding-top: 0.7rem; font-size: 1.1rem; color: var(--muted); font-weight: 600; }
  html.phone .layout-journey .card.info { width: auto; }
  html.phone .layout-journey #info { order: 3; }
  html.phone .layout-journey #map { height: 62vw; min-height: 230px; max-height: 60vh; }
  html.phone .layout-journey .dest .sub { white-space: normal; }
  @media (orientation: landscape) {
    html.phone .layout-journey #info { grid-column: 1; grid-row: 2; }
    html.phone .layout-journey #map { grid-row: 1 / span 2; height: calc(100vh - 24px); height: calc(100dvh - 24px); max-height: none; }
  }
