// sig-lifestyles.jsx — Section 05. Five Lifestyles, One Culture.
//
// Bridges from the inventory ("Every Resident Receives") to the
// arrival ("Welcome to The Tech Lifestyle"). The five named
// Lifestyles — each a Resident archetype with her own landing
// page — are surfaced here as doorways into the broader system.
//
// Layout options (tweak: lifestyles):
//   row          — horizontal row of 5 plates, editorial (default)
//   editorial    — vertical scroll list w/ portrait + role + line
//   constellation — billboard-collage; each lifestyle is a panel in
//                   a cinematic billboard wall

const LIFESTYLES = [
  { who: 'Brenda',  role: 'The Matriarch Upgrading', tag: 'For the woman already considered.',                href: '/lifestyles/brenda',  img: 'assets/persona-brenda.jpg' },
  { who: 'Jasmine', role: 'The Builder',             tag: 'For the woman already building.',                  href: '/lifestyles/jasmine', img: 'assets/persona-jasmine.png' },
  { who: 'Keisha',  role: 'The Architect Mom',       tag: 'For the mother building while managing.',          href: '/lifestyles/keisha',  img: 'assets/persona-keisha.png' },
  { who: 'Tamara',  role: 'The Pivot',               tag: 'For the woman in reinvention.',                    href: '/lifestyles/tamara',  img: 'assets/persona-tamara-billboard-v2.png' },
  { who: 'Destiny', role: 'The Quiet Riser',         tag: 'For the quiet riser, upskilling with purpose.',    href: '/lifestyles/destiny', img: 'assets/persona-destiny-retreat.png' },
];

// Shared section frame
const LifestylesFrame = ({ children }) => (
  <section id="lifestyles" data-screen-label="05 Five Lifestyles · One Culture"
    style={{
      background:
        'radial-gradient(ellipse at 50% 0%, rgba(95,224,230,0.10) 0%, transparent 55%),' +
        'linear-gradient(180deg, var(--ld-navy-800) 0%, var(--ld-navy-900) 100%)',
      color: 'var(--ld-pearl-100)',
      padding: '56px 32px 56px',
      position: 'relative', overflow: 'hidden',
    }}>
    <div style={{ maxWidth: 1320, margin: '0 auto', position: 'relative' }}>
      <div style={{ textAlign: 'center', marginBottom: 56 }}>
        <div style={{
          fontFamily: 'var(--font-body)', fontWeight: 700,
          fontSize: 11, letterSpacing: '0.40em', textTransform: 'uppercase',
          color: 'var(--ld-aqua)', marginBottom: 16,
        }}>Five Lifestyles · One Culture</div>
      </div>
      {children}
    </div>
  </section>
);

