/* ==========================================================================
   Hero carousel — cinematic editorial (single-focus, no gradients)
   ========================================================================== */

.hero-carousel {
  --hero-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --hero-content-pad: 1.25rem;
  width: 100%;
}

/* Reserve the fixed header height before the homepage hero. */
#heroCarousel {
  margin-top: calc(var(--header-offset) + var(--space-6));
}

@media (max-width: 639px) {
  .hero-carousel .gg-shell {
    padding-inline: 0;
  }

  .hero-carousel .carousel-slide-card {
    border-inline: 0;
  }
}

@media (min-width: 640px) {
  .hero-carousel {
    --hero-content-pad: 1.75rem;
  }
}

@media (min-width: 1024px) {
  .hero-carousel {
    --hero-content-pad: clamp(1.75rem, 4vw, 3rem);
  }
}

.hero-carousel-viewport {
  --page-gutter: var(--hero-content-pad);
  --carousel-slide-width: 100%;
  --carousel-gap: 0;
  --carousel-media-height: 56.25cqi;
  position: relative;
  overflow: hidden;
  width: 100%;
  container-type: inline-size;
}

.hero-carousel-track {
  display: flex;
  /* Stretch to the tallest slide so changing slides never resizes the hero. */
  align-items: stretch;
  gap: var(--carousel-gap);
  transition: transform 0.7s var(--hero-ease);
  will-change: transform;
}

.hero-carousel .carousel-slide {
  display: flex;
  flex: 0 0 var(--carousel-slide-width);
  min-width: 0;
  opacity: 0;
  transition: opacity 0.55s var(--hero-ease);
  pointer-events: none;
}

.hero-carousel .carousel-slide.is-active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

.carousel-slide-card {
  display: flex;
  flex-direction: row;
  width: 100%;
  /* flex: 1 1 auto; */
  min-height: 0;
  overflow: hidden;
  background: rgb(var(--color-surface));
  border: 1px solid rgb(var(--color-border));
}

.hero-slide-media {
  display: block;
  position: relative;
  overflow: hidden;
  /* width: 100%; */
  flex: 1 1 66.666%;
  aspect-ratio: 16 / 9;
  /* height: var(--carousel-media-height); */
  background: rgb(var(--color-bg));
  isolation: isolate;
}

.hero-slide-media::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: 3px;
  height: auto;
  background: rgb(var(--color-brand));
  z-index: 1;
}

.hero-slide-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s var(--hero-ease);
}

.hero-carousel .carousel-slide.is-active .hero-slide-media:hover img {
  transform: scale(1.025);
}

.hero-slide-media.is-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(var(--color-surface));
}

.hero-slide-media.is-fallback img {
  width: min(48%, 280px);
  height: auto;
  max-height: 55%;
  object-fit: contain;
  opacity: 0.28;
}

.hero-slide-content {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  /* flex: 1 1 auto; */
  gap: 0.85rem;
  flex: 0 0 35%;
  width: auto;
  max-width: 35%;
  box-sizing: border-box;
  padding: 1.35rem var(--hero-content-pad) 1.5rem;
  background: rgb(var(--color-surface));
  color: rgb(var(--color-ink));
  border-top: 1px solid rgb(var(--color-border));
  overflow: hidden;
  isolation: isolate;
}

/* Light: pure white band (surface token is ice/neutral-100). */
.light-mode .hero-slide-content {
  background: #fff;
}

/*
 * Hero content-band pattern — Steve Schoger / Hero Patterns “Hexagons”
 * (tessellating pointy-top honeycomb). Brand fill + SVG mask (not CSS var —
 * var(url()) is unreliable for mask-image). Flat surface; ~23° fade on
 * __sweep (full-bleed); mesh tilts −9° on an oversized layer. Tile 28×49.
 * https://heropatterns.com/ · https://github.com/lowmess/hero-patterns
 */
.hero-slide-tramage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/*
 * Full-bleed sweep + ~23° fade (no element rotation).
 * Rotating a finite box around BR left a hard clip through the top-right;
 * an angled mask on inset:0 keeps the pattern continuous to the right edge
 * (under the tags) while softening toward the copy on the left.
 */
.hero-slide-tramage__sweep {
  position: absolute;
  inset: 0;
  transform: none;
  -webkit-mask-image: linear-gradient(
    113deg,
    transparent 0%,
    transparent 26%,
    rgb(255 255 255 / 0.2) 48%,
    rgb(255 255 255 / 0.55) 64%,
    #fff 78%,
    #fff 100%
  );
  mask-image: linear-gradient(
    113deg,
    transparent 0%,
    transparent 26%,
    rgb(255 255 255 / 0.2) 48%,
    rgb(255 255 255 / 0.55) 64%,
    #fff 78%,
    #fff 100%
  );
}

