/* rondell.nu. The palette is borrowed from Swedish road signs: the blue of
   mandatory signs, the yellow of warning signs, red for stop. */

/* Overpass, a typeface drawn after highway signage. Served from here (one
   variable file) so that a visit does not call on anyone else's servers. */
@font-face {
  font-family: Overpass;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../fonts/overpass-latin.woff2) format("woff2");
}

:root {
  --paper: #f2f4f5;
  --surface: #ffffff;
  --ink: #1b2126;
  --ink-soft: #4d5861;
  --ink-faint: #7a858e;
  --line: #d8dde1;
  --sign: #0a5aa8;
  --sign-deep: #07457f;
  --sign-tint: #e3eef8;
  --ego: #2f9bff;
  --caution: #f6c800;
  --caution-tint: #fff6c9;
  --danger: #d6252b;
  --go: #2e9d5b;
  --ground: #e4e9df;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 40, 0.08), 0 6px 20px rgba(20, 30, 40, 0.10);
  --font: Overpass, "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--sign); text-underline-offset: 2px; }
h1, h2, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--ego); outline-offset: 2px; }

.view { position: fixed; inset: 0; }

/* ---- Map picker ----------------------------------------------------------- */

.picker #map { position: absolute; inset: 0; background: var(--ground); }
.picker-card {
  position: absolute; top: 16px; left: 16px; z-index: 500;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  padding: 22px 22px 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* The name: the roundabout sign and the address, nothing more. */
.brand { display: inline-flex; align-items: center; gap: 9px; margin: 0; color: var(--sign); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-name { font-size: 29px; font-weight: 800; letter-spacing: -0.025em; line-height: 1; padding-top: 0.12em; }
.brand-name span { color: var(--ink-faint); font-weight: 700; }
.brand.small { gap: 6px; }
.brand.small .brand-mark { width: 20px; height: 20px; }
.brand.small .brand-name { font-size: 17px; }
a.brand:hover .brand-name span { color: var(--sign); }

.language {
  flex: none; height: 30px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 15px;
  background: none; font-size: 13px; font-weight: 700; color: var(--ink-soft);
}
.language:hover { border-color: var(--sign); color: var(--sign-deep); background: var(--sign-tint); }
.tagline { margin-top: 12px; color: var(--ink-soft); }
.picker-card h2 { font-size: 14px; font-weight: 700; margin: 20px 0 8px; }
#search { margin-top: 18px; }
#search label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.search-row { display: flex; gap: 8px; }
.search-row input {
  flex: 1; min-width: 0; height: 42px; padding: 0 12px;
  border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface);
}
.search-row input:focus { border-color: var(--sign); outline: none; }
.search-row button {
  height: 42px; padding: 0 16px; border: 0; border-radius: 8px;
  background: var(--sign); color: #fff; font-weight: 700;
}
.search-row button:hover { background: var(--sign-deep); }
.search-results { margin-top: 6px; }
.search-results button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none;
  border-radius: 6px; font-size: 14px;
}
.search-results button:hover { background: var(--sign-tint); }
.hint {
  margin-top: 14px; padding: 10px 12px; border-radius: 8px;
  background: var(--sign-tint); color: var(--sign-deep); font-size: 14px; font-weight: 600;
}
.hint:empty { display: none; }
.hint.problem { background: var(--caution-tint); color: #5c4a00; }
.examples li + li { margin-top: 6px; }
.examples button {
  display: block; width: 100%; text-align: left; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface);
}
.examples button:hover { border-color: var(--sign); background: var(--sign-tint); }
.examples strong { display: block; font-weight: 700; }
.examples span { color: var(--ink-soft); font-size: 14px; }
.leaflet-container { font-family: var(--font); }
.roundabout-marker { cursor: pointer; }

/* ---- Trainer ---------------------------------------------------------------- */

