/*
 * HW Dealer Locator finder. Everything is scoped to .hwdl and themed with
 * --hwdl-* variables; override them from Bricks or Automatic.css, e.g.
 *   .hwdl { --hwdl-accent: var(--primary); --hwdl-font-heading: var(--heading-font-family); }
 * --hwdl-accent and --hwdl-height are set inline from Dealers > Settings.
 */
.hwdl {
  --hwdl-accent: #1c4bad;
  --hwdl-on-accent: #fff;
  --hwdl-accent-soft: color-mix(in srgb, var(--hwdl-accent) 9%, transparent);
  --hwdl-bg: #fff;
  --hwdl-bg-2: #f3f4f2;
  --hwdl-line: #dfe2dd;
  --hwdl-fg: #1b1f1c;
  --hwdl-muted: #5b635d;
  --hwdl-open: #1d7a3b;
  --hwdl-closed: #b3261e;
  --hwdl-me: #1a73e8;
  --hwdl-radius: 14px;
  --hwdl-shadow: 0 1px 2px rgb(20 30 20 / .12), 0 6px 18px rgb(20 30 20 / .10);
  --hwdl-font-heading: var(--heading-font-family, inherit);
  --hwdl-height: 640px;

  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "search map" "results map";
  height: var(--hwdl-height);
  background: var(--hwdl-bg);
  color: var(--hwdl-fg);
  border: 1px solid var(--hwdl-line);
  border-radius: var(--hwdl-radius);
  overflow: hidden;
  box-shadow: var(--hwdl-shadow);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
}
.hwdl *, .hwdl *::before, .hwdl *::after { box-sizing: border-box; }
.hwdl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Theme frameworks (Automatic.css, Bricks) style generic elements; keep the finder's own layout. */
.hwdl > *, .hwdl-search > *, .hwdl-results > * { max-width: none; margin: 0; }
.hwdl-results, .hwdl-search { padding-inline: 0; }
.hwdl [hidden] { display: none !important; }
.hwdl button, .hwdl input { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; }
.hwdl button { cursor: pointer; }
.hwdl :focus-visible { outline: 2px solid var(--hwdl-accent); outline-offset: 2px; }
.hwdl-i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Search */
.hwdl .hwdl-search { grid-area: search; padding: 14px 14px 10px; display: grid; gap: 10px; border-right: 1px solid var(--hwdl-line); position: relative; z-index: 5; background: var(--hwdl-bg); }
.hwdl-searchbox { display: flex; align-items: center; gap: 4px; background: var(--hwdl-bg); border: 1px solid var(--hwdl-line); border-radius: 999px; padding: 4px 4px 4px 14px; box-shadow: 0 1px 3px rgb(0 0 0 / .08); }
.hwdl-searchbox:focus-within { border-color: var(--hwdl-accent); box-shadow: 0 0 0 3px var(--hwdl-accent-soft); }
.hwdl-searchbox > svg { color: var(--hwdl-muted); }
.hwdl .hwdl-searchbox input { flex: 1; min-width: 0; border: 0; border-radius: 0; background: transparent; padding: 8px 6px; margin: 0; outline: none; box-shadow: none; height: auto; }
/* The pill shows focus (:focus-within above), so drop the theme's ring on the field itself. */
.hwdl .hwdl-searchbox input:focus, .hwdl .hwdl-searchbox input:focus-visible { border: 0; outline: none; box-shadow: none; }
.hwdl .hwdl-icon-btn { width: 36px; height: 36px; min-width: 0; min-height: 0; padding: 0; border-radius: 999px; border: 0; background: transparent; display: inline-grid; place-items: center; color: var(--hwdl-muted); text-decoration: none; }
.hwdl .hwdl-icon-btn:hover { background: var(--hwdl-bg-2); color: var(--hwdl-fg); }
.hwdl .hwdl-locate, .hwdl .hwdl-locate:hover { color: var(--hwdl-me); }
.hwdl .hwdl-locate.is-on, .hwdl .hwdl-locate.is-on:hover { background: var(--hwdl-me); color: #fff; }
/* Stands in for the field while the visitor's location is used; clicking it brings the field back. */
.hwdl .hwdl-where { flex: 1; min-width: 0; min-height: 0; height: auto; border-radius: 0; box-shadow: none; color: var(--hwdl-fg); display: flex; align-items: baseline; gap: 8px; border: 0; background: none; padding: 8px 6px; margin: 0; text-align: left; white-space: nowrap; overflow: hidden; cursor: text; }
.hwdl-where small { font-size: 12px; color: var(--hwdl-muted); overflow: hidden; text-overflow: ellipsis; }
.hwdl-locate.is-busy svg { animation: hwdl-spin 1s linear infinite; }
@keyframes hwdl-spin { to { transform: rotate(360deg); } }
.hwdl-suggest { position: absolute; left: 14px; right: 14px; top: 62px; background: var(--hwdl-bg); border: 1px solid var(--hwdl-line); border-radius: 12px; box-shadow: var(--hwdl-shadow); padding: 6px; list-style: none; margin: 0; z-index: 20; max-height: 360px; overflow: auto; }
.hwdl-suggest > li { margin: 0; }
.hwdl-suggest .grp { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--hwdl-muted); padding: 8px 10px 4px; }
.hwdl-suggest .opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.hwdl-suggest .opt svg { color: var(--hwdl-muted); }
.hwdl-suggest .opt.me, .hwdl-suggest .opt.me svg { color: var(--hwdl-me); }
.hwdl-suggest .opt small { color: var(--hwdl-muted); margin-left: auto; white-space: nowrap; padding-left: 8px; }
.hwdl-suggest .opt[aria-selected="true"], .hwdl-suggest .opt:hover { background: var(--hwdl-bg-2); }
.hwdl-suggest .powered { text-align: right; font-size: 11px; color: var(--hwdl-muted); padding: 4px 10px 2px; }
.hwdl-radius { display: grid; gap: 4px; }
.hwdl-radius-label { font-size: 12px; font-weight: 600; color: var(--hwdl-muted); }
/* One connected row of distance buttons. */
.hwdl-seg { display: flex; gap: 0; border: 1px solid var(--hwdl-line); border-radius: 999px; padding: 3px; background: var(--hwdl-bg-2); }
/* Every box property is set, so theme button styles (min-height, alignment, padding) can't leak in. */
.hwdl .hwdl-chip { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; margin: 0; min-width: 0; min-height: 0; height: auto; border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 500; line-height: 1.2; text-align: center; white-space: nowrap; color: var(--hwdl-fg); box-shadow: none; position: relative; }
.hwdl .hwdl-chip:hover { background: var(--hwdl-bg); }
.hwdl .hwdl-chip[aria-pressed="true"] { background: var(--hwdl-accent); color: var(--hwdl-on-accent); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / .15); }
/* Dividers between buttons, hidden next to the selected one and the one under the pointer. */
.hwdl .hwdl-chip + .hwdl-chip::before { content: ""; position: absolute; left: 0; top: 28%; bottom: 28%; width: 1px; background: var(--hwdl-line); transition: opacity .15s; }
.hwdl .hwdl-chip[aria-pressed="true"]::before, .hwdl .hwdl-chip[aria-pressed="true"] + .hwdl-chip::before,
.hwdl .hwdl-chip:hover::before, .hwdl .hwdl-chip:hover + .hwdl-chip::before { opacity: 0; }

