/**
 * SPD Hero — Homepage hero section
 * =====================================================================
 * Phase 3a component styles. Reproduces the React Hero (HomePage.tsx) using
 * the centralized SPD design system for typography/radius/shadow/spacing
 * tokens, and React-reference-exact brand colors scoped to .spd-hero.
 *
 * The React site is the visual source of truth. The global SPD tokens
 * (--spd-blue/red/gold) intentionally differ slightly from the React
 * reference hexes; to match the React render pixel-for-pixel without
 * polluting the global token system, the Hero defines its own scoped
 * brand-color variables below. Neutral slates are used as raw values,
 * consistent with spd-shell.css. The warm hero surface is a section-
 * scoped decoration (not a global palette addition).
 *
 * Loaded after spd-shell.css.
 */

.spd-hero {
  /* Section-scoped surface (warm cream, matches the React reference). */
  --spd-hero-bg: #FAF8F5;
  --spd-hero-text: #0F172A;        /* slate-900 */
  --spd-hero-text-muted: #475569;  /* slate-600 */
  --spd-hero-text-soft: #64748B;   /* slate-500 */
  --spd-hero-border: rgba(226, 232, 240, 0.8); /* slate-200/80 */

  /* Hero-scoped brand colors — reference the centralized UI tokens
     (defined in spd-design-system.css) so the validated React values
     live in one place. Section-specific shades (amber, emerald) remain
     local because they have no global equivalent. */
  --spd-hero-blue: var(--spd-ui-blue);
  --spd-hero-blue-dark: #0c4977;
  --spd-hero-red: var(--spd-ui-red);
  --spd-hero-gold: var(--spd-ui-gold);        /* Truck / ShieldCheck badge icons */
  --spd-hero-amber-300: #FCD34D;   /* badge border, sparkles, "Explorer" */
  --spd-hero-amber-50: rgba(255, 251, 235, 0.9); /* amber-50/90 badge bg */
  --spd-hero-emerald-700: #047857; /* Check badge icon */

  /* Hero-scoped focus ring (React blue). */
  --spd-hero-focus-ring: 0 0 0 3px rgba(15, 91, 148, 0.35);

  position: relative;
  overflow: hidden;
  background-color: var(--spd-hero-bg);
  border-bottom: 1px solid var(--spd-hero-border);
}

/* ----------------------------------------------------------------
   Escape Astra's boxed content container on the front page.
   On the SPD front page, Astra wraps <main> in `.ast-container` which is
   given `display:flex; flex-direction:column-reverse; width:100%` and
   `padding:0.54em` (rules keyed on the #content ID — specificity 1,x,x).
   Astra also adds `padding:20px` to `.site-main`. These constrain the
   Hero and break its full-bleed right-side image.

   The Hero's right-side image must be full-bleed (edge to edge), so we
   neutralize the container's flex/padding and the main's padding. We use
   `#content` in the selector to beat Astra's ID-based specificity, scoped
   to body.spd-front-page so no other Astra page is affected. The Hero's
   internal `.spd-container` provides the 1280px content width for the
   text column. No Astra file is modified.
   ---------------------------------------------------------------- */
body.spd-front-page #content > .ast-container,
body.spd-front-page #content .ast-container {
  display: block;
  flex-direction: unset;
  max-width: none;
  width: 100%;
  padding-left: 0;
  padding-right: 0;
}

body.spd-front-page .site-main.spd-front-main {
  padding-left: 0;
  padding-right: 0;
  width: 100%;
  max-width: none;
}

/* ============================================================
   1. Slides + crossfade (shared by desktop & mobile carousels)
   ============================================================ */
.spd-hero__media {
  display: block;
  text-decoration: none;
  color: inherit;
}
.spd-hero__slides {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.spd-hero__slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}
.spd-hero__slide.is-active {
  opacity: 1;
  pointer-events: auto;
}
.spd-hero__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================================
   2. Desktop immersive carousel (lg+)
   ============================================================ */
.spd-hero__media--desktop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 62%;
  display: none;
  overflow: hidden;
  cursor: pointer;
}
.spd-hero__media--desktop .spd-hero__img {
  object-position: right center;
  transition: transform 0.7s ease;
}
.spd-hero__media--desktop:hover .spd-hero__slide.is-active .spd-hero__img,
.spd-hero__media--desktop:focus-visible .spd-hero__slide.is-active .spd-hero__img {
  transform: scale(1.02);
}
.spd-hero__media--desktop:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--spd-hero-blue);
}

