// sections.jsx — alle pagina-secties als losse componenten.

const { useState, useEffect, useMemo, useRef } = React;

// ── Book cover placeholder (stylized) ────────────────────────────────────────
function BookCover({ book, size = "md" }) {
  const palettes = {
    warm:  { a: "#3a1f15", b: "#7a2d1a", c: "#e9b894" },
    blue:  { a: "#0e1a2b", b: "#1d3554", c: "#7ea4cf" },
    ink:   { a: "#0a0a0c", b: "#1c1c22", c: "#a39d8f" },
    olive: { a: "#1e2316", b: "#3a4326", c: "#b8b58a" },
    rust:  { a: "#2a160e", b: "#5e2818", c: "#d99a73" },
  };
  const p = palettes[book.omslag] || palettes.ink;
  const dims = { sm: [120, 180], md: [220, 330], lg: [320, 480] }[size];

  // Real cover from Elikser, if available
  if (book.cover) {
    return (
      <div className="book-cover book-cover-real" style={{
        width: dims[0], height: dims[1],
        position: "relative",
        boxShadow: "0 1px 0 rgba(255,255,255,0.08) inset, 0 20px 40px -20px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,0,0,0.4)",
        overflow: "hidden",
        flexShrink: 0,
        background: "#1a1a1c",
      }}>
        <img src={book.cover} alt={`Omslag ${book.titel}`} loading="lazy"
          style={{ width: "100%", height: "100%", objectFit: "cover", display: "block" }} />
        <div style={{
          position: "absolute", left: 0, top: 0, bottom: 0, width: 8,
          background: `linear-gradient(90deg, rgba(0,0,0,0.45), transparent)`,
          pointerEvents: "none",
        }} />
      </div>
    );
  }

  // Stylized placeholder for books without uploaded cover yet
  return (
    <div className="book-cover" style={{
      width: dims[0], height: dims[1],
      background: `linear-gradient(160deg, ${p.a} 0%, ${p.b} 60%, ${p.a} 100%)`,
      position: "relative",
      boxShadow: "0 1px 0 rgba(255,255,255,0.08) inset, 0 20px 40px -20px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,0,0,0.4)",
      overflow: "hidden",
      flexShrink: 0,
    }}>
      <div style={{
        position: "absolute", left: 0, top: 0, bottom: 0, width: 8,
        background: `linear-gradient(90deg, rgba(0,0,0,0.5), transparent)`,
      }} />
      <div style={{
        position: "absolute", inset: 0,
        background: `radial-gradient(circle at 30% 20%, ${p.c}22, transparent 60%)`,
      }} />
      <div style={{
        position: "absolute", left: "10%", right: "10%", top: "14%",
        fontFamily: "var(--ff-mono)", fontSize: size==="lg"?11:9, letterSpacing: "0.2em",
        color: p.c, opacity: 0.8, textTransform: "uppercase",
      }}>
        Gerard Legerstee
      </div>
      <div style={{
        position: "absolute", left: "10%", right: "10%", top: "30%",
        fontFamily: "var(--ff-display)", fontWeight: 800,
        fontSize: size==="lg"? 44 : size==="md"? 26 : 16,
        lineHeight: 0.95, letterSpacing: "-0.02em",
        color: "#f3ead9",
        textTransform: "uppercase",
        textWrap: "balance",
      }}>
        {book.titel}
      </div>
      <div style={{
        position: "absolute", left: "10%", right: "10%", bottom: "8%",
        fontFamily: "var(--ff-mono)", fontSize: 9, letterSpacing: "0.15em",
        color: p.c, opacity: 0.7, textTransform: "uppercase",
      }}>
        {book.genre} · {book.jaar}
      </div>
      {book.isUpcoming && (
        <div style={{
          position: "absolute", top: 10, right: -32, transform: "rotate(45deg)",
          background: "var(--accent)", color: "var(--accent-ink)",
          fontFamily: "var(--ff-mono)", fontSize: 9, letterSpacing: "0.15em",
          textTransform: "uppercase", padding: "4px 36px", fontWeight: 600,
        }}>
          Najaar 2026
        </div>
      )}
    </div>
  );
}

