/* The map's interest filter (interests/includes/explore-row.html, docs/INTEREST_EXPLORE.md).
   One compact control on one surface, floating over the map inside .map-container in one fixed
   place: on a desktop to the right of the place panel (416px on the home map) and left of the
   map controls, on a phone just above the bottom navigation. It never moves other UI. Tokens
   only (seo/css/ds-tokens.css), 4px grid. A chosen option is a brand tint under an ink label
   (and a check on a genre): the page's one filled button is its primary action, never a filter. */
.interest-explore {
  position: absolute;
  z-index: 2;
  top: calc(var(--map-header-height, 64px) + var(--ds-space-4));
  left: calc(416px + var(--ds-space-8));
  right: calc(160px + var(--ds-space-4));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--ds-space-2);
  pointer-events: none;
  font-family: var(--ds-font-sans);
  font-size: var(--ds-font-size-bodySm);
  line-height: var(--ds-line-height-bodySm);
  color: var(--ds-ink);
}
.interest-explore > * { pointer-events: auto; }
.interest-explore *,
.interest-explore *::before,
.interest-explore *::after { box-sizing: border-box; }
.interest-explore [hidden] { display: none !important; }
/* The map-first shell (exp_home_discovery_panel): on a desktop the upper left of its map is free,
   left of the intro card and the control rail; while another panel or a place is open, or on a
   phone (its intro card and dock already hold the top and bottom), the row steps aside. */
.map-first-shell .interest-explore {
  top: calc(var(--explorer-header-height) + var(--ds-space-4));
  left: var(--ds-space-4);
  right: calc(var(--explorer-map-controls-width) + var(--ds-space-16) * 7 + var(--ds-space-4));
}
/* The Highlighted Moments card sits above the map at the lower left: the panel ends before it. */
.map-first-shell .interest-explore__panel {
  max-height: calc(100dvh - var(--explorer-header-height) - var(--explorer-dock-clearance) - 300px);
}
.map-first-shell[data-explorer-panel]:not([data-explorer-panel="map"]) .interest-explore,
.map-first-shell.map-first-detail-open .interest-explore { display: none; }

/* The one surface: the kinds at rest; the chosen kind's genres and the count join them inside it. */
.interest-explore__bar {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-1);
  max-width: min(560px, 100%);
  padding: var(--ds-space-1);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-card);
  box-shadow: var(--ds-shadow-card);
}
.interest-explore__row { display: flex; align-items: center; }
.interest-explore__chips {
  display: flex;
  gap: var(--ds-space-1);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.interest-explore__chips::-webkit-scrollbar { display: none; }
.interest-explore__chip {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--ds-space-1);
  min-height: calc(var(--ds-space-8) + var(--ds-space-1));
  padding: 0 var(--ds-space-3);
  border: 0;
  border-radius: var(--ds-radius-md);
  background: transparent;
  color: var(--ds-ink-soft);
  font: 600 var(--ds-font-size-bodySm) / var(--ds-line-height-bodySm) var(--ds-font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1), color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
/* The surface's own padding belongs to the option, so a small control still has a 44px target. */
.interest-explore__chip::after { content: ""; position: absolute; inset: calc(-1 * var(--ds-space-1)) 0; }
.interest-explore__chip:hover { background: var(--ds-surface); color: var(--ds-ink); }
.interest-explore__chip[aria-pressed="true"] {
  background: color-mix(in srgb, var(--ds-brand) 16%, var(--ds-card));
  color: var(--ds-ink);
}
.interest-explore__chip-check { font-size: var(--ds-font-size-h4); }
.interest-explore__chip[aria-pressed="false"] .interest-explore__chip-check { display: none; }
.interest-explore :is(button, a, input):focus-visible { outline: 3px solid var(--ds-focus); outline-offset: 2px; }
/* One scrolling line of genres, fading where it runs on. The mask only reads the gradient's alpha. */
.interest-explore__genres {
  padding-inline-end: var(--ds-space-8);
  -webkit-mask-image: linear-gradient(to right, black calc(100% - var(--ds-space-10)), transparent);
  mask-image: linear-gradient(to right, black calc(100% - var(--ds-space-10)), transparent);
}
.interest-explore__genres .interest-explore__chip { font-weight: 500; }

.interest-explore__search {
  position: relative;
  display: flex;
  flex: 1 1 320px;
  align-items: center;
  min-width: min(240px, 100%);
  max-width: 400px;
  min-height: 44px;
  border: 1px solid var(--ds-input-border);
  border-radius: var(--ds-radius-pill);
  background: var(--ds-card);
  box-shadow: var(--ds-shadow-card);
}
.interest-explore__search-icon { position: absolute; left: var(--ds-space-3); color: var(--ds-ink-soft); font-size: 20px; }
.interest-explore__search input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--ds-space-4) 0 var(--ds-space-10);
  border: 0;
  border-radius: var(--ds-radius-pill);
  background: transparent;
  color: var(--ds-ink);
  font: 400 var(--ds-font-size-body) / var(--ds-line-height-body) var(--ds-font-sans);
}
.interest-explore__search input::placeholder { color: var(--ds-ink-soft); }
.interest-explore__results {
  position: absolute;
  top: calc(100% + var(--ds-space-1));
  left: 0;
  right: 0;
  max-height: 320px;
  margin: 0;
  padding: var(--ds-space-1);
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  background: var(--ds-elevated);
  box-shadow: var(--ds-shadow-elevated);
}
.interest-explore__result {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 44px;
  padding: var(--ds-space-2) var(--ds-space-3);
  border-radius: var(--ds-radius-sm);
  cursor: pointer;
}
.interest-explore__result[aria-selected="true"],
.interest-explore__result:hover { background: color-mix(in srgb, var(--ds-brand) 12%, var(--ds-card)); }
.interest-explore__result-name { font-weight: 600; }
.interest-explore__result-meta,
.interest-explore__result--empty { color: var(--ds-ink-soft); font-size: var(--ds-font-size-caption); line-height: var(--ds-line-height-caption); }
.interest-explore__result--empty { cursor: default; }