/* Progressive warm fade blending the image into the left content side. */
.spd-hero__fade {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 55%;
  pointer-events: none;
  background: linear-gradient(
    to right,
    var(--spd-hero-bg) 0%,
    rgba(250, 248, 245, 0.96) 25%,
    rgba(250, 248, 245, 0.7) 55%,
    rgba(250, 248, 245, 0) 100%
  );
}

/* Hover-revealed navigation arrows. */
.spd-hero__arrows {
  position: absolute;
  right: 1.5rem;
  bottom: 1.25rem;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity var(--spd-transition-normal);
}
.spd-hero__media--desktop:hover .spd-hero__arrows,
.spd-hero__media--desktop:focus-within .spd-hero__arrows {
  opacity: 1;
}
.spd-hero__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: var(--spd-radius-full);
  background: rgba(255, 255, 255, 0.85);
  color: #334155; /* slate-700 */
  box-shadow: var(--spd-shadow-md);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: background-color var(--spd-transition-fast), color var(--spd-transition-fast), transform var(--spd-transition-fast);
}
.spd-hero__arrow:hover {
  background: #fff;
  color: var(--spd-hero-blue);
  transform: scale(1.06);
}
.spd-hero__arrow:focus-visible {
  outline: none;
  box-shadow: var(--spd-hero-focus-ring);
}
.spd-hero__arrow .spd-icon {
  width: 16px;
  height: 16px;
}

/* ============================================================
   3. Left content column
   ============================================================ */
.spd-hero__content {
  position: relative;
  z-index: 10;
}
.spd-hero__content .spd-container {
  padding-top: 2rem;    /* pt-8 */
  padding-bottom: 3rem;  /* pb-12 */
}
.spd-hero__inner {
  max-width: 36rem; /* max-w-xl */
  display: flex;
  flex-direction: column;
  gap: 1.5rem; /* space-y-6 */
}

/* Title */
.spd-hero__title {
  margin: 0;
  font-size: var(--spd-font-size-3xl); /* text-3xl 1.875rem */
  line-height: 1.12;
  font-weight: var(--spd-font-weight-black);
  letter-spacing: var(--spd-tracking-tight);
  color: var(--spd-hero-text);
}
.spd-hero__title-line {
  display: block;
  color: var(--spd-hero-text);
}
.spd-hero__title-line--brand {
  color: var(--spd-hero-blue);
  margin-top: 0.25rem; /* mt-1 */
}

/* Subtitle */
.spd-hero__subtitle {
  margin: 0;
  max-width: 32rem; /* max-w-lg */
  font-size: var(--spd-font-size-sm);
  line-height: var(--spd-line-height-relaxed);
  font-weight: var(--spd-font-weight-normal);
  color: var(--spd-hero-text-muted);
}

/* Action buttons */
.spd-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.875rem; /* gap-3.5 */
  padding-top: 0.25rem; /* pt-1 */
}
.spd-hero__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem; /* py-3 px-6 */
  border-radius: var(--spd-radius-md); /* rounded-lg */
  font-weight: var(--spd-font-weight-bold);
  font-size: var(--spd-font-size-sm);
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color var(--spd-transition-fast), color var(--spd-transition-fast), box-shadow var(--spd-transition-fast), transform var(--spd-transition-fast), border-color var(--spd-transition-fast);
}
.spd-hero__btn:focus-visible {
  outline: none;
  box-shadow: var(--spd-hero-focus-ring);
}
.spd-hero__btn--primary {
  background-color: var(--spd-hero-blue);
  color: #fff;
  box-shadow: var(--spd-shadow-sm);
}
.spd-hero__btn--primary:hover {
  background-color: var(--spd-hero-blue-dark);
  color: #fff;
  box-shadow: var(--spd-shadow-md);
  transform: translateY(-1px);
}
.spd-hero__btn--ghost {
  background-color: var(--spd-surface);
  color: #1E293B; /* slate-800 */
  border-color: rgba(51, 65, 85, 0.8); /* slate-700/80 */
  box-shadow: var(--spd-shadow-xs);
}
.spd-hero__btn--ghost:hover {
  background-color: var(--spd-bg); /* slate-50 */
  color: #1E293B;
  transform: translateY(-1px);
}

