// slides.jsx — Hijos de la Intimidad, Capítulo 8
// Componentes para los slides individuales

const TYPE_SCALE = {
  display: 128,
  title: 80,
  subtitle: 52,
  lead: 40,
  body: 32,
  small: 26,
  micro: 22,
  caption: 24
};

const SPACING = {
  paddingTop: 110,
  paddingBottom: 100,
  paddingX: 130,
  titleGap: 56,
  itemGap: 32
};

// ─── Imágenes curadas (Unsplash) ──────────────────────────────────────────
// Fotografías profesionales, gratuitas, alusivas a las verdades del capítulo.
// IMG: solo se usa imgPortada (subible vía Tweaks). El resto del deck usa
// ilustraciones SVG animadas en illustrations.jsx.
const IMG = {};

// ─── Paleta (azul nocturno profundo + acento cálido) ──────────────────────
const PALETTES = {
  noche: {
    name: 'Azul nocturno',
    bg: '#edeef3',
    panel: '#f4f5f8',
    soft: '#bcc4d8',
    medium: '#5a6688',
    deep: '#2a2f4a',
    abyss: '#0f1226',
    warm: '#e6c89a',
    warmDeep: '#b8916a',
    ink: '#1a1d2e',
    inkSoft: '#4d5470'
  },
  amanecer: {
    name: 'Amanecer cálido',
    bg: '#f5efe6',
    panel: '#faf6ef',
    soft: '#e0d2bc',
    medium: '#a89578',
    deep: '#5e4d36',
    abyss: '#2a2218',
    warm: '#c89a6a',
    warmDeep: '#8a5a3b',
    ink: '#2a2218',
    inkSoft: '#6a5a44'
  },
  hogar: {
    name: 'Hogar tenue',
    bg: '#f0eef3',
    panel: '#f7f5f9',
    soft: '#d8d2e6',
    medium: '#8a7fb0',
    deep: '#4a3f7a',
    abyss: '#1f1a3d',
    warm: '#e0c3a0',
    warmDeep: '#b08560',
    ink: '#1f1a3d',
    inkSoft: '#5a5070'
  }
};

// ─── Editable text helper ─────────────────────────────────────────────────
function Editable({ tag = 'span', children, style, ...rest }) {
  const Tag = tag;
  return <Tag suppressContentEditableWarning contentEditable={false} style={style} {...rest}>{children}</Tag>;
}

// ─── Frame: cálido fondo claro con marco "página de libro" ─────────────────
function SlideFrame({ pal, children, variant = 'light', label, vignette = true, padded = true }) {
  const isDark = variant === 'dark';
  const bg = isDark ? pal.abyss : pal.bg;
  const fg = isDark ? pal.bg : pal.ink;
  return (
    <div style={{
      position: 'absolute', inset: 0,
      background: bg,
      color: fg,
      padding: padded ? `${SPACING.paddingTop}px ${SPACING.paddingX}px ${SPACING.paddingBottom}px` : 0,
      display: 'flex', flexDirection: 'column',
      overflow: 'hidden',
      fontFamily: "'Manrope', system-ui, sans-serif", fontSize: "4px"
    }}>
      {vignette &&
      <div style={{
        position: 'absolute', inset: 0, pointerEvents: 'none',
        background: isDark ?
        `radial-gradient(ellipse 90% 70% at 50% 30%, ${pal.deep}55, transparent 70%), radial-gradient(ellipse 100% 100% at 50% 110%, ${pal.warm}18, transparent 60%)` :
        `radial-gradient(ellipse 80% 60% at 50% 0%, ${pal.warm}22, transparent 70%), radial-gradient(ellipse 100% 100% at 50% 110%, ${pal.soft}55, transparent 60%)`
      }} />
      }
      {label &&
      <div style={{
        position: 'absolute', top: 56, left: SPACING.paddingX,
        fontSize: TYPE_SCALE.caption, letterSpacing: '0.22em', textTransform: 'uppercase',
        color: isDark ? pal.warm : pal.medium, fontWeight: 500
      }}>{label}</div>
      }
      <div style={{ position: 'relative', flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0, paddingBottom: 20 }}>
        {children}
      </div>
      {padded &&
      <div style={{
        position: 'absolute', bottom: 36, left: SPACING.paddingX, right: SPACING.paddingX,
        display: 'flex', justifyContent: 'space-between', alignItems: 'center',
        fontSize: TYPE_SCALE.caption, letterSpacing: '0.18em',
        color: isDark ? pal.soft + '99' : pal.inkSoft + 'aa',
        fontWeight: 500, whiteSpace: 'nowrap'
      }}>
          <span>HIJOS DE LA INTIMIDAD</span>
          <span style={{ display: 'flex', alignItems: 'center', gap: 14, whiteSpace: 'nowrap' }}>
            <span style={{ width: 6, height: 6, borderRadius: '50%', background: pal.warm, flexShrink: 0 }} />
            CAPÍTULO 8 · PARTE II
          </span>
        </div>
      }
    </div>);

}

function SlideMark({ pal, isDark }) {
  return (
    <div style={{
      position: 'absolute', bottom: -50, left: 0, right: 0,
      display: 'flex', justifyContent: 'space-between',
      fontSize: TYPE_SCALE.caption, letterSpacing: '0.18em',
      color: isDark ? pal.soft + '99' : pal.inkSoft + 'aa',
      fontWeight: 500
    }}>
      <span>HIJOS DE LA INTIMIDAD</span>
      <span style={{ display: 'flex', alignItems: 'center', gap: 14 }}>
        <span style={{ width: 6, height: 6, borderRadius: '50%', background: pal.warm }} />
        CAPÍTULO 8 · PARTE II
      </span>
    </div>);

}

// ─── Image placeholder con texto monoespaciado ─────────────────────────────
function ImageSlot({ pal, src, caption, style, alt, onSet, hideCaption }) {
  const hasImg = !!src;
  return (
    <div style={{
      position: 'relative',
      borderRadius: 6,
      overflow: 'hidden',
      background: hasImg ? '#000' : `repeating-linear-gradient(135deg, ${pal.soft}66 0 1px, transparent 1px 14px), ${pal.panel}`,
      border: `1px solid ${pal.soft}88`,
      display: 'flex', alignItems: 'center', justifyContent: 'center',
      ...style
    }}>
      {hasImg ?
      <img src={src} alt={alt || ''} style={{ width: '100%', height: '100%', objectFit: 'cover' }} /> :
      !hideCaption &&
      <div style={{
        fontFamily: "'JetBrains Mono', ui-monospace, monospace",
        fontSize: TYPE_SCALE.micro,
        color: pal.medium, letterSpacing: '0.1em', textAlign: 'center', padding: 24,
        textTransform: 'uppercase'
      }}>
          {caption || 'imagen'}
        </div>
      }
    </div>);

}

