/*
 * Parallex UI kit for the map prototypes: the dashboard's tokens (src/app/globals.css) and the look of its
 * shadcn components (button, badge, card, tabs, input, kbd, tooltip, switch, dropdown) as plain CSS,
 * plus the map's own markers (pins, landmarks, area names, radius labels, A/B, popups).
 */
:root {
  --background: oklch(1 0 0);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --popover: oklch(1 0 0);
  --primary: #506fb3;
  --primary-rgb: 80 111 179;
  --primary-foreground: #ffffff;
  --secondary: oklch(0.967 0.001 286.375);
  --secondary-foreground: oklch(0.21 0.006 285.885);
  --muted: oklch(0.967 0.001 286.375);
  --muted-foreground: oklch(0.552 0.016 285.938);
  --accent: oklch(0.967 0.001 286.375);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.92 0.004 286.32);
  --border-subtle: #f1f3f8;
  --input: oklch(0.92 0.004 286.32);
  --ring: #506fb3;
  --radius: 0.875rem;
  --radius-2xl: calc(var(--radius) * 1.8);
  --sidebar: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.967 0.001 286.375);
  --sidebar-border: oklch(0.92 0.004 286.32);
  --ring-10: oklch(0.141 0.005 285.823 / 0.1); /* ring-foreground/10 */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  /* Floating over the aerial map needs a little more lift than on a white page. */
  --shadow-float: 0 0 0 1px var(--ring-10), 0 12px 32px -10px rgb(9 9 11 / 0.35), 0 2px 6px -2px rgb(9 9 11 / 0.12);
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #dde6ea; color: var(--foreground);
  font: 14px/1.43 var(--font-sans); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
#map { position: fixed; inset: 0; }
#map.picking, #map.picking .maplibregl-canvas { cursor: crosshair !important; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Icons (Tabler, like the dashboard) */
.ti { width: 16px; height: 16px; flex: none; display: block; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: .5; } }

/* Button (dashboard ui/button: rounded-lg = radius, h-10 default/lg, ghost/outline/secondary) */
.btn { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--foreground); font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none; user-select: none;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s, opacity .15s; outline: none; }
.btn:focus-visible, .ring-focus:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px rgb(var(--primary-rgb) / .5); }
.btn:active:not([aria-haspopup]) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { pointer-events: none; opacity: .7; }
.btn-lg { height: 40px; gap: 8px; padding: 0 24px; }
.btn-lg:has(> .ti:first-child) { padding-left: 16px; }
.btn-sm { height: 28px; gap: 4px; padding: 0 10px; border-radius: 12px; font-size: 12.8px; }
.btn-sm .ti { width: 14px; height: 14px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-icon-sm { width: 28px; height: 28px; padding: 0; border-radius: 12px; }
.btn-icon-lg { width: 40px; height: 40px; padding: 0; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: rgb(var(--primary-rgb) / .8); }
.btn-outline { border-color: var(--border); background: var(--background); }
.btn-outline:hover, .btn-outline[aria-expanded="true"] { background: var(--muted); }
.btn-outline[aria-pressed="true"], .btn-outline.on { border-color: var(--primary); color: var(--primary); background: rgb(var(--primary-rgb) / .05); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover { background: color-mix(in oklch, var(--secondary), var(--foreground) 5%); }
.btn-ghost:hover, .btn-ghost[aria-expanded="true"] { background: var(--muted); }
.btn-ghost[aria-pressed="true"], .btn-ghost.on { background: rgb(var(--primary-rgb) / .1); color: var(--primary); }
.btn-block { width: 100%; }

/* Badge (dashboard ui/badge with tones) */
.badge { display: inline-flex; flex: none; align-items: center; gap: 4px; height: 20px; padding: 2px 8px; border: 1px solid transparent; border-radius: 999px; font-size: 12px; font-weight: 500;
  line-height: 1; white-space: nowrap; }
.badge .ti { width: 12px; height: 12px; }
.badge.outline { border-color: var(--border); color: var(--foreground); }
.badge.secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge.tone-primary { border-color: rgb(var(--primary-rgb) / .3); background: rgb(var(--primary-rgb) / .1); color: var(--primary); }
.badge.tone-neutral { border-color: var(--border); background: var(--muted); color: var(--muted-foreground); }
.badge.tone-info { border-color: oklch(0.623 0.214 259.815 / .2); background: oklch(0.623 0.214 259.815 / .1); color: oklch(0.488 0.243 264.376); }
.badge.tone-success { border-color: oklch(0.723 0.219 149.579 / .2); background: oklch(0.723 0.219 149.579 / .1); color: oklch(0.527 0.154 150.069); }
.badge.tone-warning { border-color: oklch(0.769 0.188 70.08 / .25); background: oklch(0.769 0.188 70.08 / .15); color: oklch(0.555 0.163 48.998); }
.badge.tone-accent { border-color: oklch(0.606 0.25 292.717 / .2); background: oklch(0.606 0.25 292.717 / .1); color: oklch(0.491 0.27 292.581); }
.badge.on-media { border: 0; background: rgb(255 255 255 / .92); color: var(--foreground); box-shadow: var(--shadow-sm); }

/* Card surface (ring-1 ring-foreground/10, rounded-xl = radius) */
.surface { background: var(--card); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--ring-10); }
.float { background: var(--popover); border-radius: var(--radius); box-shadow: var(--shadow-float); }
.eyebrow { font-size: 11px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-foreground); }
.muted { color: var(--muted-foreground); }
.sep { height: 1px; background: var(--border); border: 0; margin: 0; flex: none; }
.sep-v { width: 1px; align-self: stretch; background: var(--border); flex: none; }

