/* ============================================================================
   FEATURE PAGE COMPONENT

   Reusable layout for individual feature detail pages. Each feature page
   showcases a specific feature with a hero video demo, summary, and optional
   bullet points.

   Purpose: Provide a consistent, scalable structure for all feature pages.
   New pages are created by copying the template and filling in the data contract.

   Required HTML Structure:

   <main class="feature-page">
     <!-- Hero Section with Video Demo -->
     <section class="feature-hero">
       <div class="container">
         <h1 class="feature-hero__title">{{featureTitle}}</h1>
         <p class="feature-hero__summary">{{featureSummary}}</p>

         <div class="feature-hero__demo">
           <video
             class="feature-demo-video"
             autoplay
             muted
             loop
             playsinline
             preload="metadata"
             poster="{{posterPath}}"
             width="{{videoWidth}}"
             height="{{videoHeight}}"
           >
             <source src="{{videoWebmPath}}" type="video/webm">
             <source src="{{videoMp4Path}}" type="video/mp4">
           </video>
         </div>
       </div>
     </section>

     <!-- Feature Content Section (Optional) -->
     <section class="feature-content">
       <div class="container">
         <div class="feature-content__box">
           <h2>Key Benefits</h2>
           <ul class="feature-bullets">
             <li>{{bullet1}}</li>
             <li>{{bullet2}}</li>
             <li>{{bullet3}}</li>
           </ul>

           <div class="feature-cta">
             <a href="{{ctaHref}}" class="btn btn--primary">{{ctaText}}</a>
           </div>
         </div>
       </div>
     </section>
   </main>

   Data Contract (required fields per feature page):
   - featureSlug: URL-safe identifier (e.g., "shared-budgets")
   - featureTitle: Display title (e.g., "Shared Budgets")
   - featureSummary: 1-2 sentence description
   - posterPath: Path to video poster image
   - videoWebmPath: Path to WebM video file
   - videoMp4Path: Path to MP4 video file
   - videoWidth: Video width in pixels (prevents layout shift)
   - videoHeight: Video height in pixels (prevents layout shift)

   Optional fields:
   - featureBullets[]: Array of 3-6 benefit bullet points
   - ctaText: Call-to-action button text
   - ctaHref: Call-to-action button URL
   - secondaryMedia: Additional screenshots or images

   File Structure Convention:
   - Feature pages: /features/<featureSlug>/index.html
   - Media files: /media/features/<featureSlug>.webm
                  /media/features/<featureSlug>.mp4
                  /media/features/<featureSlug>-poster.webp

   Modifiers:
   - .feature-hero--compact     # Reduced padding for shorter content
   - .feature-content--hidden   # Hide content section (video-only page)

   Notes:
   - Only one autoplay video per page (the hero demo)
   - Video uses preload="metadata" for performance
   - Respects reduced motion preferences via CSS
   ============================================================================ */


/* ===== Feature Page Wrapper ===== */

.feature-page {
  background: var(--section-dark);
  min-height: 100vh;
}


/* ===== Feature Hero Section ===== */

.feature-hero {
  background: linear-gradient(
    180deg,
    var(--section-dark) 0%,
    var(--navy-dark) 50%,
    var(--section-dark) 100%
  );
  padding: 120px 0 60px;
  text-align: center;
}

.feature-hero__title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: var(--spacing-md);
  background: linear-gradient(
    135deg,
    var(--hero-gradient-start) 0%,
    var(--hero-gradient-mid) 50%,
    var(--hero-gradient-end) 100%
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.feature-hero__summary {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto var(--spacing-lg);
  line-height: var(--line-height-base);
}


/* ===== Feature Demo Video ===== */

.feature-hero__demo {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--spacing-sm);
}

.feature-demo-video {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(96, 165, 250, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.2);
  background: var(--navy-dark);
}

/* Reduced motion: pause video and show poster */
@media (prefers-reduced-motion: reduce) {
  .feature-demo-video {
    /* Video will show poster image when paused */
  }
}


/* ===== Video Play Overlay (Autoplay Fallback) ===== */

.video-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: opacity var(--transition-normal);
}

.video-play-overlay--hidden {
  opacity: 0;
  pointer-events: none;
}

.video-play-button {
  width: 80px;
  height: 80px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--navy-dark);
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 6px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.video-play-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

.video-play-button:active {
  transform: scale(0.95);
}


/* ===== Demo Disclaimer (for AI generation features) ===== */

.feature-demo-disclaimer {
  margin-top: var(--spacing-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.7;
}


/* ===== Feature Content Section ===== */

.feature-content {
  padding: var(--spacing-xl) 0 var(--spacing-xxl);
}

.feature-content__box {
  max-width: 800px;
  margin: 0 auto;
  background: rgba(30, 58, 138, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-lg);
}

.feature-content__box h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}


/* ===== Feature Bullets ===== */

.feature-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--spacing-lg);
}

.feature-bullets li {
  position: relative;
  padding-left: 28px;
  margin-bottom: var(--spacing-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

.feature-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 8px;
  height: 8px;
  background: var(--sky-blue);
  border-radius: 50%;
}


/* ===== Feature CTA ===== */

.feature-cta {
  text-align: center;
  padding-top: var(--spacing-sm);
}

.feature-cta .btn--primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--navy-light) 0%, var(--navy-medium) 100%);
  color: var(--white);
  font-weight: 600;
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.feature-cta .btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}


/* ===== Responsive Breakpoints ===== */

@media (max-width: 768px) {
  .feature-hero {
    padding: 100px 0 40px;
  }

  .feature-hero__demo {
    padding: 0 var(--spacing-xs);
  }

  .feature-demo-video {
    border-radius: var(--radius-md);
  }

  .feature-content__box {
    padding: var(--spacing-md);
    margin: 0 var(--spacing-sm);
  }
}


/* ===== Modifiers ===== */

.feature-hero--compact {
  padding: 100px 0 40px;
}

.feature-content--hidden {
  display: none;
}


/* ===== Light Mode Overrides ===== */

[data-theme="light"] .feature-page {
  background: var(--section-dark);
}

[data-theme="light"] .feature-hero {
  background: linear-gradient(
    180deg,
    var(--section-dark) 0%,
    var(--section-medium) 50%,
    var(--section-dark) 100%
  );
}

[data-theme="light"] .feature-demo-video {
  box-shadow: var(--shadow-md), 0 0 30px rgba(37, 99, 235, 0.1);
  border-color: var(--border-color);
}

[data-theme="light"] .feature-content__box {
  background: linear-gradient(
    145deg,
    rgba(241, 245, 249, 0.95),
    rgba(226, 232, 240, 0.9)
  );
  border-color: var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .feature-bullets li::before {
  background: var(--navy-light);
}
