/* The first section belongs to the page surface, not the card stack. */
.study-on body.portfolio-open-layout main > .v-hero {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
/* One smaller step for the hero, retaining the existing responsive scale. */
.study-on body.portfolio-open-layout .v-hero h1 {
  font-size: calc(var(--s-hero) * .9);
}
/* Give the desktop introduction enough room to keep applied AI on its line. */
@media (min-width: 1051px) {
  .portfolio-open-layout .hero-intro {
    max-width: 520px;
  }
}
/* Keep horizontal motion contained while letting the last card's shadow
   extend naturally into the space above the footer. */
html.depth-scroll:not(.motion-paused) body.portfolio-open-layout main {
  overflow-x: clip;
  overflow-y: visible;
}
.portfolio-open-layout .v-brand {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  line-height: 1.25;
}
.portfolio-open-layout .v-brand span {
  display: block;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.35;
}
.portfolio-open-layout .work-preview-controls { display: none !important; }
/* Text-only selected work: remove the thumbnail column at every breakpoint. */
.portfolio-open-layout #work[data-work-thumbnails="none"] .wi-index a {
  grid-template-columns: 32px minmax(0, 1fr) 150px 24px;
}
@media (max-width: 1050px) {
  .portfolio-open-layout #work[data-work-thumbnails="none"] .wi-index a {
    grid-template-columns: 24px minmax(0, 1fr) 110px 20px;
  }
}
@media (max-width: 760px) {
  .portfolio-open-layout #work[data-work-thumbnails="none"] .wi-index a {
    grid-template-columns: 22px minmax(0, 1fr) 18px;
  }
  .portfolio-open-layout #work[data-work-thumbnails="none"] .wo-num {
    display: block;
  }
}
.portfolio-open-layout .v-nav .nav-email {
  background: rgba(246, 246, 242, .65);
  backdrop-filter: blur(8px);
}
.portfolio-open-layout .v-nav .nav-email:hover {
  background: rgba(246, 246, 242, .92);
}
.portfolio-open-layout .v-hero > .motion-toggle,
.portfolio-open-layout .v-hero > .motion-toggle:hover {
  background: transparent;
  backdrop-filter: none;
}
.portfolio-open-layout .v-hero > .motion-toggle {
  top: auto;
  right: 0;
  bottom: 8px;
}
@media (max-width: 1050px) {
  .study-on body.portfolio-open-layout main > .v-hero {
    padding-bottom: 76px;
  }
}
.portfolio-open-layout .contact-bottom > .action {
  display: inline-flex;
  width: fit-content;
  margin-top: 0;
  color: var(--v-paper);
  border-bottom: 0;
}

/* Keep the inset desktop silhouette throughout entry and the reading interval.
   The outgoing depth effect can still recede from this maximum width. */
@media (min-width: 900px) {
  /* Match the card's 3.75% gutter, accounting for the hero's own margins. */
  .portfolio-open-layout .v-hero > .motion-toggle {
    right: calc(3.75% - var(--s-outer) * .925);
  }
  .study-on body.portfolio-open-layout main > :is(section, article):not(.v-hero) {
    width: 92.5%;
    max-width: 92.5%;
    margin-inline: auto;
  }
}

/* The containing content card supplies the only slide background. */
.portfolio-open-layout .product-gallery { --gallery-surface: transparent; }
.portfolio-open-layout .product-gallery :is(.gallery-sticky, .gallery-viewport, .gallery-track, .gallery-slide, .gallery-media),
.portfolio-open-layout .review-feature .focus-preview {
  background: transparent;
  box-shadow: none;
}
.portfolio-open-layout .product-gallery .gallery-viewport {
  border: 0;
  border-radius: 0;
}
.portfolio-open-layout .product-gallery .gallery-media:fullscreen {
  background: #191b1c;
}
/* Scrolling remains continuous, including touch and horizontal trackpad input. */
.portfolio-open-layout .product-gallery .gallery-viewport {
  scroll-snap-type: none;
}
.portfolio-open-layout .product-gallery .gallery-slide {
  min-height: 0;
  scroll-snap-align: none;
  scroll-snap-stop: normal;
}
/* Fit the complete frame above its caption; never let intrinsic media size
   force a slide beyond the fixed-height viewport. */
.portfolio-open-layout .gallery-pinned .gallery-slide {
  height: 100%;
  max-height: 100%;
}
.portfolio-open-layout .gallery-pinned .gallery-media {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
}
.portfolio-open-layout .product-gallery .gallery-media > :is(img, video) {
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}
.portfolio-open-layout .product-gallery :is(.gallery-media, figcaption) {
  transform: none;
}
.portfolio-open-layout .product-gallery figcaption {
  min-width: 0;
  overflow-wrap: anywhere;
}
.portfolio-open-layout .product-gallery .gallery-controls {
  flex-shrink: 0;
}

