/*
 * Design tokens from the Routific Website Figma file (variables on node 7166:92349).
 * Code components render inside Shadow DOM, so tokens are declared on :host as well as :root
 * (:root covers the local preview and Webflow's own page; :host covers the shadow tree).
 */
:host,
:host {
  /* Brand */
  --rt-indigo-100: #374cd2;
  --rt-indigo-200: #667afa;
  --rt-yellow-200: #ffad0a;
  --rt-yellow-border: #b97b01;
  --rt-turquoise: #45c4d7;
  --rt-primary-500: #326bfc;
  --rt-primary-600: #1750e3;
  --rt-hero-blue: #1f36a7;
  --rt-hero-lilac: #eceefb;

  /* Text */
  --rt-text-primary: #282828;
  --rt-text-secondary: #676d7e;
  --rt-text-tertiary: #9da1af;

  /* Route colours */
  --rt-route-violet: #7547bf;
  --rt-route-pink: #ff85a9;
  --rt-route-sky: #269ed1;
  --rt-route-lilac: #a770db;

  /* Type — Proxima Nova is expected to be loaded by the Webflow site (Adobe Fonts);
     Plus Jakarta Sans and Figtree are loaded from Google Fonts by useDocumentFonts(). */
  --rt-font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --rt-font-heading: "Figtree", system-ui, sans-serif;
  --rt-font-body: "proxima-nova", "Proxima Nova", "Figtree", system-ui, sans-serif;
  --rt-font-ui: "SF Pro Text", -apple-system, "Inter", system-ui, sans-serif;

  /* Radii */
  --rt-radius-md: 8px;
  --rt-radius-lg: 16px;

  /* Vector map (Hero/showcase/MapBase.tsx): Mapbox-light look of the current Routific UI */
  --map-land: #edeff3;
  --map-street: #fcfdfe;
  --map-park: #d3e9d1;
  --map-water: #b3caf3;
  --map-industrial: #f2e4c6;
  --map-highway: #aab3c7;
  --map-highway-edge: #fcfdfe;
}

/* ---------------------------------------------------------------------------
 * Floating route TOC. Fixed to the side of the viewport, so it must not sit inside an element
 * with a CSS transform (same as the Navbar). Not in Figma: our design, flag for design review.
 * --rt-toc-p (set from JS) is the scroll position in stops: 2.5 = halfway from stop 3 to stop 4.
 * ------------------------------------------------------------------------- */
.rt-toc {
  --rt-toc-gap: 30px;
  --rt-toc-p: 0;
  /* 0 → 1 as the end section (Growth) grows in and pushes the TOC off screen (set from JS) */
  --rt-toc-out: 0;
  --rt-toc-blue: var(--rt-primary-500);
  --rt-toc-road: #c3c9dd;
  position: fixed;
  top: 50%;
  z-index: 40;
  translate: 0 -50%;
  padding: 12px 10px;
  font-family: var(--rt-font-heading);
  -webkit-font-smoothing: antialiased;
  transition:
    translate 450ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 300ms ease,
    visibility 0s;
}

/* Pushed out: slides off screen in step with the end section growing in (follows the scroll,
   smoothed by the translate transition). */
.rt-toc--left {
  translate: calc(var(--rt-toc-out) * (-100% - 24px)) -50%;
}

.rt-toc--right {
  translate: calc(var(--rt-toc-out) * (100% + 24px)) -50%;
}

/* Fully out (or scrolled past the last section without an end section): hidden from keyboard and
   pointer; back when scrolling up. */
.rt-toc.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    translate 450ms cubic-bezier(0.55, 0, 0.78, 0),
    opacity 300ms ease 150ms,
    visibility 0s 450ms;
}

.rt-toc--left.is-done {
  translate: calc(-100% - 24px) -50%;
}

.rt-toc--right.is-done {
  translate: calc(100% + 24px) -50%;
}

.rt-toc.is-done .rt-toc-label {
  opacity: 0;
}

.rt-toc *,
.rt-toc *::before,
.rt-toc *::after {
  box-sizing: border-box;
}

.rt-toc--left {
  left: 16px;
}

.rt-toc--right {
  right: 16px;
}

/* Frosted panel: a slim pill around the route. Labels float beside it as their own pills. */
.rt-toc::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 36px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow:
    0 0 0 1px rgba(31, 54, 167, 0.08),
    0 8px 24px rgba(31, 54, 167, 0.12);
}

