/* ==========================================================================
   Resources hub — filter chips + card grid
   Uses site-wide CSS variables defined in pageBase.css so light / dark
   mode come for free: --body-background, --surface, --body-text,
   --rollup-bg, --link-color, --link-hover-color, --border-subtle,
   --gallery-stats, --shadow-color, --table-shaded-row.
   ========================================================================== */

.resources-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0 1.25rem;
  border-bottom: 1px solid var(--border-subtle, silver);
  margin-bottom: 1.5rem;
}

.resources-filters .filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.resources-filters .filter-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gallery-stats, #595959);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.5rem;
  min-width: 3.5rem;
}

/* Chips are pinned to a uniform minimum width within a filter group so
   the row stays visually tidy regardless of label length. */
.resources-filters .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 6.5rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.9rem;
  line-height: 1.25;
  background: var(--surface, #fff);
  color: var(--body-text, #333);
  border: 1px solid var(--border-subtle, silver);
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.resources-filters .chip:hover {
  background: var(--table-shaded-row, #eaeaea);
  border-color: var(--body-text, #333);
}

.resources-filters .chip.is-active {
  background: var(--link-color, #4B52D8);
  color: var(--surface, #fff);
  border-color: var(--link-color, #4B52D8);
}

/* ------------------------------------------------------------------ grid */

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.resource-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1rem;
  padding: 1rem;
  background: var(--rollup-bg, #fff);
  color: var(--body-text, #333);
  border: 1px solid var(--border-subtle, silver);
  border-radius: 8px;
  box-shadow: 0 1px 2px var(--shadow-color, rgba(0, 0, 0, 0.08));
  transition: box-shadow 150ms ease, transform 150ms ease;
}

.resource-card:hover {
  box-shadow: 0 4px 12px var(--shadow-color, rgba(0, 0, 0, 0.12));
  transform: translateY(-1px);
}

.resource-card-thumb { display: block; }

.resource-card-thumb img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.resource-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.resource-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.resource-card-title {
  font-size: 1.05rem;
  line-height: 1.3;
  margin: 0;
  font-weight: 600;
}

.resource-card-title a {
  color: var(--link-color, #4B52D8);
  text-decoration: none;
}

.resource-card-title a:hover {
  color: var(--link-hover-color, #08148F);
  text-decoration: underline;
}

.resource-card-desc {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--body-text, #333);
  margin: 0;
}

.resource-card-date {
  font-size: 0.78rem;
  color: var(--gallery-stats, #595959);
  margin: 0.25rem 0 0;
}

/* ------------------------------------------------------------ type chips */

.type-chip {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
}

.type-chip-publication  { background: #e8eef8; color: #1a4a8a; }
.type-chip-article      { background: #e8f5e9; color: #1e6a2a; }
.type-chip-methodology  { background: #f1e8f8; color: #5a1a8a; }
.type-chip-tool         { background: #fff3e0; color: #a05000; }

@media (prefers-color-scheme: dark) {
  .type-chip-publication  { background: #1f2f4d; color: #b6d2ff; }
  .type-chip-article      { background: #1e3a26; color: #bfe6c6; }
  .type-chip-methodology  { background: #35234d; color: #d0b6ff; }
  .type-chip-tool         { background: #4a2f12; color: #ffcea0; }
}

.topic-chip {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem;
  color: var(--gallery-stats, #595959);
  background: var(--table-shaded-row, #e8e8ec);
  border-radius: 4px;
}

@media (prefers-color-scheme: dark) {
  .topic-chip {
    background: #2c2c34;
    color: #b0b0c0;
  }
}

.topic-chip-external {
  color: #884400;
  background: #ffefd0;
}

@media (prefers-color-scheme: dark) {
  .topic-chip-external {
    color: #ffcea0;
    background: #4a2f12;
  }
}

/* ---------------------------------------------------------- empty state */

.resources-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gallery-stats, #595959);
  font-style: italic;
}

/* -------------------------------------------------------- small screens */

@media (max-width: 480px) {
  .resource-card {
    grid-template-columns: 60px 1fr;
    gap: 0.75rem;
    padding: 0.85rem;
  }
  .resource-card-thumb img { width: 60px; height: 60px; }
  .resource-card-title { font-size: 1rem; }
  .resources-filters .chip { min-width: 5rem; }
}
