/* Sac Bites & Nights :: public/css/map.css — /map/ page. Owner: T2. Prefix: map-.
   Utilitarian page: no hero, no pinning, micro-interactions only (<= 200ms). Tokens from shared/tokens.css. */

/* ---------------------------------------------------------------- toolbar */
.map-toolbar { display: flex; flex-direction: column; gap: 10px; padding-block: 12px; }
.map-row { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; }
.map-row--scroll {
  overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter);
}
.map-row--scroll::-webkit-scrollbar { display: none; }
.map-chip { min-height: 44px; flex: 0 0 auto; white-space: nowrap; color: var(--text); transition: background-color 150ms, border-color 150ms; }
.map-chip:hover { border-color: var(--teal); color: var(--text); }
.map-chip--open[aria-pressed="true"] { background: var(--ok-soft); border-color: var(--ok); color: var(--text); }
.map-cats { display: flex; gap: 8px; flex: 0 0 auto; }
.map-sep { flex: 0 0 1px; align-self: stretch; margin-block: 6px; background: var(--border-2); }
.map-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--text-3); }
.map-dot--ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

.map-date { position: relative; flex: 0 0 auto; margin: 0; font-size: var(--fs-body); }
.map-date__input {
  width: auto; min-height: 44px; padding: 6px 12px; border-radius: var(--radius-pill);
  font-size: var(--fs-body); font-weight: 600; color: var(--text); background: var(--surface-3); color-scheme: dark;
}
.map-date.is-active .map-date__input { background: var(--teal-soft); border-color: var(--teal); }

.map-search { flex: 1 1 auto; min-width: 0; color: var(--text); background: var(--surface-3); }
.map-near {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; min-width: 52px; padding: 0 16px; border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-2);
  font-size: var(--fs-key); font-weight: 600; cursor: pointer; transition: border-color 150ms, background-color 150ms;
}
.map-near:hover { border-color: var(--teal); color: var(--text); }
.map-near[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); }
.map-near[aria-busy="true"] .map-ico { animation: map-spin 1s linear infinite; }
.map-ico { width: 22px; height: 22px; color: var(--teal); flex: 0 0 auto; }
@media (max-width: 479px) {
  .map-near { padding: 0; }
  .map-near__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@keyframes map-spin { to { transform: rotate(360deg); } }

.map-focus {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px;
  border: 1px solid var(--blue); background: var(--blue-soft); border-radius: var(--radius-sm);
  color: var(--text); font-size: var(--fs-body);
}
.map-focus strong { color: var(--text); }

/* ---------------------------------------------------------------- stage: map + sheet */
.map-stage {
  position: relative; height: var(--stage-h, calc(100dvh - 260px)); min-height: 460px;
  overflow: hidden; border-top: 1px solid var(--border); background: var(--bg-2); isolation: isolate;
}
.map-stage .map-canvas { position: absolute; inset: 0; z-index: var(--z-map); background: #0c0c0c; }
.map-canvas__status {
  position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); max-width: 85%;
  padding: 10px 16px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border); font-size: var(--fs-small); text-align: center; z-index: 2;
}
.map-canvas__status.is-error { color: var(--text); border-color: var(--warn); }

.map-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; flex-direction: column; height: 52%;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2); border-bottom: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.5);
  transition: height 200ms var(--ease-out);
}
.map-sheet[data-state="peek"] { height: 116px; }
.map-sheet[data-state="half"] { height: 52%; }
.map-sheet[data-state="full"] { height: 100%; border-radius: 0; }
.map-sheet.is-dragging { transition: none; }

.map-sheet__handle {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 100%; min-height: 72px; padding: 10px var(--gutter) 12px; border: 0; background: transparent;
  color: var(--text); cursor: grab; touch-action: none; font-size: var(--fs-key); text-align: center;
}
.map-sheet__handle:active { cursor: grabbing; }
.map-sheet__grip { width: 46px; height: 5px; border-radius: 3px; background: var(--border-2); }
.map-sheet__summary { color: var(--text); font-size: var(--fs-key); font-weight: 600; }
.map-sheet__summary strong { color: var(--teal); font-family: var(--font-display); }
.map-summary__open { color: var(--ok); }
.map-sheet__body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 var(--gutter) var(--s-6); -webkit-overflow-scrolling: touch;
}

