// Direction E · Atelier (refined again)
// New order: offer leads, supporting background follows. The hero right column
// is a slow drifting starfield instead of a portrait. Lead copy talks about the
// audience, not the practitioner. Credentials moved out of the hero into their
// own "Background, in service of the work" section as four cards.

// Five starfield presets. Default is the original 14-mote constellation.
// Three alternates: "larger" (fewer, bigger, brighter), "dense" (more,
// smaller, busier), and "minimal" (just a few quiet ones). Each entry is
// a { top, left, delay, size, coral } record; size: "" | "is-small" |
// "is-tiny" | "is-large".
const STARFIELD_PRESETS = {
  default: [
    { top: "18%", left: "22%", delay: "0s",    size: "" },
    { top: "31%", left: "62%", delay: "3s",    size: "is-small" },
    { top: "44%", left: "38%", delay: "6s",    size: "is-tiny" },
    { top: "12%", left: "74%", delay: "9s",    size: "is-small" },
    { top: "58%", left: "16%", delay: "12s",   size: "is-small" },
    { top: "67%", left: "48%", delay: "1.5s",  size: "" },
    { top: "76%", left: "78%", delay: "4.5s",  size: "is-small" },
    { top: "84%", left: "32%", delay: "7.5s",  size: "is-tiny" },
    { top: "26%", left: "84%", delay: "10.5s", size: "is-tiny" },
    { top: "38%", left: "58%", delay: "5s",    size: "is-small", coral: true },
    { top: "72%", left: "62%", delay: "11s",   size: "is-tiny",  coral: true },
    { top: "52%", left: "72%", delay: "2.5s",  size: "is-tiny" },
    { top: "8%",  left: "44%", delay: "8s",    size: "is-tiny" },
    { top: "90%", left: "54%", delay: "13s",   size: "is-tiny" },
  ],

  // Fewer, bigger, with stronger glow. Reads as a quiet handful of bright
  // points rather than a constellation. Two coral stars for warmth.
  larger: [
    { top: "22%", left: "28%", delay: "0s",   size: "is-large" },
    { top: "42%", left: "68%", delay: "2.5s", size: "is-large" },
    { top: "18%", left: "74%", delay: "5s",   size: "" },
    { top: "60%", left: "22%", delay: "7.5s", size: "is-large" },
    { top: "72%", left: "58%", delay: "10s",  size: "" },
    { top: "36%", left: "50%", delay: "3.5s", size: "is-large", coral: true },
    { top: "82%", left: "80%", delay: "6.5s", size: "" },
    { top: "54%", left: "82%", delay: "9s",   size: "",         coral: true },
  ],

  // Many small motes, busier field. Most are tiny so they don't compete
  // with the headline next door.
  dense: [
    { top: "10%", left: "18%", delay: "0s",    size: "is-tiny" },
    { top: "14%", left: "42%", delay: "1.5s",  size: "is-tiny" },
    { top: "8%",  left: "66%", delay: "3s",    size: "is-tiny" },
    { top: "16%", left: "84%", delay: "4.5s",  size: "is-small" },
    { top: "24%", left: "32%", delay: "6s",    size: "is-tiny" },
    { top: "28%", left: "56%", delay: "7.5s",  size: "is-tiny" },
    { top: "32%", left: "76%", delay: "9s",    size: "is-tiny" },
    { top: "40%", left: "20%", delay: "10.5s", size: "is-small" },
    { top: "44%", left: "50%", delay: "12s",   size: "is-tiny" },
    { top: "48%", left: "82%", delay: "0.75s", size: "is-tiny", coral: true },
    { top: "52%", left: "36%", delay: "2.25s", size: "is-tiny" },
    { top: "56%", left: "62%", delay: "3.75s", size: "is-tiny" },
    { top: "62%", left: "24%", delay: "5.25s", size: "is-tiny" },
    { top: "64%", left: "54%", delay: "6.75s", size: "is-tiny" },
    { top: "68%", left: "78%", delay: "8.25s", size: "is-small" },
    { top: "72%", left: "40%", delay: "9.75s", size: "is-tiny" },
    { top: "76%", left: "16%", delay: "11.25s",size: "is-tiny" },
    { top: "80%", left: "66%", delay: "0.5s",  size: "is-tiny" },
    { top: "84%", left: "30%", delay: "2s",    size: "is-tiny" },
    { top: "86%", left: "54%", delay: "4s",    size: "is-tiny", coral: true },
    { top: "88%", left: "80%", delay: "5.5s",  size: "is-tiny" },
    { top: "92%", left: "42%", delay: "7s",    size: "is-tiny" },
    { top: "36%", left: "8%",  delay: "8.5s",  size: "is-tiny" },
    { top: "58%", left: "92%", delay: "10s",   size: "is-tiny" },
  ],

  // Pricing section: 8 motes scattered around the edges and across the field.
  pricing: [
    { top: "8%",  left: "4%",  delay: "0s",    size: "is-small" },
    { top: "6%",  left: "84%", delay: "3.5s",  size: "" },
    { top: "38%", left: "96%", delay: "7s",    size: "is-large", coral: true },
    { top: "62%", left: "2%",  delay: "10s",   size: "is-large" },
    { top: "78%", left: "88%", delay: "1.5s",  size: "is-small" },
    { top: "88%", left: "18%", delay: "5s",    size: "" },
    { top: "46%", left: "50%", delay: "8.5s",  size: "is-tiny" },
    { top: "94%", left: "54%", delay: "12s",   size: "is-small", coral: true },
  ],

  // Very quiet: six motes, well-spaced, one coral.
  minimal: [
    { top: "22%", left: "34%", delay: "0s",   size: "" },
    { top: "38%", left: "72%", delay: "5s",   size: "is-small" },
    { top: "56%", left: "24%", delay: "9s",   size: "is-small" },
    { top: "68%", left: "58%", delay: "3s",   size: "", coral: true },
    { top: "82%", left: "36%", delay: "7s",   size: "is-tiny" },
    { top: "30%", left: "82%", delay: "11s",  size: "is-tiny" },
  ],
};

