/* ==========================================================================
   Mirage Furniture — Collections (#collections)
   The catalogue. Reuses the .acc accordion look (services.css) for categories
   and the projects-style image treatment for product cards. Light section.
   Built by scripts/sections/collections.js.
   ========================================================================== */

.collections {
  position: relative;
  z-index: 1;                       /* scrolls over the pinned hero */
  width: 100%;
  background: var(--color-bg);
  padding: clamp(4rem, 10vh, 8rem) var(--nav-pad-x);

  /* The reused .acc rules read these (scoped to this subtree). */
  --acc-dur: 520ms;
  --acc-icon-dur: 340ms;
}

.collections__head {
  max-width: 52rem;
  margin: 0 auto clamp(2rem, 5vh, 3.5rem);
  text-align: center;
}

.collections__eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-size: var(--text-sm);
  color: var(--color-text-body);
}

.collections__title {
  margin-top: var(--space-3);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(1.6rem, 2.7vw, 2.35rem);
  line-height: var(--leading-snug);
  color: var(--color-text-primary);
}

.collections__acc {
  max-width: 72rem;
  margin: 0 auto;
}

/* Small product count next to each category title. */
.collection__count {
  flex: 0 0 auto;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text-body);
}

/* Short descriptor under the category title, clarifying what it contains. */
.collection__blurb {
  margin: 0;
  padding-top: clamp(0.75rem, 2vh, 1.25rem);
  max-width: 42rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--color-text-body);
}

/* --- Product card grid (inside each open category) ------------------------ */
.collection__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: clamp(1rem, 2vw, 1.75rem);
  padding: clamp(1rem, 2.5vh, 1.75rem) 0 clamp(1.5rem, 3vh, 2.5rem);
}

.collection__empty {
  padding: 0 0 clamp(1.5rem, 3vh, 2.5rem);
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.2vw, 1.15rem);
  color: var(--color-text-body);
}

/* Product card — projects-style image treatment, in a static grid. */
.collection__card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;     /* matches the square studio shots — no cropping */
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-hero-text);
  text-align: left;
  cursor: pointer;
}

.collection__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.collection__card:hover .collection__img {
  transform: scale(1.04);
}

.collection__grad {
  position: absolute;
  inset: 0;
  /* Smoother, slightly deeper top scrim so the white name stays legible
     over pale (White Wash) products as well as dark ones. */
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.58) 0%,
    rgba(0, 0, 0, 0.22) 22%,
    rgba(0, 0, 0, 0) 48%
  );
  pointer-events: none;
}

.collection__overlay {
  position: absolute;
  inset: 0;
  /* Lighter hover wash (was 0.5) so the product isn't dulled; paired with a
     bottom scrim that grounds the "View details" label. */
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.5) 0%,
    rgba(0, 0, 0, 0.18) 30%,
    rgba(0, 0, 0, 0.12) 100%
  );
  opacity: 0;
  transition: opacity var(--projects-fade, 450ms) ease;
  pointer-events: none;
}
.collection__card:hover .collection__overlay {
  opacity: 1;
}

.collection__name {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  margin: 0;
  padding: clamp(0.85rem, 1.6vw, 1.25rem);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-size: clamp(0.95rem, 1.2vw, 1.15rem);
  line-height: 1.25;
  color: var(--color-hero-text);
  /* Soft halo + crisp edge so the name reads on any product tone. */
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
}

.collection__cta {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 2;
  padding: clamp(0.85rem, 1.6vw, 1.25rem);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-size: var(--text-xs);
  color: var(--color-hero-text);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--projects-fade, 450ms) ease,
    transform var(--projects-fade, 450ms) ease;
}
.collection__card:hover .collection__cta {
  opacity: 1;
  transform: none;
}

/* --- Detail modal (Option B) ---------------------------------------------- */
.collection-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.collection-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.collection-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
}

.collection-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 60rem;
  max-height: 88vh;
  overflow: auto;
  background: var(--color-bg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  transform: translateY(16px);
  transition: transform 0.4s ease;
}
.collection-modal.is-open .collection-modal__panel {
  transform: none;
}

.collection-modal__media {
  position: relative;
  /* Square to match the 1:1 studio shots, so they fill with no letterbox
     bands; cream backdrop blends with the photos (and softens any landscape
     lifestyle shot's bands). Does not stretch to the body column's height. */
  aspect-ratio: 1 / 1;
  align-self: start;
  background: var(--color-photo-bg);
}
.collection-modal__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;     /* show the whole product/scene — never cropped */
}

/* Thumbnail strip over the bottom of the media column. */
.collection-modal__thumbs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.35),
    rgba(0, 0, 0, 0)
  );
}
.collection-modal__thumb {
  flex: 0 0 auto;
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s ease, border-color 0.3s ease;
}
.collection-modal__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.collection-modal__thumb:hover {
  opacity: 1;
}
.collection-modal__thumb.is-active {
  opacity: 1;
  border-color: var(--color-bg);
}

.collection-modal__body {
  padding: clamp(1.75rem, 3vw, 2.75rem);
}

.collection-modal__name {
  margin: 0;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-size: clamp(1.3rem, 2vw, 1.75rem);
  line-height: 1.25;
  color: var(--color-text-primary);
}

.collection-modal__desc {
  margin-top: var(--space-4);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(1rem, 1.2vw, 1.15rem);
  line-height: var(--leading-normal);
  color: var(--color-text-body);
}

.collection-modal__specs {
  margin-top: var(--space-4);
  border-top: 1px solid var(--color-hairline);
}
.collection-modal__spec {
  display: flex;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--color-hairline);
  font-family: var(--font-body);
  font-size: var(--text-sm);
}
.collection-modal__spec-label {
  flex: 0 0 9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-body);
}
.collection-modal__spec-value {
  flex: 1 1 auto;
  color: var(--color-text-primary);
}

/* Weave-colour swatches (brand-wide, informational). */
.collection-modal__swatches {
  margin-top: var(--space-4);
}
.collection-modal__swatches-label {
  margin: 0 0 0.75rem;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--text-sm);
  color: var(--color-text-body);
}
.collection-modal__swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}
.collection-modal__swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 3rem;
}
.collection-modal__swatch-chip {
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  border: 1px solid var(--color-hairline);
}
.collection-modal__swatch-name {
  font-family: var(--font-body);
  font-size: 0.7rem;
  line-height: 1.2;
  text-align: center;
  color: var(--color-text-body);
}

.collection-modal__cta {
  display: inline-block;
  margin-top: var(--space-5);
  padding: 0.9rem 2rem;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-size: var(--text-xs);
  color: var(--color-bg);
  background: var(--color-text-primary);
  text-decoration: none;
  transition: opacity 0.3s ease;
}
.collection-modal__cta:hover {
  opacity: 0.85;
}

.collection-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 768px) {
  .collection-modal__panel {
    grid-template-columns: 1fr;
  }
  .collection-modal__media {
    min-height: 16rem;
  }
  /* Nudge swatch labels up to 12px for mobile legibility. */
  .collection-modal__swatch-name {
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .collection__img,
  .collection__overlay,
  .collection__cta,
  .collection-modal,
  .collection-modal__panel {
    transition: none;
  }
}
