---
/**
 * MOREMINIMORE - PAGE HERO COMPONENT (LIGHT THEME + ANIMATIONS)
 * White bg + dark text + yellow accent line. Animated on load.
 */

interface Props {
  badge?: string;
  title: string;
  subtitle?: string;
}

const {
  badge,
  title,
  subtitle,
} = Astro.props;

// Split title into words for kinetic animation
const titleWords = title.split(' ');
---

<section class="page-hero">
  <div class="hero-bg">
    <div class="bg-dots"></div>
  </div>

  <div class="hero-content container">
    {badge && (
      <span class="hero-badge">{badge}</span>
    )}
    <h1 class="hero-title kinetic-title">
      {titleWords.map((word, index) => (
        <span class="word-wrapper">
          <span
            class="word"
            style={`--delay: ${0.2 + index * 0.08}s`}
          >
            {word}
          </span>
        </span>
      ))}
    </h1>
    {subtitle && (
      <p class="hero-subtitle">{subtitle}</p>
    )}
  </div>

  <!-- Yellow accent line at bottom (animated) -->
  <div class="hero-accent">
    <div class="accent-bar"></div>
  </div>
</section>

<style>
  /* ============================================
     PAGE HERO BASE — LIGHT THEME + ANIMATIONS
     ============================================ */

  .page-hero {
    position: relative;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-white);
    overflow: hidden;
    padding: 140px 0 80px;
  }

  /* ============================================
     BACKGROUND (subtle yellow dots on white)
     ============================================ */

  .hero-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
  }

  .bg-dots {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(254, 212, 0, 0.15) 1px, transparent 0);
    background-size: 40px 40px;
    animation: dotsFloat 30s linear infinite;
  }

  @keyframes dotsFloat {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(40px, 40px); }
  }

  /* ============================================
     CONTENT (animates on load)
     ============================================ */

  .hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px var(--gutter) 60px;
  }

  .hero-badge {
    display: inline-block;
    padding: 8px 20px;
    background: var(--color-primary);
    color: var(--color-black);
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s var(--ease-out-expo) 0.1s forwards;
  }

  .hero-title {
    font-family: var(--font-display);
    font-size: clamp(36px, 6vw, 64px);
    font-weight: 900;
    line-height: 1.3;  /* Thai-safe: 1.1 clipped descenders */
    color: var(--color-black);
    margin-bottom: 16px;
  }

  .hero-subtitle {
    font-size: 18px;
    color: var(--color-gray-600);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s var(--ease-out-expo) 1.2s forwards;
  }

  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ============================================
     BOTTOM ACCENT LINE (animated draw)
     ============================================ */

  .hero-accent {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--color-gray-200);
  }

  .accent-bar {
    width: 100%;
    height: 100%;
    background: var(--color-primary);
    transform-origin: left;
    animation: accentDraw 1.2s var(--ease-out-expo) 0.5s forwards;
    transform: scaleX(0);
  }

  @keyframes accentDraw {
    to { transform: scaleX(1); }
  }

  /* ============================================
     RESPONSIVE
     ============================================ */

  @media (max-width: 640px) {
    .page-hero {
      min-height: 45vh;
      padding: 120px 0 60px;
    }

    .hero-content {
      padding: 20px var(--gutter) 40px;
    }

    .hero-title {
      font-size: 32px;
    }

    .hero-subtitle {
      font-size: 16px;
    }
  }
</style>
