/* Filter block (fl-): a faceted list. Tokens only; phone breakpoint 720, reads at 360. */
.fl { --fl-gap: 20px; --fl-lap: 20px; padding-top: var(--section); padding-bottom: var(--section); }
.fl-head { display: flex; flex-direction: column; gap: 12px; max-width: var(--w-prose); margin-bottom: 32px; }
.fl-head:empty { display: none; }
.fl-none { color: var(--muted); }

/* ---- K2: the cards / calendar switch (laptops only; mount unhides it). In calendar view the filter keeps its heading and the switch. ---- */
.fl-view { display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.fl-seg { border: 0; background: transparent; padding: 0 18px; cursor: pointer; }
.fl-seg[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }
.fl-seg:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.fl[data-calendar] { padding-bottom: 0; }
.fl[data-calendar] :is(.fl-form, .fl-status, .fl-list, .fl-empty, .fl-more) { display: none; }
@media (max-width: 767px) { .fl-view { display: none; } }

/* ---- the form: search and sort on one line, then one labelled row of chips per facet ---- */
.fl-form { display: flex; flex-direction: column; gap: 16px; }
.fl-bar { display: flex; align-items: center; gap: 12px; }
.fl-search { position: relative; flex: 1 1 auto; max-width: 480px; }
.fl-search svg { position: absolute; left: 14px; top: 14px; color: var(--muted); pointer-events: none; }
.fl-search input { width: 100%; padding-left: 44px; }
.fl-sort { flex: none; flex-direction: row; align-items: center; gap: 10px; margin-left: auto; }
.fl-sort select { min-width: 200px; }
.fl-apply { display: none; align-self: flex-start; }
@media (scripting: none) { .fl-apply { display: inline-flex; } } /* the form still submits; a static host just ignores the query */
.fl-sum { display: none; margin: 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.fl[data-armed] .fl-sum { color: var(--ink); }

.fl-facets { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 20px; row-gap: 10px; align-items: center; }
.fl-facet { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; align-items: center; }
.fl-legend { font-size: 14px; font-weight: 600; color: var(--muted); }
.fl-chip { position: relative; cursor: pointer; user-select: none; }
.fl-chip:has(input:checked) { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
/* "All" and "Any" being selected is the resting state, not a filter: soft, so only real choices are filled */
.fl-chip[data-all]:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.fl-chip:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 3px; }

/* ---- the count line ---- */
.fl-status { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 24px 0 20px; padding-top: 12px; border-top: 1px solid var(--line); min-height: 57px; }
.fl-count { margin: 0; font-size: 15px; font-weight: 600; }
.fl-clear { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 600; }

/* ---- cards: sheet over stage, like services ---- */
.fl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--fl-gap); }
.fl[data-variant="grid"] .fl-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fl-card { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.fl-card:has(.fl-link:focus-visible) { outline: 2px solid var(--brand); outline-offset: 3px; }
.fl-media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--placeholder); }
.fl-media > .k-photo, .fl-media > .fl-ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fl-ph { text-align: center; padding: 12px; }
.fl-sheet { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; gap: 10px; margin-top: calc(var(--fl-lap) * -1); padding: 20px 20px 22px; background: var(--surface); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; }
.fl-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fl-name { font-size: 20px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.fl-link { color: inherit; text-decoration: none; }
.fl-link:focus-visible { outline: none; }
.fl-link::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.fl-text { color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow-wrap: anywhere; }
.fl-tags { font-size: 14px; font-weight: 500; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.fl-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 6px; }
.fl-price { margin: 0; font-size: 15px; font-weight: 500; color: var(--muted); }
.fl-amt { font-size: 17px; font-weight: 700; color: var(--ink); }
.fl-date { flex: none; font-size: 14px; font-weight: 500; color: var(--muted); }

/* K3: the descriptive line and the special offer on a card */
.fl-meta { display: flex; flex-wrap: wrap; margin: 0; font-size: 14px; font-weight: 500; line-height: 1.5; color: var(--muted); }
.fl-meta span:not(:last-child)::after { content: "\00b7"; margin: 0 8px; } /* the dot trails its item, so a wrapped line never starts with one */
.fl-special { align-self: flex-start; margin: 2px 0 0; padding: 4px 10px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }

/* ---- rows: one tidy line per item, hairlines between ---- */
.fl[data-variant="rows"] .fl-list { gap: 0; border-bottom: 1px solid var(--line); }
.fl[data-variant="rows"] .fl-card { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; align-items: center; column-gap: 20px; padding: 16px 0; background: transparent; border-radius: 0; box-shadow: none; overflow: visible; border-top: 1px solid var(--line); }
.fl[data-variant="rows"] .fl-card:has(.fl-link:focus-visible) { outline-offset: -2px; border-radius: var(--radius-sm); }
.fl[data-variant="rows"] .fl-media { border-radius: var(--radius-sm); }
.fl[data-variant="rows"] .fl-sheet { display: contents; }
.fl[data-variant="rows"] .fl-name { font-size: 19px; }
.fl[data-variant="rows"] .fl-ph { font-size: 11px; line-height: 1.25; padding: 6px; }
.fl[data-variant="rows"] .fl-foot { flex-direction: column; align-items: flex-end; gap: 2px; margin: 0; padding: 0; text-align: right; }

/* ---- empty state and Show more ---- */
.fl-empty { align-items: center; text-align: center; gap: 10px; padding: 44px 24px; color: var(--muted); }
.fl-empty-t { font-size: 19px; font-weight: 600; color: var(--ink); }
.fl-more { display: flex; justify-content: center; margin: 0; }
.fl-more-btn { margin-top: 32px; }

/* ---- the reflow (mount): leavers fade 180 ms, the rest glide over 300 ms by WAAPI ---- */
.fl .fl-card.k-out { animation: k-out 180ms var(--ease) forwards; pointer-events: none; }

@media (hover: hover) and (pointer: fine) {
  .fl-media .k-photo { transition: transform .6s var(--ease); }
  .fl-card:has(.fl-link):hover .k-photo { transform: scale(1.04); }
  .fl-name { transition: color var(--d-fast) ease; }
  .fl-card:has(.fl-link):hover .fl-name { color: var(--brand); }
}

@media (max-width: 960px) {
  .fl[data-variant="grid"] .fl-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* phone: facets collapse into one swipeable chip row under a "Filters (n)" line */
@media (max-width: 720px) {
  .fl-head { margin-bottom: 24px; }
  .fl-form { gap: 12px; }
  .fl-search { max-width: none; }
  .fl-sort { margin-left: 0; }
  .fl-sort label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .fl-sort select { min-width: 0; width: 140px; }
  .fl-sum { display: block; }
  .fl-facets { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 0 var(--pad); scrollbar-width: none; margin: -4px calc(var(--pad) * -1); padding: 4px var(--pad); -webkit-mask-image: linear-gradient(to right, transparent, black var(--pad), black calc(100% - 28px), transparent); mask-image: linear-gradient(to right, transparent, black var(--pad), black calc(100% - 28px), transparent); }
  .fl-facets::-webkit-scrollbar { display: none; }
  .fl-facet { display: flex; flex: none; align-items: center; gap: 8px; }
  .fl-facet + .fl-facet { margin-left: 4px; padding-left: 12px; border-left: 1px solid var(--line); }
  .fl-legend { scroll-snap-align: start; }
  .fl-chips { flex-wrap: nowrap; }
  .fl-chip { flex: none; white-space: nowrap; scroll-snap-align: start; }
  .fl-status { margin: 16px 0; min-height: 0; padding-top: 8px; }
  .fl[data-variant="grid"] .fl-list { grid-template-columns: 1fr; gap: 16px; }
  .fl[data-variant="grid"] .fl-media { aspect-ratio: 3 / 2; }
  .fl[data-variant="rows"] .fl-card { grid-template-columns: 84px minmax(0, 1fr); column-gap: 14px; row-gap: 4px; align-items: start; }
  .fl[data-variant="rows"] .fl-media { grid-row: 1 / span 2; }
  .fl[data-variant="rows"] .fl-name { font-size: 18px; }
  .fl[data-variant="rows"] .fl-foot { grid-column: 2; flex-direction: row; align-items: baseline; justify-content: space-between; text-align: left; }
  .fl-more-btn { width: 100%; }
  .fl-empty { padding: 32px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .fl-media .k-photo, .fl-name { transition: none !important; transform: none !important; }
}
