/*
 * Category tiles — photo with the name laid over it.
 *
 * Grid and carousel share every tile rule; only the list container differs,
 * so a layout switch in the editor cannot drift the two apart visually.
 */

.nesa-cats {
  background: var(--cat-bg, var(--nesa-bg));
  padding-block: clamp(var(--oxa-space-5), 6vw, var(--oxa-space-7));
}

.nesa-cats__head {
  padding-inline: var(--nesa-gutter);
  margin-bottom: var(--oxa-space-5);
  text-align: center;
}

/* Rule running through the heading, as in the reference. The pseudo-elements
 * are the rule; the gap comes from the flex gap, not from a background trick,
 * so it survives any background colour behind it. */
.nesa-cats__title {
  display: flex;
  align-items: center;
  gap: var(--oxa-space-4);
  margin: 0;
  font-family: var(--nesa-font-sans);
  font-size: var(--oxa-fs-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--nesa-track-wide);
  color: var(--cat-ink, var(--nesa-ink));
}

.nesa-cats__title::before,
.nesa-cats__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--nesa-line);
}

.nesa-cats__list {
  display: grid;
  gap: var(--oxa-space-2);
  width: 100%;
  padding-inline: var(--nesa-gutter);
  list-style: none;
  margin-block: 0;
}

.nesa-cats--grid .nesa-cats__list {
  grid-template-columns: repeat(var(--cat-cols, 4), minmax(0, 1fr));
}

/* Carousel: same tiles, one row, scroll-snapped. */
.nesa-cats--carousel .nesa-cats__list {
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--cat-cols, 4) - 1) * var(--oxa-space-2)) / var(--cat-cols, 4));
  grid-template-columns: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.nesa-cats--carousel .nesa-cats__list::-webkit-scrollbar { display: none; }
.nesa-cats--carousel .nesa-cats__item { scroll-snap-align: start; }

.nesa-cats__item { min-width: 0; }

.nesa-cats__card {
  position: relative;
  display: block;
  overflow: hidden;
  color: var(--cat-label-ink, #fff);
  isolation: isolate;
}

.nesa-cats__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale var(--nesa-dur-slow) var(--oxa-ease);
}

.nesa-cats--portrait  .nesa-cats__img { aspect-ratio: 3 / 4; }
.nesa-cats--square    .nesa-cats__img { aspect-ratio: 1 / 1; }
.nesa-cats--landscape .nesa-cats__img { aspect-ratio: 4 / 3; }

.nesa-cats__img--empty { background: var(--nesa-cream); }

.nesa-cats__card:hover .nesa-cats__img { scale: 1.03; }

/* Gradient only across the bottom third — the label has to stay readable over
 * a pale studio shot without dimming the whole photograph. */
.nesa-cats__card::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 55%;
  background: linear-gradient(180deg, rgb(0 0 0 / 0) 0%, rgb(0 0 0 / .55) 100%);
  pointer-events: none;
}

.nesa-cats__label {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 1;
  padding: var(--oxa-space-3);
  font-family: var(--nesa-font-sans);
  font-size: var(--oxa-fs-sm);
  font-weight: 500;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: var(--nesa-track-ui);
  text-wrap: balance;
}

@media (max-width: 900px) {
  .nesa-cats--grid .nesa-cats__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nesa-cats--carousel .nesa-cats__list { grid-auto-columns: 60%; }
}

@media (max-width: 480px) {
  .nesa-cats--carousel .nesa-cats__list { grid-auto-columns: 78%; }
  .nesa-cats__label { font-size: var(--oxa-fs-xs); padding: var(--oxa-space-2); }
}