// ─── 01 PORTADA ────────────────────────────────────────────────────────────
function SlidePortada({ pal, t, set }) {
  return (
    <SlideFrame pal={pal} variant="dark" label={null} padded={false} vignette={false}>
      <div style={{ position: 'absolute', inset: 0 }}>
        <ImageSlot pal={pal} src={t.imgPortada} hideCaption
        style={{ position: 'absolute', inset: 0, border: 'none', borderRadius: 0 }} />
        {!t.imgPortada && <div style={{ position: 'absolute', inset: 0 }}><IllusPortada pal={pal} /></div>}
        <div style={{
          position: 'absolute', inset: 0,
          background: `linear-gradient(180deg, ${pal.abyss}d8 0%, ${pal.abyss}88 45%, ${pal.abyss}f5 100%)`,
          pointerEvents: 'none'
        }} />
      </div>
      <div style={{
        position: 'relative', flex: 1,
        padding: `${SPACING.paddingTop}px ${SPACING.paddingX}px ${SPACING.paddingBottom}px`,
        display: 'flex', flexDirection: 'column', justifyContent: 'space-between', color: pal.bg
      }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 18, fontSize: TYPE_SCALE.caption, letterSpacing: '0.32em', textTransform: 'uppercase', color: pal.warm, fontWeight: 500 }}>
          <span style={{ width: 48, height: 1, background: pal.warm }} />
          Capítulo 8 · Parte II
        </div>
        <div>
          <div style={{
            fontFamily: "'Fraunces', 'Cormorant Garamond', serif",
            fontSize: TYPE_SCALE.display,
            lineHeight: 0.98,
            letterSpacing: '-0.02em',
            color: pal.bg,
            fontWeight: 300
          }}>
            De esclavos<br /><em style={{ fontWeight: 300, color: pal.warm }}>a hijos</em>
          </div>
          <div style={{
            marginTop: 36, fontSize: TYPE_SCALE.lead, color: pal.bg + 'cc',
            fontWeight: 300, maxWidth: 1100, lineHeight: 1.35
          }}>
            La diferencia entre quien se acerca a Dios como huérfano<br />
            y quien aprende a vivir como hijo.
          </div>
        </div>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end', fontSize: TYPE_SCALE.caption, letterSpacing: '0.18em', color: pal.bg + 'aa' }}>
          <span>HIJOS DE LA INTIMIDAD</span>
          <span style={{ color: pal.warm, textAlign: 'right' }}>· · ·</span>
        </div>
      </div>
    </SlideFrame>);

}

// ─── 02 EPÍGRAFES ─────────────────────────────────────────────────────────
function SlideEpigrafes({ pal, t }) {
  const quotes = [
  'Para los religiosos el pecado afecta su ministerio y la imagen que han construido delante de los hombres. Para los íntimos, el pecado contamina el deleite de la relación con el Padre.',
  'Amar es más poderoso que juzgar cuando queremos transformar.',
  'Cada persona es una consecuencia de cómo ora.'];

  return (
    <SlideFrame pal={pal} label="Tres frases que abren el capítulo">
      <div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: 64, flex: 1, maxWidth: 1500, marginTop: 40 }}>
        {quotes.map((q, i) =>
        <div key={i} style={{ display: 'flex', gap: 40, alignItems: 'flex-start' }}>
            <div style={{
            fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.subtitle,
            color: pal.warmDeep, fontWeight: 300, fontStyle: 'italic',
            minWidth: 60, lineHeight: 1
          }}>{String(i + 1).padStart(2, '0')}</div>
            <div style={{
            fontFamily: "'Fraunces', serif",
            fontSize: TYPE_SCALE.lead, lineHeight: 1.3, color: pal.deep, fontWeight: 300,
            fontStyle: 'italic', maxWidth: 1300
          }}>"{q}"</div>
          </div>
        )}
      </div>
    </SlideFrame>);

}

// ─── 03 DONDE NOS QUEDAMOS ─────────────────────────────────────────────────
function SlideRecap({ pal, t }) {
  return (
    <SlideFrame pal={pal} label="Donde nos quedamos">
      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 80, alignItems: 'center', flex: 1, marginTop: 20 }}>
        <div>
          <div style={{
            width: '100%', height: 280, marginBottom: 32, position: 'relative'
          }}>
            <IllusRecap pal={pal} />
          </div>
          <div style={{ fontFamily: "'Fraunces', serif", fontSize: 64, lineHeight: 1.05, color: pal.deep, fontWeight: 300, letterSpacing: '-0.01em' }}>
            Hoy el Padre nos sigue haciendo preguntas<br />
            <em style={{ color: pal.warmDeep }}>para acercarnos más a su corazón</em>
          </div>
          <div style={{ marginTop: 24, fontSize: 28, lineHeight: 1.45, color: pal.inkSoft, maxWidth: 700 }}>
            En la primera parte de éste capítulo vimos tres áreas que diferencian al huérfano del hijo. Hoy recorremos siete más — para seguirnos preguntando: <em style={{ color: pal.deep }}>¿estoy viviendo como hijo o como esclavo?</em>
          </div>
        </div>
        <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
          {[
          ['1', 'Síntoma principal'],
          ['2', 'Identidad'],
          ['3', 'Imagen propia'],
          ['4', 'Motivaciones ministeriales', true],
          ['5', 'Santidad', true],
          ['6', 'Placer y consuelo', true],
          ['7', 'Relación con el prójimo', true],
          ['8', 'Manejo de errores ajenos', true],
          ['9', 'Autoridad', true],
          ['10', 'Visión de Dios y palabras', true],
          ['11', 'Recompensa', true]].
          map(([n, label, today]) =>
          <div key={n} style={{
            display: 'flex', alignItems: 'baseline', gap: 20,
            padding: '10px 22px',
            background: today ? pal.warm + '22' : 'transparent',
            borderLeft: `2px solid ${today ? pal.warm : pal.soft}`,
            borderRadius: 4
          }}>
              <span style={{ fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.small, color: today ? pal.warmDeep : pal.medium, minWidth: 36, fontWeight: 400 }}>{n}</span>
              <span style={{ fontSize: TYPE_SCALE.small, color: today ? pal.deep : pal.inkSoft, fontWeight: today ? 500 : 400 }}>{label}</span>
              {today && <span style={{ marginLeft: 'auto', fontSize: TYPE_SCALE.caption, letterSpacing: '0.18em', color: pal.warmDeep, textTransform: 'uppercase' }}>Hoy</span>}
            </div>
          )}
        </div>
      </div>
    </SlideFrame>);

}

