'use client'

import * as React from 'react'
import { ArrowRight, Activity, Brain, Heart, Shield, Bug, Beaker, Microscope } from 'lucide-react'
import { useRouter } from '@/lib/router'
import { PageShell, PageHero, Section, SectionHeading, Reveal, Eyebrow, Card, DefRow, LabeledDivider, LinkButton, Pill } from '@/components/site/ui'

interface TherapyArea {
  code: string
  icon: typeof Activity
  name: string
  overview: string
  challenges: string[]
  approaches: string[]
  innovations: string[]
}

const AREAS: TherapyArea[] = [
  {
    code: '01',
    icon: Beaker,
    name: 'Oncology',
    overview:
      'Cancer encompasses more than 200 distinct diseases characterized by uncontrolled cell proliferation, local tissue invasion and metastasis. Molecular profiling has transformed oncology from an organ-based taxonomy to a biology-based one — non-small-cell lung cancer, for example, is now subdivided by driver alterations such as EGFR, ALK, ROS1, BRAF, KRAS G12C, NTRK and MET exon 14. The World Health Organization reports cancer as a leading cause of mortality globally, with incidence rising as populations age.',
    challenges: [
      'Tumor heterogeneity and clonal evolution drive resistance to targeted therapies.',
      'The blood–brain barrier limits delivery of many systemic agents to brain metastases.',
      'Immune checkpoint inhibitors benefit only a subset of patients; predictive biomarkers remain imperfect.',
      'Late-stage presentation in many health systems reduces treatment options and survival.',
    ],
    approaches: [
      'Targeted small molecules (kinase inhibitors) selected by molecular biomarker.',
      'Antibody–drug conjugates (ADCs) delivering cytotoxic payload to tumor-specific antigens.',
      'Immune checkpoint inhibitors (anti-PD-1, anti-PD-L1, anti-CTLA-4) and bispecific T-cell engagers.',
      'Combination regimens designed to overcome adaptive resistance pathways.',
    ],
    innovations: [
      'Patient-derived organoid models for ex vivo drug response prediction.',
      'Circulating tumor DNA (ctDNA) for minimal residual disease detection and treatment monitoring.',
      'Radioligand therapy pairing tumor-targeting ligands with therapeutic radioisotopes.',
    ],
  },
  {
    code: '02',
    icon: Brain,
    name: 'Neurology',
    overview:
      'Neurological disorders span neurodegenerative disease (Alzheimer\'s, Parkinson\'s, ALS), cerebrovascular disease, epilepsy, multiple sclerosis and neuromuscular conditions. The WHO estimates that neurological disorders affect more than one billion people worldwide. Central nervous system drug development is uniquely challenging: the brain is anatomically protected, biologically complex and functionally heterogeneous.',
    challenges: [
      'The blood–brain barrier excludes ~98% of small molecules and nearly all biologics.',
      'Neurodegenerative diseases progress over decades, complicating clinical trial design.',
      'Heterogeneous pathology (e.g., amyloid vs. tau in Alzheimer\'s) limits universal treatment strategies.',
      'Outcome measures in CNS trials are subjective and slow to change.',
    ],
    approaches: [
      'Small molecules engineered for blood–brain barrier penetration (low P-gp efflux, optimal lipophilicity).',
      'Monoclonal antibodies targeting aggregated proteins (anti-amyloid, anti-tau, anti-alpha-synuclein).',
      'Gene therapy for monogenic CNS disorders (e.g., spinal muscular atrophy).',
      'Symptomatic therapies (dopaminergic agents, antiepileptics, immunomodulators for MS).',
    ],
    innovations: [
      'Focused ultrasound for transient blood–brain barrier opening and targeted drug delivery.',
      'Digital biomarkers (smartphone gait, voice, keystroke dynamics) for remote disease monitoring.',
      'Antisense oligonucleotides (ASOs) for allele-specific silencing in inherited CNS disease.',
    ],
  },
  {
    code: '03',
    icon: Microscope,
    name: 'Rare diseases',
    overview:
      'A rare disease is defined in the United States as a condition affecting fewer than 200,000 people, and in the European Union as one affecting fewer than 1 in 2,000. There are an estimated 6,000–8,000 rare diseases, the large majority genetic in origin, and only a small fraction have an approved therapy. Orphan drug legislation in the US (1983), EU (2000), Japan and other markets has incentivized rare disease drug development.',
    challenges: [
      'Small, geographically dispersed patient populations complicate recruitment for clinical trials.',
      'Limited natural history data make endpoint selection and trial design difficult.',
      'Many rare diseases are pediatric, requiring age-appropriate formulations and ethical trial design.',
      'High per-patient development costs require sustainable reimbursement models.',
    ],
    approaches: [
      'Enzyme replacement therapy for lysosomal storage disorders.',
      'Gene therapy (AAV-delivered) for monogenic conditions such as spinal muscular atrophy and inherited retinal dystrophy.',
      'mRNA and exon-skipping therapies for Duchenne muscular dystrophy.',
      'Patient registries and natural history studies that support regulatory submission.',
    ],
    innovations: [
      'Platform trial designs that test multiple therapies within a single disease framework.',
      'Gene editing (CRISPR-Cas) for one-time correction of monogenic disease.',
      'Digital twin models informed by registry data to simulate counterfactual control arms.',
    ],
  },
  {
    code: '04',
    icon: Shield,
    name: 'Autoimmune disorders',
    overview:
      'Autoimmune diseases — including rheumatoid arthritis, systemic lupus erythematosus, inflammatory bowel disease, psoriasis and multiple sclerosis — arise when the immune system targets self-tissues. They affect an estimated 5–8% of the global population and are a leading cause of chronic disability. Treatment has been transformed over the past two decades by biologic therapy.',
    challenges: [
      'Heterogeneous disease mechanisms within a single diagnosis (e.g., seropositive vs. seronegative RA).',
      'Loss of response to biologics over time, often due to anti-drug antibodies.',
      'Immunosuppression increases risk of infection and malignancy.',
      'Limited biomarkers to predict individual treatment response.',
    ],
    approaches: [
      'Biologic inhibitors of TNF-α, IL-6, IL-17, IL-23 and JAK/STAT pathways.',
      'B-cell depleting therapies (anti-CD20) for autoimmune and neurological indications.',
      'Targeted synthetic small molecules (JAK inhibitors, S1P modulators, PDE4 inhibitors).',
      'Combination and sequential biologic strategies for refractory disease.',
    ],
    innovations: [
      'Low-immunogenicity biologics engineered to reduce anti-drug antibody formation.',
      'Tissue-targeted biologics that deliver immunomodulation where it is needed.',
      'Regulatory T-cell (Treg) expansion therapies to restore immune tolerance.',
    ],
  },
  {
    code: '05',
    icon: Heart,
    name: 'Cardiovascular medicine',
    overview:
      'Cardiovascular disease is the leading cause of death globally, accounting for an estimated 17 million deaths per year (WHO). Major disease categories include coronary artery disease, heart failure, arrhythmia, hypertension and thromboembolic disease. Recent therapeutic advances — including PCSK9 inhibitors, SGLT2 inhibitors, GLP-1 receptor agonists and factor Xa inhibitors — have substantially expanded treatment options.',
    challenges: [
      'Cardiovascular outcomes trials are large, long and expensive.',
      'Polypharmacy and drug–drug interactions complicate chronic disease management.',
      'Residual cardiovascular risk persists despite optimal standard of care.',
      'Health-equity gaps in access to novel therapeutics.',
    ],
    approaches: [
      'Lipid-lowering therapies (statins, ezetimibe, PCSK9 inhibitors, inclisiran).',
      'Antithrombotic agents (factor Xa inhibitors, direct thrombin inhibitors, P2Y12 antagonists).',
      'Heart failure therapies (ARNI, SGLT2 inhibitors, mineralocorticoid antagonists).',
      'Antihypertensives across multiple mechanistic classes (ACEi, ARB, CCB, beta-blocker, diuretic).',
    ],
    innovations: [
      'Gene silencing (siRNA, antisense) for durable lipid-lowering and metabolic control.',
      'Cardiac-specific gene therapy for inherited cardiomyopathy.',
      'Wearable sensors and digital biomarkers for arrhythmia detection and heart failure monitoring.',
    ],
  },
  {
    code: '06',
    icon: Activity,
    name: 'Endocrinology',
    overview:
      'Endocrine disorders — including diabetes mellitus, thyroid disease, adrenal insufficiency and growth disorders — affect hundreds of millions of people worldwide. Type 2 diabetes alone affects more than 400 million adults globally (WHO). The past decade has seen transformative therapeutic advances, particularly in incretin biology, that have reshaped management of diabetes and obesity.',
    challenges: [
      'Type 2 diabetes is progressive, requiring escalating therapy over time.',
      'Chronic complications (microvascular, macrovascular) drive long-term morbidity.',
      'Adherence to injectable therapy is often suboptimal.',
      'Obesity is a chronic, relapsing disease with limited long-term pharmacotherapy options historically.',
    ],
    approaches: [
      'GLP-1 receptor agonists and dual/tri-agonist incretin therapies for diabetes and obesity.',
      'Insulin analogs (rapid-acting, long-acting, premixed) and concentrated formulations.',
      'SGLT2 inhibitors providing glucose-lowering with cardio-renal benefit.',
      'Hormone replacement therapies for thyroid, adrenal and growth disorders.',
    ],
    innovations: [
      'Once-weekly and oral incretin formulations improving adherence.',
      'Continuous glucose monitoring integrated with automated insulin delivery (AID) systems.',
      'Islet cell replacement and stem-cell-derived beta-cell therapy for type 1 diabetes.',
    ],
  },
  {
    code: '07',
    icon: Bug,
    name: 'Infectious diseases',
    overview:
      'Infectious diseases remain a leading cause of morbidity and mortality globally, particularly in low- and middle-income countries. The emergence of antimicrobial resistance (AMR) is recognized by the WHO as one of the top ten global public health threats. Vaccines, antivirals, antibacterials and antifungals are central to the infectious disease armamentarium.',
    challenges: [
      'Antimicrobial resistance outpaces the development of new agents.',
      'Pandemic-prone pathogens require rapid, platform-based response capability.',
      'Limited economic incentives for narrow-spectrum antibiotics.',
      'Access to antimicrobials is uneven globally, contributing to both under-treatment and misuse.',
    ],
    approaches: [
      'Direct-acting antivirals for HIV, hepatitis B/C, influenza, SARS-CoV-2 and respiratory viruses.',
      'Antibacterial agents targeting novel mechanisms (e.g., beta-lactamase inhibitors, novel ribosome binders).',
      'Vaccines across platforms (mRNA, viral vector, recombinant protein, conjugate, inactivated).',
      'Antifungal agents for invasive candidiasis, aspergillosis and mucormycosis.',
    ],
    innovations: [
      'mRNA vaccine platforms enabling rapid response to emerging pathogens.',
      'Phage therapy and anti-virulence strategies for multidrug-resistant infection.',
      'Long-acting injectable antivirals for HIV pre-exposure prophylaxis (PrEP) and treatment.',
    ],
  },
]

