/* Full-width media leads into a short introduction below. */
.case-study-body {
  --story-title-size: 28px;
  --story-heading-size: 20px;
  --story-heading-line-height: 1.35;
  --story-body-size: 16px;
  --story-section-space: 128px;
}
.case-study-body::after { display: none; }

.case-study-page {
  width: min(1040px, calc(100% - 144px));
  margin: 0 auto;
  padding: 24px 0 160px;
}

.case-study-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  isolation: isolate;
}

.case-study-media {
  --case-study-top-fade: min(8%, 48px);
  position: relative;
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  background: transparent;
  /* Reveal the page behind both edges, so the fade follows light and dark mode. */
  mask-image: linear-gradient(to bottom, transparent 0%, #000 var(--case-study-top-fade), #000 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 var(--case-study-top-fade), #000 90%, transparent 100%);
}

.case-study-video {
  display: block;
  width: 100%;
  height: min(72svh, 640px);
  object-fit: contain;
  object-position: center;
  background: transparent;
}

.case-study-media-wide .case-study-video {
  height: min(72svh, 640px);
}

.case-study-playback {
  position: absolute;
  z-index: 4;
  top: 20px;
  right: 20px;
  min-height: 40px;
  padding: 0 16px;
  border: 0.5px solid var(--theme-line);
  border-radius: 999px;
  color: var(--theme-text);
  background: var(--theme-glass);
  box-shadow: inset 0 0.5px 0 var(--theme-rim);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font: inherit;
  font-size: var(--story-body-size);
  cursor: pointer !important;
}

.case-study-playback:focus-visible {
  outline: 2px solid var(--theme-text);
  outline-offset: 4px;
}

.case-study-intro {
  position: relative;
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  padding: 24px 48px 0;
}

.case-study-summary,
.case-study-intro h1,
.case-study-section h2,
.case-study-section p {
  margin: 0;
}

.case-study-intro h1 {
  color: var(--theme-text);
  font-size: var(--story-title-size);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.case-study-summary {
  max-width: none;
  margin-top: 20px;
  color: var(--theme-muted);
  font-size: var(--story-body-size);
  line-height: 1.6;
  text-wrap: wrap;
}

.case-study-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--story-section-space) 48px;
  margin: var(--story-section-space) 48px 0;
  padding-top: 32px;
  border-top: 1px solid var(--theme-line);
}

.case-study-section h2 {
  margin-bottom: 12px;
  color: var(--theme-text);
  font-size: var(--story-heading-size);
  font-weight: 500;
  line-height: var(--story-heading-line-height);
}

.case-study-section p {
  color: var(--theme-muted);
  font-size: var(--story-body-size);
  line-height: 1.6;
}

body:has(.case-study-playback:hover) .site-cursor { opacity: 0; }

/* The final reveal uses the Early vision poster's 848 × 1704 hardware.
   Its aperture and island mask use that source geometry, with a small underlap
   so the earlier purple screen cannot survive along the composited edge. */
[data-project-story="monthly-millionaire"] .story-reveal-device {
  position: relative;
  width: 100%;
  aspect-ratio: 848 / 1704;
  background: transparent;
  filter: drop-shadow(0 20px 28px rgb(0 0 0 / 14%));
}
[data-project-story="monthly-millionaire"] .story-reveal-device-screen {
  position: absolute;
  top: calc(35 / 1704 * 100%);
  left: calc(46 / 848 * 100%);
  width: calc(756 / 848 * 100%);
  height: calc(1631 / 1704 * 100%);
  object-fit: cover;
  border-radius: calc(96 / 756 * 100%) / calc(96 / 1631 * 100%);
}
[data-project-story="monthly-millionaire"] .story-reveal-device-hardware {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mask: url('/story-assets/mm/reveal-device-rim.svg') center / 100% 100% no-repeat;
  -webkit-mask: url('/story-assets/mm/reveal-device-rim.svg') center / 100% 100% no-repeat;
  pointer-events: none;
}

@media (max-width: 899px) {
  .case-study-page { width: calc(100% - 64px); }
  .case-study-intro { padding: 24px 24px 0; }
  .case-study-sections { column-gap: 32px; margin-right: 24px; margin-left: 24px; }
}

@media (max-width: 599px) {
  .case-study-body { --story-section-space: 80px; }
  .case-study-page { width: calc(100% - 32px); padding-top: 48px; padding-bottom: 120px; }
  .case-study-video,
  .case-study-media-wide .case-study-video { height: auto; max-height: 60svh; }
  .case-study-playback { top: 12px; right: 12px; }
  .case-study-intro { padding: 20px 8px 0; }
  .case-study-summary { margin-top: 20px; }
  .case-study-sections { grid-template-columns: 1fr; gap: var(--story-section-space); margin: var(--story-section-space) 8px 0; padding-top: 28px; }
}

.story-brief { margin-top:48px; }
.story-brief dl { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:40px; margin:0; }
.story-brief dt { font-size:var(--story-heading-size); font-weight:500; line-height:var(--story-heading-line-height); letter-spacing:-.02em; }
.story-brief dd { margin:8px 0 0; color:var(--theme-muted); font-size:var(--story-body-size); line-height:1.6; text-wrap:wrap; }
[data-project-story="monthly-millionaire"] .story-reveal-device { filter:none; }
.case-study-media > .case-study-playback,
[data-project-story] .story-reveal-display .story-reveal-playback {
  position:absolute; inset:0; z-index:4; display:grid; place-items:center;
  width:100%; height:100%; min-height:0; margin:0; padding:0; border:0; border-radius:20px;
  background:rgba(0,0,0,.13); color:#fff; box-shadow:none;
  backdrop-filter:none; -webkit-backdrop-filter:none; opacity:0;
  transition:opacity 180ms ease; transform:none;
}
.case-study-media:hover > .case-study-playback,
.case-study-media > .case-study-playback:focus-visible,
[data-project-story] .story-reveal-display:hover .story-reveal-playback,
[data-project-story] .story-reveal-display .story-reveal-playback:focus-visible { opacity:1; }
.media-playback-icon { display:grid; place-items:center; width:52px; height:52px; border-radius:50%; background:rgba(20,20,20,.48); border:.5px solid rgba(255,255,255,.35); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); }
.media-playback-icon svg { width:24px; height:24px; }
@media (hover:none) {
  .case-study-media > .case-study-playback[data-paused="true"],
  [data-project-story] .story-reveal-display .story-reveal-playback[data-paused="true"] { opacity:1; }
}
@media(max-width:599px) { .story-brief dl { grid-template-columns:1fr; gap:24px; } }
@media(prefers-reduced-motion:reduce) { .case-study-media > .case-study-playback,[data-project-story] .story-reveal-display .story-reveal-playback { transition:none; } }

.case-study-media > .case-study-playback[hidden],
[data-project-story] .story-reveal-display .story-reveal-playback[hidden] { display:none; }

.case-study-page :is(h1,h2,h3,p,dd) { overflow-wrap:break-word; }
