/* ==========================================================================
   Case studies. Same tokens and type as the homepage; each project brings
   one accent (--case) used only as a mark, never for text.
   ========================================================================== */

.case__wrap { padding: calc(var(--nav-h) + 56px) var(--gutter) 120px; }

/* ---------- Head ---------- */
.case__head { display: grid; gap: 28px; margin-bottom: clamp(56px, 8vw, 104px); }
.case__back {
  justify-self: start; display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  color: var(--mute); text-decoration: none; transition: color 0.3s;
}
.case__back span { transition: transform 0.4s var(--ease); }
.case__back:hover { color: var(--bone); }
.case__back:hover span { transform: translateX(-4px); }
.case__kicker { margin: 0; display: flex; align-items: center; gap: 10px; color: var(--mute); }
.case__kicker i { width: 10px; height: 10px; border-radius: 50%; background: var(--case); box-shadow: 0 0 0 4px color-mix(in srgb, var(--case) 25%, transparent); }
.case__title {
  margin: 0; font-weight: 900; text-transform: uppercase; letter-spacing: -0.045em; line-height: 0.86;
  font-size: clamp(44px, 9vw, 150px); font-variation-settings: "wdth" 80;
  overflow-wrap: normal; word-break: normal; hyphens: none;
}
.case__intro { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 32px 64px; align-items: start; margin-top: 12px; }
.case__summary { margin: 0; max-width: 34ch; font-size: clamp(20px, 2vw, 30px); line-height: 1.3; letter-spacing: -0.015em; color: var(--bone); }
.case__facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 32px; }
.case__facts div { border-top: 1px solid var(--line); padding-top: 12px; }
.case__facts dt { color: var(--mute); margin-bottom: 6px; }
.case__facts dd { margin: 0; color: var(--bone); text-transform: none; letter-spacing: 0.02em; line-height: 1.5; }

/* ---------- Gallery ---------- */
.case__gallery { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); }
.case__gallery--deck { gap: clamp(28px, 4vw, 56px); }
.f { margin: 0; min-width: 0; }
.f--full { grid-column: span 6; }
.f--half { grid-column: span 3; }
.f--third { grid-column: span 2; }
.f__open { display: block; border-radius: 6px; overflow: hidden; background: var(--ink-2); outline-offset: 4px; }
.f__open img, .f__open video { display: block; width: 100%; height: auto; transition: transform 0.8s var(--ease); }
@media (hover: hover) { .f__open:hover img, .f__open:hover video { transform: scale(1.02); } }
.f figcaption { margin-top: 12px; color: var(--mute); }
.case__gallery--photo { display: block; columns: 3 300px; column-gap: clamp(12px, 1.6vw, 20px); }
.f--photo { break-inside: avoid; margin-bottom: clamp(12px, 1.6vw, 20px); }

/* ---------- Next project ---------- */
.case__next { padding: 0 var(--gutter) clamp(80px, 10vw, 140px); }
.next {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px 32px;
  padding-top: 28px; border-top: 1px solid var(--line); color: var(--bone); text-decoration: none;
}
.next__label { grid-column: 1 / -1; color: var(--mute); }
.next__title {
  font-weight: 900; text-transform: uppercase; letter-spacing: -0.045em; line-height: 0.86;
  font-size: clamp(40px, 7vw, 112px); font-variation-settings: "wdth" 70; transition: font-variation-settings 0.8s var(--ease), color 0.4s;
}
.next__tag { color: var(--mute); align-self: end; padding-bottom: 6px; }
.next__img {
  position: absolute; right: 0; bottom: calc(100% + 16px); width: clamp(200px, 24vw, 340px); aspect-ratio: 16 / 10;
  border-radius: 6px; overflow: hidden; background: var(--ink-2); pointer-events: none;
  opacity: 0; transform: translateY(16px) rotate(2deg); transition: opacity 0.5s var(--ease), transform 0.7s var(--ease);
}
.next__img img { width: 100%; height: 100%; object-fit: cover; }
@media (hover: hover) {
  .next:hover .next__title { font-variation-settings: "wdth" 110; color: var(--accent); }
  .next:hover .next__img { opacity: 1; transform: none; }
}
.next:focus-visible .next__title { color: var(--accent); }