// ── Hamburger nav ────────────────────────────────────────────────────────────
function HamburgerNav({ open, setOpen, activeView, onNavigate }) {
  const items = [
    { id: "home",       label: "Home" },
    { id: "boeken",     label: "Boeken" },
    { id: "biografie",  label: "Biografie" },
    { id: "interviews", label: "Interviews" },
    { id: "vragen",     label: "Vragen aan auteur" },
    { id: "agenda",     label: "Agenda" },
    { id: "contact",    label: "Contact" },
  ];

  useEffect(() => {
    document.body.style.overflow = open ? "hidden" : "";
    const onKey = (e) => { if (e.key === "Escape") setOpen(false); };
    window.addEventListener("keydown", onKey);
    return () => window.removeEventListener("keydown", onKey);
  }, [open, setOpen]);

  return (
    <>
      <header className="nav">
        <div className="container nav-inner">
          <a href="#" className="nav-brand" onClick={(e)=>{e.preventDefault(); onNavigate("home");}}>
            <span className="brand-mark brand-mark-img">
              <img src="assets/favicon.png" alt="" />
            </span>
            <span className="brand-name">
              Gerard Legerstee
              <span className="brand-copy">© 2026</span>
            </span>
          </a>
          <button className={`burger ${open?"is-open":""}`}
                  onClick={()=>setOpen(!open)}
                  aria-label={open?"Menu sluiten":"Menu openen"}>
            <span className="burger-lines">
              <span/><span/><span/>
            </span>
            <span className="burger-label">{open?"Sluit":"Menu"}</span>
          </button>
        </div>
      </header>

      <div className={`menu-overlay ${open?"is-open":""}`} onClick={()=>setOpen(false)}>
        <nav className="menu-panel" onClick={(e)=>e.stopPropagation()}>
          <div className="mono menu-eyebrow">— Navigatie</div>
          <ul className="menu-list">
            {items.map((it, i) => (
              <li key={it.id}>
                <button
                  className={`menu-item ${activeView===it.id?"is-active":""}`}
                  onClick={()=>{ onNavigate(it.id); setOpen(false); }}
                  style={{ transitionDelay: `${open ? i*40 : 0}ms` }}>
                  <span className="menu-num mono">0{i+1}</span>
                  <span className="menu-label">{it.label}</span>
                  <span className="menu-arrow">
                    <svg width="22" height="14" viewBox="0 0 22 14" fill="none">
                      <path d="M1 7h18M14 1l6 6-6 6" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
                    </svg>
                  </span>
                </button>
              </li>
            ))}
          </ul>
          <div className="menu-foot mono">
            <span>Gerard Legerstee · Auteur</span>
            <span>Bergschenhoek · NL</span>
          </div>
        </nav>
      </div>
    </>
  );
}

// ── Hero ─────────────────────────────────────────────────────────────────────
function Hero({ onOpenBook }) {
  return (
    <section id="home" className="hero" data-screen-label="01 Home">
      <div className="container hero-inner">
        <div className="hero-meta mono">
          <span>Auteur · Bergschenhoek</span>
          <span className="dot">·</span>
          <span>thrillers en non-fictie</span>
          <span className="dot">·</span>
          <span>{BOOKS.length} titels</span>
        </div>

        <h2 className="hero-welcome">Welkom op de plaats delict</h2>

        <div className="hero-grid">
          <div className="hero-text">
            <h1 className="hero-title">
              <span className="hero-title-name-row">
                <span className="portrait-inline">
                  <img src="assets/auteur-gerard-2025.jpg" alt="Portret van Gerard Legerstee" />
                </span>
                <span className="hero-title-names">
                  <span className="hero-title-line italic"><em>Gerard</em></span>
                  <span className="hero-title-line italic"><em>Legerstee</em></span>
                </span>
              </span>
            </h1>
            <p className="hero-lead">
              {AUTHOR.korteBio}
            </p>
            <NewsBanner items={NIEUWSBANNER} />
          </div>
        </div>
      </div>

      <HomeCovers onOpenBook={onOpenBook} />
    </section>
  );
}

