// ps1c2.jsx — Clase 1.2 «Efecto fotovoltaico: célula, módulo, string y array»
// Incluye la animación «Del fotón a la corriente». Después de solar-lib.jsx.

const TIEMPOS_PS1C2 = [[0.6, 5.6, 7.06], [0.6, 4.12, 11.13], [0.6, 2.61, 5.65, 8.21, 13.22], [0.6, 4.24, 11.42], [0.6, 10.56, 12.69, 14.86], [0.6, 7.58, 9.39], [0.6, 4.19, 7.77, 13.36, 16.83], [0.6, 3.99, 7.19, 10.4, 12.23, 14.91], [0.6, 4.44, 10.17, 16.07], [0.6, 7.74, 9.05]]; // auto
const fr = (i, k) => (TIEMPOS_PS1C2[i] || [])[k] ?? 0.6 + k * 3.5;

const N_COL = '#60a5fa';   // capa N (electrones de sobra)
const P_COL = '#f472b6';   // capa P (huecos)

/** Corte de la célula: capa N arriba, P abajo, unión al medio */
function CellSection({ x, y, w = 900, h = 420, t, field = 0, contacts = 0 }) {
  const mid = y + h * 0.42;
  return (
    <g>
      <rect x={x} y={y} width={w} height={mid - y} fill={N_COL} opacity="0.16" />
      <rect x={x} y={mid} width={w} height={y + h - mid} fill={P_COL} opacity="0.14" />
      <rect x={x} y={y} width={w} height={h} fill="none" stroke={SL.lineS} strokeWidth="2" />
      <line x1={x} y1={mid} x2={x + w} y2={mid} stroke={SL.ink} strokeWidth="2" strokeDasharray="8 6" opacity="0.6" />
      <text x={x + 20} y={y + 40} fill={N_COL} fontFamily={DISP} fontSize="26" fontWeight="700">Capa N</text>
      <text x={x + 20} y={y + h - 22} fill={P_COL} fontFamily={DISP} fontSize="26" fontWeight="700">Capa P</text>
      <text x={x + w - 20} y={mid - 12} textAnchor="end" fill={SL.mut} fontFamily={MONO} fontSize="17">unión PN</text>
      {field > 0 && [0, 1, 2, 3, 4, 5].map(i => {
        const ax = x + 150 + i * 120;
        return (
          <g key={i} opacity={field}>
            <line x1={ax} y1={mid - 40} x2={ax} y2={mid + 30} stroke={SL.sun} strokeWidth="3" />
            <path d={`M${ax - 9} ${mid + 18} L${ax} ${mid + 34} L${ax + 9} ${mid + 18}`} fill="none" stroke={SL.sun} strokeWidth="3" />
          </g>
        );
      })}
      {field > 0 && <text x={x + w / 2} y={mid + 70} textAnchor="middle" fill={SL.sun} fontFamily={MONO} fontSize="18" opacity={field}>campo eléctrico interno</text>}
      {contacts > 0 && (
        <g opacity={contacts}>
          {[0, 1, 2, 3, 4, 5, 6].map(i => <rect key={i} x={x + 60 + i * 125} y={y - 14} width="34" height="14" fill="#cbd5e1" />)}
          <rect x={x} y={y + h} width={w} height="16" fill="#94a3b8" />
          <text x={x + w + 20} y={y - 2} fill={SL.mut} fontFamily={MONO} fontSize="16">contacto superior</text>
          <text x={x + w + 20} y={y + h + 14} fill={SL.mut} fontFamily={MONO} fontSize="16">contacto inferior</text>
        </g>
      )}
    </g>
  );
}
const Electron = ({ x, y, op = 1 }) => (<g opacity={op}><circle cx={x} cy={y} r="13" fill={N_COL} /><text x={x} y={y + 6} textAnchor="middle" fill="#0b1220" fontFamily={MONO} fontSize="18" fontWeight="700">−</text></g>);
const Hole = ({ x, y, op = 1 }) => (<g opacity={op}><circle cx={x} cy={y} r="13" fill="none" stroke={P_COL} strokeWidth="3" /><text x={x} y={y + 6} textAnchor="middle" fill={P_COL} fontFamily={MONO} fontSize="18" fontWeight="700">+</text></g>);
/** Fotón: ondita amarilla que viaja de (x0,y0) a (x1,y1) en [a, a+d] */
function Photon({ t, a, d = 1.1, x0, y0, x1, y1 }) {
  const k = clamp((t - a) / d, 0, 1);
  if (k <= 0 || k >= 1) return null;
  const x = x0 + (x1 - x0) * k, y = y0 + (y1 - y0) * k;
  const ang = Math.atan2(y1 - y0, x1 - x0) * 180 / Math.PI;
  return (
    <g transform={`translate(${x} ${y}) rotate(${ang})`}>
      <path d="M-34 0 q6 -10 12 0 t12 0 t12 0 t12 0" fill="none" stroke={SL.sun} strokeWidth="3.5" strokeLinecap="round" />
      <circle cx="16" cy="0" r="5" fill={SL.sun} />
    </g>
  );
}

