/* /business-resources/ (assets/js/business-resources-controller.js) - a
   curated affiliate/tool directory for business owners. One long page: a bar
   of jump links under the hero (sticky; a swipeable row on a phone) scrolls to
   each category's section, and every section is always on the page - nothing
   is hidden or filtered. Each section is a centered heading and intro, then a
   two-column grid of resources (logo on the left; name, description and a
   "Visit site" link on the right), one column on a phone. */

.resources-hero {
  background: linear-gradient(135deg, var(--ink) 0%, var(--blue) 160%);
  color: #fff;
  padding: 56px 0 48px;
}
.resources-hero .eyebrow { color: #9ecbff; }
.resources-hero .lead { color: #dce6f3; max-width: 680px; font-size: 19px; }
.resources-hero h1 { color: #fff; font-size: clamp(38px, 5vw, 58px); }

/* ---- Jump bar ---------------------------------------------------------- */
/* Sits right under the sticky site header; --resources-sticky-top is that
   header's measured height (set by the controller, which also measures this
   bar into --resources-bar-h for the sections' scroll offset). */
.resources-jump {
  position: sticky;
  top: var(--resources-sticky-top, 84px);
  z-index: 40;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 14px rgba(11, 26, 46, .05);
}
.resources-jump[hidden] { display: none; }
.resources-jump__scroller {
  display: flex;
  justify-content: flex-start;
  gap: 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.resources-jump__scroller::-webkit-scrollbar { display: none; }
/* Few categories sit together in the middle (like the centered headings below);
   too many to fit and the row starts at the left and scrolls instead. The auto
   margins on the first and last link do both - "justify-content: center" alone
   would cut off the left end of a row that overflows. */
.resources-jump__link:first-child { margin-left: auto; }
.resources-jump__link:last-child { margin-right: auto; }
.resources-jump__link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 14px 13px;
  border-bottom: 3px solid transparent;
  color: #5b6b80;
  font: 700 15px var(--sans);
  white-space: nowrap;
  text-decoration: none;
  transition: color .15s ease, border-color .15s ease;
}
.resources-jump__link:hover,
.resources-jump__link:focus-visible { color: var(--ink); }
.resources-jump__link.is-active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}
.resources-jump__icon { font-size: 17px; line-height: 1; }

/* A soft fade on the right edge says "more to swipe"; the controller turns it
   on only while the row has more to the right. */
.resources-jump::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 36px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff 85%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.resources-jump.has-more::after { opacity: 1; }

/* ---- Sections ---------------------------------------------------------- */
.resources-sections { padding-top: 8px; }
.resources-section {
  padding: 56px 0 8px;
  /* A jump link stops the section below the sticky header and the jump bar. */
  scroll-margin-top: calc(var(--resources-sticky-top, 84px) + var(--resources-bar-h, 54px) + 16px);
}
.resources-section + .resources-section { border-top: 1px solid var(--line); margin-top: 40px; }
.resources-section__head {
  max-width: 760px;
  margin: 0 auto 40px;
  text-align: center;
}
.resources-section__head h2 { margin: 0 0 12px; font-size: clamp(24px, 3vw, 30px); }
.resources-section__head p { margin: 0; color: #4b5b70; font-size: 16px; line-height: 1.7; }

.resources-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px 56px;
  align-items: start;
}

/* ---- One resource ------------------------------------------------------ */
.resource-card {
  /* A link straight to one resource (#slug) must land below the sticky bars too. */
  scroll-margin-top: calc(var(--resources-sticky-top, 84px) + var(--resources-bar-h, 54px) + 24px);
  display: flex;
  /* The name and description sit vertically centered beside the 96px image (the
     image centered against the text when the text is taller), not hung from its top. */
  align-items: center;
  gap: 18px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.resource-card__media {
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  box-sizing: border-box;
  /* A visible 96 x 96 tile (soft grey, thin outline, rounded corners) with the
     image centered in the middle of it, like the reference cards - so a logo with
     a transparent background, or a photo that is not square, still sits in the
     middle of a square instead of floating. The padding keeps the picture off the
     edges of the tile (it is not right against the top and bottom). */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
  border: 1px solid #d5dae2;
  border-radius: 12px;
  background: #f4f5f7;
}
/* The whole image is shown (never cropped), centered inside the padding. */
.resource-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
/* No logo: the first letter, centered in the same tile. */
.resource-card__initial {
  font: 800 36px var(--sans);
  color: #8a98aa;
}
.resource-card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}
.resource-card__name {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
  color: #3a3a3a;
  text-decoration: none;
  transition: color .15s ease;
}
/* Hover (or keyboard focus) turns the name the site's blue - no underline. */
.resource-card:hover .resource-card__name,
.resource-card:focus-visible .resource-card__name { color: var(--blue); }
.resource-card__subcategory {
  font: 700 10px var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--blue);
  background: #eef4ff;
  border-radius: 999px;
  padding: 3px 9px;
}
.resource-card__description { color: #444; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.resource-card__link { color: var(--orange); font-weight: 800; white-space: nowrap; }
.resource-card:hover .resource-card__link { text-decoration: underline; }

@media (max-width: 860px) {
  .resources-grid { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 640px) {
  .resources-hero { padding: 44px 0 36px; }
  .resources-section { padding-top: 40px; }
  .resources-section + .resources-section { margin-top: 28px; }
  .resources-section__head { margin-bottom: 28px; }
  .resources-jump__link { padding: 14px 12px 11px; font-size: 14px; }
  .resource-card { gap: 14px; }
  .resource-card__name { font-size: 18px; }
}
