/* Large serif quote: mark in column 3, text from column 4, author and
   Prev / Next underneath. */

.quote-slider {
  overflow-x: clip;
  touch-action: pan-y;
  padding-block: clamp(4rem, 11.9vw, 11rem) clamp(4rem, 15.2vw, 14rem);
}

.quote-slider__inner {
  align-items: start;
}

.quote-slider__mark {
  grid-column: 3;
  width: clamp(2.5rem, 4.5vw, 4.25rem);
  margin-block-start: 0.5rem;
  margin-inline-start: 1vw;
  color: var(--theme-color-heading-alt);
}

.quote-slider__slides {
  display: grid;
  grid-column: 4 / span 7;
  padding-inline-start: 3vw;
}

/* The quotes slide across the whole section (it clips at the screen edges): the
   next one arrives from the side it is going to (the direction is set by
   main.js, 1 forward, -1 back) while the one before leaves to the other side.
   Slides that are neither jump to the waiting side at once. */

.quote-slider__slide {
  grid-area: 1 / 1;
  visibility: hidden;
  translate: calc(var(--theme-slide-dir, 1) * 100vw) 0;
}

.quote-slider__slide.is-active,
.quote-slider__slide.is-leaving {
  visibility: visible;
  transition: translate 0.9s var(--theme-ease-signature);
}

.quote-slider__slide.is-active {
  translate: 0 0;
}

.quote-slider__slide.is-leaving {
  translate: calc(var(--theme-slide-dir, 1) * -100vw) 0;
}

@media (prefers-reduced-motion: reduce) {
  .quote-slider__slide,
  .quote-slider__slide.is-leaving {
    translate: 0 0;
  }

  .quote-slider__slide.is-leaving {
    visibility: hidden;
  }

  .quote-slider__slide.is-active,
  .quote-slider__slide.is-leaving {
    transition: none;
  }
}

.quote-slider__text {
  max-width: 19em;
  font-family: var(--theme-font-quote);
  font-size: var(--theme-fs-4xl);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.quote-slider__author {
  margin-block-start: clamp(2.5rem, 5.2vw, 4.75rem);
  padding-inline-start: 1.9vw;
  font-size: clamp(0.9375rem, 1.111vw, 1rem);
  line-height: 1.19;
}

.quote-slider__controls {
  display: flex;
  gap: clamp(1rem, 1.9vw, 1.75rem);

  /* Under the tallest quote, in a row of its own: a long quote never reaches
     the buttons and the sliding quotes never pass behind them. */
  grid-area: 2 / 1;
  place-self: start;
  margin-block-start: clamp(1rem, 1.7vw, 1.5rem);
  margin-inline-start: 1.9vw;
  line-height: 1.9;
  font-size: clamp(0.75rem, 0.903vw, 0.8125rem);
}

/* The counter, like the hero's: the current number rolls up or down with the
   slide (main.js). Only the top and bottom are clipped. */

.quote-slider__count {
  display: flex;
  gap: 0.35em;
  margin-inline-end: clamp(0.5rem, 1.4vw, 1.25rem);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.quote-slider__current {
  position: relative;
  display: inline-block;
  clip-path: inset(0 -100vw);
}

.quote-slider__current > span {
  display: block;
}

.quote-slider__current > .is-leaving {
  position: absolute;
  inset: 0;
}

.quote-slider__controls button:disabled {
  cursor: default;
}

/* The underline shows what a click would do: Next at rest, and while the pointer is
   over the right half; Prev while it is over the left half (data-hover, set by
   main.js). It fades between the two. */

.quote-slider__controls button {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.3em;
  transition: text-decoration-color 0.3s var(--theme-ease-signature);
}

.quote-slider:not([data-hover]) [data-slider-next]:not(:disabled),
.quote-slider[data-hover='right'] [data-slider-next]:not(:disabled),
.quote-slider[data-hover='left'] [data-slider-prev]:not(:disabled) {
  text-decoration-color: currentcolor;
}

@media (width <= 768px) {
  .quote-slider__mark {
    grid-column: 1 / span 2;
  }

  .quote-slider__slides {
    grid-column: 3 / -1;
    padding-inline-start: 0;
  }

  .quote-slider__controls {
    margin-inline-start: 0;
    margin-block-start: var(--theme-space-sm);
  }
}
