:root {
  --hero-bg-1: #ffffff;
  --hero-bg-2: #f1f1f1;
  --hero-accent: #f8b400;
  --muted: #9aa7bf;
  --card-radius: 18px;
  --carousel-radius: 14px;
}

#hero {
  background: linear-gradient(
    180deg,
    var(--hero-bg-1) 0%,
    var(--hero-bg-2) 100%
  );
  color: #1f242d;
  position: relative;
  overflow: visible;
  padding-top: 3rem;
  padding-bottom: 3rem;
}

/* Support selectors whether markup uses .hero-inner / hero-row or default container/row */
.hero-inner .hero-row,
#hero .container-lg > .row,
#hero .row {
  min-height: fit-content;
  position: relative;
  align-items: center;
}

/* -----------------------
   Card / text column
   ----------------------- */
.hero-text-col {
  z-index: 40;
  position: relative;
}

/* glass card */
.hero-card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.035),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(6px) saturate(1.05);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0px 6px rgba(2, 6, 20, 0.6);
  border-radius: var(--card-radius);
}

/* heading and typed text */
.hero-heading {
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  line-height: 1.05;
  font-weight: 700;
  margin: 0;
}
.typed-text {
  color: gold;
  display: inline-block;
  border-right: 2px solid rgba(255, 255, 255, 0.12);
  padding-right: 6px;
  white-space: nowrap;
  text-shadow: #e0e0e0 20px 20px 0px;
  margin-bottom: 8px;
}

/* -----------------------
   Carousel column / root
   ----------------------- */
.hero-carousel-col {
  position: relative;
}

/* IMPORTANT: ensure only one slide visible */
.hero-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden; /* clip non-active slides */
  border-radius: var(--carousel-radius);
  -webkit-tap-highlight-color: transparent;
}

/* track: horizontal flex row that will be translated */
.hero-carousel .carousel-track {
  display: flex;
  width: 100%;
  transition: transform 560ms cubic-bezier(0.2, 0.95, 0.25, 1);
  will-change: transform;
  align-items: center;
  gap: 0; /* no gap so slides butt up exactly */
  touch-action: pan-y; /* allow vertical scroll while supporting horizontal swipe */
}

/* each slide occupies full width */
.hero-carousel .slide {
  min-width: 100%;
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden; /* clip content inside each slide */
}

/* image fills the slide and is clipped when necessary */
.hero-carousel .carousel-img {
  width: 100%;
  max-width: none;
  display: block;
  object-fit: cover;
  border-radius: 12px;
  pointer-events: none;
  user-select: none;
  box-shadow: 0 40px 120px rgba(3, 7, 18, 0.75);
  transform: translateY(0);
  transition: transform 700ms ease, filter 400ms ease, box-shadow 400ms ease;
  filter: brightness(0.98) saturate(1.02);
}

/* subtle lift on hover for pointer devices */
@media (hover: hover) and (pointer: fine) {
  .hero-carousel .slide:hover .carousel-img {
    transform: translateY(-6px);
  }
}

/* -----------------------
   Controls and dots
   ----------------------- */
.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  background: rgba(2, 6, 20, 0.45);
  border: none;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-size: 1.6rem;
  box-shadow: 0 8px 24px rgba(2, 6, 20, 0.45);
}
.carousel-control.prev {
  left: 12px;
}
.carousel-control.next {
  right: 12px;
}
.carousel-control:focus {
  outline: 3px solid rgba(248, 180, 0, 0.14);
}

.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 60;
}
.carousel-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  cursor: pointer;
}
.carousel-dots .dot.active,
.carousel-dots .dot[aria-selected="true"] {
  background: linear-gradient(90deg, #ffd166, var(--hero-accent));
  transform: scale(1.12);
  box-shadow: 0 8px 20px rgba(248, 180, 0, 0.12);
}
.carousel-dots .dot:focus {
  outline: 3px solid rgba(248, 180, 0, 0.14);
}

/* -----------------------
   Desktop layout adjustments (>= 992px)
   - carousel visually sits behind the card
   ----------------------- */
@media (min-width: 992px) {
  .hero-inner {
    position: relative;
  }

  /* position carousel column absolute on the right so it sits under the card */
  .hero-carousel-col {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: fit-content;
    z-index: 10;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 3rem;
  }

  /* text column remains in normal flow with space reserved */
  .hero-text-col {
    position: relative;
    width: 48%;
    padding-right: 4rem;
  }

  /* subtle dim overlay on carousel to help the card pop */
  .hero-carousel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
      90deg,
      rgba(7, 10, 20, 0.18) 0%,
      rgba(7, 10, 20, 0.06) 40%,
      rgba(7, 10, 20, 0.12) 100%
    );
    pointer-events: none;
    z-index: 12;
    border-radius: var(--carousel-radius);
  }

  .hero-card {
    z-index: 40;
    position: relative;
  }

  /* ensure controls are usable but not above card */
  .carousel-control,
  .carousel-dots {
    z-index: 20;
  }
}

/* -----------------------
   Mobile: in-flow carousel + stacked text below
   - carousel full-width in the hero section but NOT fixed
   - hero text appears under carousel (stacked)
   ----------------------- */
@media (max-width: 991.98px) {
  .hero-carousel-col {
    position: relative;
    width: 100%;
    padding: 0;
    order: 0; /* ensure carousel appears first visually */
  }

  .hero-carousel {
    position: relative;
    z-index: 10;
    width: 100%;
    height: auto;
    display: block;
    background: transparent;
    padding: 0;
    border-radius: 0;
    overflow: hidden;
  }

  .hero-carousel .carousel-track {
    align-items: stretch;
  }

  .hero-carousel .slide {
    min-width: 100%;
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  /* cinematic, responsive height - does not cover nav */
  .hero-carousel .carousel-img {
    width: 100%;
    height: clamp(38vh, 50vw, 56vh);
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(3, 7, 18, 0.55);
    display: block;
  }

  /* show the hero text column under the carousel */
  .hero-text-col {
    display: block !important;
    width: 100%;
    order: 1; /* ensure it appears after carousel on mobile */
    padding: 1.25rem 0;
  }

  /* adapt the card to mobile width */
  .hero-text-col .hero-card {
    margin: 0 auto;
    width: calc(100% - 2rem);
    max-width: 720px;
    padding: 1rem 1.1rem;
    border-radius: 12px;
  }

  /* controls and dots stay tappable above slides */
  .carousel-control,
  .carousel-dots {
    z-index: 20;
    pointer-events: auto;
  }

  /* larger tappable dots on mobile */
  .carousel-dots .dot {
    width: 12px;
    height: 12px;
  }

  /* slightly larger nav controls for thumbs */
  .carousel-control {
    padding: 0.5rem 0.9rem;
    font-size: 1.4rem;
  }

  /* reduce padding so hero spacing remains comfortable */
  #hero {
    padding-top: 1.75rem;
    padding-bottom: 2.25rem;
  }
}

/* -----------------------
   Optional: small "peek" variant (desktop only)
   If you want a small part of the next slide visible on desktop, uncomment and tweak:
   .hero-carousel .slide { min-width: calc(100% - 24px); margin-right: 24px; }
   and remove gap:0 on the track. Disabled by default.
   ----------------------- */

/* -----------------------
   Reduced motion support
   ----------------------- */
@media (prefers-reduced-motion: reduce) {
  .hero-carousel .carousel-track {
    transition: none !important;
  }
  .hero-carousel .carousel-img {
    transition: none !important;
    transform: none !important;
  }
}
