/* Field IQ — drill catalog
 * ---------------------------------------------------------------------------
 * Scoped to the library page. Denser than the marketing pages on purpose:
 * this is a working tool a coach scans, not a page they read.
 */

/* ---------------------------------------------------------------- layout */
.catalog {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

@media (max-width: 900px) {
  .catalog { grid-template-columns: 1fr; gap: 16px; }
}

/* The library page runs tighter than the marketing sections. */
.section--catalog { padding: 40px 0 64px; }
@media (max-width: 900px) { .section--catalog { padding: 24px 0 48px; } }

/* ------------------------------------------------------------------ rail */
.rail {
  position: sticky;
  top: 84px;                       /* clears the sticky nav */
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}
@media (max-width: 900px) {
  .rail { position: static; max-height: none; overflow: visible; }
}
.rail::-webkit-scrollbar { width: 6px; }
.rail::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 3px; }

.rail-group { margin-bottom: 22px; }
.rail-group:last-child { margin-bottom: 0; }

.rail-title {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--gray-600);
  margin-bottom: 8px;
}

.rail-opts { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1;
  padding: 7px 11px;
  border-radius: 100px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-800);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.chip:hover { border-color: var(--gray-400); }
.chip[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------------------------------------------------------------- toolbar */
.cat-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.cat-search {
  flex: 1 1 240px;
  position: relative;
  display: flex;
  align-items: center;
}
.cat-search svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--gray-400);
  pointer-events: none;
}
.cat-search input {
  width: 100%;
  font: inherit;
  font-size: .92rem;
  padding: 11px 36px 11px 36px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-800);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.cat-search input::placeholder { color: var(--gray-400); }
.cat-search input:focus {
  outline: none;
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(30,51,84,.12);
}
.cat-search-clear {
  position: absolute;
  right: 8px;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
}
.cat-search-clear:hover { color: var(--gray-800); }

.cat-count {
  font-size: .82rem;
  color: var(--gray-600);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cat-count strong { color: var(--gray-800); }

/* view toggle */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}
.view-toggle button {
  font: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  font-weight: 600;
  padding: 9px 13px;
  border: 0;
  background: none;
  color: var(--gray-600);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.view-toggle button + button { border-left: 1px solid var(--gray-200); }
.view-toggle button[aria-pressed="true"] { background: var(--navy); color: var(--white); }
.view-toggle svg { width: 14px; height: 14px; }

/* active filter summary */
.cat-active {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 14px;
}
.cat-clear {
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  color: var(--red);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 4px 2px;
  text-decoration: underline;
}

/* ------------------------------------------------------- grid (dense) */
/* Tighter than the marketing .grid-3: smaller min column, smaller gap. */
#drillGrid.is-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 14px;
}
#drillGrid.is-grid .card-body { padding: 15px; }
#drillGrid.is-grid h4 { font-size: 1rem; line-height: 1.25; }
#drillGrid.is-grid .drill-desc {
  font-size: .82rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#drillGrid.is-grid .drill-cue { display: none; }   /* recovered on the detail view */
#drillGrid.is-grid .drill-meta { font-size: .72rem; gap: 10px; }

/* ------------------------------------------------------- list (densest) */
#drillGrid.is-list { display: flex; flex-direction: column; gap: 0; }

#drillGrid.is-list .card {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 2.4fr) auto;
  gap: 18px;
  align-items: center;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  box-shadow: none;
  padding: 11px 14px;
  transform: none;
}
#drillGrid.is-list .card:first-child { border-top: 1px solid var(--gray-200); }
#drillGrid.is-list .card:hover { transform: none; background: var(--gray-100); box-shadow: none; }
#drillGrid.is-list .card-body { padding: 0; display: contents; }
#drillGrid.is-list h4 { font-size: .95rem; margin: 0; }
#drillGrid.is-list .drill-desc {
  font-size: .82rem;
  color: var(--gray-600);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#drillGrid.is-list .drill-cue,
#drillGrid.is-list .drill-tags { display: none; }
#drillGrid.is-list .drill-meta {
  margin: 0;
  border: 0;
  padding: 0;
  justify-content: flex-end;
  white-space: nowrap;
  font-size: .74rem;
  gap: 12px;
}
#drillGrid.is-list .member-badge { position: static; margin-left: 8px; }
#drillGrid.is-list .fiq-drill-video { display: none; }

@media (max-width: 720px) {
  #drillGrid.is-list .card { grid-template-columns: 1fr; gap: 5px; padding: 12px 4px; }
  #drillGrid.is-list .drill-meta { justify-content: flex-start; }
}

/* --------------------------------------------------------- card internals */
.drill-meta {
  display: flex;
  gap: 14px;
  color: var(--gray-400);
  margin-top: 12px;
  border-top: 1px solid var(--gray-200);
  padding-top: 10px;
  font-size: .78rem;
}
.drill-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 9px; }

/* Descriptions are now multi-paragraph and long. Cards show a clamped preview
   and expand on demand — without this the detail is written but unreadable. */
.drill-desc p { margin: 0 0 8px; }
.drill-desc p:last-child { margin-bottom: 0; }

.drill-more {
  font: inherit;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--navy-light);
  background: none;
  border: 0;
  padding: 8px 0 0;
  cursor: pointer;
}
.drill-more:hover { color: var(--red); }
.drill-more:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* expanded: release the line clamp and reveal the cue */
.card.is-open .drill-desc {
  display: block !important;
  -webkit-line-clamp: none !important;
  overflow: visible !important;
}
.card.is-open .drill-cue { display: block !important; }
.drill-cue {
  font-size: .82rem;
  color: var(--gray-700, #495057);
  margin-top: 10px;
  font-style: italic;
}
.member-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--gold);
  color: var(--navy);
  font-size: .62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  letter-spacing: .06em;
  z-index: 2;
}

/* ------------------------------------------------------------- empty state */
.cat-empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--gray-600);
  border: 1px dashed var(--gray-200);
  border-radius: var(--radius-lg);
}
.cat-empty strong { display: block; color: var(--gray-800); margin-bottom: 6px; font-size: 1.05rem; }

/* --------------------------------------------------------------- a11y */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced-motion handling now lives globally in styles.css. */
