// portfolio-cinematic.jsx
// Direction A — Cinematic Editorial · dark red + black.
// FULLMETAL & CINESTEEL sub-brands in nav. TEAM dropdown opens a member
// detail page with a project slideshow showing the member's role per film.
// Services split into Video / Graphic / Clothing.

const CIN = {
  bg: '#0a0606',
  bgSoft: '#140909',
  bgRaise: '#1c0c0e',
  ink: '#f0e8dc',
  inkMute: 'rgba(240,232,220,.62)',
  inkDim: 'rgba(240,232,220,.38)',
  rule: 'rgba(240,232,220,.10)',
  accent: '#a8202c',
  accentDeep: '#6b0d14',
};

function CinematicPortfolio({ projects, accent = CIN.accent, dense = false, showreelId = '76979871', showreelSource = 'vimeo', workFilters, creators = CREATORS, brands = BRANDS, managed = MANAGED_SEED, subBrandClients = SUB_BRAND_CLIENTS_SEED, team = TEAM, links = NAV_LINKS, subBrands = SUB_BRANDS, services = SERVICES, locations, homePhotos = [] }) {
  const locs = (Array.isArray(locations) && locations.length) ? locations : [
    { name: 'Lisbon',   address: 'Rua da Boavista 84\n1200-066\nrichard@armature.studio' },
    { name: 'New York', address: '79 Walker St, 4F\nNY 10013\nbookings@armature.studio' },
  ];
  const [route, setRoute] = React.useState(() => {
    const m = location.hash.match(/^#team=(.+)/);
    return m ? { name: 'team', id: decodeURIComponent(m[1]) } : { name: 'home' };
  });
  const scrollRef = React.useRef(null);
  React.useEffect(() => {
    if (scrollRef.current) scrollRef.current.scrollTop = 0;
  }, [route]);

  const go = React.useCallback((r) => {
    setRoute(r);
    if (r.name === 'team' && r.id) {
      history.replaceState(null, '', '#team=' + encodeURIComponent(r.id));
    } else if (location.hash.startsWith('#team=')) {
      history.replaceState(null, '', location.pathname + location.search);
    }
  }, []);

  React.useEffect(() => {
    function onHashChange() {
      const m = location.hash.match(/^#team=(.+)/);
      if (m) setRoute({ name: 'team', id: decodeURIComponent(m[1]) });
      else if (route.name === 'team') setRoute({ name: 'home' });
    }
    window.addEventListener('hashchange', onHashChange);
    return () => window.removeEventListener('hashchange', onHashChange);
  }, [route.name]);

  return (
    <div
      style={{
        width: '100%', height: '100%', background: CIN.bg, color: CIN.ink,
        fontFamily: '"Geist", "Inter", system-ui, sans-serif',
        position: 'relative', overflow: 'hidden',
        display: 'flex', flexDirection: 'column',
      }}
    >
      <CinNav route={route} go={go} accent={accent} team={team} links={links} subBrands={subBrands} />
      <div ref={scrollRef} style={{ flex: 1, overflowY: 'auto', overflowX: 'hidden' }}>
        {route.name === 'home' && <CinHome projects={projects} accent={accent} dense={dense} showreelId={showreelId} showreelSource={showreelSource} workFilters={workFilters} go={go} team={team} links={links} subBrands={subBrands} homePhotos={homePhotos} />}
        {route.name === 'project' && <CinProject project={projects.find(p => p.id === route.id) || projects[0]} projects={projects} accent={accent} go={go} />}
        {route.name === 'team' && <CinTeamMember member={team.find(m => m.id === route.id) || team[0]} projects={projects} accent={accent} go={go} />}
        {route.name === 'services' && <CinServices accent={accent} creators={creators} brands={brands} managed={managed} subBrandClients={subBrandClients} services={services} />}
        {route.name === 'about' && <CinAbout accent={accent} links={links} subBrands={subBrands} />}
        {route.name === 'contact' && <CinContact accent={accent} locations={locs} />}
        <CinFooter accent={accent} go={go} links={links} locations={locs} subBrands={subBrands} />
      </div>
    </div>
  );
}

function CinNav({ route, go, accent, team = TEAM, links = NAV_LINKS, subBrands = SUB_BRANDS }) {
  const [teamOpen, setTeamOpen] = React.useState(false);
  const closeTimer = React.useRef(null);
  const teamWrapRef = React.useRef(null);
  const openTeam = () => { clearTimeout(closeTimer.current); setTeamOpen(true); };
  const scheduleClose = () => { clearTimeout(closeTimer.current); closeTimer.current = setTimeout(() => setTeamOpen(false), 220); };
  React.useEffect(() => () => clearTimeout(closeTimer.current), []);
  // Touch / mobile: clicking outside the team dropdown should close it.
  React.useEffect(() => {
    if (!teamOpen) return;
    function onDocClick(e) {
      if (teamWrapRef.current && !teamWrapRef.current.contains(e.target)) setTeamOpen(false);
    }
    document.addEventListener('click', onDocClick);
    return () => document.removeEventListener('click', onDocClick);
  }, [teamOpen]);
  const items = [
    ['work',     { name: 'home' }],
    ['services', { name: 'services' }],
    ['about',    { name: 'about' }],
    ['contact',  { name: 'contact' }],
  ];
  const subBrandHrefs = subBrands.reduce((acc, b) => { acc[b.id] = links[b.id] || b.href; return acc; }, {});
  return (
    <header
      className="cin-nav-row"
      style={{
        position: 'absolute', top: 0, left: 0, right: 0, zIndex: 5,
        padding: '22px 36px', display: 'flex', alignItems: 'center', justifyContent: 'space-between',
        background: 'linear-gradient(180deg, rgba(10,6,6,.7) 0%, transparent 100%)',
      }}
    >
      <div style={{ display: 'flex', alignItems: 'baseline', gap: 28 }}>
        <button onClick={() => go({ name: 'home' })} style={{ all: 'unset', cursor: 'pointer', display: 'flex', alignItems: 'baseline', gap: 10 }}>
          <E id="nav.wordmark" style={{ fontFamily: '"Instrument Serif", "Newsreader", serif', fontSize: 28, letterSpacing: '.005em' }}>ARMATURE</E>
          <span style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 9.5, letterSpacing: '.18em', color: CIN.inkDim, textTransform: 'uppercase' }}>
            ®&nbsp;&nbsp;<E id="nav.tagline">est. 2024</E>
          </span>
        </button>
        <span style={{ width: 1, height: 18, background: CIN.rule, alignSelf: 'center' }} />
        <div className="cin-nav-links" style={{ display: 'flex', gap: 18, fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.16em', textTransform: 'uppercase' }}>
          {subBrands.map(b => (
            <a key={b.id} href={subBrandHrefs[b.id] || b.href} target="_blank" rel="noopener" style={{
              color: CIN.inkMute, textDecoration: 'none', display: 'inline-flex', alignItems: 'baseline', gap: 6,
            }}>
              <span style={{ width: 5, height: 5, borderRadius: '50%', background: accent, display: 'inline-block', alignSelf: 'center' }} />
              {b.name}
              <span style={{ color: CIN.inkDim, fontSize: 9 }}>↗</span>
            </a>
          ))}
        </div>
      </div>

      <nav className="cin-nav-links" style={{ display: 'flex', gap: 24, alignItems: 'center' }}>
        {items.map(([label, target]) => {
          const active = route.name === target.name;
          return (
            <button key={label} onClick={() => go(target)} style={{
              all: 'unset', cursor: 'pointer', position: 'relative',
              fontFamily: '"JetBrains Mono", monospace',
              fontSize: 11.5, letterSpacing: '.08em', textTransform: 'uppercase',
              color: active ? accent : CIN.ink, paddingBottom: 4,
            }}>
              {label}
              {active && <span style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: 1, background: accent }} />}
            </button>
          );
        })}
        {/* STORE — external Shopify link */}
        <a href={links.store || NAV_LINKS.store} target="_blank" rel="noopener" style={{
          textDecoration: 'none', position: 'relative',
          fontFamily: '"JetBrains Mono", monospace',
          fontSize: 11.5, letterSpacing: '.08em', textTransform: 'uppercase',
          color: CIN.ink, paddingBottom: 4,
          display: 'inline-flex', alignItems: 'baseline', gap: 5,
        }}>
          <E id="nav.store">store</E><span style={{ color: accent, fontSize: 9 }}>↗</span>
        </a>
        {/* TEAM dropdown */}
        <div
          ref={teamWrapRef}
          onMouseEnter={openTeam}
          onMouseLeave={scheduleClose}
          style={{ position: 'relative' }}
        >
          <button
            onClick={(e) => { e.stopPropagation(); setTeamOpen(o => !o); }}
            style={{
            all: 'unset', cursor: 'pointer', position: 'relative',
            fontFamily: '"JetBrains Mono", monospace',
            fontSize: 11.5, letterSpacing: '.08em', textTransform: 'uppercase',
            color: route.name === 'team' ? accent : CIN.ink, paddingBottom: 4,
            display: 'inline-flex', alignItems: 'center', gap: 6,
          }}>
            team <span style={{ fontSize: 8, opacity: .7 }}>{teamOpen ? '▴' : '▾'}</span>
            {route.name === 'team' && <span style={{ position: 'absolute', left: 0, right: 14, bottom: 0, height: 1, background: accent }} />}
          </button>
          {teamOpen && (
            <div
              onMouseEnter={openTeam}
              onMouseLeave={scheduleClose}
              style={{
                /* No gap between trigger and panel: paddingTop spans the
                   space so the mouse never crosses an inert region. */
                position: 'absolute', top: '100%', right: 0,
                paddingTop: 12,
                minWidth: 300, zIndex: 20,
              }}>
              <div style={{
                background: CIN.bgRaise,
                border: '1px solid ' + CIN.rule,
                padding: 8,
                boxShadow: '0 18px 48px rgba(0,0,0,.6)',
              }}>
              <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 9.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', padding: '6px 10px 10px' }}>
                The studio · {String(team.length).padStart(2, '0')} members
              </div>
              {team.map((m) => (
                <button
                  key={m.id}
                  onClick={() => { go({ name: 'team', id: m.id }); setTeamOpen(false); }}
                  style={{
                    all: 'unset', cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 12,
                    padding: '10px 10px', width: '100%', borderRadius: 2,
                  }}
                  onMouseEnter={(e) => e.currentTarget.style.background = 'rgba(168,32,44,.12)'}
                  onMouseLeave={(e) => e.currentTarget.style.background = 'transparent'}
                >
                  <span style={{
                    width: 28, height: 28, borderRadius: '50%', flexShrink: 0,
                    background: m.portrait
                      ? `#0a0606 url(${m.portrait}) center/cover no-repeat`
                      : placeholderBg(m.hue, true),
                  }} />
                  <span style={{ flex: 1 }}>
                    <span style={{ fontFamily: '"Instrument Serif", serif', fontSize: 18, display: 'block', lineHeight: 1.1 }}>{m.name}</span>
                    <span style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 9.5, letterSpacing: '.14em', color: CIN.inkDim, textTransform: 'uppercase' }}>{m.title}</span>
                  </span>
                  <span style={{ color: accent, fontSize: 12 }}>→</span>
                </button>
              ))}
              </div>
            </div>
          )}
        </div>
      </nav>
    </header>
  );
}

