/* The web route planner at the top of /route-planner (+ /de/, /fr/), round 1108.
 * Loaded by those three pages only, after site.css, whose tokens (--petrol, --rust, --ink, --off,
 * --hair, --r, --control, --font) it uses; every class here is rb- prefixed so nothing in site.css
 * can collide with it (site.css already has a `.sheet`: the mobile menu).
 * The map library's own stylesheet (Mapbox GL or MapLibre) is injected by route-builder.js
 * together with the library, never linked here: neither is needed before the visitor starts. */

section.rb-top { padding-block: 40px 48px; }
.rb-head { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.rb-h1 { font-size: 40px; line-height: 1.12; letter-spacing: -.015em; max-width: 30ch; color: var(--white); }
.rb-tagline { color: var(--off); font-size: var(--fs-body); }

.rb {
  display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px;
  margin-top: 28px; position: relative;
}
.rb-panel {
  background: var(--white); color: var(--ink); border-radius: var(--r); padding: 20px;
  display: flex; flex-direction: column; gap: 16px; min-width: 0;
}
.rb-panel a { color: var(--ink); }
.rb-panel :focus-visible, .rb-sheet :focus-visible { outline-color: var(--rust); }
.rb-mapwrap { position: relative; min-height: 560px; border-radius: var(--r); overflow: hidden; background: #DDE3E3; }
/* Two classes on purpose: the map libraries set `.mapboxgl-map` / `.maplibregl-map` to
 * position: relative, which would collapse an inset-only box to zero height.
 * see docs/kb/map-library-css-collapses-inset-map-container.md */
.rb-mapwrap .rb-map { position: absolute; inset: 0; }
.rb-cover {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center;
  text-align: center; padding: 24px; color: var(--ink); cursor: pointer;
  background:
    repeating-linear-gradient(35deg, rgba(48, 82, 92, .07) 0 2px, transparent 2px 46px),
    repeating-linear-gradient(-55deg, rgba(48, 82, 92, .07) 0 2px, transparent 2px 64px),
    #E6EBEA;
}
.rb-cover p { font-size: var(--fs-sm); max-width: 32ch; }
.rb-cover[hidden] { display: none; }
.rb-cover.rb-busy .btn { opacity: .6; pointer-events: none; }

.rb-search { position: relative; }
.rb-search input {
  width: 100%; min-height: var(--control); padding: 0 14px; border: 1px solid var(--hair-s); border-radius: var(--r);
  font: 400 16px/1.2 var(--font); color: var(--ink); background: var(--white);
}
.rb-sugg {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px 0; list-style: none;
  background: var(--white); border: 1px solid var(--hair-s); border-radius: var(--r); box-shadow: 0 12px 32px rgba(20, 38, 43, .18);
  max-height: 320px; overflow-y: auto;
}
.rb-sugg li { padding: 10px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.rb-sugg li small { color: var(--petrol); font-size: var(--fs-cap); }
.rb-sugg li[aria-selected="true"], .rb-sugg li:hover { background: var(--off); }
.rb-sugg li.rb-sugg-note { cursor: default; color: var(--petrol); font-size: var(--fs-sm); }
.rb-hint { font-size: var(--fs-sm); color: var(--petrol); }

.rb-seg, .rb-opts { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 14px; min-width: 0; }
.rb-seg legend, .rb-opts legend, .rb-stops-h { font-size: var(--fs-cap); font-weight: 700; color: var(--petrol); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; padding: 0; }
.rb-seg label { position: relative; }
.rb-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.rb-seg span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border: 1px solid var(--hair-s); border-radius: var(--r);
  font-weight: 500;
}
.rb-seg input:checked + span { background: var(--petrol); border-color: var(--petrol); color: var(--white); }
.rb-seg input:focus-visible + span { outline: 3px solid var(--rust); outline-offset: 2px; }
.rb-check { display: grid; grid-template-columns: 20px 1fr; gap: 2px 8px; align-items: start; width: 100%; font-size: var(--fs-sm); cursor: pointer; }
.rb-check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--petrol); }
.rb-check small { grid-column: 2; color: var(--petrol); font-size: var(--fs-cap); line-height: 1.4; }