// 1 · Fotones que liberan electrones
function S_Fotones({ start, dur }) {
  const t = useTime(); const s = start;
  const gx = 900, gy = 360, step = 110, n = 6, m = 4;
  const hitAt = s + fr(1, 1) + 1.6;
  const free = clamp((t - hitAt) / 1.2, 0, 1);
  const wander = segS(t, s + fr(1, 2), 2.5);
  const ex = gx + 2 * step + 50 * free + 160 * wander + 20 * Math.sin(t * 3) * wander;
  const ey = gy + 1 * step - 60 * free + 50 * Math.sin(t * 2) * wander;
  return (
    <SceneS start={start} dur={dur}>
      <HeadS s={s} dur={dur} kicker="Del fotón a la corriente · 1" title="La luz llega en paquetes: fotones" />
      <svg style={{ position: 'absolute', inset: 0, width: '100%', height: '100%' }}>
        <SunG x={260} y={330} r={60} t={t} />
        {[0, 1, 2, 3, 4, 5].map(i => <Photon key={i} t={t} a={s + fr(1, 0) + i * 0.7} x0={330} y0={360} x1={gx - 30} y1={gy + (i % 4) * step} />)}
        <Photon t={t} a={s + fr(1, 1) + 0.5} x0={330} y0={380} x1={gx + 2 * step} y1={gy + step} />
        <g opacity={popS(t, s + fr(1, 0) + 0.3).op}>
          {[...Array(n)].map((_, i) => [...Array(m)].map((__, j) => (
            <g key={i + '-' + j}>
              {i < n - 1 && <line x1={gx + i * step} y1={gy + j * step} x2={gx + (i + 1) * step} y2={gy + j * step} stroke={SL.lineS} strokeWidth="3" />}
              {j < m - 1 && <line x1={gx + i * step} y1={gy + j * step} x2={gx + i * step} y2={gy + (j + 1) * step} stroke={SL.lineS} strokeWidth="3" />}
              <circle cx={gx + i * step} cy={gy + j * step} r="24" fill={SL.paper2} stroke="#64748b" strokeWidth="2.5" />
              <text x={gx + i * step} y={gy + j * step + 6} textAnchor="middle" fill={SL.mut} fontFamily={MONO} fontSize="16">Si</text>
            </g>
          )))}
          <text x={gx} y={gy + m * step + 10} fill={SL.mut} fontFamily={MONO} fontSize="18">red cristalina de silicio</text>
        </g>
        {free > 0 && (
          <g>
            <circle cx={gx + 2 * step} cy={gy + step} r={40 * (1 - free) + 18} fill={SL.sun} opacity={0.4 * (1 - free)} />
            <Hole x={gx + 2 * step + 30} y={gy + step + 30} op={free} />
            <Electron x={ex} y={ey} op={free} />
            <text x={ex + 24} y={ey - 22} fill={N_COL} fontFamily={DISP} fontSize="22" fontWeight="600" opacity={free}>electrón libre</text>
            <text x={gx + 2 * step + 50} y={gy + step + 70} fill={P_COL} fontFamily={DISP} fontSize="22" fontWeight="600" opacity={segS(t, s + fr(1, 2) + 1.5, 0.6)}>hueco</text>
          </g>
        )}
      </svg>
    </SceneS>
  );
}