function CinHome({ projects, accent, dense, showreelId, showreelSource = 'vimeo', workFilters, go, team = TEAM, links = NAV_LINKS, subBrands = SUB_BRANDS, homePhotos = [] }) {
  const filters = (Array.isArray(workFilters) && workFilters.length)
    ? workFilters
    : ['all', 'cinesteel', 'fullmetal', 'brand film', 'documentary'];
  const [activeFilter, setActiveFilter] = React.useState(filters[0]);
  React.useEffect(() => { setActiveFilter(filters[0]); }, [filters.join('|')]);
  const filtered = (activeFilter && activeFilter.toLowerCase() !== 'all')
    ? projects.filter(p => {
        const tokens = [p.brand, p.tag, p.client].filter(Boolean).map(s => String(s).toLowerCase());
        const needle = String(activeFilter).toLowerCase();
        return tokens.some(t => t.includes(needle) || needle.includes(t));
      })
    : projects;
  const showreelSrc = showreelSource === 'youtube'
    ? youTubeEmbed(showreelId, { background: true })
    : vimeoEmbed(showreelId, { background: true });
  return (
    <>
      {/* HERO — full-bleed showreel */}
      <section className="cin-hero" style={{ position: 'relative', height: 760, overflow: 'hidden', background: '#000' }}>
        <iframe
          className="cin-hero-iframe"
          src={showreelSrc}
          style={{ position: 'absolute', top: '50%', left: '50%', width: '178vh', minWidth: '100%', height: '56.25vw', minHeight: '100%', transform: 'translate(-50%,-50%)', border: 0, pointerEvents: 'none' }}
          allow="autoplay; fullscreen"
        />
        <div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(180deg, rgba(10,6,6,.35) 0%, rgba(10,6,6,.1) 40%, rgba(10,6,6,.92) 100%)' }} />
        <div style={{ position: 'absolute', left: 36, right: 36, bottom: 76, display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end' }}>
          <div>
            <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.22em', color: CIN.inkMute, textTransform: 'uppercase', marginBottom: 14 }}>
              <span style={{ color: accent }}>●</span>&nbsp;&nbsp;<E id="hero.label">Showreel · 2026</E>
            </div>
            <E as="h1" id="hero.title" className="cin-hero-title" style={{
              fontFamily: '"Instrument Serif", "Newsreader", serif',
              fontSize: 124, lineHeight: .9, fontWeight: 400,
              margin: 0, letterSpacing: '-.018em', textWrap: 'balance', maxWidth: 1100,
              display: 'block',
            }}>Films forged in iron & light.</E>
          </div>
          <div style={{ display: 'flex', gap: 14, alignItems: 'center', fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.12em', color: CIN.ink, textTransform: 'uppercase' }}>
            <span style={{ display: 'inline-block', width: 8, height: 8, borderRadius: '50%', background: accent }} />
            <E id="hero.reel-cta">Play reel</E><span style={{ color: CIN.inkDim }}>·</span><E id="hero.reel-runtime" style={{ color: CIN.inkDim }}>04:32</E>
          </div>
        </div>
        {/* Sub-brand strip */}
        <div style={{
          position: 'absolute', left: 0, right: 0, bottom: 0,
          padding: '14px 36px', display: 'flex', justifyContent: 'space-between', alignItems: 'center',
          borderTop: '1px solid rgba(240,232,220,.18)',
          background: 'rgba(10,6,6,.55)', backdropFilter: 'blur(6px)',
          fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.16em', textTransform: 'uppercase',
        }}>
          <E id="hero.subtext" style={{ color: CIN.inkDim }}>A studio of two practices →</E>
          <div style={{ display: 'flex', gap: 36 }}>
            {subBrands.map(b => (
              <a key={b.id} href={links[b.id] || b.href} target="_blank" rel="noopener" style={{ color: CIN.ink, textDecoration: 'none', display: 'inline-flex', gap: 8, alignItems: 'baseline' }}>
                {b.name}<span style={{ color: accent, fontSize: 9 }}>↗</span>
              </a>
            ))}
          </div>
        </div>
      </section>

      {/* WORK GRID — scrolls into view below the reel */}
      <section className="cin-section-pad" style={{ padding: '72px 36px 28px', display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end', borderBottom: '1px solid ' + CIN.rule }}>
        <div>
          <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', marginBottom: 18 }}>
            <E id="work.eyebrow">Index</E> — {String(filtered.length).padStart(3, '0')} <E id="work.eyebrowSuffix">selected films</E>
          </div>
          <E as="h2" id="work.title" className="cin-section-title" style={{ fontFamily: '"Instrument Serif", serif', fontSize: 64, lineHeight: 1, margin: 0, fontWeight: 400, letterSpacing: '-.012em', display: 'block' }}>All work.</E>
        </div>
        <div style={{ display: 'flex', gap: 8, fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.12em', textTransform: 'uppercase' }}>
          {filters.map((f) => {
            const isActive = f === activeFilter;
            return (
              <button key={f} onClick={() => setActiveFilter(f)} style={{
                all: 'unset', cursor: 'pointer', padding: '6px 12px', borderRadius: 999,
                border: '1px solid ' + (isActive ? CIN.ink : CIN.rule),
                color: isActive ? CIN.ink : CIN.inkMute,
              }}>{f}</button>
            );
          })}
        </div>
      </section>

      {/* GRID — uniform tiles, hover reveals title */}
      <section className="cin-section-pad" style={{ padding: '36px 36px 96px' }}>
        <div className="cin-grid-work" style={{
          display: 'grid',
          gridTemplateColumns: dense ? 'repeat(4, 1fr)' : 'repeat(3, 1fr)',
          gap: dense ? 10 : 14,
        }}>
          {filtered.map((p, i) => (
            <WorkTile key={p.id} project={p} index={i} accent={accent} onClick={() => go({ name: 'project', id: p.id })} />
          ))}
        </div>
      </section>

      {/* CAMPAIGNS / PRODUCTION PHOTOS */}
      <HomeCampaigns photos={homePhotos} accent={accent} />

      {/* SUB-BRAND BLOCK */}
      <section className="cin-section-pad" style={{ padding: '80px 36px', borderTop: '1px solid ' + CIN.rule, background: CIN.bgSoft }}>
        <div className="cin-grid-contact" style={{ display: 'grid', gridTemplateColumns: '1fr 2.5fr', gap: 48, marginBottom: 48 }}>
          <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase' }}>
            ❖ &nbsp;<E id="brands.eyebrow">Studio system</E>
          </div>
          <E as="h2" id="brands.title" className="cin-section-title" style={{ fontFamily: '"Instrument Serif", serif', fontSize: 64, lineHeight: 1, margin: 0, fontWeight: 400, letterSpacing: '-.01em', textWrap: 'balance', display: 'block' }}>ARMATURE is the frame behind two practices.</E>
        </div>
        <div className="cin-grid-2" style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 18 }}>
          {subBrands.map((b, i) => (
            <a key={b.id || i} href={links[b.id] || b.href} target="_blank" rel="noopener" style={{
              padding: '36px 28px', border: '1px solid ' + CIN.rule, borderRadius: 2,
              background: 'rgba(168,32,44,.04)', position: 'relative', textDecoration: 'none', color: 'inherit',
              display: 'block',
            }}>
              <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline' }}>
                <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10, letterSpacing: '.2em', color: CIN.inkDim, textTransform: 'uppercase' }}>
                  {String(i + 1).padStart(2, '0')} / {String(subBrands.length).padStart(2, '0')}
                </div>
                <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10, letterSpacing: '.16em', color: accent, textTransform: 'uppercase' }}>
                  visit ↗
                </div>
              </div>
              <div style={{ fontFamily: '"Instrument Serif", serif', fontSize: 56, fontWeight: 400, marginTop: 24, letterSpacing: '-.01em' }}>{b.name}</div>
              <div style={{ fontSize: 14, lineHeight: 1.55, color: CIN.inkMute, marginTop: 12, maxWidth: 420 }}>{b.tagline}</div>
              <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.14em', color: CIN.inkDim, textTransform: 'uppercase', marginTop: 32 }}>
                {b.focus}
              </div>
            </a>
          ))}
        </div>
      </section>

      {/* TEAM PREVIEW */}
      <section className="cin-section-pad" style={{ padding: '96px 36px' }}>
        <div style={{ borderTop: '1px solid ' + CIN.rule, paddingTop: 32, display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end', marginBottom: 36 }}>
          <E as="h2" id="team.title" className="cin-section-title" style={{ fontFamily: '"Instrument Serif", serif', fontSize: 56, lineHeight: 1, margin: 0, fontWeight: 400, letterSpacing: '-.012em', display: 'block' }}>The studio.</E>
          <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.18em', color: CIN.inkDim, textTransform: 'uppercase' }}>
            {String(team.length).padStart(2, '0')} <E id="team.subtitle">members · click for credits</E>
          </div>
        </div>
        <div className="cin-grid-team" style={{ display: 'grid', gridTemplateColumns: `repeat(${Math.min(team.length, 6)}, 1fr)`, gap: 12 }}>
          {team.map(m => (
            <button key={m.id} onClick={() => go({ name: 'team', id: m.id })} style={{
              all: 'unset', cursor: 'pointer', display: 'block',
            }}>
              <div style={{
                aspectRatio: '3/4', position: 'relative',
                background: m.portrait
                  ? `#0a0606 url(${m.portrait}) center/cover no-repeat`
                  : placeholderBg(m.hue, true),
              }}>
                <div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(180deg, transparent 50%, rgba(0,0,0,.7))' }} />
                {m.link && (
                  <a
                    href={m.link}
                    target="_blank"
                    rel="noopener"
                    onClick={(e) => e.stopPropagation()}
                    title={'Visit ' + (m.name || 'link')}
                    style={{
                      position: 'absolute', top: 10, right: 10,
                      width: 28, height: 28, borderRadius: 2,
                      display: 'flex', alignItems: 'center', justifyContent: 'center',
                      background: 'rgba(10,6,6,.6)', color: CIN.ink,
                      fontFamily: '"JetBrains Mono", monospace', fontSize: 13,
                      textDecoration: 'none', border: '1px solid rgba(240,232,220,.18)',
                    }}
                  >↗</a>
                )}
                <div style={{ position: 'absolute', left: 12, bottom: 12, right: 12, color: CIN.ink }}>
                  <div style={{ fontFamily: '"Instrument Serif", serif', fontSize: 20, lineHeight: 1.05 }}>{m.name}</div>
                  <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 9, letterSpacing: '.14em', color: CIN.inkMute, textTransform: 'uppercase', marginTop: 4 }}>{m.title}</div>
                </div>
              </div>
            </button>
          ))}
        </div>
      </section>
    </>
  );
}

function WorkTile({ project, index, accent, onClick }) {
  return (
    <HoverPreview
      project={project}
      style={{ aspectRatio: '4/3', borderRadius: 2, position: 'relative' }}
      onClick={onClick}
    >
      {/* hover-only title overlay */}
      <div className="work-title-overlay" style={{
        position: 'absolute', inset: 0,
        background: 'linear-gradient(180deg, rgba(10,6,6,.2) 0%, rgba(10,6,6,.85) 100%)',
        opacity: 0, transition: 'opacity .25s ease', pointerEvents: 'none',
        display: 'flex', flexDirection: 'column', justifyContent: 'flex-end',
        padding: 22,
      }}>
        <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10, letterSpacing: '.2em', color: accent, textTransform: 'uppercase' }}>
          {String(index + 1).padStart(3, '0')} · {project.brand}
        </div>
        <div style={{ fontFamily: '"Instrument Serif", serif', fontSize: 36, lineHeight: 1, marginTop: 10, color: CIN.ink, letterSpacing: '-.005em' }}>
          {project.title}
        </div>
        <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.14em', color: CIN.inkMute, textTransform: 'uppercase', marginTop: 8 }}>
          {project.client} · {project.tag} · {project.year}
        </div>
      </div>
      <style>{`
        [data-tile="${project.id}"]:hover .work-title-overlay { opacity: 1; }
      `}</style>
      <span data-tile={project.id} style={{ position: 'absolute', inset: 0 }} onMouseOver={(e) => {
        const o = e.currentTarget.parentElement.querySelector('.work-title-overlay');
        if (o) o.style.opacity = '1';
      }} onMouseOut={(e) => {
        const o = e.currentTarget.parentElement.querySelector('.work-title-overlay');
        if (o) o.style.opacity = '0';
      }} />
    </HoverPreview>
  );
}

