/* ==========================================================================
   categories.css — 4-up grid of portrait category tiles. Photo fills the
   tile, dark gradient at the bottom, title + count pill stacked over it.
   On hover: photo Ken-Burns zooms, brightens & saturates; pill flips brand.
   Markup: <div class="cat-grid">
            <a class="cat-tile" href="...">
              <div class="photo" style="background-image:url('...')"></div>
              <div class="body">
                <h4>Yoga</h4>
                <span class="count">47 sessions</span>
              </div>
            </a>
   ========================================================================== */

/* Section heading — bigger than the default --fs-h2 to match the hero weight
   of this category browse module. Scoped to .cat-section so other .block-head
   instances are unaffected. */
.cat-section .block-head h2 { font-size: var(--fs-h1-lg); }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-16);
}

.cat-tile {
  position: relative;
  display: block;
  aspect-ratio: 9 / 12;
  border-radius: var(--radius);
  overflow: hidden;
  background-color: var(--bg-3);
  color: white;
  isolation: isolate;
  transition: transform .25s ease, box-shadow .25s ease;
}
.cat-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: white;
}

/* Photo layer — sits behind the gradient and content. Zooms on hover. */
.cat-tile .photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: -2;
  transition:
    transform .65s cubic-bezier(.2, .8, .2, 1),
    filter .35s ease;
}
.cat-tile:hover .photo {
  transform: scale(1.08);
  filter: brightness(1.08) saturate(1.15);
}

/* Dark gradient overlay — keeps the bottom text legible over any photo */
.cat-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(var(--bg-dark-rgb), 0)   30%,
    rgba(var(--bg-dark-rgb), .72) 100%
  );
  transition: opacity .35s ease;
}
.cat-tile:hover::before {
  background: linear-gradient(
    180deg,
    rgba(var(--bg-dark-rgb), 0)   25%,
    rgba(var(--bg-dark-rgb), .82) 100%
  );
}

/* Bottom info — title on top, pill below */
.cat-tile .body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--space-18);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-10);
}

.cat-tile h4 {
  margin: 0;
  font-size: var(--fs-h3-lg);
  line-height: var(--lh-heading);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-snug);
  color: white;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-tile .count {
  display: inline-flex;
  align-items: center;
  padding: var(--space-5) var(--space-10);
  border-radius: var(--pill);
  background: rgba(var(--white-rgb), .92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--ink);
  font-size: var(--fs-meta);
  font-weight: var(--fw-bold);
  line-height: 1;
  transition:
    background .25s ease,
    color .25s ease,
    box-shadow .25s ease;
}
.cat-tile:hover .count {
  background: var(--brand);
  color: white;
  box-shadow: var(--shadow-brand);
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-section .block-head h2 { font-size: var(--fs-h2-md); }
  /* Allow titles to wrap to two lines instead of truncating with ellipsis */
  .cat-tile h4 {
    font-size: var(--fs-body-lg);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: var(--lh-card);
  }
}