/* Tabs (dashboard ui/tabs: muted list, white active trigger with shadow-sm); .modes is the Driving / Walking control */
.tabs, .modes { display: flex; align-items: center; height: 32px; padding: 3px; border-radius: var(--radius); background: var(--muted); color: var(--muted-foreground); }
.tabs.lg, .modes { height: 40px; }
.tabs > button, .modes > button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 100%; min-width: 0; padding: 2px 8px; border: 1px solid transparent;
  border-radius: var(--radius); background: transparent; color: var(--foreground); font-size: 14px; font-weight: 500; white-space: nowrap; transition: background-color .15s, box-shadow .15s; outline: none; }
.tabs > button:focus-visible, .modes > button:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px rgb(var(--primary-rgb) / .5); }
.tabs > button[aria-selected="true"], .tabs > button.on, .modes > button.on { background: var(--background); box-shadow: var(--shadow-sm); }
.tabs > button:not(.on):not([aria-selected="true"]):hover, .modes > button:not(.on):hover { color: var(--foreground); background: rgb(255 255 255 / .45); }
.tabs .ti, .modes .ti { width: 16px; height: 16px; }

/* Input (dashboard ui/input: h-10, rounded-lg, border-input, ring on focus) */
.input { width: 100%; min-width: 0; height: 40px; padding: 4px 10px; border: 1px solid var(--input); border-radius: var(--radius); background: var(--background); color: var(--foreground);
  font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: var(--muted-foreground); }
.input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px rgb(var(--primary-rgb) / .5); }
.kbd { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 20px; min-width: 20px; padding: 0 4px; border-radius: 6px; background: var(--muted);
  color: var(--muted-foreground); font: 500 12px/1 var(--font-sans); pointer-events: none; user-select: none; }

