/* Scroll Word Highlight — Framer (prefixo fixo + palavras no scroll) */

.page-teste__section--scroll-word-highlight {
  padding-top: var(--space-xl);
}

.page-teste__scroll-word-stage {
  padding: 0 var(--section-padding-x);
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.scroll-word-highlight {
  --swh-gap: 1rem;
  --swh-inactive-opacity: 0.2;
  --swh-text-color: var(--color-text-on-light);
  --swh-bg: transparent;
  --swh-font-size: clamp(1.35rem, 3.25vw, 3rem);
  --swh-line-height: 1.1;
  --swh-line-height-px: calc(var(--swh-font-size) * var(--swh-line-height));
  --swh-visible-lines: 3;
  --swh-sticky-top: calc(50vh - 0.5 * var(--swh-line-height-px, 1em));

  container-type: inline-size;
  container-name: swh;
  width: 100%;
  max-width: 100%;
  overflow: clip;
  box-sizing: border-box;
  background-color: var(--swh-bg);
  color: var(--swh-text-color);
  font-family: var(--font-heading);
  font-size: var(--swh-font-size);
  font-weight: var(--weight-title);
  line-height: var(--swh-line-height);
  letter-spacing: -0.03em;
  padding-block: 50vh;
}

.scroll-word-highlight--placement-top {
  --swh-sticky-top: var(--swh-placement-offset, 40px);
}

.scroll-word-highlight--placement-bottom {
  --swh-sticky-top: calc(100svh - var(--swh-line-height-px, 1em) - var(--swh-placement-offset, 40px));
}

.scroll-word-highlight__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--swh-gap);
  box-sizing: border-box;
  width: 100%;
  margin-inline: auto;
}

.scroll-word-highlight__stack {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  box-sizing: border-box;
}

@container swh (min-width: 1200px) {
  .scroll-word-highlight__inner {
    flex-direction: row;
    align-items: flex-start;
  }

  .scroll-word-highlight--mode-slide .scroll-word-highlight__inner {
    align-items: center;
  }
}

.scroll-word-highlight--mode-slide {
  padding-block: 0;
  min-height: 100vh;  /* constante e preenche; pin do GSAP usa esta altura */
  min-height: 100lvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: visible;
}

.scroll-word-highlight--mode-slide .scroll-word-highlight__inner {
  height: auto;
  align-items: center;
  overflow: visible;
  /* Só o espaço do nbsp no prefixo — evita gap duplicado antes da palavra ativa */
  gap: 0;
}

.scroll-word-highlight--mode-slide .scroll-word-highlight__clip {
  position: static;
  top: auto;
  overflow: visible;
  height: var(--swh-line-height-px);
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
  min-width: 0;
}

.scroll-word-highlight--mode-slide .scroll-word-highlight__stack {
  overflow: visible;
}

.scroll-word-highlight--mode-slide.scroll-word-highlight--has-closing {
  padding-bottom: 0;
}

.scroll-word-highlight--mode-slide .scroll-word-highlight__list {
  will-change: transform;
  margin: 0;
}

.scroll-word-highlight--mode-slide .scroll-word-highlight__list li {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  overflow: visible;
  opacity: var(--swh-inactive-opacity);
}

.scroll-word-highlight--mode-slide .scroll-word-highlight__list li.is-active {
  opacity: 1;
}

.scroll-word-highlight__prefix {
  position: sticky;
  top: var(--swh-sticky-top);
  margin: 0;
  font: inherit;
  height: fit-content;
  flex-shrink: 0;
  white-space: nowrap;
}

.scroll-word-highlight--mode-slide .scroll-word-highlight__prefix {
  position: static;
  top: auto;
  line-height: var(--swh-line-height-px);
  height: var(--swh-line-height-px);
  display: flex;
  align-items: center;
}

/* Só palavras no scroll — sem prefixo nem fechamento (scrolltelling de categorias) */
.scroll-word-highlight--words-only .scroll-word-highlight__inner {
  flex-direction: column;
  align-items: flex-start;
}

@container swh (min-width: 1200px) {
  .scroll-word-highlight--words-only .scroll-word-highlight__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .scroll-word-highlight--words-only.scroll-word-highlight--mode-slide .scroll-word-highlight__inner {
    align-items: flex-start;
  }
}

.scroll-word-highlight--words-only.scroll-word-highlight--mode-slide .scroll-word-highlight__inner {
  gap: 0;
}

.page-teste__scroll-word-stage--words-only {
  margin-top: var(--space-2xl, 3rem);
  padding-top: var(--space-xl, 2rem);
  border-top: 1px solid color-mix(in srgb, var(--color-text-on-light) 12%, transparent);
}

.scroll-word-highlight--has-closing {
  padding-bottom: calc(50vh + var(--swh-line-height-px, 1em) * 2);
}

.scroll-word-highlight__closing {
  margin: 0.35em 0 0;
  padding: 0;
  font: inherit;
  width: 100%;
  box-sizing: border-box;
  opacity: 0;
}

.scroll-word-highlight--mode-slide .scroll-word-highlight__closing {
  margin-top: 0.25em;
  max-width: none;
}

.scroll-word-highlight__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.scroll-word-highlight__list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}

.scroll-word-highlight__list li {
  will-change: opacity;
  white-space: nowrap;
}

.scroll-word-highlight--mode-fade-in .scroll-word-highlight__list li:not(:first-child) {
  opacity: var(--swh-inactive-opacity);
}

.scroll-word-highlight--mode-spotlight .scroll-word-highlight__list li:not(:first-child) {
  opacity: var(--swh-inactive-opacity);
}

.scroll-word-highlight--mode-spotlight .scroll-word-highlight__list li:last-child {
  opacity: var(--swh-inactive-opacity);
}

.scroll-word-highlight--mode-spotlight .scroll-word-highlight__list li:first-child:last-child {
  opacity: 1;
}

.scroll-word-highlight__clip {
  overflow: hidden;
  height: var(--swh-line-height-px);
  position: sticky;
  top: var(--swh-sticky-top);
  flex: 1;
  min-width: 0;
}

@media (max-width: 767px) {
  .scroll-word-highlight {
    --swh-gap: 0.5rem;
    --swh-font-size: clamp(1.15rem, 6vw, 2.15rem);
    padding-block: 40vh;
  }

  .scroll-word-highlight__prefix {
    white-space: normal;
  }

  .scroll-word-highlight--has-closing {
    padding-bottom: calc(40vh + var(--swh-line-height-px, 1em) * 2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-word-highlight__list li {
    opacity: 1 !important;
    will-change: auto;
  }

  .scroll-word-highlight__closing {
    opacity: 1 !important;
    transform: none !important;
  }

  .scroll-word-highlight--mode-slide .scroll-word-highlight__list {
    transform: none !important;
    will-change: auto;
  }
}
