/* Shared edge-to-edge layout for case-study image sections and galleries. */
html,
body {
  overflow-x: clip;
}

/* Keep the project introduction background continuous over a sticky hero. */
.project-intro,
.intro {
  position: relative;
  isolation: isolate;
  border-bottom: 0 !important;
}

/* Keep sticky hero pixels inside their group so they cannot show through later section gaps. */
.hero-intro-group {
  isolation: isolate;
}

/* Paint the intro-to-content breathing room above the sticky hero. */
.hero-intro-group + .wrap > :is(.story, .story-grid),
.hero-intro-group + .wrap > section:first-child,
.hero-intro-group + :is(.story, .story-grid, .kanpo-flow) {
  position: relative;
  z-index: 1;
  background-color: var(--paper, #fff);
}

.project-intro::before,
.intro::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: var(--paper, #fff);
  pointer-events: none;
}

.project-bleed {
  box-sizing: border-box;
  width: 100vw;
  max-width: none !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
}

.project-bleed > img,
.project-bleed figure > img,
.project-bleed .gallery-grid img,
.project-bleed .applications-grid img,
.project-bleed .sketch-grid img {
  max-width: 100%;
}

/* Preserve existing figure sizing and collage gaps while removing old wrap offsets. */
.project-bleed > :is(.feature-board, .full-board) {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.project-intro-body.is-collapsed {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-clamp: var(--intro-lines, 7);
  -webkit-line-clamp: var(--intro-lines, 7);
}

.project-intro-body.is-collapsed > * {
  min-width: 0;
}

.project-intro-body > h2 {
  margin: 18px 0 8px;
}

.project-intro-body > h2.intro-heading-17 {
  font-size: 17px;
  line-height: 1.3;
  font-weight: 500;
}

.project-intro-body > h2.intro-heading-16 {
  font-size: 16px;
  line-height: 1.45;
  font-weight: 500;
}

.project-intro-body > h2.intro-heading-small {
  font-size: 13px;
  line-height: 1.7;
  font-weight: 700;
  margin-bottom: 10px;
}

.project-intro-toggle {
  appearance: none;
  margin-top: 10px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #888;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 11px;
  line-height: 1.5;
  cursor: pointer;
}

.project-intro-toggle[hidden] {
  display: none;
}

.project-intro-toggle:hover {
  opacity: .65;
}

.project-intro-toggle:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .project-intro-body.is-collapsed {
    --intro-lines: 4;
  }
}

@media (max-width: 760px) {
  /* Bound each mobile sticky hero to its intro so it releases before the next section. */
  .hero-intro-group > .hero-stage {
    position: sticky;
    top: 0;
    z-index: 0;
    height: var(--project-hero-height, var(--hero-height));
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .hero-intro-group > .hero-stage > .project-hero {
    position: relative;
    top: auto;
    height: 100%;
  }

  .kanpo-flow {
    padding-top: 0 !important;
  }

  .project-bleed :is(
    .chapter-copy,
    .exploration-notes,
    .development-head,
    .gallery-head,
    .split-copy,
    .story-copy,
    .concept-copy,
    .packaging-explainer,
    .structure-copy,
    .story-cell-copy,
    .process-copy,
    .section-head,
    .accordion,
    .kanpo-copy,
    .kanpo-copy-one,
    .kanpo-copy-two,
    .image-caption,
    .caption
  ),
  .brand-guide-copy {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .project-bleed.centered > :is(.eyebrow, h1, h2, h3, p) {
    padding-left: 12px;
    padding-right: 12px;
  }

  .project-bleed.usp > h2,
  .project-bleed.usp .usp-visual > p {
    padding-left: 12px;
    padding-right: 12px;
  }

  .project-intro-body.is-collapsed {
    --intro-lines: 2;
  }
}
