1import{r as l,j as I,u as C,a as e,b as g,L as v,X as O}from"./index-OZBwOq0W.js";import{u as R,S as T,M as z,a as q}from"./Footer-Bl-kUtxI.js";function V({title:r,description:c,canonicalPath:n,ogImage:i="https://joaotome.com/meta.png"}){l.useEffect(()=>{const h=`https://joaotome.com${n}`;document.title=r;const o=(f,x)=>{const m=document.querySelector(f);m&&m.setAttribute(m.hasAttribute("content")?"content":"href",x)};o('meta[name="description"]',c),o('link[rel="canonical"]',h),o('meta[property="og:title"]',r),o('meta[property="og:description"]',c),o('meta[property="og:url"]',h),o('meta[property="og:image"]',i),o('meta[name="twitter:title"]',r),o('meta[name="twitter:description"]',c),o('meta[name="twitter:image"]',i)},[r,c,n,i])}const L=[{label:"Home",href:"/"},{label:"Writing",href:"/writing"},{label:"Projects",href:"/#projects"},{label:"TWiN",href:"/#twin"},{label:"About",href:"/about"},{label:"Contact",href:"/#contact"}],D=["home","writing","projects","twin","about-teaser","contact"],B={"/":"home","/#projects":"projects","/#twin":"twin","/#contact":"contact"};function K(r,c,n){if(!r.includes("#")&&r!=="/")return c===r;if(c!=="/")return!1;const i=B[r];return i?n===i:r==="/"?n==="home"||n==="":!1}const Z=()=>{const[r,c]=l.useState(!1),[n,i]=l.useState(!1),[w,h]=l.useState(""),o=R(),{resolvedTheme:f,setTheme:x}=I(),[m,A]=l.useState(!1),p=C(),j=l.useRef(null),y=l.useRef(null);l.useEffect(()=>{A(!0)},[]),l.useEffect(()=>{let t=!1;const s=()=>{t||(t=!0,requestAnimationFrame(()=>{c(d=>{const u=window.scrollY>20;return d===u?d:u}),t=!1}))};return window.addEventListener("scroll",s,{passive:!0}),()=>window.removeEventListener("scroll",s)},[]),l.useEffect(()=>{if(p.pathname!=="/"){h("");return}const t=[];return D.forEach(s=>{const d=document.getElementById(s);if(!d)return;const u=new IntersectionObserver(([a])=>{a.isIntersecting&&h(s)},{rootMargin:"-40% 0px -55% 0px",threshold:0});u.observe(d),t.push(u)}),()=>t.forEach(s=>s.disconnect())},[p.pathname]),l.useEffect(()=>{if(!n||!o)return;const t=document.body.style.overflow;document.body.style.overflow="hidden";const s=y.current,d=window.setTimeout(()=>{var a;(a=s==null?void 0:s.querySelector("a"))==null||a.focus()},0),u=a=>{var M;if(a.key==="Escape"){a.preventDefault(),i(!1),(M=j.current)==null||M.focus();return}if(a.key!=="Tab"||!s)return;const b=[...s.querySelectorAll("a")];if(!b.length)return;const N=b[0],S=b[b.length-1];a.shiftKey&&document.activeElement===N?(a.preventDefault(),S.focus()):!a.shiftKey&&document.activeElement===S&&(a.preventDefault(),N.focus())};return document.addEventListener("keydown",u),()=>{window.clearTimeout(d),document.removeEventListener("keydown",u),document.body.style.overflow=t}},[o,n]);const k=()=>x(f==="dark"?"light":"dark"),E=f==="dark"?"Switch to light mode":"Switch to dark mode";return e.jsxs(e.Fragment,{children:[e.jsx("header",{className:g("fixed top-0 left-0 w-full z-[70] transition-[background-color,box-shadow] duration-300 ease-in-out py-4 px-6 md:px-12",r?"bg-background/90 backdrop-blur-md shadow-sm":"bg-transparent"),style:{transform:"translateZ(0)",WebkitTransform:"translateZ(0)"},children:e.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[e.jsxs(v,{to:"/",className:"text-xl font-serif font-bold text-foreground",children:["João",e.jsx("span",{className:"text-cloudflare",children:"Tomé"})]}),e.jsxs("nav",{className:"hidden md:flex items-center space-x-8",children:[L.map(t=>e.jsx(v,{to:t.href,className:g("nav-link",K(t.href,p.pathname,w)&&"text-foreground font-medium"),children:t.label},t.href)),m&&e.jsx("button",{onClick:k,className:"p-2 rounded-lg hover:bg-secondary transition-colors","aria-label":E,children:f==="dark"?e.jsx(T,{size:20}):e.jsx(z,{size:20})})]}),e.jsxs("div",{className:"md:hidden flex items-center gap-2",children:[m&&e.jsx("button",{onClick:k,className:"p-2 rounded-lg hover:bg-secondary transition-colors text-foreground","aria-label":E,children:f==="dark"?e.jsx(T,{size:20}):e.jsx(z,{size:20})}),e.jsx("button",{ref:j,className:"text-foreground hover:text-cloudflare focus:outline-none",onClick:()=>i(!n),"aria-label":n?"Close menu":"Open menu","aria-expanded":n,"aria-controls":"mobile-navigation",children:n?e.jsx(O,{size:24}):e.jsx(q,{size:24})})]})]})}),o&&e.jsx("div",{id:"mobile-navigation",ref:y,className:g("fixed inset-0 z-[60] bg-background pt-20 transition-[transform,visibility] duration-300 ease-in-out",n?"translate-x-0 visible":"translate-x-full invisible pointer-events-none"),"aria-hidden":!n,children:e.jsx("nav",{className:"flex flex-col items-center space-y-8 p-8",children:L.map(t=>e.jsx(v,{to:t.href,onClick:()=>i(!1),tabIndex:n?0:-1,className:"text-lg font-medium text-foreground hover:text-cloudflare transition-colors",children:t.label},t.href))})})]})};export{Z as V,V as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.