// ─── TEAM MEMBER · project grid + lightbox ──────────────────────────────────
function CinTeamMember({ member, projects, accent, go }) {
  const memberProjects = (member.projects || []).map(mp => {
    if (mp.projectId) {
      const p = projects.find(x => x.id === mp.projectId);
      return p ? { ...p, memberRole: mp.role } : null;
    }
    return { ...mp, memberRole: mp.role || mp.memberRole, hue: mp.hue ?? 0 };
  }).filter(Boolean);
  const [videoBox, setVideoBox] = React.useState(null);
  const activeVideo = videoBox != null ? memberProjects[videoBox] : null;

  React.useEffect(() => {
    if (videoBox == null) return;
    const onKey = (e) => {
      if (e.key === 'Escape') setVideoBox(null);
      if (e.key === 'ArrowRight') setVideoBox(v => v == null ? null : (v + 1) % memberProjects.length);
      if (e.key === 'ArrowLeft')  setVideoBox(v => v == null ? null : (v - 1 + memberProjects.length) % memberProjects.length);
    };
    document.addEventListener('keydown', onKey);
    return () => document.removeEventListener('keydown', onKey);
  }, [videoBox, memberProjects.length]);

  return (
    <>
      <section style={{ padding: '120px 36px 48px' }}>
        <button onClick={() => go({ name: 'home' })} style={{
          all: 'unset', cursor: 'pointer', fontFamily: '"JetBrains Mono", monospace',
          fontSize: 10.5, letterSpacing: '.18em', color: CIN.inkMute, textTransform: 'uppercase', marginBottom: 24, display: 'inline-block',
        }}><E id="team-detail.back">← back</E></button>
        <div className="cin-grid-contact" style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: 36, alignItems: 'end' }}>
          <div className="cin-member-portrait" style={{
            width: 240, aspectRatio: '3/4', borderRadius: 2, position: 'relative',
            background: member.portrait
              ? `#0a0606 url(${member.portrait}) center/cover no-repeat`
              : placeholderBg(member.hue, true),
          }}>
            {!member.portrait && (
              <div style={{ position: 'absolute', left: 12, bottom: 12, fontFamily: '"JetBrains Mono", monospace', fontSize: 9.5, letterSpacing: '.18em', color: CIN.inkDim, textTransform: 'uppercase' }}>
                <E id="team-detail.portrait-label">portrait</E>
              </div>
            )}
          </div>
          <div>
            <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', marginBottom: 18 }}>
              <E id="team-detail.eyebrow">The studio</E> · {member.title}
            </div>
            <h1 className="cin-member-name" style={{ fontFamily: '"Instrument Serif", serif', fontSize: 124, lineHeight: .92, fontWeight: 400, margin: 0, letterSpacing: '-.018em' }}>
              {member.name}<span style={{ color: accent }}>.</span>
            </h1>
            {member.alias && (
              <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 13, letterSpacing: '.16em', color: CIN.inkMute, textTransform: 'uppercase', marginTop: 10 }}>
                aka {member.alias}
              </div>
            )}
            <p style={{ marginTop: 24, fontSize: 16, lineHeight: 1.6, color: CIN.inkMute, maxWidth: 660 }}>{member.bio}</p>
          </div>
        </div>
      </section>

      {/* VIDEO GRID */}
      {memberProjects.length > 0 && (
        <section style={{ padding: '32px 36px 48px' }}>
          <div style={{ borderTop: '1px solid ' + CIN.rule, paddingTop: 24, display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', marginBottom: 24 }}>
            <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase' }}>
              <E id="team-detail.credits-label">Selected credits</E> · {String(memberProjects.length).padStart(2, '0')}
            </div>
          </div>
          <div className="cin-grid-photos" style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 14 }}>
            {memberProjects.map((p, i) => (
              <HoverPreview
                key={p.id}
                project={p}
                style={{ aspectRatio: '4/3', borderRadius: 2, position: 'relative' }}
                onClick={() => setVideoBox(i)}
              >
                <div className="work-title-overlay" style={{
                  position: 'absolute', inset: 0,
                  background: 'linear-gradient(180deg, rgba(10,6,6,.2) 0%, rgba(10,6,6,.85) 100%)',
                  opacity: 0, transition: 'opacity .25s ease', pointerEvents: 'none',
                  display: 'flex', flexDirection: 'column', justifyContent: 'flex-end',
                  padding: 18,
                }}>
                  <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10, letterSpacing: '.2em', color: accent, textTransform: 'uppercase' }}>
                    {String(i + 1).padStart(3, '0')} · {p.brand}
                  </div>
                  <div style={{ fontFamily: '"Instrument Serif", serif', fontSize: 22, lineHeight: 1.1, marginTop: 6, color: CIN.ink }}>
                    {p.customTitle || p.title}
                  </div>
                  <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 9.5, letterSpacing: '.14em', color: CIN.inkMute, textTransform: 'uppercase', marginTop: 6 }}>
                    {(p.customClient || p.client)} · {p.tag} · {p.year}{p.memberRole ? ' · ' + p.memberRole : ''}
                  </div>
                </div>
                <span style={{ position: 'absolute', inset: 0 }} onMouseOver={(e) => {
                  const o = e.currentTarget.parentElement.querySelector('.work-title-overlay');
                  if (o) o.style.opacity = '1';
                }} onMouseOut={(e) => {
                  const o = e.currentTarget.parentElement.querySelector('.work-title-overlay');
                  if (o) o.style.opacity = '0';
                }} />
              </HoverPreview>
            ))}
          </div>
        </section>
      )}

      {/* VIDEO LIGHTBOX */}
      {activeVideo && (
        <div onClick={() => setVideoBox(null)} style={{
          position: 'fixed', inset: 0, zIndex: 5000,
          background: 'rgba(10,6,6,.94)',
          display: 'flex', alignItems: 'center', justifyContent: 'center',
          padding: 48, cursor: 'zoom-out',
        }}>
          <div onClick={(e) => e.stopPropagation()} style={{ width: '100%', maxWidth: 1200, position: 'relative' }}>
            <div style={{ position: 'relative', aspectRatio: '16/9', background: '#000', overflow: 'hidden' }}>
              {projectIsYouTube(activeVideo) ? (
                <iframe
                  src={videoEmbedFor(activeVideo, { autoplay: true, muted: false, controls: true })}
                  style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', border: 0 }}
                  allow="autoplay; fullscreen; picture-in-picture" allowFullScreen
                />
              ) : (
                <iframe
                  src={videoEmbedFor(activeVideo, { background: true })}
                  style={{ position: 'absolute', top: '50%', left: '50%', width: '178%', height: '178%', transform: 'translate(-50%,-50%)', border: 0, pointerEvents: 'none' }}
                  allow="autoplay; fullscreen"
                />
              )}
            </div>
            <div style={{
              display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end',
              marginTop: 18, gap: 24,
            }}>
              <div>
                <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: accent, textTransform: 'uppercase', marginBottom: 8 }}>
                  {activeVideo.brand} · {activeVideo.year}
                </div>
                <h2 style={{ fontFamily: '"Instrument Serif", serif', fontSize: 42, lineHeight: 1, fontWeight: 400, margin: 0, letterSpacing: '-.01em', color: CIN.ink }}>
                  {activeVideo.customTitle || activeVideo.title}
                  <span style={{ fontStyle: 'italic', color: accent }}> — {(activeVideo.customClient || activeVideo.client).toLowerCase()}.</span>
                </h2>
              </div>
              <div style={{ textAlign: 'right', flexShrink: 0 }}>
                <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.18em', color: CIN.inkDim, textTransform: 'uppercase' }}>
                  {member.name.split(' ')[0]}'s role
                </div>
                <div style={{ fontFamily: '"Instrument Serif", serif', fontSize: 22, fontStyle: 'italic', color: CIN.ink, marginTop: 4 }}>
                  {activeVideo.memberRole}
                </div>
              </div>
            </div>
          </div>
          <button onClick={(e) => { e.stopPropagation(); setVideoBox((videoBox - 1 + memberProjects.length) % memberProjects.length); }} style={{
            position: 'absolute', left: 24, top: '50%', transform: 'translateY(-50%)',
            all: 'unset', cursor: 'pointer', color: CIN.inkMute, fontSize: 28, padding: 16,
          }}>←</button>
          <button onClick={(e) => { e.stopPropagation(); setVideoBox((videoBox + 1) % memberProjects.length); }} style={{
            position: 'absolute', right: 24, top: '50%', transform: 'translateY(-50%)',
            all: 'unset', cursor: 'pointer', color: CIN.inkMute, fontSize: 28, padding: 16,
          }}>→</button>
          <div style={{
            position: 'absolute', left: 0, right: 0, bottom: 24, textAlign: 'center',
            fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.2em', color: CIN.inkMute, textTransform: 'uppercase',
          }}>
            {String(videoBox + 1).padStart(2, '0')} / {String(memberProjects.length).padStart(2, '0')} · esc to close · ← →
          </div>
        </div>
      )}

      {/* CREDIT LIST */}
      <section style={{ padding: '64px 36px 96px' }}>
        <div style={{ borderTop: '1px solid ' + CIN.rule, paddingTop: 24, fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', marginBottom: 18 }}>
          <E id="team-detail.full-credits">Full credit list</E>
        </div>
        {memberProjects.map((p, i) => (
          <button key={p.id} onClick={() => setVideoBox(i)} style={{
            all: 'unset', cursor: 'pointer', width: '100%',
            display: 'grid', gridTemplateColumns: '60px 2fr 1.5fr 1fr 60px',
            padding: '18px 0', borderBottom: '1px solid ' + CIN.rule, alignItems: 'baseline',
            background: videoBox === i ? 'rgba(168,32,44,.06)' : 'transparent',
          }}>
            <span style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 11, color: videoBox === i ? accent : CIN.inkMute, letterSpacing: '.06em' }}>
              {String(i + 1).padStart(3, '0')}
            </span>
            <span style={{ fontFamily: '"Instrument Serif", serif', fontSize: 32, fontStyle: videoBox === i ? 'italic' : 'normal', color: videoBox === i ? accent : CIN.ink }}>
              {p.customTitle || p.title}
            </span>
            <span style={{ fontSize: 14, color: CIN.ink }}>{p.customClient || p.client}</span>
            <span style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.14em', color: CIN.inkMute, textTransform: 'uppercase' }}>
              {p.memberRole}
            </span>
            <span style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 11, color: CIN.inkMute, textAlign: 'right' }}>{p.year}</span>
          </button>
        ))}
      </section>

      {/* PHOTOGRAPHY */}
      {Array.isArray(member.photos) && member.photos.length > 0 && (
        <MemberPhotography photos={member.photos} accent={accent} memberName={member.name} />
      )}

      <LetsWorkBlock member={member} accent={accent} />
    </>
  );
}