/*
 * Pattern mesh only — slight tilt for style. Oversized + centered so
 * rotate() doesn’t leave empty corners; fade stays on full-bleed __sweep.
 */
.hero-slide-tramage__mesh {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 160%;
  height: 220%;
  pointer-events: none;
  background-color: rgb(var(--color-brand));
  opacity: 0.145;
  transform: translate(-50%, -50%) rotate(-9deg);
  transform-origin: center center;
  -webkit-mask-repeat: repeat;
  mask-repeat: repeat;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cpath fill='%23fff' fill-rule='nonzero' d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/svg%3E");
  -webkit-mask-size: 28px 49px;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cpath fill='%23fff' fill-rule='nonzero' d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/svg%3E");
  mask-size: 28px 49px;
}

.light-mode .hero-slide-tramage__mesh {
  opacity: 0.11;
}

@media (max-width: 639px) {
  .hero-slide-tramage__sweep {
    -webkit-mask-image: linear-gradient(
      113deg,
      transparent 0%,
      transparent 18%,
      rgb(255 255 255 / 0.18) 40%,
      rgb(255 255 255 / 0.5) 58%,
      #fff 74%,
      #fff 100%
    );
    mask-image: linear-gradient(
      113deg,
      transparent 0%,
      transparent 18%,
      rgb(255 255 255 / 0.18) 40%,
      rgb(255 255 255 / 0.5) 58%,
      #fff 74%,
      #fff 100%
    );
  }

  .hero-slide-tramage__mesh {
    opacity: 0.1;
  }
}

.hero-slide-content > *:not(.hero-slide-tramage) {
  position: relative;
  z-index: 1;
}

@media (min-width: 768px) {
  .hero-slide-content {
    gap: 1rem;
    padding-block: 1.75rem 2rem;
  }
}

@media (min-width: 1024px) {
  .hero-slide-content {
    padding-block: 2rem 2.25rem;
  }
}

.hero-carousel .carousel-slide.is-active .hero-slide-content {
  animation: hero-content-in 0.55s var(--hero-ease) both;
}

.hero-slide-counter {
  position: absolute;
  bottom: 1rem;
  left: 2rem;
  z-index: 20;
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  min-width: 5.5rem;
  padding: 0.65rem 0.8rem;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  background: rgb(5 10 17 / 0.78);
}

.hero-slide-counter strong {
  color: rgb(var(--palette-blue-400));
  font-size: 1.15rem;
}

.hero-slide-topline {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
}

.hero-slide-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  color: rgb(var(--color-brand));
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
  background: rgb(var(--color-brand) / 0.12);
  border: 1px solid rgb(var(--color-brand) / 0.35);
}

.hero-slide-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  min-width: 0;
  color: rgb(var(--color-ink-muted));
  font-size: 0.8125rem;
  line-height: 1.4;
}