/* Results */
.hwdl-results { grid-area: results; min-height: 0; overflow: auto; border-right: 1px solid var(--hwdl-line); overscroll-behavior: contain; }
.hwdl .hwdl-near { border: 0; background: none; padding: 0; margin: 0; min-height: 0; height: auto; border-radius: 0; box-shadow: none; color: var(--hwdl-me); font-weight: 600; }
.hwdl .hwdl-near:hover { text-decoration: underline; text-underline-offset: 3px; }
.hwdl-res-head { position: sticky; top: 0; background: var(--hwdl-bg); padding: 10px 16px; border-bottom: 1px solid var(--hwdl-line); font-weight: 600; text-align: left; z-index: 2; }
.hwdl-list { list-style: none; margin: 0; padding: 0; }
.hwdl-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px 16px; margin: 0; border-bottom: 1px solid var(--hwdl-line); cursor: pointer; position: relative; }
.hwdl-item:hover, .hwdl-item.is-hot { background: var(--hwdl-bg-2); }
.hwdl-item.is-selected { background: var(--hwdl-accent-soft); }
.hwdl-item.is-selected::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--hwdl-accent); }
.hwdl .hwdl-item-title { border: 0; background: none; padding: 0; margin: 0; text-align: left; font-family: var(--hwdl-font-heading); font-size: 15.5px; font-weight: 500; line-height: 1.3; color: inherit; text-decoration: none; }
.hwdl .hwdl-item-title:hover { color: var(--hwdl-accent); text-decoration: underline; text-underline-offset: 3px; }
.hwdl-item-meta { font-size: 13px; color: var(--hwdl-muted); }
.hwdl-item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0; }
.hwdl-dist { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hwdl-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: .04em; text-transform: uppercase; color: var(--hwdl-accent); }
.hwdl-badge svg { display: block; flex: none; width: 12px; height: 12px; fill: currentColor; }
.hwdl-item .hwdl-badge { display: flex; margin-bottom: 4px; }
.hwdl-ptag { display: inline-block; font-size: 12px; background: var(--hwdl-bg-2); border: 1px solid var(--hwdl-line); border-radius: 999px; padding: 2px 10px; margin-top: 4px; }
.hwdl-open { color: var(--hwdl-open); font-weight: 600; }
.hwdl-closed { color: var(--hwdl-closed); font-weight: 600; }
.hwdl-empty { padding: 28px 20px; display: grid; gap: 10px; justify-items: start; cursor: default; }
.hwdl .hwdl-empty h3 { margin: 0; font-family: var(--hwdl-font-heading); font-size: 17px; font-weight: 700; line-height: 1.25; letter-spacing: normal; text-transform: none; color: inherit; }
.hwdl-empty p { margin: 0; color: var(--hwdl-muted); }
.hwdl .hwdl-btn { min-width: 0; min-height: 0; height: auto; font-size: 14px; border: 1px solid var(--hwdl-accent); background: var(--hwdl-accent); color: var(--hwdl-on-accent); border-radius: 999px; padding: 7px 16px; font-weight: 600; }
.hwdl .hwdl-btn.ghost { background: transparent; color: var(--hwdl-accent); }