/* The count, as the surface's caption. */
.interest-explore__status:empty { display: none; }
.interest-explore__status {
  margin: 0;
  padding: 0 var(--ds-space-3) var(--ds-space-1);
  color: var(--ds-ink-soft);
  font: 400 var(--ds-font-size-caption) / var(--ds-line-height-caption) var(--ds-font-sans);
}

.interest-explore__panel {
  width: min(400px, 100%);
  /* Ends above the guest sign-up bar and the bottom map controls. */
  max-height: calc(100vh - var(--map-header-height, 64px) - 260px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--ds-space-4);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-card);
  box-shadow: var(--ds-shadow-elevated);
}
.interest-explore__panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--ds-space-2); }
.interest-explore__panel-type {
  margin: 0 0 var(--ds-space-1);
  color: var(--ds-link);
  font-size: var(--ds-font-size-overline);
  line-height: var(--ds-line-height-overline);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.interest-explore__panel-title {
  margin: 0;
  font: 700 var(--ds-font-size-h4) / var(--ds-line-height-h4) var(--ds-font-display);
  overflow-wrap: anywhere;
}
.interest-explore__panel-title:focus { outline: none; }
.interest-explore__panel-reach { margin: var(--ds-space-1) 0 0; color: var(--ds-ink-soft); }
.interest-explore__close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--ds-radius-pill);
  background: transparent;
  color: var(--ds-ink);
  cursor: pointer;
}
.interest-explore__close:hover { background: var(--ds-surface); }
.interest-explore__panel-actions { margin: var(--ds-space-3) 0; }
.interest-explore__panel-actions .subject-follow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-3); }
.interest-explore__follow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 44px;
  padding: 0 var(--ds-space-5);
  border: 1px solid var(--ds-brand);
  border-radius: var(--ds-radius-md);
  background: var(--ds-brand);
  color: var(--ds-on-cta);
  font: 600 var(--ds-font-size-label) / var(--ds-line-height-label) var(--ds-font-sans);
  text-decoration: none;
  cursor: pointer;
}
.interest-explore__follow:hover { background: var(--ds-brand-hover); border-color: var(--ds-brand-hover); }
.interest-explore__follow.is-following { background: var(--ds-card); color: var(--ds-ink); }
.interest-explore .subject-follow__followers { color: var(--ds-ink-soft); }
.interest-explore .subject-follow__status:not(.sr-only) { flex-basis: 100%; margin: 0; color: var(--ds-error-text); }
.interest-explore__memories { margin: 0; padding: 0; list-style: none; }
.interest-explore__memories li + li { border-top: 1px solid var(--ds-line); }
.interest-explore__memory {
  display: flex;
  align-items: center;
  gap: var(--ds-space-3);
  min-height: 56px;
  padding: var(--ds-space-2) 0;
  color: var(--ds-ink);
  text-decoration: none;
}
.interest-explore__memory img,
.interest-explore__memory-placeholder {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface);
  object-fit: cover;
}
.interest-explore__memory-title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.interest-explore__memory-meta { display: block; color: var(--ds-ink-soft); font-size: var(--ds-font-size-caption); line-height: var(--ds-line-height-caption); }
.interest-explore__panel-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ds-space-2); margin-top: var(--ds-space-2); }
.interest-explore__more,
.interest-explore__page-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--ds-space-3);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  background: var(--ds-card);
  color: var(--ds-link);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.interest-explore__more:hover,
.interest-explore__page-link:hover { background: var(--ds-surface); }

/* While a facet is on the map, its points replace the memory markers; Blox stay. */
#map.mb-interest-explore-active .mb-map-marker { visibility: hidden; }

@media (max-width: 812px) {
  .map-first-shell .interest-explore { display: none; }
  .interest-explore {
    top: auto;
    left: var(--ds-space-4);
    right: var(--ds-space-4);
    /* Above the 66px bottom navigation and the two lines of map attribution over it. */
    bottom: calc(66px + var(--ds-space-12) + var(--ds-space-2) + env(safe-area-inset-bottom, 0px));
    flex-direction: column-reverse;
  }
  /* The kinds stay next to the thumb; the genres and the count open above them. */
  .interest-explore__bar { flex-direction: column-reverse; }
  /* The Mystery Box launcher floats at this height on the right: the surface ends before it. */
  body:has(.mystery-box-entry) .interest-explore__bar { max-width: calc(100% - var(--ds-space-16) - var(--ds-space-4)); }
  .interest-explore__chip { min-height: calc(var(--ds-space-10) + var(--ds-space-1)); }
  .interest-explore__chip::after { content: none; }
  .interest-explore__status { padding: var(--ds-space-1) var(--ds-space-3) 0; }
  .interest-explore__search { flex: none; min-width: 0; max-width: none; }
  .interest-explore__results { top: auto; bottom: calc(100% + var(--ds-space-1)); max-height: 40vh; }
  .interest-explore__panel { width: 100%; max-height: 45vh; }
  .map-first-shell .interest-explore.has-subject { display: flex; }
  .map-first-shell .interest-explore__panel { max-height: 45dvh; }
  .map-first-shell .interest-explore.has-subject .interest-explore__row { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .interest-explore__chip { transition: none; }
}