// 2 · La unión PN y su campo interno
function S_Union({ start, dur }) {
  const t = useTime(); const s = start;
  const x = 360, y = 320, w = 1000, h = 460;
  const lay = segS(t, s + fr(2, 2), 0.8);
  const field = segS(t, s + fr(2, 4), 1.0);
  const nDots = segS(t, s + fr(2, 3), 0.8);
  const pDots = segS(t, s + fr(2, 3) + 2.2, 0.8);
  return (
    <SceneS start={start} dur={dur}>
      <HeadS s={s} dur={dur} kicker="Del fotón a la corriente · 2" title="Dos capas de silicio: la unión PN" />
      <svg style={{ position: 'absolute', inset: 0, width: '100%', height: '100%' }}>
        <g opacity={lay}>
          <CellSection x={x} y={y} w={w} h={h} t={t} field={field} />
          {[...Array(10)].map((_, i) => <Electron key={'n' + i} x={x + 90 + i * 92} y={y + 70 + (i % 2) * 50} op={nDots * 0.85} />)}
          {[...Array(10)].map((_, i) => <Hole key={'p' + i} x={x + 90 + i * 92} y={y + h - 90 + (i % 2) * 40} op={pDots * 0.85} />)}
        </g>
      </svg>
      <CardS at={s + fr(2, 3)} x={1420} y={330} w={400} accent={N_COL} title="Tipo N">Electrones de sobra.</CardS>
      <CardS at={s + fr(2, 3) + 2.2} x={1420} y={560} w={400} accent={P_COL} title="Tipo P">Falta de electrones: huecos.</CardS>
    </SceneS>
  );
}

// 3 · El campo separa las cargas: aparece una tensión
function S_Separacion({ start, dur }) {
  const t = useTime(); const s = start;
  const x = 360, y = 320, w = 1000, h = 460, mid = y + h * 0.42;
  const pairsAt = s + fr(3, 1);
  const pairs = [0, 1, 2, 3, 4];
  const volt = popS(t, s + fr(3, 2));
  return (
    <SceneS start={start} dur={dur}>
      <HeadS s={s} dur={dur} kicker="Del fotón a la corriente · 3" title="El campo separa las cargas" />
      <svg style={{ position: 'absolute', inset: 0, width: '100%', height: '100%' }}>
        <CellSection x={x} y={y} w={w} h={h} t={t} field={1} />
        {pairs.map(i => {
          const a = pairsAt + i * 0.9;
          const k = clamp((t - a) / 1.6, 0, 1);
          if (t < a) return null;
          const px = x + 180 + i * 160;
          return (
            <g key={i}>
              <Photon t={t} a={a - 1} d={1} x0={px - 200} y0={y - 120} x1={px} y1={mid} />
              <Electron x={px} y={mid - 10 - (mid - y - 60) * Easing.easeOutCubic(k)} />
              <Hole x={px + 26} y={mid + 10 + (y + h - mid - 70) * Easing.easeOutCubic(k)} />
            </g>
          );
        })}
      </svg>
      <div style={{ position: 'absolute', left: 1430, top: 420, opacity: volt.op, transform: `translateY(${volt.ty}px)` }}>
        <div style={{ fontFamily: MONO, fontSize: 18, color: SL.mut, letterSpacing: '0.16em' }}>ENTRE LAS DOS CARAS</div>
        <div style={{ fontFamily: MONO, fontSize: 88, fontWeight: 700, color: SL.cc, lineHeight: 1.1 }}>≈ 0,6 V</div>
        <div style={{ fontFamily: DISP, fontSize: 22, color: SL.mut, marginTop: 6 }}>en circuito abierto</div>
      </div>
    </SceneS>
  );
}

