/* PONTILE E-INK — printed port-authority bulletin.
   Pure #000 on #fff. No transitions, no animation, no gray gradients.
   Sturdy slab serif (renders crisp on binary e-ink panels) + tabular mono. */

:root {
  --ink: #000;
  --paper: #fff;
  --rule: 3px solid #000;
  --rule-thin: 1.5px solid #000;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Zilla Slab", Georgia, serif;
  font-size: 19px;
  line-height: 1.4;
  /* kill mobile tap-highlight ghosting on e-ink */
  -webkit-tap-highlight-color: transparent;
}

/* No motion anywhere — e-ink refresh ghosts. Hard override. */
*, *::before, *::after {
  transition: none !important;
  animation: none !important;
}

.sheet {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 18px 60px;
}

/* ---------- masthead ---------- */

.masthead {
  background: var(--ink);
  color: var(--paper);
  margin: 0 -18px 0;
  padding: 14px 18px 18px;
}

.mast-top {
  display: flex;
  justify-content: space-between;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  border-bottom: 1.5px solid var(--paper);
  padding-bottom: 8px;
}

.mast-title {
  font-size: clamp(3.2rem, 14vw, 5.5rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 0.95;
  text-align: center;
  margin: 10px 0 4px;
}

.mast-sub {
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
}

/* ---------- status bar ---------- */

.statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  border-bottom: var(--rule);
}

.stat-clock, .stat-acqua {
  padding: 12px 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  font-weight: 500;
  border-right: var(--rule-thin);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-clock strong { font-size: 1.3rem; font-weight: 700; }

.stat-acqua { flex: 1; }
.stat-acqua.high { background: var(--ink); color: var(--paper); }

.btn-refresh {
  appearance: none;
  border: none;
  border-left: var(--rule-thin);
  background: var(--paper);
  color: var(--ink);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 12px 16px;
  cursor: pointer;
}

.btn-refresh:active { background: var(--ink); color: var(--paper); }

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  border-bottom: var(--rule);
}

.tabs a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 14px 6px;
  border-right: var(--rule-thin);
}

.tabs a:last-child { border-right: none; }
.tabs a.active { background: var(--ink); color: var(--paper); }

/* ---------- controls ---------- */

.view { padding-top: 18px; }

.row-controls { display: flex; flex-direction: column; gap: 12px; }

.ctl { display: flex; flex-direction: column; gap: 5px; }

.ctl-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}