/* Reassurance badges */
.spd-hero__badges {
  list-style: none;
  margin: 0;
  padding: 1rem 0 0; /* pt-4 */
  max-width: 36rem; /* max-w-xl */
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem; /* gap-4 */
}
.spd-hero__badge {
  display: flex;
  align-items: center;
  gap: 0.625rem; /* gap-2.5 */
}
.spd-hero__badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem; /* w-8 */
  height: 2rem; /* h-8 */
  flex-shrink: 0;
  border-radius: var(--spd-radius-full);
  border: 1px solid var(--spd-hero-amber-300); /* amber-300 */
  background-color: var(--spd-hero-amber-50);  /* amber-50/90 */
  box-shadow: var(--spd-shadow-xs);
}
.spd-hero__badge-icon .spd-icon {
  width: 16px;
  height: 16px;
}
.spd-hero__badge--success .spd-hero__badge-icon {
  color: var(--spd-hero-emerald-700); /* emerald-700 */
}
.spd-hero__badge--success .spd-hero__badge-icon .spd-icon {
  stroke-width: 2.5;
}
.spd-hero__badge--gold .spd-hero__badge-icon {
  color: var(--spd-hero-gold); /* #EAA21D */
}
.spd-hero__badge--gold .spd-hero__badge-icon .spd-icon {
  stroke-width: 2;
}
.spd-hero__badge-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.spd-hero__badge-title {
  display: block;
  font-size: var(--spd-font-size-xs); /* text-xs */
  font-weight: var(--spd-font-weight-bold);
  color: var(--spd-hero-text);
}
.spd-hero__badge-desc {
  display: block;
  font-size: 0.6875rem; /* text-[11px] */
  color: var(--spd-hero-text-soft);
}

/* ============================================================
   4. Mobile / tablet carousel card (< lg)
   ============================================================ */
.spd-hero__media--mobile {
  display: block;
  padding-top: 1rem; /* pt-4 */
}
.spd-hero__card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--spd-radius-xl); /* rounded-2xl */
  overflow: hidden;
  background-color: #F1F5F9; /* slate-100 */
  border: 1px solid rgba(226, 232, 240, 0.9); /* slate-200/90 */
  box-shadow: var(--spd-shadow-md);
  text-decoration: none;
  color: inherit;
}
.spd-hero__card:focus-visible {
  outline: none;
  box-shadow: var(--spd-shadow-md), var(--spd-hero-focus-ring);
}
.spd-hero__media--mobile .spd-hero__img {
  object-position: center center;
}

/* Floating promotional chip */
.spd-hero__chip {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--spd-radius-full);
  background: rgba(15, 91, 148, 0.9); /* #0F5B94/90 */
  color: #fff;
  font-size: 0.6875rem; /* text-[11px] */
  font-weight: var(--spd-font-weight-bold);
  box-shadow: var(--spd-shadow-xs);
  backdrop-filter: blur(4px);
}
.spd-hero__chip .spd-icon {
  width: 12px;
  height: 12px;
  color: var(--spd-hero-amber-300); /* amber-300 */
}

/* Mobile nav arrows (always visible, inset on the sides) */
.spd-hero__arrows--mobile {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0.5rem; /* inset-x-2 */
  right: 0.5rem;
  z-index: 20;
  justify-content: space-between;
  pointer-events: none;
}
.spd-hero__arrows--mobile .spd-hero__arrow {
  width: 1.75rem; /* w-7 */
  height: 1.75rem; /* h-7 */
  background: rgba(255, 255, 255, 0.8); /* white/80 */
  color: #1E293B; /* slate-800 */
  box-shadow: var(--spd-shadow-xs);
  pointer-events: auto;
}
.spd-hero__arrows--mobile .spd-hero__arrow:hover {
  background: #fff;
  color: var(--spd-hero-blue);
}
.spd-hero__arrows--mobile .spd-hero__arrow .spd-icon {
  width: 15px;
  height: 15px;
}

/* Bottom caption gradient */
.spd-hero__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem; /* p-3 */
  background: linear-gradient(
    to top,
    rgba(2, 6, 23, 0.85) 0%,  /* slate-950/85 */
    rgba(2, 6, 23, 0.45) 55%,
    rgba(2, 6, 23, 0) 100%
  );
  color: #fff;
}
.spd-hero__caption-text {
  font-size: var(--spd-font-size-xs); /* text-xs */
  font-weight: var(--spd-font-weight-bold);
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 0.5rem;
  min-width: 0;
}
.spd-hero__caption-cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem; /* text-[11px] */
  font-weight: var(--spd-font-weight-bold);
  color: var(--spd-hero-amber-300); /* amber-300 */
}
.spd-hero__caption-cta .spd-icon {
  width: 12px;
  height: 12px;
}

/* ============================================================
   5. Indicator dots
   ============================================================ */