// 4 · Circuito exterior: corriente continua
function S_Corriente({ start, dur }) {
  const t = useTime(); const s = start;
  const x = 260, y = 360, w = 860, h = 380;
  const wire = `M${x + w} ${y - 7} H${x + w + 360} V${y + h + 8} H${x + w}`;
  const on = segS(t, s + fr(4, 0) + 1.2, 1);
  const len = 360 * 2 + h + 15;
  const lamp = 0.4 + 0.6 * on;
  const dc = popS(t, s + fr(4, 3));
  return (
    <SceneS start={start} dur={dur}>
      <HeadS s={s} dur={dur} kicker="Del fotón a la corriente · 4" title="Un circuito exterior: corriente continua" />
      <svg style={{ position: 'absolute', inset: 0, width: '100%', height: '100%' }}>
        <CellSection x={x} y={y} w={w} h={h} t={t} field={0.5} contacts={1} />
        <path d={wire} fill="none" stroke={SL.cc} strokeWidth="6" strokeLinejoin="round" strokeDasharray={len} strokeDashoffset={len * (1 - on)} />
        {on >= 1 && [...Array(8)].map((_, i) => {
          const f = ((t * 0.25 + i / 8) % 1);
          const d0 = f * len;
          let px, py;
          if (d0 < 360) { px = x + w + d0; py = y - 7; }
          else if (d0 < 360 + h + 15) { px = x + w + 360; py = y - 7 + (d0 - 360); }
          else { px = x + w + 360 - (d0 - 360 - h - 15); py = y + h + 8; }
          return <circle key={i} cx={px} cy={py} r="9" fill={N_COL} />;
        })}
        <g transform={`translate(${x + w + 360} ${y + h / 2})`}>
          <circle r="62" fill={SL.sun} opacity={0.25 * lamp} />
          <circle r="40" fill={SL.paper} stroke={SL.sun} strokeWidth="4" />
          <circle r="24" fill={SL.sun} opacity={lamp} />
          <text x="70" y="8" fill={SL.ink} fontFamily={DISP} fontSize="24" fontWeight="600">carga</text>
        </g>
        <text x={x + w + 180} y={y - 26} textAnchor="middle" fill={N_COL} fontFamily={DISP} fontSize="22" opacity={on}>electrones →</text>
      </svg>
      <div style={{ position: 'absolute', left: 1500, top: 760, opacity: dc.op, transform: `translateY(${dc.ty}px)`, display: 'flex', alignItems: 'center', gap: 18 }}>
        <DcI size={56} />
        <div>
          <div style={{ fontFamily: DISP, fontSize: 32, fontWeight: 700, color: SL.cc }}>Corriente continua</div>
          <div style={{ fontFamily: DISP, fontSize: 20, color: SL.mut }}>siempre en el mismo sentido</div>
        </div>
      </div>
    </SceneS>
  );
}

// 5 · Una célula: medio voltio; la corriente sigue a la luz
function S_Celula({ start, dur }) {
  const t = useTime(); const s = start;
  const k = segS(t, s + fr(5, 1), 0.6);
  const irr = 0.25 + 0.75 * (0.5 + 0.5 * Math.sin((t - s) * 1.1)) * k + (1 - k) * 0.75;
  const amps = 13 * irr, volts = 0.55 + 0.04 * Math.log10(irr * 10) / 1;
  const bar = (v, max, col, x, label, unit) => (
    <g>
      <rect x={x} y={360} width="90" height="400" rx="8" fill={SL.paper} stroke={SL.lineS} strokeWidth="2" />
      <rect x={x + 8} y={360 + 392 - 384 * (v / max)} width="74" height={384 * (v / max)} rx="5" fill={col} />
      <text x={x + 45} y={800} textAnchor="middle" fill={SL.ink} fontFamily={MONO} fontSize="24" fontWeight="700">{v.toFixed(unit === 'V' ? 2 : 1).replace('.', ',')} {unit}</text>
      <text x={x + 45} y={832} textAnchor="middle" fill={SL.mut} fontFamily={DISP} fontSize="19">{label}</text>
    </g>
  );
  return (
    <SceneS start={start} dur={dur}>
      <HeadS s={s} dur={dur} kicker="Una célula" title="Poco más de medio voltio por célula" />
      <svg style={{ position: 'absolute', inset: 0, width: '100%', height: '100%' }}>
        <SunG x={300} y={330} r={30 + 22 * irr} t={t} />
        <text x={300} y={470} textAnchor="middle" fill={SL.sun} fontFamily={MONO} fontSize="22">{Math.round(irr * 1000)} W/m²</text>
        <g transform="translate(470 500)">
          <rect width="300" height="300" rx="8" fill="#0d2a52" stroke="#9fb3cc" strokeWidth="3" />
          {[1, 2, 3, 4, 5, 6, 7, 8, 9].map(i => <line key={i} x1={i * 30} y1="0" x2={i * 30} y2="300" stroke="#1e3a66" strokeWidth="1" />)}
          {[75, 150, 225].map(xx => <rect key={xx} x={xx - 3} y="0" width="6" height="300" fill="#cbd5e1" />)}
          <text x="150" y="340" textAnchor="middle" fill={SL.mut} fontFamily={DISP} fontSize="20">célula de silicio</text>
        </g>
        <g opacity={popS(t, s + fr(5, 0)).op}>{bar(volts, 0.8, SL.cc, 1000, 'tensión', 'V')}</g>
        <g opacity={popS(t, s + fr(5, 1)).op}>{bar(amps, 14, SL.sun, 1200, 'corriente', 'A')}</g>
      </svg>
      <CardS at={s + fr(5, 1)} x={1400} y={380} w={420} accent={SL.sun} title="Más luz, más corriente">La corriente sube y baja con la irradiancia.</CardS>
      <CardS at={s + fr(5, 2)} x={1400} y={600} w={420} accent={SL.cc} title="La tensión casi no cambia">Depende sobre todo del material y la temperatura.</CardS>
    </SceneS>
  );
}

