.case-study-page .frame {
  min-height: 100svh;
  transition: none;
}

.case-study-sidebar .sidebar-content {
  max-height: calc(100svh - 220 * var(--u));
  overflow-y: auto;
  scrollbar-width: none;
}

.case-study-sidebar .actions { margin-bottom: 0; }

.case-study-summary,
.case-study-thinking,
.case-study-next-project {
  width: 100%;
  color: var(--gray);
  font-size: calc(14 * var(--u));
  font-weight: 400;
  letter-spacing: -0.03em;
}

.case-study-lead,
.case-study-next-project a { color: var(--black); }

.case-study-next-project { margin-top: calc(28 * var(--u)); }

.case-study-next-project a:focus-visible {
  outline: 1px solid var(--black);
  outline-offset: 3px;
}

.case-study-content {
  --case-copy-gap: calc(31.8 * var(--u));
  display: flex;
  flex-direction: column;
  gap: calc(40 * var(--u));
  /* Match the homepage's bounded artwork: zooming out must not stretch it to the right edge. */
  width: min(calc(1344 * var(--u)), calc(100% - var(--project-left) - 30 * var(--u)));
  margin-left: var(--project-left);
  margin-right: calc(30 * var(--u));
  padding: calc(106 * var(--u)) 0;
}

.case-study-frame {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 1344 / 756.511;
  overflow: hidden;
  background: var(--surface);
}

.case-study-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-study-artwork {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.case-study-frame[data-case-slot="product-detail"] { aspect-ratio: 16 / 9; }

/* Crop the recorded scrollbar symmetrically, without changing any frame geometry. */
.case-study-frame[data-case-slot="website-2"] .case-study-video {
  object-position: center center;
  transform: scale(1.04);
  transform-origin: center center;
}

.case-study-demo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

.case-study-text-band {
  position: relative;
  min-height: calc(198 * var(--u));
  padding: calc(35 * var(--u)) calc(30 * var(--u)) calc(17 * var(--u));
}

.case-study-text-copy {
  display: flex;
  flex-direction: column;
  gap: var(--case-copy-gap);
  width: 70.9502%;
  max-width: calc(911 * var(--u));
}

/* Closing copy shares the existing text width and spacing, centered on the artwork column. */
.case-study-centered .case-study-text-copy {
  margin-inline: auto;
  text-align: center;
}

.case-study-testimonial { min-height: calc(130 * var(--u)); }
.case-study-collaboration { min-height: 0; }

.case-study-collaboration .case-study-lead { color: var(--black); }

.case-study-content h2,
.case-study-content p {
  font-size: calc(14 * var(--u));
  line-height: 1.3;
  letter-spacing: -0.03em;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
}

.case-study-content h2,
.case-study-note {
  color: var(--black);
  font-weight: 500;
}

.case-study-text-copy p,
.case-study-split-body p {
  color: var(--gray);
  font-weight: 400;
}

.case-study-text-band > .case-study-note {
  position: absolute;
  top: calc(35 * var(--u));
  right: calc(30 * var(--u));
  text-align: right;
}

.case-study-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  aspect-ratio: 1344 / 756.511;
}

.mobile-layout .case-study-product { aspect-ratio: auto; }

.mobile-layout .case-study-frame[data-case-slot="website-1"] .case-study-demo,
.mobile-layout .case-study-frame[data-case-slot="product-detail"] .case-study-demo { pointer-events: none; }

.case-study-split-copy {
  display: flex;
  flex-direction: column;
  padding: calc(35 * var(--u)) calc(30 * var(--u)) calc(34.5 * var(--u));
}

.case-study-split-body {
  display: flex;
  flex-direction: column;
  gap: var(--case-copy-gap);
  max-width: calc(459 * var(--u));
}

.case-study-split-note {
  margin-top: auto;
  padding-top: calc(40 * var(--u));
}

html:not(.mobile-layout) .case-study-product {
  display: grid;
  grid-template-columns: minmax(0, 70.9502%) minmax(0, 1fr);
  row-gap: var(--case-copy-gap);
}

html:not(.mobile-layout) .case-study-product .case-study-text-copy { display: contents; }
html:not(.mobile-layout) .case-study-product .case-study-text-copy > * { grid-column: 1; align-self: center; }

