/* =====================================================
   COLLECTION TILES GRID — Section Styles
   Aesthetic: restrained editorial commerce.
   No Splide dependency. Pure CSS grid (desktop) +
   native scroll-snap horizontal scroll (mobile).
===================================================== */

.collection-tiles-grid {
  color: var(--clr-text-primary, #1a1716);
}

.collection-tiles-grid__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl, 32px);
}

/* ---------- Header row ---------- */

.collection-tiles-grid__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm, 8px);
}

.collection-tiles-grid__header-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs, 4px);
}

/* Typography (font-size/weight/family/color) now driven by section dropdowns
   via utility classes in the render. Only layout properties remain here. */
.collection-tiles-grid__heading {
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.collection-tiles-grid__description {
  margin: 0;
  line-height: 1.5;
  max-width: 56ch;
}

/* Heading/description are richtext blocks rendered into a .rte wrapper.
   Typography lives on the WRAPPER (editor-safe — the WYSIWYG editor cannot
   strip the wrapper's classes). The inner <h2>/<p> inherits font + color
   from the wrapper so typography survives even after the editor rewrites
   the inner tag to a bare <p> on alignment/format edits. */
.collection-tiles-grid__heading > *,
.collection-tiles-grid__description > * {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0 !important;
}

.collection-tiles-grid__view-all {
  align-self: flex-start;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: text-underline-offset 200ms ease;
}

.collection-tiles-grid__view-all:hover,
.collection-tiles-grid__view-all:focus-visible {
  text-underline-offset: 5px;
}

.collection-tiles-grid__view-all:focus-visible {
  outline: 2px solid var(--clr-text-primary, #1a1716);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (min-width: 768px) {
  .collection-tiles-grid__header {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-lg, 24px);
  }
  .collection-tiles-grid__view-all {
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 4px;
  }
}
@media (min-width: 1024px) {
  .collection-tiles-grid__heading {
    font-size: var(--font-size-4xl, 36px);
  }
}
/* ---------- Tile list ---------- */

.collection-tiles-grid__list {
  list-style: none;
  margin: 0;
  padding: 0;

  /* Mobile (default): horizontal scroll with snap + peek */
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-sm, 8px);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  scroll-padding-left: var(--space-md, 16px);
  padding-bottom: var(--space-xs, 4px);
  margin-left: calc(-1 * var(--space-md, 16px));
  margin-right: calc(-1 * var(--space-md, 16px));
  padding-left: var(--space-md, 16px);
  padding-right: var(--space-md, 16px);
}

.collection-tiles-grid__list::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .collection-tiles-grid__list {
    display: grid;
    grid-template-columns: repeat(var(--tiles-cols, 4), 1fr);
    gap: var(--space-md, 16px);
    overflow: visible;
    scroll-snap-type: none;
    margin: 0;
    padding: 0;
  }
}

@media (min-width: 1024px) {
  .collection-tiles-grid__list {
    grid-template-columns: repeat(var(--tiles-cols, 4), 1fr);
  }
}

/* ---------- Tile ---------- */

.collection-tile {
  list-style: none;
  margin: 0;
  padding: 0;

  /* Mobile: peek-width slide */
  flex: 0 0 76%;
  width: 76%;
  min-width: 0;
  scroll-snap-align: start;
}

@media (min-width: 768px) {
  .collection-tile {
    flex: initial;
    width: auto;
    scroll-snap-align: none;
  }
}

/* The photograph IS the card. No white surface, no caption bar underneath —
   the label sits on the image over a scrim, so the six tiles read as one row
   of photographs rather than six bordered boxes. */
.collection-tile__link {
  position: relative;
  display: block;
  height: 100%;
  border-radius: var(--radius-lg, 13px);
  overflow: hidden;
  text-decoration: none;
  color: var(--clr-white, #ffffff);
  background-color: var(--clr-neutral-medium, #d9d3cc);
}

.collection-tile__link:focus-visible {
  outline: 2px solid var(--clr-text-primary, #1a1716);
  outline-offset: 3px;
}

/* Empty-state tile (no category picked yet): keep the old outlined look so a
   misconfigured tile still reads as "nothing here", not as a dark photo. */
.collection-tile--empty .collection-tile__link {
  background-color: var(--clr-bg-page, #ffffff);
  border: 1px dashed var(--clr-border-dark, #dad0c9);
}
.collection-tile--empty .collection-tile__scrim {
  display: none;
}
.collection-tile--empty .collection-tile__title,
.collection-tile--empty .collection-tile__arrow {
  color: var(--clr-text-muted, #7a7067);
  text-shadow: none;
}
.collection-tile--empty .collection-tile__title {
  font-style: italic;
}

/* ---------- Tile media ---------- */

/* 4 / 3 matches the supplied lifestyle photography (1500 x 1126) exactly, so
   nothing is cropped away at any breakpoint. */
.collection-tile__media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: block;
}

.collection-tile__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* Product pack shot used as a fallback tile image: show the whole pack, don't crop it. */
.collection-tile__image--product {
  object-fit: contain;
  padding: var(--space-md, 16px);
  box-sizing: border-box;
}

.collection-tile__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-md, 16px);
  font-size: var(--font-size-2xl, 24px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--clr-text-primary, #1a1716);
}

/* ---------- Scrim ----------
   Two stops rather than one: a soft shoulder that starts around the middle of
   the image, then a faster ramp over the bottom third where the text actually
   sits. A single linear fade either muddies the photo too high up or leaves the
   label short of contrast on a bright frame. */

.collection-tile__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(22, 23, 22, 0.78) 0%,
    rgba(22, 23, 22, 0.58) 18%,
    rgba(22, 23, 22, 0.22) 42%,
    rgba(22, 23, 22, 0) 68%
  );
}

/* ---------- Tile title strip (overlaid) ---------- */

.collection-tile__strip {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md, 16px);
  padding: var(--space-md, 16px);
}

@media (min-width: 1024px) {
  .collection-tile__strip {
    padding: var(--space-lg, 24px);
  }
}

.collection-tile__title {
  line-height: 1.2;
  letter-spacing: -0.005em;
  /* Insurance for the brightest frames — the scrim does the work, this only
     keeps the edges of the letterforms from dissolving into a highlight. */
  text-shadow: 0 1px 3px rgba(22, 23, 22, 0.45);
}

.collection-tile__arrow {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: inherit;
  transform: translateX(0);
}

.collection-tile__arrow svg {
  display: block;
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 1px 3px rgba(22, 23, 22, 0.45));
}

@media (min-width: 1024px) {
  .collection-tile__arrow svg {
    width: 28px;
    height: 28px;
  }
}

/* ---------- Micro-interaction (reduced-motion-aware) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .collection-tile__arrow,
  .collection-tile__image,
  .collection-tile__scrim {
    transition: transform 400ms cubic-bezier(0.2, 0, 0.2, 1), opacity 250ms ease;
  }
  .collection-tile__arrow {
    transition: transform 200ms ease;
  }
  .collection-tile__link:hover .collection-tile__arrow,
  .collection-tile__link:focus-visible .collection-tile__arrow,
  .collection-tile__link:active .collection-tile__arrow {
    transform: translateX(6px);
  }
  .collection-tile__link:hover .collection-tile__image,
  .collection-tile__link:focus-visible .collection-tile__image {
    transform: scale(1.04);
  }
}