function StarField({ preset = "default" }) {
  const motes = STARFIELD_PRESETS[preset] || STARFIELD_PRESETS.default;
  return (
    <div className="at-hero-motes" data-preset={preset} aria-hidden="true">
      {motes.map((m, i) => (
        <span
          key={i}
          className={[m.size, m.coral ? "is-coral" : ""].filter(Boolean).join(" ")}
          style={{ top: m.top, left: m.left, animationDelay: m.delay }}
        />
      ))}
    </div>
  );
}

// HeroNodeGraph — node network with a coral "upward trend" path threading
// left→right and bottom→top through a field of muted teal background nodes.
// Mirrors the reference: bold highlighted route, quieter surrounding network.
// Five layers: (1) faint teal network edges, (2) coral path glow + crisp line,
// (3) background nodes, (4) coral path nodes with outer glow rings,
// (5) second-pass path that draws after a pause and a fade-to-teal reset.
function HeroNodeGraph() {
  const [phase, setPhase] = React.useState('anim1');

  React.useEffect(() => {
    if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
    const timers = [];
    function at(delay, phase) {
      timers.push(setTimeout(() => setPhase(phase), delay));
    }
    // Each cycle schedules all phase transitions then recurses at the moment
    // loop1 begins, so subsequent anim1 plays without the three pulses.
    function cycle(isFirst) {
      // anim1 hold: 17.3s first play (5.4s pulse + 8s draw + 0.9s last-node + 3s)
      //             12.4s loop  (0.5s delay + 8s draw + 0.9s last-node + 3s)
      const h1 = isFirst ? 17300 : 12400;
      let t = h1;
      at(t, 'fading');   t += 1500;   // 1.5s fade
      at(t, 'anim2');    t += 10900;  // 7s draw + 0.9s + 3s hold
      at(t, 'fading2');  t += 1800;   // 1.8s rest
      at(t, 'anim3');    t += 9900;   // 6s draw + 0.9s + 3s hold
      at(t, 'fading3');  t += 1800;   // 1.8s rest
      at(t, 'anim4');    t += 10900;  // 7s draw + 0.9s + 3s hold
      at(t, 'fading4');  t += 1800;   // 1.8s rest
      at(t, 'loop1');                  // anim1 repeats (no pulse)
      // recurse exactly when loop1 begins
      timers.push(setTimeout(() => cycle(false), t));
    }
    cycle(true);
    return () => timers.forEach(clearTimeout);
  }, []);

  return (
    <div className="at-hero-graph" data-phase={phase} aria-hidden="true">
      <svg viewBox="0 0 400 365" fill="none" xmlns="http://www.w3.org/2000/svg">

        {/* ── Layer 1: full network — faint teal edges ── */}
        <g stroke="var(--teal-300)" strokeWidth="1" strokeOpacity="0.28" strokeLinecap="round">
          {/* edges that the coral path rides along, node→node */}
          <line x1="48"  y1="332" x2="112" y2="262" />
          <line x1="112" y1="262" x2="145" y2="212" />
          <line x1="145" y1="212" x2="245" y2="182" />
          <line x1="245" y1="182" x2="285" y2="242" />
          <line x1="285" y1="242" x2="298" y2="122" />
          <line x1="298" y1="122" x2="342" y2="42"  />
          {/* surrounding mesh — denser Obsidian-style cross-connections */}
          <line x1="48"  y1="332" x2="38"  y2="258" />
          <line x1="48"  y1="332" x2="135" y2="325" />
          <line x1="112" y1="262" x2="198" y2="278" />
          <line x1="112" y1="262" x2="82"  y2="185" />
          <line x1="82"  y1="185" x2="38"  y2="258" />
          <line x1="82"  y1="185" x2="145" y2="212" />
          <line x1="145" y1="212" x2="172" y2="128" />
          <line x1="172" y1="128" x2="188" y2="48"  />
          <line x1="172" y1="128" x2="258" y2="78"  />
          <line x1="245" y1="182" x2="172" y2="128" />
          <line x1="245" y1="182" x2="298" y2="122" />
          <line x1="245" y1="182" x2="352" y2="200" />
          <line x1="258" y1="78"  x2="298" y2="122" />
          <line x1="258" y1="78"  x2="188" y2="48"  />
          <line x1="298" y1="122" x2="372" y2="92"  />
          <line x1="342" y1="42"  x2="372" y2="92"  />
          <line x1="198" y1="278" x2="285" y2="242" />
          <line x1="198" y1="278" x2="135" y2="325" />
          <line x1="198" y1="278" x2="358" y2="305" />
          <line x1="285" y1="242" x2="352" y2="200" />
          <line x1="285" y1="242" x2="358" y2="305" />
          <line x1="352" y1="200" x2="358" y2="305" />
          <line x1="372" y1="92"  x2="352" y2="200" />
          <line x1="135" y1="325" x2="285" y2="242" />
        </g>

        {/* ── Layer 2: highlighted path — straight node→node segments ──
             Route from the bottom-left node, trending right & upward with a
             pullback at 285,242, peaking at the top-right node 342,42.
             Glow halo first, crisp coral line on top. */}
        <polyline
          className="at-cg-path"
          points="48,332 112,262 145,212 245,182 285,242 298,122 342,42"
          stroke="var(--coral-400)" strokeWidth="10" strokeOpacity="0.10"
          strokeLinecap="round" strokeLinejoin="round" fill="none"
        />
        <polyline
          className="at-cg-path"
          points="48,332 112,262 145,212 245,182 285,242 298,122 342,42"
          stroke="var(--coral-400)" strokeWidth="2" strokeOpacity="0.48"
          strokeLinecap="round" strokeLinejoin="round" fill="none"
        />

        {/* ── Layer 3: background (off-path) nodes — muted teal ── */}
        <g fill="var(--teal-300)" fillOpacity="0.58">
          <circle cx="38"  cy="258" r="4" />
          <circle cx="135" cy="325" r="5" />
          <circle cx="198" cy="278" r="7" />
          <circle cx="82"  cy="185" r="5" />
          <circle cx="172" cy="128" r="6" />
          <circle cx="258" cy="78"  r="5" />
          <circle cx="352" cy="200" r="5" />
          <circle cx="358" cy="305" r="6" />
          <circle cx="372" cy="92"  r="5" />
          <circle cx="188" cy="48"  r="5" />
        </g>

        {/* ── Layer 4: path nodes — coral, glow ring behind, solid core ── */}
        {/* outer glow rings */}
        <g fill="var(--coral-400)" fillOpacity="0.16">
          <circle cx="48"  cy="332" r="18" className="at-cg-glow at-cg-glow--first" />
          <circle cx="112" cy="262" r="15" className="at-cg-glow" style={{'--d':'6.80s',  '--dl':'1.90s'}} />
          <circle cx="145" cy="212" r="15" className="at-cg-glow" style={{'--d':'7.68s',  '--dl':'2.78s'}} />
          <circle cx="245" cy="182" r="16" className="at-cg-glow" style={{'--d':'9.22s',  '--dl':'4.32s'}} />
          <circle cx="285" cy="242" r="15" className="at-cg-glow" style={{'--d':'10.28s', '--dl':'5.38s'}} />
          <circle cx="298" cy="122" r="15" className="at-cg-glow" style={{'--d':'12.06s', '--dl':'7.16s'}} />
          <circle cx="342" cy="42"  r="24" className="at-cg-glow" style={{'--d':'13.40s', '--dl':'8.50s'}} />
        </g>
        {/* solid path nodes */}
        <circle cx="48"  cy="332" r="9"
          className="at-cg-node at-cg-node--first"
          fill="var(--coral-400)" fillOpacity="0.90"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))'}} />
        <circle cx="112" cy="262" r="8"
          className="at-cg-node"
          fill="var(--coral-400)" fillOpacity="0.90"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'6.80s',  '--dl':'1.90s'}} />
        <circle cx="145" cy="212" r="8"
          className="at-cg-node"
          fill="var(--coral-400)" fillOpacity="0.90"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'7.68s',  '--dl':'2.78s'}} />
        <circle cx="245" cy="182" r="9"
          className="at-cg-node"
          fill="var(--coral-400)" fillOpacity="0.90"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'9.22s',  '--dl':'4.32s'}} />
        <circle cx="285" cy="242" r="8"
          className="at-cg-node"
          fill="var(--coral-400)" fillOpacity="0.90"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'10.28s', '--dl':'5.38s'}} />
        <circle cx="298" cy="122" r="8"
          className="at-cg-node"
          fill="var(--coral-400)" fillOpacity="0.90"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'12.06s', '--dl':'7.16s'}} />
        {/* endpoint — largest, brightest glow */}
        <circle cx="342" cy="42"  r="13"
          className="at-cg-node"
          fill="var(--coral-400)" fillOpacity="0.92"
          style={{filter:'drop-shadow(0 0 12px rgba(219,122,87,0.80))', '--d':'13.40s', '--dl':'8.50s'}} />

        {/* ── Layer 5: second path (anim2) ──
             Route: (135,325) → (198,278) → (285,242) → (352,200) → (372,92) → (298,122) → (258,78)
             Bottom-centre across the mesh then up the right side and left to the top.
             All edges exist in Layer 1's teal mesh. Invisible until anim2 phase. */}
        <polyline
          className="at-cg-path2"
          points="135,325 198,278 285,242 352,200 372,92 298,122 258,78"
          stroke="var(--coral-400)" strokeWidth="10" strokeOpacity="0.10"
          strokeLinecap="round" strokeLinejoin="round" fill="none"
        />
        <polyline
          className="at-cg-path2"
          points="135,325 198,278 285,242 352,200 372,92 298,122 258,78"
          stroke="var(--coral-400)" strokeWidth="2" strokeOpacity="0.48"
          strokeLinecap="round" strokeLinejoin="round" fill="none"
        />
        {/* glow rings — path length splits: 78.6 / 172.8 / 251.9 / 361.7 / 441.6 / 501 */}
        <circle cx="135" cy="325" r="18" className="at-cg-glow2 at-cg-glow2--first" fill="var(--coral-400)" fillOpacity="0" />
        <circle cx="198" cy="278" r="15" className="at-cg-glow2" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'1.10s'}} />
        <circle cx="285" cy="242" r="15" className="at-cg-glow2" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'2.40s'}} />
        <circle cx="352" cy="200" r="15" className="at-cg-glow2" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'3.50s'}} />
        <circle cx="372" cy="92"  r="15" className="at-cg-glow2" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'5.10s'}} />
        <circle cx="298" cy="122" r="15" className="at-cg-glow2" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'6.20s'}} />
        <circle cx="258" cy="78"  r="24" className="at-cg-glow2" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'7.00s'}} />
        {/* solid nodes — no pulse on first node for anim2 */}
        <circle cx="135" cy="325" r="9"
          className="at-cg-node2 at-cg-node2--first"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))'}} />
        <circle cx="198" cy="278" r="8"
          className="at-cg-node2"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'1.10s'}} />
        <circle cx="285" cy="242" r="8"
          className="at-cg-node2"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'2.40s'}} />
        <circle cx="352" cy="200" r="8"
          className="at-cg-node2"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'3.50s'}} />
        <circle cx="372" cy="92"  r="8"
          className="at-cg-node2"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'5.10s'}} />
        <circle cx="298" cy="122" r="8"
          className="at-cg-node2"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'6.20s'}} />
        <circle cx="258" cy="78"  r="13"
          className="at-cg-node2 at-cg-node2--last"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 12px rgba(219,122,87,0.80))', '--d':'7.00s'}} />

        {/* ── Layer 6: third path (anim3) ──
             Route: (38,258) → (82,185) → (145,212) → (172,128) → (258,78) → (188,48)
             Climbs the left-centre column: mid-left → up → upper-left corner.
             A different quadrant from both previous paths. Invisible until anim3 phase. */}
        <polyline
          className="at-cg-path3"
          points="38,258 82,185 145,212 172,128 258,78 188,48"
          stroke="var(--coral-400)" strokeWidth="10" strokeOpacity="0.10"
          strokeLinecap="round" strokeLinejoin="round" fill="none"
        />
        <polyline
          className="at-cg-path3"
          points="38,258 82,185 145,212 172,128 258,78 188,48"
          stroke="var(--coral-400)" strokeWidth="2" strokeOpacity="0.48"
          strokeLinecap="round" strokeLinejoin="round" fill="none"
        />
        {/* glow rings — path length splits: 85 / 154 / 242 / 341 / 418 */}
        <circle cx="38"  cy="258" r="18" className="at-cg-glow3 at-cg-glow3--first" fill="var(--coral-400)" fillOpacity="0" />
        <circle cx="82"  cy="185" r="15" className="at-cg-glow3" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'1.20s'}} />
        <circle cx="145" cy="212" r="15" className="at-cg-glow3" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'2.20s'}} />
        <circle cx="172" cy="128" r="15" className="at-cg-glow3" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'3.50s'}} />
        <circle cx="258" cy="78"  r="15" className="at-cg-glow3" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'4.90s'}} />
        <circle cx="188" cy="48"  r="24" className="at-cg-glow3" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'6.00s'}} />
        {/* solid nodes */}
        <circle cx="38"  cy="258" r="9"
          className="at-cg-node3 at-cg-node3--first"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))'}} />
        <circle cx="82"  cy="185" r="8"
          className="at-cg-node3"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'1.20s'}} />
        <circle cx="145" cy="212" r="8"
          className="at-cg-node3"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'2.20s'}} />
        <circle cx="172" cy="128" r="8"
          className="at-cg-node3"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'3.50s'}} />
        <circle cx="258" cy="78"  r="8"
          className="at-cg-node3"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'4.90s'}} />
        <circle cx="188" cy="48"  r="13"
          className="at-cg-node3 at-cg-node3--last"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 12px rgba(219,122,87,0.80))', '--d':'6.00s'}} />

        {/* ── Layer 7: fourth path (anim4) ──
             Route: (342,42) → (372,92) → (352,200) → (358,305) → (285,242) → (135,325)
             Descends from the anim1 endpoint (top-right corner) down the right side,
             landing at the anim2 start node (bottom-centre) — a callback to both.
             All edges exist in Layer 1's teal mesh. Total path ≈ 541px → dasharray 550. */}
        <polyline
          className="at-cg-path4"
          points="342,42 372,92 352,200 358,305 285,242 135,325"
          stroke="var(--coral-400)" strokeWidth="10" strokeOpacity="0.10"
          strokeLinecap="round" strokeLinejoin="round" fill="none"
        />
        <polyline
          className="at-cg-path4"
          points="342,42 372,92 352,200 358,305 285,242 135,325"
          stroke="var(--coral-400)" strokeWidth="2" strokeOpacity="0.48"
          strokeLinecap="round" strokeLinejoin="round" fill="none"
        />
        {/* glow rings — path length splits: 58 / 168 / 273 / 370 / 541 */}
        <circle cx="342" cy="42"  r="18" className="at-cg-glow4 at-cg-glow4--first" fill="var(--coral-400)" fillOpacity="0" />
        <circle cx="372" cy="92"  r="15" className="at-cg-glow4" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'0.75s'}} />
        <circle cx="352" cy="200" r="15" className="at-cg-glow4" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'2.20s'}} />
        <circle cx="358" cy="305" r="15" className="at-cg-glow4" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'3.50s'}} />
        <circle cx="285" cy="242" r="15" className="at-cg-glow4" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'4.80s'}} />
        <circle cx="135" cy="325" r="24" className="at-cg-glow4" fill="var(--coral-400)" fillOpacity="0" style={{'--d':'7.00s'}} />
        {/* solid nodes */}
        <circle cx="342" cy="42"  r="9"
          className="at-cg-node4 at-cg-node4--first"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))'}} />
        <circle cx="372" cy="92"  r="8"
          className="at-cg-node4"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'0.75s'}} />
        <circle cx="352" cy="200" r="8"
          className="at-cg-node4"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'2.20s'}} />
        <circle cx="358" cy="305" r="8"
          className="at-cg-node4"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'3.50s'}} />
        <circle cx="285" cy="242" r="8"
          className="at-cg-node4"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 6px rgba(219,122,87,0.55))', '--d':'4.80s'}} />
        <circle cx="135" cy="325" r="13"
          className="at-cg-node4 at-cg-node4--last"
          fill="var(--coral-400)" fillOpacity="0"
          style={{filter:'drop-shadow(0 0 12px rgba(219,122,87,0.80))', '--d':'7.00s'}} />

      </svg>
    </div>
  );
}

