/* Homepage sections use normal document flow instead of forced full-screen slides. */
.reference-home .ref-stats > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  column-gap: 24px;
  align-content: center;
}
.reference-home .ref-stats strong { grid-column: 1; grid-row: 1; }
.reference-home .ref-stats p { grid-column: 1; grid-row: 2; }
.ref-stat-icon {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  width: 76px;
  height: 76px;
  color: var(--accent);
}
.ref-stat-accent { stroke: var(--orange); }
.ref-stats > [role="button"] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ref-stats > [role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.ref-stats > div:is(:focus-visible, .is-stat-active) { background: #f3f8fb; }
.ref-stats > div:is(:focus-visible, .is-stat-active)::after { transform: scaleX(1); }
.ref-stat-icon [data-stat-hand] { transform-origin: 44px 44px; }
.ref-stat-icon [data-stat-door] { transform-origin: 32px 27px; }
@media (prefers-reduced-motion: no-preference) {
  .ref-stat-icon { transition: transform 320ms cubic-bezier(.22, 1, .36, 1); }
  .ref-stats > div:is(:focus-visible, .is-stat-active) .ref-stat-icon { transform: translateY(-3px) scale(1.08); }
}
@media (max-width: 1100px) {
  .reference-home .ref-stats > div { grid-template-columns: minmax(0, 1fr); }
  .reference-home .ref-stats strong { grid-row: 2; }
  .reference-home .ref-stats p { grid-row: 3; }
  .ref-stat-icon { grid-column: 1; grid-row: 1; width: 56px; height: 56px; margin-bottom: 20px; }
}
@media (max-width: 600px) {
  .reference-home .ref-stats > div { padding: 16px 0; }
  .ref-stat-icon { width: 44px; height: 44px; margin-bottom: 16px; }
}

html:has(.reference-home) {
  scroll-snap-type: none !important;
}

/* Keep the homepage product grid on the same content rail as the other homepage sections. */
.reference-home > .ref-products {
  width: min(calc(100% - 2 * var(--page-gutter)), var(--shell));
  margin-inline: auto;
}

.reference-home .ref-product:hover .ref-product-copy,
.reference-home .ref-product:hover .ref-product-media img {
  transform: none;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .reference-home .ref-product .ref-product-media img,
  .reference-home .ref-product:hover .ref-product-media img {
    transform: perspective(900px) translate3d(var(--home-product-x, 0px), var(--home-product-y, 0px), 0) rotateX(var(--home-product-rx, 0deg)) rotateY(var(--home-product-ry, 0deg));
    transition: transform 450ms cubic-bezier(.22, 1, .36, 1);
  }

  .reference-home .ref-product .ref-product-media.is-pointer-active img {
    transition-duration: 220ms;
    will-change: transform;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reference-home .ref-product .ref-product-media img {
    transform: none;
    transition: none;
  }
}

.reference-home > .ref-clients {
  padding-block: 120px;
  background: #fff;
}

.reference-home .ref-clients-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 34px;
}

.reference-home .ref-clients-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 44px;
  line-height: 1.35;
  font-weight: 400;
}

.reference-home .ref-clients-heading > p {
  max-width: 460px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.9;
  text-align: right;
}

.ref-client-viewport {
  overflow: hidden;
  scrollbar-width: none;
  outline: none;
}

.ref-client-viewport::-webkit-scrollbar { display: none; }

.ref-client-viewport:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

.ref-client-track {
  display: flex;
  gap: clamp(32px, 4vw, 58px);
  width: max-content;
  padding-block: 18px 20px;
  will-change: transform;
}

.ref-client-slide {
  display: flex;
  flex: 0 0 clamp(190px, 18vw, 240px);
  min-width: 0;
  min-height: 158px;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  color: var(--ink);
  text-align: center;
}

.ref-client-logo {
  display: grid;
  width: 100%;
  height: 112px;
  place-items: center;
}

.ref-client-logo img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 112px;
  object-fit: contain;
}

.ref-client-logo img[src$="/keyfield-hd.png"] {
  max-width: 112px;
}

.ref-client-slide strong {
  display: block;
  max-width: 100%;
  color: #284554;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .reference-home > .ref-clients { padding-block: 76px; }
  .reference-home .ref-clients-heading { display: block; margin-bottom: 24px; }
  .reference-home .ref-clients-heading h2 { font-size: 30px; }
  .reference-home .ref-clients-heading > p { margin-top: 14px; text-align: left; font-size: 14px; }
  .ref-client-track { gap: 28px; }
  .ref-client-slide { flex-basis: 170px; min-height: 136px; }
  .ref-client-logo { height: 92px; }
  .ref-client-logo img { max-height: 92px; }
  .ref-client-logo img[src$="/keyfield-hd.png"] { max-width: 92px; }
  .ref-client-slide strong { font-size: 12px; }
}

/* One heading scale for all homepage sections, independent of content layout. */
.reference-home .ref-section-heading {
  display: block;
  min-width: 0;
  margin-top: 0;
  margin-bottom: 34px;
  color: var(--ink);
  text-align: left;
  letter-spacing: 0;
}