// ─── 03 RESUMEN PARTE I (las primeras 3 áreas) ────────────────────────────
function SlideRecapAreas({ pal, t }) {
  const areas = [
    {
      n: '01',
      area: 'Síntoma principal',
      pregunta: '¿Cómo opera tu corazón?',
      huerfano: 'Por temor. Vivo cuidándome de fallar.',
      hijo: 'Por amor. Vivo descansando en su afecto.',
    },
    {
      n: '02',
      area: 'Identidad',
      pregunta: '¿En qué se basa tu valor?',
      huerfano: 'En lo que HAGO. Mi rendimiento me define.',
      hijo: 'En lo que SOY. Hijo amado, antes que nada.',
    },
    {
      n: '03',
      area: 'Imagen propia',
      pregunta: '¿Cómo te ves a ti mismo?',
      huerfano: 'Inseguridad, comparación, auto-rechazo.',
      hijo: 'Seguro en el amor del Padre, sin máscaras.',
    },
  ];

  return (
    <SlideFrame pal={pal} label="Capítulo 8 · Parte I">
      <div style={{
        marginTop: 4,
        fontFamily: "'Fraunces', serif",
        fontSize: TYPE_SCALE.title,
        color: pal.deep,
        fontWeight: 300,
        letterSpacing: '-0.01em',
        lineHeight: 1.05
      }}>
        Donde nos <em style={{ color: pal.warmDeep }}>quedamos</em>
      </div>
      <div style={{
        marginTop: 14,
        fontFamily: "'Fraunces', serif",
        fontSize: TYPE_SCALE.lead,
        color: pal.inkSoft,
        fontWeight: 300,
        fontStyle: 'italic',
        maxWidth: 1100
      }}>
        Tres áreas que ya recorrimos como cuerpo. La raíz del corazón huérfano y la del corazón de hijo.
      </div>

      <div style={{
        marginTop: 36,
        flex: 1,
        display: 'grid',
        gridTemplateColumns: '1fr 0.85fr 1fr',
        borderTop: `1px solid ${pal.soft}`
      }}>
        <div style={{
          padding: '14px 32px 14px 0',
          fontSize: TYPE_SCALE.caption,
          letterSpacing: '0.22em',
          textTransform: 'uppercase',
          color: pal.medium,
          fontWeight: 600,
          textAlign: 'right',
          borderBottom: `1px solid ${pal.soft}`
        }}>Huérfano · Esclavo</div>
        <div style={{
          padding: '14px 24px',
          fontSize: TYPE_SCALE.caption,
          letterSpacing: '0.22em',
          textTransform: 'uppercase',
          color: pal.inkSoft,
          fontWeight: 600,
          textAlign: 'center',
          borderBottom: `1px solid ${pal.soft}`
        }}>Tema</div>
        <div style={{
          padding: '14px 0 14px 32px',
          fontSize: TYPE_SCALE.caption,
          letterSpacing: '0.22em',
          textTransform: 'uppercase',
          color: pal.warmDeep,
          fontWeight: 600,
          borderBottom: `1px solid ${pal.soft}`
        }}>Hijo</div>

        {areas.map((a) =>
          <React.Fragment key={a.n}>
            <div style={{
              padding: '28px 32px 28px 0',
              textAlign: 'right',
              color: pal.inkSoft,
              fontSize: TYPE_SCALE.body,
              lineHeight: 1.3,
              borderBottom: `1px solid ${pal.soft}66`,
              display: 'flex', alignItems: 'center', justifyContent: 'flex-end'
            }}>
              {a.huerfano}
            </div>

            <div style={{
              padding: '24px 16px',
              textAlign: 'center',
              borderBottom: `1px solid ${pal.soft}66`,
              background: pal.panel,
              display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center'
            }}>
              <div style={{
                fontFamily: "'Fraunces', serif",
                fontSize: TYPE_SCALE.subtitle,
                color: pal.warmDeep,
                fontWeight: 300,
                letterSpacing: '-0.01em',
                lineHeight: 1
              }}>{a.n}</div>
              <div style={{
                marginTop: 6,
                fontSize: TYPE_SCALE.small,
                color: pal.deep,
                fontWeight: 600,
                letterSpacing: '0.01em'
              }}>{a.area}</div>
              <div style={{
                marginTop: 10,
                fontFamily: "'Fraunces', serif",
                fontSize: TYPE_SCALE.small,
                fontStyle: 'italic',
                color: pal.medium,
                fontWeight: 300,
                lineHeight: 1.25
              }}>«{a.pregunta}»</div>
            </div>

            <div style={{
              padding: '28px 0 28px 32px',
              color: pal.deep,
              fontSize: TYPE_SCALE.body,
              lineHeight: 1.3,
              borderBottom: `1px solid ${pal.soft}66`,
              display: 'flex', alignItems: 'center'
            }}>
              {a.hijo}
            </div>
          </React.Fragment>
        )}
      </div>

      <div style={{
        marginTop: 28,
        fontFamily: "'Fraunces', serif",
        fontSize: TYPE_SCALE.lead,
        color: pal.deep,
        fontWeight: 300,
        fontStyle: 'italic',
        textAlign: 'center'
      }}>
        Hoy seguimos con <em style={{ color: pal.warmDeep }}>las siete áreas restantes</em>.
      </div>
    </SlideFrame>);

}

// ─── 04 MOTIVACIONES MINISTERIALES ─────────────────────────────────────────
function SlideMotivaciones({ pal, t }) {
  return (
    <ContrastSlide
      pal={pal}
      area="03 · Motivaciones ministeriales"
      title="¿Para quién está sirviendo tu corazón?"
      huerfano="Sirve para ganar el favor de los hombres. Persigue fama, dinero y reputación, aunque su boca diga lo contrario."
      hijo="Sirve por el placer de agradar al Padre. Sigue el evangelio aunque pierda fama, dinero y reputación."
      verse={{ ref: '1 Pedro 5:1', text: '… que soy también participante de la gloria que será revelada.' }}
      bottom="El éxito de un hombre no se mide por la grandeza de su ministerio terrenal, sino por la dimensión del Reino al que representa."
      image={<IllusMotivaciones pal={pal} />} />);


}

