/* ==========================================================================
   Home page sections (front-page.php). Loaded on the front page only.
   Tokens (colours, type sizes, radii) come from style.css.

   Desktop numbers = Figma "Home_page-v3" (1440).
   Mobile numbers  = Figma "Homepage_responsive" (402), see the 600px block.
   ========================================================================== */

/* Hero (Figma "Banner", 1440 x 862) ---------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: clamp(600px, 100svh, 862px);
  padding-bottom: 84px;
  overflow: hidden;
  background: var(--color-text);
  color: var(--color-white);
}
.hero__bg { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--color-hero-overlay); } /* Figma: #000 at 75% */
.hero__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  padding-top: 40px;
  border-top: 1px solid rgba(32, 169, 146, .4); /* Figma: 0.4px primary line */
}
.hero__title { max-width: 897px; font-size: var(--fs-display); font-weight: 700; line-height: var(--lh-display); }
.hero__aside { flex: 0 0 370px; }
.hero__text { min-height: 84px; margin-bottom: 20px; }

/* Solutions (Figma 1440 x 816, incl. the white header area) ---------------- */
.solutions { padding: 194px 0 116px; }
.solutions__grid {
  display: grid;
  grid-template-columns: minmax(0, 435fr) minmax(0, 789fr);
  column-gap: 96px;
  align-items: start;
}
.solutions__intro .section-title { margin-bottom: 50px; }
.solutions__tabs { position: relative; display: flex; flex-direction: column; width: 298px; max-width: 100%; }
.solutions__tab {
  padding: 17px 0 18px; /* 60px per row incl. the 1px line, as in Figma */
  border: 0;
  border-bottom: 1px solid var(--color-line);
  background: none;
  font-size: var(--fs-lead);
  line-height: 24px;
  text-align: left;
  color: var(--color-muted);
  cursor: pointer;
  position: relative;
  transition: color .5s var(--ease-soft);
}
.solutions__tab:first-child { padding-top: 0; }
.solutions__tab:hover,
.solutions__tab.is-active { color: var(--color-text); }
/* Active tab: the teal line draws in over the grey one */
.solutions__tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .8s var(--ease-soft);
}
.solutions__tab.is-active::after { transform: scaleX(1); }

/* Panels share one grid cell, so the card keeps the tallest panel's height
   and switching never makes the page jump. Same for the products slider.

   Slide change (here and in Products), slow and soft:
   - the new photo fades in over the old one, which stays put underneath
     (so the green never flashes through), and eases out of a slight zoom;
   - the old text fades out first, then the new text fades in and rises 8px.
   Only opacity and transform move, and only while a slide changes. */
