/* ==========================================================================
   Section: curated-collection  →  assets/section-curated-collection.css
   Figma 1089-4051 ("Curated For Him"): 1320 inside the page width, 54px below the category
   row. Two 658px columns 4px apart — a product grid on the left, a promo panel on the right
   that sticks under the header while the grid scrolls past and releases at the end of the
   grid. Native position: sticky, so it follows Lenis without a scroll listener.
   Figma clips the frame at 820px; the grid holds as many products as the section is given.
   Modifier: .curated-collection--reverse puts the panel on the left (Figma 1089-4152,
   "Curated For Her"), which also sets --panel-shade to darken its photo.
   ========================================================================== */
.curated-collection {
  --column-gap: 4px;
  --row-gap: 24px;
  --panel-height: 820px;
  --panel-inset: 40px;
  --sticky-top: calc(var(--header-height) + 1px); /* just under the solid header */
  --sticky-bottom-gap: 16px;
  --cta-gap: 24px; /* where the intro is released above the button */
  --section-top: 54px;

  padding-top: var(--section-top);
}

/* row-reverse: the panel comes first in the document (it carries the heading) and sits right */
.curated-collection__inner {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: var(--column-gap);
}

/* Product grid — two 327px columns at the design width */
.curated-collection__grid {
  display: grid;
  flex: 0 0 calc(50% - var(--column-gap) / 2);
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--row-gap) var(--column-gap);
}

/* Promo panel */
.curated-collection__panel {
  position: sticky;
  top: var(--sticky-top);
  display: flex;
  flex: 0 0 calc(50% - var(--column-gap) / 2);
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  height: min(var(--panel-height), calc(100dvh - var(--sticky-top) - var(--sticky-bottom-gap)));
  padding: var(--panel-inset);
  /* clip, not hidden: hidden would make the panel a scroll container and the sticky intro inside
     it would resolve against the panel instead of the page, so it would never move */
  overflow: clip;
  isolation: isolate;
  background: var(--color-surface-muted);
  color: var(--color-text-inverse);
}

/* Panel on the left (Figma "Curated For Her") */
.curated-collection--reverse .curated-collection__inner {
  flex-direction: row;
}

/* --panel-shade tints the photo (Figma darkens the "Curated For Her" one by 20%).
   Both this and the image sit at z-index -1, so the later one wins and the text stays on top. */
.curated-collection__panel::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--panel-shade, transparent);
  pointer-events: none;
}

/* Image settings on .curated-collection__panel: --focal-x / --focal-y / --zoom (hero model) */
.curated-collection__image {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focal-x, 50%) var(--focal-y, 50%);
  transform: scale(var(--zoom, 1));
  transform-origin: var(--focal-x, 50%) var(--focal-y, 50%);
}

/* The intro's run: the whole panel down to --cta-gap above the button. The intro is sticky inside
   it, so it holds its place on screen while the panel is stuck and while the panel scrolls away
   afterwards, and is handed back exactly when the button rising from the bottom reaches it. */
.curated-collection__intro-track {
  flex: 1;
  margin-bottom: var(--cta-gap);
}

.curated-collection__intro {
  position: sticky;
  top: calc(var(--sticky-top) + var(--panel-inset));
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 370px;
}

.curated-collection__eyebrow {
  font-size: var(--text-body-s-size);
  font-weight: 500;
  line-height: 1.2;
}

.curated-collection__title {
  font-family: var(--font-display);
  font-size: var(--text-display-l-size); /* Figma Heading/H1 */
  font-weight: 500;
  line-height: 1.2;
}

.curated-collection__cta {
  align-self: flex-start;
}

@media (max-width: 989px) {
  /* both selectors: the --reverse modifier outranks a bare class inside a media query */
  .curated-collection__inner,
  .curated-collection--reverse .curated-collection__inner {
    flex-direction: column;
    gap: 24px;
  }

  .curated-collection__grid,
  .curated-collection__panel {
    flex: none;
    width: 100%;
  }

  .curated-collection__panel {
    position: relative;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  /* nothing sticks at this width, the intro included */
  .curated-collection__intro {
    position: static;
  }
}

@media (max-width: 749px) {
  .curated-collection {
    --panel-inset: 24px;
    padding-top: 48px;
  }

  .curated-collection__panel {
    aspect-ratio: 4 / 3;
  }

  .curated-collection__title {
    font-size: 36px;
  }
}
