/* Carousel & list scrollers
   -------------------------------------------------------------------------
   Everything wired up by carousel.js, plus the group single's list scrollers.
   Gathered from sections.css (nav arrows + testimonials track) and cards.css
   (group carousel track, roster head, member search, event scroll) so the
   component lives in one place. Enqueued after forms.css — the member-search
   input rule below relies on out-specifying forms.css. */

/* --- Navigation arrows (shared, wired by carousel.js) -------------------- */

/* Reusable carousel navigation arrows. Shared by the testimonials section and
   the group members carousel (see inc/template-parts/pager-arrows.php). */
.carousel-nav {
  display: flex;
  flex-shrink: 0;
  gap: var(--space-sm);
}

.carousel-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: none;
  border-radius: var(--br-rounded);
  background-color: var(--primary-color);
  color: var(--white);
  cursor: pointer;
  transition: background-color var(--duration) var(--ease), opacity var(--duration-fast) var(--ease);
}

.carousel-arrow:hover {
  background-color: var(--primary-80);
}

.carousel-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.carousel-arrow svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

.carousel-arrow--prev svg {
  transform: scaleX(-1);
}

/* --- Testimonials track (homepage) --------------------------------------- */

/* Horizontal scroll track. Cards are sized to --container-inner so a set
   number fit within the container. The track itself bleeds to both edges of
   the browser, with gutter padding holding the cards aligned to the
   container at rest — so as you scroll, cards nudge left off the viewport
   edge instead of clipping at the container edge. */
.testimonials__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc(var(--container-inner) - var(--space-xl)); /* mobile: 1 card + peek */
  gap: var(--card-gap);
  margin: 0 calc(50% - 50vw); /* full-bleed: both edges reach the viewport */
  padding: 0 calc(50vw - 50%); /* gutters align cards to the container (the cards have no shadow, so no vertical room) */
  list-style: none;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
}

.testimonials__track::-webkit-scrollbar {
  display: none;
}

@media (min-width: 48rem) {
  /* tablet: 2 cards in the container */
  .testimonials__track {
    grid-auto-columns: calc((var(--container-inner) - var(--card-gap)) / 2);
  }
}

@media (min-width: 62rem) {
  /* desktop: 3 cards in the container */
  .testimonials__track {
    grid-auto-columns: calc((var(--container-inner) - var(--card-gap) * 2) / 3);
  }
}

/* --- Group single: heading row (title + arrows + member search) ---------- */

/* Section heading row: title left, carousel arrows right (reuses .carousel-nav).
   The members search also lives here — see .roster-head .group-search below. */
.roster-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.roster-head h2 {
  margin: 0;
}

/* A headed block that follows cards in a single page's column (group Upcoming
   Events + Members, member Group memberships, event Hosted by): --space-lg above
   it instead of the --card-gap, so the heading sits nearer its own content
   (--space-md below) than the card above. The margin adds to the column's gap,
   so it tops the gap up to --space-lg. */
.group-carousel,
.group-events {
  margin-top: calc(var(--space-lg) - var(--card-gap));
}

/* ...but not when nothing is above it: on desktop a block that opens its column
   (a member with no bio, a group with no aside cards) lines up with the other
   column's top. */
@media (min-width: 62rem) {
  :is(.member-layout__main, .group-layout__aside, .group-layout__main, .event-aside, .event-main) > :is(.group-carousel, .group-events):first-child {
    margin-top: 0;
  }
}

/* Members search inside the roster head. Mobile: wraps to its own full-width
   row beneath the heading + arrows. Desktop: shrinks and sits inline, just left
   of the pager arrows (order + margin-left:auto push the pair to the right). */
.roster-head .group-search {
  flex: 1 1 100%;
}