// ─────────────────────────────────────────────────────────────
// LAYOUT A · ROW
// Horizontal row of 5 plates. Each plate: portrait, name, role,
// tag, "Visit her room →".
// ─────────────────────────────────────────────────────────────
const LifestylesRow = () => (
  <LifestylesFrame>
    <div style={{
      display: 'grid',
      gridTemplateColumns: 'repeat(5, 1fr)',
      gap: 16,
    }} className="sig-lifestyles-row">
      {LIFESTYLES.map((l) => (
        <a key={l.who} href={l.href} style={{
          display: 'flex', flexDirection: 'column',
          background: 'rgba(13,27,61,0.55)',
          border: '1px solid rgba(95,224,230,0.20)',
          borderRadius: 2,
          padding: 14,
          textDecoration: 'none', borderBottom: 'none',
          color: 'var(--ld-pearl-100)',
          transition: 'border-color 200ms ease, transform 200ms ease',
        }}
          onMouseEnter={(e) => {
            e.currentTarget.style.borderColor = 'var(--ld-aqua)';
            e.currentTarget.style.transform = 'translateY(-2px)';
          }}
          onMouseLeave={(e) => {
            e.currentTarget.style.borderColor = 'rgba(95,224,230,0.20)';
            e.currentTarget.style.transform = 'translateY(0)';
          }}
        >
          <div style={{
            position: 'relative',
            aspectRatio: '4 / 5',
            background: 'var(--ld-navy)',
            border: '1px solid rgba(201,162,74,0.3)',
            overflow: 'hidden',
            marginBottom: 14,
          }}>
            <img src={l.img} alt={`${l.who} — ${l.role}`} style={{
              width: '100%', height: '100%',
              objectFit: 'cover', objectPosition: 'center 18%',
              display: 'block',
            }} />
            <div aria-hidden="true" style={{
              position: 'absolute', inset: 0,
              background: 'linear-gradient(180deg, transparent 50%, rgba(13,27,61,0.85) 100%)',
            }} />
            <div style={{
              position: 'absolute', left: 10, bottom: 8,
              fontFamily: 'var(--font-body)', fontWeight: 600,
              fontSize: 9, letterSpacing: '0.24em', textTransform: 'uppercase',
              color: 'var(--ld-aqua)',
            }}>{l.who.charAt(0)}</div>
          </div>
          <div style={{
            fontFamily: 'var(--font-display)', fontWeight: 400,
            fontStyle: 'italic',
            fontSize: 22, lineHeight: 1.1, letterSpacing: '-0.008em',
            color: 'var(--ld-pearl-100)', margin: '0 0 6px',
          }}>{l.who}</div>
          <div style={{
            fontFamily: 'var(--font-body)', fontWeight: 600,
            fontSize: 9.5, letterSpacing: '0.22em', textTransform: 'uppercase',
            color: 'var(--ld-gold)', marginBottom: 10,
          }}>{l.role}</div>
          <p style={{
            fontFamily: 'var(--font-body)', fontSize: 12.5, lineHeight: 1.55,
            color: 'rgba(235,221,197,0.78)', margin: '0 0 14px',
            textWrap: 'pretty', flex: 1,
          }}>{l.tag}</p>
          <div style={{
            paddingTop: 10, borderTop: '1px solid rgba(95,224,230,0.18)',
            display: 'flex', alignItems: 'center', justifyContent: 'space-between',
            fontFamily: 'var(--font-body)', fontWeight: 700,
            fontSize: 9.5, letterSpacing: '0.22em', textTransform: 'uppercase',
            color: 'var(--ld-aqua)',
          }}>
            <span>Visit her room</span>
            <span aria-hidden="true">→</span>
          </div>
        </a>
      ))}
    </div>
    <style>{`
      @media (max-width: 1100px) {
        .sig-lifestyles-row { grid-template-columns: repeat(3, 1fr) !important; }
      }
      @media (max-width: 720px) {
        .sig-lifestyles-row { grid-template-columns: repeat(2, 1fr) !important; }
      }
      @media (max-width: 480px) {
        .sig-lifestyles-row { grid-template-columns: 1fr !important; }
      }
    `}</style>
  </LifestylesFrame>
);

