/* Subway map slide-down panel + compass button + supplemental nav. Single source of truth for the
   subway-map look-and-feel; loaded via <link> from both the Astro playbook layouts and the Phoenix
   root layout so the home page and the playbook share one CSS file. Uses only plain CSS
   (`var()`, `color-mix(in oklch, …)`, percentage-positioned absolute children) — no Tailwind
   directives — so it ships from `playbook/public/` without compilation.

   Companion: `subway-map.js` injects the panel/backdrop/button markup at runtime. */

/* Compass button (in the navbar): pulses in primary blue to draw the eye, signaling that the
   subway map is here and interactive. Mirrors the `bulb-pulse` animation used in the main app's
   homepage navigation. */
@keyframes compass-pulse {
  0%, 100% {
    color: var(--color-primary);
    opacity: 1;
  }
  50% {
    color: color-mix(in oklch, var(--color-primary) 70%, white);
    opacity: 0.75;
  }
}
.compass-pulse {
  color: var(--color-primary);
  animation: compass-pulse 2s ease-in-out infinite;
}
.compass-btn:hover .compass-pulse {
  animation-play-state: paused;
  color: var(--color-primary);
  opacity: 1;
}

/* Subway-map slide-down panel. Hidden above the viewport by default (translateY(-100%)). When
   `.is-open` is added, it slides down to sit just below the sticky navbar and covers the full page
   width. The navbar sits at z-50 and stays visible above the panel; the docs sidebar is z-40, so
   the panel needs to sit above the sidebar (z-45) but below the navbar. */
.subway-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background: var(--color-base-100);
  border-bottom: 1px solid color-mix(in oklch, var(--color-base-content) 12%, transparent);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  transform: translateY(-100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 0.3s ease-out,
              visibility 0s linear 0.45s;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  padding-top: 4rem; /* clear the sticky navbar so content slides out from under it */
}
/* The subway panel now lives at the body level (above the docs drawer) so it spans the full
   viewport width on every page — no sidebar carve-out needed. */
.subway-panel.is-open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 0.3s ease-out,
              visibility 0s;
}
.subway-panel__inner {
  padding: 5px;
  display: flex;
  justify-content: center;
}
.subway-panel__inner img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Light/dark image variants. Both `<img>` elements ship in the markup; CSS visibility flips with
   the page's `data-theme`. The hidden one still loads — for the slide-out panel that's fine since
   it's lazy-loaded by `loading="lazy"` and only renders on user interaction.

   Selectors are scoped through `.subway-map-canvas` so they outrank the generic
   `.subway-map-canvas img { display: block }` rule below; a bare `.subway-map-img-dark` selector
   loses the specificity battle (0,1,0 vs 0,1,1) and both images render stacked. */
.subway-map-canvas .subway-map-img-dark { display: none; }
[data-theme="dark"] .subway-map-canvas .subway-map-img-light { display: none; }
[data-theme="dark"] .subway-map-canvas .subway-map-img-dark { display: block; }

/* Canvas wraps the responsive map image plus a stack of percentage-positioned `<a>` overlays.
   Position relative so the absolute-positioned children scale with the image. */
.subway-map-canvas {
  position: relative;
  display: inline-block;
  line-height: 0;
  max-width: 100%;
}
.subway-map-canvas img {
  max-width: 100%;
  height: auto;
  display: block;
  /* Lightweight drag/right-click friction: `pointer-events: none` routes the right-click context
     menu to the parent `<div>` (no "Save image as"), `user-drag: none` blocks the native drag-to-
     desktop handler, and `user-select: none` suppresses the OS selection ring. The subway-stop
     anchors are absolutely positioned above the image and have their own pointer-events, so this
     does not interfere with stop clicks. Not DRM — dev-tools users can still resolve the URL. */
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
/* Subway-stop overlay: an invisible circular click target over each disc. `aspect-ratio: 1` keeps
   the element square in actual pixels so `border-radius: 50%` always produces a true circle,
   regardless of the image's responsive scale. Position and width are set per-stop via inline
   `style="left/top/width"`. */
.subway-stop {
  position: absolute;
  display: block;
  aspect-ratio: 1;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease-out, box-shadow 0.15s ease-out;
}
.subway-stop:hover,
.subway-stop:focus-visible {
  background-color: color-mix(in oklch, var(--color-primary) 18%, transparent);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--color-primary) 55%, transparent);
  outline: none;
}
/* "You are here" marker: the stop the visitor is currently on glows red. The `<a>` is rewritten by
   `subway-map.js` (href removed, `is-current` class added) on init. `pointer-events: none` keeps
   it non-clickable for keyboard + mouse users alike. */
.subway-stop.is-current {
  background-color: color-mix(in oklch, var(--color-error) 28%, transparent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-error) 70%, transparent);
  cursor: default;
  pointer-events: none;
}

/* Supplemental navigation row beneath the map. Soft DaisyUI badges acting as quick-jump links to
   the major surface areas of the playbook plus the parent properties (COE blog, Boss Logic). */
.subway-panel__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 5px 0.7rem;
}
.subway-panel__nav .badge {
  text-decoration: none;
  cursor: pointer;
}
.subway-panel__nav .badge:hover {
  filter: brightness(0.95);
}

/* Progressive color sweep: green → blue across the 5 supplemental nav badges. Each badge gets a
   soft tinted background, a matching saturated text color, and a subtle border in the same hue
   family — all derived from a single per-step `--step-color` token using OKLCH so the steps share
   consistent lightness/chroma. */
.subway-step {
  background: color-mix(in oklch, var(--step-color) 12%, transparent);
  color: color-mix(in oklch, var(--step-color) 90%, var(--color-base-content));
  border: 1px solid color-mix(in oklch, var(--step-color) 29%, transparent);
}
.subway-step:hover {
  background: color-mix(in oklch, var(--step-color) 18%, transparent);
  border-color: color-mix(in oklch, var(--step-color) 42%, transparent);
}
.subway-step-1 { --step-color: oklch(0.55 0.17 250); } /* deep blue  — Workshops */
.subway-step-2 { --step-color: oklch(0.55 0.17 285); } /* indigo     — Process guides */
.subway-step-3 { --step-color: oklch(0.58 0.16 320); } /* magenta    — Templates */
.subway-step-4 { --step-color: oklch(0.62 0.16  25); } /* red-orange — COE */
.subway-step-5 { --step-color: oklch(0.65 0.16  55); } /* orange     — Boss Logic */

/* Backdrop: sits below the panel but above page content; only catches clicks while the panel is
   open. */
.subway-backdrop {
  position: fixed;
  inset: 0;
  z-index: 44;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-out, visibility 0s linear 0.3s;
}
.subway-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease-out, visibility 0s;
}