// Editorial photo grid + lightbox for a team member's gallery.
function MemberPhotography({ photos, accent, memberName }) {
  const [lightbox, setLightbox] = React.useState(null);
  const touchX = React.useRef(null);
  React.useEffect(() => {
    if (!lightbox) return;
    const onKey = (e) => {
      if (e.key === 'Escape') setLightbox(null);
      if (e.key === 'ArrowRight') setLightbox(l => l == null ? null : (l + 1) % photos.length);
      if (e.key === 'ArrowLeft')  setLightbox(l => l == null ? null : (l - 1 + photos.length) % photos.length);
    };
    document.addEventListener('keydown', onKey);
    return () => document.removeEventListener('keydown', onKey);
  }, [lightbox, photos.length]);

  return (
    <section style={{ padding: '32px 36px 64px' }}>
      <div style={{
        borderTop: '1px solid ' + CIN.rule, paddingTop: 32,
        display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', marginBottom: 28,
      }}>
        <E as="h2" id="team-detail.photography-title" style={{ fontFamily: '"Instrument Serif", serif', fontSize: 56, lineHeight: 1, margin: 0, fontWeight: 400, letterSpacing: '-.012em', display: 'block' }}>Photography.</E>
        <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.18em', color: CIN.inkDim, textTransform: 'uppercase' }}>
          {String(photos.length).padStart(2, '0')} <E id="team-detail.photography-meta">selected frames</E>
        </div>
      </div>

      <div className="cin-grid-photos" style={{
        display: 'grid',
        gridTemplateColumns: 'repeat(3, 1fr)',
        gridAutoFlow: 'dense',
        gap: 12,
      }}>
        {photos.slice(0, 6).map((p, i) => {
          // Vary tile size for an editorial rhythm.
          const span = (i % 7 === 0 || i % 7 === 4) ? 2 : 1;
          return (
            <button key={p.id || i} onClick={() => setLightbox(i)} style={{
              all: 'unset', cursor: 'zoom-in',
              gridColumn: 'span ' + span,
              aspectRatio: span === 2 ? '3/2' : '4/5',
              background: p.src ? `#0a0606 url(${p.src}) center/cover no-repeat` : 'rgba(168,32,44,.18)',
              position: 'relative', overflow: 'hidden',
            }} title={p.caption || p.alt || ''}>
              {p.caption && (
                <div style={{
                  position: 'absolute', left: 0, right: 0, bottom: 0,
                  padding: '14px 16px',
                  background: 'linear-gradient(180deg, transparent 0%, rgba(10,6,6,.8) 100%)',
                  fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.14em', color: '#f0e8dc', textTransform: 'uppercase',
                  opacity: 0, transition: 'opacity .22s ease',
                }}
                onMouseEnter={(e) => e.currentTarget.style.opacity = '1'}
                onMouseLeave={(e) => e.currentTarget.style.opacity = '0'}
                >{p.caption}{p.year ? ' · ' + p.year : ''}</div>
              )}
            </button>
          );
        })}
        {photos.length > 6 && (
          <button onClick={() => setLightbox(6)} style={{
            all: 'unset', cursor: 'zoom-in',
            gridColumn: 'span 1',
            aspectRatio: '4/5',
            background: 'rgba(240,232,220,.04)',
            border: '1px solid ' + CIN.rule,
            position: 'relative', overflow: 'hidden',
            display: 'flex', alignItems: 'center', justifyContent: 'center',
            flexDirection: 'column', gap: 8,
          }}>
            <span style={{ fontFamily: '"Instrument Serif", serif', fontSize: 36, color: CIN.ink, lineHeight: 1 }}>+{photos.length - 6}</span>
            <span style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10, letterSpacing: '.16em', color: CIN.inkMute, textTransform: 'uppercase' }}>view all</span>
          </button>
        )}
      </div>

      {lightbox != null && photos[lightbox] && (
        <div onClick={() => setLightbox(null)}
          onTouchStart={(e) => { touchX.current = e.touches[0].clientX; }}
          onTouchEnd={(e) => {
            if (touchX.current == null) return;
            const dx = e.changedTouches[0].clientX - touchX.current;
            touchX.current = null;
            if (Math.abs(dx) < 40) return;
            setLightbox(l => l == null ? null : (dx > 0
              ? (l - 1 + photos.length) % photos.length
              : (l + 1) % photos.length));
          }}
          style={{
          position: 'fixed', inset: 0, zIndex: 5000,
          background: 'rgba(10,6,6,.94)',
          display: 'flex', alignItems: 'center', justifyContent: 'center',
          padding: 48, cursor: 'zoom-out',
        }}>
          <img
            src={photos[lightbox].src}
            alt={photos[lightbox].alt || photos[lightbox].caption || ''}
            style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain', boxShadow: '0 40px 120px rgba(0,0,0,.6)' }}
          />
          <div style={{
            position: 'absolute', left: 0, right: 0, bottom: 24, textAlign: 'center',
            fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.2em', color: CIN.inkMute, textTransform: 'uppercase',
          }}>
            {photos[lightbox].caption || memberName} · {String(lightbox + 1).padStart(2, '0')} / {String(photos.length).padStart(2, '0')} · esc · ← → · swipe
          </div>
          <button onClick={(e) => { e.stopPropagation(); setLightbox((lightbox - 1 + photos.length) % photos.length); }} style={{
            position: 'absolute', left: 24, top: '50%', transform: 'translateY(-50%)',
            all: 'unset', cursor: 'pointer', color: CIN.inkMute, fontSize: 28, padding: 16,
          }}>←</button>
          <button onClick={(e) => { e.stopPropagation(); setLightbox((lightbox + 1) % photos.length); }} style={{
            position: 'absolute', right: 24, top: '50%', transform: 'translateY(-50%)',
            all: 'unset', cursor: 'pointer', color: CIN.inkMute, fontSize: 28, padding: 16,
          }}>→</button>
        </div>
      )}
    </section>
  );
}

