/* Happy hour crawl (crawl.js): the button on a venue, the panel, the route.
   The panel borrows the count-bar list's frame (.peek-list) so the two read
   as one family and hide under the same conditions. */

/* --- "+ Crawl" on the venue card ----------------------------------------- */
.crawl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  min-height: 30px;
  padding: 0 12px 0 9px;
  border: 1px solid rgba(255, 176, 32, 0.55);
  border-radius: 999px;
  background: rgba(255, 176, 32, 0.1);
  color: #ffd27a;
  font: 600 13px/1 'Poppins', system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease;
}
.crawl-btn[hidden] { display: none; }
.crawl-btn:hover { background: rgba(255, 176, 32, 0.2); }
.crawl-btn:focus-visible { outline: 2px solid var(--primary, #0C9DB0); outline-offset: 2px; }
.crawl-btn svg { flex: none; }
/* On the crawl: a solid amber pill carrying the stop number. Dark ink — white
   on this amber would fail contrast. */
.crawl-btn.is-on { background: #ffb020; border-color: #ffb020; color: #2a1a00; }
.crawl-btn-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; border-radius: 50%;
  background: #2a1a00; color: #ffd27a; font-size: 12px; font-weight: 800;
}

/* The card's row: "+ Crawl" and, once the crawl has a stop, "Your crawl · N",
   which opens the panel (the count bar is hidden while a venue is open). */
.crawl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.crawl-actions .crawl-btn { margin-top: 0; }
.crawl-actions:not(:has(> :not([hidden]))) { display: none; }
.crawl-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 6px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: 600 13px/1 'Poppins', system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.crawl-view-btn[hidden] { display: none; }
.crawl-view-btn svg { flex: none; color: #ffb020; width: 16px; height: 16px; }
.crawl-view-btn:hover { background: rgba(255, 255, 255, 0.16); }
.crawl-view-btn:focus-visible { outline: 2px solid var(--primary, #0C9DB0); outline-offset: 2px; }
.crawl-view-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box;
  border-radius: 999px; background: #ffb020; color: #2a1a00; font-size: 12px; font-weight: 800;
}

/* On the detail view's photo: to the left of the heart. */
.crawl-btn-hero {
  position: absolute;
  top: 17px;
  right: 70px;
  z-index: 2;
  margin: 0;
  min-height: 40px;
  padding: 0 14px 0 11px;
  background: rgba(12, 22, 36, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.crawl-btn-hero.is-on { background: #ffb020; }

/* --- The count bar's Crawl chip ----------------------------------------- */
.peek-crawl[hidden] { display: none; }
.peek-crawl .peek-dot { background: #ffb020; }
.peek-crawl.is-on { background: #ffb020; color: #2a1a00; }
.peek-crawl.is-on .peek-dot { background: #2a1a00; }
@media (max-width: 400px) {
  .peek-crawl .peek-label { display: none; }
}

/* --- The menu row --------------------------------------------------------- */
.cp-crawl svg { color: #ffb020; }
.cp-crawl { margin-bottom: 10px; }

/* --- The panel ------------------------------------------------------------ */
.crawl-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.crawl-summary { font-size: 13px; color: var(--text-medium, rgba(255, 255, 255, 0.7)); }
.crawl-summary:empty { display: none; }
.crawl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 8px;
  border-radius: 14px;
}
.crawl-row:hover { background: rgba(255, 255, 255, 0.06); }
/* The drag handle. touch-action: none makes a finger on it drag the stop
   instead of scrolling the list; the rest of the row still scrolls. */
.crawl-grip {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 44px; margin-right: -4px; padding: 0;
  border: 0; border-radius: 10px; background: none;
  color: rgba(255, 255, 255, 0.55);
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.crawl-grip:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.crawl-grip:focus-visible { outline: 2px solid var(--primary, #0C9DB0); outline-offset: -2px; color: #fff; }
.crawl-panel.is-dragging, .crawl-panel.is-dragging * { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.crawl-panel.is-dragging .crawl-row:hover { background: none; }
/* Where the dragged stop will land: an empty dashed slot. */
.crawl-row.is-placeholder {
  outline: 2px dashed rgba(255, 176, 32, 0.7);
  outline-offset: -2px;
  background: rgba(255, 176, 32, 0.08);
}
.crawl-row.is-placeholder > * { visibility: hidden; }
/* The lifted row following the pointer (fixed inside the panel). */
.crawl-ghost {
  position: fixed;
  z-index: 1000;
  box-sizing: border-box;
  margin: 0;
  background: var(--blue-bg-dark, #13283a);
  border: 2px solid #ffb020;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  color: var(--text-light, #fff);
  pointer-events: none;
  transform: scale(1.02);
  opacity: 0.96;
}
@media (prefers-reduced-motion: reduce) { .crawl-ghost { transform: none; } }
.crawl-row-open {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 4px; border: 0; border-radius: 12px; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.crawl-row-open:focus-visible { outline: 2px solid var(--primary, #0C9DB0); outline-offset: -2px; }
.crawl-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.crawl-row-tools { display: flex; gap: 4px; flex: none; }
.crawl-tool {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); color: #fff; cursor: pointer;
}
.crawl-tool:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
.crawl-tool:disabled { opacity: 0.3; cursor: default; }
.crawl-tool:focus-visible { outline: 2px solid var(--primary, #0C9DB0); outline-offset: 2px; }
.crawl-tool-remove:hover:not(:disabled) { background: rgba(255, 90, 122, 0.3); }
.crawl-foot {
  display: flex; gap: 8px; justify-content: space-between;
  padding: 8px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.crawl-foot[hidden] { display: none; }
.crawl-foot-btn {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 38px; padding: 0 16px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1); color: #fff;
  font: 600 14px/1 'Poppins', system-ui, sans-serif; cursor: pointer;
}
.crawl-foot-btn:hover { background: rgba(255, 255, 255, 0.18); }
.crawl-fit { background: #ffb020; color: #2a1a00; }
.crawl-fit:hover { background: #ffc24d; }
.crawl-clear.is-armed { background: #ff5a7a; color: #3a0612; }

/* --- The timeline (crawlTimeline.js) --------------------------------------
   One bar per stop on a shared time axis for the day the map shows. Its own
   scroll box above the stop list, so a 12-stop crawl cannot push the list
   off the panel. Track column starts after the 24px badge + 8px gap. */
.crawl-tl {
  flex: none;
  /* A vh cap: a % max-height means nothing in a panel with no set height,
     and the timeline then squeezed the stop list out on a phone. */
  max-height: min(26vh, 260px);
  overflow-y: auto;
  margin: 0 14px 6px;
  padding: 8px 10px 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}
.crawl-tl[hidden] { display: none; }
.crawl-tl-head { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: rgba(255, 255, 255, 0.72); margin-bottom: 2px; }
.crawl-tl-grid { position: relative; --tl-left: 32px; }
.crawl-tl-axis { position: relative; height: 16px; margin-left: var(--tl-left); margin-right: 4px; }
.crawl-tl-tick {
  position: absolute; top: 0; transform: translateX(-50%);
  font-size: 10.5px; line-height: 16px; white-space: nowrap; color: rgba(255, 255, 255, 0.7);
}
.crawl-tl-tick.is-first { transform: none; }
.crawl-tl-tick.is-last { transform: translateX(-100%); }
/* Gridlines and the now line live in each track (behind its bar; the now
   line over it), so they never cross the words under the bars. */
.crawl-tl-gridline { position: absolute; top: -3px; bottom: -3px; width: 1px; background: rgba(255, 255, 255, 0.1); pointer-events: none; }
.crawl-tl-now { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: #ff5a7a; z-index: 1; border-radius: 1px; pointer-events: none; }
.crawl-tl-now-dot {
  position: absolute; bottom: 0; width: 8px; height: 8px; margin-left: -4px;
  border-radius: 50%; background: #ff5a7a;
}
.crawl-tl-now-text { color: #ff8da3; text-transform: none; letter-spacing: 0; }
.crawl-tl-row { position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; }
.crawl-tl-num { width: 22px; height: 22px; font-size: 11px; flex: none; }
.crawl-tl-row.is-flagged .crawl-tl-num { background: #ff5a7a; color: #3a0612; border-color: #3a0612; }
.crawl-tl-body { flex: 1; min-width: 0; margin-right: 4px; }
.crawl-tl-track { position: relative; height: 12px; margin-top: 5px; }
.crawl-tl-bar {
  position: absolute; top: 0; bottom: 0; min-width: 3px;
  border-radius: 6px; background: #ffb020;
  box-shadow: 0 0 0 1px rgba(42, 26, 0, 0.6);
}
.crawl-tl-row.is-ended .crawl-tl-bar { background: rgba(255, 255, 255, 0.28); box-shadow: none; }
.crawl-tl-row.is-out-of-order .crawl-tl-bar {
  background: repeating-linear-gradient(135deg, #ff5a7a 0 6px, #d43c5c 6px 12px);
}
.crawl-tl-missing {
  position: absolute; inset: 0; display: flex; align-items: center;
  padding-left: 8px; border: 1px dashed rgba(255, 255, 255, 0.3); border-radius: 6px;
  font-size: 10.5px; font-style: italic; color: rgba(255, 255, 255, 0.72); line-height: 1;
}
.crawl-tl-note { margin-top: 3px; font-size: 11.5px; line-height: 1.35; color: rgba(255, 255, 255, 0.72); }
.crawl-tl-name { color: #fff; font-weight: 600; }
.crawl-tl-note .is-flag { color: #ff8da3; font-weight: 600; }

/* --- Stop numbers (on the map and in the panel) --------------------------- */
.crawl-badge-icon { background: none; border: 0; }
.crawl-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; box-sizing: border-box;
  border: 2px solid #2a1a00; border-radius: 50%;
  background: #ffb020; color: #2a1a00;
  font: 800 13px/1 'Poppins', system-ui, sans-serif;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.crawl-badge-icon .crawl-badge { cursor: pointer; }
.crawl-row-num { flex: none; }

/* The route draws under the pins (overlay pane) and never takes a tap. */
.crawl-route-line, .crawl-route-casing { pointer-events: none; }

/* Hidden in admin mode's panel and under the same layers as the bar's list. */
body:has(#admin-panel-modal[style*="flex"]) .crawl-panel { display: none; }
@media (max-width: 768px) {
  body:has(#control-panel:not(.hidden)) .crawl-panel { display: none; }
}

/* --- "Start this crawl" sheet (/?crawl=<id> with stops already saved) ----
   An in-page sheet, never confirm(): centred card on a wide screen, a sheet
   from the bottom on a phone. Same dark family as the crawl panel. */
.crawl-start-layer { position: fixed; inset: 0; z-index: 2500; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.crawl-start-backdrop { position: absolute; inset: 0; background: rgba(6, 12, 24, 0.55); opacity: 0; transition: opacity 0.2s ease; }
.crawl-start-sheet {
  position: relative;
  width: min(400px, 100%);
  box-sizing: border-box;
  padding: 22px 22px 18px;
  background-color: var(--blue-bg-dark, #14213d);
  border: 3px solid var(--blue-accent, #3a5a99);
  border-radius: 22px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  color: var(--text-light, #fff);
  font-family: 'Poppins', system-ui, sans-serif;
  text-align: center;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.crawl-start-layer.is-open .crawl-start-backdrop,
.crawl-start-layer.is-open .crawl-start-sheet { opacity: 1; }
.crawl-start-layer.is-open .crawl-start-sheet { transform: none; }
.crawl-start-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 176, 32, 0.16); color: #ffb020;
}
.crawl-start-icon svg { width: 22px; height: 22px; }
.crawl-start-title { margin: 10px 0 2px; font-size: 19px; font-weight: 800; line-height: 1.25; }
.crawl-start-where { margin: 0 0 12px; font-size: 13px; color: #c9d4ea; }
.crawl-start-text { margin: 0 0 6px; font-size: 15px; }
.crawl-start-note { margin: 0 0 6px; font-size: 13px; color: #ffd27a; }
.crawl-start-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.crawl-start-btn {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: 700 15px/1 'Poppins', system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.crawl-start-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
.crawl-start-btn:focus-visible { outline: 2px solid #ffd27a; outline-offset: 2px; }
.crawl-start-btn:disabled { opacity: 0.45; cursor: default; }
/* Dark ink on the amber: white would fail contrast (see .crawl-btn.is-on). */
.crawl-start-btn.is-primary { background: #ffb020; border-color: #ffb020; color: #2a1a00; }
.crawl-start-btn.is-primary:hover { background: #ffc04d; }
.crawl-start-btn.is-quiet { background: transparent; border-color: transparent; color: #c9d4ea; }
@media (max-width: 768px) {
  .crawl-start-layer { align-items: flex-end; padding: 0; }
  .crawl-start-sheet {
    width: 100%;
    border-width: 3px 0 0;
    border-radius: 22px 22px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    transform: translateY(24px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .crawl-start-sheet, .crawl-start-backdrop { transition: none; }
}
