"use client";

import { usePathname } from "next/navigation";

import { PublicHeader } from "@/components/public-header";

// Public viewing surface — no auth, no app sidebar. The tree page (/p/<id>)
// wants the whole canvas like the member tree view; the person detail page
// reads better in a centered column.
export default function PublicLayout({ children }: { children: React.ReactNode }) {
  const pathname = usePathname();
  const fullWidth = /^\/p\/[^/]+$/.test(pathname);
  return (
    <div className="min-h-screen">
      <PublicHeader />
      <main className={fullWidth ? "w-full px-4 py-6 md:px-6" : "mx-auto max-w-5xl px-4 py-8"}>
        {children}
      </main>
    </div>
  );
}
