/* The Ski Map's resort filter (map-filter.js): a button above Open now under the search box, and the filter sheet,
   which is one of the app's sheets (friends.css .sheet: a bottom sheet on phones, a side card wider; rows from
   browse.css). A chosen country gets a soft veil of frosted, blurred snow around it (.country-veil). */

/* Open now sits under the filter, both lined up on the left and clear of the map's buttons on the right */
.chip-row { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: calc(100vw - 2 * var(--gutter) - 64px); }

/* ---------- The button: "Filter", or a few words for what's chosen, with a clear (×) joined on ---------- */

.map-filter-chip {
  display: flex; align-items: stretch; min-width: 0; max-width: 100%;
  border-radius: 999px; box-shadow: var(--shadow);
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.map-filter-chip[hidden] { display: none; }
.map-filter-chip button {
  display: inline-flex; align-items: center; gap: 7px; min-height: 32px;
  border: 0; background: none; color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; letter-spacing: -.005em; cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur-fast) var(--ease);
}
.map-filter-chip button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.map-filter-open { flex: 0 1 auto; min-width: 0; padding: 4px 15px 4px 12px; border-radius: 999px; }
.map-filter-open:hover { background: rgb(255 255 255 / .5); }
.map-filter-open svg, .map-filter-clear svg {
  flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
}
/* Fingers get 44 px pills, as the trail map's Filters (trail-filters.css), with Open now under it */
@media (max-width: 600px), (pointer: coarse) {
  .map-filter-chip button, .open-now-chip .open-now-toggle { min-height: 44px; }
}
.mf-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-filter-clear { flex: none; padding: 4px 11px 4px 9px; border-radius: 0 999px 999px 0; }
.map-filter-clear[hidden] { display: none; }
.map-filter-chip.on { background: var(--accent); box-shadow: 0 6px 20px rgb(var(--accent-rgb) / .28), 0 1px 3px rgb(var(--navy-rgb) / .12); }
.map-filter-chip.on button { color: var(--on-accent); }
.map-filter-chip.on .map-filter-open { padding-right: 10px; border-radius: 999px 0 0 999px; }
.map-filter-chip.on .map-filter-open:hover, .map-filter-chip.on .map-filter-clear:hover { background: rgb(255 255 255 / .14); }
.map-filter-chip.on .map-filter-clear { position: relative; }
.map-filter-chip.on .map-filter-clear::before {   /* a hairline between the summary and the × */
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 1px; background: rgb(255 255 255 / .35);
}

/* ---------- The sheet ---------- */

#filter-title { outline: none; }
@media (max-width: 699px) {
  .filter-sheet { max-height: min(64vh, 600px); }   /* the country it frames stays in view above it */
  .filter-sheet.countries { height: min(64vh, 600px); }
}
@media (min-width: 700px) {
  .filter-sheet { max-height: min(640px, calc(100vh - 210px)); }   /* below the Filter button, which stays in view */
  .filter-sheet.countries { height: min(640px, calc(100vh - 210px)); }
  body:has(#filter-sheet.open) .place-card { left: calc(var(--gutter) + 396px); margin-left: 0; }
}
.filter-sheet .sheet-body { flex: 1; min-height: 0; padding-top: var(--space-2); padding-bottom: var(--space-4); }
/* A phone on its side: under the Filter button its body was 40 px tall (2026-11-04, an iPhone's 292 px Safari window,
   where 100vh is the 402 px screen), so here it reaches up to the search box's top, 16 px under the app bar (100% is
   the body, the window under the bar, as the resort card measures), over the Filter button, which its title stands in
   for, with a slimmer header and foot, and no room for the home bar inside a card that already stands above it */
@media (min-width: 700px) and (max-height: 500px) {
  .filter-sheet { max-height: calc(100% - 16px - max(16px, env(safe-area-inset-bottom))); padding-bottom: 0; }
  .filter-sheet.countries { height: calc(100% - 16px - max(16px, env(safe-area-inset-bottom))); }
  .filter-sheet .sheet-header { padding-top: 4px; padding-bottom: 4px; }
  .filter-sheet .sheet-body { padding-top: var(--space-1); padding-bottom: var(--space-2); }
  .filter-sheet .mf-section + .mf-section { margin-top: var(--space-4); }
  .filter-sheet .mf-foot { padding-top: 6px; padding-bottom: 8px; }
  .filter-sheet .mf-done { min-height: 44px; padding-block: 6px; }
}

.mf-section + .mf-section { margin-top: var(--space-5); }
.mf-section h3 {
  margin: var(--space-2) 0 var(--space-2); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.mf-country { background: var(--fill); }
.mf-country:hover { background: var(--fill-2); }
.mf-country .browse-flag { font-size: 22px; }

/* Lifts, runs and snow: four segments side by side, each with how many resorts it leaves; several can be on */
.mf-seg {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px;
  padding: 3px; border-radius: 13px; background: var(--fill-2);
}
.mf-seg button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 48px; padding: 6px 2px 5px;
  border: 0; border-radius: 10px; background: none; color: var(--text);
  font: inherit; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease), transform .12s var(--ease-out), opacity var(--dur-fast) var(--ease);
}
.mf-seg button:hover { background: rgb(255 255 255 / .55); }
.mf-seg button:active { transform: scale(.95); }
.mf-seg button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 1px; }
.mf-seg-label { font-size: 14px; font-weight: 600; line-height: 1.2; white-space: nowrap; letter-spacing: -.01em; }
.mf-seg-count { font-size: 11.5px; line-height: 1.2; color: var(--muted); font-variant-numeric: tabular-nums; }
.mf-seg button[aria-pressed="true"] {
  background: #fff; color: var(--accent);
  box-shadow: 0 1px 2px rgb(var(--navy-rgb) / .12), 0 3px 10px rgb(var(--navy-rgb) / .08);
}
.mf-seg button[aria-pressed="true"] .mf-seg-count { color: var(--accent); opacity: .8; }
.mf-seg button.empty { opacity: .42; }