// 6 · El módulo: células en serie
function S_Modulo({ start, dur }) {
  const t = useTime(); const s = start;
  const cols = 6, rows = 10, cw = 46, ch = 46, mx = 300, my = 290;
  const chain = segS(t, s + fr(6, 1), 3);
  const sum = segS(t, s + fr(6, 3), 0.8);
  const parts = segS(t, s + fr(6, 4), 0.8);
  const order = [];
  for (let c = 0; c < cols; c++) for (let r = 0; r < rows; r++) order.push([c, c % 2 ? rows - 1 - r : r]);
  const lit = Math.floor(chain * order.length);
  const path = order.slice(0, Math.max(1, lit)).map(([c, r], i) => `${i ? 'L' : 'M'}${mx + c * cw + cw / 2} ${my + r * ch + ch / 2}`).join(' ');
  return (
    <SceneS start={start} dur={dur}>
      <HeadS s={s} dur={dur} kicker="El módulo" title="Células en serie: las tensiones se suman" />
      <svg style={{ position: 'absolute', inset: 0, width: '100%', height: '100%' }}>
        <rect x={mx - 14} y={my - 14} width={cols * cw + 28} height={rows * ch + 28} rx="8" fill="none" stroke="#9fb3cc" strokeWidth={4 + 4 * parts} />
        {order.map(([c, r], i) => (
          <rect key={i} x={mx + c * cw + 3} y={my + r * ch + 3} width={cw - 6} height={ch - 6} rx="3" fill={i < lit ? '#1d4f91' : '#0d2a52'} stroke="#3b5f8f" strokeWidth="1" />
        ))}
        {chain > 0 && <path d={path} fill="none" stroke={SL.cc} strokeWidth="3" opacity="0.9" />}
        <g opacity={parts}>
          <line x1={mx + cols * cw + 20} y1={my + 40} x2={mx + cols * cw + 120} y2={my + 40} stroke={SL.mut} strokeWidth="2" />
          <text x={mx + cols * cw + 130} y={my + 47} fill={SL.ink} fontFamily={DISP} fontSize="22">vidrio frontal</text>
          <line x1={mx + cols * cw + 20} y1={my + 230} x2={mx + cols * cw + 120} y2={my + 230} stroke={SL.mut} strokeWidth="2" />
          <text x={mx + cols * cw + 130} y={my + 237} fill={SL.ink} fontFamily={DISP} fontSize="22">marco de aluminio</text>
          <rect x={mx + cols * cw / 2 - 40} y={my + rows * ch + 24} width="80" height="40" rx="6" fill={SL.paper} stroke={SL.sun} strokeWidth="2.5" />
          <line x1={mx + cols * cw / 2 + 40} y1={my + rows * ch + 44} x2={mx + cols * cw + 120} y2={my + rows * ch + 44} stroke={SL.mut} strokeWidth="2" />
          <text x={mx + cols * cw + 130} y={my + rows * ch + 51} fill={SL.ink} fontFamily={DISP} fontSize="22">caja de conexiones con diodos</text>
        </g>
      </svg>
      <div style={{ position: 'absolute', left: 1080, top: 300, width: 720, opacity: popS(t, s + fr(6, 2)).op }}>
        <div style={{ fontFamily: MONO, fontSize: 18, color: SL.mut, letterSpacing: '0.16em' }}>CÉLULAS POR MÓDULO</div>
        <div style={{ fontFamily: DISP, fontSize: 34, color: SL.ink, fontWeight: 600, marginTop: 10, lineHeight: 1.35 }}>60 · 72<br /><span style={{ color: SL.mut, fontSize: 26 }}>media célula: 120 · 144</span></div>
      </div>
      <FormulaS at={s + fr(6, 3)} x="76%" y="62%" size={44} color={SL.cc} sub="decenas de voltios por módulo">{lit > 0 ? `${Math.max(1, Math.round(sum * 60))} × 0,6 V ≈ ${Math.round(Math.max(1, Math.round(sum * 60)) * 0.6)} V` : ''}</FormulaS>
    </SceneS>
  );
}