// Home-page campaign / production-photo grid + lightbox.
// Returns null when no photos have been added (section hidden by default).
function HomeCampaigns({ photos, accent }) {
  const [lightbox, setLightbox] = React.useState(null);
  const touchX = React.useRef(null);
  React.useEffect(() => {
    if (lightbox == null) return;
    const onKey = (e) => {
      if (e.key === 'Escape')     setLightbox(null);
      if (e.key === 'ArrowRight') setLightbox(l => l == null ? null : (l + 1) % photos.length);
      if (e.key === 'ArrowLeft')  setLightbox(l => l == null ? null : (l - 1 + photos.length) % photos.length);
    };
    document.addEventListener('keydown', onKey);
    return () => document.removeEventListener('keydown', onKey);
  }, [lightbox, photos.length]);

  if (!photos || !photos.length) return null;
  const preview = photos.slice(0, 9);

  return (
    <section className="cin-section-pad" style={{ padding: '80px 36px 96px', borderTop: '1px solid ' + CIN.rule }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end', marginBottom: 36 }}>
        <div>
          <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', marginBottom: 14 }}>
            <E id="campaigns.eyebrow">Production</E> — {String(photos.length).padStart(2, '0')} <E id="campaigns.eyebrowSuffix">campaigns</E>
          </div>
          <E as="h2" id="campaigns.title" className="cin-section-title" style={{ fontFamily: '"Instrument Serif", serif', fontSize: 64, lineHeight: 1, margin: 0, fontWeight: 400, letterSpacing: '-.012em', display: 'block' }}>Campaigns.</E>
        </div>
      </div>
      <div className="cin-grid-photos" style={{
        display: 'grid',
        gridTemplateColumns: 'repeat(3, 1fr)',
        gridAutoFlow: 'dense',
        gap: 14,
      }}>
        {preview.map((p, i) => {
          const span = (i % 7 === 0 || i % 7 === 5) ? 2 : 1;
          return (
            <button key={p.id || i} onClick={() => setLightbox(i)} style={{
              all: 'unset', cursor: 'zoom-in',
              gridColumn: 'span ' + span,
              aspectRatio: span === 2 ? '3/2' : '4/5',
              background: p.src ? `#0a0606 url(${p.src}) center/cover no-repeat` : 'rgba(168,32,44,.18)',
              position: 'relative', overflow: 'hidden', borderRadius: 2,
            }} title={p.caption || p.alt || ''}>
              {p.caption && (
                <div style={{
                  position: 'absolute', left: 0, right: 0, bottom: 0,
                  padding: '14px 18px',
                  background: 'linear-gradient(180deg, transparent 0%, rgba(10,6,6,.8) 100%)',
                  fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.14em', color: CIN.ink, textTransform: 'uppercase',
                  opacity: 0, transition: 'opacity .22s ease',
                }}
                onMouseEnter={(e) => e.currentTarget.style.opacity = '1'}
                onMouseLeave={(e) => e.currentTarget.style.opacity = '0'}
                >{p.caption}{p.year ? ' · ' + p.year : ''}</div>
              )}
            </button>
          );
        })}
        {photos.length > 9 && (
          <button onClick={() => setLightbox(9)} style={{
            all: 'unset', cursor: 'zoom-in',
            gridColumn: 'span 1', aspectRatio: '4/5',
            background: 'rgba(240,232,220,.04)', border: '1px solid ' + CIN.rule, borderRadius: 2,
            display: 'flex', alignItems: 'center', justifyContent: 'center',
            flexDirection: 'column', gap: 8,
          }}>
            <span style={{ fontFamily: '"Instrument Serif", serif', fontSize: 36, color: CIN.ink, lineHeight: 1 }}>+{photos.length - 9}</span>
            <span style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10, letterSpacing: '.16em', color: CIN.inkMute, textTransform: 'uppercase' }}>view all</span>
          </button>
        )}
      </div>

      {lightbox != null && photos[lightbox] && (
        <div onClick={() => setLightbox(null)}
          onTouchStart={(e) => { touchX.current = e.touches[0].clientX; }}
          onTouchEnd={(e) => {
            if (touchX.current == null) return;
            const dx = e.changedTouches[0].clientX - touchX.current;
            touchX.current = null;
            if (Math.abs(dx) < 40) return;
            setLightbox(l => l == null ? null : (dx > 0
              ? (l - 1 + photos.length) % photos.length
              : (l + 1) % photos.length));
          }}
          style={{
          position: 'fixed', inset: 0, zIndex: 5000,
          background: 'rgba(10,6,6,.94)',
          display: 'flex', alignItems: 'center', justifyContent: 'center',
          padding: 48, cursor: 'zoom-out',
        }}>
          <img
            src={photos[lightbox].src}
            alt={photos[lightbox].alt || photos[lightbox].caption || ''}
            style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain', boxShadow: '0 40px 120px rgba(0,0,0,.6)' }}
          />
          <div style={{
            position: 'absolute', left: 0, right: 0, bottom: 24, textAlign: 'center',
            fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.2em', color: CIN.inkMute, textTransform: 'uppercase',
          }}>
            {photos[lightbox].caption ? photos[lightbox].caption + ' · ' : ''}{String(lightbox + 1).padStart(2, '0')} / {String(photos.length).padStart(2, '0')} · esc · ← → · swipe
          </div>
          <button onClick={(e) => { e.stopPropagation(); setLightbox((lightbox - 1 + photos.length) % photos.length); }} style={{
            position: 'absolute', left: 24, top: '50%', transform: 'translateY(-50%)',
            all: 'unset', cursor: 'pointer', color: CIN.inkMute, fontSize: 28, padding: 16,
          }}>←</button>
          <button onClick={(e) => { e.stopPropagation(); setLightbox((lightbox + 1) % photos.length); }} style={{
            position: 'absolute', right: 24, top: '50%', transform: 'translateY(-50%)',
            all: 'unset', cursor: 'pointer', color: CIN.inkMute, fontSize: 28, padding: 16,
          }}>→</button>
        </div>
      )}
    </section>
  );
}

