/* Home hero: featured pages as floating pictures with a title under each (hand-written).
   Replaces the old text slides. The row sits in the middle of the screen with an arrow on
   each side; 5 cards show at a time (2 on phones) and, when there are more, the row rolls on
   in an endless loop (home-hero-cards.js). The video controls sit at the far right.
   No box around the section. Edit website → Home → Hero slides. */

/* The page's main heading: read by search engines and screen readers, not shown. */
.hero-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hero {
  /* Card width and spacing: 132px and 48px on large screens, a little less on smaller ones
     so all 5 cards always fit beside the arrows and the controls. */
  --hc-w: clamp(94px, 9.2vw, 132px);
  --hc-gap: clamp(20px, 3.3vw, 48px);
  --hc-visible: 5;        /* cards in view at a time */
  --hc-arrow: 40px;
  --hc-pad: 14px;         /* room above the row for the float and below it for the shadow */
  /* The leading card: a see-through white box with the picture, its title beside it and
     a progress line on top. Its title has a fixed width so it wraps onto 2-3 lines. */
  --hc-box-pad: 2px;
  --hc-text: 150px;       /* title width */
  --hc-text-gap: 14px;    /* space between picture and title */
  --hc-line: 4px;         /* progress line thickness */
  --hc-extra: calc(2 * var(--hc-box-pad) + var(--hc-text-gap) + var(--hc-text) + 10px);
}

/* The stage spans the whole screen width, with the row in the middle. */
.hero-inner > .hero-stage {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding-inline: clamp(16px, 2.5vw, 40px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--sp-4);
}
.hero-stage .hero-cards { grid-column: 2; }
/* Video controls: stacked, at the far right, halfway down the hero (on every screen size). */
.hero > .hero-controls {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: clamp(12px, 2.5vw, 40px);
  transform: translateY(-50%);
  flex-direction: column;
  margin: 0;
}

/* Arrows either side of the row, level with the middle of the pictures. */
.hero-cards {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
}
.hero-cards-arrow {
  flex: none;
  width: var(--hc-arrow);
  height: var(--hc-arrow);
  margin-top: calc(var(--hc-w) / 3 - var(--hc-arrow) / 2); /* picture height is 2/3 of its width */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--gray-700);
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.hero-cards-arrow svg { width: 22px; height: 22px; filter: drop-shadow(0 0 2px rgba(255,255,255,0.9)); }
.hero-cards-arrow:hover {
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(6px);
  border-color: rgba(255,255,255,0.75);
  color: #003CA4;
}
/* Kept in place (invisible) when there is only one card, so it stays centred. */
.hero-cards-arrow[hidden] { display: flex; visibility: hidden; }

/* The window onto the row: exactly the cards in view. */
.hero-cards-viewport {
  width: calc(var(--hc-w) * var(--hc-visible) + var(--hc-gap) * (var(--hc-visible) - 1) + var(--hc-extra));
  overflow: hidden;
  padding-block: var(--hc-pad) calc(var(--hc-pad) + 8px);
  margin-block: calc(-1 * var(--hc-pad)) calc(-1 * var(--hc-pad) - 8px);
  touch-action: pan-y;
}
.hero-cards-track {
  display: flex;
  gap: var(--hc-gap);
  will-change: transform;
  transition: transform 0.9s cubic-bezier(0.65, 0, 0.35, 1);
}
.hero-cards:not(.is-rolling) .hero-cards-track { justify-content: center; }
.hero-cards-track.no-anim,
.hero-cards-track.no-anim .hero-card,
.hero-cards-track.no-anim .hero-card-title { transition: none; }

.hero-card {
  position: relative;
  box-sizing: border-box;
  flex: 0 0 var(--hc-w);
  width: var(--hc-w);
  display: flex;
  flex-direction: row;
  align-items: center;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0);
  transition: flex-basis 0.9s cubic-bezier(0.65, 0, 0.35, 1), width 0.9s cubic-bezier(0.65, 0, 0.35, 1),
              padding 0.9s cubic-bezier(0.65, 0, 0.35, 1), background 0.6s ease;
  text-decoration: none;
  color: inherit;
  -webkit-user-drag: none;
  animation: heroSlideIn 0.7s var(--ease-out-quart) both;
  animation-delay: calc(min(var(--i, 0), 3) * 0.12s);
}
.hero-card img { -webkit-user-drag: none; user-select: none; }

/* The picture: square corners, drifting gently up and down (each card out of step).
   The shadow fades in only when pointing at it. */