// 7 · String (serie) y array (paralelo)
function S_StringArray({ start, dur }) {
  const t = useTime(); const s = start;
  const ser = segS(t, s + fr(7, 0), 2.4);
  const par = segS(t, s + fr(7, 2), 1.4);
  const hier = segS(t, s + fr(7, 4), 0.8);
  const nMods = 5;
  const vTxt = Math.round(ser * nMods) * 40;
  return (
    <SceneS start={start} dur={dur}>
      <HeadS s={s} dur={dur} kicker="String y array" title="Serie suma tensiones · paralelo suma corrientes" size={46} />
      <svg style={{ position: 'absolute', inset: 0, width: '100%', height: '100%' }} opacity={1 - 0.9 * hier}>
        {[0, 1, 2].map(row => {
          const show = row === 0 ? 1 : par;
          const yy = 290 + row * 170;
          return (
            <g key={row} opacity={show}>
              {[...Array(nMods)].map((_, i) => {
                const on = row > 0 || ser * nMods > i;
                return <g key={i} opacity={on ? 1 : 0.15}><PanelG x={220 + i * 150} y={yy} w={110} h={130} cols={4} rows={5} /></g>;
              })}
              {[...Array(nMods - 1)].map((_, i) => (row > 0 || ser * nMods > i + 1) && <line key={i} x1={330 + i * 150} y1={yy + 65} x2={370 + i * 150} y2={yy + 65} stroke={SL.cc} strokeWidth="4" />)}
              <line x1={220 + nMods * 150 - 40} y1={yy + 65} x2={1080} y2={yy + 65} stroke={SL.cc} strokeWidth="4" opacity={row === 0 ? ser : 1} />
              {row === 0 && <text x={300} y={yy - 18} fill={SL.cc} fontFamily={MONO} fontSize="26" fontWeight="700">string: {vTxt} V</text>}
            </g>
          );
        })}
        <g opacity={par}>
          <line x1={1080} y1={355} x2={1080} y2={695} stroke={SL.cc} strokeWidth="6" />
          <line x1={1080} y1={525} x2={1250} y2={525} stroke={SL.cc} strokeWidth="6" />
          <text x={1270} y={500} fill={SL.cc} fontFamily={MONO} fontSize="26" fontWeight="700">3 × 10 A = 30 A</text>
          <text x={1270} y={540} fill={SL.mut} fontFamily={DISP} fontSize="22">las corrientes se suman</text>
        </g>
      </svg>
      {hier > 0 && (
        <div style={{ position: 'absolute', left: 0, right: 0, top: 440, display: 'flex', justifyContent: 'center', alignItems: 'center', gap: 30, opacity: hier }}>
          {['Célula', 'Módulo', 'String', 'Array'].map((k, i) => (
            <React.Fragment key={k}>
              {i > 0 && <span style={{ fontFamily: MONO, fontSize: 46, color: SL.sun }}>→</span>}
              <div style={{ padding: '28px 40px', borderRadius: 14, background: SL.paper, border: `2px solid ${SL.sun}`, fontFamily: DISP, fontSize: 40, fontWeight: 700, color: SL.ink, boxShadow: SL.shadow }}>{k}</div>
            </React.Fragment>
          ))}
        </div>
      )}
    </SceneS>
  );
}

