function StorySection() {
  const [activeTrait, setActiveTrait] = React.useState(null);
  
  const traitsList = [
    { trait: 'Sensitive', reason: 'We believe art should connect with you on a personal level. Our delicate watercolors are crafted to inspire emotion, creativity, and self-expression.' },
    { trait: 'Curious', reason: 'Every stroke is an adventure. With our Chromatic Reveal, painting becomes a journey of discovery, bringing surprising hues to life right on your paper.' },
    { trait: 'Handcrafted', reason: 'Each palette is carefully poured and prepared by artisans who deeply respect the ingredients, ensuring a personal touch in every single drop of color.' },
    { trait: 'Approachable', reason: 'Creativity belongs to everyone. Our watercolors are designed for all skill levels, making conscious, sustainable art easy and accessible to everyone.' },
    { trait: 'Culturally rooted', reason: 'Inspired by the hummingbird\'s journey, we source our vibrant botanical pigments directly from local Mexican markets, celebrating our rich heritage in every shade.' },
  ];

  return (
    <section id="story" style={{ paddingTop: 64 }}>

      {/* Sub-section A: Brand Origin Story (dark) */}
      <div style={{ background: 'var(--ink-dark)', padding: 'clamp(3rem, 8vh, 6rem) clamp(1.5rem, 6vw, 6rem)' }}>
        <SectionReveal>
          <div style={{ maxWidth: 720, margin: '0 auto' }}>
            <p style={{ fontFamily: 'var(--font-ui)', fontSize: 11, color: 'var(--water-turquoise)', letterSpacing: '0.2em', textTransform: 'uppercase', marginBottom: 28, textAlign: 'center' }}>Our story</p>

            <blockquote style={{
              fontFamily: 'var(--font-identity)', fontWeight: 600, fontStyle: 'italic', fontSize: 'clamp(22px, 3vw, 30px)',
              color: 'var(--paper-cream)', lineHeight: 1.5, marginBottom: 36, textAlign: 'center',
            }}>
              "Legend has it that the hummingbird was made from a jade arrow and a handful of good vibes. Its mission was to carry our deepest wishes to the gods."
            </blockquote>

            <div style={{ fontFamily: 'var(--font-ui)', fontSize: 16, color: 'rgba(245,240,230,0.85)', lineHeight: 1.9, marginBottom: 36 }}>
              <p style={{ marginBottom: 18 }}>
                Xochiatl was born from a school project. The brief was simple: propose a product with a twist: something that would raise awareness about conscious consumption. The team looked inward, to Mexican culture and to a shared childhood memory: watercolors in a classroom.
              </p>
              <p style={{ marginBottom: 18 }}>
                The question that launched the brand was equally simple: <em style={{ fontFamily: 'var(--font-identity)', fontStyle: 'italic', color: 'var(--flower-pink)', fontSize: '1.05em' }}>why should watercolors come from petroleum-based compounds when the most vibrant colors in the world grow in a garden?</em> From that question came the first experiments: hibiscus, beetroot, coffee, turmeric, spinach, and achiote, each carrying its own pigment story.
              </p>
              <p style={{ marginBottom: 18 }}>
                And then came the discovery that changed everything: the color in the godet was not the color on the paper.
              </p>
              <p style={{ marginBottom: 18 }}>
                On the hummingbird's journey, it stops at the most vibrant flowers, drinking their color to stay radiant. Xochiatl was born in that very moment: when water touches pigment and a flower turns into art.
              </p>
              <p style={{ fontFamily: 'var(--font-identity)', fontStyle: 'italic', fontSize: 'clamp(18px, 2vw, 22px)', color: 'var(--paper-cream)', lineHeight: 1.6 }}>
                We do not just sell paint: we deliver the liquid soul of México so every artist can be the messenger of their own story.
              </p>
            </div>

            {/* Name etymology */}
            <div style={{ borderTop: '1px solid rgba(245,240,230,0.1)', paddingTop: 32, marginBottom: 8 }}>
              <p style={{ fontFamily: 'var(--font-ui)', fontSize: 11, color: 'var(--water-turquoise)', letterSpacing: '0.2em', textTransform: 'uppercase', marginBottom: 20, textAlign: 'center' }}>About the name</p>
              <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))', gap: 20 }}>
                {[
                  { word: 'Xochitl', meaning: 'Flower', note: 'The source of every botanical pigment: hibiscus, achiote, beetroot.' },
                  { word: 'Atl', meaning: 'Water', note: 'The medium that activates the color. The revealer. The transformer.' },
                  { word: 'Xochiatl', meaning: 'Flower + Water', note: 'A name that is a compressed product description in a language that predates synthetic chemistry by centuries.' },
                ].map((item, i) => (
                  <SectionReveal key={i} delay={i * 80}>
                    <div style={{ textAlign: 'center', padding: '20px 16px', border: '1px solid rgba(47,143,168,0.2)', borderRadius: 4 }}>
                      <p style={{ fontFamily: 'var(--font-identity)', fontWeight: 600, fontSize: 24, color: 'var(--flower-pink)', marginBottom: 4 }}>{item.word}</p>
                      <p style={{ fontFamily: 'var(--font-ui)', fontSize: 11, color: 'var(--water-turquoise)', letterSpacing: '0.15em', textTransform: 'uppercase', marginBottom: 10 }}>{item.meaning}</p>
                      <p style={{ fontFamily: 'var(--font-ui)', fontSize: 13, color: 'rgba(245,240,230,0.65)', lineHeight: 1.6 }}>{item.note}</p>
                    </div>
                  </SectionReveal>
                ))}
              </div>
            </div>

            <div style={{ width: 60, height: 1, background: 'var(--flower-pink)', margin: '32px auto 24px' }}></div>
            <p style={{ fontFamily: 'var(--font-ui)', fontSize: 14, color: 'rgba(245,240,230,0.6)', textAlign: 'center' }}>
              Born in Puebla · Made by hand · No petroleum · Six botanical colors
            </p>
          </div>
        </SectionReveal>
      </div>

      {/* Sub-section B: Brand Identity (light) */}
      <div style={{ background: 'var(--paper-cream)', padding: 'clamp(3rem, 8vh, 5rem) clamp(1.5rem, 6vw, 6rem)' }}>
        <SectionReveal>
          <p style={{ fontFamily: 'var(--font-ui)', fontSize: 11, color: 'var(--flower-pink)', letterSpacing: '0.2em', textTransform: 'uppercase', marginBottom: 12, textAlign: 'center' }}>Brand essence</p>
          <h2 style={{ fontFamily: 'var(--font-identity)', fontWeight: 600, fontSize: 'clamp(28px, 3.5vw, 40px)', color: 'var(--ink-dark)', textAlign: 'center', marginBottom: 12 }}>Conscious creativity.</h2>
          <p style={{ fontFamily: 'var(--font-ui)', fontSize: 16, color: 'rgba(34,34,51,0.75)', textAlign: 'center', maxWidth: 640, margin: '0 auto 48px', lineHeight: 1.8 }}>
            Xochiatl addresses three tensions at once: creative freedom and environmental responsibility; Mexican cultural heritage and contemporary visual language; artisanal production and accessible price. Most brands resolve one. We resolve all three.
          </p>
        </SectionReveal>

        {/* Archetypes */}
        <div style={{ maxWidth: 800, margin: '0 auto 48px', display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))', gap: 20 }}>
          {[
            {
              label: 'Our Core Spirit',
              name: 'The Creator',
              icon: (
                <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
                  <path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/>
                </svg>
              ),
              color: 'var(--flower-pink)',
              text: 'We exist to enable your creative expression, not just to offer another art supply. Through our Chromatic Reveal, every piece you make becomes a beautiful co-creation between our botanical magic and your artistic vision.'
            },
            {
              label: 'Our Foundation',
              name: 'The Caregiver',
              icon: (
                <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
                  <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
                </svg>
              ),
              color: 'var(--water-turquoise)',
              text: 'Our botanical formula isn\'t just a label, it\'s the heart of what makes Xochiatl unique. By using hibiscus, beetroot, coffee, turmeric, spinach, and achiote, we remove toxicity from the creative experience entirely.'
            }
          ].map((item, i) => (
            <SectionReveal key={i} delay={i * 100} style={{
              background: 'white', borderTop: `2px solid ${item.color}`,
              padding: '28px 24px', borderRadius: '0 0 8px 8px',
              boxShadow: '0 4px 20px rgba(0,0,0,0.03)',
              transition: 'transform 0.3s ease, box-shadow 0.3s ease',
            }}
              onMouseEnter={e => { e.currentTarget.style.transform = 'translateY(-4px)'; e.currentTarget.style.boxShadow = '0 12px 30px rgba(0,0,0,0.07)'; }}
              onMouseLeave={e => { e.currentTarget.style.transform = 'translateY(0)'; e.currentTarget.style.boxShadow = '0 4px 20px rgba(0,0,0,0.03)'; }}>
              <p style={{ fontFamily: 'var(--font-ui)', fontSize: 10, color: item.color, letterSpacing: '0.18em', textTransform: 'uppercase', marginBottom: 8 }}>{item.label}</p>
              <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 14, color: item.color }}>
                {item.icon}
                <h3 style={{ fontFamily: 'var(--font-identity)', fontWeight: 600, fontSize: 24, color: 'var(--ink-dark)', margin: 0 }}>{item.name}</h3>
              </div>
              <p style={{ fontFamily: 'var(--font-ui)', fontSize: 14, color: 'rgba(34,34,51,0.8)', lineHeight: 1.75 }}>{item.text}</p>
            </SectionReveal>
          ))}
        </div>

        {/* Personality traits */}
        {/* Personality traits */}
        <SectionReveal>
          <p style={{ fontFamily: 'var(--font-ui)', fontSize: 11, color: 'rgba(34,34,51,0.5)', letterSpacing: '0.15em', textTransform: 'uppercase', marginBottom: 20, textAlign: 'center' }}>Personality traits</p>
        </SectionReveal>
        
        <style>{`
          .traits-mobile-desc { display: none; }
          @media (max-width: 768px) {
            .trait-tooltip-desktop { display: none !important; }
            .traits-mobile-desc { display: block; }
          }
        `}</style>
        
        <div style={{ display: 'flex', flexWrap: 'wrap', gap: 12, maxWidth: 700, margin: '0 auto 0', justifyContent: 'center' }}>
          {traitsList.map((item, i) => (
            <SectionReveal key={i} delay={i * 60}>
              <div 
                style={{ position: 'relative', cursor: 'pointer' }}
                onMouseEnter={() => setActiveTrait(i)}
                onMouseLeave={() => setActiveTrait(null)}
                onClick={() => setActiveTrait(activeTrait === i ? null : i)}
              >
                <div style={{
                  fontFamily: 'var(--font-ui)', fontWeight: 500, fontSize: 13,
                  color: activeTrait === i ? 'var(--flower-pink)' : 'var(--ink-dark)', 
                  padding: '8px 18px',
                  border: `1px solid ${activeTrait === i ? 'var(--flower-pink)' : 'rgba(34,34,51,0.2)'}`, 
                  borderRadius: 40,
                  background: activeTrait === i ? 'rgba(199,46,102,0.04)' : 'transparent', 
                  transition: 'all 0.2s',
                }}>
                  {item.trait}
                </div>
                
                {/* Desktop Tooltip */}
                <div className="trait-tooltip-desktop" style={{
                  position: 'absolute', bottom: 'calc(100% + 8px)', left: '50%', transform: 'translateX(-50%)',
                  background: 'var(--ink-dark)', color: 'rgba(245,240,230,0.9)',
                  fontFamily: 'var(--font-ui)', fontSize: 12, lineHeight: 1.6,
                  padding: '10px 14px', borderRadius: 4, width: 240,
                  boxShadow: '0 4px 16px rgba(0,0,0,0.2)', zIndex: 10,
                  opacity: activeTrait === i ? 1 : 0,
                  visibility: activeTrait === i ? 'visible' : 'hidden',
                  transition: 'all 0.2s ease',
                  pointerEvents: 'none',
                  textAlign: 'center'
                }}>
                  {item.reason}
                  <div style={{ position: 'absolute', bottom: -5, left: '50%', transform: 'translateX(-50%)', width: 10, height: 10, background: 'var(--ink-dark)', borderRadius: 1, rotate: '45deg' }}></div>
                </div>
              </div>
            </SectionReveal>
          ))}
        </div>
        
        {/* Mobile Description Box */}
        <div className="traits-mobile-desc" style={{
          marginTop: 24,
          minHeight: 80,
          opacity: activeTrait !== null ? 1 : 0,
          transform: activeTrait !== null ? 'translateY(0)' : 'translateY(10px)',
          transition: 'all 0.3s ease',
          pointerEvents: activeTrait !== null ? 'auto' : 'none'
        }}>
          <div style={{
            background: 'var(--ink-dark)', color: 'rgba(245,240,230,0.9)',
            fontFamily: 'var(--font-ui)', fontSize: 13, lineHeight: 1.6,
            padding: '16px 20px', borderRadius: 8,
            textAlign: 'center', maxWidth: 400, margin: '0 auto',
            boxShadow: '0 8px 24px rgba(0,0,0,0.15)',
          }}>
            {activeTrait !== null ? traitsList[activeTrait].reason : ' '}
          </div>
        </div>
      </div>

      {/* Sub-section C: Mission, Vision, Values (dark) */}
      <div style={{ background: 'var(--ink-dark)', padding: 'clamp(3rem, 8vh, 5rem) clamp(1.5rem, 6vw, 6rem)' }}>
        <SectionReveal>
          <p style={{ fontFamily: 'var(--font-ui)', fontSize: 11, color: 'var(--water-turquoise)', letterSpacing: '0.2em', textTransform: 'uppercase', marginBottom: 12, textAlign: 'center' }}>Philosophy</p>
          <h2 style={{ fontFamily: 'var(--font-identity)', fontWeight: 600, fontSize: 'clamp(28px, 3.5vw, 40px)', color: 'var(--paper-cream)', textAlign: 'center', marginBottom: 48 }}>What we stand for.</h2>
        </SectionReveal>

        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(260px, 1fr))', gap: 24, maxWidth: 960, margin: '0 auto 40px' }}>
          {[
            {
              icon: (
                <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
                  <path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z"/>
                  <path d="M2 22l9-9"/>
                </svg>
              ),
              iconColor: 'var(--leaf-green)',
              tag: 'Mission',
              title: 'What we do',
              text: 'We transform botanical ingredients and rich Mexican traditions into safe, breathtaking handcrafted watercolors. We want to empower you to express yourself in a way that is conscious, vibrant, and deeply connected to nature.',
            },
            {
              icon: (
                <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
                  <circle cx="12" cy="12" r="10"/><path d="M12 8v4l3 3"/>
                </svg>
              ),
              iconColor: 'var(--flower-pink)',
              tag: 'Vision',
              title: 'Where we are going',
              text: 'We aim to be the watercolor of choice for mindful creators in Puebla and beyond. We envision a community where sustainable art practices, beautiful aesthetics, and cultural pride seamlessly bloom together.',
            },
            {
              icon: (
                <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
                  <path d="M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z"/>
                </svg>
              ),
              iconColor: 'var(--water-turquoise)',
              tag: 'Values',
              title: 'What we believe',
              text: null, // rendered as list below
              values: [
                'Creativity with purpose',
                'Safety and transparency in every ingredient',
                'Respect for nature as a raw material',
                'Well-grounded cultural pride without folkloric excess',
                'Useful craftsmanship that solves real problems',
                'Closeness to the community that uses and recommends the product',
              ]
            },
          ].map((card, i) => (
            <SectionReveal key={i} delay={i * 100} style={{
              background: 'rgba(245,240,230,0.04)', borderTop: `2px solid ${card.iconColor}`,
              padding: '32px 28px', boxShadow: '0 4px 20px rgba(0,0,0,0.1)',
              borderRadius: '0 0 8px 8px', cursor: 'default',
              transition: 'transform 0.3s ease, box-shadow 0.3s ease',
            }}
              onMouseEnter={e => { e.currentTarget.style.transform = 'translateY(-4px)'; e.currentTarget.style.boxShadow = '0 12px 30px rgba(0,0,0,0.2)'; }}
              onMouseLeave={e => { e.currentTarget.style.transform = 'translateY(0)'; e.currentTarget.style.boxShadow = '0 4px 20px rgba(0,0,0,0.1)'; }}>
              <p style={{ fontFamily: 'var(--font-ui)', fontSize: 10, color: card.iconColor, letterSpacing: '0.18em', textTransform: 'uppercase', marginBottom: 12 }}>{card.tag}</p>
              <div style={{ color: card.iconColor, marginBottom: 14 }}>{card.icon}</div>
              <h3 style={{ fontFamily: 'var(--font-identity)', fontWeight: 600, fontSize: 24, color: 'var(--paper-cream)', marginBottom: 14 }}>{card.title}</h3>
              {card.text ? (
                <p style={{ fontFamily: 'var(--font-ui)', fontSize: 14, color: 'rgba(245,240,230,0.8)', lineHeight: 1.8 }}>{card.text}</p>
              ) : (
                <ul style={{ margin: 0, padding: 0, listStyle: 'none' }}>
                  {card.values.map((v, vi) => (
                    <li key={vi} style={{
                      fontFamily: 'var(--font-ui)', fontSize: 13, color: 'rgba(245,240,230,0.8)',
                      lineHeight: 1.6, paddingLeft: 16, position: 'relative', marginBottom: 8,
                    }}>
                      <span style={{ position: 'absolute', left: 0, color: card.iconColor }}>·</span>
                      {v}
                    </li>
                  ))}
                </ul>
              )}
            </SectionReveal>
          ))}
        </div>

        {/* Our commitment */}
        <SectionReveal delay={200}>
          <div style={{
            maxWidth: 720, margin: '0 auto', background: 'rgba(199,46,102,0.08)',
            border: '1px solid rgba(199,46,102,0.2)', borderRadius: 4, padding: '28px 32px',
          }}>
            <p style={{ fontFamily: 'var(--font-ui)', fontSize: 10, color: 'var(--flower-pink)', letterSpacing: '0.18em', textTransform: 'uppercase', marginBottom: 12 }}>Our commitment</p>
            <p style={{ fontFamily: 'var(--font-ui)', fontSize: 14, color: 'rgba(245,240,230,0.8)', lineHeight: 1.9, margin: 0 }}>
              To bring you a vibrant and consistent palette across all six botanical colors. We strive to craft watercolors that creators truly love, sharing them with our local community first. For us, the ecological narrative isn't just a label; it's the core reason you'll choose to paint with Xochiatl.
            </p>
          </div>
        </SectionReveal>
      </div>

      {/* Sub-section D: Ingredients (dark, distinct) */}
      <div style={{ background: '#1A1A2E', padding: 'clamp(3rem, 8vh, 5rem) clamp(1.5rem, 6vw, 6rem)' }}>
        <SectionReveal>
          <h3 style={{
            fontFamily: 'var(--font-identity)', fontWeight: 600, fontSize: 'clamp(28px, 3vw, 36px)',
            color: 'var(--paper-cream)', textAlign: 'center', marginBottom: 36,
          }}>What is inside each cap?</h3>
        </SectionReveal>

        <div style={{ maxWidth: 780, margin: '0 auto' }}>
          {/* Table header */}
          <SectionReveal>
            <div style={{
              display: 'grid', gridTemplateColumns: '1.6fr 1fr',
              borderBottom: '1px solid rgba(47,143,168,0.3)', paddingBottom: 10, marginBottom: 4,
            }}>
              <span style={{ fontFamily: 'var(--font-ui)', fontSize: 11, color: 'var(--water-turquoise)', letterSpacing: '0.15em', textTransform: 'uppercase' }}>Ingredient</span>
              <span style={{ fontFamily: 'var(--font-ui)', fontSize: 11, color: 'var(--water-turquoise)', letterSpacing: '0.15em', textTransform: 'uppercase' }}>Produces</span>
            </div>
          </SectionReveal>

          {INGREDIENTS_DATA.map((ing, i) => (
            <SectionReveal key={i} delay={i * 50}>
              <div style={{
                display: 'grid', gridTemplateColumns: '1.6fr 1fr',
                alignItems: 'center', padding: '14px 0',
                borderBottom: i < INGREDIENTS_DATA.length - 1 ? '1px solid rgba(245,240,230,0.06)' : 'none',
              }}>
                <span style={{ fontFamily: 'var(--font-ui)', fontWeight: 500, fontSize: 14, color: 'var(--paper-cream)' }}>
                  {ing.name}
                </span>
                <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
                  <div style={{
                    width: 12, height: 12, borderRadius: '50%', background: ing.color,
                    flexShrink: 0, boxShadow: `0 0 6px ${ing.color}88`,
                  }}></div>
                  <span style={{ fontFamily: 'var(--font-identity)', fontWeight: 600, fontSize: 17, color: ing.color }}>
                    {ing.colorProduced}
                  </span>
                </div>
              </div>
            </SectionReveal>
          ))}

          <SectionReveal delay={350}>
            <p style={{
              fontFamily: 'var(--font-ui)', fontSize: 11, color: 'rgba(245,240,230,0.35)',
              marginTop: 20, textAlign: 'center',
            }}>All botanical ingredients sourced from Puebla's local markets · Gum arabic binder sourced sustainably</p>
          </SectionReveal>
        </div>
      </div>
    </section>
  );
}

window.StorySection = StorySection;