.filter-sheet .mf-note { margin: var(--space-4) 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.filter-sheet .mf-snow-note { margin-top: var(--space-2); }   /* where the snow figures come from, under their ranges */

/* The countries: a search field over a list of rows (browse.css), the chosen one ticked */
.mf-search {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  border-radius: 11px; background: var(--fill-2); color: var(--muted);
}
.mf-search:focus-within { box-shadow: 0 0 0 3px var(--focus-ring); }
.mf-search svg { flex: none; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mf-search input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none;
  color: var(--text); font: inherit; font-size: 16px;   /* 16 px: iOS doesn't zoom in on it */
}
.mf-countries { margin-top: var(--space-2); }
.mf-countries li[hidden] { display: none; }
.mf-countries [aria-current="true"] strong { color: var(--accent); }
.mf-check { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.mf-foot {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-4);
  border-top: 1px solid var(--separator);
}
.mf-foot[hidden] { display: none; }
.mf-foot button { border: 0; font: inherit; cursor: pointer; transition: background var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease), transform .12s var(--ease-out); }
.mf-foot button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.mf-reset { padding: 10px 6px; background: none; color: var(--accent); font-size: 15px; font-weight: 600; border-radius: 10px; }
.mf-reset:disabled { color: var(--muted); opacity: .5; cursor: default; }
@media (max-width: 600px), (pointer: coarse) { .mf-reset { min-height: 44px; } }   /* a finger's target (40 px, iOS Safari 2026-11-08) */
.mf-done {
  flex: 1; min-height: 46px; padding: 10px 16px; border-radius: 13px;
  background: var(--accent); color: var(--on-accent); font-size: 16px; font-weight: 600;
}
.mf-done:hover { background: var(--accent-hover); }
.mf-done:active, .mf-reset:not(:disabled):active { transform: scale(.98); }

/* ---------- The veil around a chosen country ----------
   Frosted, blurred snow over the map outside the country; map-filter.js cuts the country out of it with a soft-edged
   mask and fades it as the map zooms in to a resort. Under the map's buttons. */
.country-veil {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: rgb(247 249 252 / .5);
  -webkit-backdrop-filter: blur(5px) saturate(.85); backdrop-filter: blur(5px) saturate(.85);
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  opacity: 0; transition: opacity .5s var(--ease);
}
.country-veil.on { opacity: var(--fade, 1); }
.country-veil.off { opacity: 0; }   /* zoomed in to a resort, or the map tilted (the frost layer takes over) */
@media (prefers-reduced-motion: reduce) {
  .country-veil, .mf-seg button, .map-filter-chip, .map-filter-chip button, .mf-foot button { transition: none; }
}
