// Film finish: one result, shown in fourteen of the 86 looks (Kate's pick, 13 Oct 2026). Tapping a look
// swaps the large image. The list scrolls sideways on a phone.

function PSFilmFinish() {
  const looks = [
    { id: 'original', label: 'Original', group: 'As generated' },
    { id: 'mono', label: 'Silver', group: 'Film' },
    { id: 'goldenhour', label: 'Amber', group: 'Film' },
    { id: 'cool', label: 'Cold Press', group: 'Film' },
    { id: 'grain2', label: '35mm', group: 'Grain' },
    { id: 'vault1', label: 'Tobacco', group: 'Color' },
    { id: 'vault2', label: 'Linen', group: 'Color' },
    { id: 'mono1', label: 'Newsprint', group: 'Mono' },
    { id: 'palm', label: 'Palm', group: 'Shadow' },
    { id: 'scan01', label: 'Interlace', group: 'Scan' },
    { id: 'scan03', label: 'Lid Open', group: 'Scan' },
    { id: 'misprint10', label: 'Double Feed', group: 'Misprint' },
    { id: 'fold04', label: 'Road Map', group: 'Fold' },
    { id: 'fold02', label: 'Letter', group: 'Fold' },
    { id: 'paper07', label: 'Cellophane', group: 'Paper' },
  ];
  const [active, setActive] = React.useState('goldenhour');
  const current = looks.find((l) => l.id === active) || looks[0];
  const src = (id) => `assets/filmfinish/${id}.jpg`;

  return (
    <section id="film-finish" className="ps-section" data-mobile-pad="true" data-mobile-y="lg" style={{ background: 'var(--cocoa)', padding: '128px 48px' }}>
      <div className="ps-ff-grid" style={{ maxWidth: 1320, margin: '0 auto', display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 1fr)', gap: 72, alignItems: 'center' }}>
        <div style={{ minWidth: 0 }}>
          <div className="eyebrow" style={{ marginBottom: 14, color: 'rgba(242,236,228,0.7)' }}>
            <span style={{ display: 'inline-block', width: 24, height: 1, background: 'var(--cream)', verticalAlign: 'middle', marginRight: 12 }}></span>
            New · Film finish
          </div>
          <h2 className="celestial" style={{ fontSize: 'clamp(48px,6vw,96px)', color: 'var(--cream)', margin: 0 }}>
            Lose the<br />AI polish.
          </h2>
          <p style={{ fontFamily: '"La Villa", sans-serif', fontSize: 17, lineHeight: 1.6, color: 'rgba(242,236,228,0.78)', maxWidth: 460, margin: '26px 0 0' }}>
            Swap that too-perfect finish for the grain and tone of real film. 86 looks made by our own designers: film stocks, grain, color grades, light leaks, shadows and paper. Your original stays as it is.
          </p>
          <div style={{ display: 'flex', gap: 34, marginTop: 34, paddingTop: 22, borderTop: '1px solid rgba(242,236,228,0.16)', fontFamily: '"La Villa", sans-serif', color: 'var(--cream)' }}>
            {[['86', 'Looks'], ['Free', 'To use'], ['1 tap', 'On any result']].map(([big, small]) => (
              <div key={small}>
                <div style={{ fontSize: 22 }}>{big}</div>
                <div style={{ fontSize: 9.5, letterSpacing: '0.2em', textTransform: 'uppercase', color: 'rgba(242,236,228,0.6)', marginTop: 5 }}>{small}</div>
              </div>
            ))}
          </div>
        </div>

        <div style={{ minWidth: 0 }}>
          <div style={{ position: 'relative', aspectRatio: '4 / 5', overflow: 'hidden', background: '#1c1715' }}>
            {/* every look stays mounted and cross-fades, so a tap never flashes empty */}
            {looks.map((l) => (
              <img key={l.id} src={src(l.id)} alt={l.id === active ? `The image in the ${l.label} look` : ''} loading="lazy"
                style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover', opacity: l.id === active ? 1 : 0, transition: 'opacity 260ms ease' }} />
            ))}
            <div style={{ position: 'absolute', left: 12, bottom: 12, padding: '6px 10px', background: 'rgba(28,23,21,0.62)', backdropFilter: 'blur(6px)', WebkitBackdropFilter: 'blur(6px)', color: 'var(--cream)', fontFamily: '"La Villa", sans-serif', fontSize: 9.5, letterSpacing: '0.22em', textTransform: 'uppercase', borderRadius: 999 }}>
              {current.group} · {current.label}
            </div>
          </div>
          <div className="ps-ff-looks">
            {looks.map((l) => (
              <button key={l.id} type="button" onClick={() => setActive(l.id)} aria-pressed={l.id === active}
                style={{ flex: '0 0 auto', width: 62, padding: 0, border: 0, background: 'transparent', cursor: 'pointer', textAlign: 'left' }}>
                <span style={{ display: 'block', aspectRatio: '4 / 5', overflow: 'hidden', outline: l.id === active ? '2px solid var(--cream)' : '1px solid rgba(242,236,228,0.14)', outlineOffset: -2 }}>
                  <img src={src(l.id)} alt="" loading="lazy" style={{ width: '100%', height: '100%', objectFit: 'cover', display: 'block' }} />
                </span>
                <span style={{ display: 'block', marginTop: 6, fontFamily: '"La Villa", sans-serif', fontSize: 10.5, lineHeight: 1.2, color: l.id === active ? 'var(--cream)' : 'rgba(242,236,228,0.6)', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{l.label}</span>
              </button>
            ))}
          </div>
        </div>
      </div>

      <style>{`
        .ps-ff-looks { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
        .ps-ff-looks::-webkit-scrollbar { display: none; }
        @media (max-width: 980px) {
          .ps-ff-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 34px !important; }
        }
      `}</style>
    </section>
  );
}