// OfferDetail powered the expandable multi-offer cards. The site now shows a
// single static offer, so this is preserved (disabled) for when offers return.
/*
function OfferDetail({ offering, onClose, detailRef }) {
  const d = offering.details;
  return (
    <div className="at-detail" id="offer-detail" role="region" ref={detailRef}>
      <div className="at-detail-head">
        <span className="at-detail-title">{offering.title}</span>
        <button type="button" className="at-detail-close" onClick={onClose}>
          Close <span aria-hidden="true">×</span>
        </button>
      </div>
      <div className="at-detail-body">
        {d.body && <p className="at-detail-text">{d.body}</p>}
        {d.list && (
          <div className="at-detail-list">
            <p className="at-detail-list-label">{d.list.label}</p>
            <ul>
              {d.list.items.map((item, i) => <li key={i}>{item}</li>)}
            </ul>
          </div>
        )}
        {d.products && (
          <div className="at-detail-products">
            {d.products.map(p => (
              <div key={p.name} className="at-detail-product-row">
                <span>{p.name}</span>
                {p.price && <span className="at-detail-product-price">{p.price}</span>}
              </div>
            ))}
          </div>
        )}
        {d.options && (
          <div className="at-detail-options">
            {d.options.map(opt => (
              <div key={opt.title} className="at-detail-option">
                <strong>{opt.title}</strong>
                <p>{opt.body}</p>
              </div>
            ))}
          </div>
        )}
        {d.note && <p className="at-detail-note">{d.note}</p>}
        {(d.price || d.cta) && (
          <div className="at-detail-foot">
            {d.price && <span className="at-detail-price">{d.price}</span>}
            {d.cta && (
              <a href={d.cta.href} className="v-btn at-detail-cta">
                {d.cta.label} <span aria-hidden="true">→</span>
              </a>
            )}
          </div>
        )}
      </div>
    </div>
  );
}
*/

