/* See It In Action — sizes chosen with the tuning sliders (on a 1893px screen) and
   scaled with the screen width. Matches Website Screens/See it in action (Desktop at 1440px, Mobile at 410px).
   js/action.js positions the slides: the current one large in the centre, the
   others smaller, blurred and tucked behind it the further they are from the middle. */

.action {
  --slide-w: min(36vw, 62vh * 1.41, 900px);
  --slide-ratio: 646 / 458;

  position: relative;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--a-pad-top, 100px) 0 var(--a-pad-bottom, 100px); /* top clears the docked nav */
  background: var(--beige);
  color: var(--black);
}

.action__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--a-title, clamp(34px, 3.472vw, 56px)); /* 50px at 1440px like the other section headings, up to 56px */
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-align: center;
}

.action__title em {
  font-style: italic;
}

/* ---------- Tabs ---------- */

.action__tabs {
  display: flex;
  justify-content: center;
  gap: var(--a-tabs-gap, clamp(24px, 1.9vw, 44px));
  margin-top: var(--a-tabs-top, clamp(32px, 2.536vw, 56px));
}

.action__tab {
  position: relative;
  padding: 0 0 10px;
  border: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: var(--a-tab-size, clamp(13.5px, 0.845vw, 18px));
  line-height: 1.2;
  color: var(--dark-grey);
  cursor: pointer;
  transition: color 0.3s ease;
}

.action__tab:hover,
.action__tab[aria-selected="true"] {
  color: var(--black);
}

.action__tab[aria-selected="true"] {
  font-weight: 500;
}

/* Dotted underline on the selected tab, drawn in from the left */
.action__tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: repeating-linear-gradient(90deg, currentColor 0 3px, transparent 3px 6px);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.43, 0.195, 0.02, 1);
}

.action__tab[aria-selected="true"]::after {
  transform: scaleX(1);
}

.action__tab:focus-visible,
.action__stage:focus-visible {
  outline: 1px solid var(--black);
  outline-offset: 6px;
}

/* ---------- Carousel ---------- */

.action__stage {
  position: relative;
  height: calc(var(--slide-w) / (var(--slide-ratio)));
  margin-top: var(--a-stage-top, clamp(20px, 1.69vw, 40px));
  cursor: grab;
  touch-action: pan-y; /* vertical swipes still scroll the page */
  user-select: none;
  -webkit-user-select: none;
}

.action__stage.is-dragging {
  cursor: grabbing;
}

.action__panel {
  position: absolute;
  inset: 0;
}

.action__panel[hidden] {
  display: none;
}

.action__slides {
  margin: 0;
  padding: 0;
  list-style: none;
}

.action__slide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--slide-w);
  aspect-ratio: var(--slide-ratio);
  transform: translate(-50%, -50%);
  will-change: transform, filter;
}

.action__slide img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  pointer-events: none;
}

/* The text lives in the caption below; the copies on each slide are its source */
.action__slide-title,
.action__slide-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Caption ---------- */

.action__caption {
  width: min(var(--a-cap-w, clamp(420px, 27.68vw, 600px)), 100% - 48px);
  min-height: 9em;
  margin: var(--a-cap-top, clamp(28px, 2.113vw, 48px)) auto 0;
}

.action__caption-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--a-cap-title, clamp(25px, 1.585vw, 34px));
  line-height: 1.15;
}

.action__caption-text {
  margin: var(--a-cap-gap, 12px) 0 0;
  font-family: var(--font-mono);
  font-size: var(--a-cap-text, clamp(14px, 0.845vw, 18px));
  line-height: var(--a-cap-lh, 1.3125);
}

/* ---------- Phones and tablets ---------- */

@media (max-width: 959px) {
  .action {
    --slide-w: min(85vw, 640px);
    padding: 88px 0 72px;
  }

  .action__tabs {
    margin-top: 40px;
  }

  .action__tab {
    font-size: 14.5px;
  }

  .action__stage {
    margin-top: 28px;
  }

  .action__caption {
    width: auto;
    max-width: 560px;
    margin: 64px 0 0;
    padding: 0 max(24px, 7.5vw);
  }

  .action__caption-title {
    font-size: 27px;
  }

  .action__caption-text {
    margin-top: 18px;
    font-size: 14px;
    line-height: 20px;
  }
}
