/* Preserve the edges of original screenshots and layouts. */
:root {
  --screenshot-inset: clamp(16px, 2vw, 24px);
  --screenshot-frame-radius: 24px;
  --screenshot-radius: 8px;
  --screenshot-board-radius: 4px;
  --screenshot-phone-radius: 14% / 6.5%;
  --screenshot-shadow: 0 5px 18px rgb(0 0 0 / .10);
}

.home-featured-project {
  --home-media-height: 320px;
  grid-template-rows: var(--home-media-height) 1fr;
}
.home-featured-image {
  height: var(--home-media-height);
  align-items: center;
  padding: 28px;
  overflow: visible;
}
.home-featured-image img {
  display: block;
  flex: 0 1 auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: var(--screenshot-radius);
  corner-shape: round;
  box-shadow: var(--screenshot-shadow);
}
.home-featured-image.home-featured-board { padding: 28px; }
.home-featured-board img { max-width: calc((100% - 12px) / 2); border-radius: var(--screenshot-board-radius); }
.home-featured-project[href='/flicker/'] .home-featured-image img { border-radius: var(--screenshot-phone-radius); }

.recruiter-case .evidence-figure > button,
.recruiter-case .vr-assignment-image {
  padding: var(--screenshot-inset);
  border: 0;
  border-radius: var(--screenshot-frame-radius);
  corner-shape: round;
  background: var(--surface);
  box-shadow: none;
  overflow: visible;
}
.recruiter-case .screenshot-frame,
.recruiter-case :is(.vr-email-figure, .vr-performance-figure) > button {
  padding: 0;
  background: transparent;
}
.recruiter-case .evidence-figure > button { display: grid; place-items: center; }
.recruiter-case .evidence-figure img,
.recruiter-case .vr-assignment-image img,
.recruiter-case .vr-cover-evidence img,
.recruiter-case .vr-interaction-detail > img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  border: 0;
  border-radius: var(--screenshot-radius);
  corner-shape: round;
  box-shadow: var(--screenshot-shadow);
  transform: none;
}
.recruiter-case .vr-cover-evidence img { max-height: 420px; }
.recruiter-case .vr-cover-evidence { min-width: 0; max-width: 100%; }
.recruiter-case .vr-interaction-detail { grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); }
.recruiter-case .vr-interaction-detail > img { max-height: 460px; }
.recruiter-case :is(.vr-board-figure, .vr-performance-figure) img,
.recruiter-case .vr-assignment-image img { border-radius: var(--screenshot-board-radius); box-shadow: none; }

/* Long exports remain readable at screen width. A labelled native scroll area
   exposes every part of the original, with the existing enlarge action intact. */