// ── Home: alleen boekomslagen, twee per regel, nieuwste eerst ────────────────
function HomeCovers({ onOpenBook }) {
  const sorted = [...BOOKS].sort((a, b) => b.jaar - a.jaar);
  return (
    <div className="container home-covers-wrap">
      <div className="home-covers-grid">
        {sorted.map(b => (
          <button key={b.id} className="home-cover-card" onClick={()=>onOpenBook(b)}
                  aria-label={`Open ${b.titel}`}>
            <BookCover book={b} size="lg" />
            <div className="home-cover-caption mono">
              <span>{b.titel}</span>
              <span className="dot">·</span>
              <span>{b.jaar}</span>
            </div>
          </button>
        ))}
      </div>
    </div>
  );
}

// ── Over de auteur ───────────────────────────────────────────────────────────
function About() {
  return (
    <section id="over" className="sect over" data-screen-label="02 Over">
      <div className="container">
        <SectHead nr="01" eyebrow="Over de auteur" title="Van bankzaal naar schrijftafel" />
        <div className="over-grid">
          <div className="over-text">
            {AUTHOR.langeBio.map((p, i) => <p key={i}>{p}</p>)}
            <div className="over-tags">
              <div className="mono">Schrijfstijl</div>
              <div className="tag-row">
                {AUTHOR.stijl.map(s => <span key={s} className="tag">{s}</span>)}
              </div>
            </div>
          </div>
          <aside className="over-side">
            <dl className="def">
              <dt>Genre</dt><dd>{AUTHOR.genre}</dd>
              <dt>Uitgever</dt><dd>{AUTHOR.uitgever}</dd>
              <dt>Debuut</dt><dd>SplitsING, 2019</dd>
              <dt>Woont in</dt><dd>Bergschenhoek (Lansingerland)</dd>
              <dt>Lezerspubliek</dt><dd>Liefhebbers van Nederlandse thrillers</dd>
            </dl>
            <div className="quote-card">
              <div className="quote-mark">"</div>
              <p>Niet de gruwel, maar het mechanisme dat goede mensen tot foute keuzes brengt — daar gaat het me om.</p>
              <div className="mono">— Gerard Legerstee</div>
            </div>
          </aside>
        </div>
      </div>
    </section>
  );
}

function SectHead({ nr, eyebrow, title, action }) {
  return (
    <div className="sect-head">
      <div className="sect-head-l">
        <span className="mono sect-nr">{nr}</span>
        <span className="mono sect-eyebrow">— {eyebrow}</span>
      </div>
      <h2 className="sect-title">{title}</h2>
      {action && <div className="sect-action">{action}</div>}
    </div>
  );
}

