// Courageous Path Counseling, site sections, composed from the design system.
(function () {
  const DS = window.CourageousPathDesignSystem_747028;
  const LOGO = 'assets/logo-full-transparent.png';
  const PORTRAIT = 'assets/img-3581-large.jpeg';

  // Responsive spacing helpers. Sections set their padding inline, so the
  // simplest way to make them fluid is to compute clamp() strings here:
  // PX = side padding (shrinks on phones), PY(max) = block padding.
  const PX = 'clamp(20px, 5vw, 32px)';
  const PY = (max) => `clamp(${Math.round(max * 0.6)}px, 9vw, ${max}px)`;
  // Vertical-only padding for two/three-value shorthands: `${PY(top)} ${PX} ${PY(bot)}`.

  // Shared responsive CSS injected once into <head>. Because every page mounts
  // these shared components, this is the single source of truth for the site's
  // responsive grid collapses and header behavior (kept here so all four HTML
  // pages stay in sync instead of each maintaining its own media queries).
  (function injectGlobalCSS() {
    if (typeof document === 'undefined' || document.getElementById('cp-global-css')) return;
    const el = document.createElement('style');
    el.id = 'cp-global-css';
    el.textContent = [
      '.cp-book-short{display:none}',
      // Header: swap full nav for the burger menu on tablet/mobile.
      '@media (max-width:1000px){',
      '.cp-nav{display:none !important}',
      '.cp-portal-link{display:none !important}',
      '.cp-burger{display:inline-flex !important}}',
      '@media (min-width:1001px){.cp-menu{display:none !important}}',
      // Collapse all two/three-column section grids to a single column.
      '@media (max-width:880px){',
      '.cp-hero{grid-template-columns:1fr !important;gap:40px !important}',
      '.cp-about{grid-template-columns:1fr !important;gap:40px !important}',
      '.cp-contact{grid-template-columns:1fr !important;gap:40px !important}',
      '.cp-services{grid-template-columns:1fr !important}',
      '.cp-reassure{grid-template-columns:1fr !important;gap:28px !important}',
      '.cp-svc-split{grid-template-columns:1fr !important}',
      '.cp-svc-left{grid-template-columns:1fr !important}',
      '.cp-svc-right{grid-template-rows:auto !important}',
      '.cp-about-row{flex-direction:column;text-align:center;gap:28px !important}',
      '.cp-about-logo{height:180px !important;width:180px !important}',
      '.cp-proc-h{display:none !important}.cp-proc-v{display:flex !important}}',
      // Tablet: ease the reassurance strip to two columns before stacking.
      '@media (min-width:721px) and (max-width:880px){.cp-reassure{grid-template-columns:1fr 1fr !important}}',
      // PSYPACT coverage: let the geographic tile map keep shrinking, then swap to a
      // compact grid only once the tiles get too small to read (≤430px).
      '@media (max-width:430px){.cp-map-geo{display:none !important}.cp-map-grid{display:grid !important}}',
      // Compact the header on very small screens.
      '@media (max-width:470px){',
      '.cp-book-full{display:none}.cp-book-short{display:inline-flex}',
      '.cp-headbar{padding-left:16px !important;padding-right:16px !important}}'
    ].join('');
    document.head.appendChild(el);
  })();

  // ---- Thin, rounded line icons (Lucide-style, 2px stroke) -----------------
  const Ic = ({ d, size = 26, fill }) =>
  <svg width={size} height={size} viewBox="0 0 24 24" fill={fill || 'none'}
  stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round">
      {d}
    </svg>;

  const Icons = {
    heart: <Ic d={<path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.29 1.51 4.04 3 5.5l7 7Z" />} />,
    sprout: <Ic d={<g><path d="M7 20h10" /><path d="M12 20c0-6 0-8 0-10" /><path d="M12 10C12 7 9.5 5 6 5c0 3.5 2.5 5.5 6 5Z" /><path d="M12 12c0-2.5 2-4.5 5-4.5 0 3-2 4.5-5 4.5Z" /></g>} />,
    moon: <Ic d={<path d="M12 3a6.5 6.5 0 1 0 9 9 9 9 0 1 1-9-9Z" />} />,
    users: <Ic d={<g><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" /><circle cx="9" cy="7" r="4" /><path d="M22 21v-2a4 4 0 0 0-3-3.87" /><path d="M16 3.13a4 4 0 0 1 0 7.75" /></g>} />,
    clipboard: <Ic d={<g><rect x="8" y="3" width="8" height="4" rx="1.5" /><path d="M9 5H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-3" /><path d="m9 14 2 2 4-4" /></g>} />,
    sparkle: <Ic d={<path d="M12 3l1.6 5.3L19 10l-5.4 1.7L12 17l-1.6-5.3L5 10l5.4-1.7L12 3Z" />} />,
    baby: <Ic d={<g><path d="M9 12h.01" /><path d="M15 12h.01" /><path d="M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5" /><path d="M19 6.3a9 9 0 0 1 1.8 3.9 2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5S14.6 8 13.5 8c-.8 0-1.5-.4-1.5-1" /></g>} />,
    woman: <img src="assets/woman-profile.png" alt="" style={{ height: 34, width: 'auto', objectFit: 'contain' }} />,
    mail: <Ic d={<g><rect x="2" y="4" width="20" height="16" rx="3" /><path d="m3 7 9 6 9-6" /></g>} size={20} />,
    phone: <Ic d={<path d="M5 3h3l2 5-2.5 1.5a11 11 0 0 0 5 5L19 17l2 5v0a2 2 0 0 1-2 2A16 16 0 0 1 3 8a2 2 0 0 1 2-5Z" />} size={20} />,
    pin: <Ic d={<g><path d="M20 10c0 5-8 12-8 12s-8-7-8-12a8 8 0 0 1 16 0Z" /><circle cx="12" cy="10" r="3" /></g>} size={20} />,
    arrow: <Ic d={<g><path d="M5 12h14" /><path d="m13 6 6 6-6 6" /></g>} size={18} />,
    clock: <Ic d={<g><circle cx="12" cy="12" r="9" /><path d="M12 7v5l3 2" /></g>} size={20} />,
    mic: <Ic d={<g><rect x="9" y="3" width="6" height="11" rx="3" /><path d="M5 11a7 7 0 0 0 14 0" /><path d="M12 18v3" /><path d="M9 21h6" /></g>} />,
    check: <Ic d={<path d="m4 12 5 5L20 6" />} size={16} />,
    copy: <Ic d={<g><rect x="9" y="9" width="11" height="11" rx="2" /><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" /></g>} size={15} />,
    chevron: <Ic d={<path d="m6 9 6 6 6-6" />} size={22} />,
    portal: <Ic d={<g><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4" /><path d="M10 17l5-5-5-5" /><path d="M15 12H3" /></g>} size={18} />,
    menu: <Ic d={<g><path d="M3 6h18" /><path d="M3 12h18" /><path d="M3 18h18" /></g>} />,
    x: <Ic d={<g><path d="M18 6 6 18" /><path d="m6 6 12 12" /></g>} />
  };

  // ---- Shared bits ---------------------------------------------------------
  function Eyebrow({ children, color = 'var(--slate-400)', style = {} }) {
    return <div style={{
      fontFamily: 'var(--font-body)', fontSize: '0.75rem', fontWeight: 700,
      letterSpacing: '0.14em', textTransform: 'uppercase', color, ...style
    }}>{children}</div>;
  }

  function Photo({ label, tone = 'mixed', radius = 'var(--radius-2xl)', height = '100%', src, objectPosition = 'center 28%', style = {} }) {
    const tones = {
      blue: 'linear-gradient(155deg, var(--blue-200), var(--blue-300))',
      sage: 'linear-gradient(155deg, var(--sage-200), var(--sage-300))',
      sand: 'linear-gradient(155deg, var(--sand-200), var(--sand-300))',
      mixed: 'linear-gradient(155deg, var(--blue-200), var(--sage-200) 58%, var(--sand-200))'
    };
    return (
      <div style={{
        background: tones[tone] || tones.mixed, borderRadius: radius, height, width: '100%',
        display: 'flex', alignItems: 'center', justifyContent: 'center',
        position: 'relative', overflow: 'hidden', ...style
      }}>
        {src ?
        <img src={src} alt={label} style={{ width: '100%', height: '100%',
          objectFit: 'cover', objectPosition, display: 'block' }} /> :
        <span style={{ fontFamily: 'var(--font-display)', fontStyle: 'italic',
          fontSize: '1rem', color: 'rgba(58,70,81,0.5)', letterSpacing: '0.01em',
          padding: '0 24px', textAlign: 'center' }}>{label}</span>}
      </div>);

  }

  function SectionHead({ eyebrow, title, script, sub, align = 'center', maxWidth = 620 }) {
    return (
      <div style={{ textAlign: align, maxWidth, margin: align === 'center' ? '0 auto' : 0 }}>
        {eyebrow && <Eyebrow style={{ marginBottom: 14 }}>{eyebrow}</Eyebrow>}
        <h2 style={{ fontFamily: 'var(--font-display)', fontSize: 'var(--text-2xl)',
          fontWeight: 500, color: 'var(--text-strong)', lineHeight: 1.12, margin: 0 }}>{title}</h2>
        {script && <div style={{ fontFamily: 'var(--font-script)', fontSize: 'clamp(34px, 8vw, 46px)',
          color: 'var(--primary)', lineHeight: 1, marginTop: 4 }}>{script}</div>}
        {sub && <p style={{ fontSize: 'var(--text-md)', lineHeight: 1.7, color: 'var(--text-body)',
          margin: align === 'center' ? '18px auto 0' : '18px 0 0', maxWidth: 560 }}>{sub}</p>}
      </div>);

  }

  const NAV = [['Services', '#services'], ['FAQ', '/faq'], ['For Professionals', '/for-professionals'], ['Contact', '#contact']];
  const resolve = (href, base) => href.charAt(0) === '#' ? base + href : href;

  // ---- Header --------------------------------------------------------------
  const PORTAL_URL = 'https://jamie-kuhlman.clientsecure.me/sign-in';

  function Header({ base = '', localContact = false }) {
    const { Button } = DS;
    const contactHref = localContact ? '#contact' : base + '#contact';
    const navHref = (href) => href === '#contact' ? contactHref : resolve(href, base);
    const [menu, setMenu] = React.useState(false);
    return (
      <header style={{ position: 'sticky', top: 0, zIndex: 20,
        background: 'rgba(249,246,240,0.82)', backdropFilter: 'blur(14px)',
        WebkitBackdropFilter: 'blur(14px)', borderBottom: '1px solid var(--border)' }}>
        <div className="wrap cp-headbar" style={{ position: 'relative', display: 'flex', alignItems: 'center',
          justifyContent: 'space-between', padding: '12px 32px' }}>
          <a href={base + '#top'} style={{ display: 'flex', alignItems: 'center', gap: 12, textDecoration: 'none' }}>
            <span style={{ display: 'flex', flexDirection: 'column', lineHeight: 1 }}>
              <span style={{ fontFamily: 'var(--font-script)', fontSize: 26, color: 'var(--primary)', whiteSpace: 'nowrap' }}>Courageous Path</span>
              <span style={{ fontFamily: 'var(--font-body)', fontSize: 11, fontWeight: 700,
                letterSpacing: '0.22em', textTransform: 'uppercase', color: 'var(--slate-400)',
                marginTop: 3 }}>Counseling</span>
            </span>
          </a>
          <nav className="cp-nav" style={{ position: 'absolute', left: '50%', top: '50%',
            transform: 'translate(-50%, -50%)', display: 'flex', alignItems: 'center', gap: 28 }}>
            {NAV.map(([label, href]) =>
            <a key={label} href={navHref(href)} style={{ textDecoration: 'none', fontFamily: 'var(--font-body)',
              fontSize: 15, fontWeight: 600, color: 'var(--text-strong)', whiteSpace: 'nowrap' }}>{label}</a>
            )}
          </nav>
          <div className="cp-actions" style={{ display: 'flex', alignItems: 'center', gap: 14 }}>
            <a className="cp-portal-link" href={PORTAL_URL} target="_blank" rel="noopener noreferrer"
            style={{ display: 'inline-flex', alignItems: 'center', gap: 7, textDecoration: 'none',
              fontFamily: 'var(--font-body)', fontSize: 15, fontWeight: 600, color: 'var(--primary-press)',
              whiteSpace: 'nowrap' }}>{Icons.portal}<span>Client portal</span></a>
            <span className="cp-book-full"><Button size="sm" onClick={() => {openContactModal();}}>Book a consultation</Button></span>
            <span className="cp-book-short"><Button size="sm" onClick={() => {openContactModal();}}>Book</Button></span>
            <button className="cp-burger" aria-label="Menu" onClick={() => setMenu((m) => !m)}
            style={{ display: 'none', background: 'transparent', border: '1px solid var(--border-strong)',
              borderRadius: 'var(--radius-pill)', width: 44, height: 44, alignItems: 'center',
              justifyContent: 'center', color: 'var(--text-strong)', cursor: 'pointer', flex: '0 0 auto' }}>
              {menu ? Icons.x : Icons.menu}
            </button>
          </div>
        </div>
        <div className="cp-menu" style={{ display: menu ? 'block' : 'none',
          borderTop: '1px solid var(--border)', background: 'var(--surface-page)' }}>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 4, padding: '14px 24px 22px' }}>
            {NAV.map(([label, href]) =>
            <a key={label} href={navHref(href)} onClick={() => setMenu(false)}
            style={{ textDecoration: 'none', fontFamily: 'var(--font-body)', fontSize: 17,
              fontWeight: 600, color: 'var(--text-strong)', padding: '12px 4px',
              borderBottom: '1px solid var(--border)' }}>{label}</a>
            )}
            <a href={PORTAL_URL} target="_blank" rel="noopener noreferrer" onClick={() => setMenu(false)}
            style={{ display: 'inline-flex', alignItems: 'center', gap: 8, textDecoration: 'none',
              fontFamily: 'var(--font-body)', fontSize: 17, fontWeight: 600, color: 'var(--primary-press)',
              padding: '12px 4px', whiteSpace: 'nowrap' }}>{Icons.portal}<span>Client portal</span></a>
          </div>
        </div>
      </header>);

  }

  // ---- Hero ----------------------------------------------------------------
  function Hero() {
    const { Button, Badge } = DS;
    return (
      <section id="top" style={{ position: 'relative', overflow: 'hidden' }}>
        <div className="wrap cp-hero" style={{ display: 'grid', gridTemplateColumns: '1.05fr 0.95fr',
          gap: 64, alignItems: 'center', padding: `${PY(80)} ${PX} ${PY(96)}` }}>
          <div>
            <Eyebrow style={{ marginBottom: 18 }}>Licensed Psychologist · Nashville, TN · Telehealth in 43 states</Eyebrow>
            <h1 style={{ fontFamily: 'var(--font-display)', fontSize: 'var(--text-4xl)',
              fontWeight: 500, lineHeight: 1.04, color: 'var(--text-strong)', margin: 0 }}>
              You don&rsquo;t have to walk
            </h1>
            <div style={{ fontFamily: 'var(--font-script)', fontSize: 'clamp(52px, 14vw, 86px)', color: 'var(--primary)',
              lineHeight: 0.92, margin: '6px 0 26px' }}>this path alone</div>
            <p style={{ fontSize: 'var(--text-md)', lineHeight: 1.75, color: 'var(--text-body)',
              maxWidth: 478, margin: '0 0 32px' }}>
              Compassionate, specialized therapy for infertility and maternal mental health ,
              helping you find peace and steady ground wherever you are on your reproductive journey.
            </p>
            <div style={{ display: 'flex', gap: 14, alignItems: 'center', flexWrap: 'wrap' }}>
              <Button size="lg" iconRight={Icons.arrow} onClick={() => {openContactModal();}}>Book a free consultation</Button>
              <Button size="lg" variant="ghost" onClick={() => {location.hash = '#services';}}>Explore services</Button>
            </div>
          </div>
          <div style={{ position: 'relative' }}>
            <Photo label="Dr. Jamie Kuhlman" src={PORTRAIT} objectPosition="center 22%" tone="mixed" height="clamp(380px, 88vw, 500px)" />
            <div style={{ position: 'absolute', bottom: -24, left: -22, background: 'var(--surface-raised)',
              boxShadow: 'var(--shadow-lg)', borderRadius: 'var(--radius-lg)', padding: '18px 26px',
              border: '1px solid var(--border)' }}>
              <div style={{ fontFamily: 'var(--font-display)', fontSize: 24, fontWeight: 600,
                color: 'var(--text-strong)', whiteSpace: 'nowrap' }}>Dr. Jamie Kuhlman, PhD</div>
              <div style={{ fontSize: 13, color: 'var(--text-muted)', marginTop: 3 }}>
                Licensed Psychologist · TN&nbsp;#3447</div>
            </div>
          </div>
        </div>
      </section>);

  }

  // ---- Reassurance strip ---------------------------------------------------
  function Reassurance() {
    const items = [
    [Icons.heart, 'Safe Space', 'Empathetic listening where hard feelings are truly heard, never minimized'],
    [Icons.clock, 'Telehealth Appointments', 'All sessions are conducted over telehealth to provide flexibility and comfort'],
    [Icons.sprout, 'Specialized Care', 'Specialized focus on fertility, pregnancy, loss, and maternal mental health']];

    return (
      <section style={{ background: 'var(--surface-accent)' }}>
        <div className="wrap cp-reassure" style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)',
          gap: 40, padding: `${PY(52)} ${PX}` }}>
          {items.map(([icon, title, body], i) =>
          <div key={i} style={{ display: 'flex', gap: 16, alignItems: 'flex-start' }}>
              <span style={{ color: 'var(--primary-press)', flex: '0 0 auto', marginTop: 2 }}>{icon}</span>
              <div>
                <div style={{ fontFamily: 'var(--font-display)', fontSize: 21, fontWeight: 600,
                color: 'var(--text-strong)', marginBottom: 4 }}>{title}</div>
                <p style={{ margin: 0, fontSize: 14.5, lineHeight: 1.6, color: 'var(--text-body)' }}>{body}</p>
              </div>
            </div>
          )}
        </div>
      </section>);

  }

  // ---- Services ------------------------------------------------------------
  const SERVICES = [
  [Icons.heart, 'blue', 'Individual Therapy', 'Infertility',
  'An emotional rollercoaster of hope, grief, anxiety, and loneliness, often isolating and hard to talk about. Together we navigate it and find peace, wherever you are on your reproductive journey.'],
  [Icons.baby, 'blue', 'Individual Therapy', 'Postpartum mental health',
  'Complications, difficult or traumatic births, pregnancy loss, and postpartum mood disorders can happen to any of us. We walk through this complex time and find the strength within to feel steady again.'],
  [Icons.woman, 'blue', 'Individual Therapy', 'Maternal mental health',
  'Whatever your path to motherhood, being a mother is a challenging task. Alongside the joys come stressors that can feel isolating and hard to name. I work with women across every stage of motherhood to grow not only as a mother but as a whole person.'],
  [Icons.sprout, 'blue', 'Individual Therapy', 'Personal growth',
  'We work collaboratively with clients to discover themselves more deeply, improve their relationships, experience a new way of being, and feel empowered to make the changes they want in their life.'],
  [Icons.users, 'sand', '3rd Party Reproduction', 'Implications counseling',
  'When using an egg or sperm donor or a gestational carrier, it helps, and is often required, to meet with a trained counselor. We support intended parents in thinking through these decisions as they move forward in building their families.'],
  [Icons.clipboard, 'sand', '3rd Party Reproduction', 'Donor & carrier screenings',
  'Becoming an egg or sperm donor or a gestational carrier often requires a psychological evaluation. We conduct each part of the evaluation process and coordinate with your agency or clinic.']];


  function Services() {
    const { Card, Badge } = DS;
    const renderCard = ([icon, tone, cat, title, body], i) =>
    <Card key={i} tone="paper" interactive padding="lg" style={{ display: 'flex',
      flexDirection: 'column', gap: 0, height: '100%' }}>
        <span style={{ width: 52, height: 52, borderRadius: 'var(--radius-md)',
        display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
        background: `var(--${tone === 'blue' ? 'blue' : tone === 'sage' ? 'sage' : 'sand'}-100)`,
        color: 'var(--slate-600)', marginBottom: 20 }}>{icon}</span>
        <Badge tone={tone} style={{ alignSelf: 'flex-start', marginBottom: 12, whiteSpace: 'nowrap' }}>{cat}</Badge>
        <h3 style={{ fontFamily: 'var(--font-display)', fontSize: 'var(--text-lg)',
        fontWeight: 600, color: 'var(--text-strong)', margin: '0 0 10px' }}>{title}</h3>
        <p style={{ margin: 0, fontSize: 14.5, lineHeight: 1.65, color: 'var(--text-body)' }}>{body}</p>
      </Card>;

    return (
      <section id="services" style={{ padding: `${PY(96)} ${PX}` }}>
        <div className="wrap" style={{ padding: 0 }}>
          <SectionHead eyebrow="How I can help"
          title="Specialized support for"
          script="every step of the journey"
          sub="Care for the tender, often-unspoken parts of building and growing a family." />
          <div className="cp-svc-split" style={{ marginTop: 56 }}>
            <div className="cp-svc-left">
              {SERVICES.slice(0, 4).map(renderCard)}
            </div>
            <div className="cp-svc-right">
              {SERVICES.slice(4).map((s, i) => renderCard(s, i + 4))}
            </div>
          </div>
        </div>
      </section>);

  }

  // ---- About ---------------------------------------------------------------
  function About() {
    const { Button } = DS;
    return (
      <section id="about" style={{ background: 'var(--surface-inset)', padding: `${PY(96)} ${PX}` }}>
        <div className="wrap" style={{ padding: 0 }}>
          <div className="cp-about-row" style={{ display: 'flex', alignItems: 'center', gap: 56 }}>
            <img src={LOGO} alt="Courageous Path Counseling" className="cp-about-logo"
            style={{ objectFit: 'contain', height: 240, width: 240, flex: '0 0 auto' }} />
            <div style={{ maxWidth: 700 }}>
              <Eyebrow style={{ marginBottom: 14 }}>Meet your psychologist</Eyebrow>
              <h2 style={{ fontFamily: 'var(--font-display)', fontSize: 'var(--text-3xl)', fontWeight: 500,
                color: 'var(--text-strong)', lineHeight: 1.08, margin: '0 0 4px' }}>Jamie Kuhlman, <span style={{ fontStyle: 'italic', color: 'var(--slate-500)' }}>PhD</span></h2>
              <div style={{ fontSize: 14.5, color: 'var(--text-muted)', marginBottom: 22 }}>
                Licensed Clinical Psychologist · State of Tennessee #3447</div>
              <p style={{ fontSize: 'var(--text-md)', lineHeight: 1.78, color: 'var(--text-body)', margin: '0 0 18px' }}>Having walked the road of infertility myself, and known the difficulties of becoming a new mother, I’m passionate about helping clients find peace on their own reproductive journey.




              </p>
              <p style={{ fontSize: 'var(--text-md)', lineHeight: 1.78, color: 'var(--text-body)', margin: '0 0 30px' }}>My work is collaborative and unhurried. Together we make room for the whole of your experience, the hope and the grief, so you can feel truly met, and find the courage and strength already within you.

All sessions are conducted via telehealth so you can meet in the comfort of your own space without the added time of coming into an office. As a PSYPACT member, I also see clients in over 43 state so location is no longer a barrier to the care you deserve. 

              </p>
              <Button size="lg" variant="secondary" iconRight={Icons.arrow}
              onClick={() => {location.href = '/about';}}>More about me</Button>
            </div>
          </div>
        </div>
      </section>);

  }

  // ---- Quote ---------------------------------------------------------------
  function Quote() {
    return (
      <section style={{ padding: `${PY(90)} ${PX}` }}>
        <div className="wrap" style={{ maxWidth: 'var(--container-narrow)', textAlign: 'center', padding: 0 }}>
          <div style={{ fontFamily: 'var(--font-script)', fontSize: 'clamp(30px, 7vw, 40px)', color: 'var(--accent-sage)',
            lineHeight: 1, marginBottom: 18 }}>a gentle reminder</div>
          <p style={{ fontFamily: 'var(--font-display)', fontStyle: 'italic', fontSize: 'clamp(24px, 5.5vw, 34px)',
            fontWeight: 400, lineHeight: 1.3, color: 'var(--text-strong)', margin: 0 }}>"And the day came when the risk to remain tight in a bud was more painful than the risk it took to blossom." Anaïs Nin


          </p>
        </div>
      </section>);

  }

  // ---- Contact + Footer ----------------------------------------------------
  const CONTACT_COPY = {
    default: {
      eyebrow: 'Contact', heading: 'Reach out when you&rsquo;re ready', script: 'I&rsquo;d love to hear from you',
      intro: 'Booking a free consultation carries no pressure and no commitment. We&rsquo;ll see if we&rsquo;re a good fit, at a pace that feels right for you.',
      formTitle: 'Send a note', formSub: 'Share as much or as little as feels right.',
      fieldLabel: 'What brings you here?',
      fieldPlaceholder: 'A sentence or two is plenty, there&rsquo;s no pressure to share more than you&rsquo;d like.'
    },
    faq: {
      eyebrow: 'Still wondering?', heading: 'Have a question I didn&rsquo;t cover?', script: 'I&rsquo;m always happy to help',
      intro: 'If something wasn&rsquo;t answered above, please reach out, no question is too small, and there&rsquo;s never any pressure or commitment.',
      formTitle: 'Ask away', formSub: 'Share as much or as little as feels right.',
      fieldLabel: 'What would you like to ask?',
      fieldPlaceholder: 'Tell me what&rsquo;s on your mind, even a single sentence is plenty.'
    },
    pro: {
      eyebrow: 'For professionals', heading: 'Let&rsquo;s work together', script: 'for the people in your care',
      intro: 'Whether you&rsquo;re seeking services for a client, exploring a partnership, or inviting me to speak or collaborate on advocacy, I&rsquo;d be glad to talk.',
      formTitle: 'Start a conversation', formSub: 'A few details about your team or request help me point you the right way.',
      fieldLabel: 'How can I help your team?',
      fieldPlaceholder: 'Tell me a little about your clinic, agency, or organization and what you&rsquo;re looking for.'
    }
  };

  // Small "copy to clipboard" pill, shown next to the email at every screen size.
  function CopyButton({ text, label = 'email address' }) {
    const [copied, setCopied] = React.useState(false);
    const copy = async () => {
      try {
        if (navigator.clipboard && navigator.clipboard.writeText) {
          await navigator.clipboard.writeText(text);
        } else {throw new Error('no clipboard');}
      } catch (e) {
        const ta = document.createElement('textarea');
        ta.value = text; ta.style.position = 'fixed'; ta.style.opacity = '0';
        document.body.appendChild(ta); ta.focus(); ta.select();
        try {document.execCommand('copy');} catch (_) {}
        document.body.removeChild(ta);
      }
      setCopied(true);
      setTimeout(() => setCopied(false), 1800);
    };
    return (
      <button type="button" onClick={copy}
      aria-label={copied ? 'Copied' : 'Copy ' + label}
      title={copied ? 'Copied!' : 'Copy ' + label}
      style={{ display: 'inline-flex', alignItems: 'center', gap: 6, flex: '0 0 auto',
        padding: '5px 10px', borderRadius: 'var(--radius-pill)',
        border: '1px solid ' + (copied ? 'var(--sage-400)' : 'var(--border)'),
        background: 'var(--surface-raised)', color: copied ? 'var(--sage-500)' : 'var(--primary-press)',
        cursor: 'pointer', fontFamily: 'var(--font-body)', fontSize: 12.5, fontWeight: 700,
        letterSpacing: '0.02em', whiteSpace: 'nowrap', lineHeight: 1,
        transition: 'color var(--dur-base) var(--ease-soft), border-color var(--dur-base) var(--ease-soft)' }}>
        {copied ? Icons.check : Icons.copy}
        <span>{copied ? 'Copied' : 'Copy'}</span>
      </button>);

  }

  function ContactInfo({ gap = 18 }) {
    const info = [
    [Icons.mail, 'Email', 'drjamie@courageouspathcounseling.com', 'mailto:drjamie@courageouspathcounseling.com'],
    [Icons.phone, 'Telephone', '615.274.9972', 'tel:6152749972'],
    [Icons.pin, 'Mailing Address', '2021 Richard Jones Road, Suite 350B · Nashville, TN 37215', null]];

    return (
      <div>
        <div style={{ display: 'flex', flexDirection: 'column', gap }}>
          {info.map(([icon, label, value, href], i) =>
          <div key={i} style={{ display: 'flex', gap: 14, alignItems: 'flex-start' }}>
              <span style={{ width: 42, height: 42, borderRadius: 'var(--radius-pill)', flex: '0 0 auto',
              display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
              background: 'var(--surface-raised)', color: 'var(--primary-press)',
              border: '1px solid var(--border)' }}>{icon}</span>
              <div style={{ minWidth: 0 }}>
                <div style={{ fontSize: 12, fontWeight: 700, letterSpacing: '0.12em',
                textTransform: 'uppercase', color: 'var(--slate-400)', marginBottom: 3 }}>{label}</div>
                {href && href.indexOf('mailto:') === 0 ?
              <div style={{ display: 'flex', alignItems: 'center', gap: 10, flexWrap: 'wrap' }}>
                  <a href={href} style={{ fontSize: 15.5, color: 'var(--text-strong)', textDecoration: 'none', fontWeight: 600, overflowWrap: 'anywhere', wordBreak: 'break-word', minWidth: 0 }}>{value}</a>
                  <CopyButton text={value} />
                </div> :
              href ?
              <a href={href} style={{ fontSize: 15.5, color: 'var(--text-strong)', textDecoration: 'none', fontWeight: 600, overflowWrap: 'anywhere', wordBreak: 'break-word' }}>{value}</a> :
              <div style={{ fontSize: 15.5, color: 'var(--text-strong)', fontWeight: 600, maxWidth: 320, overflowWrap: 'anywhere', wordBreak: 'break-word' }}>{value}</div>}
              </div>
            </div>
          )}
        </div>
        <div style={{ marginTop: 24, fontSize: 13, lineHeight: 1.6, color: 'var(--text-muted)',
          borderLeft: '3px solid var(--blue-300)', paddingLeft: 14 }}>
          If you are in crisis, please call or text <strong style={{ color: 'var(--text-body)' }}>988</strong> for the
          Suicide &amp; Crisis Lifeline, or call 911.
        </div>
      </div>);

  }

  // Returns a friendly, specific error string, or '' when the email is valid.
  // Stricter than the browser's native type="email" check (which accepts e.g.
  // "a@b" with no TLD) and gives a targeted message for the common mistakes.
  function emailErrorFor(raw) {
    const email = (raw || '').trim();
    if (!email) return 'Please enter your email address.';
    if (/\s/.test(email)) return 'Email addresses can’t contain spaces.';
    const parts = email.split('@');
    if (parts.length !== 2) return 'Please include a single “@” in your email.';
    const [local, domain] = parts;
    if (!local) return 'Add the part before the “@” (e.g. you).';
    if (!domain) return 'Add the part after the “@” (e.g. gmail.com).';
    if (!domain.includes('.')) return 'The domain looks incomplete — it’s missing a “.com”, “.org”, etc.';
    if (/^[.]|[.]$/.test(local) || /\.\./.test(local)) return 'Please enter a valid email address.';
    if (/^[.-]|[.-]$/.test(domain) || /\.\./.test(domain)) return 'Please enter a valid email address.';
    const tld = domain.slice(domain.lastIndexOf('.') + 1);
    if (tld.length < 2) return 'The domain ending looks incomplete.';
    if (!/^[A-Za-z]+$/.test(tld)) return 'Please check the end of the email address.';
    if (!/^[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}$/.test(email)) {
      return 'Please enter a valid email address.';
    }
    return '';
  }

  function ContactForm({ copy, bare = false, source = 'main' }) {
    const { Card, Button, Input, Textarea } = DS;
    const [sent, setSent] = React.useState(false);
    const [status, setStatus] = React.useState('idle'); // idle | sending | error
    const [error, setError] = React.useState('');
    const [emailTouched, setEmailTouched] = React.useState(false);
    const [form, setForm] = React.useState({ name: '', email: '', message: '', company: '' });
    const set = (k) => (e) => setForm((f) => ({ ...f, [k]: e.target.value }));
    const emailError = emailErrorFor(form.email);
    const showEmailError = emailTouched && !!emailError;

    async function handleSubmit(e) {
      e.preventDefault();
      if (status === 'sending') return;
      if (emailError) {
        setEmailTouched(true);
        return;
      }
      setStatus('sending');
      setError('');
      try {
        const res = await fetch('/api/contact', {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify({ ...form, source })
        });
        const data = await res.json().catch(() => ({}));
        if (!res.ok) throw new Error(data.error || 'Something went wrong. Please try again.');
        setSent(true);
      } catch (err) {
        setStatus('error');
        setError(err.message || 'Something went wrong. Please try again.');
      }
    }

    const sending = status === 'sending';
    const inner = sent ?
    <div style={{ textAlign: 'center', padding: '36px 12px' }}>
        <span style={{ width: 60, height: 60, borderRadius: '50%', display: 'inline-flex',
        alignItems: 'center', justifyContent: 'center', background: 'var(--sage-100)',
        color: 'var(--sage-500)', marginBottom: 18 }}>{Icons.heart}</span>
        <h3 style={{ fontFamily: 'var(--font-display)', fontSize: 26, fontWeight: 600,
        color: 'var(--text-strong)', margin: '0 0 8px' }}>Thank you for reaching out</h3>
        <p style={{ fontSize: 15, lineHeight: 1.6, color: 'var(--text-body)', margin: 0 }}>
          Your note is on its way. I&rsquo;ll be in touch soon.</p>
      </div> :

    <form onSubmit={handleSubmit} noValidate
    style={{ display: 'flex', flexDirection: 'column', gap: 18 }}>
        <div style={{ marginBottom: 4 }}>
          <h3 style={{ fontFamily: 'var(--font-display)', fontSize: 24, fontWeight: 600,
          color: 'var(--text-strong)', margin: '0 0 4px' }}>{copy.formTitle}</h3>
          <p style={{ margin: 0, fontSize: 14, color: 'var(--text-muted)' }}>{copy.formSub}</p>
        </div>
        <Input label="Your name" name="name" required placeholder="Your name"
      value={form.name} onChange={set('name')} disabled={sending} />
        {/* Wrapper catches blur (focusout bubbles) without overriding the DS
            Input's own onBlur, which drives its focus styling. */}
        <div onBlur={() => setEmailTouched(true)}>
          <Input label="Email" type="email" name="email" required placeholder="you@email.com"
        inputMode="email" autoComplete="email" spellCheck={false}
        aria-invalid={showEmailError ? true : undefined}
        error={showEmailError ? emailError : undefined}
        value={form.email} onChange={set('email')} disabled={sending} />
        </div>
        <Textarea label={copy.fieldLabel} name="message" rows={4} required
      placeholder={copy.fieldPlaceholder.replace(/&rsquo;/g, '\u2019').replace(/&mdash;/g, ',')}
      value={form.message} onChange={set('message')} disabled={sending} />
        {/* Honeypot: hidden from people, tempting to bots. */}
        <input type="text" name="company" tabIndex={-1} autoComplete="off"
      value={form.company} onChange={set('company')}
      style={{ position: 'absolute', left: '-9999px', width: 1, height: 1, opacity: 0 }} aria-hidden="true" />
        {status === 'error' &&
      <p role="alert" style={{ margin: 0, fontSize: 14, color: 'var(--danger, #b91c1c)' }}>{error}</p>}
        <Button size="lg" fullWidth type="submit" iconRight={Icons.arrow} disabled={sending}>
          {sending ? 'Sending\u2026' : 'Send my note'}</Button>
      </form>;

    if (bare) return inner;
    return <Card tone="raised" padding="lg" style={{ borderRadius: 'var(--radius-xl)' }}>{inner}</Card>;
  }

  function Contact({ variant = 'default' }) {
    const copy = CONTACT_COPY[variant] || CONTACT_COPY.default;
    return (
      <section id="contact" style={{ background: 'var(--surface-accent)', padding: `${PY(96)} ${PX}` }}>
        <div className="wrap cp-contact" style={{ display: 'grid', gridTemplateColumns: '0.9fr 1.1fr',
          gap: 56, alignItems: 'flex-start', padding: 0 }}>
          <div style={{ minWidth: 0 }}>
            <Eyebrow style={{ marginBottom: 14 }}>{copy.eyebrow}</Eyebrow>
            <h2 style={{ fontFamily: 'var(--font-display)', fontSize: 'var(--text-2xl)', fontWeight: 500,
              color: 'var(--text-strong)', lineHeight: 1.12, margin: '0 0 2px' }} dangerouslySetInnerHTML={{ __html: copy.heading }} />
            <div style={{ fontFamily: 'var(--font-script)', fontSize: 'clamp(30px, 7vw, 40px)', color: 'var(--primary)',
              lineHeight: 1, marginBottom: 20 }} dangerouslySetInnerHTML={{ __html: copy.script }} />
            <p style={{ fontSize: 'var(--text-md)', lineHeight: 1.7, color: 'var(--text-body)',
              maxWidth: 420, margin: '0 0 32px' }} dangerouslySetInnerHTML={{ __html: copy.intro }} />
            <ContactInfo />
          </div>

          <ContactForm copy={copy} source={variant === 'default' ? 'main' : variant} />
        </div>
      </section>);

  }

  function openContactModal() {window.dispatchEvent(new CustomEvent('cp-open-contact'));}

  function ContactModal() {
    const [open, setOpen] = React.useState(false);
    React.useEffect(() => {
      const onOpen = () => setOpen(true);
      window.addEventListener('cp-open-contact', onOpen);
      return () => window.removeEventListener('cp-open-contact', onOpen);
    }, []);
    React.useEffect(() => {
      const onKey = (e) => {if (e.key === 'Escape') setOpen(false);};
      document.addEventListener('keydown', onKey);
      return () => document.removeEventListener('keydown', onKey);
    }, []);
    React.useEffect(() => {
      document.body.style.overflow = open ? 'hidden' : '';
      return () => {document.body.style.overflow = '';};
    }, [open]);
    if (!open) return null;
    const copy = { ...CONTACT_COPY.default, eyebrow: 'Book a consultation' };
    return (
      <div onClick={() => setOpen(false)} style={{ position: 'fixed', inset: 0, zIndex: 100,
        background: 'rgba(46,53,62,0.45)', backdropFilter: 'blur(4px)', WebkitBackdropFilter: 'blur(4px)',
        display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 24, overflowY: 'auto',
        animation: 'cpFade 240ms var(--ease-soft)' }}>
        <style dangerouslySetInnerHTML={{ __html: '@keyframes cpFade{from{opacity:0}to{opacity:1}}@keyframes cpRise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}@media (max-width:760px){.cp-modal{grid-template-columns:1fr !important}.cp-modal-aside{border-radius:var(--radius-2xl) var(--radius-2xl) 0 0 !important;padding:28px 24px !important}.cp-modal-body{padding:32px 24px 32px !important}}' }} />
        <div onClick={(e) => e.stopPropagation()} className="cp-modal" style={{ background: 'var(--surface-page)',
          borderRadius: 'var(--radius-2xl)', maxWidth: 900, width: '100%', maxHeight: '92vh', overflowY: 'auto',
          boxShadow: 'var(--shadow-xl)', position: 'relative', display: 'grid', gridTemplateColumns: '0.82fr 1.18fr',
          animation: 'cpRise 280ms var(--ease-soft)' }}>
          <div className="cp-modal-aside" style={{ background: 'var(--surface-accent)', padding: '40px 34px',
            borderRadius: 'var(--radius-2xl) 0 0 var(--radius-2xl)' }}>
            <Eyebrow style={{ marginBottom: 12 }}>{copy.eyebrow}</Eyebrow>
            <h2 style={{ fontFamily: 'var(--font-display)', fontSize: 'var(--text-xl)', fontWeight: 500,
              color: 'var(--text-strong)', lineHeight: 1.15, margin: '0 0 2px' }} dangerouslySetInnerHTML={{ __html: copy.heading }} />
            <div style={{ fontFamily: 'var(--font-script)', fontSize: 'clamp(26px, 7vw, 34px)', color: 'var(--primary)',
              lineHeight: 1, marginBottom: 18 }} dangerouslySetInnerHTML={{ __html: copy.script }} />
            <p style={{ fontSize: 15, lineHeight: 1.65, color: 'var(--text-body)', margin: '0 0 26px' }} dangerouslySetInnerHTML={{ __html: copy.intro }} />
            <ContactInfo gap={14} />
          </div>
          <div className="cp-modal-body" style={{ padding: '44px 36px 40px' }}>
            <ContactForm copy={copy} bare source="booking" />
          </div>
          <button aria-label="Close" onClick={() => setOpen(false)} style={{ position: 'absolute', top: 16, right: 16,
            width: 40, height: 40, borderRadius: '50%', border: '1px solid var(--border)', background: 'var(--surface-raised)',
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer',
            color: 'var(--text-strong)', boxShadow: 'var(--shadow-sm)' }}>{Icons.x}</button>
        </div>
      </div>);

  }

  function Footer({ base = '', localContact = false }) {
    const navHref = (href) => href === '#contact' ? localContact ? '#contact' : base + '#contact' : resolve(href, base);
    return (
      <footer style={{ background: 'var(--surface-ink)', color: 'var(--text-on-dark)' }}>
        <div className="wrap" style={{ display: 'flex', justifyContent: 'space-between',
          alignItems: 'flex-start', gap: 40, padding: `${PY(56)} ${PX}`, flexWrap: 'wrap' }}>
          <div style={{ maxWidth: 320 }}>
            <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 16 }}>
              <img src={LOGO} alt="" style={{ height: 52, width: 52, objectFit: 'contain',
                background: 'var(--cream-100)', borderRadius: '50%', padding: 2 }} />
              <span style={{ display: 'flex', flexDirection: 'column', lineHeight: 1 }}>
                <span style={{ fontFamily: 'var(--font-script)', fontSize: 26, color: 'var(--blue-200)' }}>Courageous Path</span>
                <span style={{ fontSize: 11, fontWeight: 700, letterSpacing: '0.22em',
                  textTransform: 'uppercase', color: 'var(--slate-300)', marginTop: 3 }}>Counseling, PLLC</span>
              </span>
            </div>
            <p style={{ fontSize: 14, lineHeight: 1.7, color: 'var(--slate-300)', margin: 0 }}>
              Compassionate care for infertility and maternal mental health in 43 states.</p>
          </div>
          <div style={{ display: 'flex', gap: 64, flexWrap: 'wrap' }}>
            <div>
              <div style={{ fontSize: 12, fontWeight: 700, letterSpacing: '0.14em', textTransform: 'uppercase',
                color: 'var(--slate-300)', marginBottom: 14 }}>Explore</div>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
                {NAV.map(([label, href]) =>
                <a key={label} href={navHref(href)} style={{ fontSize: 14.5, color: 'var(--cream-200)',
                  textDecoration: 'none' }}>{label}</a>
                )}
                <a href="https://jamie-kuhlman.clientsecure.me/sign-in" target="_blank" rel="noopener noreferrer"
                style={{ fontSize: 14.5, color: 'var(--cream-200)', textDecoration: 'none' }}>Client portal</a>
              </div>
            </div>
            <div>
              <div style={{ fontSize: 12, fontWeight: 700, letterSpacing: '0.14em', textTransform: 'uppercase',
                color: 'var(--slate-300)', marginBottom: 14 }}>Reach me</div>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 10, fontSize: 14.5, color: 'var(--cream-200)', minWidth: 0 }}>
                <a href="mailto:drjamie@courageouspathcounseling.com" style={{ color: 'var(--cream-200)', textDecoration: 'none', overflowWrap: 'anywhere', wordBreak: 'break-word' }}>drjamie@courageouspathcounseling.com</a>
                <a href="tel:6152749972" style={{ color: 'var(--cream-200)', textDecoration: 'none' }}>615.274.9972</a>
                <span style={{ color: 'var(--slate-300)' }}>2021 Richard Jones Road, Suite 350B<br />Nashville, TN 37215</span>
              </div>
            </div>
          </div>
        </div>
        <div style={{ borderTop: '1px solid rgba(255,255,255,0.08)' }}>
          <div className="wrap" style={{ display: 'flex', justifyContent: 'space-between',
            alignItems: 'center', gap: 16, padding: `20px ${PX}`, flexWrap: 'wrap' }}>
            <span style={{ fontSize: 13, color: 'var(--slate-300)' }}>© 2026 Courageous Path Counseling, PLLC. All rights reserved.</span>
            <span style={{ fontSize: 13, color: 'var(--slate-300)' }}>If you are in crisis, call or text 988.</span>
          </div>
        </div>
      </footer>);

  }

  // ---- For Professionals page ---------------------------------------------
  const PRO_SECTIONS = [
  {
    no: '01', tone: 'blue', icon: Icons.clipboard,
    cat: 'Consultations & evaluations',
    title: 'Third-party assisted reproduction (ART)',
    script: 'consultations & evaluations',
    body: 'I provide psychological consultations and evaluations for everyone involved in third-party reproduction, egg and sperm donors, gestational carriers, and intended parents. Each session gathers relevant history, explores the implications of the decision, and includes standardized assessment where required. As a member of the American Society of Reproductive Medicine (ASRM), I follow all of their standards and guidelines.',
    points: [
    'Donor & gestational carrier psychological evaluations',
    'Implications counseling for intended parents',
    'Standardized assessment measures & clear written reports',
    'Direct coordination with your agency or clinic']

  },
  {
    no: '02', tone: 'sage', icon: Icons.mic,
    cat: 'Education & advocacy',
    title: 'Public speaking',
    script: '& advocacy',
    body: 'I speak on infertility, pregnancy loss, and maternal mental health, for clinics, professional groups, support organizations, and community events. Talks are tailored to your audience and are grounded in both clinical insight and lived experience.',
    points: [
    'Trainings & continuing education',
    'Panels, workshops & retreats',
    'Community talks & support-group facilitation',
    'Advocacy for maternal & reproductive mental health']

  },
  {
    no: '03', tone: 'sand', icon: Icons.heart,
    cat: 'Referrals welcome',
    title: 'Individual',
    script: 'therapy',
    body: 'For the clients you refer, I offer specialized, unhurried therapy across the reproductive journey, fertility challenges, pregnancy, loss, birth trauma, and the postpartum season. I welcome warm hand-offs and, with the client&rsquo;s consent, keep referring providers gently informed.',
    points: [
    'Specialized care for fertility & maternal mental health',
    'Telehealth across 43 PSYPACT states',
    'Collaborative, consent-based communication with referrers',
    'A calm, judgment-free space for your clients']

  }];


  function ProSection({ data, flip }) {
    const { Badge } = DS;
    const accent = data.tone === 'blue' ? 'blue' : data.tone === 'sage' ? 'sage' : 'sand';
    return (
      <section style={{ background: flip ? 'var(--surface-inset)' : 'transparent', padding: `${PY(84)} ${PX}` }}>
        <div className="wrap" style={{ maxWidth: 760, margin: '0 auto', padding: 0 }}>
          <div style={{ display: 'flex', alignItems: 'center', gap: 14, marginBottom: 18 }}>
            <span style={{ flex: '0 0 auto', width: 52, height: 52, borderRadius: 'var(--radius-lg)',
            background: 'var(--surface-raised)', boxShadow: 'var(--shadow-md)', border: '1px solid var(--border)',
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
            color: 'var(--primary-press)' }}>{data.icon}</span>
            <span style={{ fontFamily: 'var(--font-display)', fontSize: 30, fontWeight: 500,
            color: `var(--${accent}-400)` }}>{data.no}</span>
            <Badge tone={data.tone} style={{ whiteSpace: 'nowrap' }}>{data.cat}</Badge>
          </div>
          <h2 style={{ fontFamily: 'var(--font-display)', fontSize: 'var(--text-2xl)', fontWeight: 500,
          color: 'var(--text-strong)', lineHeight: 1.1, margin: 0 }}>{data.title}</h2>
          <div style={{ fontFamily: 'var(--font-script)', fontSize: 'clamp(32px, 8vw, 44px)', color: 'var(--primary)',
          lineHeight: 1, margin: '2px 0 18px' }}>{data.script}</div>
          <p style={{ fontSize: 'var(--text-md)', lineHeight: 1.75, color: 'var(--text-body)',
          margin: '0 0 24px' }} dangerouslySetInnerHTML={{ __html: data.body }}></p>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
            {data.points.map((p, i) =>
          <div key={i} style={{ display: 'flex', gap: 12, alignItems: 'flex-start' }}>
                <span style={{ flex: '0 0 auto', width: 26, height: 26, marginTop: 1,
              borderRadius: 'var(--radius-pill)', background: 'var(--surface-sage)',
              color: 'var(--sage-500)', display: 'inline-flex', alignItems: 'center',
              justifyContent: 'center' }}>{Icons.check}</span>
                <span style={{ fontSize: 15.5, lineHeight: 1.5, color: 'var(--text-strong)' }}>{p}</span>
              </div>
          )}
          </div>
        </div>
      </section>);

  }

  function ProHeader() {
    const { Button } = DS;
    return (
      <section id="top" style={{ position: 'relative', overflow: 'hidden',
        background: 'var(--surface-accent)' }}>
        <div className="wrap" style={{ textAlign: 'center', padding: `${PY(88)} ${PX} ${PY(80)}`, maxWidth: 820 }}>
          <Eyebrow style={{ marginBottom: 18, color: 'var(--slate-500)' }}>For agencies, clinics &amp; partners</Eyebrow>
          <h1 style={{ fontFamily: 'var(--font-display)', fontSize: 'var(--text-4xl)', fontWeight: 500,
            lineHeight: 1.05, color: 'var(--text-strong)', margin: 0 }}>Partnering in the work of</h1>
          <div style={{ fontFamily: 'var(--font-script)', fontSize: 'clamp(48px, 13vw, 80px)', color: 'var(--primary)',
            lineHeight: 0.95, margin: '4px 0 24px' }}>building families</div>
          <p style={{ fontSize: 'var(--text-md)', lineHeight: 1.75, color: 'var(--text-body)',
            margin: '0 auto 32px', maxWidth: 600 }}>
            I work alongside fertility clinics, agencies, physicians, and organizations to support the
            people in their care, through evaluations, education, and specialized therapy. If your team
            is looking for a compassionate, experienced partner, I&rsquo;d be glad to talk.
          </p>
          <Button size="lg" iconRight={Icons.arrow}
          onClick={() => {location.href = '#contact';}}>Start a conversation</Button>
        </div>
      </section>);

  }

  function ProPage() {
    return (
      <React.Fragment>
        <Header base="/" localContact />
        <main>
          <ProHeader />
          {PRO_SECTIONS.map((s, i) => <ProSection key={s.no} data={s} flip={i % 2 === 1} />)}
          <Contact variant="pro" />
        </main>
        <Footer base="/" localContact />
        <ContactModal />
      </React.Fragment>);

  }

  // ---- About page ("More about me") ---------------------------------------
  const ABOUT_VALUES = [
  [Icons.heart, 'Truly met', 'Your whole experience, the hope and the grief alike, is welcome here, and never minimized.'],
  [Icons.clock, 'Unhurried', 'We move at your pace. You can share as much or as little as feels right, with no pressure.'],
  [Icons.sprout, 'Lived experience', 'I have walked the road of infertility and the early days of new motherhood myself.']];


  function AboutHero() {
    const { Button } = DS;
    return (
      <section id="top" style={{ padding: `${PY(72)} ${PX} 0` }}>
        <div className="wrap cp-about" style={{ display: 'grid', gridTemplateColumns: '0.9fr 1.1fr',
          gap: 64, alignItems: 'center', padding: 0 }}>
          <div style={{ position: 'relative' }}>
            <Photo label="Dr. Jamie Kuhlman" src={PORTRAIT} objectPosition="center 20%"
            tone="sage" height="clamp(360px, 86vw, 480px)" radius="var(--radius-2xl)" />
            <div style={{ position: 'absolute', bottom: -22, right: -20, background: 'var(--surface-raised)',
              boxShadow: 'var(--shadow-md)', borderRadius: 'var(--radius-lg)', padding: '14px 22px',
              border: '1px solid var(--border)', textAlign: 'center' }}>
              <div style={{ fontFamily: 'var(--font-script)', fontSize: 28, color: 'var(--primary)', lineHeight: 1 }}>You are not alone</div>
              <div style={{ fontSize: 12, color: 'var(--text-muted)', marginTop: 2, letterSpacing: '0.04em' }}>at your own pace</div>
            </div>
          </div>
          <div>
            <Eyebrow style={{ marginBottom: 14 }}>Meet your psychologist</Eyebrow>
            <h1 style={{ fontFamily: 'var(--font-display)', fontSize: 'var(--text-4xl)', fontWeight: 500,
              color: 'var(--text-strong)', lineHeight: 1.02, margin: 0 }}>Jamie Kuhlman, <span style={{ fontStyle: 'italic', color: 'var(--slate-500)' }}>PhD</span></h1>
            <div style={{ fontFamily: 'var(--font-script)', fontSize: 'clamp(40px, 10vw, 56px)', color: 'var(--primary)',
              lineHeight: 0.95, margin: '4px 0 18px' }}>walking it with you</div>
            <div style={{ fontSize: 14.5, color: 'var(--text-muted)', marginBottom: 22 }}>
              Licensed Clinical Psychologist · State of Tennessee #3447</div>
            <p style={{ fontSize: 'var(--text-md)', lineHeight: 1.78, color: 'var(--text-body)', margin: '0 0 30px', maxWidth: 480 }}>I’m a Licensed Psychologist in Nashville specializing in issues around building and growing a family, fertility, pregnancy, loss, and motherhood.



            </p>
            <div style={{ display: 'flex', gap: 14, flexWrap: 'wrap' }}>
              <Button size="lg" iconRight={Icons.arrow} onClick={() => {openContactModal();}}>Book a free consultation</Button>
              <Button size="lg" variant="ghost" onClick={() => {location.href = '/#services';}}>View services</Button>
            </div>
          </div>
        </div>
      </section>);

  }

  function AboutStory() {
    return (
      <section style={{ padding: `${PY(90)} ${PX}` }}>
        <div className="wrap" style={{ maxWidth: 'var(--container-narrow)', padding: 0 }}>
          <Eyebrow style={{ marginBottom: 16 }}>My story</Eyebrow>
          <p style={{ fontSize: 'var(--text-lg)', lineHeight: 1.7, color: 'var(--text-strong)',
            fontFamily: 'var(--font-display)', fontWeight: 500, margin: '0 0 28px' }}>
            My path to this work is personal.
          </p>
          <p style={{ fontSize: 'var(--text-md)', lineHeight: 1.8, color: 'var(--text-body)', margin: '0 0 22px' }}>
            I walked the road of infertility myself, and I know the quiet ache of it, the hope, the
            grief, and the loneliness that can sit right alongside everyone else&rsquo;s good news. I also
            know the disorienting first months of new motherhood, when joy and overwhelm seem to arrive
            in the same breath.
          </p>
          <p style={{ fontSize: 'var(--text-md)', lineHeight: 1.8, color: 'var(--text-body)', margin: '0 0 22px' }}>
            Those experiences shape how I show up for the people I work with: with patience, without
            judgment, and with deep respect for how brave it is to keep going. Together we make room for
            the whole of your story, so you can find the steady ground and the strength already within you.
          </p>
          <blockquote style={{ margin: '40px 0 0', padding: '0 0 0 24px', borderLeft: '3px solid var(--primary-soft)' }}>
            <p style={{ fontFamily: 'var(--font-display)', fontStyle: 'italic', fontSize: 26, fontWeight: 400,
              lineHeight: 1.4, color: 'var(--text-strong)', margin: 0 }}>
              &ldquo;Having walked this road myself, I&rsquo;m passionate about helping women and men find
              peace on their own reproductive journey.&rdquo;
            </p>
          </blockquote>
        </div>
      </section>);

  }

  function AboutValues() {
    return (
      <section style={{ background: 'var(--surface-inset)', padding: `${PY(88)} ${PX}` }}>
        <div className="wrap" style={{ padding: 0 }}>
          <SectionHead eyebrow="How I work" title="A calm, compassionate" script="way of being together"
          sub="The feeling I hope you carry out of every session, a little more held, a little more steady." />
          <div className="cp-services" style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 24, marginTop: 52 }}>
            {ABOUT_VALUES.map(([icon, title, body], i) =>
            <div key={i} style={{ background: 'var(--surface-card)', border: '1px solid var(--border)',
              borderRadius: 'var(--radius-lg)', padding: 'var(--space-6)', boxShadow: 'var(--shadow-sm)' }}>
                <span style={{ width: 52, height: 52, borderRadius: 'var(--radius-md)', display: 'inline-flex',
                alignItems: 'center', justifyContent: 'center', background: 'var(--surface-accent)',
                color: 'var(--primary-press)', marginBottom: 18 }}>{icon}</span>
                <h3 style={{ fontFamily: 'var(--font-display)', fontSize: 'var(--text-lg)', fontWeight: 600,
                color: 'var(--text-strong)', margin: '0 0 8px' }}>{title}</h3>
                <p style={{ margin: 0, fontSize: 14.5, lineHeight: 1.65, color: 'var(--text-body)' }}>{body}</p>
              </div>
            )}
          </div>
        </div>
      </section>);

  }

  function AboutCredentials() {
    const { Badge } = DS;
    const focus = ['Infertility & IVF', 'Postpartum mental health', 'Pregnancy & infant loss', 'Birth trauma', 'Maternal mental health', 'Personal growth'];
    return (
      <section style={{ padding: `${PY(80)} ${PX}` }}>
        <div className="wrap cp-about" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 56,
          alignItems: 'start', padding: 0 }}>
          <div>
            <Eyebrow style={{ marginBottom: 14 }}>Credentials</Eyebrow>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 14 }}>
              {[['PhD', 'Doctorate in Clinical Psychology'],
              ['Licensed Psychologist', 'State of Tennessee · License #3447'],
              ['Telehealth', 'Available to clients across US in 43 states']].map(([t, d], i) =>
              <div key={i} style={{ display: 'flex', gap: 14, alignItems: 'flex-start' }}>
                  <span style={{ flex: '0 0 auto', width: 30, height: 30, marginTop: 1, borderRadius: 'var(--radius-pill)',
                  background: 'var(--surface-sage)', color: 'var(--sage-500)', display: 'inline-flex',
                  alignItems: 'center', justifyContent: 'center' }}>{Icons.check}</span>
                  <div>
                    <div style={{ fontFamily: 'var(--font-body)', fontSize: 16, fontWeight: 700, color: 'var(--text-strong)' }}>{t}</div>
                    <div style={{ fontSize: 14, color: 'var(--text-body)' }}>{d}</div>
                  </div>
                </div>
              )}
            </div>
          </div>
          <div>
            <Eyebrow style={{ marginBottom: 14 }}>Areas of focus</Eyebrow>
            <div style={{ display: 'flex', flexWrap: 'wrap', gap: 10 }}>
              {focus.map((f, i) => <Badge key={i} tone={['blue', 'sage', 'sand'][i % 3]} style={{ fontSize: 14, padding: '8px 16px' }}>{f}</Badge>)}
            </div>
          </div>
        </div>
      </section>);

  }

  function AboutCTA() {
    const { Button } = DS;
    return (
      <section style={{ background: 'var(--surface-accent)', padding: `${PY(88)} ${PX}`, textAlign: 'center' }}>
        <div className="wrap" style={{ padding: 0 }}>
          <div style={{ fontFamily: 'var(--font-script)', fontSize: 'clamp(32px, 8vw, 44px)', color: 'var(--primary-press)', lineHeight: 1, marginBottom: 8 }}>ready when you are</div>
          <h2 style={{ fontFamily: 'var(--font-display)', fontSize: 'var(--text-2xl)', fontWeight: 500,
            color: 'var(--text-strong)', margin: '0 0 24px' }}>Let&rsquo;s take the first step together</h2>
          <Button size="lg" iconRight={Icons.arrow} onClick={() => {openContactModal();}}>Book a free consultation</Button>
        </div>
      </section>);

  }

  function AboutPage() {
    return (
      <React.Fragment>
        <Header base="/" />
        <main>
          <AboutHero />
          <AboutStory />
          <AboutValues />
          <AboutCredentials />
          <AboutCTA />
        </main>
        <Footer base="/" />
        <ContactModal />
      </React.Fragment>);

  }

  // ---- FAQ page -----------------------------------------------------------
  const FAQS = [
  ['Do you offer a free consultation?',
  'Yes. Every relationship begins with a free, no-pressure consultation by phone or video. It&rsquo;s a chance to ask questions and see whether we feel like a good fit, there&rsquo;s no commitment to continue.'],
  ['Do you meet in person or by telehealth?',
  'I see clients by secure telehealth across the state of Tennessee, and across all 43 PSYPACT States.'],
  ['Which states can you see clients in through PSYPACT?',
  'Through the Psychology Interjurisdictional Compact (PSYPACT), I can offer telehealth in 43 participating states and jurisdictions, including Washington D.C. and the Northern Mariana Islands. PSYPACT is always growing, so if you do not see your state, please reach out and I&rsquo;ll gladly check the latest.'],
  ['What happens in a first session?',
  'The first few sessions are a chance for us to get to know each other. I&rsquo;ll ask questions to better understand what brings you here, gain a history, and make a plan moving forward. I view this as a collaborative process and welcome any questions you might have as well.'],
  ['How often will we meet, and for how long?',
  'Many clients begin weekly and adjust as they go. There&rsquo;s no fixed length of care; we&rsquo;ll keep revisiting what feels helpful, always at your own pace.'],
  ['Do you work with partners and couples?',
  'For third-party reproduction arrangements, I work with couples and all parties involved. However, for on-going counseling, I work only with individuals.'],
  ['Do you work with men too?',
  'For third-party reproduction arrangements, I work with couples and all parties involved. For on-going counseling, I only work with women.'],
  ['What do you specialize in?',
  'My practice is devoted to infertility and IVF, pregnancy and postpartum mental health, pregnancy and infant loss, birth trauma, third-party reproduction, and maternal mental health, alongside personal growth.'],
  ['What about fees and insurance?',
  'I accept most Aetna insurance plans and private pay. I&rsquo;ll walk you through current fees and any insurance or superbill options during your consultation, so there are no surprises. Please reach out with any billing questions, I&rsquo;m glad to help.']];


  // ---- PSYPACT participation map ------------------------------------------
  // Schematic tile-grid map of the US (one rounded square per state), shaded
  // with brand colors. Positions follow the standard equal-area tile layout.
  const US_GRID = {
    AK: [0, 0], ME: [0, 11],
    VT: [1, 10], NH: [1, 11],
    WA: [2, 1], ID: [2, 2], MT: [2, 3], ND: [2, 4], MN: [2, 5], WI: [2, 6], MI: [2, 7], NY: [2, 9], MA: [2, 10],
    OR: [3, 1], NV: [3, 2], WY: [3, 3], SD: [3, 4], IA: [3, 5], IL: [3, 6], IN: [3, 7], OH: [3, 8], PA: [3, 9], NJ: [3, 10], CT: [3, 11],
    CA: [4, 1], UT: [4, 2], CO: [4, 3], NE: [4, 4], MO: [4, 5], KY: [4, 6], WV: [4, 7], VA: [4, 8], MD: [4, 9], DE: [4, 10], RI: [4, 11],
    AZ: [5, 2], NM: [5, 3], KS: [5, 4], AR: [5, 5], TN: [5, 6], NC: [5, 7], SC: [5, 8], DC: [5, 9],
    OK: [6, 4], LA: [6, 5], MS: [6, 6], AL: [6, 7], GA: [6, 8],
    HI: [7, 0], TX: [7, 4], FL: [7, 9] };

  const US_NAMES = {
    AL: 'Alabama', AK: 'Alaska', AZ: 'Arizona', AR: 'Arkansas', CA: 'California', CO: 'Colorado',
    CT: 'Connecticut', DE: 'Delaware', DC: 'District of Columbia', FL: 'Florida', GA: 'Georgia',
    HI: 'Hawaii', ID: 'Idaho', IL: 'Illinois', IN: 'Indiana', IA: 'Iowa', KS: 'Kansas', KY: 'Kentucky',
    LA: 'Louisiana', ME: 'Maine', MD: 'Maryland', MA: 'Massachusetts', MI: 'Michigan', MN: 'Minnesota',
    MS: 'Mississippi', MO: 'Missouri', MT: 'Montana', NE: 'Nebraska', NV: 'Nevada', NH: 'New Hampshire',
    NJ: 'New Jersey', NM: 'New Mexico', NY: 'New York', NC: 'North Carolina', ND: 'North Dakota', OH: 'Ohio',
    OK: 'Oklahoma', OR: 'Oregon', PA: 'Pennsylvania', RI: 'Rhode Island', SC: 'South Carolina',
    SD: 'South Dakota', TN: 'Tennessee', TX: 'Texas', UT: 'Utah', VT: 'Vermont', VA: 'Virginia',
    WA: 'Washington', WV: 'West Virginia', WI: 'Wisconsin', WY: 'Wyoming' };

  const PSYPACT_STATES = new Set([
  'AL', 'AZ', 'AR', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'ID', 'IL', 'IN', 'KS', 'KY', 'ME', 'MD', 'MI',
  'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NC', 'ND', 'OH', 'OK', 'PA', 'RI', 'SC', 'SD', 'TN',
  'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY']);

  // Renders the PSYPACT coverage as a geographic tile map on wider screens and,
  // once it gets too small to read, a compact alphabetical grid of the same
  // states (toggled via the .cp-map-geo / .cp-map-grid media query).
  // `showIntro` toggles the lead paragraph; `center` centers it for the home slice.
  function PsypactMap({ showIntro = true, center = false }) {
    const swatch = (bg, border) =>
    <span style={{ width: 14, height: 14, borderRadius: 4, background: bg, flex: '0 0 auto',
      border: border ? '1px solid var(--border)' : '1px solid transparent', display: 'inline-block' }} />;

    const hover = {
      onMouseEnter: (e) => {e.currentTarget.style.transform = 'translateY(-2px)';e.currentTarget.style.filter = 'brightness(1.05)';},
      onMouseLeave: (e) => {e.currentTarget.style.transform = 'none';e.currentTarget.style.filter = 'none';}
    };
    // Shared per-state styling + tooltip, used by both the map and the grid.
    const cell = (ab) => {
      const part = PSYPACT_STATES.has(ab);
      const home = ab === 'TN';
      return {
        title: US_NAMES[ab] + (home ? ' — home practice' : part ? ' — participating' : ' — not yet in PSYPACT'),
        style: { aspectRatio: '1', borderRadius: 7, display: 'flex', alignItems: 'center', justifyContent: 'center',
          fontFamily: 'var(--font-body)', fontWeight: 700, letterSpacing: '0.01em', cursor: 'default',
          background: home ? 'var(--sand-300)' : part ? 'var(--blue-400)' : 'var(--cream-300)',
          color: home ? 'var(--slate-700)' : part ? '#fff' : 'var(--slate-300)',
          border: part || home ? '1px solid transparent' : '1px solid var(--border)',
          boxShadow: part || home ? 'var(--shadow-xs)' : 'none',
          transition: 'transform var(--dur-base) var(--ease-soft), filter var(--dur-base) var(--ease-soft)' }
      };
    };

    return (
      <div style={{ padding: center ? 0 : '0 26px 26px' }}>
        {showIntro &&
        <p style={{ margin: center ? '0 auto 20px' : '0 0 20px', textAlign: center ? 'center' : 'left',
          fontSize: 'var(--text-md)', lineHeight: 1.72, color: 'var(--text-body)', maxWidth: 640 }}>
          Through the Psychology Interjurisdictional Compact (PSYPACT), I can offer telehealth across
          <strong style={{ color: 'var(--text-strong)' }}> 43 participating states and jurisdictions</strong>,
          including Washington D.C. and the Northern Mariana Islands. The shaded squares below show where we can work together.
        </p>}

        {/* Geographic tile map (wider screens) */}
        <div className="cp-map-geo" style={{ display: 'grid', gridTemplateColumns: 'repeat(12, 1fr)', gap: 5,
          maxWidth: 540, margin: center ? '0 auto' : 0 }}>
          {Object.entries(US_GRID).map(([ab, [r, c]]) => {
            const { title, style } = cell(ab);
            return (
              <div key={ab} title={title} {...hover}
              style={{ ...style, gridColumnStart: c + 1, gridRowStart: r + 1, fontSize: 'clamp(7px, 1.4vw, 11px)' }}>
                {ab}
              </div>);
          })}
        </div>

        {/* Compact alphabetical grid (small screens) */}
        <div className="cp-map-grid" style={{ display: 'none', gridTemplateColumns: 'repeat(auto-fill, minmax(40px, 1fr))',
          gap: 6, maxWidth: 440, margin: center ? '0 auto' : 0 }}>
          {Object.keys(US_NAMES).sort().map((ab) => {
            const { title, style } = cell(ab);
            return <div key={ab} title={title} {...hover} style={{ ...style, fontSize: 12 }}>{ab}</div>;
          })}
        </div>

        <div style={{ display: 'flex', flexWrap: 'wrap', gap: '12px 22px', marginTop: 20, alignItems: 'center',
          justifyContent: center ? 'center' : 'flex-start',
          fontFamily: 'var(--font-body)', fontSize: 13.5, color: 'var(--text-body)' }}>
          <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>{swatch('var(--blue-400)')}Participating</span>
          <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>{swatch('var(--sand-300)')}Tennessee &middot; home practice</span>
          <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>{swatch('var(--cream-300)', true)}Not yet in PSYPACT</span>
        </div>
      </div>);

  }

  // ---- Telehealth coverage (home-page slice) ------------------------------
  function Telehealth() {
    return (
      <section style={{ background: 'var(--surface-accent)', padding: `${PY(96)} ${PX}` }}>
        <div className="wrap" style={{ padding: 0 }}>
          <SectionHead eyebrow="Telehealth"
          title="Meeting you wherever you are,"
          script="in 43 states"
          sub="I am licensed in Tennessee, and as a PSYPACT member I offer secure telehealth across 43 participating states and jurisdictions, so where you live is never a barrier to the care you deserve." />
          <div style={{ marginTop: 52 }}>
            <PsypactMap showIntro={false} center />
          </div>
        </div>
      </section>);

  }

  function FAQItem({ q, a, node, open, onToggle }) {
    const bodyRef = React.useRef(null);
    const [contentH, setContentH] = React.useState(0);
    React.useEffect(() => {
      const measure = () => {if (bodyRef.current) setContentH(bodyRef.current.scrollHeight);};
      measure();
      const t1 = setTimeout(measure, 60);
      const t2 = setTimeout(measure, 320);
      window.addEventListener('resize', measure);
      if (document.fonts && document.fonts.ready) {document.fonts.ready.then(measure);}
      return () => {window.removeEventListener('resize', measure);clearTimeout(t1);clearTimeout(t2);};
    }, [a, node, open]);
    return (
      <div style={{ background: 'var(--surface-card)', border: '1px solid var(--border)',
        borderRadius: 'var(--radius-lg)', boxShadow: open ? 'var(--shadow-md)' : 'var(--shadow-xs)',
        transition: 'box-shadow var(--dur-base) var(--ease-soft)', overflow: 'hidden' }}>
        <button onClick={onToggle} style={{ width: '100%', display: 'flex', alignItems: 'center',
          justifyContent: 'space-between', gap: 18, textAlign: 'left', cursor: 'pointer',
          background: 'transparent', border: 'none', padding: '22px clamp(18px, 5vw, 26px)',
          fontFamily: 'var(--font-display)', fontSize: 'clamp(18px, 4.6vw, 21px)', fontWeight: 600, color: 'var(--text-strong)' }}>
          <span>{q}</span>
          <span style={{ flex: '0 0 auto', color: 'var(--primary)', transition: 'transform var(--dur-base) var(--ease-soft)',
            transform: open ? 'rotate(180deg)' : 'none', display: 'inline-flex' }}>{Icons.chevron}</span>
        </button>
        <div style={{ maxHeight: open ? contentH : 0, transition: 'max-height var(--dur-slow) var(--ease-soft)', overflow: 'hidden' }}>
          <div ref={bodyRef}>
            {node ? node :
            <p style={{ margin: 0, padding: '0 26px 24px', fontSize: 'var(--text-md)', lineHeight: 1.72,
              color: 'var(--text-body)', maxWidth: 640 }} dangerouslySetInnerHTML={{ __html: a }}></p>}
          </div>
        </div>
      </div>);
  }

  function FAQPage() {
    const { Button } = DS;
    const [open, setOpen] = React.useState(0);
    return (
      <React.Fragment>
        <Header base="/" localContact />
        <main>
          <section id="top" style={{ background: 'var(--surface-accent)' }}>
            <div className="wrap" style={{ textAlign: 'center', padding: `${PY(84)} ${PX} ${PY(76)}`, maxWidth: 760 }}>
              <Eyebrow style={{ marginBottom: 18, color: 'var(--slate-500)' }}>Questions &amp; answers</Eyebrow>
              <h1 style={{ fontFamily: 'var(--font-display)', fontSize: 'var(--text-4xl)', fontWeight: 500,
                lineHeight: 1.05, color: 'var(--text-strong)', margin: 0 }}>It&rsquo;s okay to have</h1>
              <div style={{ fontFamily: 'var(--font-script)', fontSize: 'clamp(46px, 13vw, 78px)', color: 'var(--primary)',
                lineHeight: 0.95, margin: '4px 0 22px' }}>questions first</div>
              <p style={{ fontSize: 'var(--text-md)', lineHeight: 1.75, color: 'var(--text-body)', margin: '0 auto', maxWidth: 560 }}>
                A few of the things people often wonder before reaching out. If yours isn&rsquo;t here,
                please ask, there&rsquo;s no such thing as a question too small.
              </p>
            </div>
          </section>

          <section style={{ padding: `${PY(72)} ${PX} ${PY(84)}` }}>
            <div className="wrap" style={{ maxWidth: 820, padding: 0 }}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 14 }}>
                {FAQS.map(([q, a], i) =>
                <FAQItem key={i} q={q} a={a} node={/PSYPACT/.test(q) ? <PsypactMap /> : null} open={open === i} onToggle={() => setOpen(open === i ? -1 : i)} />
                )}
              </div>
              <div style={{ marginTop: 30, fontSize: 14, lineHeight: 1.6, color: 'var(--text-muted)',
                borderLeft: '3px solid var(--blue-300)', paddingLeft: 16, maxWidth: 820 }}>
                If you are in crisis, please call or text <strong style={{ color: 'var(--text-body)' }}>988</strong> for the
                Suicide &amp; Crisis Lifeline, or call 911. Therapy is not a substitute for emergency care.
              </div>
            </div>
          </section>

          <Contact variant="faq" />
        </main>
        <Footer base="/" localContact />
        <ContactModal />
      </React.Fragment>);

  }

  // ---- Getting started: 4-step process ------------------------------------
  const STEPS = [
  ['First, reach out', 'Send an email, make a phone call, or share a note below.'],
  ['A free consultation', 'We talk briefly, at no cost and no commitment, to see if we are a good fit.'],
  ['Schedule your first session', 'When you feel ready, we find a time that works and begin.'],
  ['Start down the\nCourageous Path', 'Together we make room for your whole story, no longer walk alone.']];


  function Process() {
    const [active, setActive] = React.useState(0);
    const fillPct = active * 25;

    // Scroll-driven connection: as the section passes through the viewport the
    // path fills step by step. Hover/click still override (they set active too).
    React.useEffect(() => {
      let raf = 0;
      const compute = () => {
        raf = 0;
        const ih = window.innerHeight;
        const hC = document.querySelectorAll('.cp-proc-h .cp-circle');
        const vC = document.querySelectorAll('.cp-proc-v .cp-circle');
        if (hC[0] && hC[0].offsetParent !== null) {
          const r = hC[0].getBoundingClientRect();
          const cy = r.top + r.height / 2;
          const start = ih * 0.82,end = ih * 0.42;
          let p = (start - cy) / (start - end);
          p = Math.max(0, Math.min(1, p));
          setActive(Math.round(p * 3));
        } else if (vC.length) {
          const trigger = ih * 0.66;
          let reached = 0;
          vC.forEach((n, i) => {const rr = n.getBoundingClientRect();if (rr.top + rr.height / 2 <= trigger) reached = i;});
          setActive(reached);
          // Size the vertical connector to span exactly first circle -> last circle.
          const wrap = document.querySelector('.cp-proc-v');
          const track = document.querySelector('.cp-vtrack');
          if (wrap && track && vC.length >= 2) {
            const wr = wrap.getBoundingClientRect();
            const f = vC[0].getBoundingClientRect();
            const l = vC[vC.length - 1].getBoundingClientRect();
            const top = f.top + f.height / 2 - wr.top;
            const bottom = l.top + l.height / 2 - wr.top;
            track.style.top = top + 'px';
            track.style.height = Math.max(0, bottom - top) + 'px';
            track.style.bottom = 'auto';
          }
        }
      };
      const onScroll = () => {if (!raf) raf = requestAnimationFrame(compute);};
      compute();
      const settle = setTimeout(compute, 350);
      if (document.fonts && document.fonts.ready) {document.fonts.ready.then(compute);}
      window.addEventListener('scroll', onScroll, { passive: true });
      window.addEventListener('resize', compute);
      let ro = null;
      const vWrap = document.querySelector('.cp-proc-v');
      if (window.ResizeObserver && vWrap) {
        ro = new ResizeObserver(compute);
        ro.observe(vWrap);
      }
      return () => {
        window.removeEventListener('scroll', onScroll);
        window.removeEventListener('resize', compute);
        clearTimeout(settle);
        if (ro) ro.disconnect();
        if (raf) cancelAnimationFrame(raf);
      };
    }, []);

    const handlers = (i) => ({
      onMouseEnter: () => setActive(i),
      onClick: () => setActive(i),
      onFocus: () => setActive(i),
      onKeyDown: (e) => {if (e.key === 'Enter' || e.key === ' ') {e.preventDefault();setActive(i);}},
      tabIndex: 0,
      role: 'button',
      'aria-label': STEPS[i][0]
    });

    const circle = (i, on, isActive) =>
    <div className="cp-circle" data-on={on ? '1' : '0'} data-active={isActive ? '1' : '0'}>
        <span style={{ fontFamily: 'var(--font-display)', fontSize: 30, fontWeight: 500, lineHeight: 1, display: 'block', fontVariantNumeric: 'lining-nums', fontFeatureSettings: '"lnum" 1', transform: 'translateY(-2px)' }}>{i + 1}</span>
      </div>;

    const heading = (name, on) =>
    <div style={{ fontFamily: 'var(--font-display)', fontSize: 19, fontWeight: 600, lineHeight: 1.2, whiteSpace: 'pre-line',
      color: on ? 'var(--primary-press)' : 'var(--text-strong)', marginBottom: 6 }}>{name}</div>;

    return (
      <section style={{ background: 'var(--surface-inset)', padding: `${PY(92)} ${PX}` }}>
        <div className="wrap" style={{ padding: 0 }}>
          <SectionHead eyebrow="Getting started"
          title="Your first steps,"
          script="one moment at a time"
          sub="Beginning care can feel like a lot. Here is how it gently unfolds, simply, and at your own pace." />

          {/* Horizontal (desktop / tablet) */}
          <div className="cp-proc-h" style={{ marginTop: 64 }}>
            <div className="cp-proc-callouts">
              {STEPS.map(([name, desc], i) =>
              <div key={i} className="cp-callout-cell" {...handlers(i)}>
                  <div className="cp-callout-card" data-on={i === active ? '1' : '0'}>
                    {heading(name, i === active)}
                    <p style={{ margin: 0, fontSize: 13.5, lineHeight: 1.55, color: 'var(--text-body)' }}>{desc}</p>
                  </div>
                  <div className="cp-pointer" data-on={i === active ? '1' : '0'} />
                </div>
              )}
            </div>
            <div className="cp-proc-circles">
              <div className="cp-track" />
              <div className="cp-track-fill" style={{ width: `${fillPct}%` }} />
              {STEPS.map((s, i) =>
              <div key={i} className="cp-circle-cell" {...handlers(i)}>
                  {circle(i, i <= active, i === active)}
                </div>
              )}
            </div>
          </div>

          {/* Vertical (mobile) */}
          <div className="cp-proc-v" style={{ marginTop: 48 }}>
            <div className="cp-vtrack" />
            {STEPS.map(([name, desc], i) =>
            <div key={i} className="cp-vstep" {...handlers(i)}>
                {circle(i, i <= active, i === active)}
                <div className="cp-callout-card" data-on={i === active ? '1' : '0'} style={{ flex: 1, textAlign: 'left' }}>
                  {heading(name, i === active)}
                  <p style={{ margin: 0, fontSize: 14, lineHeight: 1.55, color: 'var(--text-body)' }}>{desc}</p>
                </div>
              </div>
            )}
          </div>
        </div>
      </section>);

  }

  window.CPSite = { Header, Hero, Reassurance, Services, Telehealth, About, Quote, Process, Contact, Footer, ProPage, AboutPage, FAQPage, ContactModal };
})();