/* ===========================================================================
   directions.css — #routes "מסלולי הגעה" branded interactive map (2026-06-10)
   ---------------------------------------------------------------------------
   Replaces the 3 dated PNG route cards + the generic Google iframe with ONE
   Leaflet map (js/directions-map.js) themed to the brass/cocoa/ivory palette,
   plus origin tabs (מירושלים / מהמרכז / מצפון) and a floating glass card.

   Constitution: all values from css/tokens.css (§10.2 — no hard-coded hex).
   Leaflet's own chrome is restyled here to drop its blue/white default look.
   Desktop-first; mobile overrides live in /mobile/css/directions.css (§13).
   ========================================================================= */

.directions {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* ----- Origin tabs (line-language; native radios for a11y) -----
   No segmented box — quiet text labels with a growing brass underline that
   stays lit on the active tab (the .site-nav grammar). LINE-LANGUAGE rev. */

.directions__tabs {
  display: inline-flex;
  align-self: center;
  gap: var(--space-6, 1.5rem);
}

.directions__tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* The radio drives state but stays invisible (label is the hit target). */
.directions__tab input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.directions__tab-label {
  position: relative;
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--fg-muted);
  padding-block: var(--space-2);
  transition: color var(--dur-base) var(--ease-out-cinema);
}

/* Growing brass underline — verbatim the .site-nav link grammar (RTL-safe). */
.directions__tab-label::after {
  content: "";
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  block-size: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform var(--dur-base) var(--ease-out-cinema);
}

.directions__tab:hover .directions__tab-label {
  color: var(--ink-deep);
}
.directions__tab:hover .directions__tab-label::after {
  transform: scaleX(1);
}

.directions__tab.is-active .directions__tab-label,
.directions__tab input:checked ~ .directions__tab-label {
  color: var(--ink-deep);
}
.directions__tab.is-active .directions__tab-label::after,
.directions__tab input:checked ~ .directions__tab-label::after {
  transform: scaleX(1);          /* active tab keeps its underline lit */
}

/* Visible keyboard focus ring on the active radio (§9). */
.directions__tab input:focus-visible ~ .directions__tab-label {
  outline: 3px solid var(--brass);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}
@media (prefers-reduced-motion: reduce) {
  .directions__tab-label::after { transition: none; }
}

/* ----- Stage (map + floating card) ----- */

.directions__stage {
  position: relative;
  inline-size: 100%;
  min-block-size: clamp(380px, 52vh, 560px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  background: var(--mist);          /* shows while tiles load */
  isolation: isolate;
}

.directions__map {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  background: var(--mist);
}

/* Brand tint: CARTO Voyager-no-labels already has warm beige land + BLUE
   water. Keep the sea blue — use only a gentle warm/contrast nudge (NOT a
   heavy sepia, which would drain the blue). Applied to the tile pane only;
   controls/pin/route/labels live above and stay true-color. Single knob for
   the whole map's tone. */
.directions__map .leaflet-tile-pane {
  filter: saturate(1.04) brightness(1.01) contrast(0.99);
}

/* ----- Venue pin (brass divIcon + gentle pulse) ----- */

.directions__pin-wrap { background: none; border: 0; }

.directions__pin {
  display: block;
  inline-size: 32px;
  block-size: 44px;
  filter: drop-shadow(0 4px 6px rgba(26, 20, 16, 0.28));
  transform-origin: 50% 100%;
  animation: directions-pin-pulse 2.4s var(--ease-out-cinema) infinite;
}

@keyframes directions-pin-pulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-3px) scale(1.05); }
}

.directions__pin-name {
  position: absolute;
  inset-block-start: -4px;
  inset-inline-start: 38px;
  white-space: nowrap;
  font-family: var(--font-display-he);
  font-size: var(--text-base);
  font-weight: var(--fw-bold);
  color: var(--cocoa);
  text-shadow: 0 1px 2px var(--ivory), 0 0 6px var(--ivory);
}

/* ----- Per-route place labels (dot + name) for distance scale ----- */

.directions__label-wrap { background: none; border: 0; }

.directions__place {
  position: relative;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  pointer-events: none;
}

/* Anchor variants nudge the text just off its geographic point so it doesn't
   land directly on the route line. No dot — the name sits tight on its place. */
.directions__place--right  { transform: translate(4px, -50%); }
.directions__place--left   { transform: translate(-4px, -50%); flex-direction: row-reverse; }
.directions__place--top    { transform: translate(-50%, calc(-100% - 3px)); }
.directions__place--bottom { transform: translate(-50%, 3px); }

.directions__place-name {
  font-family: var(--font-body);
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--fw-semibold);
  color: var(--cocoa);
  /* readable over the tiles without a hard chip behind the text */
  text-shadow: 0 1px 2px var(--ivory), 0 0 5px var(--ivory), 0 0 5px var(--ivory);
}

/* Origin city (route start) reads a touch larger/stronger. */
.directions__place--origin .directions__place-name {
  font-family: var(--font-display-he);
  font-size: var(--text-base);
  font-weight: var(--fw-bold);
  color: var(--brass-deep);
}

/* ----- Route polyline (SVG path, brass-deep + glow) ----- */

.directions__route {
  stroke: var(--brass-deep);
  stroke-width: 4;
  fill: none;
  filter: drop-shadow(0 0 5px rgba(207, 174, 131, 0.55)); /* brass glow */
}

/* ----- Floating glass card (RTL: anchored to inline-end/bottom) ----- */

.directions__card {
  position: absolute;
  inset-block-end: var(--space-6);
  inset-inline-end: var(--space-6);
  z-index: 500;                      /* above Leaflet panes (≤400) */
  max-inline-size: min(340px, 78%);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: color-mix(in srgb, var(--ivory) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--brass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-strong);
}

.directions__eta {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1, 0.25rem);
}

.directions__eta-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--accent);
}

.directions__eta-stat {
  font-family: var(--font-display-he);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--ink-deep);
}

.directions__address {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--fg-muted);
}

.directions__cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* .directions__cta skin removed 2026-06-15 (unify pass) — the Waze/Maps/WA
   buttons now use the canonical `.btn` (secondary outline) from
   css/components/buttons.css. The `--waze/--maps/--wa` modifiers carry no
   CSS (JS hooks only); `.directions__cta-row` above still owns layout. */

/* ----- Attribution + JS-off fallback ----- */

.directions__attribution {
  margin: 0;
  text-align: center;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--fg-muted);
  opacity: 0.8;
}

.directions__fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-8);
  text-align: center;
}

.directions__fallback a { color: var(--accent); }

/* ----- Leaflet chrome → brand restyle (drop the default blue/white) ----- */

.directions__map .leaflet-control-zoom a {
  background: var(--ivory);
  color: var(--cocoa);
  border-color: var(--border);
}

.directions__map .leaflet-control-zoom a:hover {
  background: var(--brass);
  color: var(--ink-deep);
}

.directions__map .leaflet-bar {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.directions__map .leaflet-control-attribution {
  background: color-mix(in srgb, var(--ivory) 85%, transparent);
  color: var(--fg-muted);
  font-family: var(--font-body);
}

.directions__map .leaflet-control-attribution a { color: var(--accent-hover); }

/* ----- Reduced motion (§8): no pin pulse; JS already skips fly/draw ----- */

@media (prefers-reduced-motion: reduce) {
  .directions__pin { animation: none; }
}