// ── Books grid + filters ─────────────────────────────────────────────────────
function Books() {
  const [genre, setGenre] = useState("Alle");
  const [year, setYear]   = useState("Alle");
  const [trailer, setTrailer] = useState(null);

  const genres = useMemo(()=>["Alle", ...new Set(BOOKS.map(b=>b.genre))], []);
  const years  = useMemo(()=>["Alle", ...new Set(BOOKS.map(b=>String(b.jaar)).sort((a,b)=>b.localeCompare(a)))], []);

  const filtered = BOOKS.filter(b =>
    (genre === "Alle" || b.genre === genre) &&
    (year === "Alle" || String(b.jaar) === year)
  ).sort((a, b) => b.jaar - a.jaar);

  return (
    <section id="boeken" className="sect boeken" data-screen-label="03 Boeken">
      <div className="container">
        <header className="boeken-head">
          <h2 className="sect-title">Boeken</h2>
        </header>
        <div className="filters">
          <FilterGroup label="Genre" value={genre} options={genres} onChange={setGenre} />
          <FilterGroup label="Jaar" value={year} options={years} onChange={setYear} />
          <div className="filter-count mono">{filtered.length} van {BOOKS.length} titels</div>
        </div>

        <div className="books-list">
          {filtered.map(b => (
            <article key={b.id} id={`book-${b.id}`} className="book-row">
              <div className="book-row-cover">
                <BookCover book={b} size="md" />
              </div>
              <div className="book-row-body">
                <div className="book-row-meta mono">
                  <span>{b.jaar}</span>
                  <span className="dot">·</span>
                  <span>{b.genre}</span>
                  {b.paginas && <><span className="dot">·</span><span>{b.paginas} p.</span></>}
                  {b.isbn && <><span className="dot">·</span><span>ISBN {b.isbn}</span></>}
                </div>
                <h3 className="book-title">{b.titel}</h3>
                <div className="book-row-badges">
                  {b.isLatest && <span className="badge badge-accent">Nieuwste</span>}
                  {b.isUpcoming && <span className="badge badge-accent">Aankomend</span>}
                  {b.isFirstBook && <span className="badge">Debuut</span>}
                  {b.isFirstThriller && <span className="badge">Eerste thriller</span>}
                  {b.isDebut && <span className="badge">Eerste Elikser-thriller</span>}
                  {b.gratis && <span className="badge">Gratis · EPUB</span>}
                </div>
                <div className="book-row-flap">
                  {b.flap.split("\n\n").map((para, i) => (
                    <p key={i}>{para}</p>
                  ))}
                </div>
                {b.quote && (
                  <blockquote className="book-row-quote">
                    <span className="quote-mark">"</span>
                    <p>{b.quote}</p>
                    <cite className="mono">— {b.quoteBron}</cite>
                  </blockquote>
                )}
                <div className="book-row-cta">
                  {b.elikserUrl && (
                    <a className="btn btn-primary"
                       href={b.elikserUrl}
                       target="_blank" rel="noopener noreferrer"
                       onClick={(e)=>e.stopPropagation()}>
                      Koop paperback
                      <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                        <path d="M3 7h8M7 3l4 4-4 4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
                      </svg>
                    </a>
                  )}
                  {b.elikserEpubUrl && (
                    <a className="btn btn-ghost"
                       href={b.elikserEpubUrl}
                       target="_blank" rel="noopener noreferrer"
                       onClick={(e)=>e.stopPropagation()}>
                      Koop epub
                      <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                        <path d="M3 7h8M7 3l4 4-4 4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
                      </svg>
                    </a>
                  )}
                  {b.elikserUrl && (
                    <a className="btn btn-ghost"
                       href="https://www.bibliotheek.nl/catalogus.catalogus.html?q=Gerard%20Legerstee"
                       target="_blank" rel="noopener noreferrer"
                       onClick={(e)=>e.stopPropagation()}>
                      Leen via bibliotheek
                      <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                        <path d="M3 7h8M7 3l4 4-4 4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
                      </svg>
                    </a>
                  )}
                  {b.trailerUrl && (
                    <button className="btn btn-ghost btn-trailer"
                       onClick={(e)=>{e.stopPropagation(); setTrailer(b);}}>
                      <svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true">
                        <path d="M4 2.5v9l7-4.5-7-4.5z" fill="currentColor"/>
                      </svg>
                      Bekijk de trailer
                    </button>
                  )}
                  {b.smashwordsUrl && (
                    <a className="btn btn-primary"
                       href={b.smashwordsUrl}
                       target="_blank" rel="noopener noreferrer"
                       onClick={(e)=>e.stopPropagation()}>
                      Gratis downloaden (epub)
                      <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                        <path d="M3 7h8M7 3l4 4-4 4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
                      </svg>
                    </a>
                  )}
                </div>
              </div>
            </article>
          ))}
        </div>
      </div>

      {trailer && <TrailerModal book={trailer} onClose={()=>setTrailer(null)} />}
    </section>
  );
}

