/* ==========================================================================
   Why Somerset County — featured-highlight carousel
   --------------------------------------------------------------------------
   Two ways into the same set of slides: a right-aligned list of names on the
   left, and a row of dots underneath. Picking either swaps the copy panel and
   the photograph together.

   Comp geometry at 1440, inside the 1040 content column:
     names   right-aligned to 443.6, the selected one a 230 x 55 teal pill
             whose right edge runs on to 506 to hold its arrow
     copy    482 - 764  (282 x 320), radius 12, on the section blue
     photo   700 - 1241 (541 x 371.5), radius 7.7
   The copy panel deliberately overlaps the photograph's left edge by 64.
   Design reference: WhySomerset_Website_2026_Work.pdf, page 4
   ========================================================================== */

.feature-carousel {
  display: grid;
  /* The column boundary is the copy panel's left edge at 482 — 27.115% of the
     1040 column. The selected name's pill runs 24 past that and sits over the
     panel, which is what the comp draws, so the list is given that 24 back as
     a negative margin and lifted above the stage. */
  grid-template-columns: 27.115% 1fr;
  align-items: center;
}
.feature-carousel__list  { grid-area: 1 / 1 / 2 / 2; }
.feature-carousel__stage { grid-area: 1 / 2 / 2 / 3; }
.feature-carousel__dots  { grid-area: 2 / 2 / 3 / 3; }

/* --------------------------------------------------------------------------
   1. The name list
   -------------------------------------------------------------------------- */
.feature-carousel__list {
  position: relative;
  z-index: 2;
  list-style: none;
  margin: 0 -8.511% 0 0;      /* the 24 the pill overhangs by, as a share of its own 282 column */
  padding: 0;
  text-align: right;
}
.feature-carousel__list li + li { margin-top: clamp(10px, 1.6vw, 23px); }

.feature-carousel__name {
  display: inline-block;
  max-width: 100%;
  /* The right padding is the arrow's berth: it holds every label's right edge
     on the same line whether or not the pill is showing. There is no left
     padding until the pill appears — the labels are right-aligned, so the pill
     grows leftwards without shifting its text, and an unselected name gets the
     full column to wrap in. */
  padding: clamp(5px, .76vw, 11px) clamp(34px, 4.33vw, 62px) clamp(5px, .76vw, 11px) 0;
  border: 0;
  border-radius: 999px;
  background: none;
  font-family: var(--ws-font-body);
  font-weight: 400;
  font-size: clamp(.875rem, 1.389vw, 1.25rem);
  line-height: 1.25;
  color: var(--ws-teal-ink);
  text-align: right;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .25s var(--ws-ease), color .25s var(--ws-ease);
}
.feature-carousel__name:hover { color: var(--ws-blue); }
.feature-carousel__name:focus-visible { outline: 3px solid var(--ws-blue); outline-offset: 2px; }

.feature-carousel__name[aria-selected="true"] {
  position: relative;
  padding-left: clamp(16px, 2.28vw, 33px);
  background: var(--ws-teal);
  font-weight: 700;
  color: #fff;
}
/* The arrow only belongs to the selected name, and lives in the padding that
   every name already reserves. */
.feature-carousel__arrow {
  position: absolute;
  right: clamp(12px, 1.32vw, 19px);
  top: 50%;
  width: clamp(18px, 2.15vw, 31px);
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity .25s var(--ws-ease);
}
.feature-carousel__name[aria-selected="true"] .feature-carousel__arrow { opacity: 1; }

/* --------------------------------------------------------------------------
   2. The stage
   -------------------------------------------------------------------------- */
/* The panels stack in one grid cell so the stage keeps the height of the
   tallest of them and nothing jumps as they swap — and so an outgoing card and
   an incoming one can be on screen together mid-flip.
   [hidden] is the no-JS state; main.js clears it and drives .is-active. */
.feature-carousel__stage { display: grid; }
.feature-carousel__panel { grid-area: 1 / 1; }
.feature-carousel__panel[hidden] { display: none; }

