@import url('/assets/css/bomforge-brand.css?v=bf5');

/* ============================================================
   Filter panel v2 — collapsible panel, disclosure sections, and
   the searchable country picker. Layered over atlas-shell.css;
   every color is a token so light and dark both hold.
   ============================================================ */

/* ── Title bar: hero + collapse control ─────────────────────── */
.fp-titlebar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.fp-titlebar h1 {
  flex: 1 1 auto;
  font-size: 17px;
  line-height: 1.35;
  margin-bottom: 4px;
}
.fp-collapse-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: -4px -6px 0 0;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--ink-3);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.fp-collapse-btn:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.fp-collapse-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.panel-sub {
  margin-bottom: 8px;
}
.panel-stats {
  margin-bottom: 4px;
}

/* ── Disclosure sections ────────────────────────────────────── */
.fp-section {
  margin: 0 -16px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
}
.fp-sec-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.fp-sec-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  transition: color 0.15s;
}
.fp-sec-head:hover .fp-sec-title {
  color: var(--ink);
}
.fp-sec-hint {
  margin-left: auto;
  min-width: 0;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.fp-sec-chev {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease-out;
}
.fp-sec-head[aria-expanded='false'] .fp-sec-chev {
  transform: rotate(-90deg);
}

/* Body collapse: grid-rows animation, one wrapper, no JS measuring. */
.fp-sec-clip {
  display: grid;
  grid-template-rows: 1fr;
  /* minmax(0,1fr): an auto track would size to the content's max-content
     width and push the body past the panel edge. */
  grid-template-columns: minmax(0, 1fr);
  transition: grid-template-rows 0.2s ease-out;
}
.fp-section[data-open='false'] .fp-sec-clip {
  grid-template-rows: 0fr;
}
.fp-sec-body {
  overflow: hidden;
  min-height: 0;
  padding-bottom: 10px;
}
.fp-section[data-open='false'] .fp-sec-body {
  padding-bottom: 0;
}
/* While the country popover is open its section must not clip it. */
.fp-section.fp-pop-open .fp-sec-clip,
.fp-section.fp-pop-open .fp-sec-body {
  overflow: visible;
}

/* The section header already says Focus / Where; the old inline labels
   would say it twice. JS still toggles their inline display as a signal,
   so hide them visually instead of touching the wiring. */
#domainChipsLabel,
#countryLabel {
  display: none !important;
}
.fp-sec-body .search-row {
  margin-bottom: 8px;
}
.fp-sec-body .country-note {
  margin: 8px 0 0;
}
.fp-sec-body .ts-segments,
.fp-sec-body .ts-legend {
  margin-bottom: 0;
}
.fp-sec-body .ts-legend {
  margin-top: 8px;
}
.fp-sec-body .ts-domains {
  margin-bottom: 8px;
}

/* ── Searchable country picker ──────────────────────────────── */
/* The native select stays in the DOM as the source of truth for
   map-globe.js; it is only removed from the visual and a11y tree. */
.fp-native-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.fp-combobox {
  position: relative;
}
.fp-combo-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  background: var(--paper-2);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.fp-combo-btn:hover {
  border-color: var(--ink-3);
}
.fp-combo-btn[aria-expanded='true'] {
  border-color: var(--accent);
  background: var(--paper);
}
.fp-combo-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fp-combo-btn svg {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease-out;
}
.fp-combo-btn[aria-expanded='true'] svg {
  transform: rotate(180deg);
}
.fp-combo-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.1),
    0 18px 48px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.fp-combo-search {
  display: block;
  width: 100%;
  padding: 11px 12px;
  background: var(--paper);
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 13.5px;
  font-family: inherit;
}
.fp-combo-search:focus {
  outline: none;
  border-bottom-color: var(--accent);
}
.fp-combo-search::placeholder {
  color: var(--ink-3);
}
.fp-combo-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: min(280px, 32vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.fp-combo-list::-webkit-scrollbar {
  width: 8px;
}
.fp-combo-list::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}
.fp-combo-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.fp-combo-list li .fp-co-n {
  flex-shrink: 0;
  color: var(--ink-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.fp-combo-list li:hover,
.fp-combo-list li.fp-active {
  background: var(--paper-2);
}
.fp-combo-list li.fp-active {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.fp-combo-list li[aria-selected='true'] {
  font-weight: 700;
  color: var(--accent);
}
.fp-combo-empty {
  padding: 14px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: default !important;
}
.fp-combo-empty:hover {
  background: none !important;
}

/* atlas-shell bakes a dark-ink chevron into the state select's data URI,
   which vanishes on the dark surface. Re-issue it in light ink for dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .search-row select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23eef2f8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  }
}
:root[data-theme='dark'] .search-row select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23eef2f8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* ── Collapsed state + floating pill (desktop only) ─────────── */
@media (min-width: 769px) {
  .panel {
    transition:
      transform 0.2s ease-out,
      opacity 0.2s ease-out;
  }
  .panel.fp-collapsed {
    transform: translateX(calc(100% + 28px));
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition:
      transform 0.2s ease-out,
      opacity 0.2s ease-out,
      visibility 0s 0.2s;
  }
  .panel.fp-no-anim {
    transition: none !important;
  }
  .fp-pill {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 9;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 10px 18px 10px 15px;
    background: rgba(var(--glass), 0.94);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.1),
      0 14px 40px rgba(0, 0, 0, 0.18);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition:
      border-color 0.15s,
      transform 0.15s;
  }
  .fp-pill:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
  }
  .fp-pill svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .fp-pill[hidden] {
    display: none;
  }
}

/* Mobile: the bottom sheet already owns collapse behavior. Disclosure
   headers and the pill are desktop affordances — the sheet keeps its
   tuned budget untouched. */
@media (max-width: 768px) {
  .fp-pill {
    display: none !important;
  }
  .fp-sec-head {
    display: none;
  }
  .fp-section {
    border-top: none;
    margin: 0;
    padding: 0;
  }
  .fp-section[data-open='false'] .fp-sec-clip {
    grid-template-rows: 1fr;
  }
  .fp-section[data-open='false'] .fp-sec-body {
    padding-bottom: 0;
  }
  .fp-sec-body {
    padding-bottom: 0;
  }
  .fp-collapse-btn {
    display: none;
  }
  .fp-titlebar h1 {
    font-size: 18px;
  }
  .fp-combo-btn {
    min-height: 40px;
    padding: 7px 11px;
    font-size: 16px; /* iOS: sub-16px focus zooms the page */
  }
  .fp-combo-search {
    font-size: 16px;
  }
  .fp-combo-list {
    max-height: min(220px, 26vh);
  }
  .panel.has-selection .fp-section {
    display: none;
  }
}
.embed-mode .fp-pill {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .fp-sec-clip,
  .fp-sec-chev,
  .fp-combo-btn svg,
  .fp-pill {
    transition: none !important;
  }
}