/* ---------------------------------------------------------------- list */
.map-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.map-day { margin-top: 10px; }
.map-day__h { font-size: var(--fs-key); color: var(--teal); margin: 4px 0 0; letter-spacing: -0.01em; }
.map-item { scroll-margin: 12px; }
.map-item__card {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-left: 5px solid var(--c, var(--cat-other)); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; transition: border-color 150ms, box-shadow 150ms;
}
.map-item__card:hover { border-color: var(--border-2); border-left-color: var(--c, var(--cat-other)); }
.map-item.is-selected .map-item__card { border-color: var(--teal); border-left-color: var(--c, var(--teal)); box-shadow: var(--glow-teal); }
.map-item__top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.map-item__top .sb-cat-dot { flex: 0 0 auto; }
.map-item__name {
  flex: 1 1 auto; min-width: 0; margin: 0; font-size: var(--fs-key); color: var(--text);
  line-height: 1.2; overflow-wrap: anywhere; letter-spacing: -0.01em;
}
.map-item__when { margin: 0 0 4px; font-size: var(--fs-key); font-weight: 600; color: var(--text); }
.map-item__dist { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--blue-soft); color: var(--text); font-size: var(--fs-small); }
.map-item__place { margin: 0; color: var(--text-2); font-size: var(--fs-body); overflow-wrap: anywhere; }
.map-item__addr { margin: 0; color: var(--text-2); font-size: var(--fs-body); overflow-wrap: anywhere; }
.map-item__notes { margin: 6px 0 0; color: var(--text-2); font-size: var(--fs-body); overflow-wrap: anywhere; }
.map-item__cat { margin: 6px 0 0; color: var(--text-3); font-size: var(--fs-small); }
.map-item__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.map-item__nopin { align-self: center; color: var(--text-3); font-size: var(--fs-small); }

.map-act {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 16px;
  border-radius: var(--radius-pill); border: 1px solid var(--teal); background: var(--teal-soft);
  color: var(--text); font-size: var(--fs-key); font-weight: 600; text-decoration: none; cursor: pointer;
  font-family: var(--font-body); line-height: 1.1; transition: background-color 150ms, border-color 150ms;
}
.map-act:hover { background: var(--teal); color: var(--text-invert); }
.map-act--ghost { border-color: var(--border-2); background: transparent; color: var(--text); }
.map-act--ghost:hover { border-color: var(--violet); background: var(--violet-soft); color: var(--text); }

.map-badge--ended { color: var(--text-3); background: transparent; }

.map-empty { list-style: none; color: var(--text-2); }
.map-empty p { margin-inline: auto; color: var(--text-2); }
.map-empty .u-key { color: var(--text); }
.map-empty__row { justify-content: center; margin-top: var(--s-4); }
.map-note { list-style: none; color: var(--text-3); font-size: var(--fs-small); padding: 4px 2px; }

.map-item--skel .map-item__card { cursor: default; border-left-color: var(--border-2); display: flex; flex-direction: column; gap: 10px; }
.map-item--skel span { display: block; height: 18px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--border), var(--surface-3)); background-size: 200% 100%; animation: map-shimmer 1.2s linear infinite; }
.map-item--skel span:nth-child(1) { width: 60%; height: 22px; }
.map-item--skel span:nth-child(2) { width: 40%; }
.map-item--skel span:nth-child(3) { width: 80%; }
@keyframes map-shimmer { to { background-position: -200% 0; } }

.map-after { margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--border); }
.map-after__text { color: var(--text-2); }
.map-after__fb { margin-top: var(--s-4); }

