/* brenn studio — homepage sections (React components) */

const { useEffect, useRef, useState } = React;

// ---------- Scroll motion hook ----------
function useReveal() {
  const ref = useRef(null);
  useEffect(() => {
    const el = ref.current;
    if (!el) return;
    const io = new IntersectionObserver(
      (entries) => {
        entries.forEach((e) => {
          if (e.isIntersecting) {
            e.target.classList.add('in');
            io.unobserve(e.target);
          }
        });
      },
      { threshold: 0.16, rootMargin: '0px 0px -8% 0px' }
    );
    el.querySelectorAll('.fade-up, .split-line').forEach((n, i) => {
      n.style.setProperty('--d', `${i % 6 * 80}ms`);
      io.observe(n);
    });
    return () => io.disconnect();
  }, []);
  return ref;
}

// ---------- Top Nav ----------
function TopNav() {
  return (
    <nav className="nav">
      <div className="nav-inner">
        <a href="#" className="logo" aria-label="brenn studio">
          brenn studio<span className="dot" aria-hidden="true"></span>
        </a>
        <div className="nav-links">
          <a href="#approach">Approach</a>
          <a href="#method">Method</a>
          <a href="#quiz">Quiz</a>
          <a href="#resources">Resources</a>
          <a href="#insights">Insights</a>
        </div>
        <a href="#quiz" className="nav-cta">Take the Quiz</a>
      </div>
    </nav>);

}

// ---------- Single thin geometric mark ----------
function Mark() {
  // A sovereign-architect mark: hairline circle (the landscape) with a single off-axis vertical (the architect's line) and one orange tick.
  return (
    <div className="hero-mark" aria-hidden="true">
      <svg viewBox="0 0 100 100">
        <circle cx="50" cy="50" r="46" className="stroke" />
        <line x1="50" y1="4" x2="50" y2="96" className="stroke" />
        <line x1="62" y1="50" x2="96" y2="50" className="accent" />
        <circle cx="62" cy="50" r="1.5" fill="var(--brenn)" stroke="none" />
      </svg>
    </div>);

}

// ---------- Hero (Section 01) ----------
function Hero() {
  const ref = useReveal();
  return (
    <section className="hero" ref={ref}>
      <Mark />
      <div className="container">
        <div className="hero-grid">
          <div>
            <div className="tick eyebrow fade-up" style={{ marginBottom: 36 }}>
              <span>01 — Operational Intelligence</span>
            </div>
            <h1 className="display fade-up">
              You built your <em>business</em><br />
              to serve.
            </h1>
          </div>

          <div className="hero-meta">
            <div className="hero-body">
              <p className="fade-up">
                And you do — brilliantly, relentlessly, with more care than most people will ever understand.
                But somewhere along the way, your vision outpaced your systems.
              </p>
              <p className="fade-up">There's a version of your business where everything hums. Where AI handles the complexity underneath, and your team's intelligence rises to the surface. Elevated, not replaced.


              </p>
              <p className="fade-up" style={{ color: "rgb(196, 84, 26)", fontWeight: "700" }}>
                brenn studio designs the systems that make that possible.
              </p>
            </div>
            <div className="hero-aside">
              <span className="label fade-up">Find out if you're ready</span>
              <a href="#quiz" className="btn-primary fade-up">
                Take the AI Readiness Quiz
                <span className="arrow">→</span>
              </a>
              <span className="label fade-up" style={{ color: 'var(--fg-3)' }}>~30 MINUTES · ACTIONABLE RESULTS</span>
            </div>
          </div>
        </div>
      </div>
    </section>);

}