/* Scale the complete recording and controls together, inside a fixed media
   slot. Its aspect ratio and the slide/caption layout never change on scroll. */
.portfolio-open-layout .product-gallery .video-zoom-slide {
  padding-inline: 0;
}
.portfolio-open-layout .gallery-video-zoom.gallery-pinned .gallery-sticky {
  height: calc(100svh - 48px);
}
.portfolio-open-layout .gallery-pinned .video-zoom-slide {
  padding-block: 0;
}
.portfolio-open-layout .product-gallery .video-zoom-slide .gallery-media {
  padding: 0;
}
.portfolio-open-layout .video-zoom-frame {
  --video-zoom: 1;
  position: relative;
  flex: none;
  max-width: 100%;
  max-height: 100%;
  transform: scale(var(--video-zoom));
  transform-origin: 50% 50%;
  will-change: transform;
}
.portfolio-open-layout .video-zoom-frame > video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.portfolio-open-layout .gallery-media:fullscreen .video-zoom-frame {
  width: 100% !important;
  height: 100% !important;
  transform: none;
}
.motion-paused .video-zoom-frame { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .portfolio-open-layout .video-zoom-frame { transform: none; will-change: auto; }
}
@media print {
  .portfolio-open-layout .video-zoom-frame { transform: none; }
}

/* Desktop retains the original two-column contract and timeline layout. */
.ih-history-shell { display: contents; }
.ih-rail-toggle { display: none; }

@media (max-width: 1050px) {
  .portfolio-open-layout .ih-demo.ih-rail-enhanced {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px;
    min-height: 430px;
    overflow: clip;
    --ih-rail-surface: #f3f4f0;
    --ih-rail-shadow: -7px 0 20px -10px rgba(34, 43, 40, .32), -1px 0 3px rgba(34, 43, 40, .05);
  }
  .ih-rail-enhanced .ih-contract { padding: 20px; }
  .ih-rail-enhanced .ih-history-shell {
    display: block;
    min-width: 0;
    background: var(--ih-rail-surface);
    box-shadow: var(--ih-rail-shadow);
  }
  .ih-rail-enhanced .ih-rail-toggle {
    position: absolute;
    top: 8px;
    right: 4px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ih-ink);
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
  }
  .ih-rail-enhanced .ih-rail-toggle[aria-expanded="false"] {
    top: 0;
    right: 0;
    width: 52px;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 18px;
    border-radius: 0;
  }
  .ih-rail-toggle:hover,
  .ih-rail-toggle[aria-expanded="true"] {
    color: var(--ih-blue);
    background: color-mix(in srgb, var(--ih-blue) 8%, transparent);
  }
  .ih-rail-toggle:focus-visible { outline: 2px solid var(--ih-blue); outline-offset: -2px; }
  .ih-rail-toggle svg { width: 23px; height: 23px; }
  .ih-rail-toggle .ih-rail-close,
  .ih-rail-toggle[aria-expanded="true"] .ih-rail-open { display: none; }
  .ih-rail-toggle[aria-expanded="true"] .ih-rail-close { display: block; }
  .ih-rail-enhanced .ih-history {
    position: absolute;
    z-index: 2;
    inset-block: 0;
    right: 0;
    width: min(360px, calc(100% - 12px));
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border: 0;
    background: var(--ih-rail-surface);
    box-shadow: var(--ih-rail-shadow);
    overflow-y: auto;
    overscroll-behavior-y: auto;
    visibility: hidden;
    transform: translateX(100%);
    transition: transform .24s cubic-bezier(.2, .7, .3, 1), visibility .24s;
  }
  .ih-rail-enhanced[data-history-open="true"] .ih-history {
    visibility: visible;
    transform: translateX(0);
  }
  .ih-rail-enhanced .ih-history-head { flex: none; }
  .ih-rail-enhanced .ih-history-head > span,
  .ih-rail-enhanced .ih-history-head > h3 { padding-right: 34px; }
  .ih-rail-enhanced .ih-count { flex: none; }
  .ih-rail-enhanced .ih-timeline {
    flex: 1 0 140px;
    min-height: 140px;
    max-height: none;
  }
  .ih-rail-enhanced [data-ih-view] { overflow-x: auto; }
  .ih-rail-enhanced .ih-compare { min-width: 480px; }
}
@media (max-width: 480px) {
  .ih-rail-enhanced .ih-contract,
  .ih-rail-enhanced .ih-history { padding: 16px; }
  .portfolio-open-layout .v-brand span { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .ih-rail-enhanced .ih-history,
  .ih-rail-enhanced .ih-rail-toggle { transition: none; }
}

/* Keep case-study reading columns within a comfortable line length. */
.case-body > .case-content {
  width: 100%;
  max-width: 680px;
  min-width: 0;
}
.case-hero .case-lede,
.case-hero .case-takeaway,
[data-content-edition] .case-hero .story-hook {
  max-width: min(100%, 680px);
  box-sizing: border-box;
}