@media (min-width: 62rem) {
  .roster-head {
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  .roster-head h2 { order: 1; }
  .roster-head .group-search {
    order: 2;
    flex: 0 1 24rem;
    margin-left: auto;
  }
  .roster-head .carousel-nav { order: 3; }

  /* No search to push them over (member Group memberships, event Hosted by):
     the arrows go to the right on their own. */
  .roster-head:not(:has(.group-search)) .carousel-nav {
    margin-left: auto;
  }
}

/* --- Group single: members carousel track -------------------------------- */

/* Horizontal carousel track for the members list. Mirrors the testimonials
   track (scroll-snap, hidden scrollbar) but stays within its roster column
   rather than bleeding full-width. */
.group-carousel__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  gap: var(--card-gap);
  /* Negative margin + matching padding so the scroll container's clip box
     extends past the cards on every side — room for their shadows — while the
     cards still line up with the column edges. */
  margin: 0 -0.75rem;
  padding: 0.75rem;
  min-width: 0; /* allow the track to scroll within its column */
  list-style: none;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
}

.group-carousel__track::-webkit-scrollbar {
  display: none;
}

/* Members (compact avatar cards): three rows per column — one column (3 cards)
   on mobile, two columns (6 cards: 2 across, 3 down) per view from desktop. */
.group-carousel__track--members {
  grid-template-rows: repeat(3, auto);
}

@media (min-width: 62rem) {
  .group-carousel__track--members {
    grid-auto-columns: calc((100% - var(--card-gap)) / 2);
  }
}

/* While the members search has a term (carousel.js), the track is a plain grid
   filling left to right — 1 across, 2 from desktop — so the matches read in
   rows rather than down each carousel column. Nothing overflows, so the arrows
   hide themselves. */
.group-carousel__track--members.is-filtered {
  grid-auto-flow: row;
  grid-template-rows: none;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 62rem) {
  .group-carousel__track--members.is-filtered {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Member-single group memberships (image cards): ONE row — stacking banner cards
   down a column left a half-empty view with only a couple of groups. 1 per view
   on mobile, 2 from tablet (in the 2/3 main column that's ~a third of the page,
   the same card width as the 3-across .cards grid). */
@media (min-width: 48rem) {
  .group-carousel__track--groups {
    grid-auto-columns: calc((100% - var(--card-gap)) / 2);
  }
}

/* --- Member search field ------------------------------------------------- */

/* Members search field — pill input + filled brand disc, matching the header
   search (reuses its white magnifying-glass disc). Decorative icon (the field
   filters live as you type). */
.group-search {
  position: relative;
}

/* Extra ancestor class so this beats the aggressive base input rule in forms.css.
   Padding/height match the header search field. */
.group-layout .group-search input[type="search"] {
  width: 100%;
  height: 3rem;
  padding: 0 3rem 0 0.875rem;
  border-radius: var(--br-rounded);
}

.group-search__icon {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--primary-color);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cline x1='21' y1='21' x2='15.5' y2='15.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 1.4rem;
  pointer-events: none;
}

/* --- Group single: events vertical scroller ------------------------------ */

/* Group events: vertical scrolling list (mirrors the map results panel in
   map.css — which only loads on the map page, so the styles live here). Shows
   ~3 cards, the next peeking under a bottom fade as a scroll cue. */
.event-scroll {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
  max-height: 32rem;
  overflow-y: auto;
  /* Negative side margins + matching side padding give the cards' shadows room
     (overflow-y clips the x-axis too), while keeping them aligned to the column
     edges. */
  margin: 0 -0.75rem;
  padding: 0.75rem;
  /* Scroll affordances: a thin brand scrollbar (desktop) plus a hard-clipped
     next card ("peek"), so it also reads on touch — where scrollbars never
     show — that the list continues. */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: var(--primary-color) transparent;
}

/* Thin brand scrollbar (WebKit/Blink): styling it forces a persistent bar even
   when the OS is set to auto-hide overlay scrollbars. */
.event-scroll::-webkit-scrollbar {
  width: 8px;
}

.event-scroll::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: var(--br-rounded);
}

.event-scroll::-webkit-scrollbar-track {
  background: transparent;
}
