/* Depends on: base.css, viewport.css. */

/* ============================================================
   SECTION 7
   ============================================================
   Two steps only:
     step 0 — the text on the left, and the first photo filling the
              whole right-hand side, full section height. Nothing
              fades in; it is simply there as the section arrives.
     step 1 — all five photos spread out into the relaxed pile, each
              one at its own source aspect ratio, and the CTA under
              the text fades in.
   ============================================================ */
#slide-s7 {
  background: var(--paper-2);
  transition: height 0.9s var(--ease);
}
#slide-s7.shrink {
  height: 80vh;
  flex: none;
}

/* No padding-top on the stage: the opening photo runs the section's
   full height, with the fixed header floating over it. The text
   column carries its own header clearance instead. */
.s7-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
}

.s7-text {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--header-h) 3vw 0 6vw;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.6em;
}
.s7-text p {
  font-family: var(--display);
  font-weight: 800;
  color: var(--burgundy);
  font-size: clamp(1.15rem, 2.2vw, 1.95rem);
  line-height: 1.2;
}
/* The venue and its address, in the script face (regular weight only).
   MonteCarlo draws much smaller than Rubik at the same size, so it is
   set up a step to match the lines around it. */
.s7-script {
  font-family: "MonteCarlo", cursive;
  font-weight: 400;
  font-size: 1.45em;
  line-height: 1;
}

.s7-imgs {
  position: relative;
  flex: 0 0 56%;
  height: 100%;
  overflow: hidden;
  /* One card width, shared by every card and by the first one's
     relaxed size. Deliberately a share of THIS COLUMN rather than of
     the viewport: the spread is a card plus the last card's 136%
     offset — 2.36 cards wide — so at 36% it always lands inside the
     column (2% + 85% = 87%), at any window size, instead of running
     off the right edge on a laptop-sized screen. */
  --card-w: 36%;
}

/* Each photo is its own card at its own source ratio: a width is set,
   the height follows from the image. No cropping, no blurred filler
   copy behind it — the pile is just the photographs. */
.s7-imgs .item {
  position: absolute;
  top: 50%;
  left: 2%;
  width: var(--card-w);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: var(--item-tf, translate(0, -50%));
  transition:
    opacity 0.5s ease,
    transform 0.7s var(--ease);
}
.s7-imgs .item img {
  width: 100%;
  height: auto;
  display: block;
}
.s7-imgs .item.stacked {
  opacity: 1;
}
.s7-imgs.relaxed .item:hover {
  z-index: 50 !important;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.4);
}
.s7-imgs .item {
  pointer-events: none;
} /* clicks/hover disabled by default... */
.s7-imgs.relaxed .item {
  pointer-events: auto;
} /* ...only re-enabled once the pile has relaxed */
body.scrolling .s7-imgs .item {
  pointer-events: none;
} /* and never mid-transition */

/* Step 0: the first photo fills the right-hand side edge to edge, at
   the section's full height. It is the one photo cropped to fit
   (there is no other way to fill a fixed box edge to edge); once the
   pile relaxes it drops back to its own ratio like the rest. */
.s7-imgs .item:nth-child(1) {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 0;
  opacity: 1;
  transform: none;
  z-index: 1;
  transition:
    transform 0.8s var(--ease),
    width 0.8s var(--ease),
    height 0.8s var(--ease),
    top 0.8s var(--ease),
    left 0.8s var(--ease),
    max-width 0.8s var(--ease),
    border-radius 0.8s var(--ease);
}
.s7-imgs .item:nth-child(1) img {
  height: 100%;
  object-fit: cover;
}

/* Step 1: the relaxed pile — a loose spread, each card tilted a
   little the other way, still overlapping. */
.s7-imgs.relaxed .item:nth-child(1) {
  top: 50%;
  left: 2%;
  width: var(--card-w);
  height: auto;
  max-width: none;
  border-radius: 4px;
  --item-tf: translate(0, -72%) rotate(-4deg);
  transform: var(--item-tf);
  z-index: 1;
}
.s7-imgs.relaxed .item:nth-child(1) img {
  height: auto;
  object-fit: fill;
}
/* Offsets are a share of a card's own width, so the pile keeps its
   spacing as the cards scale with the viewport. */
.s7-imgs.relaxed .item:nth-child(2) {
  --item-tf: translate(34%, 20%) rotate(3deg);
  z-index: 2;
}
.s7-imgs.relaxed .item:nth-child(3) {
  --item-tf: translate(68%, -66%) rotate(-5deg);
  z-index: 3;
}
.s7-imgs.relaxed .item:nth-child(4) {
  --item-tf: translate(102%, 24%) rotate(4deg);
  z-index: 4;
}
.s7-imgs.relaxed .item:nth-child(5) {
  --item-tf: translate(136%, -60%) rotate(-3deg);
  z-index: 5;
}

/* Sits under the text on the left — the same pill button used
   elsewhere on the site, faded in once the pile has relaxed. */
.s7-cta {
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.4s ease,
    transform 0.2s var(--ease),
    background 0.2s ease,
    box-shadow 0.2s ease;
}
#slide-s7[data-step="1"] .s7-cta {
  opacity: 1;
  pointer-events: auto;
}

/* ----------------------------------------------------------------
   Mobile
   ----------------------------------------------------------------
   There isn't room for the copy AND the pile side by side, and the
   relaxed pile was landing on top of both, so on a narrow screen the
   text is dropped entirely: just the button, sitting between the
   header and the photos, with the pile below it.
   ---------------------------------------------------------------- */
@media (max-width: 760px) {
  .s7-stage {
    flex-direction: column;
    align-items: stretch;
  }
  .s7-text {
    flex: none;
    width: 100%;
    padding: calc(var(--header-h) + 2.5vh) 6vw 0;
    align-items: center;
    position: relative;
    z-index: 3; /* above the photos, which fill the whole section */
  }
  .s7-text p {
    display: none;
  }

  .s7-imgs {
    position: absolute;
    inset: 0;
    flex: none;
    /* Narrow enough that a card plus the last card's offset still
       lands inside the viewport — the offsets below are tightened to
       match, so the whole spread fits without being clipped. */
    --card-w: min(54vw, 260px);
  }
  /* The pile sits below centre, clear of the button above it. */
  .s7-imgs .item,
  .s7-imgs.relaxed .item:nth-child(1) {
    top: 62%;
    left: 4%;
  }
  .s7-imgs.relaxed .item:nth-child(2) {
    --item-tf: translate(16%, 20%) rotate(3deg);
  }
  .s7-imgs.relaxed .item:nth-child(3) {
    --item-tf: translate(32%, -66%) rotate(-5deg);
  }
  .s7-imgs.relaxed .item:nth-child(4) {
    --item-tf: translate(48%, 24%) rotate(4deg);
  }
  .s7-imgs.relaxed .item:nth-child(5) {
    --item-tf: translate(64%, -60%) rotate(-3deg);
  }

  /* Step 0: the opening photo fills everything below the header. */
  .s7-imgs .item:nth-child(1) {
    top: var(--header-h);
    bottom: 0;
    height: auto;
  }
  .s7-imgs .item:nth-child(1) img {
    height: 100%;
  }
  /* ...and lets go of that bottom edge once it joins the pile. */
  .s7-imgs.relaxed .item:nth-child(1) {
    bottom: auto;
    height: auto;
  }
}