.rb-stops-h { margin: 0; }
.rb-stops { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.rb-stops:empty { display: none; }
.rb-stop { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--hair); }
.rb-stop-n {
  width: 26px; height: 26px; border-radius: 50%; background: var(--petrol); color: var(--white);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.rb-stop-t { display: flex; flex-direction: column; min-width: 0; font-size: var(--fs-sm); line-height: 1.3; }
.rb-stop-t b { font-weight: 700; font-size: var(--fs-cap); color: var(--petrol); }
.rb-stop-t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-stop-a { display: flex; gap: 2px; }
.rb-icon {
  width: 32px; height: 32px; border: 1px solid transparent; border-radius: var(--r); background: transparent; color: var(--ink);
  font: 500 16px/1 var(--font); cursor: pointer;
}
.rb-icon:hover { border-color: var(--hair-s); }
.rb-icon:disabled { opacity: .3; cursor: default; border-color: transparent; }

.rb-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.rb-tool {
  min-height: 36px; padding: 0 12px; border: 1px solid var(--hair-s); border-radius: var(--r); background: var(--white);
  font: 500 14px/1.2 var(--font); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center;
}
.rb-tool:hover { background: var(--off); }
.rb-tool:disabled { opacity: .4; cursor: default; background: var(--white); }
.rb-file { position: relative; overflow: hidden; }
.rb-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.rb-file:focus-within { outline: 3px solid var(--rust); outline-offset: 2px; }

.rb-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.rb-stats div { min-width: 0; }
.rb-stats dt { font-size: var(--fs-cap); color: var(--petrol); }
.rb-stats dd { margin: 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rb-stats dd small { display: block; font-size: var(--fs-cap); font-weight: 500; color: var(--petrol); }
.rb-stats div[hidden] { display: none; }
.rb-status, .rb-sheet-status { font-size: var(--fs-sm); color: var(--petrol); min-height: 1.5em; }
.rb-status.rb-err, .rb-sheet-status.rb-err { color: var(--rust-d); }
.rb-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.rb-cta .btn { flex: 1 1 140px; padding: 0 16px; }
.rb-cta .btn:disabled { opacity: .45; cursor: default; }
.rb-panel .btn-line { color: var(--ink) !important; border-color: var(--ink); }

/* Map pins (DOM markers, the same element for Mapbox GL and MapLibre). */
.rb-pin {
  width: 28px; height: 28px; border-radius: 50%; background: var(--petrol); color: var(--white); border: 2px solid var(--white);
  box-shadow: 0 2px 6px rgba(20, 38, 43, .4); display: flex; align-items: center; justify-content: center;
  font: 700 12px/1 var(--font); cursor: grab;
}
.rb-pin.rb-pin-start { background: var(--rust); }
.rb-pin.rb-pin-end { background: var(--ink); }

/* The CTA-first sheet: REVGARAGE first, GPX second. */
.rb-sheet {
  position: fixed; inset: 0; z-index: 80; background: rgba(20, 38, 43, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.rb-sheet[hidden] { display: none; }
.rb-card {
  position: relative; width: min(100%, 520px); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--white); color: var(--ink); border-radius: var(--r); padding: 28px 24px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.rb-card a { color: var(--ink); }
/* The sheet sits inside the petrol band, whose `.pet .btn-line` is white-on-transparent.
 * see docs/kb/website-sheet-buttons-white-on-white-inside-petrol-band.md */
.rb-card .btn-line { color: var(--ink) !important; border-color: var(--ink); }
.rb-card .btn-line:hover { background: rgba(20, 38, 43, .06); }
.rb-x { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink); }
.rb-card .hmd { padding-right: 36px; }
.rb-sheet-lead { color: var(--petrol); }
.rb-app { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 2px solid var(--rust); border-radius: var(--r); }
.rb-app > .btn { width: 100%; }
.rb-handoff { display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.rb-handoff[hidden] { display: none; }
.rb-qr svg { display: block; width: 200px; height: 200px; }
.rb-link { display: flex; gap: 8px; width: 100%; }
.rb-link input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 10px; border: 1px solid var(--hair-s); border-radius: var(--r); font: 400 14px/1.2 var(--font); color: var(--ink); }
.rb-link .btn { min-height: 44px; padding: 0 14px; }
.rb-get { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.rb-gpx { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--hair-s); border-radius: var(--r); }
.rb-gpx h3 { font-size: 18px; }
.rb-gpx-row { display: flex; flex-wrap: wrap; gap: 8px; }
.rb-gpx-row .btn { min-height: 44px; padding: 0 14px; font-size: 15px; }
.rb-noscript { background: var(--white); color: var(--ink); padding: 16px; border-radius: var(--r); grid-column: 1 / -1; }
html.rb-lock { overflow: hidden; }

@media (max-width: 1023px) {
  .rb-h1 { font-size: 30px; }
  .rb { grid-template-columns: 1fr; }
  .rb-mapwrap { order: -1; min-height: 0; height: 58vh; max-height: 520px; }
  section.rb-top { padding-block: 28px 32px; }
}
@media (max-width: 480px) {
  .rb-h1 { font-size: 26px; }
  .rb-panel { padding: 16px; }
  .rb-stats dd { font-size: 17px; }
  .rb-sheet { align-items: flex-end; padding: 0; }
  .rb-card { width: 100%; max-height: 92vh; border-radius: var(--r) var(--r) 0 0; padding: 24px 16px 20px; }
}
