.service-panels {
  padding-bottom: 7rem;
  background-color: var(--offwhite);
  color: var(--black);
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .service-panels {
    padding-bottom: 10rem;
  }
}

/* ============================================ */
/* HEADER */
/* ============================================ */

/* The rule opens the chapter; margins rather than padding keep it inside the page gutters */
.service-panels__header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 3rem;
  margin-left: 20px;
  margin-right: 20px;
  padding-top: 3rem;
  border-top: 1px solid rgba(13, 22, 17, 0.16);
}

/* Tablet Portrait Up - Min 600px */
@media (min-width: 600px) {
  .service-panels__header {
    margin-left: 32px;
    margin-right: 32px;
  }
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .service-panels__header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    gap: 4rem;
    margin-bottom: 4rem;
    margin-left: 40px;
    margin-right: 40px;
    padding-top: 4rem;
  }
}

.service-panels__header h2 {
  max-width: 900px;
  margin-top: 0;
  margin-bottom: 0;
  font-size: 40px;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

/* Tablet Portrait Up - Min 600px */
@media (min-width: 600px) {
  .service-panels__header h2 {
    font-size: 56px;
  }
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .service-panels__header h2 {
    font-size: 76px;
  }
}

/* Big Desktop Up - Min 1800px */
@media (min-width: 1800px) {
  .service-panels__header h2 {
    font-size: 96px;
  }
}

.service-panels__header p {
  max-width: 400px;
  margin-top: 0;
  margin-bottom: 0;
  color: var(--dark-gray);
  font-size: 17px;
  line-height: 1.55;
}

/* ============================================ */
/* PANELS */
/* ============================================ */

.service-panels__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 12px;
  padding-right: 12px;
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .service-panels__list {
    flex-direction: row;
    height: 84vh;
    min-height: 620px;
    max-height: 920px;
    padding-left: 40px;
    padding-right: 40px;
  }
}

.service-panels-item {
  position: relative;
  min-width: 0;
  overflow: hidden;
  transition: flex-grow 900ms cubic-bezier(0.76, 0, 0.24, 1);
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .service-panels-item {
    flex-grow: 1;
    flex-basis: 0;
  }
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .service-panels-item:hover,
  .service-panels-item:focus-within {
    flex-grow: 2;
  }
}

.service-panels-item__link {
  position: relative;
  display: block;
  height: 72vh;
  min-height: 460px;
  max-height: 640px;
  color: var(--offwhite);
  text-decoration: none;
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .service-panels-item__link {
    height: 100%;
    max-height: none;
  }
}

.service-panels-item__link:focus-visible {
  outline-offset: -6px;
}

.service-panels-item__image {
  position: absolute;
  inset: 0;
  margin: 0;
}

.service-panels-item__image::after {
  content: "";
  position: absolute;
  inset: 0;
  /* As strong as the page heroes', so the text clears 4.5:1 over bright skies and white rooms */
  background-image: linear-gradient(to top, rgba(10, 26, 18, 0.92) 0%, rgba(10, 26, 18, 0.76) 36%, rgba(10, 26, 18, 0.54) 52%, rgba(10, 26, 18, 0) 78%);
}

.service-panels-item__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.92);
  transition: filter 900ms ease;
}

.service-panels-item:hover .service-panels-item__image img {
  filter: brightness(1.05);
}

.service-panels-item__content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding-left: 24px;
  padding-right: 24px;
  padding-bottom: 28px;
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .service-panels-item__content {
    width: 520px;
    max-width: 100%;
    padding-left: 32px;
    padding-right: 32px;
    padding-bottom: 36px;
  }
}

.service-panels-item__content h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.035em;
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .service-panels-item__content h3 {
    font-size: 52px;
    margin-bottom: 0;
  }
}

.service-panels-item__content p {
  max-width: 400px;
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: rgba(244, 242, 236, 0.84);
  font-size: 16px;
  line-height: 1.55;
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .service-panels-item__content p {
    max-height: 0;
    margin-bottom: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 900ms cubic-bezier(0.76, 0, 0.24, 1), margin 900ms cubic-bezier(0.76, 0, 0.24, 1), opacity 500ms ease;
  }
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .service-panels-item:hover .service-panels-item__content p,
  .service-panels-item:focus-within .service-panels-item__content p {
    max-height: 140px;
    margin-top: 1.25rem;
    margin-bottom: 1.5rem;
    opacity: 1;
    transition-delay: 0ms, 0ms, 300ms;
  }
}

.service-panels-item__more {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 15px;
  font-weight: 500;
}

/* The arrow drawing is 56 wide with the arrow in its middle, room for it to travel on hover */
.service-panels-item__more svg {
  width: 56px;
  height: 12px;
}

@media (prefers-reduced-motion: no-preference) {
  .service-panels-item:hover .service-panels-item__more svg g {
    animation: arrow-convey 760ms cubic-bezier(0.7, 0, 0.2, 1);
  }
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .service-panels-item__more {
    display: none;
  }
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .service-panels-item:hover .service-panels-item__more,
  .service-panels-item:focus-within .service-panels-item__more {
    display: inline-flex;
  }
}