/* The photograph occupies the right 71.28% of the stage; the copy panel hangs
   off its left edge into the remainder. */
.feature-carousel__frame { margin: 0 0 0 28.72%; }
/* The photograph and the copy panel are siblings here so each can turn on its
   own axis; the shared perspective lives on their parent, which gives them one
   vanishing point between them rather than two unrelated ones. */
.feature-carousel__shot {
  position: relative;
  perspective: 1200px;
}
.feature-carousel__photo,
.feature-carousel__copy {
  transform-style: preserve-3d;
  backface-visibility: hidden;
}
.feature-carousel__photo { position: relative; }

.feature-carousel__img {
  display: block;
  width: 100%;
  aspect-ratio: 541 / 371.5;
  object-fit: cover;
  border-radius: clamp(5px, .53vw, 8px);
  background: rgba(0, 0, 0, .04);
}

.feature-carousel__source {
  position: absolute;
  right: clamp(10px, 1.46vw, 21px);
  bottom: clamp(8px, 1.32vw, 19px);
  margin: 0;
  font-size: clamp(.625rem, .9vw, .8125rem);
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}

.feature-carousel__copy {
  position: absolute;
  /* Centred by auto margins rather than a translate, so that GSAP owns the
     transform outright and its rotation cannot wipe out the centring. */
  top: 0;
  bottom: 0;
  height: -moz-fit-content;
  height: fit-content;
  margin-block: auto;
  /* -40.29% and 52.13% of the photo's width put this back at the stage's own
     left edge at 282 wide — the numbers the comp draws. */
  left: -40.29%;
  width: 52.13%;
  padding: clamp(16px, 2.64vw, 38px) clamp(18px, 2.99vw, 43px);
  border-radius: clamp(7px, .83vw, 12px);
  background: var(--ws-blue);
  color: #fff;
}
.feature-carousel__copy p {
  margin: 0;
  font-size: clamp(.8125rem, 1.389vw, 1.25rem);
  line-height: 1.3;
}

.feature-carousel__caption {
  margin: clamp(8px, .9vw, 13px) 0 0;
  font-size: clamp(.875rem, 1.25vw, 1.125rem);
  line-height: 1.4;
  color: var(--ws-ink);
}

/* --------------------------------------------------------------------------
   3. Dots — the second way through, sitting under the photograph
   -------------------------------------------------------------------------- */
.feature-carousel__dots {
  list-style: none;
  display: flex;
  gap: clamp(8px, .83vw, 12px);
  margin: clamp(16px, 2.29vw, 33px) 0 0 28.72%;
  padding: 0;
}
.feature-carousel__dot {
  width: clamp(11px, 1.11vw, 16px);
  height: clamp(11px, 1.11vw, 16px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #bcbec0;
  cursor: pointer;
  transition: background .25s var(--ws-ease), transform .25s var(--ws-ease);
}
.feature-carousel__dot:hover { transform: scale(1.15); }
.feature-carousel__dot:focus-visible { outline: 3px solid var(--ws-blue); outline-offset: 3px; }
.feature-carousel__dot[aria-selected="true"] { background: var(--ws-teal); }

/* --------------------------------------------------------------------------
   4. Responsive
   The overlap and the hanging copy panel need room; below the breakpoint the
   three parts stack in reading order instead.
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .feature-carousel { grid-template-columns: minmax(0, 1fr); row-gap: clamp(18px, 4vw, 26px); }
  .feature-carousel__list  { grid-area: auto; margin-right: 0; text-align: left; }
  .feature-carousel__stage { grid-area: auto; }
  .feature-carousel__dots  { grid-area: auto; }
  .feature-carousel__name { text-align: left; padding-inline: clamp(16px, 4vw, 24px); }
  .feature-carousel__arrow { display: none; }

  .feature-carousel__frame { margin-left: 0; }
  .feature-carousel__copy {
    position: static;
    width: auto;
    height: auto;
    margin: clamp(10px, 3vw, 16px) 0 0;
    transform: none;
  }
  .feature-carousel__dots { margin-left: 0; justify-content: center; }
}
