/* ==========================================================================
   Section: Collections — "سه روایت از طلا"
   Three chapters, three different compositions. The page dims from ivory
   to charcoal as the intro arrives (tone.js).
   WordPress: template-parts/collections.php (one chapter = one block)
   ========================================================================== */

.collections {
  padding-block: var(--s-10) var(--s-9);
}

/* ---- Intro ---------------------------------------------------------------- */
.collections__intro {
  display: grid;
  gap: var(--s-4);
  padding-block-end: var(--s-9);
}

.collections__intro .kicker {
  --kicker-color: var(--c-paper-muted);
}

.collections__title {
  font-size: var(--t-title);
  font-weight: var(--w-light);
  line-height: var(--lh-title);
  letter-spacing: -0.005em;
}

.collections__sub {
  font-size: var(--t-body);
  color: var(--c-paper-muted);
}

/* ---- Chapter: shared ------------------------------------------------------ */
.chapter {
  position: relative;
  display: grid;
}

/* Each chapter closes before the next opens: generous air plus a hairline,
   so a text group always belongs to its own image. */
.chapter + .chapter {
  margin-block-start: var(--s-9);
  padding-block-start: var(--s-9);
  border-block-start: var(--hairline) solid var(--c-rule-dark);
}

.chapter__media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  --frame-bg: #19110c;
}

.chapter__media img {
  transition: transform 1600ms var(--ease-out), opacity var(--d-base) var(--ease-out);
}

@media (hover: hover) {
  .chapter__media:hover img {
    transform: scale(1.025);
  }
}

.chapter__text {
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--s-3);
}

.chapter__num {
  font-family: var(--f-numeral);
  font-style: normal;
  font-weight: 500;              /* serifs stay crisp from 72px to 160px */
  font-size: var(--t-numeral);
  line-height: 0.8;
  letter-spacing: 0.06em;        /* keeps the serifs of II / III from touching */
  margin-right: -0.06em;         /* cancels the trailing tracking so the numeral keeps its edge */
  color: var(--c-sand);
  direction: ltr;
  unicode-bidi: isolate;
  user-select: none;
  justify-self: start;          /* grid start = right edge in RTL */
}

.chapter__label {
  color: var(--c-paper-muted);
  justify-self: start;
}

.chapter__title {
  font-size: var(--t-title);
  font-weight: var(--w-light);
  line-height: 1.5;
}

.chapter__line {
  font-size: var(--t-lead);
  font-weight: var(--w-light);
  color: rgb(243 237 227 / 0.78);
  max-inline-size: 20em;
}

.chapter .text-link {
  margin-block-start: var(--s-3);
  justify-self: start;
}

/* ---- I · Luxury: full bleed, dissolves into the charcoal ------------------ */
.chapter--luxury .chapter__media {
  margin-inline: calc(var(--gutter) * -1);
}

.chapter--luxury .chapter__media::after {
  /* the dark velvet melts into the page */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(0deg, var(--c-charcoal) 0%, rgb(17 17 17 / 0) 26%),
    linear-gradient(180deg, var(--c-charcoal) 0%, rgb(17 17 17 / 0) 9%);
}

.chapter--luxury .chapter__text {
  margin-block-start: calc(var(--t-numeral) * -0.62);
  z-index: 1;
}

/* ---- II · Affordable: an offset print with the numeral beside it ---------- */
.chapter--affordable {
  grid-template-columns: 1fr minmax(0, 68%);
  column-gap: var(--s-4);
  align-items: start;
}

.chapter--affordable .chapter__media {
  grid-column: 2;
  grid-row: 1;
  --frame-bg: #cfb9a5;
}

.chapter--affordable .chapter__aside {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  padding-block-end: var(--s-5);
}

.chapter--affordable .chapter__text {
  grid-column: 1 / -1;
  margin-block-start: var(--s-6);
  padding-inline-start: 0;
}

/* ---- III · Gift: framed like a small print, words above ------------------- */
.chapter--gift {
  justify-items: center;
}

.chapter--gift .chapter__text {
  justify-self: stretch;
  grid-template-columns: auto 1fr;
  column-gap: var(--s-5);
  align-items: end;
  margin-block-end: var(--s-6);
}

.chapter--gift .chapter__num {
  grid-row: span 3;
  align-self: end;
}

.chapter--gift .chapter__label,
.chapter--gift .chapter__title,
.chapter--gift .chapter__line,
.chapter--gift .text-link {
  grid-column: 2;
}

.chapter--gift .chapter__mat {
  inline-size: min(78%, 22rem);
  padding: clamp(0.625rem, 2.6vw, 1.125rem);
  background: var(--c-ivory);
  box-shadow: 0 1.5rem 3rem -1.5rem rgb(0 0 0 / 0.6);
}

.chapter--gift .chapter__media {
  --frame-bg: #c6a888;
}

/* ==========================================================================
   Wide screens: asymmetric spreads on a 12-column grid
   ========================================================================== */
@media (min-width: 64em) {
  .collections__intro {
    grid-template-columns: repeat(12, 1fr);
    column-gap: var(--gutter);
    align-items: end;
  }

  .collections__intro .kicker { grid-column: 1 / -1; }
  .collections__title { grid-column: 1 / 7; }
  .collections__sub { grid-column: 9 / 13; justify-self: end; }

  .chapter {
    grid-template-columns: repeat(12, 1fr);
    column-gap: var(--gutter);
  }

  .chapter + .chapter {
    margin-block-start: var(--s-9);
    padding-block-start: var(--s-10);
  }

  /* I — image on the left (columns 6–12 in RTL), words bottom-right */
  .chapter--luxury .chapter__media {
    grid-column: 6 / 13;
    grid-row: 1;
    margin-inline: 0;
    inline-size: 100%;
    max-inline-size: 40rem;            /* stays within the 1122px source */
    justify-self: end;
  }

  .chapter--luxury .chapter__media::after {
    background:
      linear-gradient(0deg, var(--c-charcoal) 0%, rgb(17 17 17 / 0) 18%),
      linear-gradient(180deg, var(--c-charcoal) 0%, rgb(17 17 17 / 0) 10%),
      linear-gradient(270deg, var(--c-charcoal) 0%, rgb(17 17 17 / 0) 14%),
      linear-gradient(90deg, var(--c-charcoal) 0%, rgb(17 17 17 / 0) 14%);
  }

  .chapter--luxury .chapter__text {
    grid-column: 1 / 6;
    grid-row: 1;
    align-self: end;
    margin: 0;
    padding-block-end: var(--s-8);
  }

  /* II — small print on the right, words lower-left, shifted down */
  .chapter--affordable {
    grid-template-columns: repeat(12, 1fr);
  }

  .chapter--affordable .chapter__media {
    grid-column: 2 / 6;
    grid-row: 1 / 3;
    max-inline-size: 28rem;
  }

  .chapter--affordable .chapter__aside {
    grid-column: 7 / 9;
    grid-row: 1;
    align-self: start;
    padding: 0;
  }

  .chapter--affordable .chapter__text {
    grid-column: 7 / 12;
    grid-row: 2;
    align-self: end;
    margin: 0;
  }

  /* III — framed print centred-left, words on the right */
  .chapter--gift {
    justify-items: stretch;
    align-items: center;
  }

  .chapter--gift .chapter__text {
    grid-column: 1 / 6;
    grid-row: 1;
    margin: 0;
  }

  .chapter--gift .chapter__mat {
    grid-column: 6 / 11;
    grid-row: 1;
    inline-size: 100%;
    max-inline-size: 26rem;
    justify-self: center;
  }
}