/* Switch (dashboard ui/switch: 32 x 18.4, primary when on) */
.switch { position: relative; flex: none; width: 32px; height: 18.4px; padding: 0; border: 1px solid transparent; border-radius: 999px; background: var(--input); transition: background-color .15s; outline: none; }
.switch::after { content: ""; position: absolute; top: 50%; left: 1px; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; background: var(--background); box-shadow: var(--shadow-xs); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"]::after { transform: translateX(13px); }
.switch:focus-visible { box-shadow: 0 0 0 3px rgb(var(--primary-rgb) / .5); }

/* Tooltip on hover/focus (dashboard ui/tooltip: foreground bubble, text-xs) */
[data-tip] { position: relative; }
@media (hover: hover) {
  [data-tip]::after { content: attr(data-tip); position: absolute; z-index: 50; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(2px); padding: 6px 12px; border-radius: 10px;
    background: var(--foreground); color: var(--background); font: 400 12px/1.3 var(--font-sans); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; }
  [data-tip-side="left"]::after { left: auto; right: calc(100% + 8px); bottom: 50%; transform: translateY(50%) translateX(2px); }
  [data-tip-side="right"]::after { left: calc(100% + 8px); bottom: 50%; transform: translateY(50%) translateX(-2px); }
  [data-tip-side="bottom"]::after { bottom: auto; top: calc(100% + 8px); transform: translateX(-50%) translateY(-2px); }
  [data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transition-delay: .25s; }
  [data-tip]:hover::after { transform: translateX(-50%); }
  [data-tip-side="left"]:hover::after { transform: translateY(50%); }
  [data-tip-side="right"]:hover::after { transform: translateY(50%); }
  [data-tip-side="bottom"]:hover::after { transform: translateX(-50%); }
}
.skeleton { display: inline-block; border-radius: 6px; background: var(--accent); animation: pulse 2s ease-in-out infinite; }
.thin-scroll { scrollbar-width: thin; scrollbar-color: oklch(0.871 0.006 286.286) transparent; }

/* Toast (pick-on-map prompt): popover surface like the dashboard's sonner toasts */
.toast { position: fixed; z-index: 40; left: 50%; top: 20px; display: none; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; transform: translateX(-50%);
  border-radius: var(--radius); background: var(--popover); box-shadow: var(--shadow-float); font-size: 14px; font-weight: 500; white-space: nowrap; }
.toast.show { display: flex; animation: fade-in .2s var(--ease); }
.toast .ti { color: var(--primary); }

/* From / To fields with their dropdown (dashboard input + dropdown-menu) */
.loc { position: relative; display: flex; align-items: center; gap: 8px; }
.loc input { flex: 1; min-width: 0; height: 40px; padding: 4px 10px; border: 1px solid var(--input); border-radius: var(--radius); background: var(--background); outline: none;
  font-size: 14px; text-overflow: ellipsis; transition: border-color .15s, box-shadow .15s; }
.loc input::placeholder { color: var(--muted-foreground); }
.loc input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px rgb(var(--primary-rgb) / .5); }
.loc > .ab { width: 22px; height: 22px; font-size: 11px; border-width: 2px; flex: none; box-shadow: none; }
.dd { position: absolute; z-index: 30; top: calc(100% + 6px); left: 30px; right: 0; max-height: min(320px, 50vh); overflow: auto; padding: 4px; border-radius: var(--radius);
  background: var(--popover); box-shadow: 0 0 0 1px var(--ring-10), var(--shadow-md); display: none; scrollbar-width: thin; }
.dd.open { display: block; animation: fade-in .12s; }
.dd .grp { padding: 8px 8px 4px; font-size: 11px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-foreground); }
.dd button { width: 100%; min-height: 36px; padding: 4px 8px; border: 0; border-radius: 10px; background: transparent; display: flex; align-items: center; gap: 10px; text-align: left; font-size: 14px; }
.dd button span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd button small { color: var(--muted-foreground); font-size: 12px; }
.dd button:hover, .dd button.kb { background: var(--accent); }
.dd button i { width: 26px; height: 26px; border-radius: 8px; background: var(--muted); color: var(--foreground); display: grid; place-items: center; flex: none; }
.dd button i svg { width: 15px; height: 15px; }
.dd button.pick i { background: rgb(var(--primary-rgb) / .1); color: var(--primary); }
.dd button img { width: 54px; height: 22px; object-fit: contain; flex: none; }
.dd .none { padding: 12px 10px; color: var(--muted-foreground); font-size: 13px; }
#result { display: none; }
#result.show { display: flex; }
#result.busy b { opacity: .35; }
.result-note { display: none; }
.result-note.show { display: block; }