/* Map */
.hwdl-map-wrap { grid-area: map; position: relative; min-height: 0; background: #e8e6df; }
.hwdl-map { position: absolute; inset: 0; }
.hwdl-map-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--hwdl-muted); }
.hwdl .hwdl-fit { position: absolute; right: 10px; top: 10px; height: 40px; min-width: 0; min-height: 0; margin: 0; padding: 0 14px 0 12px; border: 0; border-radius: 8px; background: #fff; color: #333; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; line-height: 1; box-shadow: 0 1px 4px rgb(0 0 0 / .3); z-index: 2; outline: none; }
.hwdl .hwdl-fit[hidden] { display: none; }
.hwdl .hwdl-fit:hover { background: #f2f2f2; }
.hwdl .hwdl-fit:focus-visible { outline: 2px solid var(--hwdl-accent); outline-offset: 2px; }

/* Pins (Advanced Marker content) */
.hwdl-pin { position: relative; display: block; cursor: pointer; transform-origin: 50% 100%; transition: transform .15s ease; }
.hwdl-pin.is-hot { transform: scale(1.18); }
.hwdl-pin.is-selected { transform: scale(1.32); }
.hwdl-pin svg { width: 28px; height: 38px; display: block; filter: drop-shadow(0 1px 1.5px rgb(0 0 0 / .35)); }
.hwdl-pin .body { fill: var(--hwdl-accent); stroke: color-mix(in srgb, var(--hwdl-accent) 70%, #000); stroke-width: 1.2; }
.hwdl-pin .hole { fill: var(--hwdl-on-accent); }
.hwdl-pin-label { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 4px; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--hwdl-fg); background: var(--hwdl-bg); padding: 2px 8px; border-radius: 6px; box-shadow: 0 1px 3px rgb(0 0 0 / .2); display: none; pointer-events: none; font-family: inherit; }
.hwdl-pin:hover .hwdl-pin-label, .hwdl-pin.is-hot .hwdl-pin-label, .hwdl-pin.is-selected .hwdl-pin-label, .hwdl.show-labels .hwdl-pin-label { display: block; }
.hwdl-cluster { width: 38px; height: 38px; border-radius: 50%; background: var(--hwdl-accent); color: var(--hwdl-on-accent); font-weight: 700; font-size: 14px; box-shadow: 0 0 0 6px var(--hwdl-accent-soft), 0 2px 6px rgb(0 0 0 / .3); display: grid; place-items: center; transform: translateY(50%); cursor: pointer; }
.hwdl-me { width: 18px; height: 18px; border-radius: 50%; background: var(--hwdl-me); border: 3px solid #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .35); transform: translateY(50%); animation: hwdl-halo 2s ease-out infinite; }
@keyframes hwdl-halo { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--hwdl-me) 45%, transparent), 0 1px 4px rgb(0 0 0 / .35); } 100% { box-shadow: 0 0 0 18px transparent, 0 1px 4px rgb(0 0 0 / .35); } }

/* Details popup */
/* Scroll areas: no scrollbar until the pointer is over them, then a thin one. */
.hwdl-results, .hwdl-modal, .hwdl-suggest { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.hwdl-results:hover, .hwdl-modal:hover, .hwdl-suggest:hover { scrollbar-color: var(--hwdl-line) transparent; }
.hwdl-modal { border: 0; padding: 0; border-radius: 16px; background: var(--hwdl-bg); color: var(--hwdl-fg); overscroll-behavior: contain; overflow: auto; }
/* Desktop: a card over the top-left of the map. Positions are explicit so theme dialog styles can't move it. */
.hwdl-modal:not(:modal) { position: absolute; inset: 12px auto auto 12px; margin: 0; z-index: 5; width: min(400px, calc(100% - 24px)); max-width: none; max-height: calc(100% - 24px); box-shadow: 0 8px 30px rgb(0 0 0 / .28); }
/* Phones: a modal bottom sheet. */
.hwdl-modal:modal { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; max-height: 85dvh; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -8px 30px rgb(0 0 0 / .3); animation: hwdl-up .22s ease-out; }
.hwdl-modal::backdrop { background: rgb(10 15 12 / .45); }
.hwdl-modal-inner { padding: 20px; position: relative; }
.hwdl-modal-close { position: absolute; right: 10px; top: 10px; }
.hwdl-detail { display: grid; gap: 16px; font-size: 14px; line-height: 1.45; }
.hwdl-detail-head { display: flex; gap: 14px; align-items: flex-start; padding-right: 28px; }
.hwdl-avatar { width: 54px; height: 54px; border-radius: 12px; background: var(--hwdl-accent); color: var(--hwdl-on-accent); display: grid; place-items: center; font-family: var(--hwdl-font-heading); font-weight: 900; font-size: 19px; flex: none; }
.hwdl-detail h2 { margin: 0; font-family: var(--hwdl-font-heading); font-weight: 900; font-size: 21px; line-height: 1.2; text-wrap: balance; color: inherit; }
.hwdl-sub { margin: 4px 0 0; color: var(--hwdl-muted); font-size: 13px; }
.hwdl-actions { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 6px; border-block: 1px solid var(--hwdl-line); padding-block: 12px; }
.hwdl .hwdl-act { min-width: 0; min-height: 0; height: auto; line-height: 1.3; display: grid; justify-items: center; gap: 6px; border: 0; background: none; color: var(--hwdl-accent); text-decoration: none; font-size: 12px; font-weight: 600; padding: 2px; border-radius: 8px; text-align: center; }
.hwdl-act .circ { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--hwdl-line); display: grid; place-items: center; }
.hwdl-act.primary .circ { background: var(--hwdl-accent); color: var(--hwdl-on-accent); border-color: var(--hwdl-accent); }
.hwdl-act:hover .circ { background: var(--hwdl-accent-soft); }
.hwdl-act.primary:hover .circ { background: var(--hwdl-accent); filter: brightness(1.08); }
.hwdl-facts { display: grid; gap: 12px; margin: 0; }
.hwdl-fact { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; }
.hwdl-fact > svg { color: var(--hwdl-accent); margin-top: 1px; }
.hwdl-fact a { color: inherit; }
.hwdl-hours { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 0; font-variant-numeric: tabular-nums; border: 0; }
.hwdl-hours td { padding: 2px 0; border: 0; background: none; }
.hwdl-hours td:last-child { text-align: right; color: var(--hwdl-muted); }
.hwdl-hours tr.today td { font-weight: 700; color: var(--hwdl-fg); }
.hwdl-notes { margin: 0; white-space: pre-line; }
.hwdl .hwdl-more { font-weight: 600; color: var(--hwdl-accent); text-decoration: none; justify-self: start; }
.hwdl .hwdl-more:hover { color: var(--hwdl-accent); text-decoration: underline; }

/* Gallery + lightbox */
.hwdl-gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -20px; padding: 0 20px 4px; scrollbar-width: thin; }
.hwdl .hwdl-thumb { min-width: 0; min-height: 0; flex: none; width: 112px; height: 84px; padding: 0; border: 0; border-radius: 10px; overflow: hidden; scroll-snap-align: start; background: var(--hwdl-bg-2); }
.hwdl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.hwdl-thumb:hover img { transform: scale(1.05); }
.hwdl-lightbox { border: 0; padding: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: rgb(0 0 0 / .92); color: #fff; touch-action: pan-y; }
.hwdl-lightbox::backdrop { background: rgb(0 0 0 / .92); }
.hwdl-lightbox figure { margin: 0; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; padding: 56px 16px 16px; }
.hwdl-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.hwdl-lightbox figcaption { font-size: 13px; opacity: .8; padding-top: 8px; min-height: 1.5em; }
.hwdl .hwdl-lb-btn { min-width: 0; min-height: 0; position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .14); color: #fff; display: grid; place-items: center; padding: 0; }
.hwdl .hwdl-lb-btn:hover { color: #fff; background: rgb(255 255 255 / .26); }
.hwdl-lb-btn .hwdl-i { width: 22px; height: 22px; }
.hwdl-lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.hwdl-lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.hwdl-lb-close { right: 12px; top: 12px; }

.hwdl-toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--hwdl-fg); color: var(--hwdl-bg); padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: var(--hwdl-shadow); z-index: 100000; max-width: min(460px, calc(100% - 32px)); }

/* Phones: search, then map, then list; details slide up from the bottom. */
@media (max-width: 760px) {
  .hwdl {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 45vh auto;
    grid-template-areas: "search" "map" "results";
    height: auto;
  }
  .hwdl .hwdl-search, .hwdl-results { border-right: 0; }
  .hwdl .hwdl-search { border-bottom: 1px solid var(--hwdl-line); }
  .hwdl-results { max-height: 70vh; }
  .hwdl .hwdl-lb-prev, .hwdl .hwdl-lb-next { width: 36px; height: 36px; }
}
@keyframes hwdl-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .hwdl-me, .hwdl-modal:modal, .hwdl-locate.is-busy svg { animation: none; }
  .hwdl-pin, .hwdl-thumb img { transition: none; }
}

/* Dealer page helpers (Bricks tags / [hw_dealer_field]) */
.hwdl-hours-note { margin: 0; }
table.hwdl-hours { max-width: 360px; }