// ─────────────────────────────────────────────────────────────
// LAYOUT B · EDITORIAL
// Vertical scroll list. Each row: index (01–05) · portrait · name +
// role + tag · arrow. Like a magazine's table of contents.
// ─────────────────────────────────────────────────────────────
const LifestylesEditorial = () => (
  <LifestylesFrame>
    <div style={{
      maxWidth: 880, margin: '0 auto',
      borderTop: '1px solid rgba(95,224,230,0.24)',
    }}>
      {LIFESTYLES.map((L, i) => (
        <a key={L.who} href={L.href} style={{
          display: 'grid',
          gridTemplateColumns: '64px 100px 1fr 32px',
          gap: 24, alignItems: 'center',
          padding: '22px 0',
          borderBottom: '1px solid rgba(95,224,230,0.24)',
          textDecoration: 'none', borderBottom_: 'none',
          color: 'var(--ld-pearl-100)',
          transition: 'background 200ms ease, padding-left 200ms ease',
        }}
          onMouseEnter={(e) => {
            e.currentTarget.style.background = 'rgba(95,224,230,0.05)';
            e.currentTarget.style.paddingLeft = '12px';
          }}
          onMouseLeave={(e) => {
            e.currentTarget.style.background = 'transparent';
            e.currentTarget.style.paddingLeft = '0';
          }}
          className="sig-lifestyles-ed-row"
        >
          <div aria-hidden="true" style={{
            fontFamily: 'var(--font-display)', fontWeight: 300,
            fontSize: 36, lineHeight: 1, letterSpacing: '-0.02em',
            color: 'var(--ld-gold)',
          }}>0{i + 1}</div>
          <div style={{
            aspectRatio: '4 / 5',
            background: 'var(--ld-navy)',
            border: '1px solid rgba(201,162,74,0.3)',
            overflow: 'hidden',
          }}>
            <img src={L.img} alt={`${L.who} — ${L.role}`} style={{
              width: '100%', height: '100%',
              objectFit: 'cover', objectPosition: 'center 18%',
              display: 'block',
            }} />
          </div>
          <div>
            <div style={{
              display: 'flex', alignItems: 'baseline', gap: 12, flexWrap: 'wrap',
              marginBottom: 6,
            }}>
              <span style={{
                fontFamily: 'var(--font-display)', fontWeight: 400,
                fontStyle: 'italic',
                fontSize: 28, letterSpacing: '-0.012em',
                color: 'var(--ld-pearl-100)',
              }}>{l.who}</span>
              <span style={{
                fontFamily: 'var(--font-body)', fontWeight: 600,
                fontSize: 9.5, letterSpacing: '0.22em', textTransform: 'uppercase',
                color: 'var(--ld-aqua)',
              }}>· {L.role}</span>
            </div>
            <div style={{
              fontFamily: 'var(--font-display)', fontStyle: 'italic',
              fontWeight: 400, fontSize: 15, lineHeight: 1.4,
              color: 'rgba(235,221,197,0.78)',
              textWrap: 'pretty', maxWidth: 460,
            }}>{l.tag}</div>
          </div>
          <div aria-hidden="true" style={{
            fontFamily: 'var(--font-body)', fontWeight: 600,
            fontSize: 22, color: 'var(--ld-aqua)',
            justifySelf: 'end',
          }}>→</div>
        </a>
      ))}
    </div>
    <style>{`
      @media (max-width: 600px) {
        .sig-lifestyles-ed-row { grid-template-columns: 36px 80px 1fr 24px !important; gap: 14px !important; }
      }
    `}</style>
  </LifestylesFrame>
);