.case-study-product-controls {
  grid-column: 2;
  grid-row: 4;
  align-self: center;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: calc(12 * var(--u));
  margin-top: 0;
  padding-top: 0;
}

.case-study-theme-switch {
  display: inline-flex;
  gap: calc(2 * var(--u));
  padding: calc(3 * var(--u));
  border-radius: calc(7 * var(--u));
  background: var(--surface);
}

.case-study-theme-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(5 * var(--u));
  min-height: calc(28 * var(--u));
  padding: 0 calc(9 * var(--u));
  border: 0;
  border-radius: calc(5 * var(--u));
  background: transparent;
  color: var(--gray);
  font: 400 calc(12 * var(--u))/1.3 Inter, sans-serif;
  letter-spacing: -0.03em;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.case-study-theme-switch button:hover { color: var(--black); }
.case-study-theme-switch button[aria-pressed="true"] {
  background: #fff;
  color: var(--black);
  box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}
.case-study-theme-switch button:focus-visible {
  outline: 1px solid var(--black);
  outline-offset: 2px;
}
.case-study-theme-switch svg {
  width: calc(13 * var(--u));
  height: calc(13 * var(--u));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.case-study-split-frame {
  height: 100%;
  aspect-ratio: auto;
}

.case-study-footer { display: none; }

@supports (text-box-trim: trim-both) {
  .case-study-content { --case-copy-gap: calc(40 * var(--u)); }
}

.mobile-layout .case-study-sidebar .sidebar-content {
  max-height: none;
  overflow: visible;
}

.mobile-layout .case-study-summary,
.mobile-layout .case-study-thinking,
.mobile-layout .case-study-next-project { font-size: var(--mobile-type); }

.mobile-layout .case-study-sidebar .services {
  width: 100%;
  margin-top: 0;
}

.mobile-layout .case-study-next-project {
  margin-top: clamp(28px, calc(56 * var(--mu)), 56px);
}

.mobile-layout .case-study-content {
  --case-copy-gap: var(--mobile-copy-gap);
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 0 var(--mobile-gutter);
  gap: clamp(24px, calc(40 * var(--mu)), 40px);
}

.mobile-layout .case-study-content h2,
.mobile-layout .case-study-content p {
  font-size: var(--mobile-type);
  line-height: 1.3;
  text-box-trim: none;
}

.mobile-layout .case-study-text-band {
  min-height: 0;
  padding: 12px 0;
}

.mobile-layout .case-study-text-copy {
  width: 100%;
  max-width: none;
}

.mobile-layout .case-study-text-band > .case-study-note {
  position: static;
  margin-bottom: var(--mobile-copy-gap);
}

.mobile-layout .case-study-split {
  display: flex;
  flex-direction: column;
  gap: 24px;
  aspect-ratio: auto;
}

.mobile-layout .case-study-split-copy { padding: 12px 0; }
.mobile-layout .case-study-split-body { max-width: none; }
.mobile-layout .case-study-split-note { padding-top: 24px; }
.mobile-layout .case-study-product-controls { gap: 16px; padding-top: 24px; }
.mobile-layout .case-study-theme-switch { gap: 2px; padding: 3px; border-radius: 7px; }
.mobile-layout .case-study-theme-switch button { min-height: 32px; gap: 5px; padding: 0 9px; border-radius: 5px; font-size: 12px; }
.mobile-layout .case-study-theme-switch svg { width: 13px; height: 13px; }

@media (prefers-reduced-motion: reduce) {
  .case-study-theme-switch button { transition: none; }
}

.mobile-layout .case-study-split-frame {
  height: auto;
  aspect-ratio: 672 / 757;
}

.mobile-layout .case-study-frame[data-case-slot="product-detail"] {
  height: auto;
  aspect-ratio: 16 / 9;
  align-self: start;
}

.mobile-layout .case-study-note,
.mobile-layout .case-study-product-controls { display: none; }

.mobile-layout .case-study-footer {
  display: flex;
  width: calc(min(100%, 1080px) - var(--mobile-gutter) - var(--mobile-gutter));
  margin: calc(80 * var(--mu)) auto;
}
