/* list-page.css — reusable list/archive page skeleton
 *
 * Shared by watch.html and stories.html (Tasks 17 & 18).
 *
 * Owns: .list-layout (rail + grid), .list-rail (sticky sidebar with
 * search/sort/facets), .list-grid (4→3→2→1-up), .list-card (the card
 * shell — visual variants like .video-card or .story-card belong on
 * the consuming page), .list-search input, .list-chips chip group,
 * .list-chip pill, .list-sort dropdown, .list-result-count live
 * counter, .list-load-more button, .list-empty no-results state.
 *
 * Brand tokens (--ha-navy, --ha-red, etc.), .video-frame /
 * .play-badge, and the global breakpoints all live in shared.css —
 * we extend them, never redefine.
 *
 * No emoji. Squared corners. Brand colors only.
 */

/* ----- Page band: pages live inside a band wrapper so cards (paper)
 * sit on a light-blue surface — proper visual separation. ----- */
.list-page-band { background: var(--ha-blue-50); padding: 32px 0 72px; }

/* ----- Layout: filters above grid, single-column main area.
 * Search + sort live in a header row; chip groups wrap below; cards
 * fill the full content width. Replaces the cramped vertical rail. ----- */
.list-layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 48px;
}
@media (max-width: 768px) {
  .list-layout { padding: 0 32px; }
}
.list-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
  position: relative;
}
.list-rail__main-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.list-rail__search-wrap { flex: 1 1 360px; min-width: 200px; }
.list-rail__sort-wrap { flex: 0 0 auto; min-width: 180px; }

/* ----- Filters dropdown — search stays visible, facet panel collapses ----- */
.filter-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 13px/1 var(--font-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ha-navy);
  background: var(--ha-paper);
  border: 1px solid var(--ha-navy);
  padding: 12px 18px;
  cursor: pointer;
  border-radius: var(--ha-radius);
  min-height: 44px;
}
.filter-toggle:hover { background: var(--ha-cream); }
.filter-toggle[aria-expanded="true"] { background: var(--ha-navy); color: var(--ha-off-white); }
.filter-toggle__count {
  display: none;
  margin-left: 4px;
  background: var(--ha-red);
  color: var(--ha-off-white);
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  padding: 0 7px;
  line-height: 20px;
  text-align: center;
}
.filter-toggle--has-count .filter-toggle__count { display: inline-block; }
.filter-toggle__caret {
  display: inline-block;
  border-style: solid;
  border-width: 5px 4px 0 4px;
  border-color: currentColor transparent transparent transparent;
  transition: transform .15s ease;
  margin-left: 2px;
}
.filter-toggle[aria-expanded="true"] .filter-toggle__caret { transform: rotate(180deg); }

.filter-panel {
  display: none;
  background: var(--ha-navy-100);
  border: 2px solid var(--ha-navy);
  padding: 22px 24px 18px;
  margin-top: -2px;
  box-shadow: var(--shadow-2);
}
.filter-panel.is-open { display: block; }
.filter-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  font: 700 11px/1 var(--font-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ha-navy-600);
}
.filter-panel__clear {
  background: none; border: 0;
  font: 700 12px/1 var(--font-sans);
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ha-red); cursor: pointer;
  padding: 6px 8px;
}
.filter-panel__clear:hover { text-decoration: underline; }
@media (max-width: 768px) {
  .filter-panel { padding: 18px 16px 12px; }
}

.list-main { min-width: 0; }

/* ----- Search input ----- */
.list-search {
  width: 100%;
  font: 15px/1.4 var(--font-sans);
  color: var(--ha-navy);
  background: var(--ha-paper);
  border: 1px solid var(--ha-navy);
  padding: 12px 14px;
  margin: 0;
  border-radius: var(--ha-radius);
  -webkit-appearance: none;
  appearance: none;
}
.list-search:focus {
  border-color: var(--ha-red);
  box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.12);
}
.list-search:focus-visible {
  outline: 2px solid var(--ha-red);
  outline-offset: 2px;
  border-color: var(--ha-red);
}
.list-search::placeholder { color: var(--ha-navy-600); }

/* ----- Result count + sort row ----- */
.list-result-count {
  font: 700 12px/1 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ha-navy-600);
  min-height: 14px;
}
.list-sort-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.list-sort-row label {
  font: 700 11px/1 var(--font-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ha-navy-600);
}
.list-sort {
  font: 14px/1 var(--font-sans);
  color: var(--ha-navy);
  background: var(--ha-paper);
  border: 1px solid var(--ha-navy);
  padding: 10px 12px;
  border-radius: var(--ha-radius);
  -webkit-appearance: none;
  appearance: none;
}
.list-sort:focus-visible { border-color: var(--ha-red); }

/* ----- Facet chip groups: label sits ABOVE its chips, left-aligned with
 * a red 4px underline so the field title actually reads like a header. */
.list-facet-group {
  display: block;
  margin-bottom: 22px;
}
.list-facet-group:last-child { margin-bottom: 0; }
.list-facet-group__label {
  display: inline-block;
  font: 800 13px/1 var(--font-sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ha-navy);
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--ha-red);
}
.list-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.list-chip {
  font: 600 13px/1 var(--font-sans);
  color: var(--ha-navy);
  background: transparent;
  border: 1px solid var(--ha-navy);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  transition: background-color .12s ease, color .12s ease;
}
.list-chip:hover { background: rgba(15, 45, 82, 0.06); }
.list-chip[aria-pressed="true"] {
  background: var(--ha-navy);
  color: var(--ha-off-white);
  border-color: var(--ha-navy);
  /* WCAG 1.4.1 (F11): pressed state encoded in shape (inset red ring) +
     color, so users with color-vision deficiencies still see the toggle. */
  box-shadow: inset 0 0 0 2px var(--ha-red);
}
.list-chip[aria-pressed="true"]::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 2px;
  background: var(--ha-red);
}

/* ----- Card grid — cards from shared.css .card primitive.
 * 3-up at desktop so thumbnails are wider; reflows down on mobile. ----- */
.list-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.video-card { cursor: default; }
.video-card .card__title { font-size: 16px; line-height: 1.3; }

/* ----- Load more button ----- */
.list-load-more {
  font: 700 13px/1 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ha-off-white);
  background: var(--ha-navy);
  border: 1px solid var(--ha-navy);
  padding: 14px 28px;
  margin: 32px auto 0;
  border-radius: var(--ha-radius);
  cursor: pointer;
}
.list-load-more:hover { background: var(--ha-navy-700); }

/* ----- Empty state ----- */
.list-empty {
  padding: 48px 16px;
  text-align: center;
  font-size: 16px;
  color: var(--ha-navy-600);
  border: 1px dashed rgba(15, 45, 82, 0.20);
}
.list-empty a {
  color: var(--ha-navy);
  font-weight: 700;
  margin-left: 6px;
}
.list-empty a:hover { color: var(--ha-red); }

/* The mobile "Filters" disclosure toggle is no longer used (filters are
 * always visible inline). Hidden permanently. */
.list-filters-toggle { display: none !important; }

/* ----- Breakpoints ----- */
@media (max-width: 1024px) {
  .list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
}

@media (max-width: 768px) {
  .list-rail__main-row { gap: 10px; }
  .list-rail__search-wrap { flex: 1 1 100%; }
  .list-rail__sort-wrap { flex: 1 1 100%; }
  .list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
}

@media (max-width: 480px) {
  .list-layout { padding: 0 24px; }
  .list-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