.hero-slide-meta__accent {
  color: rgb(var(--color-brand));
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-slide-meta__sep {
  color: rgb(var(--color-ink-muted));
  flex-shrink: 0;
  opacity: 0.65;
  font-weight: 600;
}

.hero-slide-meta svg {
  color: rgb(var(--color-ink-muted));
  flex-shrink: 0;
  opacity: 0.65;
}

.hero-slide-title {
  margin: 0;
  font-size: clamp(1.75rem, 3.2vw, 3rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-slide-title a {
  color: rgb(var(--color-ink));
  text-decoration: none;
  transition: color 0.25s ease;
}

.hero-slide-title a:hover,
.hero-slide-title a:focus-visible {
  color: rgb(var(--color-brand));
}

.hero-slide-excerpt {
  margin: 0;
  max-width: 48rem;
  color: rgb(var(--color-ink-muted));
  font-size: 0.9375rem;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 640px) {
  .hero-slide-excerpt {
    font-size: 1.0625rem;
  }
}

.hero-slide-cta {
  align-self: flex-start;
  margin-top: auto;
  min-height: 2.75rem;
  padding: 0.7rem 1.35rem;
  border: 1px solid rgb(var(--color-brand));
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-decoration: none;
  background: rgb(var(--color-brand));
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s var(--hero-ease);
}

.hero-slide-cta:hover,
.hero-slide-cta:focus-visible {
  color: #fff;
  background: rgb(var(--color-brand));
  filter: none;
  outline: none;
  transform: translateY(-1px);
}

@keyframes hero-content-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/*
 * Shared pagination — one instance, overlaid on the lower media (image),
 * centered, with clearance above the content band.
 */
.hero-carousel-pagination {
  --hero-pag-gap: 0.45rem;
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0;
  box-sizing: border-box;
  overflow-x: auto;
}

.hero-carousel-pagination .carousel-indicator {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: 0.65rem;
  flex: 1 1 0;
  min-width: 10rem;
  min-height: 4.25rem;
  padding: 0.4rem;
  border: 1px solid rgb(var(--color-border));
  background: rgb(var(--color-surface));
  color: rgb(var(--color-ink));
  text-align: left;
  opacity: 0.72;
}

.hero-carousel-pagination .carousel-indicator.is-active,
.hero-carousel-pagination .carousel-indicator:hover {
  opacity: 1;
}

.hero-carousel-pagination .carousel-indicator.is-active {
  border-color: rgb(var(--color-brand));
  box-shadow: inset 0 0 0 1px rgb(var(--color-brand));
}

.carousel-indicator-image {
  display: block;
  min-width: 0;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: rgb(var(--color-bg));
}

.carousel-indicator-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-indicator-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
}

.carousel-indicator-type {
  overflow: hidden;
  color: rgb(var(--color-accent));
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.carousel-indicator-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.hero-carousel.is-single .hero-carousel-pagination,
.hero-carousel.is-single .carousel-nav,
.hero-carousel-pagination[hidden] {
  display: none;
}

/* Static hub / single-slide shell — no carousel.js height sync. */
.hero-carousel.is-single .hero-carousel-viewport {
  height: auto;
  transition: none;
}

.hero-carousel.is-single .hero-carousel-track {
  transform: none;
  will-change: auto;
}

.hero-carousel.is-single .carousel-slide.is-active .hero-slide-media:hover img {
  transform: scale(1.025);
}

/* Shape / colors / states: shared hex nav in ui.css */
.carousel-nav {
  position: absolute;
  top: 1rem;
  z-index: 20;
  opacity: 0.92;
}

.carousel-nav:hover,
.carousel-nav:focus-visible {
  opacity: 1;
}

.carousel-prev {
  left: auto;
  right: calc(35% + 2rem + (var(--gg-carousel-nav-size) * var(--gg-hex-aspect)) + 0.35rem);
}

.carousel-next {
  right: calc(35% + 2rem);
}

.hero-carousel .carousel-indicator {
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.hero-carousel .carousel-indicator-track {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 0;
  background: rgb(var(--color-border));
  overflow: hidden;
  box-shadow: none;
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.25s ease;
}

.hero-carousel .carousel-indicator.is-active .carousel-indicator-track {
  background: rgb(var(--color-brand) / 0.25);
}

.hero-carousel .carousel-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: rgb(var(--palette-blue-400));
  transition: width 0.1s linear;
  will-change: width;
}

.hero-carousel .carousel-indicator:focus-visible {
  outline: 2px solid rgb(var(--palette-blue-400));
  outline-offset: 3px;
  opacity: 1;
}

@media (min-width: 640px) {
  .hero-carousel-pagination {
    --hero-pag-gap: 0.55rem;
  }

  .hero-carousel .carousel-indicator-track {
    height: 3px;
  }
}

@media (min-width: 1024px) {
  .hero-carousel-pagination {
    --hero-pag-gap: 0.65rem;
  }
}

@media (max-width: 767px) {
  .carousel-slide-card {
    flex-direction: column;
  }

  .hero-slide-content {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
  }

  .carousel-next {
    right: 2rem;
  }

  .carousel-prev {
    right: calc(2rem + (var(--gg-carousel-nav-size) * var(--gg-hex-aspect)) + 0.35rem);
  }

  .hero-carousel-pagination .carousel-indicator {
    flex: 0 0 12rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-carousel-track,
  .hero-carousel-viewport,
  .hero-carousel .carousel-slide,
  .hero-slide-media img,
  .hero-slide-cta,
  .carousel-nav {
    transition: none;
  }

  .hero-carousel .carousel-slide.is-active .hero-slide-content {
    animation: none;
  }

  .hero-carousel .carousel-slide.is-active .hero-slide-media:hover img,
  .hero-slide-cta:hover {
    transform: none;
  }
}
