/** Obney marketing UI kit — JSX components.
 *  Visual recreation of a consultancy marketing site using the Obney
 *  design tokens. No existing codebase or Figma was provided, so these
 *  patterns are *applied design system*, not copies. Flag for review.
 */

const Logo = ({ variant = "default" }) => {
  const src = variant === "white"
    ? "../../assets/logos/logo-white.svg"
    : "../../assets/logos/logo-midnight-and-ocean.svg";
  return <img src={src} alt="Obney.ai" style={{ height: 28, width: "auto", display: "block" }} />;
};

const Nav = () => (
  <header style={{
    display: "flex", alignItems: "center", justifyContent: "space-between",
    padding: "22px 56px",
    borderBottom: "1px solid var(--border)",
    background: "var(--bg)",
  }}>
    <Logo />
    <nav style={{ display: "flex", gap: 32, alignItems: "center" }}>
      <a href="#work" style={{ fontSize: 15, fontWeight: 500, color: "var(--fg-1)" }}>Work</a>
      <a href="#method" style={{ fontSize: 15, fontWeight: 500, color: "var(--fg-1)" }}>Method</a>
      <a href="#writing" style={{ fontSize: 15, fontWeight: 500, color: "var(--fg-1)" }}>Writing</a>
      <a href="#team" style={{ fontSize: 15, fontWeight: 500, color: "var(--fg-1)" }}>Team</a>
      <Button>Start a project</Button>
    </nav>
  </header>
);

const Button = ({ children, variant = "primary", onClick, ...rest }) => {
  const base = {
    display: "inline-flex", alignItems: "center", justifyContent: "center", gap: 8,
    fontFamily: "var(--font-sans)", fontWeight: 600,
    borderRadius: 999, padding: "11px 22px",
    border: "1.5px solid transparent", cursor: "pointer",
    transition: "all 160ms cubic-bezier(.2,.7,.1,1)",
    fontSize: 15, lineHeight: 1, whiteSpace: "nowrap",
  };
  const variants = {
    primary:   { background: "#142C37", color: "#fff" },
    accent:    { background: "#68E4E9", color: "#142C37" },
    secondary: { background: "#fff", color: "#142C37", borderColor: "#142C37" },
    ghost:     { background: "transparent", color: "#142C37" },
  };
  return <button onClick={onClick} style={{ ...base, ...variants[variant] }} {...rest}>{children}</button>;
};

const Eyebrow = ({ children, color = "var(--fg-3)" }) => (
  <div style={{
    fontFamily: "var(--font-mono)", fontSize: 12, letterSpacing: "0.1em",
    textTransform: "uppercase", color, fontWeight: 500,
  }}>{children}</div>
);

const Label = ({ children, color = "#142C37", bg = "#F4F7F8" }) => (
  <span style={{
    display: "inline-flex", alignItems: "center", gap: 6,
    fontFamily: "var(--font-mono)", fontSize: 11, fontWeight: 500,
    letterSpacing: "0.08em", textTransform: "uppercase",
    padding: "6px 12px", borderRadius: 999, lineHeight: 1,
    background: bg, color,
  }}>{children}</span>
);

const Hero = () => (
  <section style={{
    padding: "96px 56px 80px",
    background: "var(--bg)",
    position: "relative", overflow: "hidden",
  }}>
    <div style={{ maxWidth: 1080 }}>
      <Eyebrow>— Greenfield software · Baton Rouge, LA</Eyebrow>
      <h1 style={{
        fontFamily: "var(--font-display)",
        fontSize: 96, fontWeight: 400, lineHeight: 0.95,
        letterSpacing: "-0.025em",
        margin: "20px 0 24px",
        maxWidth: 900,
      }}>
        Build it once.<br/>
        <span style={{ color: "var(--ocean-700)" }}>Build it to last.</span>
      </h1>
      <p style={{ fontSize: 20, lineHeight: 1.5, color: "var(--fg-2)", maxWidth: 640, margin: 0 }}>
        We're a small, opinionated team that builds new software systems with the
        architectural deliberateness to absorb whatever tooling comes next — without
        a rebuild every time the landscape shifts.
      </p>
      <div style={{ display: "flex", gap: 12, marginTop: 36 }}>
        <Button variant="primary">Schedule a call</Button>
        <Button variant="ghost">Read the method →</Button>
      </div>
    </div>
  </section>
);

