/* The resource library at the site root. Modelled on Sentry's resource library (featured row,
 * type and topic filters, search, a grid of cards whose topic tags filter too), in Ishan's
 * design system from site.css. */

.hub-crumb {
  font-size: 13px; font-weight: 600; color: var(--muted);
  padding-left: 20px; border-left: 1px solid var(--rule); line-height: 22px;
}

/* ───── hero ───── */

.hub-hero { padding: clamp(48px, 6vw, 88px) 0 clamp(32px, 4vw, 48px); }
.hub-hero .wrap { display: flex; flex-direction: column; gap: 20px; }
.hub-title { max-width: 18ch; font-size: clamp(40px, 1.6rem + 3vw, 64px); }
.hub-lede { max-width: 640px; }

/* ───── featured ───── */

.featured-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 960px) { .featured-grid { grid-template-columns: 1fr; } }

.feature {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--white); border: 1px solid var(--card-border); border-radius: var(--r-card);
  transition: translate .3s var(--ease-out), box-shadow .3s ease, border-color .3s ease;
}
.feature:hover { translate: 0 -3px; box-shadow: 0 18px 40px -18px rgba(17, 17, 17, .22); border-color: #C9C4B8; }
.feature--lead { flex-direction: row; }
@media (max-width: 720px) { .feature--lead { flex-direction: column; } }
.feature-media { background: var(--cream); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.feature--lead .feature-media { flex: 0 0 42%; min-height: 300px; }
.feature:not(.feature--lead) .feature-media { height: 180px; }
.feature-media img { display: block; transition: transform .6s var(--ease-out); }
.feature:hover .feature-media img { transform: scale(1.04); }
.feature-media.media--cover-paper img {
  width: min(190px, 58%); height: auto; border-radius: 3px; border: 1px solid var(--card-border);
  rotate: -4deg; box-shadow: var(--shadow-lift);
}
.feature:hover .feature-media.media--cover-paper img { transform: rotate(2deg) translateY(-4px) scale(1.03); }
.feature-media.media--contain img { height: 78%; width: auto; max-width: 80%; object-fit: contain; }
.feature-body { flex: 1; padding: clamp(22px, 3vw, 36px); display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.feature-title { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: clamp(22px, 1rem + 1vw, 30px); line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; }
.feature:not(.feature--lead) .feature-title { font-size: clamp(20px, 1rem + .6vw, 24px); }
.feature-summary { margin: 0; font-size: 16px; line-height: 1.55; color: var(--body); max-width: 46ch; }
.feature-cta { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--green-dark); }
.feature-cta svg { transition: transform .25s var(--ease-out); }
.feature:hover .feature-cta svg { transform: translateX(4px); }

/* The whole card is the link: the title's anchor stretches over it. Tag buttons sit above. */
.card-link { color: inherit; text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card-link:focus-visible { outline: none; }
.feature:has(.card-link:focus-visible), .card:has(.card-link:focus-visible) { outline: 2px solid var(--green-dark); outline-offset: 3px; }

/* ───── library: search + filters ───── */

.hub-library { padding: var(--section) 0 var(--section); }
.library-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; margin-bottom: 24px; }
.search {
  flex: 0 1 360px; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px;
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-ctl); color: var(--muted);
  transition: border-color .15s ease, box-shadow .2s ease;
}
.search:focus-within { border-color: var(--green-dark); box-shadow: var(--ring-focus); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; font: 500 16px var(--font-body); color: var(--ink); }
.search input::placeholder { color: #9A9993; }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.filters { display: flex; flex-direction: column; gap: 14px; padding: 18px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.filter-row { display: flex; gap: 16px; align-items: flex-start; }
.filter-label { flex: 0 0 64px; padding-top: 8px; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--green-text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 14px;
  border-radius: 999px; border: 1px solid var(--card-border); background: var(--white); color: var(--ink);
  font: 600 13px var(--font-body); cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, scale .18s var(--ease-out);
}
.chip:hover { border-color: var(--green-dark); }
.chip:active { scale: .96; }
.chip-n {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums; transition: inherit;
}
.chip.is-on { background: var(--green-dark); border-color: var(--green-dark); color: var(--white); }
.chip.is-on .chip-n { background: rgba(255, 255, 255, .18); color: var(--white); }
.chip.is-empty:not(.is-on) { opacity: .4; }
.chips--topics .chip.is-extra { display: none; }
.chips--topics.is-open .chip.is-extra { display: inline-flex; }
.chip--more { background: none; border-style: dashed; color: var(--green-dark); padding: 0 14px; }
.js .chips--topics.is-open .chip--more { display: none; }
/* Phones: each filter row is one line that scrolls sideways, as on Sentry, instead of a wall of
   chips; every topic is in the row, so "All topics" is not needed there. */
@media (max-width: 640px) {
  .filter-row { flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; }
  .filter-label { flex: none; padding-top: 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; min-width: 0; margin: 0 -24px; padding: 2px 24px 6px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .chips--topics .chip.is-extra { display: inline-flex; }
  .chips--topics .chip--more { display: none; }
}

.results-bar { display: flex; align-items: center; gap: 20px; min-height: 52px; }
.results-count { margin: 0; font-size: 14px; color: var(--muted); }
.results-count b { color: var(--ink); }

/* ───── cards ───── */

.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1040px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cards { grid-template-columns: 1fr; } }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--white); border: 1px solid var(--card-border); border-radius: var(--r-card);
  transition: translate .3s var(--ease-out), box-shadow .3s ease, border-color .3s ease;
}
.card:hover { translate: 0 -4px; box-shadow: 0 18px 36px -18px rgba(17, 17, 17, .24); border-color: #C9C4B8; }
.card[hidden] { display: none; }
.card-media { aspect-ratio: 16 / 9; overflow: hidden; background: var(--card); border-bottom: 1px solid var(--card-border); }
.card-media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.card:hover .card-media img { transform: scale(1.05); }
.card-media.media--cover-paper, .card-media.media--contain { background: var(--cream); display: flex; align-items: center; justify-content: center; }
.card-media.media--cover-paper img { width: auto; height: 82%; object-fit: contain; rotate: -4deg; border-radius: 2px; box-shadow: var(--shadow-lift); }
.card-media.media--contain img { width: auto; height: 80%; object-fit: contain; }
.media--tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--green-dark); color: var(--green-bright); }
.media--tile span { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--bg); }
.feature-media.media--tile { min-height: 180px; }
.card-body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 22px; }
.card-meta { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; background: var(--card); color: var(--body); }
.badge--white-paper { background: var(--green-dark); color: var(--white); }
.badge--assessment { background: var(--green-bright); color: var(--ink); }
.badge--guide { background: var(--green-tint); color: var(--green-dark); }
.badge--open-source { background: var(--ink); color: var(--white); }
.badge--product-update { background: var(--cream); color: var(--ink); border: 1px solid var(--card-border); }
.card-when { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-title { margin: 2px 0 0; font-family: var(--font-head); font-weight: 600; font-size: 19px; line-height: 1.25; letter-spacing: -0.01em; text-wrap: balance; }
.card-title .ext { margin-left: 6px; vertical-align: -1px; color: var(--muted); }
.card-summary {
  margin: 0; font-size: 14px; line-height: 1.55; color: var(--body);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-tags { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  position: relative; z-index: 2; border: 1px solid var(--rule); background: var(--white); border-radius: 6px;
  padding: 3px 8px; font: 600 12px var(--font-body); color: var(--muted); cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.tag:hover { border-color: var(--green-dark); color: var(--green-dark); }
.tag.is-on { background: var(--green-tint); border-color: var(--green-tint); color: var(--green-dark); }

.empty { padding: 56px 0; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .card, .feature, .card-media img, .feature-media img { transition: none; }
}

/* A compact library (fewer than seven resources, see build-hub.mjs): no filters, no count, just
   the grid under its heading. */
.hub-library--compact { padding-top: 0; }
.hub-library--compact .results-bar { display: none; }
.hub-library--compact .library-head { margin-bottom: 28px; }

/* Square art with its own cream panel (the loop): fill the frame and crop, so the panel's edges
   never show as a box inside the card. */
.media--fill img { width: 100%; height: 100%; object-fit: cover; scale: 1.08; }