// ─── 05 SANTIDAD POR AMOR ─────────────────────────────────────────────────
function SlideSantidad({ pal, t }) {
  return (
    <ContrastSlide
      pal={pal}
      area="04 · Santidad"
      title="Por disciplina, o por deleite"
      huerfano="Cumple normas para no ser rechazado. Marca tarjeta. Busca santidad para que su jefe no lo despida."
      hijo="Cuida la pureza para no perder el abrazo del Padre ni entristecer al Espíritu. Santidad por amor."
      verse={{ ref: 'Salmo 110:3', text: 'Tu pueblo se te ofrecerá voluntariamente en el día de tu poder, en la hermosura de la santidad.' }}
      bottom={'"Para los religiosos el pecado afecta su ministerio y la imagen que han construido delante de los hombres. Para los íntimos, el pecado contamina el deleite de la relación con el Padre."'}
      image={<IllusSantidad pal={pal} />} />);


}

// ─── 06 DESCANSO ──────────────────────────────────────────────────────────
function SlideDescanso({ pal, t }) {
  return (
    <ContrastSlide
      pal={pal}
      area="05 · Fuentes de placer y consuelo"
      title="Dónde corres cuando te cansas"
      huerfano="Busca alivio fuera de Dios: vicios, pornografía, redes, relaciones desvirtuadas. Calman un rato y hunden más."
      hijo="Corre a la Presencia. Encuentra descanso en la Palabra, en la adoración, en relaciones de Reino."
      verse={{ ref: 'Mateo 11:28', text: 'Venid a mí todos los que estáis trabajados y cargados, y yo os haré descansar.' }}
      bottom="Cuando planifiques un tiempo de descanso, no pienses solo en un lugar. Piensa en una Persona."
      image={<IllusDescanso pal={pal} />} />);


}

// ─── 07 PRÓJIMO ──────────────────────────────────────────────────────────
function SlideProjimo({ pal, t }) {
  return (
    <ContrastSlide
      pal={pal}
      area="06 · Relación con los demás"
      title="Mirar al hermano sin envidia"
      huerfano="Compara, compite, critica. Tiene el síndrome de Caín: no soporta que Dios se agrade de la ofrenda del otro."
      hijo="Honra. Se alegra con quien es prosperado. Sabe que es único y amado, no necesita compararse."
      verse={{ ref: 'Filipenses 2:3', text: 'Nada hagáis por contienda o por vanagloria; antes bien con humildad, estimando cada uno a los demás como superiores a él mismo.' }}
      bottom="Cuando otro hijo es prosperado en algo que tú esperas, Dios está intentando inspirarte: «Si lo hice con él, lo haré contigo»."
      image={<IllusProjimo pal={pal} />} />);


}

// ─── 08 ERRORES AJENOS ────────────────────────────────────────────────────
function SlideErrores({ pal, t }) {
  return (
    <SlideFrame pal={pal} label="07 · Cuando el otro cae">
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column', justifyContent: 'center', maxWidth: 1700 }}>
        <div style={{ display: 'flex', gap: 64, alignItems: 'flex-start' }}>
          <div style={{ fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.title, color: pal.deep, fontWeight: 300, lineHeight: 1.05, letterSpacing: '-0.01em', flex: 1 }}>
            Acusar deja al otro mal<br />para que tú te veas bien.<br />
            <em style={{ color: pal.warmDeep }}>Restaurar deja al otro de pie.</em>
          </div>
          <div style={{ width: 520, height: 320, flexShrink: 0, position: 'relative' }}>
            <IllusErrores pal={pal} />
          </div>
        </div>
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 60, marginTop: 64 }}>
          <div style={{ padding: '36px 0', borderTop: `1px solid ${pal.soft}` }}>
            <div style={{ fontSize: TYPE_SCALE.caption, letterSpacing: '0.22em', textTransform: 'uppercase', color: pal.medium, fontWeight: 500 }}>El esclavo expone</div>
            <div style={{ marginTop: 18, fontSize: TYPE_SCALE.body, color: pal.inkSoft, lineHeight: 1.45, fontStyle: 'italic' }}>
              "Yo te dije, había algo de esta persona que no me cerraba. Que tenga su merecido."
            </div>
          </div>
          <div style={{ padding: '36px 0', borderTop: `2px solid ${pal.warm}` }}>
            <div style={{ fontSize: TYPE_SCALE.caption, letterSpacing: '0.22em', textTransform: 'uppercase', color: pal.warmDeep, fontWeight: 500 }}>El hijo cubre y restaura</div>
            <div style={{ marginTop: 18, fontSize: TYPE_SCALE.body, color: pal.deep, lineHeight: 1.45 }}>
              Ve la caída del otro como una pérdida personal. Si una parte del cuerpo duele, todo el cuerpo siente dolor.
            </div>
          </div>
        </div>
        <div style={{ marginTop: 64, fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.subtitle, color: pal.deep, fontStyle: 'italic', fontWeight: 300, lineHeight: 1.25, maxWidth: 1500 }}>
          "Uno tiene autoridad sobre aquello que ama. <span style={{ color: pal.warmDeep }}>Por eso Dios tiene autoridad sobre el mundo.</span>"
        </div>
      </div>
    </SlideFrame>);

}

// ─── 09 AUTORIDAD ─────────────────────────────────────────────────────────
function SlideAutoridad({ pal, t }) {
  return (
    <ContrastSlide
      pal={pal}
      area="08 · Relación con la autoridad"
      title="¿Para quién está sirviendo tu corazón?"
      huerfano="Toma la exhortación como condenación. Vive en independencia, ante la menor incomodidad cambia de iglesia."
      hijo="Recibe la disciplina como camino de vida. Permanece. Honra a sus padres y autoridades espirituales."
      verse={{ ref: 'Juan 14:15', text: 'Si ustedes me aman, obedecerán mis mandamientos.' }}
      bottom="El éxito de un hombre no se mide por la grandeza de su ministerio terrenal, sino por la dimensión del Reino al que representa."
      image={<IllusAutoridad pal={pal} />} />);


}