.reference-home .ref-section-heading .ref-kicker {
  margin: 0 0 20px;
  color: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
}

.reference-home .ref-section-heading h2 {
  margin: 0;
  color: inherit;
  font-size: 44px;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0;
}

.reference-home .ref-products-heading {
  grid-column: 1 / -1;
  margin: 0;
  padding-block: 80px 34px;
  padding-inline: max(var(--page-gutter), calc((100% - var(--shell)) / 2));
  background: #fff;
}

.reference-home .ref-news-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0 24px;
  color: #fff;
}

.reference-home .ref-news-heading .ref-kicker {
  grid-column: 1 / -1;
  grid-row: 1;
}

.reference-home .ref-news-heading h2 {
  grid-column: 1;
  grid-row: 2;
}

.reference-home .ref-section-subtitle {
  margin: 0 0 20px;
  color: var(--ink);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
}

.reference-home .ref-section-subtitle strong {
  color: var(--accent);
  font-weight: 500;
}

.ref-news-action {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 600px) {
  .reference-home .ref-section-heading { margin-bottom: 24px; }
  .reference-home .ref-section-heading .ref-kicker { margin-bottom: 16px; font-size: 11px; }
  .reference-home .ref-section-heading h2 { font-size: 30px; }
  .reference-home .ref-products-heading { margin-bottom: 0; padding-block: 52px 24px; }
  .reference-home .ref-section-subtitle { font-size: 22px; }
  .reference-home .ref-news-heading { column-gap: 16px; }
  .ref-news-action .ref-more { width: 136px; height: 44px; gap: 10px; white-space: nowrap; }
  .ref-news-action .ref-more > i { width: 34px; height: 34px; font-size: 20px; }
}

@media (min-width: 981px) {
  .reference-home > .ref-hero {
    height: calc(100dvh - var(--header-height));
    max-height: none;
    min-height: 0;
  }

  .reference-home .ref-hero-media { background: none; }
  .reference-home .ref-hero-media img { object-fit: cover; object-position: center bottom; mask-image: none; }

  .reference-home > .ref-screen {
    scroll-margin-top: 0;
  }

  .reference-home > .ref-products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
    min-height: 0;
    grid-template-rows: none;
  }

  .reference-home .ref-product,
  .reference-home .ref-product:nth-child(2),
  .reference-home .ref-product:nth-child(3) {
    grid-column: auto;
    grid-template-columns: minmax(0, 44%) minmax(0, 56%);
    min-height: 320px;
  }

  .reference-home .ref-product-media {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }

  .reference-home .ref-product-media img {
    height: 290px;
  }

  .reference-home > .ref-about,
  .reference-home > .ref-news {
    display: block;
    min-height: 0;
    padding-block: 80px;
  }

  .reference-home .ref-about-media {
    height: 420px;
  }

  .reference-home .ref-news-image {
    height: 200px;
  }
}

/* Offset row dividers while keeping product copy beside its image. */
@media (min-width: 1200px) {
  .reference-home > .ref-products {
    grid-template-columns: repeat(20, minmax(0, 1fr));
  }

  .reference-home .ref-product:nth-of-type(n) {
    grid-column: span 11;
  }

  .reference-home .ref-product:nth-of-type(2),
  .reference-home .ref-product:nth-of-type(3) {
    grid-column: span 9;
  }
}

@media (min-width: 1600px) {
  .reference-home .ref-product,
  .reference-home .ref-product:nth-child(2),
  .reference-home .ref-product:nth-child(3) {
    min-height: 390px;
  }

  .reference-home .ref-product-media img {
    height: 340px;
    max-width: 460px;
    display: block;
    margin-inline: auto;
  }

  .reference-home .ref-product-copy {
    padding: 36px 24px 36px 40px;
  }

  .reference-home .ref-product-copy h2 {
    font-size: 28px;
  }

  .reference-home .ref-product-copy p {
    max-width: 26em;
    font-size: 16px;
  }
}