.spd-hero__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem; /* gap-2 */
}
.spd-hero__dots--mobile {
  padding-top: 0.75rem; /* pt-3 */
}
.spd-hero__dots--desktop {
  display: none;
}
.spd-hero__dot {
  width: 0.625rem; /* w-2.5 */
  height: 0.625rem; /* h-2.5 */
  padding: 0;
  border: 1px solid #94A3B8; /* slate-400 */
  border-radius: var(--spd-radius-full);
  background: transparent;
  cursor: pointer;
  transition: background-color var(--spd-transition-fast), border-color var(--spd-transition-fast), width var(--spd-transition-fast), height var(--spd-transition-fast);
}
.spd-hero__dot:hover {
  border-color: #475569; /* slate-600 */
}
.spd-hero__dot:focus-visible {
  outline: none;
  box-shadow: var(--spd-hero-focus-ring);
}
.spd-hero__dot.is-active {
  width: 0.75rem; /* w-3 */
  height: 0.75rem; /* h-3 */
  background-color: var(--spd-hero-red); /* #D93829 */
  border-color: var(--spd-hero-red);
  box-shadow: var(--spd-shadow-xs);
}

/* ============================================================
   6. Breakpoints — sm (640), md (768), lg (1024), xl (1280)
   ============================================================ */
@media (min-width: 640px) {
  .spd-hero__content .spd-container {
    padding-top: 3rem;    /* sm:pt-12 */
    padding-bottom: 3.5rem; /* sm:pb-14 */
  }
  .spd-hero__title {
    font-size: var(--spd-font-size-4xl); /* sm:text-4xl 2.25rem */
  }
  .spd-hero__title-line--brand {
    margin-top: 0.375rem; /* sm:mt-1.5 */
  }
  .spd-hero__subtitle {
    font-size: var(--spd-font-size-base); /* sm:text-base */
  }
  .spd-hero__btn {
    padding: 0.875rem 1.75rem; /* sm:py-3.5 sm:px-7 */
    font-size: var(--spd-font-size-base); /* sm:text-base */
  }
  .spd-hero__badges {
    padding-top: 1.5rem; /* sm:pt-6 */
    grid-template-columns: repeat(3, 1fr); /* sm:grid-cols-3 */
  }
  .spd-hero__media--mobile {
    padding-top: 1.5rem; /* sm:pt-6 */
  }
  .spd-hero__card {
    aspect-ratio: 16 / 8; /* sm:aspect-16/8 */
    border-radius: var(--spd-radius-2xl); /* sm:rounded-3xl */
  }
  .spd-hero__caption {
    padding: 1rem; /* sm:p-4 */
  }
  .spd-hero__caption-text {
    font-size: var(--spd-font-size-sm); /* sm:text-sm */
  }
}

@media (min-width: 768px) {
  .spd-hero__title {
    font-size: var(--spd-font-size-5xl); /* md:text-5xl 3rem */
  }
  .spd-hero__subtitle {
    font-size: var(--spd-font-size-lg); /* md:text-lg */
  }
}

@media (min-width: 1024px) {
  .spd-hero__media--desktop {
    display: block;
  }
  .spd-hero__media--mobile {
    display: none;
  }
  .spd-hero__content .spd-container {
    padding-top: 4rem;    /* lg:pt-16 */
    padding-bottom: 5rem; /* lg:pb-20 */
  }
  .spd-hero__title {
    font-size: 2.75rem; /* lg:text-[44px] */
  }
  /* Desktop crossfade is a touch slower, matching the React reference. */
  .spd-hero__slide {
    transition: opacity 0.7s ease;
  }
  .spd-hero__dots--mobile {
    display: none;
  }
  .spd-hero__dots--desktop {
    position: absolute;
    /* React: bottom-3 sm:bottom-4 on a lg:flex element → sm:bottom-4 wins. */
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
  }
}

@media (min-width: 1280px) {
  .spd-hero__media--desktop {
    width: 58%; /* xl:w-[58%] */
  }
  .spd-hero__title {
    font-size: 3.125rem; /* xl:text-[50px] */
  }
}

/* ============================================================
   7. Reduced motion — respect user preference
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .spd-hero__slide,
  .spd-hero__media--desktop .spd-hero__img,
  .spd-hero__arrow,
  .spd-hero__btn,
  .spd-hero__dot {
    transition: none;
  }
  .spd-hero__media--desktop:hover .spd-hero__slide.is-active .spd-hero__img {
    transform: none;
  }
  .spd-hero__btn:hover {
    transform: none;
  }
}