// ── Trailer modal ────────────────────────────────────────────────────────────
function TrailerModal({ book, onClose }) {
  useEffect(() => {
    const onKey = (e) => { if (e.key === "Escape") onClose(); };
    window.addEventListener("keydown", onKey);
    document.body.style.overflow = "hidden";
    return () => {
      window.removeEventListener("keydown", onKey);
      document.body.style.overflow = "";
    };
  }, [onClose]);
  return (
    <div className="modal-bg" onClick={onClose}>
      <div className="modal trailer-modal" onClick={e=>e.stopPropagation()}>
        <button className="modal-close" onClick={onClose} aria-label="Sluiten">
          <svg width="20" height="20" viewBox="0 0 20 20" fill="none"><path d="M5 5l10 10M15 5L5 15" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"/></svg>
        </button>
        <div className="trailer-inner">
          <div className="mono trailer-eyebrow">Boektrailer · {book.titel}</div>
          <video src={book.trailerUrl}
                 controls autoPlay playsInline
                 className="trailer-video" />
          <div className="trailer-caption mono">© Gerard Legerstee · {book.jaar}</div>
        </div>
      </div>
    </div>
  );
}

function FilterGroup({ label, value, options, onChange }) {
  return (
    <div className="filter-group">
      <div className="mono filter-label">{label}</div>
      <div className="filter-options">
        {options.map(o => (
          <button key={o}
            className={`chip ${value===o?"is-active":""}`}
            onClick={()=>onChange(o)}>
            {o}
          </button>
        ))}
      </div>
    </div>
  );
}

// ── Nieuws & Agenda ──────────────────────────────────────────────────────────
function Nieuws() {
  return (
    <section id="nieuws" className="sect nieuws" data-screen-label="04 Nieuws">
      <div className="container">
        <SectHead nr="03" eyebrow="Nieuws & Agenda" title="Wat speelt er nu" />
        <div className="nieuws-grid">
          <div className="nieuws-list">
            <div className="mono col-label">Recent</div>
            {NIEUWS.map((n, i) => (
              <article key={i} className="nieuws-item">
                <div className="nieuws-meta">
                  <span className="mono">{n.datum}</span>
                  <span className="mono pill">{n.label}</span>
                </div>
                <h4 className="nieuws-title">{n.titel}</h4>
                <p className="nieuws-body">{n.body}</p>
              </article>
            ))}
          </div>
          <aside className="agenda">
            <div className="mono col-label">Agenda</div>
            {AGENDA.map((a, i) => (
              <div key={i} className="agenda-item">
                <div className="agenda-date">
                  <div className="agenda-day">{a.datum.split(" ")[0]}</div>
                  <div className="mono">{a.datum.split(" ").slice(1).join(" ")}</div>
                </div>
                <div>
                  <div className="agenda-title">{a.titel}</div>
                  <div className="agenda-loc mono">{a.plaats} · {a.tijd}</div>
                </div>
              </div>
            ))}
          </aside>
        </div>
      </div>
    </section>
  );
}