/* ---------------------------------------------------------------- MapLibre skin (dark, explicit colours) */
.map-stage .maplibregl-popup-content {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 14px 16px 14px; box-shadow: var(--shadow); font-family: var(--font-body);
}
.map-stage .maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.map-stage .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.map-stage .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--surface-2); }
.map-stage .maplibregl-popup-anchor-top .maplibregl-popup-tip,
.map-stage .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.map-stage .maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--surface-2); }
.map-stage .maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface-2); }
.map-stage .maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface-2); }
.map-stage .maplibregl-popup-close-button {
  width: 40px; height: 40px; font-size: 26px; line-height: 1; color: var(--text); background: transparent; border-radius: var(--radius-sm);
}
.map-stage .maplibregl-popup-close-button:hover { background: var(--surface-3); color: var(--text); }
.map-stage .maplibregl-popup { z-index: 3; }
.map-pop { padding-right: 26px; }
.map-pop p { margin: 0; }
.map-pop__name { font-family: var(--font-display); font-size: var(--fs-key); font-weight: 700; color: var(--text); line-height: 1.2; }
.map-pop__when { font-size: var(--fs-body); font-weight: 600; color: var(--text); margin-top: 4px !important; }
.map-pop__badge { margin-top: 6px; }
.map-pop__badge:empty { display: none; }
.map-pop__place { font-size: var(--fs-small); color: var(--text-2); margin-top: 6px !important; }
.map-pop__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.map-pop .map-act { font-size: var(--fs-body); min-height: 44px; padding: 6px 14px; }

.map-stage .maplibregl-ctrl-group { background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.map-stage .maplibregl-ctrl-group button { width: 44px; height: 44px; background-color: transparent; }
.map-stage .maplibregl-ctrl-group button + button { border-top: 1px solid var(--border-2); }
.map-stage .maplibregl-ctrl-group button:hover { background-color: var(--surface-3); }
.map-stage .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.2); }
.map-stage .maplibregl-ctrl.maplibregl-ctrl-attrib { background: var(--surface-2); color: var(--text-2); font-size: var(--fs-legal); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.map-stage .maplibregl-ctrl-attrib a { color: var(--text); }
.map-stage .maplibregl-ctrl-attrib-button { background-color: var(--surface-3); filter: invert(1); }
.map-stage .maplibregl-ctrl-bottom-left, .map-stage .maplibregl-ctrl-bottom-right { bottom: 116px; }

.map-me {
  width: 20px; height: 20px; border-radius: 50%; background: var(--blue-2); border: 3px solid #FFFFFF;
  box-shadow: 0 0 0 6px var(--blue-soft), 0 0 18px var(--blue);
}

/* ---------------------------------------------------------------- signup band under the map */
.map-signup { padding-block: var(--s-7) 0; }
.map-signup__h { font-size: var(--fs-h3); color: var(--text); }
.map-signup p { color: var(--text-2); }

/* ---------------------------------------------------------------- desktop: side panel */
@media (min-width: 1024px) {
  .map-toolbar { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-block: 14px; }
  .map-toolbar > .map-row--scroll { margin-inline: 0; padding-inline: 0; }
  .map-row--main { flex: 1 1 420px; }
  .map-toolbar > .map-row--scroll:last-of-type { flex: 1 1 100%; }
  .map-stage { display: grid; grid-template-columns: 440px 1fr; grid-template-rows: minmax(0, 1fr); }
  .map-stage .map-canvas { position: relative; inset: auto; grid-column: 2; grid-row: 1; min-height: 0; min-width: 0; overflow: hidden; }
  .map-sheet {
    position: relative; grid-column: 1; grid-row: 1; height: 100% !important;
    border: 0; border-right: 1px solid var(--border); border-radius: 0; box-shadow: none; background: var(--bg-2);
  }
  .map-sheet__handle { cursor: default; min-height: 60px; align-items: flex-start; padding: 16px var(--gutter) 8px; }
  .map-sheet__handle[disabled] { opacity: 1; color: var(--text); }
  .map-sheet__grip { display: none; }
  .map-stage .maplibregl-ctrl-bottom-left, .map-stage .maplibregl-ctrl-bottom-right { bottom: 0; }
}
@media (min-width: 1440px) { .map-stage { grid-template-columns: 500px 1fr; } }