// ─── 10 VISIÓN DE DIOS / ABBA ─────────────────────────────────────────────
function SlideAbba({ pal, t }) {
  return (
    <SlideFrame pal={pal} variant="dark" label="09 · Visión de Dios">
      <div style={{ flex: 1, display: 'grid', gridTemplateColumns: '1.1fr 1fr', gap: 100, alignItems: 'center' }}>
        <div>
          <div style={{ fontSize: TYPE_SCALE.caption, letterSpacing: '0.22em', textTransform: 'uppercase', color: pal.warm, fontWeight: 500 }}>Las palabras delatan al corazón</div>
          <div style={{ marginTop: 36, fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.display, color: pal.bg, fontWeight: 300, lineHeight: 0.95, letterSpacing: '-0.02em' }}>
            De <em style={{ color: pal.bg + '88', fontWeight: 300 }}>"úsame"</em><br />
            a <em style={{ color: pal.warm }}>"Abba"</em>.
          </div>
          <div style={{ marginTop: 48, fontSize: TYPE_SCALE.body, color: pal.bg + 'cc', maxWidth: 700, lineHeight: 1.5 }}>
            Las cosas se usan, las personas se aman.<br />
            No eres una cosa. Eres un hijo amado.
          </div>
        </div>
        <div style={{ display: 'flex', flexDirection: 'column', gap: 20 }}>
          <PalabrasCol pal={pal} side="huerfano" words={['Úsame', 'Soy tu esclavo', 'No soy digno', 'Sólo dame migajas']} />
          <PalabrasCol pal={pal} side="hijo" words={['Te amo', 'Soy tu hijo', 'Abba, Padre', 'Quiero estar contigo']} />
          <div style={{ marginTop: 16, padding: '28px 32px', borderLeft: `2px solid ${pal.warm}`, background: pal.deep + '88' }}>
            <div style={{ fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.lead, color: pal.bg, fontStyle: 'italic', lineHeight: 1.3, fontWeight: 300 }}>
              "Y por cuanto sois hijos, Dios envió a vuestros corazones el Espíritu de su Hijo, el cual clama: ¡Abba, Padre!"
            </div>
            <div style={{ marginTop: 14, fontSize: TYPE_SCALE.small, letterSpacing: '0.18em', color: pal.warm, textTransform: 'uppercase' }}>Gálatas 4:6</div>
          </div>
        </div>
      </div>
    </SlideFrame>);

}

function PalabrasCol({ pal, side, words }) {
  const isHijo = side === 'hijo';
  return (
    <div style={{
      padding: '24px 32px',
      background: isHijo ? pal.warm + '14' : 'transparent',
      borderLeft: `2px solid ${isHijo ? pal.warm : pal.soft + '66'}`
    }}>
      <div style={{ fontSize: TYPE_SCALE.caption, letterSpacing: '0.22em', textTransform: 'uppercase', color: isHijo ? pal.warm : pal.soft + 'cc', fontWeight: 500 }}>
        {isHijo ? 'Palabras del hijo' : 'Palabras del esclavo'}
      </div>
      <div style={{ marginTop: 14, display: 'flex', flexWrap: 'wrap', gap: '4px 24px', fontSize: TYPE_SCALE.body, color: isHijo ? pal.bg : pal.bg + '88', fontFamily: "'Fraunces', serif", fontStyle: 'italic', fontWeight: 300 }}>
        {words.map((w, i) =>
        <span key={i}>«{w}»{i < words.length - 1 ? <span style={{ color: pal.medium, margin: '0 8px' }}>·</span> : ''}</span>
        )}
      </div>
    </div>);

}

// ─── 11 SALARIO O HERENCIA ────────────────────────────────────────────────
function SlideHerencia({ pal, t }) {
  return (
    <SlideFrame pal={pal} label="10 · Recompensa">
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column', justifyContent: 'center', maxWidth: 1700 }}>
        <div style={{ fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.title, color: pal.deep, fontWeight: 300, lineHeight: 1.02, letterSpacing: '-0.015em', maxWidth: 1500 }}>
          El esclavo reclama <em style={{ color: pal.medium, fontWeight: 300 }}>su salario.</em><br />
          El hijo recibe <em style={{ color: pal.warmDeep }}>su herencia.</em>
        </div>
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 80, marginTop: 70 }}>
          <ScaleCol pal={pal} kind="salario" label="Salario" tagline="Remuneración temporal"
          items={['Mi casa', 'Mi auto', 'Mi reino personal', 'Hoy']} />
          <ScaleCol pal={pal} kind="herencia" label="Herencia" tagline="Recompensa eterna"
          items={['Las naciones', 'Una generación postrada ante Jesús', 'La belleza del Amado en toda la tierra', 'Para siempre']} />
        </div>
        <div style={{ marginTop: 60, paddingTop: 32, borderTop: `1px solid ${pal.soft}`, display: 'flex', gap: 48, alignItems: 'flex-start' }}>
          <div style={{ fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.lead, color: pal.deep, fontStyle: 'italic', fontWeight: 300, lineHeight: 1.3, flex: 1 }}>
            "Así que ya no eres esclavo, sino hijo; y si hijo, también heredero de Dios por medio de Cristo."
          </div>
          <div style={{ fontSize: TYPE_SCALE.small, letterSpacing: '0.2em', color: pal.warmDeep, textTransform: 'uppercase', whiteSpace: 'nowrap', fontWeight: 500, paddingTop: 10 }}>Gálatas 4:7</div>
        </div>
      </div>
    </SlideFrame>);

}

function ScaleCol({ pal, kind, label, tagline, items }) {
  const isH = kind === 'herencia';
  return (
    <div style={{
      padding: '36px 40px',
      background: isH ? pal.warm + '1c' : pal.soft + '40',
      borderRadius: 4,
      borderTop: `2px solid ${isH ? pal.warm : pal.medium}`
    }}>
      <div style={{ fontSize: TYPE_SCALE.caption, letterSpacing: '0.22em', textTransform: 'uppercase', color: isH ? pal.warmDeep : pal.medium, fontWeight: 600 }}>{label}</div>
      <div style={{ marginTop: 8, fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.subtitle, color: pal.deep, fontWeight: 300, fontStyle: 'italic' }}>{tagline}</div>
      <ul style={{ marginTop: 28, padding: 0, listStyle: 'none', display: 'flex', flexDirection: 'column', gap: 12 }}>
        {items.map((it, i) =>
        <li key={i} style={{ fontSize: TYPE_SCALE.body, color: pal.deep, display: 'flex', gap: 16, alignItems: 'baseline' }}>
            <span style={{ width: 5, height: 5, borderRadius: '50%', background: isH ? pal.warm : pal.medium, flexShrink: 0, transform: 'translateY(-4px)' }} />
            <span>{it}</span>
          </li>
        )}
      </ul>
    </div>);

}

