@layer components {
  /* Scroll Progress Indicator (Modern Web Guidance) */
  .scroll-progress {
    position: fixed;
    inset-block-start: 0;
    inset-inline: 0;
    block-size: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-gold), var(--accent-sage));
    transform-origin: 0 50%;
    transform: scaleX(0);
    z-index: 60;
    pointer-events: none;
  }

  @media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: scroll()) {
      @keyframes grow-scroll-progress {
        from {
          transform: scaleX(0);
        }
        to {
          transform: scaleX(1);
        }
      }

      .scroll-progress {
        animation: grow-scroll-progress auto linear;
        animation-timeline: scroll(root block);
      }
    }
  }

  /* Scroll-Driven Section & Card Reveals */
  @media (prefers-reduced-motion: no-preference) {
    @supports ((animation-timeline: view()) and (animation-range: entry)) {
      @keyframes sacred-reveal {
        from {
          opacity: 0;
          transform: translateY(28px) scale(0.98);
        }
        to {
          opacity: 1;
          transform: translateY(0) scale(1);
        }
      }

      .reveal-on-scroll {
        animation: sacred-reveal auto var(--ease-out) both;
        animation-timeline: view(block);
        animation-range: entry 0% entry 35%;
      }
    }

    /* Fallback class driven by IntersectionObserver when view() is unavailable */
    .reveal-on-scroll.is-pending {
      opacity: 0;
      transform: translateY(24px);
      transition:
        opacity 550ms var(--ease-out),
        transform 550ms var(--ease-out);
    }

    .reveal-on-scroll.is-visible {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* 3D Interactive Image & Card Depth */
  .tilt-3d {
    perspective: 1100px;
    transform-style: preserve-3d;
    overflow: visible;
  }

  .hero-media.tilt-3d,
  .featured-post.tilt-3d,
  .blog-card.tilt-3d,
  .single-article-cover.tilt-3d {
    overflow: visible;
  }

  .tilt-3d-surface {
    position: relative;
    transform-style: preserve-3d;
    border-radius: inherit;
    overflow: clip;
    transition: transform 240ms var(--ease-out), box-shadow 240ms var(--ease-out);
    will-change: transform;
  }

  .hero-media .tilt-3d-surface {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .hero-media:not(:has(.hero-caption)) .tilt-3d-surface {
    border-radius: var(--radius-lg);
  }

  @media (prefers-reduced-motion: no-preference) {
    @keyframes hero-3d-float {
      0%,
      100% {
        transform: rotateX(1.5deg) rotateY(-2deg) translateZ(0);
      }
      50% {
        transform: rotateX(-1.5deg) rotateY(2deg) translateZ(8px);
      }
    }

    .hero-media .tilt-3d-surface {
      animation: hero-3d-float 7s ease-in-out infinite;
    }

    .tilt-3d:hover .tilt-3d-surface {
      animation-play-state: paused;
      transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(10px);
    }
  }

  .tilt-3d-glare {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    opacity: 0;
    background: radial-gradient(
      circle at var(--glare-x, 50%) var(--glare-y, 50%),
      color-mix(in srgb, #ffffff 28%, transparent),
      transparent 55%
    );
    transition: opacity 240ms var(--ease-out);
  }

  @media (prefers-reduced-motion: no-preference) {
    .tilt-3d:hover .tilt-3d-glare {
      opacity: 1;
    }
  }

  .tilt-3d-badge {
    position: absolute;
    inset-block-start: 1rem;
    inset-inline-start: 1rem;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-pill);
    background-color: color-mix(in srgb, var(--bg-dark) 86%, transparent);
    color: var(--text-on-dark);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.05em;
    backdrop-filter: blur(8px);
    transform: translateZ(28px);
    box-shadow: var(--shadow-md);
  }

  /* Shrinking / Elevated Header on Scroll */
  .site-header {
    transition: box-shadow var(--duration-base) var(--ease-out),
      background-color var(--duration-base) var(--ease-out);
  }

  .site-header.is-scrolled {
    box-shadow: var(--shadow-md);
    background-color: color-mix(in srgb, var(--bg-page) 97%, transparent);
  }

  /* Ritual Trip Schedule Cards */
  .trip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1.5rem;
  }

  .trip-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: 0.75rem;
    align-content: space-between;
  }

  .trip-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--accent-primary);
  }

  /* Single Post & Breadcrumbs */
  .breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-block-end: 1.25rem;
  }

  .breadcrumbs a {
    text-decoration: none;
    color: var(--accent-primary);
    font-weight: 600;

    &:hover {
      text-decoration: underline;
    }
  }

  .single-article {
    max-inline-size: 48rem;
    margin-inline: auto;
  }

  .single-article-cover {
    margin-block: 1.75rem;
    border-radius: var(--radius-lg);
    overflow: clip;
    box-shadow: var(--shadow-lg);
  }

  .single-article-cover img {
    inline-size: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }

  .single-article-content {
    display: grid;
    gap: 1.15rem;
    font-size: 1.0625rem;
    line-height: 1.8;
  }

  .single-article-content h2,
  .single-article-content h3 {
    margin-block-start: 1rem;
  }

  .single-article-content blockquote {
    padding: 1.25rem 1.5rem;
    border-inline-start: 4px solid var(--accent-gold);
    background-color: var(--bg-surface);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-style: italic;
  }

  /* WordPress Pagination */
  .wp-pagination {
    margin-block-start: 2.5rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .wp-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-inline-size: 44px;
    min-block-size: 44px;
    padding-inline: 0.9rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--text-sm);
  }

  .wp-pagination .page-numbers.current {
    background-color: var(--bg-dark);
    color: var(--text-on-dark);
    border-color: var(--bg-dark);
  }
}

