/* ==========================================================
   pages/collection.css — Collection page background layers,
   smoke overlay, editorial header, grid, and profile CTA
   ========================================================== */

/* ── Page Wrapper ────────────────────────────────────── */
.collection-page {
  background-color: var(--color-surface);
  color: var(--color-on-surface);
  font-family: var(--font-body);
  min-height: 100vh; /* fallback */
  min-height: 100svh;
  position: relative;
  /* MUST be `clip`, NOT `hidden`.
     overflow-x:hidden silently promotes overflow-y:visible → overflow-y:auto
     (CSS spec §overflow), turning .collection-page into a scroll container that
     allocates ~15px scrollbar gutter space on Windows, causing a lateral
     layout shift whenever the overscroll engine extends the painted area.
     overflow:clip clips both axes without creating a scroll container and
     allocates zero scrollbar space. */
  overflow: clip;
}

/* ── Fixed Background Layer ──────────────────────────── */
.collection-fixed-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  height: var(--locked-bg-height, 100lvh);
  z-index: 0;
  opacity: 0;
  transform: scale(1.05) translateZ(0);
  pointer-events: none;
  background-size: cover;
  background-position: center;
  
  /* The long 2.5s transition and 0.2s delay ensures the image
     eases into view well after the main curtain lifts, giving
     the browser ample time to decode the asset smoothly. */
  transition: opacity 2.5s cubic-bezier(0.22, 1, 0.36, 1) 0.2s,
              transform 3s cubic-bezier(0.22, 1, 0.36, 1);
  /* Promote to its own GPU compositor layer so mobile browser chrome
     toggling (address bar appear/disappear) cannot shift this element.
     Once composited, it is geometrically frozen relative to the screen. */
  will-change: transform;
}

body.page-loaded .collection-fixed-bg {
  opacity: 0.1;
  transform: scale(1) translateZ(0);
}

/* ── Moody Header Vignette ───────────────────────────── */
.collection-vignette {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 45vh; /* fallback */
  height: 45lvh;
  z-index: 10;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(15, 12, 10, 0.95),
    rgba(15, 12, 10, 0.60),
    transparent
  );
}

/* ── Main Content ────────────────────────────────────── */
.collection-main {
  position: relative;
  z-index: 30;
  min-height: 100vh; /* fallback */
  min-height: 100svh;
}

.collection-section {
  padding-top: 6rem;
  padding-bottom: 8rem;
  width: 100%;
}

/* ── Editorial Header ────────────────────────────────── */
.collection-editorial {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  margin-bottom: clamp(0.75rem, 5vw, 2.8rem);
  position: relative;
  z-index: 30;
}

.collection-editorial-inner {
  position: relative;
  padding: 1.5rem 0;
}

.collection-label {
  font-family: var(--font-label);
  color: var(--color-primary);
  font-size: 0.625rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.collection-heading {
  font-family: var(--font-headline);
  font-size: clamp(2rem, 5vw + 1rem, 4.5rem);
  font-weight: 900;
  color: var(--color-on-surface);
  letter-spacing: -0.05em;
  white-space: nowrap;
}

.collection-heading-accent {
  display: block;
  width: 3rem;
  height: 2px;
  background-color: var(--color-primary-container);
  margin-top: 1.0rem;
  margin-bottom: 1.5rem;
}

/* ── Collection Grid ─────────────────────────────────── */
.collection-grid {
  max-width: 60rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.75rem, 3vw, 3.2rem);
  padding: 0 1.5rem;
}

/* 
   First card spans both columns (marquee).
   Even indices (2, 4, 6...) → Left column.
   Odd indices (3, 5, 7...) → Right column.
*/
.collection-grid > .collection-card-reveal:first-child {
  transform-origin: center center;
  grid-column: 1 / -1;
  /* Fluid negative pull — proportional as viewport shrinks */
  margin-top: clamp(-2rem, -3.5vw, -1rem);
}
.collection-grid > .collection-card-reveal:nth-child(even) {
  transform-origin: right center;
}
.collection-grid > .collection-card-reveal:nth-child(odd):not(:first-child) {
  transform-origin: left center;
}

/* Marquee card content */
.collection-grid > .collection-card-reveal:first-child .collection-card-content {
  padding: clamp(1rem, 3vw, 2.8rem);
}
.collection-grid > .collection-card-reveal:first-child .collection-card-brand {
  font-size: clamp(1.5rem, 3.5vw, 3.2rem);
  margin-bottom: clamp(0.2rem, 0.5vw, 0.6rem);
}
.collection-grid > .collection-card-reveal:first-child .collection-card-line {
  font-size: clamp(0.6rem, 0.9vw, 0.9rem);
}

/* ── Profile CTA Banner ─────────────────────────────── */
.collection-cta-banner {
  margin-top: 5rem;
  max-width: 60rem;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1.5rem;
}
.collection-cta-inner {
  padding: clamp(2rem, 5vw, 4rem);
  border: 1px solid rgba(85, 67, 54, 0.10);
  border-radius: 0.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
  background: rgba(24, 18, 16, 0.80);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.collection-cta-text {
  font-family: var(--font-headline);
  font-size: clamp(1.25rem, 3vw, 1.875rem);
  margin-bottom: 2rem;
  color: #fffbeb;       /* text-amber-50 */
}


/* ── Responsive ──────────────────────────────────────── */

@media (min-width: 1024px) {
  .collection-editorial {
    max-width: 78rem;
    margin-bottom: 2.8rem;
    pointer-events: none; /* Let clicks pass through to the marquee behind it */
    position: relative;
    z-index: 40; /* Ensure text layers strictly above the grid */
  }

  .collection-grid {
    max-width: 78rem;
    position: relative;
    z-index: 20;
    column-gap: clamp(0.48rem, 1.92vw, 2.05rem);
  }

  .collection-cta-banner {
    max-width: 78rem;
  }
}

/* ── Mobile Real Estate Optimization (< 512px) ─────────
   Luxury aesthetic best practices on severely constrained
   viewports dictate minimizing peripheral space (padding) 
   and gutters (gap) to maximize the scale and legibility
   of the primary asset (the brand cards).
   ────────────────────────────────────────────────────── */
@media (max-width: 512px) {
  .collection-editorial,
  .collection-grid,
  .collection-cta-banner {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  .collection-grid {
    gap: 1.2rem 0.5rem;
  }

  .collection-grid > .collection-card-reveal:first-child {
    margin-bottom: 0.36rem;
  }

  /* Maximize hero image visibility by tucking text closer to bottom/left */
  .collection-grid > .collection-card-reveal:not(:first-child) .collection-card-content {
    padding: 0.5rem 0.5rem 0.4rem 0.5rem;
  }

  .collection-grid > .collection-card-reveal:not(:first-child) .collection-card-brand {
    font-size: clamp(1.1rem, 4.5vw, 1.25rem);
    margin-bottom: -0.1rem;
  }

  .collection-grid > .collection-card-reveal:not(:first-child) .collection-card-line {
    font-size: 0.5rem;
  }
}
