// CaseStudies.jsx — tabbed case-study explorer in the home-page industry-case style.
// One case per Acerti solution line. Longer body copy than the home teaser.

const CASE_STUDIES = [
  {
    tab: "Software Dev",
    line: "Software Development",
    tint: "#dde8f1",
    headline: "Accelerating time-to-market by 40% with nearshore agile teams",
    client: "SaaS · Healthcare Technology",
    model: "Managed Teams",
    context:
      "A fast-growing US healthcare SaaS provider needed to scale their platform rapidly to meet rising demand for telehealth features. Their internal engineering team was stretched thin, and hiring onshore US developers was proving too slow and too expensive.",
    challenge:
      "The client carried a three-month backlog of critical feature requests. A previous offshore attempt in India had failed on a 12-hour time-zone gap — blocked sprint cycles, misaligned requirements, and constant rework.",
    solution:
      "Acerti deployed a managed nearshore team of six senior full-stack engineers from Mexico and Colombia. Operating in CST, the team integrated fully into the client's daily stand-ups and CI/CD pipeline.",
    stack: ["React, Node.js, AWS", "AI-assisted dev via GitHub Copilot", "Agile Scrum, real-time collaboration"],
    stats: [
      { v: "40%", l: "Faster delivery cycle time" },
      { v: "Zero", l: "Time-zone delay on sprints" },
      { v: "$180K", l: "Saved annually per sprint team" },
    ],
    quote:
      "Acerti didn't just give us code; they gave us a highly integrated engineering partner. Having a team that works our hours and understands our agile culture changed everything.",
    author: "CTO, Healthcare SaaS Provider",
  },
  {
    tab: "eCommerce",
    line: "eCommerce",
    tint: "#f1e6d9",
    headline: "Boosting conversions by 25% with an AI-optimized Shopify platform",
    client: "D2C Retail · Outdoor Gear",
    model: "Project-Based",
    context:
      "A mid-sized US retail brand specializing in outdoor gear was seeing rapid traffic growth, but conversion rates stayed flat on an aging, monolithic storefront.",
    challenge:
      "The legacy platform was slow, lacked mobile optimization, and offered a rigid, impersonal experience. The client needed a full replatform to handle high-volume traffic spikes and deliver personalized shopping journeys.",
    solution:
      "Acerti's eCommerce specialists executed a full migration to a headless Shopify Plus architecture, layering in an AI personalization engine that dynamically surfaces products from live browsing behavior.",
    stack: ["Shopify Plus, headless React front-end", "AI-driven personalization engine", "Performance & Core Web Vitals tuning"],
    stats: [
      { v: "25%", l: "Lift in conversion rate" },
      { v: "50%", l: "Faster page load times" },
      { v: "30%", l: "Cost savings vs. US agency" },
    ],
    quote:
      "The nearshore team delivered a world-class Shopify experience faster than our local agency quoted, and the AI personalization has directly impacted our bottom line.",
    author: "VP of Digital, D2C Retail Brand",
  },
  {
    tab: "ERP",
    line: "ERP Solutions",
    tint: "#e3eee9",
    headline: "Streamlining global supply chains with SAP S/4HANA consulting",
    client: "Manufacturing · Automotive Parts",
    model: "Staff Augmentation + Managed Teams",
    context:
      "A North American automotive-parts manufacturer with global distribution needed to migrate from legacy SAP ECC to S/4HANA to unify supply-chain and financial data in real time.",
    challenge:
      "The client had no internal S/4HANA expertise, and engaging a Big 4 US firm was prohibitively expensive — threatening the project's ROI before it began.",
    solution:
      "Acerti provided a blended team of Tier-1 LATAM SAP consultants — architect, senior consultants, and analysts — selected through our AI-driven vetting process and integrated directly with the client's IT leadership.",
    stack: ["SAP S/4HANA (Finance, SCM, MM)", "Fiori UI", "Time-zone-aligned staff augmentation"],
    stats: [
      { v: "100%", l: "On-time go-live" },
      { v: "$250K+", l: "Consulting cost savings" },
      { v: "Real-time", l: "Inventory & financial visibility" },
    ],
    quote:
      "Acerti's SAP architects brought Big 4 expertise at nearshore rates. Having them in our time zone meant issues were resolved immediately during critical migration phases.",
    author: "CIO, Automotive Manufacturing",
  },
  {
    tab: "CRM",
    line: "CRM",
    tint: "#ece6f1",
    headline: "Shortening sales cycles by 25% with Salesforce optimization",
    client: "Financial Services · Fintech",
    model: "Project-Based",
    context:
      "A rapidly scaling B2B fintech lender needed to optimize sales operations. Reps were bogged down by manual data entry and customer data fragmented across disparate systems.",
    challenge:
      "The existing CRM was out-of-the-box and uncustomized. Leads fell through the cracks, reporting was inaccurate, and pipeline forecasting was nearly impossible.",
    solution:
      "Acerti's certified CRM specialists executed an end-to-end Salesforce Sales Cloud optimization — automated workflows, AI-driven lead scoring, and customized pipeline dashboards.",
    stack: ["Salesforce Sales Cloud", "Custom Lightning development", "AI lead scoring + automation"],
    stats: [
      { v: "25%", l: "Shorter sales cycle" },
      { v: "30%", l: "Higher lead conversion" },
      { v: "100%", l: "Pipeline visibility" },
    ],
    quote:
      "Our sales team actually uses the CRM now. The automation Acerti built eliminated hours of admin work, letting our reps focus entirely on closing deals.",
    author: "VP of Sales, Fintech Lender",
  },
  {
    tab: "Call Center",
    line: "Call Center",
    tint: "#dde8f1",
    headline: "Resolving 80% of support calls autonomously with AI voice agents",
    client: "Logistics & Shipping",
    model: "Managed Services",
    context:
      "A regional logistics company struggled to manage high call volumes for package tracking and delivery scheduling — especially during peak holiday seasons and outside business hours.",
    challenge:
      "A 24/7 human call center was destroying margins, yet long hold times were severely damaging customer satisfaction.",
    solution:
      "Acerti deployed a custom AI voice agent as the primary Tier-1 line, handling routine tracking and scheduling and seamlessly escalating complex issues to a specialized human team in LATAM.",
    stack: ["Dialogflow CX + AWS Lex", "Live tracking-database integration", "LATAM human escalation pod"],
    stats: [
      { v: "80%", l: "First-call resolution by AI" },
      { v: "Zero", l: "Hold times, 24/7 coverage" },
      { v: "90%", l: "Staffing cost reduction" },
    ],
    quote:
      "Implementing Acerti's AI voice agents solved our volume crisis overnight. Customers get instant answers 24/7, and our operating costs have plummeted.",
    author: "Director of Customer Experience, Logistics Co.",
  },
  {
    tab: "IT Operations",
    line: "IT Operations",
    tint: "#f1e6d9",
    headline: "Cutting IT support costs by 70% via AI help-desk automation",
    client: "Enterprise Technology · 2,000 employees",
    model: "Managed Services",
    context:
      "A 2,000-employee enterprise was overwhelmed by routine internal IT requests — password resets, software access, VPN issues — pulling expensive staff away from strategic infrastructure work.",
    challenge:
      "The internal help desk was slow to respond, causing employee frustration and lost productivity. They needed to scale Tier-1 and Tier-2 support without adding headcount.",
    solution:
      "Acerti implemented an AI-first IT help desk — chatbots and voice agents wired into Active Directory and the ticketing system — backed by a nearshore infrastructure team for complex escalations and proactive monitoring.",
    stack: ["AI chatbots + voice agents", "Active Directory & ticketing integration", "Nearshore infra escalation team"],
    stats: [
      { v: "80%", l: "Tickets auto-resolved" },
      { v: "70%", l: "Help-desk cost savings" },
      { v: "Instant", l: "Tier-1 response time" },
    ],
    quote:
      "Our internal IT team is finally focused on security and infrastructure instead of resetting passwords all day. Acerti's AI help desk is a game-changer.",
    author: "IT Director, Enterprise Tech",
  },
  {
    tab: "BPO",
    line: "BPO",
    tint: "#e3eee9",
    headline: "Transforming back-office efficiency with RPA and nearshore talent",
    client: "Healthcare Administration",
    model: "Managed Teams",
    context:
      "A regional healthcare network was drowning in manual data entry, claims processing, and compliance reporting. The administrative burden was driving up costs and delaying billing.",
    challenge:
      "Highly paid onshore admin staff spent 60% of their time on repetitive data transfer between legacy systems — high error rates and mounting burnout.",
    solution:
      "Acerti modernized back-office operations with an AI-assisted nearshore BPO model: RPA for repetitive data transfer, plus a dedicated LATAM team managing exceptions, complex billing, and compliance in CST.",
    stack: ["Robotic Process Automation (RPA)", "Dedicated LATAM back-office team", "Compliance & exception handling"],
    stats: [
      { v: "40%", l: "Fewer manual errors" },
      { v: "35%", l: "Faster processing time" },
      { v: "60%", l: "Labor cost savings" },
    ],
    quote:
      "Acerti didn't just outsource our mess; they fixed our processes first using automation, then provided a brilliant nearshore team to run it flawlessly.",
    author: "CFO, Healthcare Network",
  },
  {
    tab: "IoT",
    line: "IoT",
    tint: "#ece6f1",
    headline: "Predictive maintenance saves $500K annually via IoT analytics",
    client: "Industrial Manufacturing",
    model: "Project-Based",
    context:
      "A heavy-equipment manufacturer suffered unpredictable machine failures on the factory floor. Reactive maintenance caused massive production delays and millions in lost output.",
    challenge:
      "They needed a smart-factory solution to monitor equipment health in real time, but lacked the specialized IoT cloud architecture and data-science skills in-house.",
    solution:
      "Acerti's IoT team built a custom predictive-analytics platform — sensor integration on AWS IoT Core with AI anomaly-detection models, surfaced through a real-time dashboard that flags failures weeks ahead.",
    stack: ["AWS IoT Core + sensor integration", "AI anomaly-detection models", "Real-time floor-manager dashboard"],
    stats: [
      { v: "$500K", l: "Saved annually" },
      { v: "85%", l: "Fewer unplanned outages" },
      { v: "25%", l: "Faster dev time via AI" },
    ],
    quote:
      "Acerti's IoT solution moved us from reacting to disasters to preventing them entirely. The ROI on this project was realized in less than six months.",
    author: "VP of Operations, Industrial Manufacturer",
  },
];

