/* design/home-preview/css/project.css
   Purpose: before/after section on the homepage (.change) and the project case-study pages (.case).
   NOT for: tokens, nav, buttons (base.css) or other homepage sections (sections.css, hero-work.css).
   WHY a scroll wipe and not a drag slider: the real before/after photos were taken from different angles,
   so an overlay slider would misalign; the wipe reads as a transition. Without JS or with reduced motion
   the two photos simply sit side by side (stacked on phones). */
.change { padding: var(--section) var(--gutter); background: var(--ink-2); }
.change__head .lead { margin-top: 1.2rem; }
.change__link { display: inline-flex; gap: .7rem; margin-top: 1.6rem; color: var(--gold-hi); font-size: .78rem;
  letter-spacing: .2em; text-transform: uppercase; border-bottom: 1px solid currentColor; padding-bottom: .3rem; }
.change__link b { font-weight: 400; transition: transform .45s var(--ease); }
.change__link:hover b { transform: translateX(6px); }
.change__pair { display: grid; gap: 1rem; margin-top: 2.8rem; }
.change__img { position: relative; margin: 0; overflow: hidden; background: var(--stone); aspect-ratio: 5 / 4; }
.change__img img { width: 100%; height: 100%; object-fit: cover; }
.change__img::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(201,183,159,.18); pointer-events: none; }
.change__img figcaption { position: absolute; top: 1rem; left: 1rem; padding: .45rem .8rem; background: rgba(27,26,25,.78);
  font-size: .66rem; letter-spacing: .28em; text-transform: uppercase; color: var(--gold-hi); }

@media (min-width: 900px) {
  .change__pin { display: grid; grid-template-columns: minmax(16rem, 1fr) 2fr; gap: 4rem; align-items: center; }
  .change__pair { margin-top: 0; grid-template-columns: 1fr 1fr; }
  /* Pinned wipe: the section is tall, the pair sticks, --w (0→1, motion.js) uncovers "after" from the right. */
  .motion .change { height: 210vh; padding-top: 0; padding-bottom: 0; }
  .motion .change__pin { position: sticky; top: 0; height: 100vh; }
  .motion .change__pair { position: relative; grid-template-columns: 1fr; }
  .motion .change__img--after { position: absolute; inset: 0; clip-path: inset(0 0 0 calc((1 - var(--w, 0)) * 100%)); }
  .motion .change__img--after::before { content: ""; position: absolute; z-index: 1; top: 0; bottom: 0; width: 1px;
    left: 0; background: var(--gold-hi); box-shadow: 0 0 24px rgba(201,183,159,.6); }
  .motion .change__img--after figcaption { left: auto; right: 1rem; }
  .motion .change__img--before img { transform: scale(calc(1.06 - var(--w, 0) * .06)); }
}
/* Reduced motion: motion.js still sets .motion (nav, reveals), so undo the pin and show both photos side by side. */
@media (min-width: 900px) and (prefers-reduced-motion: reduce) {
  .motion .change { height: auto; padding: var(--section) var(--gutter); }
  .motion .change__pin { position: static; height: auto; }
  .motion .change__pair { grid-template-columns: 1fr 1fr; }
  .motion .change__img--after { position: relative; clip-path: none; }
  .motion .change__img--after::before { content: none; }
  .motion .change__img--after figcaption { left: 1rem; right: auto; }
  .motion .change__img--before img { transform: none; }
}

/* Case-study page */
.case__hero { position: relative; isolation: isolate; min-height: 88vh; display: grid; align-items: end; padding: 8rem var(--gutter) 4rem; overflow: hidden; }
.case__hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; }
.case__hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, var(--ink) 4%, rgba(27,26,25,.2) 60%); }
.case__back { display: inline-block; margin-bottom: 2rem; color: var(--mute); font-size: .76rem; letter-spacing: .2em; text-transform: uppercase; }
.case__back:hover { color: var(--cream); }
.case__facts { display: grid; gap: 1.4rem; padding: 3rem var(--gutter); border-bottom: 1px solid var(--line); }
.case__facts dt { font-size: .66rem; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); }
.case__facts dd { margin-top: .4rem; font-family: var(--serif); font-size: 1.25rem; font-weight: 300; }
.case__story { display: grid; gap: 1.2rem; padding: var(--section) var(--gutter) 3rem; }
.case__story .lead { margin-top: 0; }
.case__gallery { display: grid; gap: 1rem; padding: 0 var(--gutter) var(--section); }
.case__gallery figure { margin: 0; position: relative; overflow: hidden; background: var(--stone); }
.case__gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.case__gallery figure:hover img { transform: scale(1.03); }
/* Caption overlays the photo: the figure clips the hover zoom, so a caption below the image would be cut off. */
.case__gallery figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 3rem 1.2rem 1rem; color: var(--cream);
  font-size: .88rem; background: linear-gradient(to top, rgba(27,26,25,.88), rgba(27,26,25,0)); }
.case__cta { padding: var(--section) var(--gutter); text-align: center; background: var(--ink-2); }
.case__cta .btn { margin-top: 2rem; }
@media (min-width: 900px) {
  .case__facts { grid-template-columns: repeat(3, 1fr); }
  .case__story { grid-template-columns: 1fr 1fr; gap: 4rem; }
  .case__gallery { grid-template-columns: 3fr 2fr; }
  .case__gallery .wide { grid-column: 1 / -1; }
}