.solutions__panels { display: grid; border-radius: var(--radius-panel); background: var(--color-primary); } /* the green stays put while the cards swap */
.solution-card {
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: minmax(0, 386fr) minmax(0, 339fr);
  column-gap: 30px;
  min-height: 432px;
  padding: 4px 30px 4px 4px;
  border-radius: var(--radius-panel);
  color: var(--color-white);
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s 1s; /* hidden once the new card has faded in */
}
.solution-card.is-active { z-index: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.solution-card__media { opacity: 0; transition: opacity 0s 1s; }
.solution-card__media img { transform: scale(1.04); transition: transform 0s 1s; }
.solution-card__body { opacity: 0; transform: translateY(8px); transition: opacity .4s var(--ease-soft), transform 0s .4s; }
.solution-card.is-active .solution-card__media { opacity: 1; transition: opacity 1s var(--ease-soft); }
.solution-card.is-active .solution-card__media img { transform: none; transition: transform 1.8s var(--ease-soft); }
.solution-card.is-active .solution-card__body { opacity: 1; transform: none; transition: opacity .8s var(--ease-soft) .35s, transform .8s var(--ease-soft) .35s; }
.solution-card :focus-visible { outline-color: var(--color-white); }
.solution-card__media { position: relative; overflow: hidden; border-radius: var(--radius-card); }
/* Absolute so a tall photo can't stretch the card; the card sets the height. */
.solution-card__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.solution-card__body { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 26px 0; }
.solution-card__title { max-width: 198px; margin-bottom: 18px; font-size: var(--fs-card); font-weight: 600; line-height: var(--lh-card); }
.solution-card__text { margin-bottom: 18px; font-size: var(--fs-text); line-height: var(--lh-text-loose); }
.solutions__main .slider-arrows { margin-top: 30px; }

/* Below-grade card: two-image crossfade slideshow ----------------------- */
/* Both images sit in the same absolute-positioned stack. The second image
   starts transparent and fades in after 3 s, then back out at 6 s, looping
   every 6 s total — giving each image equal screen time. */
.solution-card__media--slideshow img:nth-child(2) {
  animation: gs-crossfade 6s ease-in-out 3s infinite;
}
@keyframes gs-crossfade {
  0%,  100% { opacity: 0; }
  16.67%     { opacity: 1; } /* fade in over ~1 s  */
  50%        { opacity: 1; } /* hold for ~2 s      */
  66.67%     { opacity: 0; } /* fade out over ~1 s */
}
/* Pause when the card is not visible (tab not active) */
.solution-card:not(.is-active) .solution-card__media--slideshow img:nth-child(2) {
  animation-play-state: paused;
}

/* Products (Figma card 1400 x 792, overlaps the section above by 16px) ---- */
.products { position: relative; z-index: 1; margin-top: -16px; padding: 0 20px; }
.products__card {
  --products-angle: 187.72deg;
  max-width: 1400px;
  margin: 0 auto;
  padding: 80px 40px 100px;
  border-radius: var(--radius-panel);
  background: linear-gradient(var(--products-angle), var(--color-grey) 41.099%, var(--color-primary) 241.89%);
}
.products__title { max-width: 577px; margin-bottom: 50px; }
.products__slider {
  display: grid;
  grid-template-columns: minmax(0, 750fr) minmax(0, 510fr);
  column-gap: 60px;
  align-items: center;
}
.products__media,
.products__slides { display: grid; }
.products__image { overflow: hidden; aspect-ratio: 750 / 420; border-radius: var(--radius-card); }
/* 16% from the top = the Figma crop of the (portrait) product photo */
.products__image img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 16%; }
.products__image--centred img { object-position: 50% 50%; } /* "Listing photo" (same as the product listing) */
.products__image,
.product-slide { grid-area: 1 / 1; opacity: 0; visibility: hidden; }
/* Same slide change as the Solutions card (see the note there) */
.products__image { transition: opacity 0s 1s, visibility 0s 1s; }
.products__image img { transform: scale(1.04); transition: transform 0s 1s; }
.product-slide { transform: translateY(8px); transition: opacity .4s var(--ease-soft), visibility 0s .4s, transform 0s .4s; }
.products__image.is-active { z-index: 1; opacity: 1; visibility: visible; transition: opacity 1s var(--ease-soft), visibility 0s; }
.products__image.is-active img { transform: none; transition: transform 1.8s var(--ease-soft); }
.product-slide.is-active { opacity: 1; visibility: visible; transform: none; transition: opacity .8s var(--ease-soft) .35s, visibility 0s .35s, transform .8s var(--ease-soft) .35s; }
.product-slide { display: flex; flex-direction: column; align-items: flex-start; }
.product-slide__title { margin-bottom: 20px; font-size: var(--fs-h3); line-height: var(--lh-h3); color: var(--color-primary); }
.product-slide__text { margin-bottom: 20px; font-size: var(--fs-text); line-height: var(--lh-text); }
.products__controls { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 40px; }

/* Numbered lines 01 02 03... (Figma "Group 4") */
.pager { display: flex; gap: 13.5px; }
.pager__item {
  position: relative;
  width: 47.2px;
  padding: 9px 0 0 14px;
  border: 0;
  background: none;
  font-size: 16px;
  font-weight: 300;
  line-height: 18px;
  text-align: left;
  color: var(--color-white);
  cursor: pointer;
  transition: color .5s var(--ease-soft);
}
.pager__item::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; border-radius: 2px; background: var(--color-white); transition: background-color .2s; }
.pager__item:hover::before { background: rgba(32, 169, 146, .5); }
.pager__item.is-active { color: var(--color-text); }
/* Active line fills with teal from the left */
.pager__item::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; border-radius: 2px; background: var(--color-primary); transform: scaleX(0); transform-origin: left; transition: transform .8s var(--ease-soft); }
.pager__item.is-active::after { transform: scaleX(1); }