// Big editorial CTA at the bottom of every team member's page.
// Click once: copies the member's email to the clipboard and flashes
// "EMAIL COPIED — <email>" feedback. Click again: copies again.
// Falls back to a mailto: link if clipboard API is unavailable.
function LetsWorkBlock({ member, accent }) {
  const [copied, setCopied] = React.useState(false);
  const t = React.useRef(null);
  React.useEffect(() => () => clearTimeout(t.current), []);

  async function handleCopy() {
    const email = member.email || '';
    if (!email) {
      window.location.href = 'mailto:hello@armature.studio';
      return;
    }
    try {
      if (navigator.clipboard && navigator.clipboard.writeText) {
        await navigator.clipboard.writeText(email);
      } else {
        const ta = document.createElement('textarea');
        ta.value = email; ta.style.position = 'fixed'; ta.style.opacity = '0';
        document.body.appendChild(ta); ta.select();
        document.execCommand('copy');
        document.body.removeChild(ta);
      }
      setCopied(true);
      clearTimeout(t.current);
      t.current = setTimeout(() => setCopied(false), 2400);
    } catch {
      window.location.href = 'mailto:' + email;
    }
  }

  return (
    <section style={{ padding: '24px 36px 96px' }}>
      <button
        onClick={handleCopy}
        onMouseEnter={(e) => { e.currentTarget.style.background = accent; e.currentTarget.style.color = '#0a0606'; }}
        onMouseLeave={(e) => { e.currentTarget.style.background = 'transparent'; e.currentTarget.style.color = CIN.ink; }}
        style={{
          all: 'unset', cursor: 'pointer',
          display: 'flex', flexDirection: 'column',
          width: '100%', boxSizing: 'border-box',
          padding: '56px 48px',
          borderTop: '1px solid ' + CIN.rule,
          borderBottom: '1px solid ' + CIN.rule,
          background: 'transparent',
          transition: 'background .25s ease, color .25s ease',
          color: CIN.ink,
        }}
        title={member.email ? ('Copy ' + member.email) : 'Copy email'}
      >
        <div style={{
          display: 'flex', justifyContent: 'space-between', alignItems: 'baseline',
          fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', textTransform: 'uppercase',
          opacity: .7,
        }}>
          <span><E id="letswork.prefix">Work with</E> {member.name.split(' ')[0]}</span>
          <span style={{ color: copied ? accent : 'inherit', transition: 'color .15s' }}>
            {copied ? <E id="letswork.label-copied">✓ EMAIL COPIED</E> : <E id="letswork.label">CLICK TO COPY EMAIL ↗</E>}
          </span>
        </div>
        <div style={{
          fontFamily: '"Instrument Serif", serif',
          fontSize: 'clamp(96px, 14vw, 220px)',
          lineHeight: .9, letterSpacing: '-.02em',
          marginTop: 18, marginBottom: 4,
          textWrap: 'balance',
        }}>
          <E id="letswork.title-1">LET'S</E><span style={{ fontStyle: 'italic' }}> <E id="letswork.title-2">WORK</E></span><span style={{ color: copied ? accent : 'currentColor' }}>.</span>
        </div>
        <div style={{
          display: 'flex', justifyContent: 'space-between', alignItems: 'baseline',
          marginTop: 24,
          fontFamily: '"JetBrains Mono", monospace', fontSize: 12, letterSpacing: '.12em', textTransform: 'lowercase',
        }}>
          <span style={{ opacity: .85 }}>
            {copied
              ? (<>{member.email}<E id="letswork.status-copied"> — copied to clipboard</E></>)
              : (member.email || <E id="letswork.status-no-email">no email on file</E>)}
          </span>
          <span style={{ opacity: .55, textTransform: 'uppercase', letterSpacing: '.2em' }}>
            {member.name} · {member.title}
          </span>
        </div>
      </button>
    </section>
  );
}

function navBtn(accent) {
  return {
    all: 'unset', cursor: 'pointer',
    width: 36, height: 36, borderRadius: '50%',
    border: '1px solid ' + CIN.rule,
    display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
    fontFamily: 'serif', fontSize: 16, color: CIN.ink,
    transition: 'background .15s, border-color .15s',
  };
}

