/* ---------------------------------------------------------------------------
 * E-ink view (?eink=1): two layouts share this file.
 * - Landscape (default, no ?stop param): 800x600, Kindle mounted physically
 *   rotated 90°, render pipeline rotates the screenshot back into the
 *   panel's native 600x800 framebuffer. 3 boards side by side.
 * - Paged (?eink=1&stop=N): 600x800 portrait, Kindle mounted normally, one
 *   board full-screen, cycled on-device via physical page-turn buttons.
 *   See the html.eink.paged block near the end of this file.
 * Urgency is encoded by weight/shape/inversion, not hue — a 16-level
 * grayscale non-backlit panel dithers close hues into indistinguishable gray.
 * Every rule here is scoped under html.eink so this file is a no-op
 * otherwise, safe to always link from index.html.
 * ------------------------------------------------------------------------- */

html.eink {
  --bg: #fff;
  --panel: #fff;
  --panel-2: #f2f2f2;
  --text: #000;
  --muted: #333;
  --line: #000;
}

html.eink body {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: none;
}

/* Slim header: drop the emoji title and footer, keep clock/status only. */
html.eink header h1,
html.eink footer {
  display: none;
}
html.eink header {
  justify-content: flex-end;
  padding: 4px 12px;
  border-bottom: 2px solid var(--line);
}
html.eink #clock {
  font-size: 1.2rem;
  font-weight: 700;
}
html.eink .status {
  font-size: 0.9rem;
}

html.eink .banner {
  background: #000;
  color: #fff;
  font-size: 0.85rem;
  padding: 4px 12px;
}

/* Three boards side by side, each filling the full column height. */
html.eink main {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 6px;
  align-items: stretch;
}
html.eink .board {
  display: flex;
  flex-direction: column;
  border: 2px solid var(--line);
  border-radius: 0;
  margin-bottom: 0;
  overflow: hidden;
}
html.eink .board h2 {
  font-size: 1.05rem;
  font-weight: 800;
  padding: 3px 8px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.eink .board .empty,
html.eink .board .more {
  padding: 4px 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

html.eink .row {
  grid-template-columns: 36px 1fr 52px;
  gap: 6px;
  padding: 3px 8px;
  border-bottom: 1px solid var(--line);
}

/* Route badge: flatten mode colors to solid black/white — the route text
   itself already identifies the line, color was decorative only. */
html.eink .route,
html.eink .route.tram,
html.eink .route.metro,
html.eink .route.bus,
html.eink .route.train,
html.eink .route.trolleybus {
  background: #000;
  color: #fff;
  font-size: 0.8rem;
  border-radius: 3px;
  padding: 3px 0;
}

html.eink .dest .head {
  font-size: 0.9rem;
  font-weight: 700;
}
/* Scheduled time + delay dropped in landscape — the live countdown already
   carries the essential info, and vertical space is the scarce resource
   here (row count is the whole point of the landscape layout). */
html.eink .dest .sched {
  display: none;
}

html.eink .when {
  font-size: 0.85rem;
  font-weight: 800;
  text-align: right;
  white-space: normal;
  line-height: 1.05;
}
html.eink .when .label {
  font-size: 0.6rem;
}
html.eink .when .sub {
  font-size: 0.65rem;
}

/* <=2 min: full inversion instead of red text — unmistakable at any dither level. */
html.eink .row.now {
  background: #000;
}
html.eink .row.now .route {
  background: #fff;
  color: #000;
}
html.eink .row.now .dest .head,
html.eink .row.now .dest .sched,
html.eink .row.now .when {
  color: #fff;
}
html.eink .row.now .when .label,
html.eink .row.now .when .sub {
  display: inline;
}

/* 3-5 min: bold + thick left bar instead of orange text. */
html.eink .row.soon {
  border-left: 6px solid var(--line);
  padding-left: 4px;
}
html.eink .row.soon .when {
  color: var(--text);
}

/* Departed: explicit strikethrough + label instead of relying on opacity alone. */
html.eink .row.departed {
  opacity: 1;
}
html.eink .row.departed .dest .head {
  text-decoration: line-through;
  color: var(--muted);
}
html.eink .row.departed .when {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Canceled: strikethrough + bold bordered box instead of red-tinted text. */
html.eink .row.canceled .dest .head {
  text-decoration: line-through;
  color: var(--muted);
}
html.eink .row.canceled .when {
  color: var(--text);
  border: 2px solid var(--line);
  padding: 1px 6px;
  font-size: 0.8rem;
  display: inline-block;
}

/* ---------------------------------------------------------------------------
 * Paged mode (?eink=1&stop=N): one stop full-screen at 600x800 portrait,
 * cycled on-device via the Kindle's physical page-turn buttons rather than
 * shown 3-up. One board owns the whole page, so there's room to bring back
 * the scheduled-time/delay line that landscape dropped for space, and to
 * size everything up for a single-glance read at arm's length.
 * These rules win the cascade via extra specificity (html.eink.paged vs
 * html.eink) — no !important needed — so dropping ?stop=N cleanly reverts
 * to the landscape layout above.
 * ------------------------------------------------------------------------- */

html.eink.paged main {
  display: block;
  padding: 0;
}
html.eink.paged .board {
  border: none;
}
html.eink.paged .board h2 {
  font-size: 1.7rem;
  padding: 8px 18px;
  border-bottom: 3px solid var(--line);
}
html.eink.paged .board .empty,
html.eink.paged .board .more {
  padding: 10px 18px;
  font-size: 1.1rem;
}

html.eink.paged .row {
  grid-template-columns: 72px 1fr 140px;
  gap: 14px;
  padding: 8px 18px;
  border-bottom: 2px solid var(--line);
}

html.eink.paged .route,
html.eink.paged .route.tram,
html.eink.paged .route.metro,
html.eink.paged .route.bus,
html.eink.paged .route.train,
html.eink.paged .route.trolleybus {
  font-size: 1.3rem;
  padding: 6px 0;
  border-radius: 5px;
}

html.eink.paged .dest .head {
  font-size: 1.5rem;
}
/* Room exists again on a full-page board — bring back scheduled time/delay. */
html.eink.paged .dest .sched {
  display: block;
  font-size: 1rem;
}

html.eink.paged .when {
  font-size: 2rem;
}
html.eink.paged .when .label {
  font-size: 1.1rem;
}
html.eink.paged .when .sub {
  font-size: 0.9rem;
}
html.eink.paged .row.now .when .label,
html.eink.paged .row.now .when .sub {
  display: block;
}

html.eink.paged .row.soon {
  border-left: 10px solid var(--line);
  padding-left: 8px;
}

html.eink.paged .row.departed .when,
html.eink.paged .row.canceled .when {
  font-size: 1.1rem;
}
