:root {
  --case-bg: #151515;
  --case-media: #202020;
  --case-ink: #f4f4ef;
  --case-muted: #858581;
  --case-line: rgba(244, 244, 239, 0.13);
  --case-focus: #00e463;
  --case-dialog-width: clamp(600px, 46vw, 760px);
  --case-dialog-half: clamp(300px, 23vw, 380px);
}

body.case-popup-open {
  overflow: hidden;
}

[data-case-open] {
  cursor: pointer;
}

.case-popup[hidden] {
  display: none;
}

.case-popup {
  position: fixed;
  z-index: 1400;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(5, 5, 5, 0.68);
  color: var(--case-ink);
  font-family: "Inter Local", Inter, Arial, sans-serif;
  opacity: 0;
  scrollbar-color: rgba(244, 244, 239, 0.28) transparent;
  scrollbar-width: thin;
  transition: opacity 180ms ease;
}

.case-popup.is-open {
  opacity: 1;
}

.case-popup__stage {
  position: relative;
  width: var(--case-dialog-width);
  min-height: 100%;
  margin: 0 auto;
  padding: 48px 0 80px;
}

.case-popup__dialog {
  width: var(--case-dialog-width);
  overflow: hidden;
  border-radius: 48px;
  background: var(--case-bg);
  box-shadow: 0 32px 96px rgba(0, 0, 0, 0.36);
  opacity: 0;
  transform: scale(0.88);
  transform-origin: 50% 0;
  transition: opacity 180ms ease, transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.case-popup.is-open .case-popup__dialog {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.case-popup__close {
  position: fixed;
  z-index: 6;
  top: 46px;
  left: calc(50% + var(--case-dialog-half) + 8px);
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244, 244, 239, 0.64);
  border-radius: 50%;
  background: transparent;
  color: var(--case-ink);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.case-popup__close::before,
.case-popup__close::after {
  grid-area: 1 / 1;
  width: 16px;
  height: 1.5px;
  border-radius: 99px;
  background: currentColor;
  content: "";
}

.case-popup__close::before { transform: rotate(45deg); }
.case-popup__close::after { transform: rotate(-45deg); }

.case-popup__close:hover {
  border-color: var(--case-ink);
  background: rgba(244, 244, 239, 0.1);
  transform: rotate(3deg);
}

.case-popup__close:focus-visible,
[data-case-open]:focus-visible,
.case-story__video video:focus-visible {
  outline: 2px solid rgba(244, 244, 239, 0.82);
  outline-offset: 3px;
}

.case-popup__dialog:focus {
  outline: none;
}

.case-popup__content {
  padding: 0 0 64px;
}

.case-story__header h2 {
  margin: 0;
  padding: 34px 48px 0;
  overflow: hidden;
  color: var(--case-muted);
  font-size: 18px;
  font-weight: 500;
  line-height: 26px;
  letter-spacing: -0.18px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-story__intro {
  margin: 52px 48px 0;
  color: var(--case-ink);
  font-size: 24px;
  font-weight: 500;
  line-height: 35px;
  letter-spacing: -0.42px;
}

.case-story__role,
.case-story__section,
.case-story__video-section {
  margin: 64px 48px 0;
}

.case-story__label {
  margin: 0;
  color: var(--case-muted);
  font-size: 19px;
  font-weight: 400;
  line-height: 28px;
  letter-spacing: -0.26px;
}

.case-story__prose {
  margin-top: 20px;
}

.case-story__prose p,
.case-story__results-intro,
.case-story__note > p:last-child,
.case-story__caption {
  margin: 0;
  color: var(--case-ink);
  font-size: 24px;
  font-weight: 500;
  line-height: 35px;
  letter-spacing: -0.42px;
}

.case-story__prose p + p {
  margin-top: 24px;
}

.case-story__media {
  margin: 64px 16px 0;
}

.case-story__gallery {
  margin: 64px 16px 0;
}

.case-story__gallery-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 28px;
  background: var(--case-media);
  touch-action: pan-y;
}

.case-story__gallery-viewport:focus-visible {
  outline: 2px solid rgba(244, 244, 239, 0.82);
  outline-offset: 3px;
}

.case-story__gallery-track {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.case-story__gallery-slide {
  width: 100%;
  min-width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.case-story__gallery-slide img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  user-select: none;
}

.case-story__gallery-dots {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 10px;
  left: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.case-story__gallery-dots button {
  width: 24px;
  height: 24px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.case-story__gallery-dots button::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(244, 244, 239, 0.3);
  content: "";
  transition: background-color 160ms ease, transform 160ms ease;
}

.case-story__gallery-dots button[aria-current="true"]::before {
  background: var(--case-ink);
  transform: scale(1.08);
}

.case-story__gallery-dots button:focus-visible {
  outline: 1px solid rgba(244, 244, 239, 0.54);
  outline-offset: -3px;
  border-radius: 50%;
}

.case-story__media-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: var(--case-media);
}

.case-story__media--square .case-story__media-frame {
  aspect-ratio: 1 / 1;
}

.case-story__media--landscape .case-story__media-frame {
  aspect-ratio: 1.22 / 1;
}

.case-story__media--compact .case-story__media-frame {
  aspect-ratio: 1.42 / 1;
}

.case-story__media img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

.case-story__gallery figcaption,
.case-story__media figcaption,
.case-story__caption {
  margin: 12px 32px 0;
  color: rgba(244, 244, 239, 0.46);
  font-size: 15px;
  line-height: 22px;
  letter-spacing: -0.14px;
}

.case-story__results-intro {
  margin-top: 20px;
}

.case-story__metrics {
  margin: 30px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 24px 16px;
}

.case-story__metric {
  padding: 16px 0 0;
  border-top: 1px solid var(--case-line);
}

.case-story__metric:only-child {
  grid-column: 1 / -1;
}

.case-story__metric dt,
.case-story__metric dd {
  margin: 0;
}

.case-story__metric dt {
  color: var(--case-ink);
  font-size: 24px;
  font-weight: 500;
  line-height: 35px;
  letter-spacing: -0.42px;
}

.case-story__metric dd {
  margin-top: 8px;
  color: rgba(244, 244, 239, 0.58);
  font-size: 20px;
  line-height: 30px;
  letter-spacing: -0.3px;
}

.case-story__video-section {
  margin-right: 16px;
  margin-left: 16px;
}

.case-story__video-section > .case-story__label {
  margin: 0 32px 20px;
}

.case-story__video {
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: #090909;
}

.case-story__video--wide {
  aspect-ratio: 16 / 10;
}

.case-story__video--phone {
  aspect-ratio: 4 / 5;
}

.case-story__video video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #090909;
}

.case-story__note {
  margin: 64px 48px 0;
  padding-top: 22px;
  border-top: 1px solid var(--case-line);
}

.case-story__note > p:last-child {
  margin-top: 18px;
}

@media (max-width: 959px) {
  .case-popup {
    padding-top: 48px;
    overflow: hidden;
    background: rgba(5, 5, 5, 0.8);
  }

  .case-popup__stage {
    width: 100%;
    height: calc(100dvh - 48px);
    min-height: 0;
    padding: 0;
  }

  .case-popup__dialog {
    width: 100%;
    height: calc(100dvh - 48px);
    min-height: 0;
    border-radius: 24px 24px 0 0;
    transform: translate3d(0, 32px, 0);
    transition: opacity 180ms ease, transform 500ms cubic-bezier(0.32, 0.72, 0, 1);
  }

  .case-popup__content {
    height: calc(100dvh - 88px);
    margin-top: 40px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .case-popup__close {
    top: 48px;
    right: 0;
    left: 0;
    width: 100%;
    height: 40px;
    border-color: transparent;
    border-radius: 24px 24px 0 0;
    background: var(--case-bg);
  }

  .case-popup__close::before {
    width: 40px;
    height: 4px;
    background: rgba(244, 244, 239, 0.2);
    transform: none;
  }

  .case-popup__close::after {
    display: none;
  }

  .case-popup__close:hover {
    border-color: transparent;
    background: var(--case-bg);
    transform: none;
  }

  .case-story__header h2 {
    display: none;
  }

  .case-story__intro {
    margin: 4px 24px 0;
  }

  .case-story__role,
  .case-story__section {
    margin: 64px 24px 0;
  }

  .case-story__media,
  .case-story__gallery,
  .case-story__video-section {
    margin: 64px 8px 0;
  }

  .case-story__note {
    margin: 64px 24px 0;
  }
}

@media (max-width: 620px) {
  .case-popup__content {
    padding-bottom: max(44px, env(safe-area-inset-bottom));
  }

  .case-story__header h2 {
    font-size: 18px;
  }

  .case-story__intro,
  .case-story__prose p,
  .case-story__results-intro,
  .case-story__note > p:last-child,
  .case-story__caption {
    font-size: 22px;
    line-height: 32px;
    letter-spacing: -0.34px;
  }

  .case-story__label {
    font-size: 18px;
    line-height: 27px;
  }

  .case-story__metric dt,
  .case-story__metric dd {
    font-size: 20px;
    line-height: 30px;
  }

  .case-story__intro {
    margin: 4px 24px 0;
  }

  .case-story__role,
  .case-story__section {
    margin: 64px 24px 0;
  }

  .case-story__media {
    margin: 64px 8px 0;
  }

  .case-story__gallery {
    margin: 64px 8px 0;
  }

  .case-story__media-frame,
  .case-story__gallery-viewport,
  .case-story__video {
    border-radius: 22px;
  }

  .case-story__gallery figcaption,
  .case-story__media figcaption,
  .case-story__caption {
    margin-right: 20px;
    margin-left: 20px;
    font-size: 14px;
    line-height: 21px;
  }

  .case-story__video-section {
    margin: 64px 8px 0;
  }

  .case-story__video-section > .case-story__label {
    margin-right: 20px;
    margin-left: 20px;
  }

  .case-story__note {
    margin: 64px 24px 0;
  }

  .case-story__metrics {
    gap: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-popup,
  .case-popup__dialog,
  .case-popup__close,
  .case-story__gallery-track {
    scroll-behavior: auto;
    transition: none;
  }
}