select {
  appearance: none;
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  border: var(--rule);
  border-radius: 0;
  font-family: "Zilla Slab", serif;
  font-size: 1.15rem;
  font-weight: 600;
  padding: 13px 40px 13px 14px;
  background-image:
    linear-gradient(45deg, transparent 50%, #000 50%),
    linear-gradient(135deg, #000 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% + 2px), calc(100% - 14px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.ctl-actions { display: flex; gap: 10px; margin-top: 12px; }

.btn-line {
  appearance: none;
  flex: 1;
  background: var(--paper);
  color: var(--ink);
  border: var(--rule);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 12px;
  cursor: pointer;
}

.btn-line:active { background: var(--ink); color: var(--paper); }

/* ---------- departures board ---------- */

#board { margin-top: 20px; }

.sec-head {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding-bottom: 6px;
  border-bottom: var(--rule);
  margin-bottom: 0;
}

.dep {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 2px;
  border-bottom: var(--rule-thin);
}


/* line number: solid black square, white bold digits (e-ink safe) */
.sq {
  width: 56px;
  height: 56px;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 1.3rem;
  border: 2px solid var(--ink);
}

.dep-dest { font-size: 1.2rem; font-weight: 600; line-height: 1.2; }
.dep-via {
  display: inline-block;
  margin-left: 4px;
  font-family: "JetBrains Mono", monospace;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 3px;
}
.dep-via::before { content: "· "; opacity: 0.55; }
.dep-dir {
  display: inline-block;
  border: 1.5px solid #000;
  padding: 0 5px;
  margin-left: 4px;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 1rem;
  vertical-align: 2px;
}
.dep-dir-unknown { border-style: dashed; font-style: italic; }
.dep-sub {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  font-weight: 500;
  margin-top: 3px;
}
.dep-plats {
  margin-top: 4px;
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
}
.dep-plats .plat {
  display: inline-block;
  min-width: 1.1rem;
  padding: 0 5px;
  text-align: center;
  border: 1.5px solid #000;
}
.dep-plats .plat-active {
  background: #000;
  color: #fff;
}

.dep-eta { text-align: right; white-space: nowrap; }
.eta-big {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
}
.eta-min { font-size: 0.85rem; font-weight: 500; }
.eta-clock {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 3px;
}

.night-flag {
  display: inline-block;
  border: 2px solid currentColor;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 1px 5px;
  margin-left: 8px;
  vertical-align: 2px;
}

.empty {
  padding: 40px 10px;
  text-align: center;
  font-size: 1.15rem;
  font-style: italic;
  border: var(--rule-thin);
  border-style: dashed;
}

/* ---------- routes ---------- */

#routes { margin-top: 20px; }

.route {
  border: var(--rule);
  padding: 14px;
  margin-bottom: 14px;
}

.route-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.route-head .sq { width: 46px; height: 46px; font-size: 1.1rem; }
.route-head strong { font-size: 1.15rem; font-weight: 700; display: block; }
.route-head .route-sub { font-family: "JetBrains Mono", monospace; font-size: 0.74rem; }

.route-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 500;
  border: var(--rule-thin);
  padding: 7px 10px;
}
.slot b { font-weight: 700; }

/* ---------- line index ---------- */

#line-index { border-top: var(--rule); }

.line-item {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 2px;
  border-bottom: var(--rule-thin);
  text-decoration: none;
  color: var(--ink);
}

.line-item strong { font-size: 1.15rem; font-weight: 700; }
.line-item p { font-family: "JetBrains Mono", monospace; font-size: 0.72rem; font-weight: 500; }
.line-item .chev { font-size: 1.4rem; font-weight: 700; }

/* ---------- line detail ---------- */

.back-link {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-decoration: none;
  color: var(--ink);
  border: var(--rule-thin);
  padding: 8px 12px;
  margin-bottom: 18px;
}

.ld-head { display: flex; align-items: center; gap: 14px; border-bottom: var(--rule); padding-bottom: 12px; }
.ld-head h2 { font-size: 1.5rem; font-weight: 700; flex: 1; line-height: 1.15; }
.ld-head .btn-line { flex: 0 0 auto; width: auto; }

.ld-stats {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 12px 0;
  border-bottom: var(--rule-thin);
  margin-bottom: 18px;
}

/* SVG schematic map — pure black vector, no tiles (offline + e-ink safe) */
.schematic {
  width: 100%;
  border: var(--rule);
  margin-bottom: 22px;
  display: block;
  background: var(--paper);
}
.schematic .track { fill: none; stroke: #000; stroke-width: 2.4; }
.schematic .stopdot { fill: #fff; stroke: #000; stroke-width: 2.2; }
.schematic .term { fill: #000; }

.trasa { border: var(--rule-thin); padding: 14px; margin-bottom: 12px; }
.trasa-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; border-bottom: var(--rule-thin); padding-bottom: 8px; margin-bottom: 12px; }
.trasa-dest { font-size: 1.15rem; font-weight: 700; }
.trasa-meta { font-family: "JetBrains Mono", monospace; font-size: 0.7rem; }

/* vertical stop diagram */
.diagram { padding-left: 22px; position: relative; }
.diagram::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 3px; background: #000; }
.stop-row { position: relative; display: flex; gap: 12px; align-items: baseline; padding: 7px 0; }
.stop-row::before {
  content: ""; position: absolute; left: -19px; top: 50%; transform: translateY(-50%);
  width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 3px solid #000;
}
.stop-row:first-child::before, .stop-row:last-child::before { background: #000; }
.stop-row .dt { font-family: "JetBrains Mono", monospace; font-size: 0.72rem; min-width: 48px; font-weight: 500; }
.stop-row .nm { font-size: 1.02rem; }
.stop-row:first-child .nm, .stop-row:last-child .nm { font-weight: 700; }

details.rare { border: var(--rule-thin); border-style: dashed; padding: 2px 14px; margin-top: 8px; }
details.rare summary { cursor: pointer; padding: 12px 0; font-family: "JetBrains Mono", monospace; font-size: 0.78rem; font-weight: 700; }

/* ---------- favorites ---------- */

.favs-block { margin-top: 18px; }
.favs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.fav-chip {
  display: inline-flex;
  align-items: stretch;
  border: var(--rule);
  background: var(--paper);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.fav-chip .fav-body,
.fav-chip .fav-x {
  appearance: none;
  background: var(--paper);
  color: var(--ink);
  border: 0;
  font: inherit;
  cursor: pointer;
  padding: 8px 10px;
}

.fav-chip .fav-body {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.fav-chip .fav-mark { font-weight: 700; }

.fav-chip .fav-x {
  border-left: var(--rule);
  font-weight: 700;
  padding: 8px 12px;
}

.fav-chip .fav-body:active,
.fav-chip .fav-x:active { background: var(--ink); color: var(--paper); }

.btn-line.saved { background: var(--ink); color: var(--paper); }
.btn-line[disabled] { opacity: 0.4; cursor: default; }

/* ---------- colophon ---------- */

.colophon { margin-top: 40px; }
.rule-double { border-top: var(--rule); border-bottom: var(--rule-thin); height: 5px; margin-bottom: 12px; }
.colo-row { display: flex; justify-content: space-between; font-family: "JetBrains Mono", monospace; font-size: 0.74rem; font-weight: 700; }
.colo-link { color: var(--ink); text-decoration: none; border-bottom: 2px solid #000; }
.colo-fine { font-family: "JetBrains Mono", monospace; font-size: 0.66rem; margin-top: 8px; line-height: 1.5; }

[hidden] { display: none !important; }
