/* OLAT Explorer v3z (zoom beta) — additive, scoped to .olat-v3. */

/* the map captures touch gestures for pan/pinch rather than scrolling the page;
   overflow:hidden clips the zoomed/panned reference rasters to the map box so a
   scaled layer can't spill out across the page */
.olat-v3 #olat3-map { touch-action: none; overflow: hidden; }
/* the reference-layer wrapper is transformed to follow the viewport */
.olat-v3 #olat3-ref-layers { will-change: transform; }

/* The borough SVG is scaled by the same CSS transform (set inline in JS, with the
   live zoom factor exposed as --olat-z). Divide the stroke widths back down by that
   factor so the outlines stay ~constant width and crisp instead of thickening as
   you zoom in. --olat-z defaults to 1, so the un-zoomed view is unchanged. */
.olat-v3 .olat-borough { stroke-width: calc(1px / var(--olat-z, 1)); }
.olat-v3 .olat-boundary { stroke-width: calc(2px / var(--olat-z, 1)); }
.olat-v3 .olat-borough.selected,
.olat-v3 .olat-borough:hover,
.olat-v3 .olat-borough:focus-visible { stroke-width: calc(2.5px / var(--olat-z, 1)); }

.olat-v3 .olat3-zoom {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;                 /* above the borough SVG (z-index 2) */
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.olat-v3 .olat3-zoom button {
  width: 34px;
  height: 34px;
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--warm-grey);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.olat-v3 .olat3-zoom button:hover { border-color: var(--blue); color: var(--blue); }
.olat-v3 .olat3-zoom button:disabled { opacity: 0.4; cursor: default; box-shadow: none; }

@media (max-width: 640px) {
  .olat-v3 .olat3-zoom button { width: 42px; height: 42px; }
}

/* ---- Proposed-lines (network scenario) selector ------------------------- */
/* Same look as the Mapping-options view buttons. The panel is populated and
   revealed by JS only when the manifest advertises scenarios. */
.olat-v3 .olat3-scenarios { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.olat-v3 .olat3-scen {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--warm-grey);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  min-height: 32px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.olat-v3 .olat3-scen:hover { border-color: var(--blue); color: var(--blue); }
.olat-v3 .olat3-scen.active { background: var(--blue); color: var(--white); border-color: var(--blue); }
.olat-v3 .olat3-scen-note {
  width: 100%;
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--mid-grey);
}
.olat-v3 .olat3-scen-note:empty { display: none; }

/* A display (view) that the active network can't draw yet: greyed, not clickable.
   The + e-bike / + car mode toggles already dim via .olat3-dim in main.css. */
.olat-v3 .olat3-view:disabled,
.olat-v3 .olat3-view.olat3-dim { opacity: 0.4; cursor: not-allowed; }
.olat-v3 .olat3-view:disabled:hover,
.olat-v3 .olat3-view.olat3-dim:hover { border-color: var(--warm-grey); color: var(--ink); }

@media (max-width: 640px) { .olat-v3 .olat3-scen { min-height: 40px; } }

/* ---- Proposed-line overlay (the selected scheme's route + stations) ------- */
/* Drawn inside the borough SVG, so it pans/zooms with the map and shows above the
   map layers regardless of their toggles. A dashed line (black casing + white core)
   is the map convention for a planned/future line. Widths are in SVG user units
   (0..2200 space), so the weight tracks the rail overlay at any size and zoom. */
.olat-v3 .olat3-scenario-geo { pointer-events: none; opacity: 0.75; }   /* let some dots show through */
.olat-v3 .olat3-scen-line-casing {
  fill: none; stroke: #111; stroke-width: 16;
  stroke-dasharray: 7 5; stroke-linecap: butt; stroke-linejoin: round;
}
.olat-v3 .olat3-scen-line-core {
  fill: none; stroke: #fff; stroke-width: 8;
  stroke-dasharray: 7 5; stroke-linecap: butt; stroke-linejoin: round;
}
.olat-v3 .olat3-scen-stn { fill: #fff; stroke: #111; stroke-width: 5; }

/* ---- Expand to full browser width ---------------------------------------- */
/* Button sits top-left of the map (mirroring the zoom controls). When active, the
   whole explorer becomes a fixed, scrollable overlay filling the window, so the map
   gets the full width; the controller calls r.resize() to re-render it sharply. */
.olat-v3 .olat3-expand {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--warm-grey);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.olat-v3 .olat3-expand:hover { border-color: var(--blue); color: var(--blue); }

/* the two column wrappers are invisible to layout normally (the interface keeps its
   vertical stack); the expand mode below turns them into a sidebar + a map pane */
.olat-v3 .olat3-col-controls,
.olat-v3 .olat3-col-map { display: contents; }

/* Expanded = full window, laid out side-by-side: controls sidebar on the left
   (always visible), the map filling the rest and fitted to the window height so the
   whole map shows without scrolling. Solves the "tall UI on a wide monitor" mismatch. */
.olat-v3.olat3-expanded {
  position: fixed;
  inset: 0;
  z-index: 1000;
  margin: 0;
  width: auto;
  max-width: none;
  background: #fff;
  overflow: hidden;                 /* each column manages its own scroll */
  padding: 0.9rem 1.1rem;
  display: flex;
  gap: 1.1rem;
  align-items: stretch;
}
.olat-v3.olat3-expanded .olat3-col-controls {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex: 0 0 clamp(300px, 25vw, 380px);
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.3rem;
}
.olat-v3.olat3-expanded .olat3-col-map {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
}
/* the map grows to fill the remaining height but keeps its aspect ratio and centres,
   so it's as large as fits the window without overflowing */
.olat-v3.olat3-expanded .olat3-col-map .olat-map {
  flex: 1 1 0;
  min-height: 0;
  aspect-ratio: 2200 / 1695;
  max-width: 100%;
}
.olat-v3.olat3-expanded .olat3-col-map .olat-map canvas { width: 100%; height: 100%; }
.olat-v3.olat3-expanded .olat3-col-map > .olat-legend,
.olat-v3.olat3-expanded .olat3-col-map > .olat3-stats,
.olat-v3.olat3-expanded .olat3-col-map > .olat-caption { flex: 0 0 auto; align-self: stretch; margin: 0; }
/* in the narrow sidebar the town-centre chips can wrap freely */
.olat-v3.olat3-expanded .olat3-col-controls .olat-chips { max-height: none; }

/* pointless on mobile, which is already full-bleed */
@media (max-width: 640px) { .olat-v3 .olat3-expand { display: none; } }
