.hai {
  --hai-color-navy: #001B5B;
  --hai-color-light-blue: #0078E3;
  --hai-color-gray: #6f706d;
  --hai-color-rule: #E8EEF4;
  --hai-font-title: 'TT Firs Neue', sans-serif;
  --hai-font-body: 'Space Grotesk', sans-serif;
  /* Side padding of the text block and the footer; shrinks on smaller screens. */
  --hai-pad-x: 24px;

  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  background-color: #ffffff;
  padding: 80px 24px;
}

.hai *,
.hai *::before,
.hai *::after { box-sizing: border-box; }

/* Decorative pale-blue shape peeking from the top-left, behind the content */
.hai__deco {
  position: absolute;
  top: 0;
  left: 0;
  width: 226px;
  height: auto;
  z-index: 0;
  pointer-events: none;
}

.hai__inner {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
}

.hai__title {
  margin: 0 0 73px !important;
  font-family: var(--hai-font-title);
  font-size: 48px !important;
  line-height: 1.15;
  font-weight: 500;
  color: var(--hai-color-navy);
}

.hai__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.hai__col {
  display: flex;
  flex-direction: column;
}

.hai__text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 96px;
  padding: 0 var(--hai-pad-x);
  margin-bottom: 10px;
}

.hai__agent-title {
  margin: 0;
  font-family: var(--hai-font-title);
  font-size: 24px !important;
  font-weight: 500;
  margin-bottom: 0 !important;
  color: var(--hai-color-navy);
}

.hai__desc {
  margin: 0;
  font-family: var(--hai-font-body);
  font-size: 18px !important;
  line-height: 1.55;
  color: var(--hai-color-navy);
  margin-bottom: 0 !important;
}

/* Rule + link, pinned to the bottom so the three cards line up. */
.hai__foot {
  margin-top: auto;
  margin-bottom: 25px;
  padding: 0 var(--hai-pad-x);
}

.hai__rule {
  height: 1px;
  background-color: var(--hai-color-rule);
  margin: 0 0 16px;
}

.hai__link {
  display: inline-block;
  font-family: var(--hai-font-body);
  font-size: 16px;
  font-weight: 600;
  color: var(--hai-color-light-blue);
  text-decoration: none;
  transition: opacity 0.2s;
}

.hai__link:hover { opacity: 0.8; }

.hai__arrow { display: inline-block; transition: transform 0.2s; }
.hai__link:hover .hai__arrow { transform: translateX(3px); }

/* ── Video card ── */

.hai__media {
  position: relative;
  width: 100%;
  aspect-ratio: 7 / 8;
  border-radius: 14px;
  overflow: hidden;
  background-color: var(--hai-color-navy);
}

/* Card without a link: no footer to absorb the slack, so the media takes over. */
.hai__text + .hai__media { margin-top: auto; }

.hai__media--has-poster {
  background-image: var(--hai-poster);
  background-size: cover;
  background-position: center;
}

/* lite_mobile poster: sits under the video (earlier in the DOM) and under the ::after tint. */
.hai__poster {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

/* Subtle tint so the video/poster sits back a little. */
.hai__media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background-color: rgba(6, 12, 29, 0.12);
  pointer-events: none;
}

@media (max-width: 1024px) {
  .hai {
    padding: 64px 24px;
    --hai-pad-x: 16px;
  }
  .hai__grid { gap: 24px; }
  .hai__title { margin-bottom: 40px !important; }
  .hai__agent-title { font-size: 22px !important; }
  .hai__desc { font-size: 17px !important; }
}

@media (max-width: 768px) {
  .hai {
    padding: 48px 20px;
    --hai-pad-x: 0px;
  }
  .hai__grid { grid-template-columns: 1fr; gap: 36px; }
  .hai__title {
    font-size: 2.25rem !important;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 20px !important;
    text-align: left;
  }
  .hai__text { min-height: 0; }
  .hai__agent-title { font-size: 20px !important; }
  .hai__desc { font-size: 16px !important; }
  .hai__link { font-size: 15px; }
  .hai__deco { display: none; }

  /* Drop video on mobile only when the toggle is off: poster background stands in */
  .hai:not(.hai--mobile-video) .hai__video { display: none; }
  /* lite_mobile wins over the mobile video toggle */
  .hai--lite-mobile .hai__video { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hai__video { display: none; }
}

/* ── Optional header subtitle and alignment ── */

.hai--has-intro .hai__title { margin-bottom: 20px !important; }

.hai__intro {
  margin: 0 0 73px !important;
  font-family: var(--hai-font-body);
  font-size: 18px !important;
  line-height: 1.55;
  color: var(--hai-color-navy);
}

/* ── Card layout: title, tagline, divider, description ── */

.hai__head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
  padding: 0 var(--hai-pad-x);
}

