// Marius Pop — index sections, part 1
function Nav({ onApply }) {
  const D = window.DATA;
  return (
    <header style={{ position: "sticky", top: 0, zIndex: 500, background: "rgba(255,255,255,.82)", backdropFilter: "blur(14px)", WebkitBackdropFilter: "blur(14px)", borderBottom: "1px solid var(--line)" }}>
      <div style={{ maxWidth: 1160, margin: "0 auto", padding: "13px 32px", display: "flex", alignItems: "center", gap: 26 }}>
        <a href="#top" style={{ display: "flex", alignItems: "center", textDecoration: "none" }}>
          <img src="logo.svg" alt="Marius Pop · Vertrieb" style={{ height: 42, display: "block" }} />
        </a>
        <nav className="vt-nav" style={{ display: "flex", gap: 26, marginLeft: 10 }}>
          {D.nav.map(([t, h]) =>
          <a key={h} href={h} style={{ fontFamily: "var(--font-head)", fontSize: 14.5, color: "var(--ink-soft)", textDecoration: "none", fontWeight: 500 }}>{t}</a>
          )}
        </nav>
        <div style={{ flex: 1 }} />
        <PillButton onClick={onApply} mono={false} style={{ padding: "5px 5px 5px 18px", fontSize: 13.5 }}>Karrieregespräch</PillButton>
      </div>
    </header>);

}

function Hero({ onApply }) {
  const H = window.DATA.hero;
  return (
    <section id="top" style={{ padding: "clamp(40px,5vw,68px) 0 0" }}>
      <div className="hero-stage">
        <img src="hero-team.png" alt="Marius Pop und Kollege" className="hero-photo" />
        <div style={{ position: "relative", zIndex: 1, width: "100%", boxSizing: "border-box", maxWidth: 1160, margin: "0 auto", padding: "0 32px" }}>
          <div className="hero-copy">
            <div style={{ display: "inline-flex", alignItems: "center", gap: 9, padding: "7px 15px 7px 12px", border: "1px solid var(--line-strong)", borderRadius: 999, marginBottom: 24, background: "rgba(255,255,255,.7)", backdropFilter: "blur(4px)" }}>
              <span style={{ width: 7, height: 7, borderRadius: 7, background: "var(--accent-strong)", flex: "0 0 auto" }} />
              <span style={{ fontFamily: "var(--font-mono)", fontSize: 11.5, letterSpacing: "0.08em", textTransform: "uppercase", color: "var(--ink-soft)" }}>{H.eyebrow}</span>
            </div>
            <h1 style={{ fontFamily: "var(--font-head)", fontWeight: 600, lineHeight: 1.04, letterSpacing: "-0.045em", margin: 0, textWrap: "balance", fontSize: "48px" }}>
              {H.titleLead}{" "}
              <span style={{ position: "relative", display: "inline-block" }}>
                <span style={{ position: "relative", zIndex: 1 }}>{H.titleAccent}</span>
                <span style={{ position: "absolute", left: -3, right: -3, bottom: 5, height: "34%", background: "color-mix(in oklab, var(--accent) 16%, #fff)", zIndex: 0, borderRadius: 3 }} />
              </span>{" "}
              {H.titleTail}
            </h1>
            <p style={{ fontFamily: "var(--font-head)", fontWeight: 600, fontSize: "clamp(18px,1.7vw,21px)", lineHeight: 1.4, letterSpacing: "-0.02em", color: "var(--ink)", margin: "26px 0 16px", maxWidth: 470, textWrap: "balance" }}>{H.lead}</p>
            {H.body.map((p, i) =>
            <p key={i} style={{ fontFamily: "var(--font-head)", fontSize: 16.5, lineHeight: 1.55, color: "var(--ink-soft)", margin: i ? "12px 0 0" : 0, maxWidth: 460, textWrap: "pretty" }}>{p}</p>
            )}
            <div style={{ display: "flex", alignItems: "center", gap: 18, flexWrap: "wrap", marginTop: 32 }}>
              <PillButton onClick={onApply} mono={false} style={{ padding: "8px 8px 8px 24px", fontSize: 15 }}>{H.cta}</PillButton>
              <span style={{ fontFamily: "var(--font-head)", fontSize: 14.5, color: "var(--ink-soft)" }}>{H.ctaSubline}</span>
            </div>
          </div>
        </div>
      </div>

      <div style={{ maxWidth: 1160, margin: "0 auto", padding: "0 32px" }}>
        {/* trust badges */}
        <div style={{ marginTop: "clamp(36px,4vw,52px)", paddingTop: 26, borderTop: "1px solid var(--line)" }}>
          <div className="vt-badges" style={{ display: "grid", gridTemplateColumns: "repeat(5,1fr)", gap: 14 }}>
            {H.badges.map((b, i) =>
            <div key={i} style={{ display: "flex", gap: 11, alignItems: "flex-start" }}>
                <span style={{ flex: "0 0 auto", width: 24, height: 24, borderRadius: 24, background: "var(--accent)", display: "flex", alignItems: "center", justifyContent: "center", marginTop: 1 }}>
                  <svg width="13" height="13" viewBox="0 0 24 24" fill="none"><path d="M5 13l4 4L19 7" stroke="#fff" strokeWidth="2.6" strokeLinecap="round" strokeLinejoin="round" /></svg>
                </span>
                <span style={{ fontFamily: "var(--font-head)", fontSize: 13.5, lineHeight: 1.4, color: "var(--ink)", fontWeight: 500, textWrap: "pretty" }}>{b}</span>
              </div>
            )}
          </div>
        </div>
      </div>
    </section>);

}

