@layer porchlight {
  @layer reset, tokens, themes, base, layout, components, utilities, enhancements, print;
}

@layer porchlight.components {
  @supports (animation-timeline: scroll()) {
    :where(.pl-c-scroll-progress) {
      --pl-c-progress-tone: var(--pl-color-accent);
      z-index: var(--pl-z-sticky);
      block-size: 4px;
      transform-origin: inline-start;
      background: var(--pl-c-progress-tone);
      animation-name: pl-c-scroll-progress-grow;
      animation-duration: auto;
      animation-timing-function: linear;
      animation-timeline: scroll(root);
      position: fixed;
      inset-block-start: 0;
      inset-inline: 0;
    }

    :where(.pl-c-scroll-progress[data-tone="success"]) {
      --pl-c-progress-tone: var(--pl-color-success);
    }

    :where(.pl-c-scroll-progress[data-tone="warning"]) {
      --pl-c-progress-tone: var(--pl-color-warning);
    }

    :where(.pl-c-scroll-progress[data-tone="danger"]) {
      --pl-c-progress-tone: var(--pl-color-danger);
    }
  }

  @supports not (animation-timeline: scroll()) {
    :where(.pl-c-scroll-progress) {
      display: none;
    }
  }

  @media (forced-colors: active) {
    :where(.pl-c-scroll-progress) {
      background: highlight;
    }
  }

  @keyframes pl-c-scroll-progress-grow {
    from {
      transform: scaleX(0);
    }

    to {
      transform: scaleX(1);
    }
  }
}