export function SpecialtyPage() {
  const { navigate } = useRouter()
  return (
    <PageShell>
      <PageHero
        index="01"
        eyebrow="Specialty medicines"
        title="Focused expertise."
        highlight="Broader impact."
        lead="Espandiar&apos;s specialty medicine portfolio targets therapeutic areas with significant unmet need, where advances in molecular biology, immunology and formulation science can meaningfully improve outcomes. The information below is intended for general scientific and corporate communication, not for prescribing decisions."
      />

      {/* Disclaimer & framework */}
      <Section tone="light">
        <SectionHeading
          index="02"
          eyebrow="Therapeutic framework"
          title="Disease-driven,"
          highlight="evidence-led."
          lead="Each therapeutic area below is described in terms of disease overview, treatment challenges, pharmaceutical approaches and future innovations. We describe mechanisms and established science, not treatment recommendations. Treatment decisions must be made by qualified healthcare professionals based on individual patient circumstances and current prescribing information."
        />
        <Reveal className="mt-10">
          <Card className="border-l-4 border-l-[#0d5d50] dark:border-l-[#8fb9ad]">
            <Eyebrow>Important note</Eyebrow>
            <p className="mt-4 text-sm leading-6 text-muted-foreground">
              The therapeutic area summaries on this page describe disease
              biology and pharmaceutical science as recognized by the WHO, FDA,
              EMA and peer-reviewed literature. They are not treatment
              recommendations and do not constitute medical advice. Patients
              should consult a qualified healthcare professional for diagnosis
              and treatment. Espandiar does not make unsupported efficacy
              claims for any product.
            </p>
          </Card>
        </Reveal>
      </Section>

      {/* Therapy area sections */}
      {AREAS.map((area, idx) => {
        const Icon = area.icon
        const tone = idx % 2 === 0 ? 'light' : 'pearl'
        return (
          <Section key={area.code} tone={tone}>
            <div className="grid gap-12 lg:grid-cols-[0.5fr_1.5fr]">
              {/* Sticky icon + name */}
              <Reveal>
                <div className="lg:sticky lg:top-32">
                  <div className="flex items-center gap-4">
                    <div className="grid h-16 w-16 place-items-center rounded-3xl bg-[#0d5d50]/10 text-[#0d5d50] dark:bg-[#8fb9ad]/10 dark:text-[#8fb9ad]">
                      <Icon className="h-7 w-7" />
                    </div>
                    <span className="text-5xl font-light text-[#87a69d] dark:text-[#5d7770]">
                      {area.code}
                    </span>
                  </div>
                  <h2 className="mt-6 text-4xl font-semibold tracking-[-0.04em] sm:text-5xl">
                    {area.name}
                  </h2>
                  <Pill tone="emerald" className="mt-5">Therapeutic area</Pill>
                </div>
              </Reveal>

              {/* Content */}
              <Reveal delay={0.1}>
                <div>
                  <Eyebrow>Disease overview</Eyebrow>
                  <p className="mt-4 text-[15px] leading-7 text-muted-foreground">
                    {area.overview}
                  </p>

                  <LabeledDivider label="Treatment challenges" className="mt-10" />
                  <ul className="mt-6 space-y-3">
                    {area.challenges.map((c) => (
                      <li key={c} className="flex gap-3 text-sm leading-6 text-muted-foreground">
                        <span className="mt-2 h-1.5 w-1.5 shrink-0 rounded-full bg-[#0d5d50] dark:bg-[#8fb9ad]" />
                        {c}
                      </li>
                    ))}
                  </ul>

                  <LabeledDivider label="Pharmaceutical approaches" className="mt-10" />
                  <ul className="mt-6 space-y-3">
                    {area.approaches.map((a) => (
                      <li key={a} className="flex gap-3 text-sm leading-6 text-muted-foreground">
                        <span className="mt-2 h-1.5 w-1.5 shrink-0 rounded-full bg-[#0d5d50] dark:bg-[#8fb9ad]" />
                        {a}
                      </li>
                    ))}
                  </ul>

                  <LabeledDivider label="Future innovations" className="mt-10" />
                  <div className="mt-6 grid gap-4 sm:grid-cols-3">
                    {area.innovations.map((inn, i) => (
                      <div key={inn} className="rounded-2xl border border-border bg-card p-5">
                        <span className="text-xs font-bold text-[#0d5d50] dark:text-[#8fb9ad]">
                          0{i + 1}
                        </span>
                        <p className="mt-3 text-sm leading-6 text-muted-foreground">
                          {inn}
                        </p>
                      </div>
                    ))}
                  </div>
                </div>
              </Reveal>
            </div>
          </Section>
        )
      })}

      {/* CTA */}
      <Section tone="dark">
        <div className="grid gap-8 lg:grid-cols-[1.2fr_0.8fr] lg:items-center">
          <Reveal>
            <Eyebrow tone="sage">Working together</Eyebrow>
            <h2 className="mt-5 text-3xl font-semibold tracking-[-0.04em] sm:text-5xl">
              Science moves faster in partnership.
            </h2>
            <p className="mt-5 max-w-xl text-sm leading-6 text-white/70">
              Espandiar collaborates with academic medical centers, biotech
              partners, patient advocacy groups and regulators to advance
              therapeutic development. If your organization is working in an
              area of shared interest, we welcome scientific dialogue.
            </p>
          </Reveal>
          <Reveal delay={0.1} className="flex flex-wrap gap-3 lg:justify-end">
            <LinkButton variant="light" onClick={() => navigate('contact')}>
              Scientific collaborations
              <ArrowRight className="h-4 w-4" />
            </LinkButton>
            <LinkButton variant="outline" className="text-white" onClick={() => navigate('research')}>
              Our R&D
              <ArrowRight className="h-4 w-4" />
            </LinkButton>
          </Reveal>
        </div>
      </Section>
    </PageShell>
  )
}