// ─────────────────────────────────────────────────────────────
// LAYOUT C · CONSTELLATION / BILLBOARD WALL
// Billboard collage: a cinematic wall of 5 panels arranged in a
// magazine-cover grid. The center panel is taller (the "main"
// billboard); flanking panels are smaller, like a Times Square
// wall. Hovers brighten the panel.
// ─────────────────────────────────────────────────────────────
const LifestylesConstellation = () => (
  <LifestylesFrame>
    <div style={{
      display: 'grid',
      gridTemplateColumns: 'repeat(6, 1fr)',
      gridTemplateRows: 'auto auto',
      gap: 12,
      maxWidth: 1180, margin: '0 auto',
    }} className="sig-lifestyles-cw">
      {/* layout:
          row1: [Brenda 2] [Jasmine 2] [Keisha 2]
          row2: [Tamara 3] [Destiny 3]
       */}
      {LIFESTYLES.map((L, i) => {
        const spans = [
          { col: 'span 2', row: 'span 1' }, // Brenda
          { col: 'span 2', row: 'span 1' }, // Jasmine
          { col: 'span 2', row: 'span 1' }, // Keisha
          { col: 'span 3', row: 'span 1' }, // Tamara
          { col: 'span 3', row: 'span 1' }, // Destiny
        ][i];
        return (
          <a key={L.who} href={L.href} style={{
            gridColumn: spans.col, gridRow: spans.row,
            position: 'relative', overflow: 'hidden',
            borderRadius: 2,
            border: '1px solid rgba(95,224,230,0.32)',
            textDecoration: 'none', borderBottom: 'none',
            color: 'var(--ld-pearl-100)',
            background: 'var(--ld-navy)',
            minHeight: 280,
            boxShadow: '0 16px 36px rgba(0,0,0,0.4)',
            transition: 'border-color 200ms ease, box-shadow 200ms ease',
          }}
            onMouseEnter={(e) => {
              e.currentTarget.style.borderColor = 'var(--ld-aqua)';
              e.currentTarget.style.boxShadow =
                '0 16px 36px rgba(0,0,0,0.4), 0 0 32px rgba(95,224,230,0.36)';
            }}
            onMouseLeave={(e) => {
              e.currentTarget.style.borderColor = 'rgba(95,224,230,0.32)';
              e.currentTarget.style.boxShadow = '0 16px 36px rgba(0,0,0,0.4)';
            }}
          >
            <img src={L.img} alt={`${L.who} — ${L.role}`} style={{
              position: 'absolute', inset: 0,
              width: '100%', height: '100%',
              objectFit: 'cover', objectPosition: 'center 22%',
              display: 'block',
            }} />
            <div aria-hidden="true" style={{
              position: 'absolute', inset: 0,
              background:
                'linear-gradient(180deg, rgba(13,27,61,0.5) 0%, transparent 35%, transparent 50%, rgba(5,9,19,0.92) 100%)',
            }} />
            <div style={{
              position: 'absolute', top: 14, left: 14,
              fontFamily: 'var(--font-body)', fontWeight: 700,
              fontSize: 9.5, letterSpacing: '0.28em', textTransform: 'uppercase',
              color: 'var(--ld-aqua)',
              textShadow: '0 0 8px rgba(13,27,61,0.85)',
            }}>0{i + 1}</div>
            <div style={{
              position: 'absolute', left: 16, right: 16, bottom: 16,
            }}>
              <div style={{
                fontFamily: 'var(--font-display)', fontWeight: 400,
                fontStyle: 'italic',
                fontSize: 'clamp(22px, 2.4vw, 30px)', lineHeight: 1.1,
                letterSpacing: '-0.012em',
                color: 'var(--ld-pearl-100)',
                textShadow: '0 2px 12px rgba(0,0,0,0.65)',
              }}>{L.who}</div>
              <div style={{
                fontFamily: 'var(--font-body)', fontWeight: 700,
                fontSize: 9.5, letterSpacing: '0.24em', textTransform: 'uppercase',
                color: 'var(--ld-gold)',
                textShadow: '0 2px 8px rgba(0,0,0,0.65)',
                marginTop: 4,
              }}>{L.role}</div>
              <div style={{
                marginTop: 8,
                fontFamily: 'var(--font-display)', fontStyle: 'italic',
                fontWeight: 400, fontSize: 13.5, lineHeight: 1.4,
                color: 'rgba(235,221,197,0.86)',
                textShadow: '0 2px 8px rgba(0,0,0,0.65)',
              }}>{L.tag}</div>
            </div>
          </a>
        );
      })}
    </div>
    <style>{`
      @media (max-width: 900px) {
        .sig-lifestyles-cw { grid-template-columns: repeat(2, 1fr) !important; }
        .sig-lifestyles-cw > a { grid-column: span 1 !important; grid-row: auto !important; }
      }
      @media (max-width: 540px) {
        .sig-lifestyles-cw { grid-template-columns: 1fr !important; }
      }
    `}</style>
  </LifestylesFrame>
);

// ─────────────────────────────────────────────────────────────
// Router
// ─────────────────────────────────────────────────────────────
const SigLifestyles = ({ variant = 'row' }) => {
  if (variant === 'editorial')    return <LifestylesEditorial />;
  if (variant === 'constellation') return <LifestylesConstellation />;
  return <LifestylesRow />;
};

Object.assign(window, { SigLifestyles });