// ── Lezers ───────────────────────────────────────────────────────────────────
function Lezers() {
  const [openFaq, setOpenFaq] = useState(0);
  return (
    <section id="lezers" className="sect lezers" data-screen-label="05 Lezers">
      <div className="container">
        <SectHead nr="04" eyebrow="Lezers" title="Recensies, leesclubs & fragmenten" />

        <div className="recensie-grid">
          {RECENSIES.map((r, i) => (
            <figure key={i} className="recensie">
              <div className="recensie-head">
                <span className="mono">{r.bron}</span>
                {r.rating && <span className="rating">★ {r.rating.toFixed(1)}</span>}
              </div>
              <blockquote>"{r.quote}"</blockquote>
              <figcaption className="mono">Over {r.boek} · {r.type}</figcaption>
            </figure>
          ))}
        </div>

        <div className="lezers-split">
          <div className="leesclub">
            <h3 className="sub-h">Voor leesclubs</h3>
            <p>{LEESCLUB.intro}</p>
            <ul className="leesclub-list">
              {LEESCLUB.items.map((it, i) => (
                <li key={i}>
                  <span>{it.titel}</span>
                  <span className="mono pill">{it.type}</span>
                </li>
              ))}
            </ul>
          </div>
          <div className="faq">
            <h3 className="sub-h">Vragen aan de auteur</h3>
            <div className="faq-list">
              {FAQ.map((f, i) => (
                <div key={i} className={`faq-item ${openFaq===i?"is-open":""}`}>
                  <button className="faq-q" onClick={()=>setOpenFaq(openFaq===i?-1:i)}>
                    <span>{f.v}</span>
                    <span className="faq-icon">{openFaq===i?"–":"+"}</span>
                  </button>
                  {openFaq===i && <div className="faq-a">{f.a}</div>}
                </div>
              ))}
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

// ── Pers & Media ─────────────────────────────────────────────────────────────
function Pers() {
  return (
    <section id="pers" className="sect pers" data-screen-label="06 Pers">
      <div className="container">
        <SectHead nr="05" eyebrow="Pers & Media" title="Persmap" />
        <p className="pers-intro">{PERS.intro}</p>
        <div className="pers-grid">
          <div className="pers-files">
            {PERS.bestanden.map((b, i) => (
              <a key={i} className="pers-file" href="#">
                <div className="pers-file-ico mono">{b.type}</div>
                <div className="pers-file-body">
                  <div className="pers-file-title">{b.titel}</div>
                  <div className="mono pers-file-meta">{b.grootte} · download</div>
                </div>
                <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
                  <path d="M8 2v10m0 0l-4-4m4 4l4-4M2 14h12" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
                </svg>
              </a>
            ))}
          </div>
          <aside className="pers-contact">
            <div className="mono col-label">Perscontact</div>
            <div className="pers-contact-name">{PERS.contact.naam}</div>
            <a href={`mailto:${PERS.contact.email}`}>{PERS.contact.email}</a>
            <div>{PERS.contact.telefoon}</div>
          </aside>
        </div>
      </div>
    </section>
  );
}

// ── Blog ─────────────────────────────────────────────────────────────────────
function Blog() {
  return (
    <section id="blog" className="sect blog" data-screen-label="07 Blog">
      <div className="container">
        <SectHead nr="06" eyebrow="Blog & Column" title="Achter de schermen" />
        <div className="blog-list">
          {BLOG.map((b, i) => (
            <article key={i} className="blog-item">
              <div className="blog-meta mono">
                <span>{b.datum}</span>
                <span>·</span>
                <span>{b.leestijd} leestijd</span>
              </div>
              <h3 className="blog-title">{b.titel}</h3>
              <p className="blog-excerpt">{b.excerpt}</p>
              <a className="link-arrow" href="#">Lees verder
                <svg width="12" height="12" viewBox="0 0 14 14" fill="none"><path d="M3 7h8M7 3l4 4-4 4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/></svg>
              </a>
            </article>
          ))}
        </div>
      </div>
    </section>
  );
}

// ── Contact ──────────────────────────────────────────────────────────────────
function Contact() {
  const [form, setForm] = useState({ naam: "", email: "", onderwerp: "Algemeen", bericht: "" });
  const [sent, setSent] = useState(false);

  const submit = (e) => {
    e.preventDefault();
    if (!form.naam || !form.email || !form.bericht) return;
    setSent(true);
  };

  return (
    <section id="contact" className="sect contact" data-screen-label="08 Contact">
      <div className="container">
        <SectHead nr="07" eyebrow="Contact" title="Schrijf de auteur" />
        <div className="contact-grid">
          <form className="contact-form" onSubmit={submit}>
            {sent ? (
              <div className="contact-sent">
                <div className="mono">Bericht ontvangen</div>
                <h3>Bedankt, {form.naam.split(" ")[0]}.</h3>
                <p>Je bericht is verstuurd. De auteur (of zijn uitgever) reageert doorgaans binnen een week.</p>
                <button type="button" className="btn btn-ghost" onClick={()=>{setSent(false); setForm({naam:"",email:"",onderwerp:"Algemeen",bericht:""});}}>Nieuw bericht</button>
              </div>
            ) : (
              <>
                <Field label="Naam">
                  <input type="text" value={form.naam} onChange={e=>setForm({...form, naam: e.target.value})} placeholder="Voor- en achternaam" />
                </Field>
                <Field label="E-mail">
                  <input type="email" value={form.email} onChange={e=>setForm({...form, email: e.target.value})} placeholder="je@email.nl" />
                </Field>
                <Field label="Onderwerp">
                  <div className="seg">
                    {["Algemeen","Leesclub","Pers","Lezing"].map(o => (
                      <button key={o} type="button"
                        className={`seg-btn ${form.onderwerp===o?"is-active":""}`}
                        onClick={()=>setForm({...form, onderwerp: o})}>
                        {o}
                      </button>
                    ))}
                  </div>
                </Field>
                <Field label="Bericht">
                  <textarea rows={5} value={form.bericht} onChange={e=>setForm({...form, bericht: e.target.value})} placeholder="Waar gaat het over?" />
                </Field>
                <button className="btn btn-primary" type="submit">Versturen
                  <svg width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M3 7h8M7 3l4 4-4 4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/></svg>
                </button>
              </>
            )}
          </form>

          <aside className="contact-aside">
            <div>
              <div className="mono col-label">Uitgever</div>
              <div className="contact-block">
                <div className="contact-strong">Uitgeverij Elikser</div>
                <div>Leeuwarden · NL</div>
                <a href="#">elikser.nl ↗</a>
              </div>
            </div>
            <div>
              <div className="mono col-label">Volg de auteur</div>
              <div className="socials">
                {SOCIALS.map(s => (
                  <a key={s.naam} href={s.url} className="social">
                    <span>{s.naam}</span>
                    <span className="mono">{s.handle} ↗</span>
                  </a>
                ))}
              </div>
            </div>
          </aside>
        </div>
      </div>
    </section>
  );
}

function Field({ label, children }) {
  return (
    <label className="field">
      <span className="mono field-label">{label}</span>
      {children}
    </label>
  );
}

// ── Footer ───────────────────────────────────────────────────────────────────
function Footer({ activeView, onNavigate }) {
  const links = [
    { id: "home",       label: "Home" },
    { id: "boeken",     label: "Boeken" },
    { id: "biografie",  label: "Biografie" },
    { id: "interviews", label: "Interviews" },
    { id: "vragen",     label: "Vragen aan auteur" },
    { id: "agenda",     label: "Agenda" },
    { id: "contact",    label: "Contact" },
  ];
  return (
    <footer className="footer">
      <div className="container footer-inner">
        <nav className="footer-nav mono">
          {links.map(l => (
            <button key={l.id}
                    className={`footer-link ${activeView===l.id?"is-active":""}`}
                    onClick={()=>onNavigate(l.id)}>
              {l.label}
            </button>
          ))}
        </nav>
      </div>
    </footer>
  );
}

// ── Nieuwsbanner (scrollend, met pauze-bij-hover) ───────────────────────────
function NewsBanner({ items }) {
  if (!items || !items.length) return null;
  // Verdubbelen voor naadloze loop
  const looped = [...items, ...items];
  return (
    <aside className="nb-wrap" aria-label="Scrollende nieuwsbanner">
      <div className="nb-label" aria-hidden="true">
        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
          <rect x="3" y="3" width="18" height="18" rx="2"/>
          <line x1="3" y1="9" x2="21" y2="9"/>
          <line x1="9" y1="21" x2="9" y2="9"/>
        </svg>
        Nieuws
      </div>
      <div className="nb-track">
        <div className="nb-inner">
          {looped.map((tekst, i) => (
            <span key={i} className="nb-item">
              <span className="nb-dot" aria-hidden="true"></span>
              {tekst}
            </span>
          ))}
        </div>
      </div>
    </aside>
  );
}

Object.assign(window, { HamburgerNav, Hero, HomeCovers, NewsBanner, About, Books, Nieuws, Lezers, Pers, Blog, Contact, Footer, BookCover, SectHead, Field });