function Vorwort() {
  const V = window.DATA.vorwort;
  return (
    <Section pad={96}>
      <div className="note-frame">
        <div className="note-paper">
          {/* top bar */}
          <div className="note-topbar">
            <span className="note-icon" aria-hidden="true">
              <svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M5 19h14M14.5 4.5l4.5 4.5L9 18.5l-4.8.8.8-4.8 9.5-9.5Z" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round" /></svg>
            </span>
            <span className="note-label">{V.noteLabel}</span>
            <span className="note-icon note-icon--round" aria-hidden="true">
              <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><circle cx="6" cy="12" r="1.6" /><circle cx="12" cy="12" r="1.6" /><circle cx="18" cy="12" r="1.6" /></svg>
            </span>
          </div>

          {/* big serif quote */}
          <h2 className="note-quote">{renderLead(V.lead)}</h2>

          {/* note body */}
          <div className="note-body">
            {V.paragraphs.map((p, i) =>
            <p key={i} style={{ margin: i ? "16px 0 0" : 0 }}>{p}</p>
            )}
            {(V.kicker || V.kickerStrong) && (
              <p className="note-kicker">{V.kicker} <strong>{V.kickerStrong}</strong></p>
            )}
          </div>

          {/* signature: avatar + handwriting */}
          <div className="note-sign">
            <img src="marius-presenting.png" alt="Marius Pop" style={{ display: "block", width: 60, height: 60, flex: "0 0 auto", borderRadius: "50%", objectFit: "cover", objectPosition: "50% 20%" }} />
            <div className="note-sign-text">
              <span className="note-signature">{V.signature}</span>
              <span className="note-role">{V.signatureRole}</span>
            </div>
          </div>
        </div>
      </div>
    </Section>);

}

function renderLead(txt) {
  const accent = "falschen System";
  if (txt.includes(accent)) {
    const [a, b] = txt.split(accent);
    return <React.Fragment>{a}<em>{accent}</em>{b}</React.Fragment>;
  }
  return txt;
}

function StatusQuo() {
  const SQ = window.DATA.statusQuo;
  return (
    <Section bg="var(--bg-soft)" pad={104}>
      <div style={{ textAlign: "center", maxWidth: 780, margin: "0 auto 12px" }}>
        <div style={{ display: "flex", justifyContent: "center", marginBottom: 18 }}><Eyebrow center>{SQ.eyebrow}</Eyebrow></div>
        <Heading center max={780}>{SQ.title}</Heading>
      </div>
      <div className="vt-statusquo" style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 56, alignItems: "start", marginTop: 56 }}>
        <div>
          <p style={{ fontFamily: "var(--font-head)", fontSize: 17, lineHeight: 1.65, color: "var(--ink-soft)", margin: 0, textWrap: "pretty" }}>{SQ.body}</p>
          <div className="vt-statusquo-highlight" style={{ marginTop: 26, padding: "22px 26px", borderRadius: 18, background: "color-mix(in oklab, var(--accent) 14%, #fff)", borderLeft: "4px solid var(--accent-strong)" }}>
            <p style={{ fontFamily: "var(--font-head)", fontSize: 17.5, fontWeight: 600, lineHeight: 1.45, letterSpacing: "-0.015em", color: "var(--ink)", margin: 0, textWrap: "pretty" }}>{SQ.highlight}</p>
          </div>
        </div>
        <div>
          <div style={{ fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: "0.12em", textTransform: "uppercase", color: "var(--ink-soft)", marginBottom: 18 }}>{SQ.askLabel}</div>
          <ul style={{ listStyle: "none", margin: 0, padding: 0, display: "grid", gap: 10 }}>
            {SQ.items.map((it, i) => (
              <li key={i} className="vt-statusquo-item" style={{ display: "flex", gap: 14, alignItems: "center", padding: "16px 20px", background: "#fff", borderRadius: 14, border: "1px solid var(--line)" }}>
                <span style={{ flex: "0 0 auto", width: 26, height: 26, borderRadius: 26, background: "var(--accent)", display: "flex", alignItems: "center", justifyContent: "center" }}>
                  <svg width="14" height="14" viewBox="0 0 24 24" fill="none"><path d="M5 13l4 4L19 7" stroke="#fff" strokeWidth="2.8" strokeLinecap="round" strokeLinejoin="round" /></svg>
                </span>
                <span style={{ fontFamily: "var(--font-head)", fontSize: 16, fontWeight: 500, lineHeight: 1.4, color: "var(--ink)", letterSpacing: "-0.01em" }}>{it}</span>
              </li>
            ))}
          </ul>
        </div>
      </div>
    </Section>
  );
}

