const GRAM_OPTIONS = ['100g', '200g', '500g', '1kg']; function ProductDetail({ coffee, onBack, onAddToCart, tweaks }) { const [selectedGram, setSelectedGram] = React.useState('200g'); const [added, setAdded] = React.useState(false); const [meterVisible, setMeterVisible] = React.useState(false); React.useEffect(() => { setMeterVisible(false); setSelectedGram('200g'); const t = setTimeout(() => setMeterVisible(true), 120); return () => clearTimeout(t); }, [coffee.id]); function handleAdd() { onAddToCart(coffee, selectedGram); setAdded(true); setTimeout(() => setAdded(false), 2200); } const price = coffee.prices[selectedGram]; const s = { wrap: { minHeight: '100vh', display: 'grid', gridTemplateColumns: '3fr 2fr', animation: 'slideInDetail 0.55s cubic-bezier(0.16, 1, 0.3, 1)', }, left: { padding: '96px 64px 80px', borderRight: '1px solid rgba(255,255,255,0.08)', }, right: { position: 'sticky', top: 0, height: '100vh', background: 'rgba(255,255,255,0.015)', overflow: 'hidden', }, back: { background: 'none', border: 'none', color: 'rgba(255,255,255,0.38)', fontFamily: "'Montserrat', sans-serif", fontSize: 12, letterSpacing: '0.22em', cursor: 'crosshair', padding: 0, marginBottom: 72, display: 'flex', alignItems: 'center', gap: 10, textTransform: 'uppercase', transition: 'color 0.2s', }, label: { fontFamily: "'Montserrat', sans-serif", fontSize: 12, letterSpacing: '0.28em', color: 'rgba(255,255,255,0.28)', textTransform: 'uppercase', marginBottom: 10, }, rule: { height: 1, background: 'rgba(255,255,255,0.1)', margin: '40px 0', }, }; return (
{/* ── LEFT PANEL ── */}
{/* Index line */}
{coffee.index}
{coffee.altitude.toLocaleString()}M A.S.L.
{/* Title */}

{coffee.name}

{coffee.region}
{coffee.origin}
{/* Tasting notes */}
Tasting Notes
{coffee.notes.map((note, i) => ( {note} {i < coffee.notes.length - 1 && ( · )} ))}
{/* Description */}

{coffee.description}

{/* Specs grid */}
{[ ['Process', coffee.process], ['Variety', coffee.variety], ['Roast Level', coffee.roastLevel], ['Roast Date', coffee.roastDate], ].map(([k, v]) => (
{k}
{v}
))}
{/* Weight selector */}
Select Weight
{GRAM_OPTIONS.map((g, i) => { const active = selectedGram === g; return ( ); })}
{/* Add to cart */}
{/* ── RIGHT PANEL: Altitude Meter ── */}
); } Object.assign(window, { ProductDetail });