.rt-toc--left::before {
  left: 0;
}

.rt-toc--right::before {
  right: 0;
}

.rt-toc-body {
  position: relative;
}

/* ---- The route ---- */
.rt-toc-rail {
  position: absolute;
  top: calc(var(--rt-toc-gap) / 2 - 8px);
  width: 16px;
  pointer-events: none;
}

.rt-toc--left .rt-toc-rail {
  left: 0;
}

.rt-toc--right .rt-toc-rail {
  right: 0;
}

.rt-toc-svg {
  display: block;
  overflow: visible;
}

.rt-toc-ahead {
  fill: none;
  stroke: var(--rt-toc-road);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 0 5;
}

.rt-toc-driven {
  fill: none;
  stroke: var(--rt-toc-blue);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: calc(1 - var(--rt-toc-p) / var(--rt-toc-n));
}

/* The driver: rides the route with the scroll position. */
.rt-toc-driver {
  position: absolute;
  top: calc(8px + var(--rt-toc-p) * var(--rt-toc-gap));
  left: 8px;
  z-index: 2;
  width: 14px;
  height: 14px;
  translate: -50% -50%;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--rt-hero-blue);
  box-shadow: 0 2px 6px rgba(31, 54, 167, 0.35);
}

.rt-toc-driver::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: rgba(50, 107, 252, 0.25);
  animation: rt-toc-pulse 2.2s ease-out infinite;
}

@keyframes rt-toc-pulse {
  from { transform: scale(0.5); opacity: 1; }
  to { transform: scale(1.4); opacity: 0; }
}

/* ---- Stops + labels ---- */
.rt-toc-list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rt-toc-item {
  height: var(--rt-toc-gap);
}

.rt-toc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  color: inherit;
  text-decoration: none;
  outline: none;
}

.rt-toc--right .rt-toc-link {
  flex-direction: row-reverse;
}

.rt-toc-stop {
  position: relative;
  z-index: 1;
  flex: none;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
}

.rt-toc-stop::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid var(--rt-toc-road);
  border-radius: 50%;
  background: #fff;
  transition:
    border-color 200ms,
    background-color 200ms,
    box-shadow 200ms,
    transform 200ms;
}

.is-past .rt-toc-stop::before {
  border-color: var(--rt-toc-blue);
  background: var(--rt-toc-blue);
}

.is-active .rt-toc-stop::before {
  border-color: var(--rt-toc-blue);
  box-shadow: 0 0 0 4px rgba(50, 107, 252, 0.18);
}

.rt-toc-link:hover .rt-toc-stop::before,
.rt-toc-link:focus-visible .rt-toc-stop::before {
  transform: scale(1.25);
  border-color: var(--rt-toc-blue);
}

/* Labels are hidden pills: the current section's shows beside its stop, and hovering (or
   keyboard-focusing) a stop shows that stop's title instead. */
.rt-toc-label {
  padding: 4px 11px;
  border-radius: 999px;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(31, 54, 167, 0.08),
    0 4px 12px rgba(31, 54, 167, 0.12);
  font-weight: 600;
  font-size: 13px;
  line-height: 18px;
  color: var(--rt-hero-blue);
  white-space: nowrap;
  opacity: 0;
  translate: -4px 0;
  pointer-events: none;
  transition:
    opacity 180ms,
    translate 180ms;
}

.rt-toc--right .rt-toc-label {
  translate: 4px 0;
}

/* The current section's title, except on the hero (it would sit over the showcase) and where the
   side margin is too narrow for it. */
@media (min-width: 1360px) {
  .rt-toc:not(.is-top) .is-active .rt-toc-label {
    opacity: 1;
    translate: 0 0;
  }
}

/* While pointing at the route, only the hovered stop's title shows. */
.rt-toc:hover .rt-toc-item .rt-toc-label {
  opacity: 0;
}

.rt-toc .rt-toc-link:hover .rt-toc-label,
.rt-toc .rt-toc-link:focus-visible .rt-toc-label {
  opacity: 1;
  translate: 0 0;
}

/* Only where there's room beside the content column; phones and tablets go without. */
@media (max-width: 1099px) {
  .rt-toc {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rt-toc *,
  .rt-toc::before {
    animation: none !important;
    transition: none !important;
  }
}

