/* Case study pages — loaded after styles.css, reuses its tokens.
   The page reads like a design file: an inspector, a layers panel and
   frames laid out on dotted canvases. */

/* ---------- compact nav ---------- */
.case-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding-block: 28px;
}
.case-back {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 12px; color: var(--text-2); text-decoration: none; background: var(--white);
}
.case-back:hover { color: var(--ink); border-color: var(--line-2); }

/* ---------- shared: dotted canvas + frames ---------- */
.canvas {
  background-color: var(--mist);
  background-image: radial-gradient(#D3DBE4 1px, transparent 1.2px);
  background-size: 24px 24px;
  border-radius: 20px;
}
.frame-label {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  margin: 0 0 8px; font-size: 11px; line-height: 1.45; color: var(--faint);
}
.concept-tag {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 6px;
  background: var(--highlight); color: #2F4A66;
  font-family: var(--mono-f); font-size: 10px; font-weight: 400; letter-spacing: 0; line-height: 1.4; white-space: nowrap;
}

/* ---------- hero ---------- */
.case-hero {
  padding-top: 48px;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 4vw, 64px); align-items: start;
}
.case-kicker { margin: 0 0 20px; font-size: 12px; color: var(--blue); }
.case-title {
  margin: 0; font-size: clamp(56px, 7vw, 112px); font-weight: 500;
  line-height: 0.95; letter-spacing: -0.05em;
}
.case-tagline { margin: 24px 0 0; font-size: 20px; line-height: 1.5; color: var(--text-2); letter-spacing: -0.01em; }
.inspector {
  margin: 36px 0 0; padding: 6px 20px; background: var(--white);
  border: 1px solid var(--line); border-radius: 16px;
}
.inspector > div {
  display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: baseline;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.inspector > div:first-child { border-top: 0; }
.inspector dt { font-size: 11px; color: var(--faint); }
.inspector dd { margin: 0; font-size: 15px; line-height: 1.5; }
.case-hero-canvas { margin: 0; padding: 48px; }
.case-hero-canvas img {
  display: block; width: 100%; height: auto; border-radius: 10px;
  box-shadow: 0 12px 30px rgba(20,40,70,.10);
}
.case-hero-canvas .trim-wrap { border-radius: 10px; overflow: hidden; box-shadow: 0 12px 30px rgba(20,40,70,.10); }
.case-hero-canvas .trim-wrap img { box-shadow: none; border-radius: 0; }
/* some source files carry a 1px dark edge: wrappers clip, images overscale slightly */
.trim-wrap { display: block; border-radius: 10px; overflow: hidden; }
.trim-wrap img, .shot-media img { scale: 1.02; }

/* ---------- brief ---------- */
.case-brief { padding-top: 64px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.brief-card { background: var(--mist); border-radius: 16px; padding: clamp(24px, 3vw, 40px); }
.brief-card .mono { margin: 0 0 14px; font-size: 12px; color: var(--blue); }
.brief-card p:last-child { margin: 0; font-size: 20px; line-height: 1.5; letter-spacing: -0.01em; }

/* ---------- body: layers panel + frames ---------- */
.case-body { padding-top: 120px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 64px; align-items: start; }
.layers { position: sticky; top: 96px; }
.layers-title { margin: 0 0 12px; padding: 0 10px; font-size: 11px; color: var(--faint); }
.layers ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.layers a {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 6px;
  font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap;
  transition: background .25s ease, color .25s ease;
}
.layers a:hover { color: var(--ink); background: var(--mist); }
.layers a.is-active { color: var(--ink); background: var(--highlight); }
.layer-ico { flex: none; width: 9px; height: 9px; border: 1.5px solid currentColor; border-radius: 2px; opacity: .8; }
.layers a.is-active .layer-ico { border-color: var(--blue); background: var(--white); opacity: 1; }

.case-frames { min-width: 0; display: grid; gap: 120px; }
.case-sec { scroll-margin-top: 96px; }
.frame-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 12px; color: var(--blue); }
.case-sec h2 { margin: 0; font-size: clamp(28px, 2.6vw, 36px); font-weight: 500; line-height: 1.1; letter-spacing: -0.03em; }
.case-sec-desc { margin: 10px 0 0; font-size: 16px; line-height: 1.55; color: var(--muted); }
.board { margin-top: 28px; padding: clamp(20px, 3vw, 40px); }

/* image grids on a board: --cols sets the columns; fr values equal to each
   image's aspect ratio make a row of different shapes share one height */
.shots {
  display: grid; grid-template-columns: var(--cols, repeat(2, minmax(0, 1fr)));
  gap: clamp(16px, 2vw, 28px); align-items: end;
}
.shots + .shots, .shots + .strip, .strip + .shots { margin-top: clamp(24px, 3vw, 40px); }
.shot { margin: 0; min-width: 0; }
.shot--full { grid-column: 1 / -1; }
.shot-media {
  position: relative; display: block; width: 100%; padding: 0; border: 0;
  border-radius: 10px; background: transparent; cursor: zoom-in;
  box-shadow: 0 12px 30px rgba(20,40,70,.10);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.shot-media img, .shot-media video { display: block; width: 100%; height: auto; border-radius: inherit; }
.shot-media { overflow: hidden; }
.shot-media:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(20,40,70,.16); }
.shot-media:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
/* tall pieces (emails) show their top; the lightbox shows the whole thing */
.shot-media--crop { aspect-ratio: var(--ar, 2 / 3); overflow: hidden; }
.shot-media--crop img { height: 100%; object-fit: cover; object-position: top; }

/* horizontal strip (decks, carousels): scroll-snap, drag, trackpad, arrows */
.strip { position: relative; }
.strip-track {
  display: flex; gap: clamp(16px, 2vw, 24px); overflow-x: auto; scroll-snap-type: x mandatory;
  scroll-behavior: smooth; overscroll-behavior-x: contain;
  padding: 4px 4px 28px; margin: -4px -4px 0;  /* room for frame shadows */
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; cursor: grab;
}
.strip-track.is-dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; user-select: none; }
.strip-track.is-dragging .shot-media { pointer-events: none; }
.strip-item { flex: 0 0 70%; scroll-snap-align: start; }
.strip--narrow .strip-item { flex-basis: 30%; }
.strip-nav { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.strip-btn {
  width: 44px; height: 44px; padding: 0; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--white); color: var(--ink); font-size: 16px; cursor: pointer;
}
.strip-btn:hover { border-color: var(--ink); }
.strip-btn:disabled { opacity: .35; cursor: default; border-color: var(--line-2); }

