/* ==========================================================================
   Checklisten — Phase 19
   --------------------------------------------------------------------------
   A NEW stylesheet, pushed onto the `styles` stack by the Checklisten view
   only. The approved base.css / components.css / pages.css are untouched.

   ── WHAT IT REPLACES ────────────────────────────────────────────────────────
   The catalogue was three tab panels, each holding two columns of ghost
   buttons. Organisation alone has FIFTY-ONE of them: a wall of identical
   pink-outlined pills, alphabetically unordered, with no way to search and no
   indication of how many there are or what a click would do.

   The data does not carry descriptions — `checklists` has a title, a category
   and a sort order, and nothing else — so nothing here invents one. What it can
   do is give each title room to be read, group and count honestly, and make the
   action legible.
   ========================================================================== */

/* --- Toolbar -------------------------------------------------------------- */

.cl-bar {
  display: grid;
  gap: 1rem;
  padding: 1.25rem 0;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cl-bar__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .55rem;
}

@media (min-width: 46rem) {
  .cl-bar__row {
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: .75rem 1.15rem;
    align-items: center;
  }
}

.cl-bar__label {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 700;
  color: var(--mute);
}

.cl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  min-width: 0;
}

@media (max-width: 46rem) {
  .cl-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: .2rem;
    margin-inline: calc(clamp(1.15rem, 2.5vw, 1.6rem) * -1);
    padding-inline: clamp(1.15rem, 2.5vw, 1.6rem);
  }

  .cl-filters::-webkit-scrollbar { display: none; }
  .cl-filters .chip { flex: none; }
}

.cl-bar__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.15rem;
  padding-top: .95rem;
  border-top: 1px solid var(--line);
}

.cl-search {
  flex: 1 1 15rem;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.cl-search input {
  width: 100%;
  min-height: 2.6rem;
  padding: .5rem 2.4rem .5rem .95rem;
  font-size: .9375rem;
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
}

.cl-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.cl-search__clear {
  position: absolute; right: .45rem;
  display: grid; place-items: center;
  width: 1.75rem; height: 1.75rem;
  border: 0; border-radius: 50%; background: transparent;
  color: var(--mute); cursor: pointer;
}

.cl-search__clear:hover { color: var(--accent); }
.cl-bar__meta { margin-left: auto; display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }

/* --- Group heading -------------------------------------------------------- */

.cl-group {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin: clamp(1.75rem, 3vw, 2.5rem) 0 .95rem;
}

.cl-group:first-of-type { margin-top: 0; }

.cl-group__title {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-weight: 700;
  color: var(--ink);
}

.cl-group__rule { flex: 1; height: 1px; background: var(--line); }
.cl-group__n { font-size: var(--fs-xs); color: var(--mute); font-variant-numeric: lining-nums; }

/* --- The cards ------------------------------------------------------------ */

.cl-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 40rem) { .cl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 68rem) { .cl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/*
 * The whole card is the control.
 *
 * The previous markup put a `<button>` around the title inside an `<li>`, so
 * the click target was the text and the card was decoration. Here the button IS
 * the card: one element, one focus ring, one hit area, and 44px of it in every
 * direction on a phone.
 */
.cl-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: .6rem;
  width: 100%;
  min-height: 100%;
  padding: 1.15rem 1.25rem;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}

.cl-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  transform: translateY(-2px);
  box-shadow: 0 6px 22px -18px var(--ink);
}

.cl-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cl-card__cat {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
  color: var(--mute);
}

.cl-card__title {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink);
  /* Titles run from three words to a full sentence; they wrap rather than
     truncate, because a checklist you cannot read the name of is not offered. */
  overflow-wrap: anywhere;
}

.cl-card__cta {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--accent);
}

.cl-card__cta svg { transition: transform .25s var(--ease); }
.cl-card:hover .cl-card__cta svg { transform: translateX(3px); }

.cl-card.is-filtered-out { display: none !important; }

/* --- States --------------------------------------------------------------- */

.cl-empty {
  display: grid;
  justify-items: center;
  gap: .85rem;
  padding: clamp(2.25rem, 6vw, 3.5rem) 1.5rem;
  text-align: center;
  border: 1px dashed var(--line-strong);
  background: var(--white);
}

.cl-empty__title { font-size: 1.15rem; color: var(--ink); }
.cl-empty p { margin: 0; max-width: 46ch; color: var(--mute); }

.cl-stat {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.35rem;
  margin: 0 0 clamp(1.5rem, 3vw, 2.25rem);
  padding: 0;
  list-style: none;
  font-size: var(--fs-small);
  color: var(--mute);
}

.cl-stat strong { color: var(--ink); font-variant-numeric: lining-nums; }
