/* Happening at EPB (News Carousel) - C8008 */

/* Header and mobile arrows match the main nav's fluid width
   (component/static/component/css/navigation_update/navigation_update.css), same as
   c8001/c8003: fixed 3rem side padding from 1026px, then capped at a 1824px-wide
   content area beyond 1920px. The carousel itself is deliberately outside this
   container — see .c8008-carousel. */
@media (min-width: 1026px) {
  .container.c8008-container {
    max-width: none;
    padding-left: 3rem;
    padding-right: 3rem;
  }
}

@media (min-width: 1920px) {
  .container.c8008-container {
    padding-left: calc((100vw - 1824px) / 2);
    padding-right: calc((100vw - 1824px) / 2);
  }
}

/* Slide geometry lives in these two properties, and the controller reads the
   resulting measured widths back off the DOM. Change the shape here only.
   --c8008-gap is a percentage of the track (= the full viewport width), so the
   gap keeps its proportion to the slide at every window size. */
.c8008-carousel {
  --c8008-slide-width: 86.4%;
  --c8008-gap: 3.6%;
  position: relative;
}

.c8008-header {
  text-align: left;
  margin-bottom: 2rem;
}

.c8008-eyebrow.eyebrow {
  text-align: left;
}

.c8008-eyebrow.eyebrow::after {
  margin: 0.5rem 0 0;
}

.c8008-viewport {
  overflow: hidden;
}

.c8008-track {
  display: flex;
  column-gap: var(--c8008-gap);
  transition: transform 400ms ease;
  will-change: transform;
}

/* The neighbouring slides stay on screen but drop back, so the active slide
   reads as the only one being offered. */
.c8008-slide.c8008-card {
  flex: 0 0 var(--c8008-slide-width);
  aspect-ratio: 4 / 5;
  opacity: 0.2;
  transition: opacity 400ms ease;
}

.c8008-slide.c8008-card[data-active] {
  opacity: 1;
}

/* The slide's shape comes from the box, not the photo, so the <picture> has to
   fill it before the shared `object-fit: cover` on the <img> can crop. */
.c8008-card .card-overlay__image picture {
  display: block;
  width: 100%;
  height: 100%;
}

/* No article image: the slide keeps its shape and the overlay text keeps its
   contrast, same treatment as the c8003 card placeholder. */
.c8008-card-image--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0d123d;
}

.c8008-card-image-logo {
  color: #ffffff;
}

.c8008-card-content {
  padding: 1.5rem;
  row-gap: 1.25rem;
}

.c8008-card-title {
  font-size: 1.5rem;
}

.c8008-card-blurb {
  font-size: 1rem;
  margin-bottom: 0;
}

/* A slide with a mobile blurb override renders both blurbs; the switch sits at
   the same 1026px breakpoint as the arrow pairs. */
.c8008-card-blurb--desktop {
  display: none;
}

.c8008-card-cta {
  display: inline-block;
  padding: 0.875rem 1.75rem;
  border-radius: 0.5rem;
  background-color: #fff;
  color: #0d123d;
  font-family: jost-variable, sans-serif;
  font-weight: 500;
  font-size: 1.125rem;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background-color 200ms ease;
}

.c8008-card-cta:hover {
  background-color: #ffcc5b;
  color: #0d123d;
  text-decoration: none;
}

.c8008-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 3rem;
  border-radius: 0.25rem;
  background-color: #ffcc5b;
  color: #0d123d;
  transition: background-color 200ms ease, color 200ms ease;
}

/* Single slide: nothing to navigate to, so hide the arrows instead of just
   disabling them. Two classes beats the single-class `.c8008-nav-btn--side`
   rule in the desktop media query, so this wins regardless of cascade order. */
.c8008-nav-btn:disabled {
  display: none;
}

/* Which arrow pair shows is handled here rather than with Tailwind's
   `hidden`/`lg:` classes: this file loads after the Tailwind bundle, so
   `.c8008-nav-btn { display: inline-flex }` would win the specificity tie
   against `.hidden` and both pairs would render at every width. */
.c8008-nav-btn--side {
  display: none;
}

/* Mobile: two wide arrows under the carousel, splitting the content width. */
.c8008-nav--mobile {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.c8008-nav--mobile .c8008-nav-btn {
  flex: 1 1 0;
}

@media (prefers-reduced-motion: reduce) {
  .c8008-track,
  .c8008-slide.c8008-card {
    transition: none;
  }
}

/* Tablet only. The comp specifies a portrait slide for phones and a wide one for
   desktop; kept portrait at 768px the slide stands 830px tall and pushes its own
   arrows off screen, so the shape starts opening up before the desktop layout
   takes over at 1026px. */
@media (min-width: 640px) and (max-width: 1025px) {
  .c8008-slide.c8008-card {
    aspect-ratio: 4 / 3;
  }

  /* The phone layout stretches both the CTA and the arrows to the full width,
     which is far too wide once there is 768px of it. */
  .c8008-card-cta {
    align-self: flex-start;
  }

  .c8008-nav--mobile .c8008-nav-btn {
    flex: 0 0 auto;
    width: 8rem;
  }
}

@media (min-width: 1026px) {
  .c8008-header {
    text-align: center;
    margin-bottom: 3rem;
  }

  .c8008-eyebrow.eyebrow {
    text-align: center;
  }

  .c8008-eyebrow.eyebrow::after {
    margin: 0.5rem auto 0;
  }

  .c8008-carousel {
    --c8008-slide-width: 59%;
    --c8008-gap: 11.15%;
  }

  .c8008-nav--mobile {
    display: none;
  }

  .c8008-slide.c8008-card {
    /* Stop growing where the rest of the homepage stops (the nav's 1824px
       content cap). Only reached beyond a ~3090px-wide window. */
    max-width: 1824px;
    aspect-ratio: 1182 / 620;
  }

  .c8008-card-content {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    column-gap: 2rem;
    padding: 3rem;
  }

  .c8008-card-copy {
    max-width: 60%;
  }

  .c8008-card-blurb--mobile {
    display: none;
  }

  .c8008-card-blurb--desktop {
    display: block;
  }

  .c8008-card-title {
    font-size: 2vw;
  }

  /* Desktop arrows sit in the gutter between the peeking slide and the active
     one: the gutter runs from (100% - slide)/2 inward, and 14.75% is its
     mid-point at the 59% slide width above. */
  .c8008-nav-btn--side {
    display: inline-flex;
    position: absolute;
    top: 50%;
    width: 4rem;
    transform: translateY(-50%);
  }

  .c8008-nav-btn--side.c8008-nav-btn--prev {
    left: calc(14.75% - 2rem);
  }

  .c8008-nav-btn--side.c8008-nav-btn--next {
    right: calc(14.75% - 2rem);
  }
}

@media (min-width: 1920px) {
  .c8008-card-title {
    font-size: 2.375rem;
  }
}
