#!/usr/bin/env python3
"""Static site builder for the Ruth-Anne Pai hackathon portfolio.
Assembles each page from shared header/nav/footer + a page-specific body.
Run:  python build.py   ->  writes *.html into site/
"""
import os

SITE_TITLE = "Ruth-Anne Pai, PhD"
GH_USER = "https://github.com/ruthannepai-tech"
GH_ARCHITECT = "https://github.com/ruthannepai-tech/therapeutic-program-architect"
CONTACT_EMAIL = "advising@ruthannepai.com"
WEBSITE = "https://ruthannepai.com"
LINKEDIN = "https://www.linkedin.com/in/ruth-anne-pai/"
HACKATHON = "https://cerebralvalley.ai/e/built-with-claude-life-sciences"

# Personal monogram mark — "RP" in a rounded square, accent teal
LOGO_SVG = """<svg class="mark" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<rect x="2" y="2" width="60" height="60" rx="15" fill="none" stroke="#2bb6c0" stroke-width="3.5"/>
<text x="32" y="43" text-anchor="middle" font-family="Inter, sans-serif" font-weight="800" font-size="30" fill="#eaf1f5" letter-spacing="-1">RP</text>
<circle cx="52" cy="14" r="4" fill="#f0806a"/>
</svg>"""

NAV = [
    ("index.html", "Home"),
    ("software.html", "Software"),
    ("specialist.html", "Specialist Agent"),
    ("manuscripts.html", "Manuscripts"),
    ("biotech.html", "Project Tolera"),
    ("about.html", "About"),
]

def header(active):
    parts = []
    for href, label in NAV:
        cls = ' class="active"' if href == active else ''
        parts.append(f'<a href="{href}"{cls}>{label}</a>')
    links = "".join(parts)
    return f"""<header class="site">
  <div class="wrap nav">
    <a class="brand" href="index.html">{LOGO_SVG}<span>Ruth-Anne&nbsp;Pai<span style="color:#2bb6c0">, PhD</span></span></a>
    <button class="nav-toggle" aria-label="Menu" onclick="document.getElementById('nav').classList.toggle('open')">&#9776;</button>
    <nav class="navlinks" id="nav">{links}</nav>
  </div>
</header>"""

def footer():
    return f"""<footer class="site">
  <div class="wrap foot-grid">
    <div>
      <div class="brand-f">{LOGO_SVG}<span>Ruth-Anne Pai, PhD</span></div>
      <p class="small">Immunologist, protein designer, and person living with eosinophilic esophagitis. Building open, patient-first therapeutic science &mdash; from target discovery to a fundable development plan.</p>
      <p class="small">Work developed during the <a href="{HACKATHON}" target="_blank" rel="noopener">Built with Claude: Life Sciences Hackathon</a>, 2026.</p>
    </div>
    <div>
      <h4>Explore</h4>
      <ul>
        <li><a href="software.html">Software &amp; repositories</a></li>
        <li><a href="specialist.html">Therapeutic Program Architect</a></li>
        <li><a href="manuscripts.html">Manuscripts</a></li>
        <li><a href="biotech.html">Project Tolera</a></li>
      </ul>
    </div>
    <div>
      <h4>Contact</h4>
      <ul>
        <li><a href="mailto:{CONTACT_EMAIL}">{CONTACT_EMAIL}</a></li>
        <li><a href="{WEBSITE}" target="_blank" rel="noopener">ruthannepai.com</a></li>
        <li><a href="{LINKEDIN}" target="_blank" rel="noopener">LinkedIn</a></li>
        <li><a href="{GH_USER}" target="_blank" rel="noopener">GitHub</a></li>
      </ul>
    </div>
  </div>
  <div class="wrap foot-bottom">
    &copy; 2026 Ruth-Anne Pai. Research and informational content &mdash; not medical advice, and not an offer to invest. Forward-looking scientific, regulatory, and commercial statements are development hypotheses, not established results.
  </div>
</footer>"""

def page(filename, title, body, active=None, description=""):
    active = active or filename
    html = f"""<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{title} &middot; {SITE_TITLE}</title>
<meta name="description" content="{description}">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/style.css">
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect x='4' y='4' width='56' height='56' rx='14' fill='%230a1722' stroke='%232bb6c0' stroke-width='4'/%3E%3Ctext x='32' y='43' text-anchor='middle' font-family='sans-serif' font-weight='800' font-size='30' fill='%23eaf1f5'%3ERP%3C/text%3E%3C/svg%3E">
</head>
<body>
<a class="skip-link" href="#main">Skip to content</a>
{header(active)}
<main id="main">
{body}
</main>
{footer()}
</body>
</html>"""
    with open(os.path.join(os.path.dirname(__file__), filename), "w") as f:
        f.write(html)
    return filename