.hero-card-media {
  position: relative;
  display: block;
  flex: 0 0 var(--hc-w);
  width: var(--hc-w);
  aspect-ratio: 3 / 2;
  overflow: hidden;
  /* Shown only while a card has no picture yet */
  background: linear-gradient(135deg, var(--iso-100, #dbe6f7) 0%, var(--iso-25, #f5f8fd) 100%);
  box-shadow: 0 20px 38px -14px rgba(0, 32, 92, 0), 0 6px 14px -6px rgba(0, 32, 92, 0); /* shadow only on hover */
  animation: heroCardFloat 6s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -2s);
  transition: box-shadow 1s ease;
}
.hero-card-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
/* Optional see-through white layer, to lighten dark pictures (Edit website → Home → Hero slides). */
.hero-card.has-overlay .hero-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
}
@keyframes heroCardFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* The title: hidden on every card except the leading one, where it sits beside the
   picture at a fixed width: regular, black, 3 lines at most, then "…". */
.hero-card-title {
  flex: 0 0 0;
  width: 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  font-family: var(--font-display);
  font-weight: 400;
  font-style: normal;
  font-size: 14px;
  line-height: 1.35;
  color: var(--gray-900);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  transition: opacity 0.4s ease, color 0.5s ease, visibility 0s linear 0.4s;
}

/* The leading card: white see-through box, 2px around the picture, title beside it. */
.hero-card.is-lead {
  flex-basis: calc(var(--hc-w) + var(--hc-extra) - 10px);
  width: calc(var(--hc-w) + var(--hc-extra) - 10px);
  padding: var(--hc-box-pad);
  background: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 28px -14px rgba(0, 32, 92, 0.28);
}
.hero-card.is-lead .hero-card-media { animation: none; }
.hero-card.is-lead .hero-card-title {
  flex-basis: var(--hc-text);
  width: var(--hc-text);
  margin-left: var(--hc-text-gap);
  margin-right: 6px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease 0.5s, color 0.5s ease, visibility 0s;
}

/* Pictures without a title beside them: pointing at one covers it with white, so the
   picture is barely seen, and shows its title on top. Not on the leading box. */
.hero-card-hover {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.88);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.hero-card-hover > span {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
  color: #003CA4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.hero-card:not(.is-lead):hover .hero-card-hover,
.hero-card:not(.is-lead):focus-visible .hero-card-hover { opacity: 1; }
@media (hover: none) { .hero-card-hover { display: none; } }

/* Thick dark-blue progress line along the top of the box; when full, the row moves on. */
.hero-card-progress {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  height: var(--hc-line);
  width: 100%;
  background: #003CA4;
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
  opacity: 0;
}
.hero-card.is-lead .hero-card-progress {
  opacity: 1;
  animation: heroCardProgress var(--hc-step, 5000ms) linear forwards;
  animation-delay: var(--hc-delay, 0ms);
}
.hero-cards.is-paused .hero-card.is-lead .hero-card-progress { animation-play-state: paused; }
@keyframes heroCardProgress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.hero-card:hover .hero-card-title,
.hero-card:focus-visible .hero-card-title { color: #003CA4; }
.hero-card:hover .hero-card-img { transform: scale(1.06); }
.hero-card:hover .hero-card-media {
  box-shadow: 0 20px 38px -14px rgba(0, 32, 92, 0.36), 0 6px 14px -6px rgba(0, 32, 92, 0.16);
}
.hero-card:focus-visible { outline: none; }
.hero-card:focus-visible .hero-card-media { outline: 2px solid var(--iso-500); outline-offset: 3px; }

/* Bars under the row, centred: one per card, only when it rolls. */
.hero-inner > .hero-progress { align-self: center; }
.hero-progress[hidden] { display: none; }

/* Tablets: smaller cards. */
@media (max-width: 900px) {
  .hero { --hc-w: 94px; --hc-gap: 20px; }
}
/* Phones: one card (the leading box) between the arrows. */
@media (max-width: 680px) {
  .hero {
    /* Phones: just the leading box (picture + title) between the arrows. */
    --hc-visible: 1;
    --hc-gap: 20px;
    --hc-arrow: 32px;
    --hc-text: 110px;
    --hc-text-gap: 10px;
    --hc-w: calc(100vw - 32px - 2 * var(--hc-arrow) - 2 * 8px - var(--hc-extra));
  }
  .hero-inner > .hero-stage {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 16px;
    gap: var(--sp-3);
  }
  .hero-stage .hero-cards { grid-column: 1; justify-self: center; gap: 8px; }
  .hero-card-title { font-size: 12.5px; }
  .hero-cards-arrow svg { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-card, .hero-card-media { animation: none; }
  .hero-card, .hero-card-title { transition: none; }
}