/* About (Figma "Banner" 1440 x 740, video mirrored) ------------------------ */
.about { position: relative; isolation: isolate; overflow: hidden; padding: 200px 0; text-align: center; }
.about__bg { position: absolute; inset: 0; z-index: -3; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
/* The two white fades are 1440px-wide boxes in Figma, centred. On narrow
   screens only their middle shows, so they keep a 1440 minimum width. */
.about::before,
.about::after { content: ""; position: absolute; top: 0; left: 50%; width: max(100%, 1440px); transform: translateX(-50%); pointer-events: none; }
.about::before {
  z-index: -2;
  height: max(100%, 740px);
  opacity: .9;
  background: linear-gradient(116.7deg, var(--color-white) 10.016%, rgba(255, 255, 255, .771) 34.895%, rgba(255, 255, 255, .662) 49.522%, rgba(255, 255, 255, .559) 65.051%, rgba(255, 255, 255, 0) 86.382%);
}
.about::after { z-index: -1; height: 356px; background: linear-gradient(180.38deg, var(--color-white) 8.703%, rgba(255, 255, 255, .771) 27.205%, rgba(255, 255, 255, 0) 102.02%); }
.about__title { max-width: 545px; margin: 0 auto 20px; }
.about__text { max-width: 819px; margin: 0 auto 30px; font-size: var(--fs-text); line-height: var(--lh-text); }

/* Benefits (Figma 1440 x 687, dark) ---------------------------------------- */
.benefits { padding: 120px 0; background: var(--color-text); color: var(--color-grey); }
.benefits__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 40px; margin-bottom: 50px; }
.benefits__title { max-width: 361px; }
.benefits__text { max-width: 307px; margin-top: 34px; font-size: var(--fs-text); line-height: var(--lh-text-loose); }
.benefits__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; }
.benefit-card {
  --benefit-border: 2.4px;
  --benefit-angle: 146.5deg;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 35px;
  min-height: 255px;
  padding: calc(40px - var(--benefit-border)) 20px;
  border: var(--benefit-border) solid transparent;
  border-radius: var(--radius-card);
  /* Gradient border: inner fill + gradient behind it (Figma "Subtract" stroke) */
  background:
    linear-gradient(var(--color-text), var(--color-text)) padding-box,
    linear-gradient(var(--benefit-angle), var(--color-primary) 6.4%, var(--color-primary-darkest) 108.6%) border-box;
  text-align: center;
}
.benefit-card__icon { width: auto; height: 80px; }
.benefit-card__text { max-width: 211px; font-size: var(--fs-lead); line-height: var(--lh-lead); }

/* Resources + contact banner (Figma 1440 x 988 incl. banner) ---------------- */
.resources { padding: 120px 0 80px; }
.resources--cta-only { padding-top: 80px; } /* no cards yet: banner only, even spacing */
.resources__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 50px; }
.resources__title { max-width: 281px; }
.resources__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 0 0 50px; padding: 0; list-style: none; }
.resource-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: 100%;
  min-height: 304px;
  padding: 20px;
  border-radius: var(--radius-card);
  background: var(--color-grey);
  transition: box-shadow .6s var(--ease-soft), transform .6s var(--ease-soft);
}
.resource-card:hover { box-shadow: 0 12px 32px rgba(45, 45, 45, .08); }
.resource-card .tag { margin-bottom: 30px; }
.resource-card__title { flex: 1; margin-bottom: 27px; font-size: var(--fs-lead); line-height: var(--lh-lead); }
.resource-card__link { color: var(--color-text); transition: color .5s var(--ease-soft); }
.resource-card__link:hover { color: var(--color-primary); text-decoration: none; }
.resource-card__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* whole card clickable */
.resource-card__link:focus-visible { outline: 0; }
.resource-card__link:focus-visible::after { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.resource-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-top: 20px;
  border-top: 1px solid var(--color-line-card);
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
}
/* Hover, slow and soft: the divider turns teal from the left and the arrow
   eases right. On desktop the card also lifts (the tablet row scrolls
   sideways and would clip it). */
.resource-card__footer { position: relative; }
.resource-card__footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .8s var(--ease-soft);
}
.resource-card .arrow-icon { transition: transform .6s var(--ease-soft); }
@media (hover: hover) {
  .resource-card:hover .resource-card__footer::before { transform: scaleX(1); }
  .resource-card:hover .arrow-icon { transform: rotate(90deg) translateY(-4px); }
}
@media (hover: hover) and (min-width: 1025px) {
  .resource-card:hover { transform: translateY(-4px); }
}

/* .cta (green panel) lives in style.css: shared with the About page. */

/* Responsive --------------------------------------------------------------- */
@media (max-width: 1280px) {
  .solutions__grid { column-gap: 56px; }
  .products__slider { column-gap: 40px; }
}

