/* ==========================================================================
   Work hub — index of all case studies, on top of core.css.
   Reuses the case-card component (.case-card/.case-print/.case-tag, core.css)
   in a static grid — no carousel JS. Cards are whole-card links, pins sit
   straight (the JS tilt scatter is homepage-only).
   ========================================================================== */

/* --- 1. Hero --- */
.work-hero { max-width: 46rem; margin-bottom: 3.5rem; }
.work-hero .badge { margin-bottom: 1.5rem; }
.work-title {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  letter-spacing: -0.03em;
  margin-top: 1rem;
}
.work-lede {
  font-size: 1.125rem;
  line-height: 1.6;
  margin-top: 1.25rem;
}

/* --- 2. Card grid --- */
/* Uniform heights via a shared aspect ratio: compact cards and solo prints
   are both 1:1, so mixed rows stay level at any width. Inside the compact
   cards the print area flexes to fill the space left by the text, and the
   photo crops to fill (object-fit cover) rather than distorting. Titles wrap
   naturally — a one-line title just yields a slightly taller photo. */
.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  /* Start alignment: grid stretch would override the cards' aspect-ratio
     (and let a tall photo's natural height set the row size). With start,
     every item keeps its 1:1 height and the rows stay level. */
  align-items: start;
}
.work-grid .case-card {
  aspect-ratio: 1 / 1;
  /* Zero the content-based minimum: otherwise the fixed-height print and
     text set the card's height and the ratio never applies. */
  min-height: 0;
}
.work-grid .case-card > div:not(.case-footer) {
  /* The footer is a plain <div> too — a bare `> div` would hand it the same
     flex-grow, letting it split the card's free space with the body and
     squeezing the photo down to a sliver. */
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.work-grid .case-card .case-vis {
  flex: 1;
  min-height: 0;
  /* Tighter than the homepage's 2rem: on the hub the link sits right under
     the print. With the footer's 0.25rem padding-top the gap is 0.75rem. */
  margin-bottom: 0.5rem;
}
.work-grid .case-card .case-footer { padding-top: 0.25rem; }
.work-grid .case-print--solo {
  aspect-ratio: 1 / 1;
  /* Zero the image's intrinsic minimums: without this, the photo's natural
     width inflates its grid track and its natural height overrides the
     aspect ratio. */
  min-width: 0;
  min-height: 0;
}
/* Solo prints opt out of the shared paper-bend hover: at full grid-cell
   size the rotateX swing reads as a wobble rather than a paper lift.
   Same opt-out as the homepage hero print — keep the resting shadow so
   nothing moves on hover. */
.case-print.case-print--solo:hover {
  transform: none;
  box-shadow:
    0 1px 2px rgba(12, 13, 14, 0.2),
    0 6px 14px rgba(12, 13, 14, 0.16);
}

/* --- 3. Responsive --- */
@media (min-width: 640px) {
  .work-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .work-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* --- 4. Photo lightbox --- */
/* Solo prints are real anchors to the raw .jpg (no-JS fallback); work.js
   swaps their default for this in-page viewer. The frame reuses the shared
   postcard classes (.case-print) at viewer size, so the overrides below
   undo the card-specific sizing/cropping from core.css. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.lightbox[hidden] { display: none; }
.lightbox:not([hidden]) { animation: lightbox-in 0.15s ease; }
@keyframes lightbox-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .lightbox:not([hidden]) { animation: none; }
}
.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(12, 13, 14, 0.82);
}
.lightbox__frame {
  position: relative;
  z-index: 1;
  width: auto;
  height: auto;
  max-width: min(72rem, 92vw);
}
.lightbox__frame .case-print__window {
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Show the whole photo (contain, no card crop): the 1.43 zoom and cover
   fit exist for the small grid frame, not the viewer. */
.lightbox__frame .case-print__window img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(88vh - 4rem);
  object-fit: contain;
  transform: none;
}
/* The viewer must not inherit the postcard's paper-bend hover. */
.lightbox__frame.case-print:hover {
  transform: none;
  box-shadow:
    0 1px 2px rgba(12, 13, 14, 0.2),
    0 6px 14px rgba(12, 13, 14, 0.16);
}
/* Close button overhangs the frame's top-right corner, like a badge —
   the overlay's 2rem padding keeps the overhang on-screen. */
.lightbox__close {
  position: absolute;
  top: -1rem;
  right: -1rem;
  z-index: 2;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}