// ─── 12 CUADRO RESUMEN ────────────────────────────────────────────────────
function SlideTabla({ pal, t }) {
  const rows = [
  ['Opera por temor', 'Síntoma principal', 'Opera por amor'],
  ['Basada en HACER', 'Identidad', 'Basada en SER'],
  ['Inseguridad, comparación, auto-rechazo', 'Imagen propia', 'Seguro en el amor del Padre'],
  ['Ganar el favor de los hombres', 'Motivaciones ministeriales', 'Agradar al Padre'],
  ['Cumplir normas para no ser rechazado', 'Santidad', 'Disfrutar la intimidad sin contaminación'],
  ['Placer fuera de Dios', 'Placer y consuelo', 'Descanso en la Presencia'],
  ['Competencia, celos, crítica', 'Relación con los demás', 'Honra, humildad, sentido de cuerpo'],
  ['Acusación y exposición', 'Errores ajenos', 'Cubre, da misericordia, restaura'],
  ['Autoridad como dolor, sin sumisión', 'Autoridad', 'Provisión de Dios para crecimiento'],
  ['Distante. Sin intimidad', 'Visión de Dios', 'Cercana. Conoce su grandeza y su abrazo'],
  ['"Úsame", "soy tu esclavo"', 'Palabras preferidas', '"Te amo", "Abba"'],
  ['Salario · temporal', 'Recompensa', 'Herencia · eterna']];

  return (
    <SlideFrame pal={pal} label="11 · El cuadro completo">
      <div style={{ marginTop: 8, fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.lead, color: pal.deep, fontWeight: 300, fontStyle: 'italic' }}>
        Doce áreas. Una sola pregunta: <span style={{ color: pal.warmDeep }}>¿esclavo o hijo?</span>
      </div>
      <div style={{
        marginTop: 24, flex: 1, display: 'grid',
        gridTemplateColumns: '1fr 0.7fr 1fr',
        fontSize: TYPE_SCALE.small, lineHeight: 1.25,
        borderTop: `1px solid ${pal.soft}`,
        paddingBottom: 24
      }}>
        <div style={{ padding: '16px 24px 16px 0', fontSize: TYPE_SCALE.caption, letterSpacing: '0.2em', textTransform: 'uppercase', color: pal.medium, borderBottom: `1px solid ${pal.soft}`, fontWeight: 600, textAlign: 'right' }}>Huérfano · Esclavo</div>
        <div style={{ padding: '16px 24px', fontSize: TYPE_SCALE.caption, letterSpacing: '0.2em', textTransform: 'uppercase', color: pal.inkSoft, borderBottom: `1px solid ${pal.soft}`, fontWeight: 600, textAlign: 'center' }}>Tema</div>
        <div style={{ padding: '16px 0 16px 24px', fontSize: TYPE_SCALE.caption, letterSpacing: '0.2em', textTransform: 'uppercase', color: pal.warmDeep, borderBottom: `1px solid ${pal.soft}`, fontWeight: 600 }}>Hijo</div>
        {rows.map(([h, t, hi], i) =>
        <React.Fragment key={i}>
            <div style={{ padding: '10px 24px 10px 0', borderBottom: `1px solid ${pal.soft}66`, color: pal.inkSoft, textAlign: 'right' }}>{h}</div>
            <div style={{ padding: '10px 24px', borderBottom: `1px solid ${pal.soft}66`, color: pal.deep, textAlign: 'center', fontWeight: 500, background: pal.panel }}>{t}</div>
            <div style={{ padding: '10px 0 10px 24px', borderBottom: `1px solid ${pal.soft}66`, color: pal.deep }}>{hi}</div>
          </React.Fragment>
        )}
      </div>
    </SlideFrame>);

}

// ─── 13 EXTINGUIR LA ORFANDAD ─────────────────────────────────────────────
function SlideExtincion({ pal, t }) {
  return (
    <SlideFrame pal={pal} label="12 · Cómo se extingue la orfandad">
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column', justifyContent: 'center', maxWidth: 1600 }}>
        <div style={{ fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.title, color: pal.deep, fontWeight: 300, lineHeight: 1.05, letterSpacing: '-0.01em' }}>
          La orfandad solo se extingue<br />
          <em style={{ color: pal.warmDeep }}>cerca del Padre.</em>
        </div>
        <div style={{ marginTop: 60, display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 48 }}>
          {[
          ['Pasas tiempo con Él', 'No alcanza con leer el mensaje. Hay que sentarse a su mesa, día tras día.'],
          ['Escuchas su voz', 'Le pides que te diga lo que siente por ti. Y oyes: «Ya no eres esclavo».'],
          ['Respondes Abba', 'Con corazón sincero, sin máscara. Su amor consume todo temor.']].
          map(([h, b], i) =>
          <div key={i} style={{ display: 'flex', flexDirection: 'column', gap: 18, paddingTop: 24, borderTop: `2px solid ${pal.warm}` }}>
              <div style={{ fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.caption, color: pal.warmDeep, letterSpacing: '0.18em', textTransform: 'uppercase', fontWeight: 600 }}>{`Paso 0${i + 1}`}</div>
              <div style={{ fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.subtitle, color: pal.deep, fontWeight: 300, lineHeight: 1.15 }}>{h}</div>
              <div style={{ fontSize: TYPE_SCALE.body, color: pal.inkSoft, lineHeight: 1.45 }}>{b}</div>
            </div>
          )}
        </div>
      </div>
    </SlideFrame>);

}