.hai__tagline {
  margin: 0 !important;
  font-family: var(--hai-font-body);
  font-size: 20px !important;
  line-height: 1.35;
  color: var(--hai-color-light-blue);
}

.hai__body {
  margin-bottom: 25px;
  padding: 0 var(--hai-pad-x);
}

.hai__body .hai__rule { margin-bottom: 24px; }
.hai__body .hai__link { margin-top: 16px; }

/* Without subgrid the columns stay flex: the media still lines up at the bottom. */
.hai__body + .hai__media { margin-top: auto; }

@media (min-width: 769px) {
  .hai--center .hai__title,
  .hai--center .hai__intro { text-align: center; }
  /* A centered header reads as one long line, so it runs smaller than the 48px default. */
  .hai--center .hai__title { font-size: 40px !important; }

  /* Shared rows, so a two-line tagline moves every divider and description with it. */
  @supports (grid-template-rows: subgrid) {
    .hai--tagline .hai__grid { row-gap: 0; }
    .hai--tagline .hai__col {
      display: grid;
      grid-row: span 3;
      grid-template-rows: subgrid;
    }
    .hai--tagline .hai__col:nth-child(n+4) { margin-top: 36px; }
  }
}

@media (max-width: 1024px) {
  .hai__intro { margin-bottom: 40px !important; }
  .hai__tagline { font-size: 18px !important; }
}

@media (max-width: 768px) {
  .hai--has-intro .hai__title { margin-bottom: 12px !important; }
  .hai__intro {
    margin-bottom: 32px !important;
    font-size: 16px !important;
  }
}

/* picture is only a source switcher: the img keeps filling .hai__media */
.hai__media picture { display: contents; }

/* ── Compact mobile cards (lite_mobile), Figma 3108:82 ──
   Only with the toggle on, so other pages using this module keep their mobile layout.
   Side padding stays at the homepage's 20px (Figma frame uses 40px). The H2 follows the
   Figma (500, 36/37) instead of the homepage mobile h2 standard (700 / 1.3): agreed with
   the client. Space Mono isn't loaded in the theme, so the link uses Space Grotesk 700. */
@media (max-width: 768px) {
  .hai--lite-mobile .hai__title {
    font-size: 36px !important;
    font-weight: 500;
    line-height: 37px;
    letter-spacing: -1.2px;
    margin-bottom: 34px !important;
  }
  .hai--lite-mobile.hai--has-intro .hai__title { margin-bottom: 12px !important; }

  .hai--lite-mobile .hai__grid { gap: 26px; }
  .hai--lite-mobile .hai__col { gap: 8px; }

  .hai--lite-mobile .hai__text,
  .hai--lite-mobile .hai__head {
    gap: 8px;
    margin: 0;
    padding: 0;
  }
  .hai--lite-mobile .hai__foot,
  .hai--lite-mobile .hai__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
  }
  .hai--lite-mobile .hai__rule,
  .hai--lite-mobile .hai__body .hai__rule { margin: 0; }
  .hai--lite-mobile .hai__body .hai__link { margin-top: 0; }

  .hai--lite-mobile .hai__agent-title {
    font-size: 20px !important;
    line-height: 24.75px;
  }
  .hai--lite-mobile .hai__desc {
    font-size: 14px !important;
    line-height: 16px;
  }
  .hai--lite-mobile .hai__link {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    line-height: 19.5px;
  }

  .hai--lite-mobile .hai__media {
    margin-top: 0;
    aspect-ratio: 322 / 146;
    border: 1px solid #E0E8F0;
    border-radius: 16px;
    box-shadow: 0 2px 12px -2px rgba(10, 37, 64, 0.06), 0 1px 4px -1px rgba(0, 0, 0, 0.04);
  }
  .hai--lite-mobile .hai__media::after { display: none; }
}
