/*
 * The category rail: every subject BISP teaches, as a row of pictures that
 * scrolls sideways.
 *
 * Two things shape it. A card has to look finished before its photograph
 * exists, so the tile behind the picture is a colour the card derives from its
 * own name and the initials sit on it - when the photograph lands it simply
 * covers them. And the rail is scrolled, not paged: the arrows move it by one
 * screenful, but a touch or a trackpad moves it directly, so it works the same
 * whether or not the script runs.
 *
 * Loaded from HomeController with the rest of the home page's own stylesheets.
 */

.cat-rail {
  padding: clamp(40px, 5vw, 66px) 0 clamp(8px, 1.4vw, 18px);
  color: var(--h26-ink, #062a40);
}

.cat-rail__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 22px; margin-bottom: clamp(18px, 2.2vw, 26px);
}
.cat-rail__eyebrow {
  display: block; margin-bottom: 9px;
  font-size: 10px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase;
  color: var(--h26-muted, #496878);
}
.cat-rail__head h2 {
  margin: 0; font-size: clamp(22px, 2.4vw, 33px); line-height: 1.2; letter-spacing: -.035em;
}

.cat-rail__nav { display: flex; gap: 8px; flex: none; }
.cat-rail__nav[hidden] { display: none; }
.cat-rail__arrow {
  width: 46px; height: 46px; display: grid; place-items: center;
  border: 1px solid rgba(6, 42, 64, .16); border-radius: 50%;
  background: #fff; color: #0b3b53; font-size: 18px; cursor: pointer;
  transition: border-color .2s, color .2s, transform .2s, opacity .2s;
}
.cat-rail__arrow:hover:not(:disabled) { border-color: #0c8ce9; color: #0c8ce9; transform: translateY(-2px); }
.cat-rail__arrow:focus-visible { outline: 2px solid #0c8ce9; outline-offset: 3px; }
.cat-rail__arrow:disabled { opacity: .32; cursor: default; }

/* the rail itself */
.cat-rail__track {
  display: flex; gap: 18px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-left: 2px;
  padding: 4px 2px 18px;
  scrollbar-width: none;
}
.cat-rail__track::-webkit-scrollbar { display: none; }
.cat-rail__track:focus-visible { outline: 2px solid #0c8ce9; outline-offset: 4px; border-radius: 16px; }

.cat-card {
  flex: none; width: 300px; scroll-snap-align: start;
  display: flex; flex-direction: column;
  border: 1px solid rgba(6, 42, 64, .10); border-radius: 18px;
  background: #fff; overflow: hidden; text-decoration: none !important; color: inherit;
  box-shadow: 0 10px 26px -22px rgba(6, 42, 64, .75);
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}
.cat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(12, 140, 233, .45);
  box-shadow: 0 18px 38px -24px rgba(6, 42, 64, .85);
}
.cat-card:focus-visible { outline: 2px solid #0c8ce9; outline-offset: 3px; }

/* The picture, or the tile that stands in for one. The colour comes from
   --cat-tone, a hue the category derives from its own name, so two categories
   are never the same colour and one never changes between page loads. */
.cat-card__art {
  position: relative; display: grid; place-items: center;
  aspect-ratio: 7 / 5; overflow: hidden;
  background:
    linear-gradient(140deg,
      hsl(var(--cat-tone, 200) 62% 42%),
      hsl(calc(var(--cat-tone, 200) + 26) 58% 28%));
}
.cat-card__art img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  /* Product names and logos must remain fully visible in every category. */
  object-fit: contain; display: block; padding: 18px;
  box-sizing: border-box; background: #fff;
  transition: transform .45s ease;
}
.cat-card:hover .cat-card__art img { transform: scale(1.025); }
.cat-card__mark {
  font-size: 44px; font-weight: 800; letter-spacing: .04em; color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .28);
}
/* a faint grid over the tile, so an empty card still reads as deliberate */
.cat-card__art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(0deg, rgba(255, 255, 255, .10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .10) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: .5;
}
.cat-card__art:has(img)::after { opacity: 0; }

.cat-card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 5px; }
.cat-card__label { font-size: 16.5px; font-weight: 800; line-height: 1.3; letter-spacing: -.015em; }
.cat-card__count { font-size: 13px; font-weight: 600; color: var(--h26-muted, #496878); }

/* the last card, which has no picture by design */
.cat-card--all {
  justify-content: center; min-height: 100%;
  background: linear-gradient(130deg, #0c8ce9, #14b8a6);
  border-color: transparent; color: #fff;
}
.cat-card--all .cat-card__count { color: rgba(255, 255, 255, .88); }
.cat-card--all .cat-card__body { padding: 22px 18px; }

@media (max-width: 760px) {
  .cat-rail__head { align-items: flex-start; }
  .cat-rail__nav { display: none; }
  .cat-card { width: 240px; }
  .cat-card__mark { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .cat-rail__track { scroll-behavior: auto; }
  .cat-card, .cat-card__art img, .cat-rail__arrow { transition: none; }
  .cat-card:hover { transform: none; }
  .cat-card:hover .cat-card__art img { transform: none; }
}