function HomeAtelier({ starfield = "default" }) {
  const { PERSON, SERVICES } = window;

  return (
    <div className="at-page">
      {/* HEADER */}
      <div className="at-header-bar">
      <header className="at-header">
        <a className="at-logo" href="#">
          <svg viewBox="0 0 44 44" width="24" height="24" aria-hidden="true">
            <circle cx="22" cy="22" r="14" fill="none" stroke="var(--teal-700)" strokeWidth="2.25"/>
            <circle cx="22" cy="22" r="5.5" fill="none" stroke="var(--teal-700)" strokeWidth="2.25"/>
            <line x1="4" y1="22" x2="40" y2="22" stroke="var(--teal-700)" strokeWidth="1.25" strokeDasharray="2 3"/>
          </svg>
          <span>AI Safe Lens</span>
        </a>
        <nav className="at-nav">
          <a href="#open" className="is-active">Services</a>
          <a href="#background">About</a>
        </nav>
        <a href={"https://" + PERSON.cal} target="_blank" rel="noopener noreferrer" className="at-header-cta">Book a call</a>
      </header>
      </div>

      {/* HERO — dusk band, full-bleed teal background. Headline left, a
          background-removed photo of Diana on the right, on a smooth gradient. */}
      <section className="at-hero-band" data-theme="dusk">
        <span className="at-hero-aurora" aria-hidden="true"></span>
        <div className="at-hero">
          <div className="at-hero-copy">
            <h1>
              Safety-first <em style={{color: 'var(--coral-500)'}}>AI</em> for Business.
            </h1>
            <span className="at-hero-rule" aria-hidden="true"></span>
            <p className="at-hero-lead">
              AI literacy training &amp; workshops.<br />
              Focus: cybersecurity, compliance, critical thinking.<br />
              Marbella - Estepona - Gibraltar /<br />
              Costa del Sol, Spain /<br />
              online.
            </p>
          </div>
          <HeroNodeGraph />
        </div>
      </section>

      {/* OPEN RIGHT NOW — the offering leads */}
      <section className="at-section at-section--sunken" id="open">
        <div className="at-section-inner">
          <div className="at-section-head">
            <h2>Services</h2>
          </div>
          <p className="at-open-lead">
            Practical AI skills with a critical mindset: practise the <em className="at-em-coral">how</em> and understand the <em className="at-em-coral">why</em>. Safe &amp; compliant - to save your money. Efficient - to make you money.
            <br />{SERVICES.intro[1]}
            <br />{SERVICES.intro[2]}
          </p>
          <div className="at-services-stack">
            {SERVICES.cards.map((c, i) => (
              <article key={i} className={c.items ? "at-card at-card--wide" : "at-card"}>
                <h3>{c.title}</h3>
                <p className="at-card-blurb">{c.body}</p>
                {c.items ? (
                  <ul className="at-ready-list">
                    {c.items.map((it, j) => (
                      <li key={j}>
                        <span className="at-ready-name-wrap">
                          {it.href
                            ? <a className="at-ready-name at-ready-name--link" href={it.href} target="_blank" rel="noopener noreferrer">{it.name}{it.detail ? ` ${it.detail}` : ""} →</a>
                            : <span className="at-ready-name">{it.name}</span>}
                        </span>
                        <span className="at-ready-kind">{it.kind}</span>
                      </li>
                    ))}
                  </ul>
                ) : (
                  <p className="at-card-place">{c.place}</p>
                )}
              </article>
            ))}
          </div>
        </div>
      </section>

      {/* WHAT CLIENTS SAY — hidden until real, named testimonials exist.
          Restore by uncommenting and re-enabling QUOTES in data.jsx.
      <section className="at-section" style={{ paddingTop: '56px' }}>
        <div className="at-section-head">
          <h2>
            What <em>clients</em> have said.
          </h2>
        </div>
        <div className="at-quotes">
          {QUOTES.map((q, i) => (
            <figure key={i} className="at-quote-card">
              <blockquote className="at-quote-card-body">
                {q.body}
              </blockquote>
              <figcaption className="at-quote-card-attrib">
                <span className="at-quote-card-name">{q.name}</span>
                <span className="at-quote-card-role">{q.role}</span>
              </figcaption>
            </figure>
          ))}
        </div>
      </section>
      */}

      {/* ABOUT THE FOUNDER */}
      <section className="at-section" id="background" data-theme="dusk">
        <div className="at-founder">
          <div className="at-founder-intro">
            <div className="at-founder-intro-text">
              <div className="v-eyebrow">About the Founder</div>
              <h2 className="at-founder-name">{PERSON.name}</h2>
              <p className="at-founder-aka"><span className="at-founder-aka-particle">aka</span> Skipper Szyper</p>
              <p className="at-founder-bio">{PERSON.bio}</p>
              <ul className="at-founder-bullets">
                {PERSON.areas.map((a, i) => (
                  <li key={i}><strong>{a.title}:</strong> {a.body}</li>
                ))}
              </ul>
              <div className="at-founder-creds-block">
                <div className="v-eyebrow at-founder-creds-label">Selected credentials</div>
                <div className="at-founder-pills">
                  {PERSON.selectedCredentials.map((c, i) => {
                    if (c.popup) {
                      return (
                        <span key={i} className="at-founder-pill at-founder-pill--popup" tabIndex="0">
                          {c.name}
                          <span className="at-founder-pill-sep" aria-hidden="true">·</span>
                          <span className="at-founder-pill-issuer">{c.issuer}</span>
                          <span className="at-pill-popup" role="tooltip">{c.popup}</span>
                        </span>
                      );
                    }
                    const Tag = c.href ? "a" : "span";
                    return (
                      <Tag key={i} className={"at-founder-pill" + (c.href ? " is-link" : "")}
                        href={c.href || undefined}
                        target={c.href ? "_blank" : undefined}
                        rel={c.href ? "noopener noreferrer" : undefined}>
                        {c.name}
                        <span className="at-founder-pill-sep" aria-hidden="true">·</span>
                        <span className="at-founder-pill-issuer">{c.issuer}</span>
                      </Tag>
                    );
                  })}
                </div>
                <a href={PERSON.links[0].href} className="v-btn at-founder-linkedin">
                  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                    <path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/>
                  </svg>
                  View full profile on LinkedIn
                </a>
              </div>
            </div>
            <img src="assets/diana-photo.jpg" alt="Diana Szyperska" className="at-founder-photo" />
          </div>
        </div>
      </section>

      {/* WRITING — hidden until Build b-log is ready. Uncomment to restore.
      <section className="at-section" id="writing" style={{ paddingTop: 0 }}>
        <div className="at-section-head">
          <h2>
            Build <em>b-log</em>.
          </h2>
          <div className="at-section-head-meta">
            <a href="#">All entries &rarr;</a>
          </div>
        </div>
        <ul className="at-writing">
          {WRITING.map((w, i) => (
            <li key={i} className="at-write">
              <span className="at-write-date">{w.date}</span>
              <h3><a href="#">{w.title}</a></h3>
              <span className="at-write-kind">{w.kind}</span>
            </li>
          ))}
        </ul>
      </section>
      */}

      {/* PRICING — hidden for now. Custom pricing is discussed per format
          (consultation, workshop, day training). Restore by uncommenting and
          re-enabling PRICING in data.jsx.
      <section className="at-section" id="pricing">
        <div className="at-section-head">
          <h2>
            Pricing.
          </h2>
          <div className="at-section-head-meta">
            All prices in euros. VAT added where applicable.
          </div>
        </div>
        <ul className="at-pricing">
          {PRICING.map(p => (
            <li key={p.id} className="at-price-row" data-free={p.price === "Free" ? "true" : "false"}>
              <div className="at-price-name">{p.name}</div>
              <div className="at-price-note">{p.note}</div>
              <div className="at-price-value">{p.price}</div>
            </li>
          ))}
        </ul>
      </section>
      */}

      {/* CONTACT — light theme */}
      <section className="at-contact" id="contact" style={{ position: 'relative' }}>
        <span className="deco-coral-wash" aria-hidden="true"></span>
        <div className="at-contact-inner">
          <h2>
            Let's <em>connect.</em>
          </h2>
          <div className="at-contact-actions">
            <a
              href={"https://" + PERSON.cal}
              target="_blank"
              rel="noopener noreferrer"
              className="v-btn at-contact-primary"
            >
              Book a discovery call
            </a>
            <a href={PERSON.links[0].href} target="_blank" rel="noopener noreferrer" className="at-contact-li" aria-label="LinkedIn">
              <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                <path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/>
              </svg>
            </a>
          </div>
        </div>
      </section>

      {/* FOOTER */}
      <footer className="at-footer">
        <div className="at-footer-inner">
          <div>
            <a className="at-logo" href="#">
              <svg viewBox="0 0 44 44" width="22" height="22" aria-hidden="true">
                <circle cx="22" cy="22" r="14" fill="none" stroke="var(--teal-700)" strokeWidth="2.25"/>
                <circle cx="22" cy="22" r="5.5" fill="none" stroke="var(--teal-700)" strokeWidth="2.25"/>
                <line x1="4" y1="22" x2="40" y2="22" stroke="var(--teal-700)" strokeWidth="1.25" strokeDasharray="2 3"/>
              </svg>
              <span>AI Safe Lens</span>
            </a>
            <p className="at-footer-tag">
              Safety-first AI Literacy
            </p>
          </div>
          <div className="at-footer-col">
            <div className="at-footer-head">Work with me</div>
            <ul>
              <li><a href="#open">Services</a></li>
              <li><a href="#background">About</a></li>
              <li><a href={"https://" + PERSON.cal} target="_blank" rel="noopener noreferrer">Book a discovery call</a></li>
            </ul>
          </div>
          <div className="at-footer-col">
            <div className="at-footer-head">Find me</div>
            <ul>
              <li><a href={"mailto:" + PERSON.email}>{PERSON.email}</a></li>
              <li><a href={PERSON.links[0].href} target="_blank" rel="noopener noreferrer">LinkedIn</a></li>
            </ul>
          </div>
          <div className="at-footer-col">
            <div className="at-footer-head">Legal</div>
            <ul>
              <li><a href="/privacy-policy/">Privacy Policy</a></li>
              <li><a href="/terms/">Terms of Service</a></li>
              <li><a href="/aviso-legal/">Aviso Legal (ES)</a></li>
            </ul>
          </div>
        </div>
        <div className="at-footer-base">
          <span>© 2026 AI Safe Lens</span>
        </div>
      </footer>
    </div>
  );
}

Object.assign(window, { HomeAtelier });
