/*
  "Our work" section. Editorial, not a grid.

  Image and caption alternate side to side on desktop and stack on mobile. The
  alternation is entirely in :nth-child here, so every moment emits identical
  markup and no page has to know its position.
*/
.work {
  /* Top padding trimmed from clamp(56px, 8vw, 104px): the intro was sitting in
     a large empty band before the images began. */
  padding: clamp(44px, 5.5vw, 76px) 0 clamp(56px, 8vw, 104px);
  /* A warm tint behind the header that has faded to the section's own white by
     the time the images start — continuity without a card, border or shadow. */
  background:
    linear-gradient(180deg, #fff7f4 0%, rgba(255, 247, 244, 0) 360px),
    var(--surface, #fff);
  /* The site bar is sticky and about 72px tall, so an anchor jump would
     otherwise land with the title tucked underneath it. */
  scroll-margin-top: 88px;
}
.work__inner {
  width: min(var(--content-max-width, 1380px), calc(100% - 40px));
  margin: 0 auto;
}

/* ---------- Header ---------- */
/* position/z-index are reset explicitly: the intro is a div now, but any future
   markup change back to <header> must not re-inherit the global sticky rule. */
/*
  The gallery's header, not a block of its own.

  It was 62ch (~535px), which on a wide screen left it stranded in the middle of
  a 1380px column and forced the title into three narrow lines. At 1020px it
  reads as a header band: near-full width up to about 1024px, and still clearly
  centred above the images beyond that. Text stays left-aligned — the ragged
  right is the editorial setting.
*/
/*
  The one wrapper that owns the intro's width, alignment and spacing. Its four
  children — eyebrow, headline, description, label — set no width or margin of
  their own beyond a reading measure, so they all begin at this container's left
  edge.

  NOT centred. `margin-inline: auto` was the alignment bug: it inset a 1120px
  block inside a 1380px column, putting the whole intro 130px to the right of
  the gallery's left edge. Everything inside lined up with everything else and
  with nothing below it. Left-aligned, the intro and the images share one edge.
*/
.work__head {
  position: static;
  z-index: auto;
  max-width: 1120px;
  margin: 0 0 clamp(28px, 3vw, 40px);
}
.work__eyebrow {
  margin: 0;
  color: var(--primary, #b5475a);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.work__title {
  /* Row 1. Bounded by the intro block rather than by its own narrower measure:
     "A documented distribution in Dehradun" needs 1032px at 54px, so anything
     tighter forced a second line. It now holds one line from 768px up and wraps
     only when the viewport itself is too narrow to carry it. */
  max-width: 1120px;
  margin: 12px 0 0;
  color: var(--text, #202936);
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(29px, 3.9vw, 54px);
  font-weight: 700;
  letter-spacing: -.042em;
  line-height: 1.08;
  text-wrap: balance;
}
.work__subhead {
  /* Row 3. Measured at 762px on one line, so 820px holds it to a single line on
     desktop and it wraps normally once the viewport is narrower. The old 62ch
     (~535px) was what broke it onto two. No nowrap: that would overflow. */
  max-width: 820px;
  margin: 12px 0 0;
  color: var(--text-secondary, #667085);
  font-size: 16.5px;
  line-height: 1.6;
}

/* Clarifies context without competing with the title: lighter wash, lighter
   weight, smaller. It still has to be noticed — these are Dehradun photographs
   on a page whose main appeal is Assam — but it is not a second headline. */
.work__separation {
  display: inline-block;
  max-width: 100%;
  margin: 10px 0 0;
  padding: 4px 11px;
  border-radius: 999px;
  color: #8d5560;
  background: rgba(181, 71, 90, .07);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.5;
}

/* ---------- Editorial gallery ----------
   One dominant frame with two supporting frames stacked beside it. Every box
   has a fixed aspect-ratio, so the grid holds its shape while images crossfade
   and while they load — no layout shift at any point.
*/
.work-gallery { margin-top: clamp(24px, 3vw, 36px); }
.work-gallery__grid {
  display: grid;
  gap: clamp(8px, 1vw, 14px);
  grid-template-columns: 1fr;
}

.work-slot { position: relative; margin: 0; min-width: 0; }
.work-slot__stage {
  position: relative;
  overflow: hidden;
  border-radius: clamp(12px, 1.4vw, 18px);
  background: var(--primary-soft, #fbecef);
  box-shadow: 0 12px 32px rgba(120, 50, 64, .10);
}
.work-slot--main .work-slot__stage { aspect-ratio: 3 / 2; }
.work-slot--support .work-slot__stage { aspect-ratio: 4 / 3; }

/* Both layers fill the box; only the shown one is opaque. */
.work-slot__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 1000ms cubic-bezier(.4, 0, .2, 1), transform 1200ms cubic-bezier(.4, 0, .2, 1);
}
.work-slot__image.is-shown { opacity: 1; transform: scale(1); }

/* Beneath the photograph, in normal flow. Nothing overlays the image. */
.work-slot__caption {
  margin: 12px 2px 0;
  color: var(--text, #202936);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.5;
  text-wrap: pretty;
}
/* The dominant frame carries slightly more weight, as the lead line of the set. */
.work-slot--main .work-slot__caption {
  margin-top: 14px;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.work-gallery__caption {
  margin-top: clamp(18px, 2vw, 26px);
  padding-top: clamp(14px, 1.6vw, 18px);
  border-top: 1px solid var(--border, #e9e2de);
}
.work-gallery__kicker {
  margin: 0;
  color: var(--primary, #b5475a);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.work-gallery__meta {
  margin: 6px 0 0;
  color: var(--text-secondary, #667085);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Mobile: one strong frame, two supporting beneath it. */
@media (max-width: 760px) {
  .work-gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-slot--main { grid-column: 1 / -1; }
  .work-slot--main .work-slot__stage { aspect-ratio: 4 / 3; }
}

/* Desktop: dominant frame left, two stacked right. */
@media (min-width: 761px) {
  .work-gallery__grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  /* The main frame spans both rows. It is a column so the photograph takes the
     remaining height after its caption, rather than the caption pushing the
     figure past the grid row. */
  .work-slot--main {
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
  }
  .work-slot--main .work-slot__stage {
    flex: 1 1 auto;
    min-height: 0;
    aspect-ratio: auto;
  }
  .work-slot--support .work-slot__stage { aspect-ratio: 4 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  .work-slot__image {
    transform: none;
    transition: opacity 200ms linear;
  }
  .work-slot__image.is-shown { transform: none; }
}

/* ---------- Moments (legacy alternating layout, kept for other pages) ---------- */
.work__moments {
  display: grid;
  gap: clamp(40px, 5vw, 68px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.work-moment__figure { display: grid; gap: 20px; margin: 0; }

.work-moment__frame { display: block; }
/* Phone-camera portraits run 3:4. Left unconstrained they are around 870px tall
   each, which is most of a screen per photograph and pushes the donation form
   out of reach. Capped and cropped from the centre instead. */
.work-moment__image {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(56vh, 480px);
  border-radius: var(--card-radius, 18px);
  object-fit: cover;
  object-position: center;
  background: var(--primary-soft, #fbecef);
}

.work-moment__caption { margin: 0; }
.work-moment__fact {
  max-width: 34ch;
  margin: 0;
  color: var(--text, #202936);
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(20px, 2.2vw, 27px);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.25;
}
.work-moment__meta {
  margin: 10px 0 0;
  color: var(--primary, #b5475a);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.work-moment__detail {
  max-width: 44ch;
  margin: 12px 0 0;
  color: var(--text-secondary, #667085);
  font-size: 15px;
  line-height: 1.7;
}

/* Side by side, alternating, once there is room for two real columns. */
@media (min-width: 860px) {
  .work-moment__figure {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
    align-items: center;
    gap: clamp(32px, 4vw, 64px);
  }
  .work-moment:nth-child(even) .work-moment__frame { order: 2; }
  .work-moment:nth-child(even) .work-moment__caption { order: 1; }
  /* Pull the caption in from the outer edge so the eye returns to the centre. */
  .work-moment:nth-child(odd) .work-moment__caption { padding-right: clamp(0px, 3vw, 40px); }
  .work-moment:nth-child(even) .work-moment__caption { padding-left: clamp(0px, 3vw, 40px); }
}

/* ---------- Gallery: everything beyond the featured five ---------- */
.work__gallery {
  display: grid;
  gap: clamp(14px, 1.8vw, 22px);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin: clamp(40px, 5vw, 68px) 0 0;
  padding: 0;
  list-style: none;
}
.work-gallery__figure { margin: 0; }
.work-gallery__figure .work-moment__image {
  max-height: none;
  aspect-ratio: 4 / 5;
  border-radius: 14px;
}
.work-gallery__caption {
  margin: 10px 0 0;
  color: var(--text-secondary, #667085);
  font-size: 13px;
  line-height: 1.55;
}

/* ---------- The ask ---------- */
.work__ask {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px clamp(24px, 4vw, 56px);
  margin-top: clamp(48px, 6vw, 80px);
  padding: clamp(26px, 3.5vw, 40px);
  border: 1px solid var(--border, #e9e2de);
  border-radius: var(--card-radius, 18px);
  background: var(--background, #fff9f6);
}
.work__ask-line {
  flex: 1 1 30ch;
  max-width: 52ch;
  margin: 0;
  color: var(--text, #202936);
  font-size: clamp(16px, 1.7vw, 19px);
  font-weight: 600;
  line-height: 1.55;
}
.work__cta { flex: 0 0 auto; min-height: 52px; padding-inline: 28px; }