const CaseStudiesExplorer = () => {
  const [active, setActive] = React.useState(0);
  const cur = CASE_STUDIES[active];
  return (
    <section className="container section" style={{ paddingTop: 8 }}>
      <div className="section-header reveal" style={{ marginBottom: 28 }}>
        <div className="eyebrow"><span className="mark" />BY SOLUTION</div>
        <h3 className="display-md">Eight engagements. Eight solutions. One operating model.</h3>
        <p>Pick a solution to see the full story — context, challenge, what we built, and the outcomes that followed.</p>
      </div>

      <div className="industry-tabs reveal" data-d="1">
        {CASE_STUDIES.map((c, i) => (
          <button
            key={c.tab}
            className={"industry-tab" + (i === active ? " is-active" : "")}
            onClick={() => setActive(i)}
            aria-pressed={i === active}
          >
            {c.tab}
          </button>
        ))}
      </div>

      <div key={cur.tab} className="industry-case cs-case reveal in" data-d="2" style={{ background: cur.tint }}>
        <div className="industry-case-head">
          <div className="industry-kicker">{cur.line.toUpperCase()} &middot; CASE STUDY</div>
          <div className="industry-client">{cur.client}</div>
        </div>

        <h4 className="cs-headline">{cur.headline}</h4>
        <div className="cs-model">{cur.model}</div>

        <div className="industry-case-body cs-body">
          <div className="industry-block">
            <div className="industry-label">Context</div>
            <p>{cur.context}</p>
          </div>
          <div className="industry-block">
            <div className="industry-label">Challenge</div>
            <p>{cur.challenge}</p>
          </div>
          <div className="industry-block cs-solution">
            <div className="industry-label">Acerti's solution</div>
            <p>{cur.solution}</p>
            <ul className="cs-stack">
              {cur.stack.map((s) => <li key={s}>{s}</li>)}
            </ul>
          </div>
          <div className="industry-block">
            <div className="industry-label">Outcomes</div>
            <div className="industry-stats">
              {cur.stats.map((s) => (
                <div key={s.l} className="industry-stat">
                  <div className="val">{s.v}</div>
                  <div className="lbl">{s.l}</div>
                </div>
              ))}
            </div>
          </div>
        </div>

        <figure className="cs-quote">
          <blockquote>{cur.quote}</blockquote>
          <figcaption>{cur.author}</figcaption>
        </figure>
      </div>
    </section>
  );
};

Object.assign(window, { CaseStudiesExplorer });