@media (max-width: 980px) {
  .reference-home > .ref-products {
    min-height: 0;
  }

  .reference-home .ref-product {
    min-height: 0;
  }

  .reference-home > .ref-about,
  .reference-home > .ref-news {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .reference-home > .ref-hero {
    height: min(540px, calc(100svh - var(--header-height) - var(--contact-bar-height) - 32px));
    min-height: 360px;
    background: #65a9d9;
  }

  .reference-home .ref-hero-media {
    inset: auto 0 0;
    height: 58%;
    mask-image: linear-gradient(to bottom, transparent, #000 24px);
  }

  .reference-home .ref-hero-media img {
    object-position: right bottom;
  }

  .reference-home .ref-hero::after {
    background: none;
  }

  .reference-home .ref-hero-copy {
    justify-content: flex-start;
    padding-top: 24px;
    padding-bottom: 92px;
    color: #103f60;
    text-shadow: none;
  }

  .reference-home .ref-hero-copy > p,
  .reference-home .ref-hero-copy h1,
  .reference-home .ref-hero-copy h2 {
    max-width: 100%;
  }

  .reference-home .ref-hero h1 {
    margin-bottom: 10px;
    font-size: 38px;
    line-height: 1.18;
  }

  .reference-home .ref-hero h2 {
    max-width: 14em;
    font-size: 21px;
    line-height: 1.45;
  }

  .reference-home .ref-hero-copy .ref-hero-en {
    font-size: 12px;
  }

  .reference-home .hero-bottom {
    display: none;
  }
}

@media (max-width: 360px) {
  .reference-home .ref-hero h1 { font-size: 34px; }
  .reference-home .ref-hero h2 { font-size: 19px; }
}

@media (max-width: 980px) and (max-height: 540px) and (orientation: landscape) {
  .reference-home > .ref-hero { height: min(250px, calc(100svh - var(--header-height) - var(--contact-bar-height) - 24px)); min-height: 190px; background: #65a9d9; }
  .reference-home .ref-hero-media { inset: 0; height: 100%; mask-image: none; background: none; }
  .reference-home .ref-hero-media img { object-fit: cover; object-position: center bottom; mask-image: none; }
  .reference-home .ref-hero-copy { padding-block: 14px; }
  .reference-home .ref-hero-copy > p, .reference-home .ref-hero-copy h1, .reference-home .ref-hero-copy h2 { max-width: 48%; }
  .reference-home .ref-hero-copy > p { font-size: 13px; margin-bottom: 8px; }
  .reference-home .ref-hero h1 { font-size: 30px; margin-bottom: 8px; }
  .reference-home .ref-hero h2 { font-size: 18px; margin-bottom: 8px; }
  .reference-home .ref-hero-copy .ref-hero-en { font-size: 11px; }
  .reference-home .hero-bottom { display: none; }
}

.reference-home > .ref-applications {
  padding-block: 88px;
  background: #f7fafc;
}

.ref-applications-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, .95fr);
  gap: clamp(42px, 6vw, 96px);
  align-items: center;
}

.ref-applications-media {
  position: relative;
  min-height: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #dceaf3;
}

.ref-applications-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 42, 68, 0) 42%, rgba(6, 42, 68, .72) 100%);
  pointer-events: none;
}

.ref-applications-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms ease;
}

.ref-applications-media:hover img {
  transform: scale(1.025);
}

.ref-applications-copy {
  min-width: 0;
}

.ref-applications-copy h2 {
  max-width: 12em;
  margin: 0;
  color: var(--ink);
  font-size: 42px;
  line-height: 1.35;
  font-weight: 400;
}

.ref-applications-intro {
  max-width: 42em;
  margin: 20px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.9;
}

.ref-application-groups {
  margin-top: 30px;
  border-top: 1px solid var(--line);
}

.ref-application-group {
  appearance: none;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 18px;
  position: relative;
  padding: 19px 12px;
  transition: background-color 220ms ease;
}

.ref-application-group::before {
  content: "";
  position: absolute;
  inset: 18px auto 18px 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 220ms ease;
}

.ref-application-group.is-active::before { transform: scaleY(1); }

.ref-application-group:hover,
.ref-application-group:focus-visible,
.ref-application-group.is-active {
  background: #fff;
}

.ref-application-group:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.ref-application-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #c9dce8;
  border-radius: 50%;
  background: #fff;
  transition: border-color 220ms ease, background-color 220ms ease, transform 220ms ease;
}

.ref-application-icon img {
  display: block;
  width: 27px;
  height: 27px;
}

.ref-application-group:hover .ref-application-icon,
.ref-application-group:focus-visible .ref-application-icon,
.ref-application-group.is-active .ref-application-icon {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.08);
}

.ref-application-copy {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.ref-application-copy strong {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
}

.ref-application-copy > span {
  display: block;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
}

.ref-applications-copy .ref-more {
  margin-top: 28px;
}

@media (max-width: 980px) {
  .reference-home > .ref-applications {
    padding-block: 64px;
  }

  .ref-applications-layout {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .ref-applications-media {
    aspect-ratio: 16 / 10;
  }

  .ref-applications-copy h2 {
    max-width: 16em;
    font-size: 34px;
  }
}

@media (max-width: 600px) {
  .reference-home > .ref-applications {
    padding-block: 52px;
  }

  .ref-applications-layout {
    gap: 28px;
  }

  .ref-applications-media {
    aspect-ratio: 4 / 3;
  }

  .ref-applications-copy h2 {
    font-size: 28px;
  }

  .ref-applications-intro {
    margin-top: 15px;
    font-size: 14px;
  }

  .ref-application-group {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    padding: 16px 10px;
  }

  .ref-application-icon {
    width: 36px;
    height: 36px;
  }

  .ref-application-icon img {
    width: 24px;
    height: 24px;
  }

  .ref-application-copy strong {
    font-size: 16px;
  }

  .ref-application-copy > span {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ref-applications-media img,
  .ref-application-group,
  .ref-application-group::before,
  .ref-application-icon {
    transition: none;
  }

  .ref-applications-media:hover img,
  .ref-application-group .ref-application-icon { transform: none; }
}
