/* Reusable interactive pieces: side-by-side panels (.acc), stacked bars (.stack),
   the testimonial carousel and pop-up dialogs. */

/* ---------- Side-by-side panels (Home "What makes us different", Our Work homes) ---------- */

.acc {
  --tab: clamp(80px, 8.9vw, 128px);
  --line: 2px;
  --num-size: clamp(24px, 2.36vw, 34px);
  --title-size: clamp(20px, 2.08vw, 30px);
  --title-spacing: 0.05em;
  container-type: inline-size;
  position: relative;
  display: flex;
  height: clamp(520px, 50vw, 720px);
  border: var(--line) solid var(--ink-2);
}

.acc--homes {
  --num-size: clamp(24px, 2.43vw, 35px);
  --title-size: clamp(20px, 2.22vw, 32px);
  --title-spacing: 0.004em;
}

.acc__panel {
  display: flex;
  flex: 0 0 calc(var(--tab) + var(--line));
  min-width: 0;
  overflow: hidden;
  border-right: var(--line) solid var(--ink-2);
  transition: flex-grow 0.6s var(--ease);
}

.acc__panel:last-child {
  flex-basis: var(--tab);
  border-right: 0;
}

.acc__panel.is-open {
  flex-grow: 1;
}

.acc__tab {
  display: flex;
  flex: 0 0 var(--tab);
  flex-direction: column;
  align-items: center;
  width: var(--tab);
  height: 100%;
  margin: 0;
  padding: clamp(18px, 2.08vw, 30px) 0 clamp(16px, 1.74vw, 25px);
  border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 0.35s, color 0.35s;
}

.acc__panel:not(.is-open) .acc__tab:hover {
  background: rgba(11, 20, 24, 0.05);
}

.acc__panel.is-open .acc__tab {
  background: var(--ink-2);
  color: var(--orange);
  cursor: default;
}

.acc__num {
  font-family: var(--font-display);
  font-size: var(--num-size);
  letter-spacing: 0.04em;
  line-height: 1.47;
}

.acc__arrow {
  flex: none;
  margin-top: 6px;
}

.acc__arrow--open {
  display: none;
  width: clamp(18px, 1.8vw, 26px);
  height: clamp(20px, 2vw, 29px);
}

.acc__arrow--closed {
  width: clamp(23px, 2.3vw, 33px);
  height: clamp(18px, 1.8vw, 26px);
}

.acc__panel.is-open .acc__arrow--open {
  display: block;
}

.acc__panel.is-open .acc__arrow--closed {
  display: none;
}

.acc__title {
  margin-top: auto;
  font-family: var(--font-display);
  font-size: var(--title-size);
  letter-spacing: var(--title-spacing);
  line-height: 1;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.acc__body {
  position: relative;
  flex: 0 0 auto;
  /* Fixed at the fully-open width so the copy doesn't reflow while panels animate */
  width: calc(100cqw - 5 * var(--tab) - 4 * var(--line));
  overflow: hidden;
}

.acc__body[hidden] {
  display: none;
}

.acc__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.acc__body--shaded::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.72) 100%);
}

.acc__copy {
  position: absolute;
  z-index: 1;
  left: clamp(20px, 2.78vw, 40px);
  bottom: clamp(24px, 3.6vw, 52px);
  width: min(470px, calc(100% - 2 * clamp(20px, 2.78vw, 40px)));
  color: #fff;
  font-size: clamp(16px, 1.32vw, 19px);
  line-height: 1.53;
  opacity: 0;
  transition: opacity 0.3s;
}

.acc__panel.is-open .acc__copy {
  opacity: 1;
  transition: opacity 0.4s 0.35s;
}

