/* global React, I, Button, Reveal, Flow, Tools, Pricing, Contact, useTilt */
const { useState:usePS } = React;

/* shared page hero */
function PageHero({ eyebrow, title, sub, ctas }){
  return React.createElement("section",{ className:"section", style:{ paddingTop:150, paddingBottom:24 } },
    React.createElement("div",{ className:"wrap", style:{ maxWidth:880, textAlign:"center" } },
      React.createElement(Reveal,null, React.createElement("p",{ className:"eyebrow" }, eyebrow)),
      React.createElement(Reveal,{ delay:70 }, React.createElement("h2",{ className:"h-sec", style:{ fontSize:"clamp(34px,4.4vw,56px)", maxWidth:"16ch" } }, title)),
      sub && React.createElement(Reveal,{ delay:130 }, React.createElement("p",{ className:"sub-sec" }, sub)),
      ctas && React.createElement(Reveal,{ delay:190 }, React.createElement("div",{ style:{ display:"flex", gap:12, justifyContent:"center", marginTop:28, flexWrap:"wrap" } }, ctas))
    )
  );
}
function CtaBand({ title, sub, label, go, to }){
  return React.createElement("section",{ className:"section" },
    React.createElement("div",{ className:"wrap" },
      React.createElement(Reveal,{ scale:true },
        React.createElement("div",{ className:"cta-band" },
          React.createElement("div",null,
            React.createElement("h3",null, title),
            React.createElement("p",null, sub)),
          React.createElement(Button,{ variant:"grad", onClick:()=>go(to||"new") }, label))
      )
    )
  );
}
function Tile({ ic, t, d, i }){
  const tilt = useTilt(4);
  return React.createElement(Reveal,{ delay:(i%3)*80 },
    React.createElement("div",{ className:"feat-card", ...tilt },
      React.createElement("div",{ className:"feat-ic" }, React.createElement(I[ic],{ size:21 })),
      React.createElement("h3",null,t),
      React.createElement("p",null,d))
  );
}

/* ============ PRODUCT ============ */
function ProductPage({ go }){
  return React.createElement("div",null,
    React.createElement(PageHero,{
      eyebrow:"Product",
      title:"The coding engine behind every assessment",
      sub:"Paste a note and MedCode returns MDM scoring, a CPT recommendation, ICD candidates, and a quoted evidence trail — the same flow your reviewers ship on.",
      ctas:[ React.createElement(Button,{ key:1, variant:"grad", onClick:()=>go("new") }, "Launch the analyzer"),
             React.createElement(Button,{ key:2, variant:"ghost", icon:false, onClick:()=>go("flow") }, "See how it works") ] }),
    React.createElement(Flow,null),
    React.createElement(Tools,null),
    React.createElement(CtaBand,{ go, to:"new", title:"Try it on a real note", sub:"No login required — paste an office or outpatient note and watch the assessment build in seconds.", label:"Analyze a note" })
  );
}

/* ============ SOLUTIONS ============ */
const SOLUTIONS = [
  { ic:"user",    t:"Independent reviewers", d:"Score and document encounters faster, with rationale attached to every decision for clean handoffs." },
  { ic:"layers",  t:"Coding & billing teams", d:"Standardize MDM logic across reviewers and export audit-ready output straight into your billing review." },
  { ic:"shield",  t:"Health systems", d:"Run outpatient coding at scale with custom MDM policies, SSO, and a full audit log behind your firewall." },
  { ic:"spark",   t:"Pilots & evaluations", d:"A no-login workflow lets stakeholders evaluate the experience without platform overhead or IT setup." },
  { ic:"activity",t:"Revenue integrity", d:"Surface under- and over-documentation patterns before claims go out, backed by quoted evidence." },
  { ic:"workflow",t:"Education & onboarding", d:"New reviewers ramp faster reading the model's reasoning alongside the codes it recommends." },
];
function SolutionsPage({ go }){
  return React.createElement("div",null,
    React.createElement(PageHero,{
      eyebrow:"Solutions",
      title:"Built for every team touching outpatient coding",
      sub:"One explainable workflow, adapted to how your team reviews, bills, and audits." }),
    React.createElement("section",{ className:"section", style:{ paddingTop:24 } },
      React.createElement("div",{ className:"wrap" },
        React.createElement("div",{ className:"feat-grid" },
          SOLUTIONS.map((s,i)=>React.createElement(Tile,{ key:s.t, ic:s.ic, t:s.t, d:s.d, i })))
      )),
    React.createElement(CtaBand,{ go, to:"new", title:"See it on your workflow", sub:"Bring a representative note and we'll show the assessment, evidence trail, and audit output end to end.", label:"Start a review" })
  );
}