const Values = () => {
  const items = [
    { n: "01", title: "Our best, at our expense", body: "If there's a tradeoff to be made, we pick quality. We absorb cost or effort rather than lower the standard." },
    { n: "02", title: "Our word is a contract", body: "We say what we mean. If something changes, we communicate early — never letting partners be surprised later." },
    { n: "03", title: "Partners, not projects", body: "We make decisions with our partners' long-term interests in mind, even when it's harder for us in the short term." },
    { n: "04", title: "Outcomes, not tasks", body: "If it's ours, we see it through. We're responsible for results, not just for doing the work." },
    { n: "05", title: "How, not if", body: "We assume problems are solvable. The question isn't whether — it's how to make progress and keep moving." },
  ];
  return (
    <section id="method" style={{ background: "#142C37", color: "#fff", padding: "96px 56px" }}>
      <div style={{ maxWidth: 1280, margin: "0 auto" }}>
        <Eyebrow color="#68E4E9">— Values</Eyebrow>
        <h2 style={{
          fontFamily: "var(--font-sans)", fontSize: 48, fontWeight: 700,
          letterSpacing: "-0.02em", lineHeight: 1.05,
          margin: "16px 0 56px", maxWidth: 720,
        }}>
          Five rules that shape every greenfield decision we make.
        </h2>
        <div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 24 }}>
          {items.map((it) => (
            <div key={it.n} style={{
              padding: "24px 0",
              borderTop: "1px solid rgba(255,255,255,0.14)",
            }}>
              <div style={{
                fontFamily: "var(--font-mono)", fontSize: 11,
                letterSpacing: "0.1em", color: "#68E4E9", marginBottom: 12,
              }}>{it.n}</div>
              <h3 style={{
                fontFamily: "var(--font-sans)", fontSize: 22, fontWeight: 700,
                margin: "0 0 10px", letterSpacing: "-0.01em", lineHeight: 1.25,
              }}>{it.title}</h3>
              <p style={{ margin: 0, fontSize: 15, lineHeight: 1.55, color: "rgba(255,255,255,0.75)" }}>{it.body}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
};

const CaseStudy = ({ kicker, title, summary, label, tone = "default" }) => {
  const tones = {
    default: { bg: "#fff", border: "1px solid var(--border)", fg: "#142C37" },
    accent:  { bg: "#DCF8F9", border: "1px solid #B5F2F4", fg: "#142C37" },
    dark:    { bg: "#142C37", border: "none", fg: "#fff" },
  };
  const t = tones[tone];
  return (
    <article style={{
      background: t.bg, color: t.fg, border: t.border, borderRadius: 16,
      padding: 28, display: "flex", flexDirection: "column", gap: 14,
      minHeight: 320,
    }}>
      <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
        <span style={{
          fontFamily: "var(--font-mono)", fontSize: 11,
          letterSpacing: "0.1em", textTransform: "uppercase",
          opacity: tone === "dark" ? 0.7 : 0.6,
        }}>{kicker}</span>
        {label && <Label color="#142C37" bg={tone === "dark" ? "#68E4E9" : "#F1FF73"}>{label}</Label>}
      </div>
      <div style={{ flex: 1 }}>
        <h3 style={{
          fontFamily: "var(--font-sans)", fontSize: 28, fontWeight: 700,
          letterSpacing: "-0.015em", lineHeight: 1.15, margin: "8px 0 12px",
        }}>{title}</h3>
        <p style={{ margin: 0, fontSize: 15, lineHeight: 1.55, opacity: tone === "dark" ? 0.8 : 0.78 }}>{summary}</p>
      </div>
      <a href="#" style={{
        fontSize: 14, fontWeight: 600,
        color: tone === "dark" ? "#68E4E9" : "var(--ocean-700)",
        display: "inline-flex", alignItems: "center", gap: 6,
      }}>Read the case study →</a>
    </article>
  );
};

const Work = () => (
  <section id="work" style={{ padding: "96px 56px", background: "var(--bg)" }}>
    <div style={{ maxWidth: 1280, margin: "0 auto" }}>
      <div style={{
        display: "flex", justifyContent: "space-between", alignItems: "flex-end",
        marginBottom: 48, gap: 32, flexWrap: "wrap",
      }}>
        <div>
          <Eyebrow>— Selected work</Eyebrow>
          <h2 style={{
            fontFamily: "var(--font-sans)", fontSize: 48, fontWeight: 700,
            letterSpacing: "-0.02em", lineHeight: 1.05, margin: "16px 0 0", maxWidth: 640,
          }}>
            Greenfield systems, built to absorb what's coming.
          </h2>
        </div>
        <Button variant="secondary">All case studies</Button>
      </div>
      <div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 20 }}>
        <CaseStudy
          kicker="— 01 / Healthcare"
          title="Replacing a 12-year EHR integration in 11 weeks"
          summary="A regional clinic network needed a system that could absorb AI scribing without a rewrite. We rebuilt the integration layer end-to-end."
          label="Shipped"
        />
        <CaseStudy
          tone="dark"
          kicker="— 02 / Logistics"
          title="From spreadsheets to a routing platform"
          summary="Built the dispatcher's tool the operations team actually wanted — and architected it so model swaps don't require a redeploy."
          label="Live"
        />
        <CaseStudy
          tone="accent"
          kicker="— 03 / Fintech"
          title="A risk engine with AI baked into the seams"
          summary="Designed the data and policy layer first so every later AI workflow plugs in cleanly. No bolt-on, no fragility."
          label="Featured"
        />
      </div>
    </div>
  </section>
);

