/* ===== (02) Selected case study — Figma 3280:21203 ===== */

.cases { padding: 70px 0; overflow: hidden; }
.h-section--tight { line-height: 0.98; letter-spacing: -0.034em; }
.cases__lead { max-width: 795px; line-height: 1.5; }
.cases .pager { margin-top: 48px; }
.cases__all { margin-top: 24px; }
.cases .cases__viewport { scroll-snap-type: none; cursor: none; }
.cases .case-slide__img { pointer-events: none; }

/* Shared horizontal track: starts at the container edge and bleeds to the viewport's right. */
.cases__viewport {
  --edge: max(var(--gutter), (100vw - var(--max)) / 2);
  margin-top: 72px;
  padding-left: var(--edge);
  overflow-x: auto;
  overflow-y: hidden; /* never scroll vertically: unrevealed cards sit 48px low and made the row bob on wheel */
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--edge);
  scrollbar-width: none;
  outline: none;
}
.cases__viewport::-webkit-scrollbar { display: none; }
.cases__track { display: flex; gap: 20px; width: max-content; padding-right: var(--edge); }

.case-slide {
  position: relative;
  flex: none;
  width: min(1294px, 67.4vw);
  aspect-ratio: 1294 / 700;
  border-radius: var(--radius-lg);
  overflow: hidden;
  scroll-snap-align: start;
  transform: translateZ(0);
}
.case-slide__img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1s var(--ease-out);
  user-select: none;
}
.case-slide:hover .case-slide__img { transform: scale(1.025); }

/* --- Matteo before/after slide ---
   Panel geometry from Figma (card 1294×700): after-panel at 107,104 size 1080×620;
   divider 4×650; knob 76×76. --x is the divider position in % of card width. */
.case-compare { --x: 44.6%; position: absolute; inset: 0; touch-action: pan-y; }
.case-compare__base { width: 100%; height: 100%; object-fit: cover; user-select: none; pointer-events: none; }
.case-compare__after {
  position: absolute;
  left: 8.269%; top: 14.857%;
  width: 83.462%; height: 88.571%;
  border-radius: 1.855% / 3.226%;
  overflow: hidden;
  clip-path: inset(0 0 0 calc((var(--x) - 8.269%) * 1.19815));
}
.case-compare__after img { width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; }
.case-compare__divider {
  position: absolute;
  left: var(--x); top: 14.857%;
  width: 0.309%; height: 92.857%;
  margin-left: -0.155%;
  border-radius: 2px;
  background: #00201b;
  z-index: 3;
  cursor: ew-resize;
}
/* wider invisible grab area around the thin divider */
.case-compare__divider::after { content: ""; position: absolute; inset: 0 -10px; }
.case-compare__knob {
  z-index: 4;
  position: absolute;
  left: var(--x); top: 50.57%;
  width: 5.873%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  border-radius: 50%;
  border: 3px solid #00201b;
  background: #ffeb44;
  color: #00201b;
  cursor: grab;
  transition: transform 0.25s var(--ease-out);
}
.case-compare__knob svg { width: 45%; height: 45%; }
.case-compare__knob:hover { transform: translate(-50%, -50%) scale(1.08); }
.case-compare.is-dragging .case-compare__knob { cursor: grabbing; transform: translate(-50%, -50%) scale(0.95); }
.case-compare__link { z-index: 2; }
.case-compare__chip {
  position: absolute;
  left: 83.85%; top: 18.29%;
  padding: 8px 16px;
  border-radius: 999px;
  background: #00201b;
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: clamp(9px, 0.677vw, 13px);
  letter-spacing: 0.1em;
  pointer-events: none;
}

/* Cursor that follows the pointer over the slider: a round black glass button.
   Between slides it reads "Drag"; over a case study it grows and names what a click
   opens ("View Personal / Brand Case Study"), the text rolling over as slides change. */
.drag-cursor {
  position: fixed; left: 0; top: 0; z-index: 50;
  width: 88px; height: 88px;
  border-radius: 50%;
  overflow: hidden;
  color: #fff;
  background: rgba(10, 10, 12, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -10px 24px rgba(255, 255, 255, 0.05),
    0 12px 32px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4);
  transition:
    opacity 0.25s,
    transform 0.45s var(--ease-expo, cubic-bezier(0.16, 1, 0.3, 1)),
    width 0.5s var(--ease-expo, cubic-bezier(0.16, 1, 0.3, 1)),
    height 0.5s var(--ease-expo, cubic-bezier(0.16, 1, 0.3, 1));
}
.drag-cursor.is-visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.drag-cursor.is-down { transform: translate(-50%, -50%) scale(0.9); }
.drag-cursor.is-label { width: 136px; height: 136px; }

.drag-cursor__stage { position: absolute; inset: 0; }
.drag-cursor__text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; white-space: nowrap; line-height: 1.15;
  will-change: transform, opacity;
}
.drag-cursor__text b { font-weight: 500; font-size: 17px; letter-spacing: -0.01em; white-space: normal; max-width: 112px; line-height: 1.1; }
.drag-cursor__text small { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.drag-cursor__text small:first-child { margin-bottom: 4px; }
.drag-cursor__text b + small { margin-top: 4px; }
.drag-cursor__text svg { width: 14px; height: 14px; margin-top: 8px; color: var(--accent); }

.case-slide__link { position: absolute; inset: 0; display: block; -webkit-user-drag: none; }
.case-slide__link:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: inherit; }


@media (max-width: 1024px) {
  .cases__viewport { margin-top: 40px; }
  .case-slide { width: 88vw; border-radius: 20px; }
}