/* ============ SECURITY ============ */
const SECURITY = [
  { ic:"shield", t:"PHI handled transiently", d:"Demo notes are processed in-request and never stored. Production retention is configurable to your policy." },
  { ic:"layers", t:"Encryption in transit & at rest", d:"TLS 1.2+ everywhere and AES-256 at rest, with isolated tenant storage for production deployments." },
  { ic:"user",   t:"SSO & access controls", d:"SAML / OIDC single sign-on with role-based access so only the right reviewers see the right encounters." },
  { ic:"doc",    t:"Full audit logging", d:"Every analysis, override, and export is logged with actor and timestamp for compliance review." },
  { ic:"check",  t:"BAA available", d:"We sign Business Associate Agreements for covered entities and partners handling PHI." },
  { ic:"brain",  t:"Provider-isolated model layer", d:"The model sits behind a backend adapter — swap providers or self-host without exposing data paths." },
];
function SecurityPage({ go }){
  return React.createElement("div",null,
    React.createElement(PageHero,{
      eyebrow:"Security",
      title:"Compliance-minded from the first request",
      sub:"MedCode is designed for the realities of handling clinical documentation — transparent, auditable, and controllable.",
      ctas:[ React.createElement(Button,{ key:1, variant:"grad", onClick:()=>go("contact") }, "Talk to security") ] }),
    React.createElement("section",{ className:"section", style:{ paddingTop:24 } },
      React.createElement("div",{ className:"wrap" },
        React.createElement("div",{ className:"feat-grid" },
          SECURITY.map((s,i)=>React.createElement(Tile,{ key:s.t, ic:s.ic, t:s.t, d:s.d, i }))),
        React.createElement(Reveal,{ delay:120 },
          React.createElement("div",{ className:"sec-badges" },
            ["HIPAA-aligned","SOC 2 (in progress)","TLS 1.2+","AES-256","BAA ready","RBAC"].map(b=>
              React.createElement("span",{ key:b, className:"sec-badge" }, React.createElement(I.check,{ size:14 }), b))))
      )),
    React.createElement(CtaBand,{ go, to:"contact", title:"Need the security review packet?", sub:"We'll share architecture details, data-flow diagrams, and our BAA so your team can evaluate quickly.", label:"Request details" })
  );
}

/* ============ BLOG ============ */
const POSTS = [
  { cat:"Guides",     t:"How the 2021 E/M guidelines reshaped MDM scoring", d:"A practical walk through Problems, Data, and Risk — and how the two-of-three rule sets your final level.", min:"6 min read", tone:"purple" },
  { cat:"Product",    t:"Inside the evidence trail: why every code carries a quote", d:"Explainability isn't a feature bolt-on. Here's how MedCode links each recommendation back to the note.", min:"4 min read", tone:"green" },
  { cat:"Compliance", t:"Documenting prescription drug management without ambiguity", d:"Small wording changes that move an encounter from low to moderate risk — with examples.", min:"5 min read", tone:"blue" },
  { cat:"Engineering",t:"Designing a provider-flexible model layer", d:"How a backend adapter lets teams evolve model providers without rebuilding the review surface.", min:"7 min read", tone:"purple" },
  { cat:"Playbooks",  t:"Running a 30-day coding-automation pilot", d:"A step-by-step plan to evaluate explainable coding with real encounters and zero IT overhead.", min:"8 min read", tone:"green" },
  { cat:"Research",   t:"Measuring agreement between AI and senior coders", d:"What we look at when we say 94% accuracy — and the cases where humans still disagree.", min:"6 min read", tone:"blue" },
];
function BlogPage({ go }){
  return React.createElement("div",null,
    React.createElement(PageHero,{
      eyebrow:"Blog",
      title:"Notes on explainable coding",
      sub:"Guides, product updates, and field playbooks for teams modernizing outpatient coding review." }),
    React.createElement("section",{ className:"section", style:{ paddingTop:24 } },
      React.createElement("div",{ className:"wrap" },
        React.createElement("div",{ className:"blog-grid" },
          POSTS.map(function(p,i){
            return React.createElement(Reveal,{ key:p.t, delay:(i%3)*80 },
              React.createElement("article",{ className:"blog-card" },
                React.createElement("div",{ className:"blog-thumb" },
                  React.createElement("span",{ className:`blog-cat ${p.tone}` }, p.cat),
                  React.createElement("div",{ className:"blog-glyph" }, React.createElement(I.doc,{ size:30 }))
                ),
                React.createElement("div",{ className:"blog-body" },
                  React.createElement("h3",null, p.t),
                  React.createElement("p",null, p.d),
                  React.createElement("div",{ className:"blog-meta" },
                    React.createElement("span",null, p.min),
                    React.createElement("span",{ className:"blog-read" }, "Read", React.createElement(I.arrow,{ size:14 }))
                  )
                )
              )
            );
          })
        )
      )),
    React.createElement(CtaBand,{ go, to:"new", title:"Prefer to see it in action?", sub:"Skip the reading list and run a note through the analyzer yourself.", label:"Open the analyzer" })
  );
}

/* ============ CONTACT PAGE ============ */
function ContactPage({ go }){
  return React.createElement("div",null,
    React.createElement(PageHero,{
      eyebrow:"Contact",
      title:"Let's talk about your coding workflow",
      sub:"Pilots, security reviews, or pricing — tell us what you're evaluating and we'll route you to the right person." }),
    React.createElement("section",{ className:"section", style:{ paddingTop:8 } },
      React.createElement("div",{ className:"wrap" },
        React.createElement("div",{ className:"contact-info" },
          [["mail","Email","hello@medcode.io"],["clock","Response time","Within one business day"],["shield","Security","security@medcode.io"]].map(c=>
            React.createElement(Reveal,{ key:c[1], className:"contact-info-card" },
              React.createElement("span",{ className:"feat-ic", style:{ width:38, height:38, borderRadius:11, marginBottom:0 } }, React.createElement(I[c[0]],{ size:18 })),
              React.createElement("div",null,
                React.createElement("div",{ className:"ci-k" }, c[1]),
                React.createElement("div",{ className:"ci-v" }, c[2]))))
        )
      )),
    React.createElement(Contact,null)
  );
}

Object.assign(window, { ProductPage, SolutionsPage, SecurityPage, BlogPage, ContactPage });