// ─── PROJECT DETAIL ─────────────────────────────────────────────────────────
function CinProject({ project, projects, accent, go }) {
  const p = project;
  const idx = projects.findIndex(x => x.id === p.id);
  const next = projects[(idx + 1) % projects.length];
  return (
    <>
      <section style={{ paddingTop: 96 }}>
        <div style={{ margin: '0 36px', position: 'relative', aspectRatio: '16/9', background: '#000', borderRadius: 2, overflow: 'hidden' }}>
          {projectHasVideo(p) ? (
            <iframe
              src={videoEmbedFor(p, { autoplay: false, muted: false, controls: true })}
              style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', border: 0 }}
              allow="autoplay; fullscreen; picture-in-picture" allowFullScreen
            />
          ) : (
            <div style={{ position: 'absolute', inset: 0, background: placeholderBg(p.hue, true), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
              <div style={{ textAlign: 'center', color: CIN.inkMute, fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.2em', textTransform: 'uppercase' }}>
                <E id="project.paste-prompt">▶ &nbsp; paste Vimeo URL in Tweaks</E>
              </div>
            </div>
          )}
        </div>
      </section>

      <section style={{ padding: '64px 36px 48px' }}>
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 48, alignItems: 'end' }}>
          <div>
            <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.2em', color: CIN.inkDim, textTransform: 'uppercase', marginBottom: 18 }}>
              {String(idx + 1).padStart(3, '0')} · {p.brand}
            </div>
            <h1 style={{ fontFamily: '"Instrument Serif", serif', fontSize: 96, lineHeight: .94, fontWeight: 400, margin: 0, letterSpacing: '-.012em' }}>
              {p.title}
            </h1>
            <div style={{ fontFamily: '"Instrument Serif", serif', fontSize: 22, fontStyle: 'italic', color: accent, marginTop: 16 }}>
              {p.tag} · {p.client}
            </div>
          </div>
          <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 24, fontSize: 13, lineHeight: 1.55, color: CIN.inkMute }}>
            <Meta label="Client"  value={p.client} />
            <Meta label="Year"    value={p.year} />
            <Meta label="Role"    value={p.role} />
            <Meta label="Runtime" value={p.runtime} />
            <Meta label="Brand"   value={p.brand} />
            <Meta label="Format"  value="Anamorphic · ARRI Alexa 35" />
          </div>
        </div>
      </section>

      <section className="cin-grid-contact" style={{ padding: '0 36px 80px', display: 'grid', gridTemplateColumns: '1fr 2fr', gap: 48 }}>
        <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', paddingTop: 8 }}>
          <E id="project.about-label">About the project</E>
        </div>
        <div>
          <E as="p" id="project.about-body" style={{ fontFamily: '"Instrument Serif", serif', fontSize: 28, lineHeight: 1.35, color: CIN.ink, margin: 0, fontWeight: 400, textWrap: 'pretty', display: 'block' }}>A study in restraint — the camera holds, the room breathes, and the product arrives almost as an afterthought. Built around three long takes, scored against the sound of the building itself.</E>
        </div>
      </section>

      <section style={{ padding: '0 36px 96px' }}>
        <div style={{ borderTop: '1px solid ' + CIN.rule, paddingTop: 32 }}>
          <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', marginBottom: 24 }}>
            <E id="project.credits-label">Credits</E>
          </div>
          <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: '16px 48px' }}>
            {[
              ['Director', 'Richard Santos'], ['DP', 'Richard Santos'],
              ['Producer', 'Maya Okafor'],    ['Editor', 'Lucas Reyes'],
              ['Color', 'Jin Park'],          ['Sound', 'Ana Mendes'],
              ['Graphic', 'Sofia Vargas'],    ['Production', 'ARMATURE / Lisbon'], ['Music', 'Original score'],
            ].map(([k, v]) => (
              <div key={k} style={{ display: 'flex', justifyContent: 'space-between', borderBottom: '1px solid ' + CIN.rule, paddingBottom: 10 }}>
                <span style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.14em', color: CIN.inkMute, textTransform: 'uppercase' }}>{k}</span>
                <span style={{ fontSize: 14, color: CIN.ink }}>{v}</span>
              </div>
            ))}
          </div>
        </div>
      </section>

      <section style={{ padding: '0 36px 96px' }}>
        <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', marginBottom: 24 }}>
          <E id="project.bts-label">Behind the scenes</E>
        </div>
        <div className="cin-grid-footer-brands" style={{ display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)', gridAutoRows: '180px', gap: 12 }}>
          {[
            { col: 'span 4', row: 'span 2', hue: p.hue },
            { col: 'span 2', row: 'span 1', hue: (p.hue + 10) % 360 },
            { col: 'span 2', row: 'span 1', hue: (p.hue + 20) % 360 },
            { col: 'span 3', row: 'span 1', hue: (p.hue + 30) % 360 },
            { col: 'span 3', row: 'span 1', hue: (p.hue + 40) % 360 },
          ].map((s, i) => (
            <div key={i} style={{
              gridColumn: s.col, gridRow: s.row, background: placeholderBg(s.hue, true),
              borderRadius: 2, position: 'relative', overflow: 'hidden',
            }}>
              <div style={{ position: 'absolute', left: 12, bottom: 10, fontFamily: '"JetBrains Mono", monospace', fontSize: 9.5, letterSpacing: '.18em', color: CIN.inkDim, textTransform: 'uppercase' }}>
                still / {String(i + 1).padStart(2, '0')}
              </div>
            </div>
          ))}
        </div>
      </section>

      <section style={{ padding: '0 36px 80px', borderTop: '1px solid ' + CIN.rule, paddingTop: 32 }}>
        <button onClick={() => go({ name: 'project', id: next.id })}
          style={{ all: 'unset', cursor: 'pointer', display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', width: '100%' }}>
          <div>
            <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', marginBottom: 12 }}><E id="project.next-label">Next →</E></div>
            <div style={{ fontFamily: '"Instrument Serif", serif', fontSize: 64, fontWeight: 400, letterSpacing: '-.01em' }}>{next.title}</div>
          </div>
          <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.14em', color: CIN.inkMute, textTransform: 'uppercase' }}>
            {next.client} · {next.year}
          </div>
        </button>
      </section>
    </>
  );
}

function Meta({ label, value }) {
  return (
    <div>
      <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10, letterSpacing: '.18em', color: CIN.inkDim, textTransform: 'uppercase' }}>{label}</div>
      <div style={{ marginTop: 6, fontSize: 14, color: CIN.ink }}>{value}</div>
    </div>
  );
}

// ─── SERVICES · Video / Graphic / Clothing ─────────────────────────────────
function CinServices({ accent, creators = CREATORS, brands = BRANDS, managed = MANAGED_SEED, subBrandClients = SUB_BRAND_CLIENTS_SEED, services = SERVICES }) {
  return (
    <>
      <section style={{ padding: '160px 36px 64px' }}>
        <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', marginBottom: 24 }}>
          <E id="services.eyebrow">Services — Video · Graphic · Clothing</E>
        </div>
        <E as="h1" id="services.title" style={{ fontFamily: '"Instrument Serif", serif', fontSize: 124, lineHeight: .92, fontWeight: 400, margin: 0, letterSpacing: '-.018em', maxWidth: 1200, textWrap: 'balance', display: 'block' }}>What the studio makes.</E>
      </section>

      <section style={{ padding: '0 36px 96px' }}>
        {services.map((cat, i) => (
          <div key={cat.k} style={{
            borderTop: '1px solid ' + (i === 0 ? CIN.ink : CIN.rule),
            padding: '40px 0',
            display: 'grid', gridTemplateColumns: '80px 1fr 2fr', gap: 32, alignItems: 'start',
          }}>
            <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.2em', color: accent }}>
              § {cat.k}
            </div>
            <div>
              <div style={{ fontFamily: '"Instrument Serif", serif', fontSize: 64, lineHeight: 1, fontWeight: 400, letterSpacing: '-.012em' }}>{cat.title}</div>
              <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.16em', color: CIN.inkMute, textTransform: 'uppercase', marginTop: 14 }}>
                {cat.tag}
              </div>
              <p style={{ fontSize: 14, lineHeight: 1.65, color: CIN.inkMute, marginTop: 18, maxWidth: 360 }}>{cat.body}</p>
            </div>
            <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '20px 36px' }}>
              {cat.items.map((it) => (
                <div key={it.name} style={{ paddingBottom: 14, borderBottom: '1px solid ' + CIN.rule }}>
                  <div style={{ fontFamily: '"Instrument Serif", serif', fontSize: 22, fontWeight: 400 }}>{it.name}</div>
                  <div style={{ fontSize: 12.5, color: CIN.inkMute, marginTop: 4 }}>{it.note}</div>
                </div>
              ))}
            </div>
          </div>
        ))}
      </section>

      {/* CLIENTS — four columns: Creators, Brands, Managed, Sub Brands. */}
      <section style={{ padding: '40px 36px 96px' }}>
        <div style={{ borderTop: '1px solid ' + CIN.ink, paddingTop: 32, display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', marginBottom: 40 }}>
          <E as="h2" id="services.clients-title" style={{ fontFamily: '"Instrument Serif", serif', fontSize: 72, lineHeight: 1, margin: 0, fontWeight: 400, letterSpacing: '-.014em', display: 'block' }}>Who we work with.</E>
          <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.18em', color: CIN.inkDim, textTransform: 'uppercase' }}>
            <E id="services.clients-meta">Creators · brands · managed · sub brands · selected</E>
          </div>
        </div>

        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 40 }}>
          <ClientColumn id="creators" label="Creators" tag="Independents · talent · studios" items={creators} accent={accent} />
          <ClientColumn id="brands"   label="Brands"   tag="Commissioned · agency · in-house" items={brands} accent={accent} />
          <ClientColumn id="managed"  label="Managed"  tag="End-to-end · operation · growth" items={managed} accent={accent} />
          <ClientColumn id="subbrands" label="Sub Brands" tag="Fully owned · operated · shipped" items={subBrandClients} accent={accent} />
        </div>
      </section>
    </>
  );
}

function ClientColumn({ id, label, tag, items, accent }) {
  return (
    <div>
      <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', borderBottom: '1px solid ' + CIN.rule, paddingBottom: 14, marginBottom: 8 }}>
        <E style={{ fontFamily: '"Instrument Serif", serif', fontSize: 36, lineHeight: 1, fontWeight: 400, letterSpacing: '-.01em' }} id={'services.' + (id || 'col') + '-label'}>{label}</E>
        <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10, letterSpacing: '.18em', color: CIN.inkDim, textTransform: 'uppercase' }}>
          <E id={'services.' + (id || 'col') + '-tag'}>{tag}</E> · {String(items.length).padStart(2, '0')}
        </div>
      </div>
      {items.map((c, i) => <ClientRow key={(c.name || '') + i} client={c} accent={accent} />)}
    </div>
  );
}

