))}
diff --git a/src/lib/sanitize.js b/src/lib/sanitize.js
new file mode 100644
index 0000000..017089c
--- /dev/null
+++ b/src/lib/sanitize.js
@@ -0,0 +1,20 @@
+import DOMPurify from 'dompurify'
+
+// Los fragmentos HTML que llegan desde Elementor (titulos, parrafos, items
+// de lista, titulos de acordeon) se inyectan con dangerouslySetInnerHTML
+// porque conservan enfasis/color que forman parte del contenido original.
+// Antes de eso pasan por aqui: la lista de etiquetas/atributos permitidos
+// es deliberadamente pequena -- cubre solo el marcado de texto en linea que
+// realmente aparece en site.json (ver scripts/extract_site.py), nunca
+// scripts, iframes ni manejadores de eventos.
+const ALLOWED_TAGS = [
+ 'a', 'b', 'strong', 'i', 'em', 'u', 'span', 'br',
+ 'p', 'div', 'h2', 'h3', 'h4', 'h5', 'h6',
+ 'ul', 'ol', 'li', 'sup', 'sub',
+]
+const ALLOWED_ATTR = ['href', 'target', 'rel', 'style', 'dir', 'class']
+
+export function sanitizeHtml(html) {
+ if (!html) return ''
+ return DOMPurify.sanitize(html, { ALLOWED_TAGS, ALLOWED_ATTR })
+}
diff --git a/src/main.jsx b/src/main.jsx
index b9a1a6d..48d447d 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -2,9 +2,12 @@ import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.jsx'
+import { Router } from './router/router.jsx'
createRoot(document.getElementById('root')).render(
-
+
+
+ ,
)
diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx
new file mode 100644
index 0000000..1c725c8
--- /dev/null
+++ b/src/pages/Home.jsx
@@ -0,0 +1,59 @@
+import { useEffect } from 'react'
+import Section from '../components/Section'
+import siteData from '../content/site.json'
+
+// Variantes visuales por anchor para romper la monotonia
+const VARIANTS = {
+ 'first-section': 'hero',
+ significa: 'default',
+ 'inmigración_masiva': 'alt',
+ detener_el_reemplazo_poblacional: 'default',
+ que_podemoshacer: 'alt',
+ precedentes_historicos: 'default',
+ contacto: 'hero',
+}
+
+// Orden en que aparecen en la pagina -- coincide con el orden del menu
+const SECTION_ORDER = [
+ 'first-section',
+ 'significa',
+ 'inmigración_masiva',
+ 'detener_el_reemplazo_poblacional',
+ 'que_podemoshacer',
+ 'precedentes_historicos',
+ 'contacto',
+]
+
+export default function Home() {
+ const byAnchor = Object.fromEntries(
+ siteData.sections.map((s) => [s.anchor, s])
+ )
+
+ useEffect(() => {
+ // carga directa de / con un #ancla en la URL (o navegacion desde otra
+ // pagina que ya trae el hash) -- el click normal en el navbar lo
+ // resuelve el propio Router al navegar
+ if (window.location.hash) {
+ const id = window.location.hash.slice(1)
+ requestAnimationFrame(() => {
+ document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' })
+ })
+ }
+ }, [])
+
+ return (
+ <>
+ {SECTION_ORDER.map((anchor) => {
+ const s = byAnchor[anchor]
+ if (!s) return null
+ return (
+
+ )
+ })}
+ >
+ )
+}
diff --git a/src/pages/LegalPage.jsx b/src/pages/LegalPage.jsx
new file mode 100644
index 0000000..ed7fb8a
--- /dev/null
+++ b/src/pages/LegalPage.jsx
@@ -0,0 +1,27 @@
+import Content from '../components/content/Content'
+import siteData from '../content/site.json'
+
+// Paginas legales (cookies, aviso legal): mismo renderer de contenido que
+// las secciones de la home (Content.jsx), pero sin truncar -- aqui el texto
+// completo es el contenido, no un resumen.
+export default function LegalPage({ pageKey }) {
+ const page = siteData.pages?.[pageKey]
+
+ if (!page) {
+ return (
+
+
+
Pagina no disponible
+
+
+ )
+ }
+
+ return (
+
+
+
+
+
+ )
+}
diff --git a/src/pages/NotFound.jsx b/src/pages/NotFound.jsx
new file mode 100644
index 0000000..44373bd
--- /dev/null
+++ b/src/pages/NotFound.jsx
@@ -0,0 +1,16 @@
+import { Link } from '../router/router'
+
+export default function NotFound() {
+ return (
+
+
+
Pagina no encontrada
+
+
+ Volver al inicio
+
+
+
+
+ )
+}
diff --git a/src/router/router.jsx b/src/router/router.jsx
new file mode 100644
index 0000000..9f92c45
--- /dev/null
+++ b/src/router/router.jsx
@@ -0,0 +1,90 @@
+import { createContext, useCallback, useContext, useEffect, useState } from 'react'
+
+// Router minimalista sin dependencias externas: para 3 rutas estaticas sin
+// parametros ni carga de datos, react-router-dom seria mucho mas de lo que
+// este sitio necesita. Cubre lo esencial: navegacion con la History API,
+// que no recarga la pagina, y saltar a anclas (#seccion) tanto en la
+// home como al volver a ella desde otra ruta.
+
+const RouterContext = createContext(null)
+
+function normalize(pathname) {
+ if (pathname.length > 1 && pathname.endsWith('/')) {
+ return pathname.slice(0, -1)
+ }
+ return pathname || '/'
+}
+
+function scrollToHash(hash) {
+ if (!hash) return
+ const id = hash.replace(/^#/, '')
+ // requestAnimationFrame: deja que la ruta/seccion nueva termine de montar
+ // antes de medir su posicion en pantalla.
+ requestAnimationFrame(() => {
+ document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' })
+ })
+}
+
+export function Router({ children }) {
+ const [pathname, setPathname] = useState(() => normalize(window.location.pathname))
+
+ useEffect(() => {
+ const onPopState = () => {
+ setPathname(normalize(window.location.pathname))
+ if (window.location.hash) scrollToHash(window.location.hash)
+ }
+ window.addEventListener('popstate', onPopState)
+ return () => window.removeEventListener('popstate', onPopState)
+ }, [])
+
+ const navigate = useCallback((to) => {
+ const [rawPath, hash] = to.split('#')
+ const target = normalize(rawPath || '/')
+ const prevPathname = normalize(window.location.pathname)
+ const nextUrl = hash ? `${target}#${hash}` : target
+ const prevUrl = `${prevPathname}${window.location.hash}`
+
+ if (nextUrl !== prevUrl) {
+ window.history.pushState({}, '', nextUrl)
+ }
+ if (target !== prevPathname) {
+ setPathname(target)
+ }
+
+ if (hash) {
+ scrollToHash(hash)
+ } else {
+ window.scrollTo({ top: 0 })
+ }
+ }, [])
+
+ return (
+
+ {children}
+
+ )
+}
+
+export function useRouter() {
+ const ctx = useContext(RouterContext)
+ if (!ctx) throw new Error('useRouter debe usarse dentro de ')
+ return ctx
+}
+
+export function Link({ to, children, ...rest }) {
+ const { navigate } = useRouter()
+ const handleClick = (e) => {
+ // deja pasar los clicks modificados (abrir en pestana nueva, etc.) tal
+ // cual los manejaria un normal
+ if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
+ return
+ }
+ e.preventDefault()
+ navigate(to)
+ }
+ return (
+
+ {children}
+
+ )
+}