const Method = () => (
  <section style={{ padding: "96px 56px", background: "var(--midnight-50)" }}>
    <div style={{ maxWidth: 1080, margin: "0 auto" }}>
      <Eyebrow>— The method</Eyebrow>
      <h2 style={{
        fontFamily: "var(--font-display)", fontSize: 64, fontWeight: 400,
        lineHeight: 1.0, letterSpacing: "-0.02em",
        margin: "16px 0 56px", maxWidth: 800,
      }}>
        Deliberate up front. Replaceable in the middle. Useful at the edges.
      </h2>
      <div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 24 }}>
        {[
          { n: "01", t: "Discovery as a deliverable", b: "We document the system before we build it. Architecture decisions become artifacts our partners keep." },
          { n: "02", t: "Internal frameworks", b: "Eighteen months of work codified into the patterns we use on every greenfield engagement." },
          { n: "03", t: "Built for the next tool", b: "Every interface, schema, and seam is shaped to absorb the tooling that hasn't shipped yet." },
        ].map(s => (
          <div key={s.n} style={{ background: "#fff", borderRadius: 14, padding: 24, border: "1px solid var(--border)" }}>
            <div style={{ fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: "0.1em", color: "var(--fg-3)" }}>{s.n}</div>
            <h4 style={{ fontSize: 20, fontWeight: 700, letterSpacing: "-0.01em", margin: "10px 0 8px" }}>{s.t}</h4>
            <p style={{ margin: 0, fontSize: 14, lineHeight: 1.55, color: "var(--fg-2)" }}>{s.b}</p>
          </div>
        ))}
      </div>
    </div>
  </section>
);

const CTA = () => (
  <section style={{ padding: "120px 56px", background: "#142C37", color: "#fff", textAlign: "center" }}>
    <div style={{ maxWidth: 820, margin: "0 auto" }}>
      <Eyebrow color="#68E4E9">— Let's talk</Eyebrow>
      <h2 style={{
        fontFamily: "var(--font-display)", fontSize: 88, fontWeight: 400,
        lineHeight: 0.95, letterSpacing: "-0.025em",
        margin: "20px 0 24px",
      }}>
        Bring us<br/>your hardest&nbsp;build.
      </h2>
      <p style={{ fontSize: 19, lineHeight: 1.5, opacity: 0.78, margin: "0 auto 36px", maxWidth: 580 }}>
        We take on a small number of greenfield engagements each year.
        Tell us what you're trying to build — we'll tell you if we're the right team.
      </p>
      <div style={{ display: "flex", gap: 12, justifyContent: "center" }}>
        <Button variant="accent">Schedule a call</Button>
        <button style={{
          background: "transparent", color: "#fff",
          border: "1.5px solid rgba(255,255,255,0.3)",
          borderRadius: 999, padding: "11px 22px",
          fontSize: 15, fontWeight: 600, cursor: "pointer",
        }}>hello@obney.ai</button>
      </div>
    </div>
  </section>
);

const Footer = () => (
  <footer style={{ background: "#0E1F28", color: "rgba(255,255,255,0.7)", padding: "48px 56px 36px" }}>
    <div style={{ maxWidth: 1280, margin: "0 auto", display: "flex", justifyContent: "space-between", gap: 32, flexWrap: "wrap" }}>
      <Logo variant="white" />
      <div style={{ display: "flex", gap: 48, fontSize: 13 }}>
        <div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
          <span style={{ fontFamily: "var(--font-mono)", fontSize: 10, letterSpacing: "0.1em", textTransform: "uppercase", opacity: 0.5 }}>Studio</span>
          <a href="#" style={{ color: "rgba(255,255,255,0.85)" }}>Work</a>
          <a href="#" style={{ color: "rgba(255,255,255,0.85)" }}>Method</a>
          <a href="#" style={{ color: "rgba(255,255,255,0.85)" }}>Team</a>
        </div>
        <div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
          <span style={{ fontFamily: "var(--font-mono)", fontSize: 10, letterSpacing: "0.1em", textTransform: "uppercase", opacity: 0.5 }}>Contact</span>
          <a href="#" style={{ color: "rgba(255,255,255,0.85)" }}>hello@obney.ai</a>
          <span style={{ color: "rgba(255,255,255,0.6)" }}>Baton Rouge, LA</span>
        </div>
      </div>
    </div>
    <div style={{
      maxWidth: 1280, margin: "32px auto 0", paddingTop: 24,
      borderTop: "1px solid rgba(255,255,255,0.1)",
      display: "flex", justifyContent: "space-between",
      fontFamily: "var(--font-mono)", fontSize: 11, letterSpacing: "0.05em",
      opacity: 0.5,
    }}>
      <span>© 2026 OBNEY.AI</span>
      <span>BUILT TO LAST · v0.4.2</span>
    </div>
  </footer>
);

const App = () => (
  <div data-screen-label="Marketing Home" style={{ minHeight: "100vh", background: "var(--bg)" }}>
    <Nav />
    <Hero />
    <Work />
    <Values />
    <Method />
    <CTA />
    <Footer />
  </div>
);

Object.assign(window, { App, Nav, Hero, Work, Values, Method, CTA, Footer, Button, Label, Eyebrow, CaseStudy, Logo });