// ─── 14 DECLARACIÓN ───────────────────────────────────────────────────────
function SlideDeclaracion({ pal, t }) {
  return (
    <SlideFrame pal={pal} variant="dark" label="14 · Una declaración" vignette={false}>
      <div style={{ position: 'absolute', inset: 0, marginTop: -SPACING.paddingTop, marginLeft: -SPACING.paddingX, marginRight: -SPACING.paddingX, marginBottom: -SPACING.paddingBottom, overflow: 'hidden' }}>
        <div style={{ position: 'absolute', inset: 0, opacity: 0.55 }}>
          <IllusDeclaracion pal={pal} />
        </div>
        <div style={{ position: 'absolute', inset: 0, background: `linear-gradient(105deg, ${pal.abyss}ee 0%, ${pal.abyss}c8 45%, ${pal.abyss}66 100%)` }} />
      </div>
      <div style={{ position: 'relative', flex: 1, display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'flex-start', maxWidth: 1700, gap: 56 }}>
        <div style={{ fontSize: TYPE_SCALE.caption, letterSpacing: '0.32em', textTransform: 'uppercase', color: pal.warm, fontWeight: 500 }}>El Padre te dice hoy</div>
        <div style={{ fontFamily: "'Fraunces', serif", fontSize: 108, color: pal.bg, fontWeight: 300, letterSpacing: '-0.025em' }}>
          <div style={{ lineHeight: 1.3, marginBottom: 24 }}>
            Ya no eres <em style={{ color: pal.bg + '55', textDecoration: 'line-through', textDecorationColor: pal.warm, textDecorationThickness: 3, fontWeight: 300 }}>esclavo</em>.
          </div>
          <div style={{ lineHeight: 1.3 }}>
            Eres <em style={{ color: pal.warm }}>mi hijo</em>.
          </div>
        </div>
        <div style={{ fontSize: TYPE_SCALE.body, color: pal.bg + 'cc', maxWidth: 1400, lineHeight: 1.5, fontWeight: 300 }}>
          El sistema religioso acaba de perder un esclavo.<br />
          El cielo ha ganado <em style={{ color: pal.warm }}>un hijo de la intimidad con el Padre</em>.
        </div>
      </div>
    </SlideFrame>);

}

// ─── 15 PARA CONVERSAR ────────────────────────────────────────────────────
function SlideCierre({ pal, t }) {
  const preguntas = [
  'De las 10 áreas que vimos, ¿cuál te confronta más? ¿Por qué?'];

  return (
    <SlideFrame pal={pal} label="13 · Para conversar en la célula">
      <div style={{ flex: 1, display: 'grid', gridTemplateColumns: '0.9fr 1.1fr', gap: 100, alignItems: 'center' }}>
        <div>
          <div style={{
            width: '100%', height: 320, marginBottom: 36, position: 'relative'
          }}>
            <IllusCierre pal={pal} />
          </div>
          <div style={{ fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.title, color: pal.deep, fontWeight: 300, lineHeight: 1.02, letterSpacing: '-0.015em' }}>
            Hablémos y oremos<br />
            <em style={{ color: pal.warmDeep }}>juntos.</em>
          </div>
          <div style={{ marginTop: 28, fontSize: TYPE_SCALE.body, color: pal.inkSoft, lineHeight: 1.5, maxWidth: 600 }}>

          </div>
        </div>
        <ol style={{ padding: 0, margin: 0, listStyle: 'none', display: 'flex', flexDirection: 'column', gap: 28 }}>
          {preguntas.map((q, i) =>
          <li key={i} style={{ display: 'flex', gap: 32, alignItems: 'baseline', paddingBottom: 28, borderBottom: i < preguntas.length - 1 ? `1px solid ${pal.soft}` : 'none' }}>
              <span style={{ fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.subtitle, color: pal.warmDeep, fontStyle: 'italic', minWidth: 60, fontWeight: 300 }}>0{i + 1}</span>
              <span style={{ fontSize: TYPE_SCALE.lead, color: pal.deep, lineHeight: 1.35, fontWeight: 300 }}>{q}</span>
            </li>
          )}
        </ol>
      </div>
    </SlideFrame>);

}

// ─── ContrastSlide: layout reusable para los pares huérfano/hijo ──────────
function ContrastSlide({ pal, area, title, huerfano, hijo, verse, bottom, image }) {
  return (
    <SlideFrame pal={pal} label={area}>
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
        <div style={{ display: 'flex', gap: 64, alignItems: 'flex-start', marginTop: 12 }}>
          <div style={{ fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.title, color: pal.deep, fontWeight: 300, lineHeight: 1.05, letterSpacing: '-0.015em', flex: 1 }}>
            {title}
          </div>
          {image &&
          <div style={{
            width: 520, height: 320, flexShrink: 0,
            position: 'relative'
          }}>
              {image}
            </div>
          }
        </div>

        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 56, marginTop: 56 }}>
          <div style={{ paddingTop: 28, borderTop: `1px solid ${pal.soft}` }}>
            <div style={{ fontSize: TYPE_SCALE.caption, letterSpacing: '0.22em', textTransform: 'uppercase', color: pal.medium, fontWeight: 600 }}>Huérfano · Esclavo</div>
            <div style={{ marginTop: 18, fontSize: TYPE_SCALE.body, color: pal.inkSoft, lineHeight: 1.45 }}>{huerfano}</div>
          </div>
          <div style={{ paddingTop: 28, borderTop: `2px solid ${pal.warm}` }}>
            <div style={{ fontSize: TYPE_SCALE.caption, letterSpacing: '0.22em', textTransform: 'uppercase', color: pal.warmDeep, fontWeight: 600 }}>Hijo</div>
            <div style={{ marginTop: 18, fontSize: TYPE_SCALE.body, color: pal.deep, lineHeight: 1.45, fontWeight: 500 }}>{hijo}</div>
          </div>
        </div>

        {verse &&
        <div style={{ marginTop: 'auto', paddingTop: 48, display: 'flex', gap: 48, alignItems: 'flex-start', borderTop: `1px solid ${pal.soft}`, paddingTop: 40, marginTop: 56 }}>
            <div style={{ flex: 1, fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.lead, color: pal.deep, fontStyle: 'italic', lineHeight: 1.3, fontWeight: 300 }}>
              "{verse.text}"
            </div>
            <div style={{ fontSize: TYPE_SCALE.small, letterSpacing: '0.2em', color: pal.warmDeep, textTransform: 'uppercase', whiteSpace: 'nowrap', fontWeight: 500, paddingTop: 10 }}>{verse.ref}</div>
          </div>
        }

        {bottom &&
        <div style={{ marginTop: 32, fontSize: TYPE_SCALE.body, color: pal.inkSoft, fontStyle: 'italic', maxWidth: 1500, lineHeight: 1.4, margin: "10px 0px 0px" }}>
            {bottom}
          </div>
        }
      </div>
    </SlideFrame>);

}