.recruiter-case .screenshot-scroll {
  height: 440px;
  overflow: auto;
  border-radius: var(--screenshot-radius);
  corner-shape: round;
  /* Original exports retain transparent edges; a white backing creates a halo. */
  background: transparent;
  scrollbar-width: thin;
  box-shadow: var(--screenshot-shadow);
}
.recruiter-case .screenshot-scroll > button {
  /* Only the scroll viewport rounds/clips this image, not the shared controls. */
  --button-corner: 0px;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: zoom-in;
}
.recruiter-case .screenshot-scroll img {
  width: 100%;
  height: auto;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
}
.screenshot-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.screenshot-scroll-hint { display: block; margin-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.recruiter-case .vr-feedback-pair { align-items: start; }
.recruiter-case .vr-feedback-label { min-height: 88px; }
.recruiter-case .image-dialog img { border-radius: var(--screenshot-board-radius); corner-shape: round; }

@media screen {
  /* Keep fixed-size previews and carousel slides intact while fitting every
     image inside their available space, including transparent exports. */
  [data-design] :is(.employer-case, .seek-case, .flicker-case, .ab-testing-page, .planning-page, .scout-page, .visual-page) :is(
    .evidence-figure > button,
    .planning-board-views button,
    .visual-image
  ) {
    --button-corner: var(--screenshot-frame-radius);
    display: grid;
    place-items: center;
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    padding: var(--screenshot-inset);
    border: 0;
    border-radius: var(--screenshot-frame-radius);
    corner-shape: round;
    background: var(--surface);
    box-shadow: none;
  }
  [data-design] :is(.employer-case, .seek-case, .flicker-case, .ab-testing-page, .planning-page, .scout-page, .visual-page) :is(
    .evidence-figure > button,
    .planning-board-views button,
    .scout-screens button,
    .visual-image
  ) > img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: var(--screenshot-radius);
    corner-shape: round;
    box-shadow: var(--screenshot-shadow);
  }
  .planning-page .planning-board-views img,
  .seek-case .seek-theme-list img,
  .seek-case .seek-full-bleed img { --screenshot-radius: var(--screenshot-board-radius); }
  .visual-page .visual-image[data-clean-artwork='device'] img {
    --screenshot-radius: 0px;
    --screenshot-shadow: none;
  }
  .visual-page .visual-carousel .visual-track:has(.visual-image) { border-radius: var(--screenshot-frame-radius); }
  .visual-page .visual-viewer .visual-viewer-track {
    border: 0;
    border-radius: var(--screenshot-frame-radius);
    corner-shape: round;
    background: var(--surface);
  }
  .visual-page .visual-viewer-slide { padding: var(--screenshot-inset); }
  .visual-page .visual-viewer[data-frame] .visual-viewer-slide > img,
  .visual-page .visual-viewer-slide > img {
    border-radius: var(--screenshot-board-radius);
    corner-shape: round;
  }
  .visual-page .visual-viewer[data-frame='device'] .visual-viewer-slide > img { border-radius: 0; }

  [data-design] :is(.flicker-case .case-cover, .flicker-case .screen-explanation, .seek-cover, .scout-before) {
    background: var(--surface);
    border: 0;
    border-radius: var(--screenshot-frame-radius);
    corner-shape: round;
  }
  [data-design] :is(.flicker-case .case-cover, .flicker-case .screen-explanation, .seek-cover, .scout-before, .seek-theme-list) img {
    height: auto;
    object-fit: contain;
    border: 0;
    border-radius: var(--screenshot-radius);
    corner-shape: round;
    transform: none;
    box-shadow: var(--screenshot-shadow);
  }
  [data-design] :is(.flicker-case .case-cover, .flicker-case .screen-explanation) > img {
    width: auto;
    max-height: min(450px, 82vw);
    border-radius: var(--screenshot-phone-radius);
  }
  [data-design] :is(
    .flicker-case .flicker-empty-states .evidence-figure,
    .employer-case .evidence-figure,
    .ab-testing-page .ab-screen-gallery .evidence-figure,
    .seek-case :is(.seek-audit-figure, .seek-email-figure)
  ) > button {
    padding: 0;
    background: transparent;
  }
  .flicker-case .flicker-empty-states img { --screenshot-radius: var(--screenshot-phone-radius); }

  /* Each Work cover reserves its caption space below a full-image stage. */
  [data-design] .work-page .cs-project-image:has(img) {
    border-radius: var(--screenshot-frame-radius);
    corner-shape: round;
  }
  .work-page :is(.visual-work-preview, .employer-home-composition, .scout-work-preview, .planning-work-preview, .seek-home-composition, .cs-mobile-composition) {
    position: absolute;
    inset: var(--screenshot-inset) var(--screenshot-inset) 64px;
    display: grid;
    grid-template: minmax(0, 1fr) / repeat(2, minmax(0, 1fr));
    place-items: center;
    gap: clamp(10px, 2vw, 20px);
    width: auto;
    height: auto;
    padding: 0;
    overflow: visible;
  }
  .work-page .cs-mobile-composition { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .work-page .cs-mobile-composition .cs-mobile-shot {
    display: grid;
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    place-items: center;
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    transform: none;
  }
  .work-page .cs-project-image :is(.visual-work-preview, .employer-home-composition, .scout-work-preview, .planning-work-preview, .seek-home-composition, .cs-mobile-shot) img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    margin: 0;
    object-fit: contain;
    object-position: center;
    border-radius: var(--screenshot-radius);
    corner-shape: round;
    box-shadow: var(--screenshot-shadow);
    transform: none;
  }
  .work-page .planning-work-preview img { --screenshot-radius: var(--screenshot-board-radius); }
  .work-page .cs-flicker-screen img { border-radius: var(--screenshot-phone-radius); corner-shape: round; }

  [data-design] .case-end .case-next > img {
    padding: 4px;
    object-fit: contain;
    object-position: center;
    corner-shape: round;
  }
  [data-design] :is(.employer-case, .seek-case, .flicker-case, .ab-testing-page, .planning-page, .scout-page) .image-dialog img {
    border-radius: var(--screenshot-board-radius);
    corner-shape: round;
  }

  .application-landing .system-examples > div {
    min-width: 0;
    padding: var(--screenshot-inset);
    border-radius: var(--screenshot-frame-radius);
    corner-shape: round;
    background: var(--surface);
  }
  .application-landing :is(.screen-composition, .screen-stage, .case-image) {
    min-width: 0;
    min-height: 0;
    padding: 0;
    background: transparent;
  }
  .application-landing :is(.screen-composition, .screen-stage) {
    display: grid;
    justify-items: center;
    gap: 20px;
    overflow: visible;
  }
  .application-landing .hero-evidence > figcaption { justify-content: center; }
  .application-landing .screen-composition > .margin-note { margin: 0; padding: 0; border: 0; }
  .application-landing .screen-stage .note {
    position: static;
    order: 1;
    transform: none;
    text-align: center;
  }
  .application-landing :is(.screen-composition, .screen-stage, .case-image, .system-examples) img {
    height: auto;
    max-width: 100%;
    object-fit: contain;
    margin-inline: auto;
    border-radius: var(--screenshot-radius);
    corner-shape: round;
    transform: none;
    filter: none;
    box-shadow: var(--screenshot-shadow);
  }
  .application-landing :is(.screen-composition, .screen-stage) img { border-radius: var(--screenshot-phone-radius); }
  .application-landing .case-image img { width: auto; }
  .application-landing .case-image figcaption { display: block; text-align: center; }
}