/* ---------- Closing ask: the homepage's contact block, compact ---------- */
.case__cta { background: var(--bone); color: var(--ink); padding: clamp(72px, 9vw, 120px) var(--gutter) 32px; padding-bottom: max(32px, env(safe-area-inset-bottom)); }
.case__cta-t {
  margin: 0 0 32px; max-width: 14ch; font-weight: 900; text-transform: uppercase; letter-spacing: -0.04em; line-height: 0.9;
  font-size: clamp(36px, 5vw, 76px); font-variation-settings: "wdth" 80;
}
.case__cta-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.case__cta .copy { display: inline-flex; align-items: center; color: inherit; text-decoration: none; }

/* ---------- Lightbox: a dark viewing room in both themes ---------- */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(5, 5, 7, 0.95); color: #e8eaf0;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: transparent; }
.lightbox img { max-width: min(92vw, 1800px); max-height: 82dvh; width: auto; height: auto; object-fit: contain; border-radius: 4px; }
.lightbox__cap { position: absolute; left: 0; right: 0; bottom: max(24px, env(safe-area-inset-bottom)); margin: 0; text-align: center; color: #a2a8b8; padding: 0 80px; }
.lightbox__btn {
  position: absolute; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid rgba(232, 234, 240, 0.3); color: #e8eaf0; font-size: 18px; background: rgba(11, 12, 16, 0.6); transition: background 0.3s, border-color 0.3s;
}
.lightbox__btn:hover { background: var(--brand); border-color: var(--brand); }
.lightbox__btn:focus-visible { outline: 2px solid #8fb4ff; outline-offset: 3px; }
.lightbox__close { top: max(20px, env(safe-area-inset-top)); right: 20px; }
.lightbox__prev { left: 20px; top: 50%; margin-top: -24px; }
.lightbox__next { right: 20px; top: 50%; margin-top: -24px; }
body.lightbox-open { overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .f--third { grid-column: span 3; }
}
@media (max-width: 820px) {
  .case__intro { grid-template-columns: minmax(0, 1fr); }
  .f--half { grid-column: span 6; }
  .next { grid-template-columns: minmax(0, 1fr); }
  .next__img { position: static; width: 100%; opacity: 1; transform: none; grid-row: 2; margin-bottom: 8px; }
  .next__tag { padding-bottom: 0; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: max(64px, env(safe-area-inset-bottom)); margin: 0; }
}
@media (max-width: 520px) {
  .case__facts { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .case__gallery--photo { columns: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .f__open img, .f__open video, .next__img, .next__title { transition: none; }
}

/* ===== Decks, balanced: a contained column, the opening frame leads, the rest pair up ===== */
.case__gallery--deck { max-width: 1180px; margin-inline: auto; gap: clamp(28px, 3vw, 44px) clamp(16px, 2vw, 28px); }
.case__gallery--deck .f--full { grid-column: span 3; }
.case__gallery--deck .f--full:first-child { grid-column: 2 / span 4; }
.case__gallery--grid, .case__gallery--photo { max-width: 1180px; margin-inline: auto; }
@media (max-width: 900px) {
  .case__gallery--deck .f--full, .case__gallery--deck .f--full:first-child { grid-column: span 6; }
}

/* ===== Decks as one continuous presentation: a single column, each slide sized to fit
   the screen, stacked edge to edge; the label sits on the slide instead of between them ===== */
.case__gallery--deck {
  display: flex; flex-direction: column; gap: 6px;
  max-width: min(1120px, calc((100svh - 140px) * 1.78)); margin-inline: auto;
}
.case__gallery--deck .f, .case__gallery--deck .f--full:first-child { position: relative; }
.case__gallery--deck .f__open { border-radius: 0; }
.case__gallery--deck .f:first-child .f__open { border-radius: 8px 8px 0 0; }
.case__gallery--deck .f:last-child .f__open { border-radius: 0 0 8px 8px; }
.case__gallery--deck .f__open img { transform: none !important; }
.case__gallery--deck figcaption {
  position: absolute; left: 12px; bottom: 12px; margin: 0; padding: 6px 10px; border-radius: 999px;
  background: rgba(11, 12, 16, 0.72); color: #e8eaf0; pointer-events: none;
  opacity: 0; transform: translateY(4px); transition: opacity 0.3s, transform 0.4s var(--ease);
}
.case__gallery--deck .f:hover figcaption, .case__gallery--deck .f:focus-within figcaption { opacity: 1; transform: none; }
@media (hover: none) { .case__gallery--deck figcaption { opacity: 1; transform: none; } }

/* ===== Next project: the image is always there; hover widens the title and lifts the image ===== */
.next { grid-template-columns: minmax(0, 1fr) clamp(220px, 30vw, 440px); align-items: end; }
.next__label { grid-column: 1 / -1; }
.next__title { grid-column: 1; grid-row: 2; }
.next__tag { grid-column: 1; grid-row: 3; align-self: start; }
.next__img {
  position: relative; right: auto; bottom: auto; grid-column: 2; grid-row: 2 / span 2; width: 100%;
  opacity: 1; transform: none; transition: transform 0.7s var(--ease), box-shadow 0.7s var(--ease);
}
.next__img img { transition: transform 0.9s var(--ease); }
@media (hover: hover) {
  .next:hover .next__img { opacity: 1; transform: translateY(-6px) rotate(-1.5deg); box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35); }
  .next:hover .next__img img { transform: scale(1.05); }
}
@media (max-width: 820px) {
  .next { grid-template-columns: minmax(0, 1fr); }
  .next__img { grid-column: 1; grid-row: 2; margin-bottom: 8px; }
  .next__title { grid-row: 3; }
  .next__tag { grid-row: 4; }
}

/* ===== Facts: context and year side by side, the brief across the full width ===== */
.case__facts .case__brief { grid-column: 1 / -1; }
.case__brief dd { font-family: var(--f-display); font-size: 17px; line-height: 1.5; letter-spacing: 0; text-transform: none; max-width: 46ch; }
.case__cta-t { max-width: 18ch; }
.case__summary p { margin: 0; }
.case__summary .case__summary-k { color: var(--mute); font-size: 12px; margin-bottom: 14px; }
.case__intro { align-items: end; }
@media (max-width: 520px) { .case__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ===== All work: a bar of every project at the foot of each case, the current one marked ===== */
.case__all { padding: 0 var(--gutter) max(56px, env(safe-area-inset-bottom)); }
.case__all-label { margin: 0 0 16px; color: var(--mute); }
.case__all ul { list-style: none; margin: 0; padding: 20px 0 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; }
.case__all a {
  display: inline-flex; align-items: baseline; gap: 10px; min-height: 44px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--bone); text-decoration: none; transition: border-color 0.3s, background 0.3s, color 0.3s;
}
.case__all-t { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.case__all-tag { color: var(--mute); font-size: 11px; transition: color 0.3s; }
.case__all a:hover { border-color: var(--bone); }
.case__all a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.case__all a[aria-current="page"] .case__all-tag { color: var(--on-brand); opacity: 0.8; }
.case__next { padding-bottom: clamp(56px, 7vw, 96px); }
@media (max-width: 767px) {
  .case__all ul { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; margin: 0 calc(var(--gutter) * -1); padding: 20px var(--gutter) 4px; scrollbar-width: none; }
  .case__all ul::-webkit-scrollbar { display: none; }
  .case__all li { flex: none; scroll-snap-align: start; }
}
@media (max-width: 767px) { .case__all ul { scroll-padding-inline: var(--gutter); } }
