/* route96 — everything is night, everything is wet, nothing is interactive. */

:root {
  --ink: #05070c;
  --glass: #0a1018;
  --hud: #cfd8e3;
  --hud-dim: #5a6674;
  --signal: #f59bbb; /* the actual PTV route 70 colour */
  --seal: #04060a;
  --pad: clamp(14px, 2.4vw, 28px);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--hud);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  cursor: default;
}

/* ---- the view -------------------------------------------------------------- */

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #05070e;
}

/* Sodium light bleeding through wet glass, over the top of the scene. */
#bloom {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 28% at 18% 38%, rgba(255, 176, 92, 0.07), transparent 70%),
    radial-gradient(30% 22% at 78% 45%, rgba(150, 190, 255, 0.05), transparent 70%);
  mix-blend-mode: screen;
}

/* ---- glass ----------------------------------------------------------------- */

#reflection, #rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#reflection { mix-blend-mode: screen; opacity: 0.55; }
#rain { opacity: 0.85; }

#frame { position: fixed; inset: 0; pointer-events: none; }

/* Rubber window seal. Thick enough to read as a tram, thin enough to stay out
   of the way. */
.seal { position: absolute; background: var(--seal); }
.seal-t, .seal-b { left: 0; right: 0; height: clamp(18px, 4.5vh, 52px); }
.seal-l, .seal-r { top: 0; bottom: 0; width: clamp(14px, 3.5vw, 46px); }
.seal-t { top: 0; box-shadow: 0 3px 14px rgba(0,0,0,.9); }
.seal-b { bottom: 0; box-shadow: 0 -3px 14px rgba(0,0,0,.9); }
.seal-l { left: 0; box-shadow: 3px 0 14px rgba(0,0,0,.9); }
.seal-r { right: 0; box-shadow: -3px 0 14px rgba(0,0,0,.9); }

#vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(75% 65% at 50% 50%, transparent 40%, rgba(0,0,0,.72) 100%);
}

#grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: drift 700ms steps(3) infinite;
}
@keyframes drift {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-3%, 2%); }
  66%  { transform: translate(2%, -3%); }
  100% { transform: translate(0, 0); }
}

/* ---- hud ------------------------------------------------------------------- */

#hud, #status {
  position: fixed;
  z-index: 5;
  font-size: clamp(10px, 1.05vw, 13px);
  letter-spacing: 0.09em;
  text-transform: lowercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.6s ease 0.6s;
}
body.riding #hud, body.riding #status { opacity: 1; }

#hud {
  top: calc(var(--pad) + clamp(18px, 4.5vh, 52px));
  left: calc(var(--pad) + clamp(14px, 3.5vw, 46px));
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hud-row { display: flex; align-items: center; gap: 10px; }
.route-badge {
  background: var(--signal);
  color: #000;
  font-weight: 600;
  padding: 1px 7px;
  letter-spacing: 0.02em;
}
.dim { color: var(--hud-dim); }
.tiny { font-size: 9px; letter-spacing: 0.06em; }
.sep { opacity: 0.4; }

#status {
  bottom: calc(var(--pad) + clamp(18px, 4.5vh, 52px));
  left: calc(var(--pad) + clamp(14px, 3.5vw, 46px));
  right: calc(var(--pad) + clamp(14px, 3.5vw, 46px));
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.label { color: var(--hud-dim); margin-right: 9px; }
#next-stop {
  color: var(--hud);
  font-weight: 400;
  /* Stop names arrive from OSM as "Stop 31: Church Street"; keep them honest. */
  transition: opacity 0.5s;
}
#stop-line { font-size: clamp(12px, 1.5vw, 17px); }
#attrib { opacity: 0.45; margin-top: 4px; }

#progress {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  height: 2px;
  z-index: 6;
  background: rgba(255,255,255,.06);
  opacity: 0;
  transition: opacity 1.6s ease 0.6s;
}
body.riding #progress { opacity: 1; }
#progress-bar {
  height: 100%;
  width: 0;
  background: var(--signal);
  opacity: 0.55;
  transition: width 1.2s linear;
}

/* ---- boarding gate --------------------------------------------------------- */

#gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: #05070c;
  text-align: center;
  transition: opacity 1.4s ease, visibility 1.4s;
}
body.riding #gate { opacity: 0; visibility: hidden; }

.gate-inner { padding: 24px; max-width: 560px; }
.gate-route {
  color: var(--hud-dim);
  font-size: 11px;
  letter-spacing: 0.16em;
  margin-bottom: 22px;
}
#gate h1 {
  font-size: clamp(26px, 5.5vw, 54px);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.gate-sub { color: var(--hud-dim); margin-top: 14px; font-size: 12px; letter-spacing: 0.08em; }

#board {
  margin-top: 38px;
  background: none;
  border: 1px solid #2b3644;
  color: var(--hud);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  padding: 13px 46px;
  cursor: pointer;
  transition: background 0.35s, border-color 0.35s, color 0.35s;
}
#board:hover { background: var(--signal); border-color: var(--signal); color: #000; }
#board:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; }

.gate-fine { margin-top: 18px; color: #3a4453; font-size: 10px; letter-spacing: 0.1em; }

@media (prefers-reduced-motion: reduce) {
  #grain { animation: none; }
}