.trainer { display: grid; grid-template-columns: minmax(0, 1fr) 400px; }
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.viewport { position: relative; flex: 1; min-height: 0; background: var(--ground); overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#scene.dragging { cursor: grabbing; }
#scene.pointing { cursor: pointer; }

.stage-top {
  position: absolute; top: 14px; left: 14px; right: 150px;
  display: flex; align-items: center; gap: 10px; pointer-events: none;
}
.stage-top > * { pointer-events: auto; }
.chip-button {
  display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 0 14px 0 8px;
  border: 0; border-radius: 19px; background: var(--surface); box-shadow: var(--shadow); font-weight: 700;
}
.chip-button svg { width: 16px; height: 16px; }
.chip-button:hover { background: var(--sign-tint); color: var(--sign-deep); }
.place {
  display: flex; flex-direction: column; justify-content: center; min-height: 38px; padding: 4px 14px;
  background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); line-height: 1.2; min-width: 0;
}
.place strong { font-weight: 800; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place span { font-size: 13px; color: var(--ink-soft); }
.place span:empty { display: none; }

.hud {
  position: absolute; top: 14px; right: 14px; height: 38px; padding: 0 12px;
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; border-radius: 19px; box-shadow: var(--shadow);
}
.hud .speed { font-size: 13px; min-width: 68px; text-align: center; }
.hud .speed b { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lamp {
  width: 0; height: 0; border-top: 7px solid transparent; border-bottom: 7px solid transparent;
  opacity: 0.3;
}
.lamp.left { border-right: 11px solid #9aa3ab; }
.lamp.right { border-left: 11px solid #9aa3ab; }
.lamp.on { opacity: 1; }
.lamp.left.on { border-right-color: #ffa51f; }
.lamp.right.on { border-left-color: #ffa51f; }

/* The caption under the picture: what to do right now, and the playback controls. */
.caption {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 24px; align-items: start;
  min-height: 132px; padding: 14px 18px 16px;
  background: var(--surface); border-top: 1px solid var(--line);
}
.coach-step { font-size: 13px; font-weight: 700; color: var(--sign); }
.coach-step:empty { display: none; }
.coach-lead { font-size: 21px; font-weight: 800; line-height: 1.22; letter-spacing: -0.01em; margin-top: 1px; text-wrap: balance; }
.coach-remark {
  display: inline-block; margin-top: 8px; padding: 6px 10px; border-radius: 6px;
  background: var(--caution-tint); color: #4a3c00; font-weight: 600;
}
.transport { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.transport-row { display: flex; align-items: center; gap: 8px; }
.transport-row > button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; min-width: 42px; padding: 0 10px; border: 0; border-radius: 8px;
  background: var(--paper); font-weight: 700;
}
.transport-row > button:hover { background: var(--sign-tint); color: var(--sign-deep); }
.transport svg { width: 20px; height: 20px; }
.transport-row .primary { background: var(--sign); color: #fff; padding: 0 16px 0 12px; min-width: 122px; }
.transport-row .primary:hover { background: var(--sign-deep); color: #fff; }
.transport .icon-pause { display: none; }
.transport.playing .icon-pause { display: block; }
.transport.playing .icon-play { display: none; }
.speeds { display: inline-flex; background: var(--paper); border-radius: 8px; padding: 3px; }
.speeds button { height: 36px; min-width: 40px; border: 0; border-radius: 6px; background: none; font-weight: 700; color: var(--ink-soft); }
.speeds button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 30, 40, 0.18); }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.check input { width: 17px; height: 17px; accent-color: var(--sign); margin: 0; }

.stage-message {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  max-width: min(440px, calc(100% - 40px)); padding: 18px 22px;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); text-align: center; font-weight: 600;
}
.stage-message button {
  margin-top: 12px; height: 40px; padding: 0 16px; border: 0; border-radius: 8px;
  background: var(--sign); color: #fff; font-weight: 700;
}

/* ---- Side panel -------------------------------------------------------------- */

.panel {
  background: var(--paper); border-left: 1px solid var(--line);
  overflow-y: auto; padding: 18px 18px 24px;
}
.panel-block + .panel-block { margin-top: 24px; }
.panel h2 { font-size: 14px; font-weight: 800; margin-bottom: 9px; }

.roads { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); }
.road { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 9px; }
.road + .road { border-top: 1px solid var(--line); }
.road.hover { background: #f7f9fb; }
.road .letter {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 6px; background: var(--surface); color: var(--sign); font-weight: 800;
  box-shadow: inset 0 0 0 1.5px rgba(10, 90, 168, 0.55);
}
/* Where you come from is yellow, like your car; where you are going is sign blue. */
.road.is-from .letter { background: var(--caution); color: var(--ink); box-shadow: inset 0 0 0 1.5px rgba(27, 33, 38, 0.55); }
.road.is-to .letter { background: var(--sign); color: #fff; box-shadow: none; }
.road.is-from.is-to .letter { background: linear-gradient(135deg, var(--caution) 50%, var(--sign) 50%); color: var(--ink); }
.road .text { flex: 1; min-width: 0; line-height: 1.25; }
/* (The extra line height keeps the dots of Ö and Ä from being clipped.) */
.road .name { display: block; font-weight: 700; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.road .towards { display: block; font-size: 13px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.road .ends { display: inline-flex; flex: none; background: var(--paper); border-radius: 8px; padding: 3px; }
.road .ends button {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 9px 0 7px; border: 0; border-radius: 6px; background: none;
  font-size: 14px; font-weight: 700; color: var(--ink-soft);
}
.road .ends svg { width: 20px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.road .ends button:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--surface); color: var(--ink); }
.road .ends .end-from[aria-pressed="true"] { background: var(--caution); color: var(--ink); }
.road .ends .end-to[aria-pressed="true"] { background: var(--sign); color: #fff; }
.road .ends button:disabled { opacity: 0.35; cursor: default; }
.trip-summary { margin-top: 12px; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.trip-summary.prompt { font-size: 15px; font-weight: 600; letter-spacing: 0; color: var(--ink-soft); }

.lane-choice { margin-top: 10px; }
.lane-option {
  display: grid; grid-template-columns: auto 1fr; gap: 1px 12px; align-items: center; width: 100%;
  padding: 10px 12px; text-align: left; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.lane-option + .lane-option { margin-top: 6px; }
.lane-option:hover { border-color: var(--sign); }
.lane-option[aria-checked="true"] { border-color: var(--sign); box-shadow: inset 0 0 0 1px var(--sign); }
.lane-option .lanes { grid-row: span 2; display: flex; gap: 3px; align-self: start; margin-top: 3px; }
.lane-option .lane-box { width: 17px; height: 36px; border-radius: 3px; background: #c3c9ce; position: relative; }
.lane-option .lane-box.use { background: var(--sign); }
.lane-option .lane-box.use::after {
  content: ""; position: absolute; left: 50%; top: 9px; width: 7px; height: 7px;
  border-left: 2.5px solid #fff; border-top: 2.5px solid #fff; transform: translateX(-50%) rotate(45deg);
}
.lane-option .name { font-weight: 700; }
.lane-option .tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 9px; margin-left: 7px; background: var(--sign-tint); color: var(--sign-deep); }
.lane-option .tag.allowed { background: #eceff1; color: var(--ink-soft); }
.lane-option .why { font-size: 14px; color: var(--ink-soft); }
.lane-single { font-size: 14px; color: var(--ink-soft); }

.scenario-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.scenario {
  min-height: 40px; padding: 6px 11px; text-align: left; line-height: 1.2;
  border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 14px; font-weight: 700;
}
.scenario:hover { border-color: var(--sign); }
.scenario[aria-checked="true"] { border-color: var(--sign); background: var(--sign); color: #fff; }
.scenario-blurb { margin-top: 9px; font-size: 14px; color: var(--ink-soft); }

.steps { counter-reset: step; }
.step {
  counter-increment: step; position: relative; padding: 9px 12px 9px 46px;
  border-radius: 8px; border: 1.5px solid transparent;
}
.step + .step { margin-top: 4px; }
.step::before {
  content: counter(step); position: absolute; left: 10px; top: 9px;
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 5px; font-weight: 800; font-size: 14px;
  color: var(--sign); background: var(--sign-tint); box-shadow: inset 0 0 0 1.5px rgba(10, 90, 168, 0.4);
}
.step-head { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; }
.step-title { display: block; font-weight: 800; }
.step-lead { display: block; font-size: 14px; color: var(--ink-soft); }
.step.past { opacity: 0.55; }
.step.active { background: var(--surface); border-color: var(--sign); }
.step.active::before { background: var(--sign); color: #fff; box-shadow: none; }
.step.active .step-lead { color: var(--ink); font-weight: 600; }
.step-points { display: none; margin-top: 8px; }
.step.active .step-points, .step.open .step-points { display: block; }
.step-points li { position: relative; padding-left: 14px; font-size: 14px; }
.step-points li + li { margin-top: 7px; }
.step-points li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-faint); }
.rule-link {
  display: inline; padding: 0; border: 0; background: none; font-size: 13px; font-weight: 700;
  color: var(--sign); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap;
}
.rule {
  margin-top: 6px; padding: 9px 11px; border-radius: 6px; background: var(--sign-tint); font-size: 13.5px;
}
.rule q { display: block; font-style: italic; quotes: "”" "”"; }
.rule .cite { display: block; margin-top: 5px; font-weight: 700; }

.panel-foot { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-soft); }
.panel-foot p + p { margin-top: 8px; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
#model-notes:empty { display: none; }
#model-notes { color: #5c4a00; background: var(--caution-tint); padding: 8px 10px; border-radius: 6px; }

/* ---- Small screens ----------------------------------------------------------- */

@media (max-width: 900px) {
  /* On a phone the map is the whole point: keep only the name, the search and the hint above it. */
  .picker-card { top: 10px; left: 10px; width: calc(100vw - 20px); padding: 13px 14px 14px; }
  .picker-card .tagline, .picker-card h2, .picker-card .examples { display: none; }
  .picker-card .brand-mark { width: 28px; height: 28px; }
  .picker-card .brand-name { font-size: 24px; }
  #search { margin-top: 12px; }
  #search label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .hint { margin-top: 10px; padding: 8px 11px; }

  .trainer.view { position: static; display: block; }
  .stage { height: 78vh; min-height: 460px; }
  .panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .caption { grid-template-columns: 1fr; min-height: 0; padding: 12px 14px 14px; }
  .coach { min-height: 76px; }
  .coach-lead { font-size: 18px; }
  .transport { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .stage-top { right: 14px; }
  .hud { top: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
