/* Listing pages (theme, later lists and discount groups): header, quick-filter chips, the filter column (a sheet on phones),
   toolbar, cards, "Vis 24 flere", and "Om" + FAQ. The card's list view is in card.css. */

.listing-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-top: 20px;
  padding-bottom: 64px;
}

/* HEADER */
.listing-head { display: flex; flex-direction: column; gap: 10px; max-width: 820px; }

.listing-head__title {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.listing-head__count { margin: 0; font-size: 15px; color: var(--ink-3); }
.listing-head__count strong { color: var(--ink); }
.listing-head__intro { margin: 0; font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.listing-head__intro p { margin: 0 0 8px; }
.listing-head__more { font-weight: 700; color: var(--cta); text-decoration: none; }

/* A list's intro, folded to two lines (three on phones) until "Læs mere" */
.listing-head__intro.is-clamped {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.listing-head__toggle {
  align-self: flex-start;
  margin-top: -6px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--cta);
  font-size: 15px;
  font-weight: 700;
}

/* The curated lists under /kategorier, the current one dark */
.list-tabs {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  max-width: 100%;
  padding: 5px;
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--r-lg);
  scrollbar-width: none;
}

.list-tabs::-webkit-scrollbar { display: none; }

.list-tabs__item {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.list-tabs__item span { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.list-tabs__item[aria-current="page"] { background: var(--ink); color: #fff; }
.list-tabs__item[aria-current="page"] span { color: var(--on-dark-2); }

/* QUICK FILTERS: checkboxes that look like pills (a tick when on) */
.listing { display: flex; flex-direction: column; gap: 22px; }

.chip { position: relative; flex-shrink: 0; }

.chip__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.chip__box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.chip__box svg { display: none; }
.chip__input:checked + .chip__box { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip__input:checked + .chip__box svg { display: block; }
.chip__input:focus-visible + .chip__box { outline: 3px solid var(--brand); outline-offset: 2px; }

.listing__body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

/* FILTERS */
.listing__groups { display: flex; flex-direction: column; gap: 14px; }
.listing__sheet-head, .listing__sheet-foot { display: none; }

/* min-width: 0 everywhere: by default the text fields would push a group wider than the column */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 16px;
  background: var(--surface);
  border: 0;
  border-radius: var(--r-lg);
}

.filter-group legend { float: left; width: 100%; margin-bottom: 4px; padding: 0; font-size: 15px; font-weight: 800; }

.filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  font-size: 15px;
  cursor: pointer;
}

.filter-option input { flex-shrink: 0; width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }
.filter-option__label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.filter-option input:checked ~ .filter-option__label { font-weight: 700; }
.filter-option__count { flex-shrink: 0; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.filter-option__dot { flex-shrink: 0; width: 9px; height: 9px; border-radius: 50%; }
.filter-option__dot--good { background: var(--lime); }
.filter-option__dot--in { background: var(--green); }
.filter-option__dot--warn { background: var(--orange); }
.filter-option__dot--bad { background: var(--brand); }

/* Shop logos from the 40 px sprite at half size, sharp on high-density screens. --logo is the shop's index in the sprite */
.filter-option__logo, .shop-chip__logo {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: #fff url('/images/logos/logo-sprite-40px.png') no-repeat;
  background-size: 20px auto;
  background-position: 0 calc(var(--logo, 0) * -20px);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink-3);
}

.filter-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 14px; color: var(--ink); }
.filter-search:focus-within { border-color: var(--ink); }

.filter-group__more {
  align-self: flex-start;
  padding: 4px 0;
  background: transparent;
  border: 0;
  color: var(--cta);
  font-size: 14px;
  font-weight: 700;
}

.filter-group__none { margin: 0; font-size: 14px; color: var(--ink-3); }

.filter-reset { align-self: flex-start; font-size: 14px; font-weight: 700; color: var(--cta); text-decoration: none; }

/* Price: a two-handle slider over two fields */
.price-range { position: relative; height: 22px; margin: 4px 8px 0; }

.price-range::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  height: 6px;
  background: var(--line);
  border-radius: 3px;
}

.price-range__fill { position: absolute; top: 8px; height: 6px; background: var(--ink); border-radius: 3px; }

.price-range input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.price-range input::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 50%;
  pointer-events: auto;
  cursor: grab;
  -webkit-appearance: none;
  appearance: none;
}

.price-range input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 50%;
  pointer-events: auto;
  cursor: grab;
}

.price-range input::-webkit-slider-runnable-track { background: transparent; }
.price-range input::-moz-range-track { background: transparent; }

.price-fields { display: flex; gap: 8px; }
.price-fields label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-3); }