// ---------- Section 02 — The Question Nobody Asks ----------
function QuestionSection() {
  const ref = useReveal();
  return (
    <section className="q-section" id="approach" ref={ref}>
      <div className="container">
        <div className="section-num fade-up">02 — The Question Nobody Asks</div>
        <h2 className="pull-quote fade-up">
          Most businesses have <em>processes</em>. Very few have <span className="brenn-word">decisions</span>.
        </h2>
        <div className="q-body">
          <p className="fade-up">
            There's a difference. A process tells you what to do. A decision determines what happens next —
            who owns it, what information it needs, how fast it moves, and whether it actually creates the outcome you intended.
          </p>
          <p className="fade-up">
            When decisions live in people's heads, businesses stall. When AI is asked to make decisions it doesn't have the
            context for, businesses break. When the right decision logic is designed into your systems — that's when everything starts to move.
          </p>
          <p className="fade-up" style={{ color: 'var(--fg)' }}>
            At brenn studio, decisions are where we begin.
          </p>
        </div>

        <div className="four-questions" role="list">
          <div className="fq fade-up" role="listitem">How are <span className="key">decisions</span> made here?</div>
          <div className="fq fade-up" role="listitem">Who <span className="key">owns</span> them?</div>
          <div className="fq fade-up" role="listitem">Where do they <span className="key">live</span>?</div>
          <div className="fq fade-up" role="listitem">What does the system need to <span className="key">know</span> to make them well?</div>
        </div>

        <div className="four-questions-after fade-up">
          Those four questions change everything.
        </div>
      </div>
    </section>);

}

// ---------- Section 03 — Bolt-On vs. Built-In ----------
function ContrastSection() {
  const ref = useReveal();
  const rows = [
  ['Automations built on broken processes', 'Systems designed around outcomes'],
  ['Decisions still living in people\u2019s heads', 'Decisions that are clear, owned, and fast'],
  ['AI acting without context or guardrails', 'AI that knows when to act and when to escalate'],
  ['Teams adapting around the tools', 'Teams elevated by the tools around them'],
  ['Inconsistent client experiences', 'Clients experiencing the full depth of what\u2019s possible'],
  ['Expensive complexity that creates new problems', 'Intelligent complexity that compounds over time'],
  ['The founder still at the center of everything', 'The founder leading instead of managing']];

  return (
    <section className="contrast" id="method" ref={ref}>
      <div className="container">
        <div className="contrast-head">
          <div>
            <div className="section-num fade-up">03 — Architecture</div>
            <h2 className="fade-up">Bolt-on, or built-in.</h2>
          </div>
          <div className="body fade-up" style={{ alignSelf: 'end' }}>
            Adding AI to a broken operation produces expensive chaos. Designing decision logic into the system itself produces clarity that compounds.
            The difference is architecture.
          </div>
        </div>

        <div className="contrast-grid">
          <div className="contrast-col left">
            <div className="contrast-label fade-up">
              <span className="swatch"></span> When AI is bolted on
            </div>
            {rows.map(([l], i) =>
            <div key={i} className="contrast-row fade-up">{l}</div>
            )}
          </div>
          <div className="contrast-divider" aria-hidden="true"></div>
          <div className="contrast-col right">
            <div className="contrast-label fade-up">
              <span className="swatch"></span> When AI is built in
            </div>
            {rows.map(([, r], i) =>
            <div key={i} className="contrast-row fade-up">{r}</div>
            )}
          </div>
        </div>
      </div>
    </section>);

}

// ---------- Section 04 — Offer Entry / Quiz ----------
function OfferSection() {
  const ref = useReveal();
  const dims = [
  ['01', 'Data & information flow', '01 of 05'],
  ['02', 'Workflow design', '02 of 05'],
  ['03', 'Documentation', '03 of 05'],
  ['04', 'Decision logic', '04 of 05'],
  ['05', 'Tool architecture', '05 of 05']];

  return (
    <section className="offer" id="quiz" ref={ref}>
      <div className="container">
        <div className="offer-grid">
          <div>
            <div className="section-num fade-up">04 — Where it starts</div>
            <h2 className="fade-up">This is where it starts.</h2>
            <div className="body fade-up" style={{ marginTop: 32, color: 'var(--fg-2)' }}>
              <p style={{ margin: '0 0 18px' }}>
                Not with a proposal. Not with a sales call. With an honest look at where your business actually stands.
              </p>
              <p style={{ margin: '0 0 18px', color: "rgb(61, 61, 61)" }}>The brenn studio AI Readiness Quiz evaluates your business across five dimensions. In 30 minutes, you'll know exactly where your foundation is strong, where the gaps are hiding, and what your smartest next move is.



              </p>
              <p style={{ margin: 0, color: 'var(--fg)' }}>No jargon. No pressure. Just clarity.</p>
            </div>
            <div style={{ marginTop: 48 }}>
              <a href="#" className="btn-link fade-up">Take the AI Readiness Quiz <span>→</span></a>
            </div>
          </div>

          <ul className="dimensions">
            {dims.map(([n, name, meta], i) =>
            <li key={i} className="fade-up">
                <span className="num">{n}</span>
                <span className="name">{name}</span>
                <span className="meta">{meta}</span>
              </li>
            )}
          </ul>
        </div>
      </div>
    </section>);

}