// 8 · Seguridad: el string siempre tiene tensión con luz
function S_Seguridad({ start, dur }) {
  const t = useTime(); const s = start;
  const v = segS(t, s + fr(8, 2), 1.4);
  return (
    <SceneS start={start} dur={dur}>
      <HeadS s={s} dur={dur} kicker="Seguridad" title="Con luz, el string siempre tiene tensión" color={SL.sun} />
      <svg style={{ position: 'absolute', inset: 0, width: '100%', height: '100%' }}>
        <SunG x={1640} y={290} r={50} t={t} />
        {[...Array(10)].map((_, i) => <PanelG key={i} x={170 + i * 112} y={360} w={92} h={120} cols={3} rows={5} />)}
        {[...Array(10)].map((_, i) => <PanelG key={'b' + i} x={170 + i * 112} y={500} w={92} h={120} cols={3} rows={5} />)}
        <path d="M1290 420 H1380 V560 H1290" fill="none" stroke={SL.cc} strokeWidth="5" />
        <path d="M216 620 V700 H1480" fill="none" stroke={SL.cc} strokeWidth="5" strokeDasharray="14 10" strokeDashoffset={-(t * 40) % 24} />
        <rect x="1480" y="650" width="220" height="110" rx="12" fill={SL.paper} stroke={SL.bad} strokeWidth="3" />
        <text x="1590" y="700" textAnchor="middle" fill={SL.bad} fontFamily={MONO} fontSize="26" fontWeight="700">INVERSOR OFF</text>
        <text x="1590" y="735" textAnchor="middle" fill={SL.mut} fontFamily={DISP} fontSize="18">apagado, pero…</text>
        <text x="830" y="760" textAnchor="middle" fill={SL.cc} fontFamily={MONO} fontSize="46" fontWeight="700" opacity={v}>{'>'} {Math.round(800 * v)} V</text>
        <g opacity={v}><DcG x={1000} y={744} w={50} sw={5} /></g>
        <text x="830" y="800" textAnchor="middle" fill={SL.mut} fontFamily={DISP} fontSize="21" opacity={v}>20 módulos en serie</text>
      </svg>
      <SafetyS at={s + fr(8, 3)} y="88%">Trata el string como un circuito energizado: usa EPP y procedimientos para corriente continua.</SafetyS>
    </SceneS>
  );
}

const SCENES_PS1C2 = [
  { C: (p) => <TitleCardS {...p} moduleNo={1} claseNo={2} title="Efecto fotovoltaico: de la célula al array" objetivo="Del fotón a la corriente: cómo la célula convierte la luz en corriente continua y cómo se agrupan células, módulos, strings y arrays." />, dur: 13, label: 'Apertura' },
  { C: S_Fotones, dur: 17, label: 'Fotones' },
  { C: S_Union, dur: 19, label: 'La unión PN' },
  { C: S_Separacion, dur: 18, label: 'Separación de cargas' },
  { C: S_Corriente, dur: 17, label: 'Corriente continua' },
  { C: S_Celula, dur: 14, label: 'Una célula' },
  { C: S_Modulo, dur: 24, label: 'El módulo' },
  { C: S_StringArray, dur: 19, label: 'String y array' },
  { C: S_Seguridad, dur: 20, label: 'Seguridad' },
  { C: (p) => <ClosingS {...p} line="El fotón libera cargas, la unión PN las separa y el circuito las aprovecha como corriente continua." question="Un string tiene 20 módulos de 40 V en serie. ¿Qué tensión aproximada entrega?" />, dur: 17, label: 'Cierre' },
];
window.SCENES_PS1C2 = SCENES_PS1C2;