function ClientRow({ client, accent }) {
  const [hover, setHover] = React.useState(false);
  const initials = (client.name || '?').split(/\s+/).map(s => s[0]).join('').slice(0, 2).toUpperCase();
  const inner = (
    <div
      onMouseEnter={() => setHover(true)}
      onMouseLeave={() => setHover(false)}
      style={{
        display: 'grid', gridTemplateColumns: '52px 1fr auto', gap: 16,
        alignItems: 'center', padding: '14px 0',
        borderBottom: '1px solid ' + CIN.rule,
        color: 'inherit', textDecoration: 'none',
        cursor: client.link ? 'pointer' : 'default',
      }}
    >
      <div style={{
        width: 52, height: 52, borderRadius: 2,
        background: client.logo ? `#0a0606 url(${client.logo}) center/contain no-repeat` : 'rgba(240,232,220,.06)',
        border: '1px solid ' + (client.logo ? 'transparent' : CIN.rule),
        display: 'flex', alignItems: 'center', justifyContent: 'center',
        flexShrink: 0, overflow: 'hidden',
      }}>
        {!client.logo && (
          <span style={{ fontFamily: '"Instrument Serif", serif', fontSize: 22, color: CIN.inkMute, letterSpacing: '.02em' }}>{initials}</span>
        )}
      </div>
      <div style={{
        fontFamily: '"Instrument Serif", serif', fontSize: 28, fontWeight: 400, lineHeight: 1.05, letterSpacing: '-.005em',
        color: hover && client.link ? accent : CIN.ink,
        fontStyle: hover && client.link ? 'italic' : 'normal',
        transition: 'color .15s',
      }}>
        {client.name || 'Unnamed'}
      </div>
      {client.link && (
        <span style={{
          fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.16em', textTransform: 'uppercase',
          color: hover ? accent : CIN.inkDim, transition: 'color .15s',
        }}>
          visit ↗
        </span>
      )}
    </div>
  );
  return client.link
    ? <a href={client.link} target="_blank" rel="noopener" style={{ display: 'block', color: 'inherit', textDecoration: 'none' }}>{inner}</a>
    : inner;
}

function CinAbout({ accent, links = NAV_LINKS, subBrands = SUB_BRANDS }) {
  const fmBrand = subBrands.find(b => b.id === 'fullmetal') || subBrands[0] || SUB_BRANDS[0];
  const csBrand = subBrands.find(b => b.id === 'cinesteel') || subBrands[1] || SUB_BRANDS[1];
  const fmHref = (fmBrand && (links[fmBrand.id] || fmBrand.href)) || '#';
  const csHref = (csBrand && (links[csBrand.id] || csBrand.href)) || '#';
  return (
    <>
      <section style={{ padding: '160px 36px 80px' }}>
        <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', marginBottom: 24 }}>
          <E id="about.eyebrow">About — ARMATURE</E>
        </div>
        <E as="h1" id="about.title" style={{ fontFamily: '"Instrument Serif", serif', fontSize: 88, lineHeight: 1, fontWeight: 400, margin: 0, letterSpacing: '-.012em', maxWidth: 1100, textWrap: 'balance', display: 'block' }}>A studio organized around patient cameras, small crews, and films that finish what they start.</E>
      </section>
      <section className="cin-grid-contact" style={{ padding: '0 36px 96px', display: 'grid', gridTemplateColumns: '1fr 2fr', gap: 48 }}>
        <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase' }}>
          <E id="about.bio-label">Bio · 2026</E>
        </div>
        <div style={{ fontSize: 16, lineHeight: 1.7, color: CIN.ink, maxWidth: 720 }}>
          <p style={{ margin: '0 0 18px' }}>
            <E id="about.body1-pre">ARMATURE is the parent studio behind two practices — </E>
            <a href={fmHref} target="_blank" rel="noopener" style={{ color: accent, textDecoration: 'none', borderBottom: '1px solid ' + accent }}><E id="about.fullmetal">FULLMETAL</E></a>
            <E id="about.body1-mid"> for industrial, automotive, and motorsport, and </E>
            <a href={csHref} target="_blank" rel="noopener" style={{ color: accent, textDecoration: 'none', borderBottom: '1px solid ' + accent }}><E id="about.cinesteel">CINESTEEL</E></a>
            <E id="about.body1-post"> for narrative, brand films, and editorial commissions.</E>
          </p>
          <E as="p" id="about.body2" style={{ margin: 0, display: 'block' }}>Founded by Richard Santos in 2024. Operates from Lisbon and New York with a roster of recurring collaborators across DP, edit, color, score, and graphic design.</E>
        </div>
      </section>
    </>
  );
}

function CinContact({ accent, locations = [] }) {
  return (
    <section style={{ padding: '160px 36px 96px' }}>
      <E as="h1" id="contact.title" style={{ fontFamily: '"Instrument Serif", serif', fontSize: 96, lineHeight: 1, fontWeight: 400, margin: '0 0 56px', letterSpacing: '-.012em', maxWidth: 1100, textWrap: 'balance', display: 'block' }}>Tell us about the film.</E>
      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 64 }}>
        <div>
          {[['name', 'Name'], ['company', 'Company'], ['email', 'Email']].map(([k, l]) => (
            <div key={k} style={{ padding: '20px 0', borderTop: '1px solid ' + CIN.rule, display: 'grid', gridTemplateColumns: '120px 1fr', alignItems: 'baseline', gap: 16 }}>
              <span style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.16em', color: CIN.inkDim, textTransform: 'uppercase' }}><E id={'contact.' + k + '-label'}>{l}</E></span>
              <input placeholder="—" style={{ all: 'unset', fontFamily: '"Instrument Serif", serif', fontSize: 24, color: CIN.ink, width: '100%' }} />
            </div>
          ))}
          <div style={{ padding: '20px 0', borderTop: '1px solid ' + CIN.rule, borderBottom: '1px solid ' + CIN.rule, display: 'grid', gridTemplateColumns: '120px 1fr', alignItems: 'baseline', gap: 16 }}>
            <span style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 11, letterSpacing: '.16em', color: CIN.inkDim, textTransform: 'uppercase' }}><E id="contact.project-label">Project</E></span>
            <textarea placeholder="A few sentences about the film, timing, and budget." rows={4} style={{ all: 'unset', fontFamily: '"Instrument Serif", serif', fontSize: 22, lineHeight: 1.4, color: CIN.ink, width: '100%', resize: 'none' }} />
          </div>
          <button style={{
            marginTop: 28, padding: '16px 28px', background: accent, color: CIN.ink, border: 0, cursor: 'pointer',
            fontFamily: '"JetBrains Mono", monospace', fontSize: 11.5, letterSpacing: '.2em', textTransform: 'uppercase',
          }}><E id="contact.submit">Send inquiry →</E></button>
        </div>
        <div style={{ paddingTop: 24 }}>
          <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', marginBottom: 18 }}>
            <E id="contact.studios-label">Studios</E>
          </div>
          <div className="cin-grid-2" style={{ display: 'grid', gridTemplateColumns: locations.length > 1 ? '1fr 1fr' : '1fr', gap: 36 }}>
            {locations.map((loc, i) => (
              <div key={(loc.name || '') + i}>
                <div style={{ fontFamily: '"Instrument Serif", serif', fontSize: 28, marginBottom: 12 }}>{loc.name}</div>
                <div style={{ fontSize: 13, lineHeight: 1.7, color: CIN.inkMute, whiteSpace: 'pre-line' }}>{loc.address}</div>
              </div>
            ))}
          </div>
          <div style={{ fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.22em', color: CIN.inkDim, textTransform: 'uppercase', margin: '48px 0 18px' }}>
            <E id="contact.social">Instagram · @armature.studio</E>
          </div>
          <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 6 }}>
            {Array.from({ length: 8 }).map((_, i) => (
              <div key={i} style={{ aspectRatio: '1', background: placeholderBg((i * 31) % 360, true) }} />
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

function CinFooter({ accent, go, links = NAV_LINKS, locations = [], subBrands = SUB_BRANDS }) {
  const locNames = (locations || []).map(l => l.name).filter(Boolean).join(' · ');
  return (
    <footer style={{ padding: '48px 36px 32px', borderTop: '1px solid ' + CIN.rule, background: CIN.bgSoft }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end' }}>
        <E id="footer.wordmark" style={{ fontFamily: '"Instrument Serif", serif', fontSize: 72, fontWeight: 400, letterSpacing: '-.012em', lineHeight: 1, display: 'block' }}>ARMATURE.</E>
        <div style={{ display: 'flex', gap: 36, fontFamily: '"JetBrains Mono", monospace', fontSize: 10.5, letterSpacing: '.16em', textTransform: 'uppercase', color: CIN.inkMute }}>
          <a href={links.store || NAV_LINKS.store} target="_blank" rel="noopener" style={{ color: CIN.inkMute, textDecoration: 'none' }}><E id="footer.store">STORE ↗</E></a>
          {/* Sub-brand links — driven by admin "Sub-brands" tab. */}
          {subBrands.map((b, i) => (
            <a key={b.id || i} href={links[b.id] || b.href} target="_blank" rel="noopener" style={{ color: CIN.inkMute, textDecoration: 'none' }}>{(b.name || '').toUpperCase()} ↗</a>
          ))}
          {locNames && <span>{locNames}</span>}
          <E id="footer.copyright">© 2026 · est. 2024</E>
        </div>
      </div>
    </footer>
  );
}

Object.assign(window, { CinematicPortfolio, CIN });