// ---------- Section 05 — Social Proof ----------
function ProofSection() {
  const ref = useReveal();
  return (
    <section className="proof" ref={ref}>
      <div className="container">
        <div className="proof-inner">
          <div className="section-num fade-up">05 — OUR ETHOS</div>
          <blockquote className="fade-up">
            "One quote that captures the exhale moment — the moment they saw the whole landscape for the first time."
          </blockquote>
          <div className="proof-cite fade-up">— ANGELICA MARTINEZ · FOUNDER OF BRENN STUDIO </div>
          <div className="proof-placeholder fade-up">
            [ placeholder — to be populated with first client story ]<br />
            structure: client &amp; practice → core tension on arrival → what their team now experiences → what their clients now experience.
          </div>
        </div>
      </div>
    </section>);

}

// ---------- Section 06 — Who This Is For ----------
function WhoSection() {
  const ref = useReveal();
  return (
    <section className="who" id="resources" ref={ref}>
      <div className="container">
        <div className="who-grid">
          <div>
            <div className="section-num fade-up">06</div>
            <h2 className="fade-up" style={{ marginTop: 18 }}>Who this is for.</h2>
          </div>
          <div>
            <p className="fade-up">brenn studio works with health and service business owners who are already good at what they do and know it. You're not looking for someone to hand you a tool and walk away. You're looking for a strategic partner who will look at your entire operation, tell you the truth about what they see, and build something that actually fits how you work and where you're going.




            </p>
            <p className="fade-up">
              If you're ready to stop adapting around your systems and start operating above them — this is for you.
            </p>
          </div>
        </div>
      </div>
    </section>);

}

// ---------- Section 07 — Final CTA ----------
function FinalCTA() {
  const ref = useReveal();
  return (
    <section className="final-cta" id="insights" ref={ref}>
      <div className="container">
        <div className="section-num fade-up">07 — Build for what's next</div>
        <h2 className="fade-up">
          The gap between your vision and your clients' experience has a <span className="accent">name</span>.
        </h2>
        <div className="final-cta-body">
          <p className="fade-up">
            It's called operational readiness. And it's measurable.
          </p>
          <p className="fade-up">
            Take the brenn studio AI Readiness Quiz and find out exactly where your business stands —
            and what to build next.
          </p>
        </div>
        <div className="final-cta-actions">
          <a href="#" className="btn-primary fade-up">
            Take the Quiz · Build for what's next
            <span className="arrow">→</span>
          </a>
        </div>
      </div>
    </section>);

}

// ---------- Footer ----------
function Foot() {
  return (
    <footer className="foot">
      <div className="container">
        <div className="foot-inner">
          <div>
            <div className="logo">brenn studio<span className="dot"></span></div>
            <div className="foot-tag">Build for what's next.</div>
          </div>
          <div className="foot-col">
            <h4>Studio</h4>
            <ul>
              <li><a href="#">Approach</a></li>
              <li><a href="#">Method</a></li>
              <li><a href="#">Case studies</a></li>
              <li><a href="#">About</a></li>
            </ul>
          </div>
          <div className="foot-col">
            <h4>Resources</h4>
            <ul>
              <li><a href="#">AI Readiness Quiz</a></li>
              <li><a href="#">Insights</a></li>
              <li><a href="#">Field notes</a></li>
              <li><a href="#">Glossary</a></li>
            </ul>
          </div>
          <div className="foot-col">
            <h4>Connect</h4>
            <ul>
              <li><a href="#">hello@brennstudio.io</a></li>
              <li><a href="#">LinkedIn</a></li>
              <li><a href="#">Blog</a></li>
              <li><a href="#">Take the Quiz</a></li>
            </ul>
          </div>
        </div>
        <div className="foot-base">
          <span>© 2026 brenn studio · brennstudio.io</span>
          <span>Privacy · Terms</span>
        </div>
      </div>
    </footer>);

}

Object.assign(window, {
  TopNav, Hero, QuestionSection, ContrastSection,
  OfferSection, ProofSection, WhoSection, FinalCTA, Foot
});