/* ---------- map markers ---------- */
.maplibregl-ctrl-attrib { font: 10px/1.4 var(--font-sans); background: rgb(255 255 255 / .7) !important; color: oklch(0.37 0.013 285.805); }
.maplibregl-ctrl-attrib a { color: inherit; }
/* Project pins: white pill with the project's wordmark, stem, ground dot; hover shows the photo + hint. Children only:
   MapLibre owns the root element's position and transform. */
.pin { display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: opacity .3s; }
.pin .pill { position: relative; display: grid; place-items: center; height: 44px; min-width: 92px; padding: 7px 16px; border-radius: 999px; background: #fff;
  box-shadow: 0 0 0 1px var(--ring-10), 0 10px 26px -8px rgb(9 9 11 / .5); transition: transform .25s var(--ease), background-color .25s, box-shadow .25s; }
.pin .pill img { max-height: 28px; max-width: 116px; display: block; }
.pin .pill img.inv { filter: brightness(0); }
.pin .pill em { position: absolute; left: 50%; top: 100%; margin-top: 6px; transform: translateX(-50%); white-space: nowrap; font-style: normal; font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px; background: var(--foreground); color: #fff; opacity: 0; transition: opacity .2s; pointer-events: none; box-shadow: var(--shadow-md); }
.pin .stem { width: 2px; height: 40px; background: linear-gradient(rgba(255,255,255,.95), rgba(255,255,255,.35)); }
.pin .dot { width: 10px; height: 10px; margin-top: -3px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 5px rgba(255,255,255,.3), 0 2px 6px rgba(0,0,0,.3); }
.peek { position: absolute; bottom: calc(100% + 10px); left: 50%; width: 192px; height: 192px; margin-left: -96px; border: 2px solid #fff; border-radius: var(--radius); overflow: hidden;
  background: #c9d4da center/cover no-repeat; box-shadow: 0 14px 34px rgba(0,0,0,.3); opacity: 0; transform: scale(.8); transform-origin: 50% 100%; transition: opacity .3s, transform .3s; pointer-events: none; }
@media (hover: hover) {
  .pin:hover .pill, .pin.hl .pill { transform: translateY(-4px) scale(1.04); }
  .pin:hover .pill em { opacity: 1; }
  .pin:hover .peek, .lm:hover .peek { opacity: 1; transform: none; }
}
@media (hover: none) { .pin.sel .pill em { opacity: 1; } }
.pin.hl .pill { box-shadow: 0 0 0 3px rgb(var(--primary-rgb) / .9), 0 12px 30px -8px rgb(9 9 11 / .5); }
.pin.sel .pill { background: var(--primary); box-shadow: 0 0 0 3px #fff, 0 12px 32px -6px rgb(var(--primary-rgb) / .75); }
.pin.sel .pill img { filter: brightness(0) invert(1); }
.pin.dim { opacity: .55; }
.pin.dim.hl { opacity: 1; }
/* Stacking among markers: a hovered pin or landmark (with its photo) on top, then the selected pin;
   the radius-circle distance labels always stay underneath. */
.maplibregl-marker.ring-label { z-index: 1; }
.maplibregl-marker.pin.sel { z-index: 3; }
.maplibregl-marker.pin.hl { z-index: 4; }
.maplibregl-marker.pin:hover, .maplibregl-marker.lm:hover { z-index: 4; }

/* Landmarks: dark glass icon, stem, dot; hover shows name + photo */
.lm { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.lm .ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgb(24 24 27 / .72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.55), 0 6px 18px rgba(0,0,0,.3); transition: transform .2s; }
.lm .ic svg { width: 22px; height: 22px; }
.lm .stem { width: 1.5px; height: 18px; background: rgba(255,255,255,.8); }
.lm .dot { width: 6px; height: 6px; margin-top: -2px; border-radius: 50%; background: #fff; }
.lm .tag { position: absolute; bottom: 70px; white-space: nowrap; padding: 4px 10px; border-radius: 999px; background: #fff; font-size: 12px; font-weight: 500;
  box-shadow: 0 0 0 1px var(--ring-10), var(--shadow-md); opacity: 0; transform: translateY(4px); transition: .15s; pointer-events: none; }
.lm .peek { width: 160px; height: 110px; margin-left: -80px; bottom: 98px; }
/* landmarks without a photo: their icon on a soft tile instead */
.lm .peek-ic { display: grid; place-items: center; color: rgb(24 24 27 / .55); background: linear-gradient(160deg, #eef2f6, #d9e1e8); }
.lm .peek-ic svg { width: 44px; height: 44px; }
.lm-pop .nw, .lm-pop .go button { white-space: nowrap; }
.lm-pop small { flex-wrap: wrap; }
.lm:hover .ic { transform: scale(1.1); }
.lm:hover .tag { opacity: 1; transform: none; }

/* Area names: printed on the map, like an aerial atlas */
.area { pointer-events: none; white-space: nowrap; color: #fff; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: 11px;
  text-shadow: 0 0 3px rgba(0,0,0,.65), 0 1px 8px rgba(0,0,0,.55); transition: opacity .25s; }
.area.r1 { font-size: 12px; }
.area.r0 { font-size: 15px; letter-spacing: .2em; }

/* Landmark popup: photo + Directions from / to (dashboard card) */
.maplibregl-popup.lm-pop { z-index: 6; }
.maplibregl-popup.lm-pop .maplibregl-popup-content { padding: 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-float); font: inherit; }
.maplibregl-popup.lm-pop .maplibregl-popup-tip { display: none; }
.lm-pop img { display: block; width: 260px; height: 146px; object-fit: cover; }
.lm-pop .maplibregl-popup-content > div { padding: 12px 12px 12px; width: 260px; }
.lm-pop b { display: block; font-size: 14px; font-weight: 600; padding: 0 2px; }
.lm-pop small { display: flex; align-items: center; gap: 4px; padding: 0 2px; margin-top: 2px; font-size: 12px; color: var(--muted-foreground); }
.lm-pop small .ti { width: 12px; height: 12px; }
.lm-pop .go { display: flex; gap: 6px; margin-top: 10px; }
.lm-pop .go button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 32px; padding: 0 6px; border: 0; border-radius: 10px;
  background: var(--secondary); font-size: 12.5px; font-weight: 500; }
.lm-pop .go button:hover { background: color-mix(in oklch, var(--secondary), var(--foreground) 6%); }
.lm-pop .go .ti { width: 14px; height: 14px; }
.maplibregl-popup.tip .maplibregl-popup-content { padding: 6px 12px; border-radius: 10px; background: var(--foreground); color: #fff; font: 500 12px/1.3 var(--font-sans); box-shadow: var(--shadow-md); }
.maplibregl-popup.tip .maplibregl-popup-tip { display: none; }
.ring-label { padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.92); color: #1d4ed8; font-size: 11px; font-weight: 600; pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.ab { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; border: 2.5px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,.35); }
.ab.a { background: #16a34a; } .ab.b { background: #dc2626; }

/* First load: a small status until the map has drawn */
.boot { position: fixed; z-index: 50; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  font-size: 13px; font-weight: 500; color: var(--muted-foreground); transition: opacity .4s; }
.boot .ti { color: var(--primary); }
.boot.gone { opacity: 0; pointer-events: none; }

/* Full-screen project video */
.player { position: fixed; z-index: 60; inset: 0; background: #000; display: none; }
.player.open { display: block; }
.player video { width: 100%; height: 100%; object-fit: contain; }
.player button { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: var(--radius); background: rgb(255 255 255 / .18); color: #fff; }
.player button:hover { background: rgb(255 255 255 / .28); }
.player button .ti { width: 20px; height: 20px; }