/* process: sticky notes */
.notes { margin: 28px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.notes li {
  min-height: 132px; padding: 16px; background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 16px;
  font-family: var(--mono-f); font-size: 12px; line-height: 1.5; color: var(--ink);
}
.notes li span:first-child { color: var(--blue); }

/* ---------- next case ---------- */
.case-next { padding-top: 140px; padding-bottom: 140px; }
.case-next a {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 4vw, 64px); align-items: center;
  padding: clamp(24px, 4vw, 56px); border-radius: 20px; background: var(--mist); text-decoration: none; color: var(--ink);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.case-next a:hover { transform: translateY(-4px); box-shadow: 0 24px 50px rgba(20,40,70,.10); color: var(--ink); }
.case-next .mono { display: block; margin-bottom: 16px; font-size: 12px; color: var(--blue); }
.case-next-name { display: block; font-size: clamp(40px, 5vw, 72px); font-weight: 500; line-height: 1; letter-spacing: -0.05em; }
.case-next-frame .frame-label { margin-bottom: 8px; }
.case-next-frame .trim-wrap { box-shadow: 0 12px 30px rgba(20,40,70,.10); }
.case-next-frame img { display: block; width: 100%; height: auto; }

/* ---------- lightbox ---------- */
.lb {
  position: fixed; inset: 0; z-index: 100; display: grid; grid-template-rows: auto minmax(0, 1fr);
  background: rgba(14,14,14,.98); color: var(--white);
}
.lb[hidden] { display: none; }
.lb-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px 14px 24px; }
.lb-caption { margin: 0; font-size: 12px; color: rgba(255,255,255,.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-count { flex: none; font-size: 12px; color: rgba(255,255,255,.5); margin-left: auto; }
.lb-btn {
  flex: none; width: 44px; height: 44px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06); color: var(--white); font-size: 18px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.lb-btn:hover { background: rgba(255,255,255,.14); }
.lb-stage { overflow: auto; display: flex; padding: 8px 80px 32px; overscroll-behavior: contain; }
.lb-stage img, .lb-stage video {
  display: block; margin: auto; max-width: 100%; max-height: calc(100vh - 112px);
  object-fit: contain; border-radius: 8px;
  clip-path: inset(2px round 8px);  /* hides the 1px dark edge some files have */
}
.lb-stage.is-tall img { max-height: none; width: min(760px, 100%); margin-top: 0; }
.lb-prev, .lb-next { position: fixed; top: 50%; transform: translateY(-50%); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1023.98px) {
  /* layers panel becomes a sticky, horizontally scrolling chip row */
  .case-body { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 88px; }
  .layers {
    top: 0; z-index: 20; margin-inline: calc(var(--gutter) * -1); padding: 10px var(--gutter);
    background: rgba(255,255,255,.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
  .layers-title { display: none; }
  .layers ol { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .layers ol::-webkit-scrollbar { display: none; }
  .layers a { min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); }
  .layers a.is-active { border-color: var(--highlight); }
  .case-sec { scroll-margin-top: 84px; }
  .case-frames { gap: 96px; }
}
@media (max-width: 900px) {
  .case-hero { grid-template-columns: minmax(0, 1fr); }
  .case-hero-canvas { padding: 24px; }
  .case-brief { grid-template-columns: minmax(0, 1fr); }
  .shots { grid-template-columns: var(--cols-m, minmax(0, 1fr)); }
  .shot--full-m { grid-column: 1 / -1; }
  .strip-item { flex-basis: 88%; }
  .strip--narrow .strip-item { flex-basis: 62%; }
  .notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes li:last-child { grid-column: 1 / -1; }
  .case-next { padding-top: 104px; padding-bottom: 104px; }
  .case-next a { grid-template-columns: minmax(0, 1fr); }
  .lb-stage { padding: 8px 16px 88px; }
  .lb-stage img, .lb-stage video { max-height: calc(100vh - 184px); }
  .lb-prev, .lb-next { top: auto; bottom: 20px; transform: none; }
  .lb-prev { left: calc(50% - 56px); }
  .lb-next { right: calc(50% - 56px); }
}
@media (max-width: 600px) {
  .case-hero { padding-top: 24px; }
  .case-tagline { font-size: 18px; }
  .inspector { padding: 4px 16px; }
  .inspector > div { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
  .brief-card p:last-child { font-size: 18px; }
  .case-hero-canvas { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .shot-media, .case-next a, .layers a { transition: none; }
  .shot-media:hover, .case-next a:hover { transform: none; }
  .strip-track { scroll-behavior: auto; }
}
