.corporate-profile {
  --page-scroll: 70vh;
  position: relative;
  height: calc(100vh + (var(--pages) - 1) * var(--page-scroll));
  height: calc(100svh + (var(--pages) - 1) * var(--page-scroll));
}

.corporate-profile__sticky {
  position: sticky;
  /* top: 0; */
  top: calc(var(--header-height, 72px) + 2rem);
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: #fff;
}

/* Background image, filling the pinned area like the hero. */
.corporate-profile__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.corporate-profile__bg > *,
.corporate-profile__bg .field,
.corporate-profile__bg .field__item,
.corporate-profile__bg article,
.corporate-profile__bg picture {
  height: 100%;
}

.corporate-profile__bg img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.field--type-entity-reference.field--name-field-profile-background {
  margin-bottom: 0;
}

/* Title at the top, box centred vertically on the right. */
.corporate-profile__inner {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  padding-top: calc(var(--header-height, 72px) + 3rem);
  padding-bottom: 3rem;
}

.profile-box {
  justify-self: end;
  align-self: center;
  width: min(100%, 665px);
  /* height: 26rem; */
  padding: 6rem 2rem;
  border-radius: 16px;
  border: solid 1px #9e9e9e;
  background: linear-gradient(
    52deg,
    rgba(95, 78, 124, 0.75) 31%,
    rgba(121, 121, 159, 0.75) 100%
  );
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: minmax(0, 1fr);   /* pages fill the box's fixed height */
  column-gap: 2rem;
}

/* All pages share one cell; only the active one is visible. */
.profile-box__pages {
  display: grid;
  overflow: hidden;
}

.profile-box__page {
  grid-area: 1 / 1;
  visibility: hidden;
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
}

.profile-box__page.is-active {
  visibility: visible;
  opacity: 1;
  transform: none;
}

/* Each page is a column, so the link can sit at the bottom of the box. */
.profile-box__page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-stat__number {
  margin: 0;
  font-family: 'Merriweather', serif;
  font-size: clamp(3rem, 6vw, 8rem);
  font-weight: 500;
  line-height: 1;
  color: #fff;
}

.profile-stat__description {
  margin: 0;
  font-family: 'Merriweather', serif;
  font-size: 24px;
  font-weight: 300;
  line-height: 2.92;
  color: #fff;
}

.profile-stat__note {
  margin: 0;
  font-size: 18px;
  color: #fff;
}

.profile-stat__link {
  margin-top: auto;
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 0.75rem;
  font-size: 18px;
  font-weight: 500;
  color: #242935;
  text-decoration: none;
}

.profile-stat__link .icon-arrow-circle {
  font-size: 2rem;
}

.profile-box__pages {
  display: grid;
  overflow: hidden;
}

.profile-box__tracker {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

/* The button gives a comfortable click target; the visible dash is ::before. */
.profile-box__dash {
  padding: 0 0.75rem;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.profile-box__dash::before {
  content: "";
  display: block;
  width: 3px;
  height: 0.75rem;
  border-radius: 2px;
  background: #fff;
  transition: height 0.25s ease, background-color 0.25s ease;
}

.profile-box__dash.is-active::before {
  height: 1.75rem;
  background: #fff;
}

.profile-box__dash:not(.is-active) {
  opacity: 0.4;
}

.profile-box__dash:focus-visible {
  outline: 2px solid #7e61de;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .profile-box__dash::before {
    transition: none;
  }
}

/* Below lg: still pinned and cycling, but the image sits above a
   full-width box (414 design). */
@media (max-width: 991.98px) {
  .corporate-profile__sticky {
    display: grid;
    grid-template-columns: 100%;
    grid-template-rows: minmax(0, auto) 1fr;
  }

  /* Image fills the space above the box, not the whole pinned area */
  .corporate-profile__bg {
    position: relative;
    inset: auto;
    grid-area: 1 / 1;
    overflow: hidden;
  }

  /* Title and box become direct grid items of the pinned area */
  .corporate-profile__inner {
    display: contents;
  }

  .profile-header {
    grid-area: 1 / 1;
    align-self: start;
    padding: calc(var(--header-height, 72px) + 1.5rem) 1.5rem 0;
  }

  .profile-box {
    grid-area: 2 / 1;
    justify-self: stretch;
    align-self: stretch;
    width: 100%;
    align-content: start;
    padding: 2.5rem max(1.5rem, calc(50% - 360px));
    border: 0;
    border-radius: 0;
    background: linear-gradient(52deg, #5f4e7c 31%, #79799f 100%);
    grid-template-rows: auto;
    column-gap: 1.5rem;
  }

  .profile-stat__number {
    font-size: 56px;
  }

  .profile-stat__description {
    font-size: 18px;
    line-height: 1.5;
  }

  .profile-stat__note {
    font-size: 16px;
  }

  .profile-stat__link {
    align-self: stretch;
    justify-content: center;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-box__page {
    transition: none;
    transform: none;
  }
}