function ReasonIcon({ name }) {
  const p = { fill: "none", stroke: "#fff", strokeWidth: 1.7, strokeLinecap: "round", strokeLinejoin: "round" };
  const g = {
    sinn: <g {...p}><path d="M12 20s-6.5-4.35-9-8.5C1.4 8.8 2.7 5.3 6 4.7c2-.36 3.5.7 4.4 2.1C11.5 5.4 13 4.34 15 4.7c3.3.6 4.6 4.1 3 6.8-2.5 4.15-6 8.5-6 8.5Z" /></g>,
    income: <g {...p}><path d="M4 17l5-5 3 3 7.5-7.5" /><path d="M15 7h4.5V11.5" /></g>,
    quer: <g {...p}><circle cx="6" cy="18" r="2" /><path d="M6 16V9a3 3 0 0 1 3-3h7" /><path d="M13 3l4 3-4 3" /></g>,
    mentor: <g {...p}><circle cx="9" cy="8" r="3" /><path d="M3.5 19a5.5 5.5 0 0 1 11 0" /><path d="M16 6.2a3 3 0 0 1 0 5.6M17.5 19a5.5 5.5 0 0 0-2.4-4.5" /></g>,
    flex: <g {...p}><circle cx="12" cy="12" r="8.5" /><path d="M12 7.5V12l3 2" /></g>,
    cta: <g {...p}><rect x="3.5" y="5" width="17" height="15" rx="2.5" /><path d="M3.5 9.5h17M8 3.5v3M16 3.5v3M8.5 14.5l2.2 2.2 4.3-4.3" /></g>
  };
  return <svg width="24" height="24" viewBox="0 0 24 24">{g[name]}</svg>;
}

function Reasons({ onApply }) {
  const R = window.DATA.reasons;
  const C = R.ctaCard;
  const icons = ["sinn", "income", "quer", "mentor", "flex"];
  const cards = R.items.slice(0, 5);
  return (
    <Section id="warum" pad={112} className="reasons-dark">
      <div style={{ textAlign: "center", maxWidth: 720, margin: "0 auto 56px" }}>
        <div style={{ display: "flex", justifyContent: "center", marginBottom: 18 }}>
          <span className="reasons-eyebrow">{R.eyebrow}</span>
        </div>
        <h2 style={{ fontFamily: "var(--font-head)", fontWeight: 600, fontSize: "clamp(30px,4vw,48px)", lineHeight: 1.08, letterSpacing: "-0.04em", margin: 0, color: "#fff", textWrap: "balance" }}>{R.title}</h2>
      </div>
      <div className="vt-reasons" style={{ display: "grid", gridTemplateColumns: "repeat(3,1fr)", gap: 20 }}>
        {cards.map((it, i) =>
        <article key={i} className="reason-card">
            <span className="reason-ghost">{it.k}</span>
            <div className="reason-icon"><ReasonIcon name={icons[i]} /></div>
            <h3 className="reason-title">{it.t}</h3>
            <p className="reason-desc">{it.d}</p>
          </article>
        )}
        {/* accent CTA card */}
        <article className="reason-card reason-card--cta">
          <span className="reason-ghost reason-ghost--cta">06</span>
          <div className="reason-icon reason-icon--ghost"><ReasonIcon name="cta" /></div>
          <h3 className="reason-title reason-title--cta">{C.title}</h3>
          <p className="reason-desc reason-desc--cta">{C.body}</p>
          <button className="reason-cta-btn" onClick={onApply}>{C.button}</button>
        </article>
      </div>
    </Section>);

}

function CtaMid({ onApply, dark = false }) {
  const C = window.DATA.ctaMid;
  return (
    <Section pad={68}>
      <div style={{ background: dark ? `linear-gradient(rgba(19,19,19,0.82),rgba(19,19,19,0.82)), url('cta-bg.png') center/cover no-repeat` : `linear-gradient(rgba(37,99,235,0.78),rgba(37,99,235,0.78)), url('cta-bg.png') center/cover no-repeat`, borderRadius: 28, padding: "clamp(34px,4.5vw,56px)", display: "flex", alignItems: "center", justifyContent: "space-between", gap: 28, flexWrap: "wrap" }}>
        <div>
          <h3 style={{ fontFamily: "var(--font-head)", fontWeight: 600, fontSize: "clamp(24px,3vw,34px)", letterSpacing: "-0.04em", margin: 0, color: "#fff", textWrap: "balance", maxWidth: 540, lineHeight: 1.12 }}>{C.title}</h3>
          <p style={{ fontFamily: "var(--font-head)", fontSize: 16, color: dark ? "rgba(255,255,255,.7)" : "rgba(255,255,255,.78)", margin: "12px 0 0", maxWidth: 480 }}>{C.sub}</p>
        </div>
        <PillButton onClick={onApply} variant={dark ? "primary" : "dark"} mono={false} style={{ padding: "8px 8px 8px 24px", fontSize: 14.5 }}>{C.cta}</PillButton>
      </div>
    </Section>);

}

Object.assign(window, { Nav, Hero, Vorwort, StatusQuo, Reasons, CtaMid });
