/* Focus block */

.focus {
  --focus-pause-length: 100vh;
  --focus-background-feather: 25vh;
  --focus-padding: var(--four-spacer);
  position: relative;
}

@media screen and (max-width: 767px) {
  .focus {
    --focus-padding: var(--two-spacer);
  }
}

/* ————
Background
——— */

.focus-background {
  position: absolute;
  inset: 0;
  background-color: var(--focus-background-color);
  opacity: calc(var(--focus-background-opacity, 1) * var(--focus-background-fade, 1));
  pointer-events: none;
}

/* The soft top edge */
.focus-background::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: var(--focus-background-feather);
  background: linear-gradient(to bottom, transparent, var(--focus-background-color));
}

.focus.is-preview .focus-background::before {
  display: none;
}

/* ————
Slides
——— */

.focus-slide {
  position: relative;
  height: 100vh;
  height: 100svh;
}

.focus-slide.is-paused {
  height: calc(100vh + var(--focus-pause-length));
  height: calc(100svh + var(--focus-pause-length));
}

.focus .focus-slide {
  scroll-margin-top: calc(-1 * var(--scroll-padding-top, 0px));
}

.focus .focus-slide.is-paused {
  scroll-margin-top: calc(-0.85 * var(--focus-pause-length) - var(--scroll-padding-top, 0px));
}

.focus-slide-inner {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 100vh;
  height: 100svh;
  padding: var(--focus-padding);
}

.focus-slide-content {
  width: 100%;
  max-width: var(--wp--style--global--content-size, 760px);
  text-align: left;
  font-size: var(--wp--preset--font-size--x-large); /* 32px */
  line-height: 1.4;
  transform: translate3d(0, var(--focus-shift, 0px), 0);
}

.focus.is-ready .focus-slide-content {
  will-change: transform;
}

/* Slide colors */
.focus-slide-content {
  color: var(--focus-text-color);
}

.focus-slide-content strong {
  color: var(--focus-strong-color);
}

.focus-slide-content > * {
  margin-top: 0;
  margin-bottom: 0;
  font-size: inherit;
  line-height: inherit;
}

.focus-slide-content > * + * {
  margin-top: 0.75em;
}

.focus-slide-content img {
  max-width: 100%;
  height: auto;
}

/* ————
Word reveal
——— */

/* Append words */
.focus.is-ready .focus-word--append {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.focus.is-ready .focus-word--append.is-revealed {
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .focus.is-ready .focus-word--append {
    filter: blur(0.2em);
    transition: opacity 0.5s ease, filter 0.5s ease;
  }

  .focus.is-ready .focus-word--append.is-revealed {
    filter: blur(0);
  }
}

/* ————
Editor preview
——— */

.focus.is-preview .focus-slide,
.focus.is-preview .focus-slide-inner {
  position: relative;
  height: auto;
}

.focus.is-preview .focus-slide-inner {
  padding: var(--five-spacer) var(--two-spacer);
}

.focus.is-preview .focus-slide + .focus-slide {
  border-top: 1px dashed currentColor;
}

/* Marks the text that's revealed after the rest */
.focus.is-preview .focus-append {
  opacity: 0.6;
}

.focus.is-preview .focus-slide.is-paused::before {
  content: 'Pause scroll';
  position: absolute;
  top: var(--one-spacer);
  left: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
}