// ─── 12.5 ENCUESTA EN VIVO ─────────────────────────────────────────────────
// Esta slide activa la dinámica: la célula escanea el QR y responde 10
// preguntas en sus móviles. Los resultados se proyectan en /resultados.
function SlideEncuesta({ pal, t }) {
  // URL configurable vía Tweaks. Por defecto, placeholder claro.
  const url = t.urlEncuesta && t.urlEncuesta.trim() || 'https://tu-encuesta.vercel.app';
  // QR generado en el cliente con un servicio público (sin auth).
  // dark module color = pal.deep, light = pal.bg → integra con la paleta.
  const qrSrc =
  'https://api.qrserver.com/v1/create-qr-code/?' +
  'size=720x720&margin=10&qzone=2&format=svg' +
  '&data=' + encodeURIComponent(url) +
  '&color=' + (pal.deep || '#0f1226').replace('#', '') +
  '&bgcolor=' + (pal.bg || '#edeef3').replace('#', '');

  return (
    <SlideFrame pal={pal} label="Pausa · Encuesta en vivo" variant="light">
      <div style={{ flex: 1, display: 'grid', gridTemplateColumns: '1fr 1.05fr', gap: 100, alignItems: 'center' }}>

        {/* IZQ — Texto de invitación */}
        <div>
          <div style={{
            fontSize: TYPE_SCALE.caption, letterSpacing: '0.28em', textTransform: 'uppercase',
            color: pal.warmDeep, fontWeight: 600
          }}>
            Una pausa · Para mirarnos
          </div>

          <div style={{
            marginTop: 36,
            fontFamily: "'Fraunces', serif",
            fontSize: TYPE_SCALE.title,
            color: pal.deep,
            fontWeight: 300,
            lineHeight: 1.0,
            letterSpacing: '-0.02em'
          }}>
            ¿Cómo estamos<br />
            <em style={{ color: pal.warmDeep }}>como hijos?</em>
          </div>

          <div style={{
            marginTop: 32,
            fontFamily: "'Fraunces', serif",
            fontSize: TYPE_SCALE.lead,
            color: pal.inkSoft,
            fontStyle: 'italic',
            fontWeight: 300,
            lineHeight: 1.3,
            maxWidth: 640
          }}>
            Antes de cerrar, vamos a hacernos esta pregunta — pero esta vez en silencio, cada uno con Dios.
          </div>

          {/* Lista de pasos */}
          <ol style={{
            marginTop: 56, padding: 0, listStyle: 'none',
            display: 'flex', flexDirection: 'column', gap: 22
          }}>
            {[
            ['Toma tu teléfono.', 'Apunta la cámara al código.'],
            ['Responde 10 preguntas.', 'Una balanza para cada área del corazón.'],
            ['Es anónimo.', 'Nadie sabrá qué respondiste tú — solo cómo está el grupo.']].map(([titulo, sub], i) =>
            <li key={i} style={{
              display: 'flex', gap: 28, alignItems: 'baseline',
              paddingBottom: 22,
              borderBottom: i < 2 ? `1px solid ${pal.soft}` : 'none'
            }}>
                <span style={{
                fontFamily: "'Fraunces', serif", fontSize: TYPE_SCALE.subtitle,
                color: pal.warmDeep, fontStyle: 'italic', fontWeight: 300,
                minWidth: 56, lineHeight: 1
              }}>
                  0{i + 1}
                </span>
                <span style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
                  <span style={{
                  fontSize: TYPE_SCALE.body, color: pal.deep,
                  lineHeight: 1.25, fontWeight: 500, letterSpacing: '-0.005em'
                }}>
                    {titulo}
                  </span>
                  <span style={{
                  fontSize: TYPE_SCALE.small, color: pal.inkSoft,
                  lineHeight: 1.35
                }}>
                    {sub}
                  </span>
                </span>
              </li>
            )}
          </ol>
        </div>

        {/* DER — QR + URL */}
        <div style={{
          display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 32,
          position: 'relative'
        }}>
          {/* Glow cálido detrás del QR */}
          <div style={{
            position: 'absolute', width: 720, height: 720,
            top: '50%', left: '50%', transform: 'translate(-50%, -55%)',
            background: `radial-gradient(circle, ${pal.warm}55, transparent 60%)`,
            filter: 'blur(40px)', pointerEvents: 'none'
          }} />

          {/* QR card */}
          <div style={{
            width: 620, height: 620,
            background: pal.bg,
            border: `1px solid ${pal.soft}`,
            borderRadius: 24,
            padding: 36,
            display: 'flex', alignItems: 'center', justifyContent: 'center',
            boxShadow: `0 30px 60px ${pal.deep}22, 0 0 0 1px ${pal.warm}33`,
            position: 'relative', zIndex: 1
          }}>
            <img
              src={qrSrc}
              alt={`Código QR para ${url}`}
              style={{ width: '100%', height: '100%', display: 'block' }}
              onError={(e) => {
                // Fallback si la API de QR falla — muestra solo la URL en grande
                e.currentTarget.style.display = 'none';
                const fallback = e.currentTarget.parentElement.querySelector('[data-qr-fallback]');
                if (fallback) fallback.style.display = 'flex';
              }} />
            <div data-qr-fallback style={{
              display: 'none',
              flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
              textAlign: 'center', gap: 16
            }}>
              <div style={{
                fontFamily: "'Fraunces', serif", fontSize: 48,
                color: pal.deep, fontWeight: 300
              }}>
                Abre tu navegador en
              </div>
              <div style={{
                fontFamily: 'ui-monospace, monospace', fontSize: 36,
                color: pal.warmDeep, fontWeight: 600, wordBreak: 'break-all'
              }}>
                {url.replace(/^https?:\/\//, '')}
              </div>
            </div>
          </div>

          {/* URL en texto, debajo */}
          <div style={{
            display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 8,
            position: 'relative', zIndex: 1
          }}>
            <div style={{
              fontSize: TYPE_SCALE.caption, letterSpacing: '0.22em',
              textTransform: 'uppercase', color: pal.medium, fontWeight: 600
            }}>
              o entra a
            </div>
            <div style={{
              fontFamily: 'ui-monospace, "SF Mono", Menlo, monospace',
              fontSize: TYPE_SCALE.subtitle,
              color: pal.warmDeep, fontWeight: 600,
              letterSpacing: '-0.015em',
              padding: '14px 32px',
              background: pal.panel,
              borderRadius: 12,
              border: `1px solid ${pal.soft}`
            }}>
              {url.replace(/^https?:\/\//, '')}
            </div>
          </div>
        </div>
      </div>
    </SlideFrame>);

}

Object.assign(window, {
  TYPE_SCALE, SPACING, PALETTES,
  SlidePortada, SlideEpigrafes, SlideRecap, SlideRecapAreas, SlideMotivaciones, SlideSantidad,
  SlideDescanso, SlideProjimo, SlideErrores, SlideAutoridad, SlideAbba,
  SlideHerencia, SlideTabla, SlideEncuesta, SlideExtincion, SlideDeclaracion, SlideCierre
});