@media screen and (max-width: 720px) {
  .work-page .cs-mobile-composition { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-page .cs-mobile-composition .cs-mobile-onboarding { display: none; }
}
@media screen and (max-width: 520px) {
  .work-page .planning-work-preview { grid-template-columns: minmax(0, 1fr); }
}

@media screen and (max-width: 720px) {
  .home-featured-project { --home-media-height: 300px; }
  .home-featured-image,
  .home-featured-image.home-featured-board { padding: 24px; }
  .recruiter-case .vr-interaction-detail { grid-template-columns: minmax(0, 1fr); }
  .recruiter-case .vr-sprint-screens {
    --sprint-slide-width: min(84%, 420px);
    display: flex;
    max-width: none;
    gap: 0;
    margin-inline: calc(-1 * (var(--wrap-margin) + var(--wrap-padding)));
    padding: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }
  /* Give the first and last slides enough scrollable space to reach center. */
  .recruiter-case .vr-sprint-screens::before,
  .recruiter-case .vr-sprint-screens::after {
    content: '';
    flex: 0 0 calc((100% - var(--sprint-slide-width)) / 2);
  }
  .recruiter-case .vr-sprint-screens .evidence-figure {
    flex: 0 0 var(--sprint-slide-width);
    scroll-snap-align: center;
  }
  .recruiter-case .vr-sprint-screens .evidence-figure + .evidence-figure { margin-inline-start: 16px; }
  .recruiter-case .vr-sprint-screens figcaption { padding-inline: 16px; }
  .recruiter-case .vr-sprint-screens:focus-visible,
  .recruiter-case .vr-sprint-screens .screenshot-scroll:focus-visible { outline-offset: -3px; }
  .recruiter-case .screenshot-scroll { height: 420px; }
  .recruiter-case .vr-feedback-label { min-height: 0; }
}