/* Tablet: stacked layouts, tabs and resource cards scroll sideways */
@media (max-width: 1024px) {
  .hero { min-height: 640px; }

  .solutions { padding: 140px 0 80px; }
  .solutions__grid { grid-template-columns: minmax(0, 1fr); row-gap: 32px; }
  .solutions__intro .section-title { margin-bottom: 32px; }
  .solutions__tabs { flex-direction: row; gap: 28px; width: auto; overflow-x: auto; scrollbar-width: none; }
  .solutions__tabs::-webkit-scrollbar { display: none; }
  .solutions__tab,
  .solutions__tab:first-child { flex-shrink: 0; padding: 0 0 14px; white-space: nowrap; }

  .products { padding: 0 16px; }
  .products__card { padding: 64px 24px 72px; }
  .products__slider { grid-template-columns: minmax(0, 1fr); row-gap: 32px; }

  .about { padding: 140px 0; }

  .benefits { padding: 80px 0; }
  .benefits__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .resources { padding: 80px 0 64px; }
  .resources__grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(300px, 46%);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    margin-right: calc(var(--gutter) * -1);
    padding-right: var(--gutter);
  }
  .resources__grid::-webkit-scrollbar { display: none; }
  .resources__grid > li { scroll-snap-align: start; }
}

@media (max-width: 860px) {
  .hero__row { flex-direction: column; gap: 24px; padding-top: 28px; }
  .hero__aside { flex-basis: auto; }
  .hero__text { min-height: 0; }

  .solution-card { grid-template-columns: minmax(0, 1fr); min-height: 0; padding: 4px; }
  .solution-card__media { aspect-ratio: 4 / 3; }
  .solution-card__body { justify-content: flex-start; padding: 20px 20px 24px; }
  .solution-card__title { max-width: none; }

  .benefits__head { flex-direction: column; gap: 16px; margin-bottom: 40px; }
  .benefits__text { max-width: none; margin-top: 0; }

  .resources__head { flex-direction: column; align-items: flex-start; margin-bottom: 32px; }
  .resources__grid { margin-bottom: 40px; }
}

/* Mobile: Figma "Homepage_responsive" (402 wide, 16px gutters) */
@media (max-width: 600px) {
  /* Hero 402 x 469, no divider line */
  .hero { min-height: 469px; padding-bottom: 40px; }
  .hero__row { gap: 10px; padding-top: 0; border-top: 0; }
  .hero__title { max-width: 328px; }

  /* Solutions: no tabs, arrows centred under the card */
  .solutions { padding: 50px 0; }
  .solutions .eyebrow,
  .products .eyebrow { margin-bottom: 6px; }
  .solutions__grid { row-gap: 30px; }
  .solutions__intro .section-title { max-width: 237px; margin-bottom: 0; }
  .solutions__tabs { display: none; }
  .solution-card { padding: 6px; }
  .solution-card__media { aspect-ratio: 358 / 368; }
  .solution-card__body { gap: 15px; padding: 20px 14px 14px; }
  .solution-card__title,
  .solution-card__text { margin-bottom: 15px; }
  .solutions__main .slider-arrows { justify-content: center; margin-top: 20px; }

  /* Products card 370 x 738 */
  .products { padding: 0 var(--gutter); margin-top: 0; }
  .products__card { --products-angle: 205.55deg; padding: 50px 16px; }
  .products__title { max-width: 243px; margin-bottom: 30px; }
  .products__slider { row-gap: 20px; }
  .products__image { aspect-ratio: 338 / 208; }
  .product-slide__title { margin-bottom: 10px; }
  .products__controls { flex-direction: column; align-items: stretch; gap: 30px; margin-top: 30px; }
  .pager { justify-content: space-between; gap: 0; }
  .pager__item { padding-top: 8px; font-size: 14px; font-weight: 400; line-height: 14px; }
  .products__controls .slider-arrows { justify-content: center; }

  /* About 402 x 600 */
  .about { min-height: 600px; padding: 90px 0; }
  .about__title { max-width: none; margin-bottom: 10px; }
  .about__text { margin-bottom: 20px; }

  /* Benefits 402 x 640, 2 x 2 cards of 175 x 188 */
  .benefits { padding: 50px 0; }
  .benefits__head { gap: 10px; margin-bottom: 30px; }
  .benefits__title { max-width: none; }
  .benefits__grid { gap: 20px; }
  .benefit-card { --benefit-border: 2px; --benefit-angle: 138.7deg; gap: 16px; min-height: 188px; padding: calc(20px - var(--benefit-border)) 14px; }
  .benefit-card__icon { height: 60px; }
  .benefit-card__text { max-width: 143px; }

  /* Resources: cards stacked */
  .resources { padding: 50px 0; }
  .resources__head { gap: 20px; margin-bottom: 30px; }
  .resources__title { max-width: none; }
  .resources__grid {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
    margin: 0 0 50px;
    padding: 0;
  }
  .resource-card { min-height: 212px; padding: 16px; }
  .resource-card .tag { margin-bottom: 20px; }
  .resource-card__title { margin-bottom: 19px; } /* + 1px divider = Figma 212px card */
  .resource-card__footer { padding-top: 12px; }
  .resource-card__footer .arrow-icon { width: 30px; height: 30px; }

}
