/* Shared indicators for native selects and disclosures.
   Opt in only normal dropdowns. Listboxes and custom pickers keep their UI.
   The arrow occupies size + inset; padding reserves that area plus the text gap.
   Change these tokens together here, or set a purpose-specific token below. */
:root{
  /* Same rounded V as the incidents filter SVG, displayed at 12 x 7.
     Its 1.8-unit reference stroke scales to about 1.5 CSS pixels.
     Native selects use the themed SVG background; summary/legend use that
     same image as a currentColor mask. */
  --ui-chevron-size:12px;
  --ui-chevron-height:7px;
  --ui-chevron-stroke:1.5px;
  --ui-chevron-gap:8px;
  --ui-chevron-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'12'%20height%3D'7'%20viewBox%3D'5%208%2014%208'%3E%3Cpath%20d%3D'm6%209%206%206%206-6'%20fill%3D'none'%20stroke%3D'%238b93a7'%20stroke-width%3D'1.8'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%2F%3E%3C%2Fsvg%3E");
  --select-arrow-size:var(--ui-chevron-size);
  --select-arrow-inset:10px;
  --select-text-gap:var(--ui-chevron-gap);
  --select-padding-inline:10px;
  --select-padding-block:0px;
}
/* Align the native-select icon with the site's themed muted text. */
:root[data-theme="light"]{--ui-chevron-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'12'%20height%3D'7'%20viewBox%3D'5%208%2014%208'%3E%3Cpath%20d%3D'm6%209%206%206%206-6'%20fill%3D'none'%20stroke%3D'%23606879'%20stroke-width%3D'1.8'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%2F%3E%3C%2Fsvg%3E")}
.uiSelect:where(:not([multiple])):where(:not([size]),[size="1"]){
  box-sizing:border-box;
  min-width:0;
  max-width:100%;
  border:1px solid var(--line);
  border-radius:var(--select-radius,10px);
  background-color:var(--select-background,var(--panel));
  color:var(--text);
  font-family:inherit;
  font-size:var(--font-sm,13px);
  padding-block:var(--select-padding-block);
  padding-inline-start:var(--select-padding-inline);
  padding-inline-end:calc(var(--select-arrow-inset) + var(--select-arrow-size) + var(--select-text-gap));
  -webkit-appearance:none;
  appearance:none;
  /* Complete SVG stroke with rounded caps and join (not two cropped gradients). */
  background-image:var(--ui-chevron-image);
  background-repeat:no-repeat;
  background-size:var(--select-arrow-size) var(--ui-chevron-height);
  background-position:right var(--select-arrow-inset) center;
  cursor:pointer;
}
.uiSelect:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--glow)}
.uiSelect:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.uiSelect:where(.filterSelect){width:100%;transition:border-color .13s,background-color .13s,color .13s}
.uiSelect:where(.filterSelect).active{border-color:var(--accent);color:var(--accent);background-color:color-mix(in srgb,var(--accent) 8%,var(--panel));font-weight:800}
.uiSelect:disabled{color:var(--muted);cursor:not-allowed}
.uiSelect:where(.sortSel,.incSort,.relSort){flex:0 0 auto;font-weight:400}

/* Form fields keep the existing secondary surface and larger type. */
.uiSelect--field{
  --select-background:var(--panel2);
  --select-radius:9px;
  display:block;
  width:100%;
  font-size:var(--font-md,14px);
  line-height:var(--line-ui,1.4);
}
.uiSelect:where(.siteAddSel){--select-radius:8px;margin-top:10px}
/* Event service fields share the arrow and keep their existing width range. */
.uiSelect:where(.evinp){
  width:auto;
  min-width:min(180px,100%);
  max-width:min(240px,100%);
}
.uiSelect:where(.editorSelect){font-size:inherit;line-height:inherit}

/* Keep details/summary native: only replace the decorative marker.
   The legacy map legend uses the same strokes when its mobile toggle is shown. */
:where(details > summary){display:block;list-style:none;cursor:pointer}
:where(details > summary)::-webkit-details-marker{display:none}
:where(details > summary)::before{content:""}
:where(details > summary)::before,.legend h4::after{
  display:inline-block;
  width:var(--ui-chevron-size);
  height:var(--ui-chevron-height);
  margin-inline-end:var(--ui-chevron-gap);
  vertical-align:middle;
  background-color:currentColor;
  -webkit-mask:var(--ui-chevron-image) center/contain no-repeat;
  mask:var(--ui-chevron-image) center/contain no-repeat;
}
:where(details[open] > summary)::before{transform:rotate(180deg)}

/* System high contrast supplies its own visible arrow and focus colors. */
@media(forced-colors:active){
  /* Gradients are suppressed here. Paint the same box with the system palette;
     only this decorative shape opts out so CanvasText is not remapped to Canvas. */
  .legend h4::after{
    /* A system-colored shape remains available if SVG masks are suppressed. */
    -webkit-mask:none;
    mask:none;
    background-color:CanvasText;
    forced-color-adjust:none;
    clip-path:polygon(0 0,50% calc(100% - var(--ui-chevron-stroke)),100% 0,100% var(--ui-chevron-stroke),50% 100%,0 var(--ui-chevron-stroke));
  }
  .uiSelect:where(:not([multiple])):where(:not([size]),[size="1"]){appearance:auto;background-image:none;padding-inline-end:var(--select-padding-inline)}
  :where(details > summary){display:list-item;list-style:disclosure-closed inside}
  :where(details[open] > summary){list-style-type:disclosure-open}
  :where(details > summary)::-webkit-details-marker{display:revert}
  :where(details > summary)::before{content:none}
}
