/* An architectural index above a photograph and its separate study caption. */
#services {
  --service-rule: var(--studio-line);
  background-color: var(--studio-surface);
}

#services .heading.reveal {
  opacity: 1;
  transform: none;
  transition: none;
}

#services .heading h2 {
  max-width: 15ch;
}

#services .services {
  row-gap: clamp(16px, 2.1vw, 32px);
  margin-top: clamp(26px, 4vw, 56px);
}

#services #service-tabs {
  position: relative;
  inset: auto;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-width: 0;
  border-block: 1px solid var(--service-rule);
}

#services #service-tabs .service-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(7px, 1vw, 16px);
  min-width: 0;
  min-height: 64px;
  margin: 0;
  padding: 12px clamp(10px, 1.45vw, 24px);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--studio-ink);
  text-align: start;
  transition: background-color var(--duration-fast), color var(--duration-fast);
}

#services #service-tabs .service-button + .service-button {
  border-inline-start: 1px solid var(--service-rule);
}

#services #service-tabs .service-button .name {
  font-size: clamp(.8rem, 1.18vw, 1.08rem);
  font-weight: 600;
  line-height: 1.25;
}

#services #service-tabs .service-button .arrow {
  flex: none;
  margin-inline: 0;
  opacity: .64;
  transition: translate var(--duration-fast), opacity var(--duration-fast);
}

#services #service-tabs .service-button[aria-selected="true"] {
  background: var(--studio-walnut);
  color: var(--studio-on-dark);
}

#services #service-tabs .service-button[aria-selected="true"] .arrow {
  opacity: 1;
  color: var(--studio-accent);
}

#services #service-tabs .service-button:focus-visible {
  outline-offset: -4px;
}

#services #service-tabs .service-button[aria-selected="true"]:focus-visible {
  outline-color: var(--studio-focus-dark);
}

@media (hover: hover) and (pointer: fine) {
  #services #service-tabs .service-button:not([aria-selected="true"]):hover {
    background: var(--studio-recessed);
  }

  #services #service-tabs .service-button:hover .arrow {
    translate: 2px -2px;
    opacity: 1;
  }
}

#services .service-view {
  --service-matte: var(--studio-dark);
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.84fr) minmax(17rem, 1fr);
  align-self: start;
  min-width: 0;
  border-radius: 0;
  color: var(--studio-on-dark);
  background: var(--service-matte);
  transition: background-color var(--duration-medium) var(--ease-standard);
}

#services .service-view:is([data-service-index="1"], [data-service-index="4"]) {
  --service-matte: var(--studio-forest-deep);
}

#services .service-view[data-service-index="3"] {
  --service-matte: var(--studio-walnut);
}

#services .service-photo {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: clamp(300px, 34vw, 515px);
  background: var(--studio-dark-surface);
}

#services .service-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
  object-position: 50% 60%;
  opacity: 1;
  transition: none;
}

#services .service-photo img[data-study="1"] { object-position: 50% 47%; }
#services .service-photo img[data-study="2"] { object-position: 50% 68%; }
#services .service-photo img[data-study="3"] { object-position: 50% 34%; }
#services .service-photo img[data-study="4"] { object-position: 50% 50%; }

#services .service-photo > .service-photo-outgoing {
  z-index: 1;
  pointer-events: none;
}

#services .service-photo[data-service-state="unavailable"] > #service-image {
  opacity: 0;
}

#services .service-caption {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  gap: clamp(13px, 2.15vw, 30px);
  min-height: 0;
  padding: clamp(24px, 4vw, 64px);
  background: transparent;
  color: inherit;
}

#services .service-image-note {
  position: static;
  width: fit-content;
  max-width: 100%;
  padding: 0 0 9px;
  border-block-end: 1px solid var(--studio-accent);
  border-inline-start: 0;
  color: var(--studio-accent);
  background: transparent;
  font-size: var(--type-meta);
  line-height: 1.3;
}

#services .service-caption h3 {
  margin: 0;
  color: var(--studio-on-dark);
  font-size: clamp(1.6rem, 3vw, 3.25rem);
  font-weight: 500;
  line-height: 1.06;
  overflow-wrap: anywhere;
}

#services .service-caption p {
  max-width: 36ch;
  margin: 0;
  color: var(--studio-on-dark-muted);
  line-height: 1.65;
}

@media (max-width: 860px) {
  #services .service-view {
    grid-template-columns: minmax(0, 1fr);
  }

  #services .service-photo {
    min-height: 0;
    aspect-ratio: 16 / 10;
  }
}

@media (max-width: 760px) {
  #services .heading h2 {
    max-width: none;
  }

  #services #service-tabs {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--studio-stone) var(--studio-bg);
  }

  #services #service-tabs .service-button {
    flex: 0 0 auto;
    width: auto;
    min-height: 50px;
    padding-inline: 12px;
  }

  #services #service-tabs .service-button .name {
    white-space: nowrap;
  }

  #services .service-caption {
    gap: 16px;
    padding: 24px;
  }
}