.price-fields input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink);
}

/* RESULTS */
.listing__results { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.listing__toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.listing__filter-btn { display: none; }
.listing__count { font-size: 15px; color: var(--ink-3); }
.listing__count strong { color: var(--ink); }
.listing__tools { display: flex; align-items: center; gap: 8px; }

.listing__sort {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 700;
}

.listing__sort span { font-weight: 600; color: var(--ink-3); }
.listing__sort select { border: 0; background: transparent; font-weight: 700; }

.listing__view { display: flex; padding: 3px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); }

.listing__view button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 40px;
  min-height: 38px;
  padding: 0 12px;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
}

.listing__view button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* Ticked shops, removable, and what the prices mean then */
.listing__shops { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }

.shop-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px 0 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

/* a size up: the offset has to follow the size */
.shop-chip__logo { width: 22px; height: 22px; border-radius: 6px; background-size: 22px auto; background-position: 0 calc(var(--logo, 0) * -22px); }
.shop-chip--plain { padding: 0 10px 0 14px; }
.listing__shops-note { font-size: 14px; color: var(--ink-3); }

.listing__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.listing__grid.card-grid--list { grid-template-columns: minmax(0, 1fr); gap: 10px; }

.listing__more { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 10px; }
.listing__seen { font-size: 14px; color: var(--ink-3); }
.listing__progress { width: 220px; height: 4px; overflow: hidden; background: var(--line); border-radius: 2px; }
.listing__progress span { display: block; height: 100%; background: var(--ink); border-radius: 2px; }
.listing__more .btn { padding: 0 28px; }
.listing__more .btn[aria-busy="true"] { opacity: 0.6; pointer-events: none; }

.listing__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 48px 24px;
  background: var(--surface);
  border-radius: 18px;
  text-align: center;
}

.listing__empty p { max-width: 440px; margin: 0; font-size: 15px; line-height: 22px; color: var(--ink-2); }

.listing__empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--page);
  border-radius: var(--r-lg);
  color: var(--ink-2);
}

.listing__empty-title { font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.listing__empty-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.listing__empty-reset { margin-top: 4px; min-height: 48px; padding: 0 24px; background: var(--ink); color: #fff; font-weight: 800; }
.listing__empty-reset:hover { color: #fff; filter: brightness(1.2); }

/* OM + FAQ: two columns on the grey page under a thin line */
.listing-about {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--empty-2);
}

.listing-about__col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.listing-about__text { font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.listing-about__text p { margin: 0 0 10px; }
.listing-about__text > :last-child { margin-bottom: 0; }
.listing-about .faq__item { padding: 12px 14px; }

/* ============================================================
   TABLETS AND PHONES
   ============================================================ */
@media (max-width: 1023px) {
  .listing__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .listing-page { gap: 18px; padding-top: 14px; padding-bottom: 36px; }
  .listing-head__title { font-size: 38px; }
  .listing-head__intro.is-clamped { -webkit-line-clamp: 3; line-clamp: 3; }
  /* edge to edge (max-width: none, or the bleed is cut back to the page width) */
  .list-tabs { align-self: stretch; max-width: none; margin: 0 calc(var(--gutter) * -1); padding: 5px var(--gutter); border-radius: 0; }
  .listing { gap: 14px; }

  .listing__chips { margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter) 2px; }

  .listing__body { display: flex; flex-direction: column; gap: 14px; }

  /* The filters become a full-screen sheet behind the Filtrér button */
  .listing__filters {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    flex-direction: column;
    background: var(--page);
  }

  .listing__filters.is-open { display: flex; }

  .listing__sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    font-family: var(--font-display);
    font-size: 22px;
  }

  .listing__groups { flex: 1; overflow-y: auto; padding: 16px; gap: 12px; overscroll-behavior: contain; }

  .listing__sheet-foot {
    display: block;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }

  .listing__sheet-foot .btn { width: 100%; min-height: 50px; font-size: 16px; }

  .listing__filter-btn {
    display: inline-flex;
    padding: 0 14px;
    background: var(--surface);
    border: 1px solid var(--ink);
    color: var(--ink);
  }

  .listing__count { display: none; }

  /* Icons only; the words stay for screen readers */
  .listing__view-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .listing__view button { padding: 0 10px; }
  .listing__grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .listing__grid.card-grid--list { gap: 10px; }

  .listing-about { display: flex; flex-direction: column; gap: 24px; padding-top: 12px; border-top: 0; }
}

body.sheet-open { overflow: hidden; }

/* A shop's page: its own shop stays ticked */
.filter-option--locked { cursor: default; }