.acc__copy p {
  margin: 0;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: clamp(20px, 2.36vw, 34px);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.text-link svg {
  transition: transform 0.2s var(--ease);
}

.text-link:hover svg,
.text-link:focus-visible svg {
  transform: translateX(4px);
}

/* A link or button that makes its whole positioned container clickable */
.stretched::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* Our Work: a photo with only a "See More" link */
.acc--homes .acc__copy {
  bottom: clamp(18px, 1.8vw, 26px);
  font-size: clamp(17px, 1.53vw, 22px);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.acc--homes .text-link {
  margin-top: 0;
  color: var(--paper-light);
}

@media (max-width: 859.98px) {
  .acc {
    flex-direction: column;
    height: auto;
  }

  .acc__panel,
  .acc__panel:last-child {
    flex: none;
    flex-direction: column;
    border-right: 0;
    border-bottom: var(--line) solid var(--ink-2);
  }

  .acc__panel:last-child {
    border-bottom: 0;
  }

  .acc__tab {
    flex: none;
    flex-direction: row;
    gap: 14px;
    width: 100%;
    height: auto;
    padding: 12px 18px;
  }

  .acc__num {
    font-size: 22px;
  }

  .acc__arrow {
    order: 2;
    margin: 0 0 0 auto;
  }

  .acc__title {
    order: 1;
    margin: 0;
    font-size: clamp(15px, 3.6vw, 20px);
    white-space: normal;
    writing-mode: horizontal-tb;
    transform: none;
  }

  .acc__body {
    width: auto;
    height: clamp(360px, 100vw, 540px);
  }

  .acc__panel:not(.is-open) .acc__body {
    display: none;
  }

  .acc__copy {
    opacity: 1;
  }
}

/* ---------- Stacked bars that open downwards (Our Process steps, Our Work archive) ---------- */

.stack__bar {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.7vw, 39px);
  width: 100%;
  min-height: clamp(68px, 8.47vw, 122px);
  margin: 0;
  padding: 12px clamp(18px, 4.6vw, 66px) 12px clamp(18px, 3.79vw, 54.6px);
  border: 0;
  background: var(--bar, var(--teal-ink));
  color: var(--paper-light);
  font-family: var(--font-display);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s, filter 0.2s;
}

.stack__item:not(.is-open) .stack__bar:hover {
  filter: brightness(1.06);
}

.stack__item.is-open .stack__bar {
  background: var(--open-bar, #091317);
  color: var(--orange);
  cursor: default;
}

.stack__num {
  flex: none;
  min-width: 1.4em;
  font-size: clamp(30px, 3.54vw, 51px);
  font-weight: 500;
  letter-spacing: -0.024em;
  line-height: 1.2;
}

.stack__title {
  flex: 1;
  font-size: clamp(17px, 2.5vw, 36px);
  letter-spacing: 0.005em;
  line-height: 1.2;
  text-transform: uppercase;
}

.stack__arrow {
  flex: none;
  margin-left: auto;
}

.stack__arrow--open {
  display: none;
  width: clamp(18px, 1.83vw, 26px);
  height: clamp(20px, 2.09vw, 30px);
}

.stack__arrow--closed {
  width: clamp(20px, 2.15vw, 31px);
  height: clamp(16px, 1.68vw, 24px);
}

.stack__item.is-open .stack__arrow--open {
  display: block;
}

.stack__item.is-open .stack__arrow--closed {
  display: none;
}

/* Animates to the content's natural height */
.stack__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s var(--ease);
}

.stack__item.is-open .stack__panel {
  grid-template-rows: 1fr;
}

.stack__panel > * {
  min-height: 0;
  overflow: hidden;
}

/* ---------- Testimonials ---------- */

.testimonials {
  --card-w: clamp(250px, 36.7vw, 528px);
  --card-h: calc(var(--card-w) * 1.1864);
  --card-gap: clamp(14px, 2.25vw, 32px);
  position: relative;
  padding-bottom: clamp(72px, 8.9vw, 128px);
  overflow: hidden;
  background: #fff;
}

/* Teal runs behind the heading and three-quarters of the way down the cards */
.testimonials__stage {
  padding-top: clamp(16px, 1.46vw, 21px);
  background: linear-gradient(to bottom, var(--teal) calc(100% - var(--card-h) * 0.2525), #fff 0);
}

.section-title--light {
  margin: 0 0 clamp(20px, 2.43vw, 35px);
  color: #f5f5f5;
}

.carousel {
  margin-left: var(--edge);
  overflow: hidden;
}

.carousel__track {
  --i: 0;
  display: flex;
  gap: var(--card-gap);
  transform: translateX(calc(var(--i) * -1 * (var(--card-w) + var(--card-gap))));
  transition: transform 0.7s var(--ease);
}

.card {
  position: relative;
  flex: 0 0 var(--card-w);
  height: var(--card-h);
  overflow: hidden;
  background: var(--play-ink);
}

.card__photo,
.card__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.card__video {
  opacity: 0;
  transition: opacity 0.3s;
}

.card.is-playing .card__video {
  opacity: 1;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--tint);
  pointer-events: none;
  transition: opacity 0.45s;
}

.card.is-active::after {
  opacity: 0;
}

.card__btn {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.card__btn:focus-visible {
  outline-offset: -6px;
}

.card__icon {
  position: absolute;
  left: 8.5%;
  bottom: 6.1%;
  display: grid;
  place-items: center;
  width: clamp(52px, 5.49vw, 79px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  color: rgba(79, 102, 107, 0.9);
  transition: background-color 0.3s, color 0.3s, transform 0.2s var(--ease);
}

.card__btn:hover .card__icon {
  transform: scale(1.06);
}

.card.is-active .card__icon {
  background: #fff;
  color: var(--play-ink);
}

.card__icon svg {
  grid-area: 1 / 1;
}

.i-play {
  width: 30%;
  height: auto;
  margin-left: 9%;
}

.i-pause {
  width: 27%;
  height: auto;
  visibility: hidden;
}

.card.is-playing .i-play {
  visibility: hidden;
}

.card.is-playing .i-pause {
  visibility: visible;
}

@media (max-width: 640px) {
  .testimonials {
    --card-w: 72vw;
  }
}

.quote {
  max-width: 700px;
  margin: clamp(32px, 3.8vw, 55px) 0 0;
  color: var(--teal-ink);
  transition: opacity 0.25s;
}

.quote.is-changing {
  opacity: 0;
}

.quote__name {
  margin: 0 0 clamp(12px, 1.44vw, 20.7px);
  font-family: var(--font-display);
  font-size: clamp(22px, 2.25vw, 32.4px);
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.45;
  text-transform: uppercase;
}

.quote__text {
  margin: 0;
}

.quote__text p {
  margin: 0;
  font-size: clamp(19px, 2.18vw, 31.4px);
  line-height: 1.34;
  text-indent: -0.42em;
}

/* ---------- Pop-up dialogs ---------- */

.modal {
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  overflow: hidden;
}

.modal::backdrop {
  background: rgba(12, 21, 25, 0.78);
}

.modal[open] {
  animation: modal-in 0.3s var(--ease);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

.modal__close {
  position: absolute;
  z-index: 2;
  top: clamp(12px, 2.3vw, 32px);
  right: clamp(12px, 2.3vw, 32px);
  display: grid;
  place-items: center;
  width: clamp(40px, 4vw, 56px);
  height: clamp(40px, 4vw, 56px);
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.2s var(--ease);
}

.modal__close:hover {
  transform: rotate(90deg);
}

.modal__close svg {
  width: 80%;
  height: 80%;
}

body:has(.modal[open]) {
  overflow: hidden;
}
