/* global React */
const stLink = { display:'inline-flex', alignItems:'center', gap:6, flexShrink:0, whiteSpace:'nowrap', color:'inherit', textDecoration:'none' };
const stSection = { padding:'72px var(--container-pad)' };
const stWrap = { maxWidth:'var(--container-max)', margin:'0 auto' };
const stKicker = { fontSize:12.5, fontWeight:700, letterSpacing:'.16em', textTransform:'uppercase', color:'var(--brand-accent)', margin:'0 0 10px' };
const stH2 = { fontSize:'var(--fs-display-md)', fontWeight:700, letterSpacing:'.03em', textTransform:'uppercase', lineHeight:1.2, color:'var(--text-primary)', margin:'0 0 14px' };
const stBody = { color:'var(--text-secondary)', fontSize:'var(--fs-body-lg)', lineHeight:'var(--lh-normal)', margin:0 };

function StructuresTopBar({ Icon, nap, groupLabel, groupHref }) {
  return (
    <React.Fragment>
      {groupLabel && <a href={groupHref || '#'} style={{ ...stLink, marginRight:'auto', fontWeight:700, letterSpacing:'.04em' }}><span aria-hidden="true">&larr;</span>{groupLabel}</a>}
      <a href={'https://wa.me/' + nap.wa} target="_blank" rel="noopener noreferrer" style={stLink}><Icon name="whatsapp" size={14} />{nap.phone}</a>
      <a data-top="opt" href={'mailto:' + nap.email} style={stLink}><Icon name="mail" size={14} />{nap.email}</a>
      <span data-top="opt2" style={stLink}>{nap.addressLine}</span>
    </React.Fragment>
  );
}

function StructuresTrust({ Icon, t }) {
  const items = (t.trust && t.trust.items) || [];
  const ic = ['shield', 'pin', 'gauge', 'check'];
  return (
    <section style={{ position:'relative', zIndex:2, background:'transparent', padding:'0 var(--container-pad)', marginTop:-36 }}>
      <div style={{ ...stWrap, background:'#fff', borderTop:'3px solid var(--brand-accent)', boxShadow:'var(--shadow-lg)', display:'grid', gridTemplateColumns:'repeat(auto-fit,minmax(215px,1fr))' }} data-grid="trust">
        {items.map((it, i) => (
          <div key={i} style={{ display:'flex', gap:13, alignItems:'flex-start', padding:'22px 24px', borderLeft:i ? '1px solid var(--border-subtle)' : 'none', minWidth:0 }}>
            <span style={{ color:'var(--brand-accent)', flexShrink:0, marginTop:1 }}><Icon name={ic[i] || 'check'} size={21} /></span>
            <div style={{ minWidth:0 }}>
              <p style={{ margin:0, fontSize:it.k.length > 14 ? 15 : 17.5, fontWeight:800, lineHeight:1.2, color:'var(--brand-primary)' }}>{it.k}</p>
              <p style={{ margin:'5px 0 0', fontSize:13.5, lineHeight:1.5, color:'var(--text-secondary)' }}>{it.v}</p>
            </div>
          </div>
        ))}
      </div>
    </section>
  );
}

function StructuresMobileBar({ Icon, t, nap }) {
  const m = t.mobileBar || { call:'Llamar', wa:'WhatsApp' };
  const cell = { flex:1, display:'flex', alignItems:'center', justifyContent:'center', gap:9, height:52, fontSize:15, fontWeight:700, textDecoration:'none', letterSpacing:'.02em' };
  return (
    <div data-st-mobilebar="1" style={{ position:'fixed', left:0, right:0, bottom:0, zIndex:60, boxShadow:'0 -6px 20px rgba(0,18,44,.3)' }}>
      <a href={nap.phoneHref} style={{ ...cell, background:'var(--brand-primary)', color:'#fff' }}><Icon name="phone" size={18} />{m.call}</a>
      <a href={'https://wa.me/' + nap.wa} target="_blank" rel="noopener noreferrer" style={{ ...cell, background:'#25D366', color:'#06341c' }}><Icon name="whatsapp" size={18} />{m.wa}</a>
    </div>
  );
}

function StructuresHero({ Button, t, onNav }) {
  const h = t.hero;
  return (
    <section style={{ position:'relative', background:'var(--gradient-hero)', color:'#fff', overflow:'hidden', clipPath:'polygon(0 0, 100% 0, 100% 90%, 0 100%)' }}>
      <img src="assets/photo-st-banner.jpg" alt="" aria-hidden="true" data-parallax="0.06" style={{ position:'absolute', inset:0, width:'100%', height:'100%', objectFit:'cover', opacity:.22 }} />
      <div style={{ position:'relative', ...stWrap, padding:'84px var(--container-pad) 120px', display:'grid', gridTemplateColumns:'minmax(0,1fr) minmax(0,440px)', gap:48, alignItems:'center' }} data-grid="hero">
        <div>
          <div style={{ display:'flex', alignItems:'center', gap:10, marginBottom:14 }}>
            <span style={{ width:34, height:2, background:'var(--brand-accent-light)' }} />
            <span style={{ fontSize:12.5, fontWeight:700, letterSpacing:'.18em', textTransform:'uppercase', color:'var(--brand-accent-light)' }}>{h.kicker}</span>
          </div>
          <h1 style={{ fontSize:'var(--fs-display-xl)', fontWeight:800, lineHeight:'var(--lh-tight)', letterSpacing:'var(--ls-tight)', margin:'0 0 18px', maxWidth:620 }}>{h.h1}</h1>
          <p style={{ fontSize:'var(--fs-body-lg)', color:'#fff', lineHeight:'var(--lh-normal)', maxWidth:520, margin:'0 0 30px' }}>{h.sub}</p>
          <div style={{ display:'flex', gap:18, flexWrap:'wrap', alignItems:'center' }}>
            <Button size="lg" onClick={() => onNav && onNav('contact')}>{h.ctaPrimary}</Button>
            <a href="#" onClick={(e) => { e.preventDefault(); onNav && onNav('services'); }} style={{ display:'inline-flex', alignItems:'center', gap:8, fontSize:14, fontWeight:700, letterSpacing:'.1em', textTransform:'uppercase', color:'var(--brand-accent-light)', textDecoration:'none', borderBottom:'1px solid rgba(0,172,249,.45)', paddingBottom:3 }}>{h.ctaSecondary}</a>
          </div>
        </div>
        <div style={{ position:'relative', width:'100%', maxWidth:420, justifySelf:'center', padding:14, background:'rgba(255,255,255,.07)', border:'1px solid rgba(0,172,249,.28)', boxShadow:'0 24px 60px rgba(0,18,44,.45), 0 0 0 1px rgba(255,255,255,.04) inset' }}>
          <span aria-hidden="true" style={{ position:'absolute', top:-1, left:-1, width:64, height:3, background:'var(--brand-accent)' }} />
          <img src="assets/logo-structures-lockup.png" alt={h.logoAlt || 'Canaan Structures LLC'} style={{ display:'block', width:'100%', height:'auto' }} />
        </div>
      </div>
    </section>
  );
}

function StructuresServices({ Icon, t, onNav, limit, exclude }) {
  const s = t.services;
  const skip = exclude || [];
  const pool = s.items.filter((it) => skip.indexOf(it.slug) === -1);
  const items = limit ? pool.slice(0, limit) : pool;
  return (
    <section style={{ ...stSection, background:'var(--surface-inverse)', backgroundImage:'var(--hatch-navy)', color:'#fff' }}>
      <div style={stWrap}>
        <p style={{ ...stKicker, color:'var(--brand-accent-light)' }}>{s.kicker}</p>
        <h2 style={{ ...stH2, color:'#fff' }}>{s.h1}</h2>
        <p style={{ ...stBody, color:'#fff', maxWidth:760 }}>{s.sub}</p>
        <ul style={{ margin:'44px 0 0', padding:0, listStyle:'none', borderTop:'3px solid var(--brand-accent)' }} data-grid="svc">
            {items.map((it, i) => {
              const dark = i % 2 === 1;
              const ink = dark ? '#fff' : '#14405F';
              const label = dark ? '#7FD3FB' : '#0F6E9E';
              const base = dark ? '15,54,85' : '247,250,252';
              return (
              <li key={it.slug} data-svc-row="1" data-surface={dark ? 'dark' : 'light'} style={{ position:'relative', overflow:'hidden', display:'grid', gridTemplateColumns:'50px minmax(0,268px) minmax(0,1fr) 150px', gap:22, alignItems:'start', padding:'32px 0 32px 34px', backgroundColor:'rgb(' + base + ')' }}>
                <span aria-hidden="true" data-svc-photo="1" style={{ position:'absolute', inset:0, backgroundImage:'url(' + (['assets/drawing-st-stairs.png','assets/drawing-st-roof.png','assets/drawing-st-gate.png'][i % 3]) + ')', backgroundSize:'cover', backgroundPosition:'center right', mixBlendMode:dark ? 'screen' : 'multiply', opacity:dark ? .5 : .6, maskImage:'linear-gradient(92deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 70%, rgba(0,0,0,.5) 84%, rgba(0,0,0,1) 100%)', WebkitMaskImage:'linear-gradient(92deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 70%, rgba(0,0,0,.5) 84%, rgba(0,0,0,1) 100%)', pointerEvents:'none' }} />
                <span aria-hidden="true" data-svc-bar="1" style={{ position:'absolute', left:0, top:0, bottom:0, width:3, background:'var(--brand-accent)', zIndex:2 }} />
                <span style={{ position:'relative', zIndex:1, paddingTop:5, fontSize:13, fontWeight:700, letterSpacing:'.18em', color:label }}>{'0' + (i + 1)}</span>
                <div style={{ position:'relative', zIndex:1, minWidth:0 }}>
                  <h3 style={{ margin:0, fontSize:19, fontWeight:700, lineHeight:1.3, color:ink }}>{it.title}</h3>
                  <span style={{ display:'block', marginTop:6, fontSize:11.5, fontWeight:700, letterSpacing:'.16em', textTransform:'uppercase', color:label }}>{it.kicker}</span>
                </div>
                <p style={{ position:'relative', zIndex:1, margin:0, paddingTop:3, fontSize:14.5, lineHeight:1.65, color:ink }}>{it.desc}</p>
              </li>
              );
            })}
          </ul>
        <div style={{ marginTop:40 }}>
          <a href="#" onClick={(e) => { e.preventDefault(); onNav && onNav('services'); }} style={{ fontSize:14, fontWeight:700, letterSpacing:'.1em', textTransform:'uppercase', color:'var(--brand-accent-light)', textDecoration:'none', display:'inline-flex', alignItems:'center', gap:9 }}>
            {s.ctaButton}<Icon name="arrowRight" size={18} />
          </a>
        </div>
      </div>
    </section>
  );
}

function StructuresGallery({ t }) {
  const g = t.gallery;
  const plans = g.plans || [];
  const caps = g.caps || [];
  const [i, setI] = React.useState(0);
  const [open, setOpen] = React.useState(0);
  const [hold, setHold] = React.useState(false);
  React.useEffect(() => {
    if (hold || plans.length < 2) return undefined;
    const id = setInterval(() => setI((v) => (v + 1) % plans.length), 6000);
    return () => clearInterval(id);
  }, [hold, plans.length]);
  const go = (n) => setI((n + plans.length) % plans.length);
  const cur = plans[i] || {};
  return (
    <section style={{ ...stSection, background:'#fff' }}>
      <div style={stWrap}>
        <p style={stKicker}>{g.kicker}</p>
        <h2 style={stH2}>{g.title}</h2>
        <p style={{ ...stBody, maxWidth:760 }}>{g.sub}</p>
        <div style={{ display:'grid', gridTemplateColumns:'minmax(0,1.05fr) minmax(0,1fr)', gap:'clamp(28px,4vw,52px)', alignItems:'start', marginTop:38 }} data-grid="gallery">
          <div onMouseEnter={() => setHold(true)} onMouseLeave={() => setHold(false)}>
            <div style={{ position:'relative', border:'1px solid rgba(98,141,173,.45)', padding:14, background:'#fff', boxShadow:'var(--shadow-lg)' }}>
              <span aria-hidden="true" style={{ position:'absolute', left:-1, top:-1, width:64, height:3, background:'var(--brand-accent-light)' }} />
              <div style={{ position:'relative', aspectRatio:'4 / 3', overflow:'hidden', background:'#fff', border:'1px solid rgba(98,141,173,.25)' }}>
                {plans.map((p, k) => (
                  <img key={k} src={p.img} alt={p.title} style={{ position:'absolute', inset:0, width:'100%', height:'100%', objectFit:'contain', opacity:k === i ? 1 : 0, transition:'opacity .5s ease' }} />
                ))}
              </div>
            </div>
            <div style={{ display:'flex', justifyContent:'space-between', alignItems:'flex-end', gap:16, marginTop:14 }}>
              <div style={{ minWidth:0 }}>
                <span style={{ display:'block', fontSize:16, fontWeight:700, color:'var(--brand-primary)' }}>{cur.title}</span>
                <span style={{ display:'block', marginTop:3, fontSize:12.5, fontWeight:700, letterSpacing:'.14em', textTransform:'uppercase', color:'var(--brand-steel)' }}>{cur.place}{cur.kind ? ' · ' + cur.kind : ''}</span>
              </div>
              <div style={{ display:'flex', gap:8, flexShrink:0 }}>
                <button type="button" data-st-arrow="1" onClick={() => go(i - 1)} aria-label={g.prev || 'Anterior'} style={{ width:42, height:42, display:'grid', placeItems:'center', border:'1px solid rgba(98,141,173,.5)', background:'#fff', color:'var(--brand-primary)', fontSize:16, cursor:'pointer' }}>&larr;</button>
                <button type="button" data-st-arrow="1" onClick={() => go(i + 1)} aria-label={g.next || 'Siguiente'} style={{ width:42, height:42, display:'grid', placeItems:'center', border:'1px solid rgba(98,141,173,.5)', background:'#fff', color:'var(--brand-primary)', fontSize:16, cursor:'pointer' }}>&rarr;</button>
              </div>
            </div>
          </div>
          <ul style={{ margin:0, padding:0, listStyle:'none', borderTop:'3px solid var(--brand-accent)' }}>
            {caps.map((c, k) => {
              const on = open === k;
              return (
                <li key={k} data-st-cap="1" data-open={on ? 'true' : 'false'} onClick={() => setOpen(k)} style={{ display:'grid', gridTemplateColumns:'44px minmax(0,1fr)', gap:16, padding:'20px 20px 20px 4px', paddingLeft:on ? 14 : 4, borderBottom:'1px solid rgba(98,141,173,.28)', background:on ? 'var(--color-st-navy-900)' : 'transparent', color:on ? '#fff' : 'var(--text-primary)', cursor:'pointer' }}>
                  <span style={{ paddingTop:3, fontSize:13, fontWeight:700, letterSpacing:'.18em', color:on ? 'var(--brand-accent-light)' : 'var(--brand-accent)' }}>{'0' + (k + 1)}</span>
                  <div style={{ minWidth:0 }}>
                    <h3 style={{ margin:0, fontSize:18, fontWeight:700, lineHeight:1.3 }}>{c.title}</h3>
                    <p style={{ margin:on ? '9px 0 0' : 0, fontSize:14.5, lineHeight:1.65, color:on ? 'rgba(255,255,255,.9)' : 'var(--text-secondary)', maxHeight:on ? 220 : 0, opacity:on ? 1 : 0, overflow:'hidden', transition:'max-height .32s ease, opacity .26s ease, margin .3s ease' }}>{c.desc}</p>
                  </div>
                </li>
              );
            })}
          </ul>
        </div>
      </div>
    </section>
  );
}

function StructuresPtCard({ it }) {
  const shots = it.imgs && it.imgs.length > 1 ? it.imgs : null;
  const [i, setI] = React.useState(0);
  const [hold, setHold] = React.useState(false);
  React.useEffect(() => {
    if (!shots || hold) return undefined;
    const id = setInterval(() => setI((v) => (v + 1) % shots.length), 5000);
    return () => clearInterval(id);
  }, [shots, hold]);
  return (
    <article onMouseEnter={() => setHold(true)} onMouseLeave={() => setHold(false)} style={{ background:'#fff', color:'var(--text-primary)', borderRadius:'var(--radius-lg)', overflow:'hidden', boxShadow:'var(--shadow-lg)', display:'flex', flexDirection:'column', minWidth:0 }}>
      {shots ? (
        <div style={{ position:'relative', width:'100%', aspectRatio:'4 / 3', background:'#EEF4F8', overflow:'hidden' }}>
          {shots.map((s, k) => (
            <img key={k} src={s.img} alt={it.title} style={{ position:'absolute', inset:0, width:'100%', height:'100%', objectFit:s.fit || 'cover', background:s.fit === 'contain' ? '#fff' : 'transparent', padding:s.fit === 'contain' ? 6 : 0, opacity:k === i ? 1 : 0, transition:'opacity .5s ease' }} />
          ))}
          {shots[i].cap && <span style={{ position:'absolute', left:10, bottom:10, background:'rgba(0,22,49,.82)', color:'#fff', fontSize:10.5, fontWeight:700, letterSpacing:'.14em', textTransform:'uppercase', padding:'5px 11px', borderRadius:999 }}>{shots[i].cap}</span>}
          <div style={{ position:'absolute', right:10, bottom:10, display:'flex', gap:6 }}>
            {shots.map((s, k) => (
              <button key={k} type="button" onClick={() => setI(k)} aria-label={(it.title || '') + ' ' + (k + 1)} style={{ width:8, height:8, padding:0, border:0, borderRadius:'50%', background:k === i ? 'var(--brand-accent-light)' : 'rgba(255,255,255,.55)', transform:k === i ? 'scale(1.25)' : 'none', boxShadow:'0 1px 3px rgba(0,18,44,.5)', cursor:'pointer', transition:'background .2s ease, transform .2s ease' }} />
            ))}
          </div>
        </div>
      ) : (
        <img src={it.img} alt={it.title} style={{ display:'block', width:'100%', aspectRatio:'4 / 3', objectFit:'cover' }} />
      )}
      <div style={{ padding:'20px 22px 24px', display:'flex', flexDirection:'column', gap:10 }}>
        <h3 style={{ margin:0, fontSize:17, fontWeight:700, lineHeight:1.3 }}>{it.title}</h3>
        <p style={{ margin:0, fontSize:14, lineHeight:1.6, color:'var(--text-secondary)' }}>{it.desc}</p>
      </div>
    </article>
  );
}

function StructuresProjectTypes({ t }) {
  const p = t.projectTypes;
  return (
    <section style={{ ...stSection, background:'var(--surface-inverse)', color:'#fff' }}>
      <div style={stWrap}>
        <p style={{ ...stKicker, color:'var(--brand-accent-light)' }}>{p.kicker}</p>
        <h2 style={{ ...stH2, color:'#fff', marginBottom:36 }}>{p.title}</h2>
        <div style={{ display:'grid', gridTemplateColumns:'repeat(auto-fit,minmax(230px,1fr))', gap:22 }} data-grid="ptypes">
          {p.items.map((it, i) => <StructuresPtCard key={i} it={it} />)}
        </div>
      </div>
    </section>
  );
}

function StructuresProcess({ t }) {
  const p = t.process;
  return (
    <section style={{ ...stSection, background:'#fff' }}>
      <div style={stWrap}>
        <p style={stKicker}>{p.kicker}</p>
        <h2 style={{ ...stH2, marginBottom:40 }}>{p.title}</h2>
        <ol style={{ margin:0, padding:0, listStyle:'none', display:'grid', gridTemplateColumns:'repeat(auto-fit,minmax(220px,1fr))', gap:28 }} data-grid="steps">
          {p.steps.map((s) => (
            <li key={s.n} style={{ display:'flex', flexDirection:'column', gap:12, minWidth:0 }}>
              <span style={{ width:52, height:52, borderRadius:'50%', background:'var(--brand-accent)', color:'#fff', display:'grid', placeItems:'center', fontSize:19, fontWeight:700, boxShadow:'var(--shadow-md)' }}>{s.n}</span>
              <h3 style={{ margin:0, fontSize:16.5, fontWeight:700, lineHeight:1.35, color:'var(--text-primary)' }}>{s.title}</h3>
              <p style={{ margin:0, fontSize:14.5, lineHeight:1.6, color:'var(--text-secondary)' }}>{s.desc}</p>
            </li>
          ))}
        </ol>
      </div>
    </section>
  );
}

function StructuresWhy({ Button, Icon, t, onNav }) {
  const w = t.why;
  const icons = ['gauge', 'chart', 'users', 'pin'];
  return (
    <section style={{ background:'#fff' }}>
      <div style={{ display:'grid', gridTemplateColumns:'repeat(auto-fit,minmax(320px,1fr))' }} data-grid="why">
        <div style={{ padding:'clamp(36px,6vw,72px) var(--container-pad)', display:'flex', flexDirection:'column', justifyContent:'center', gap:18 }}>
          <h2 style={{ ...stH2, margin:0 }}>{w.title}</h2>
          <p style={{ ...stBody, maxWidth:480 }}>{w.sub}</p>
          <div><Button onClick={() => onNav && onNav('contact')}>{w.cta}</Button></div>
        </div>
        <div style={{ background:'var(--brand-primary)', color:'#fff', padding:'clamp(36px,6vw,72px) var(--container-pad)', display:'flex', flexDirection:'column', justifyContent:'center', gap:22 }}>
          {w.statsTitle && <p style={{ margin:0, fontSize:11.5, fontWeight:700, letterSpacing:'.18em', textTransform:'uppercase', color:'var(--brand-accent-light)' }}>{w.statsTitle}</p>}
          {w.stats.map((s, i) => (
            <div key={i} style={{ display:'flex', alignItems:'center', gap:18, paddingBottom:i < w.stats.length - 1 ? 22 : 0, borderBottom:i < w.stats.length - 1 ? '1px solid rgba(255,255,255,.26)' : 'none' }}>
              <span style={{ width:48, height:48, borderRadius:12, background:'rgba(255,255,255,.18)', display:'grid', placeItems:'center', flexShrink:0 }}>
                <Icon name={icons[i] || 'check'} size={24} />
              </span>
              <div style={{ minWidth:0 }}>
                <p style={{ margin:0, fontSize:s.k.length > 5 ? 22 : 30, fontWeight:800, lineHeight:1.1, letterSpacing:'-.01em' }}>{s.k}</p>
                <p style={{ margin:'4px 0 0', fontSize:14, color:'#fff', lineHeight:1.5 }}>{s.v}</p>
              </div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function StructuresProjects({ t, limit }) {
  const p = t.projects;
  const items = limit ? p.items.slice(0, limit) : p.items;
  return (
    <section style={{ ...stSection, background:'var(--surface-alt)' }}>
      <div style={stWrap}>
        <p style={stKicker}>{p.kicker}</p>
        <h2 style={{ ...stH2, marginBottom:36 }}>{p.h1}</h2>
        <div style={{ display:'grid', gridTemplateColumns:'repeat(auto-fit,minmax(260px,1fr))', gap:22 }} data-grid="projects">
          {items.map((it, i) => (
            <figure key={i} style={{ margin:0, background:'#fff', borderRadius:'var(--radius-lg)', overflow:'hidden', boxShadow:'var(--shadow-sm)', display:'flex', flexDirection:'column', minWidth:0 }}>
              <img src={it.img} alt={it.title} style={{ display:'block', width:'100%', aspectRatio:'4 / 3', objectFit:'cover' }} />
              <figcaption style={{ padding:'20px 22px 24px', display:'flex', flexDirection:'column', gap:8 }}>
                <span style={{ fontSize:11.5, fontWeight:700, letterSpacing:'.14em', textTransform:'uppercase', color:'var(--brand-accent)' }}>{it.place}</span>
                <h3 style={{ margin:0, fontSize:17, fontWeight:700, lineHeight:1.3, color:'var(--text-primary)' }}>{it.title}</h3>
                <p style={{ margin:0, fontSize:14, lineHeight:1.6, color:'var(--text-secondary)' }}>{it.desc}</p>
              </figcaption>
            </figure>
          ))}
        </div>
      </div>
    </section>
  );
}

function StructuresCta({ Button, t, onNav }) {
  const s = t.services;
  return (
    <section style={{ position:'relative', background:'var(--gradient-hero)', backgroundImage:'var(--hatch-navy), var(--gradient-hero)', color:'#fff', overflow:'hidden' }}>
      <img src="assets/pattern-st-blueprint.png" alt="" aria-hidden="true" style={{ position:'absolute', right:0, top:0, height:'100%', width:'auto', opacity:.16 }} />
      <div style={{ position:'relative', ...stWrap, padding:'72px var(--container-pad)', display:'flex', gap:36, alignItems:'center', flexWrap:'wrap', justifyContent:'space-between' }}>
        <div style={{ maxWidth:560 }}>
          <h2 style={{ ...stH2, color:'#fff', margin:'0 0 10px' }}>{s.ctaTitle}</h2>
          <p style={{ margin:0, fontSize:'var(--fs-body-lg)', color:'#fff', lineHeight:'var(--lh-normal)' }}>{s.ctaSub}</p>
        </div>
        <a data-st-cta="1" href="#" onClick={(e) => { e.preventDefault(); onNav && onNav('contact'); }} style={{ display:'inline-block', padding:'18px 40px', border:'2px solid var(--brand-accent-light)', color:'var(--brand-accent-light)', background:'rgba(0,172,249,.06)', boxShadow:'0 0 22px rgba(0,172,249,.35), inset 0 0 18px rgba(0,172,249,.12)', fontSize:15.5, fontWeight:700, letterSpacing:'.14em', textTransform:'uppercase', textDecoration:'none' }}>{s.ctaButton}</a>
      </div>
    </section>
  );
}

function StructuresFooter({ Icon, t, nap, onNav, urls }) {
  const f = t.footer;
  const year = new Date().getFullYear();
  const colTitle = { fontSize:11.5, fontWeight:700, letterSpacing:'.16em', textTransform:'uppercase', color:'var(--brand-accent-light)', margin:'0 0 14px' };
  const rowLink = { display:'flex', alignItems:'center', gap:8, fontSize:13.5, lineHeight:1.7, color:'rgba(255,255,255,.92)', textDecoration:'none', overflowWrap:'anywhere' };
  return (
    <footer style={{ background:'var(--surface-inverse)', color:'#fff', fontFamily:'var(--font-body)', padding:'clamp(36px,7vw,56px) var(--container-pad) 0', position:'relative', overflow:'hidden' }}>
      <img src="assets/pattern-st-blueprint.png" alt="" aria-hidden="true" style={{ position:'absolute', right:0, top:0, height:'100%', width:'auto', opacity:.1, pointerEvents:'none' }} />
      <div style={{ position:'relative', ...stWrap, display:'grid', gridTemplateColumns:'repeat(auto-fit,minmax(220px,1fr))', gap:36, alignItems:'start' }} data-grid="footer">
        <div style={{ display:'flex', flexDirection:'column', gap:14 }}>
          <img src="assets/logo-structures-lockup.png" alt="Canaan Structures LLC — Engineering Without Limits" style={{ width:'100%', maxWidth:300, height:'auto', display:'block' }} />
          <p style={{ margin:0, fontSize:13.5, lineHeight:1.7, color:'rgba(255,255,255,.85)', maxWidth:300 }}>{f.blurb}</p>
        </div>
        <nav aria-label={f.navTitle}>
          <p style={colTitle}>{f.navTitle}</p>
          <div style={{ display:'flex', flexDirection:'column', gap:9 }}>
            {t.nav.map((l) => (
              <a key={l} href={urls[t.navMap[l]] || '#'} onClick={(e) => { if (onNav) { e.preventDefault(); onNav(t.navMap[l]); } }} style={{ color:'rgba(255,255,255,.82)', textDecoration:'none', fontSize:14 }}>{l}</a>
            ))}
            <a href={urls.group} style={{ color:'var(--brand-accent-light)', textDecoration:'none', fontSize:14, fontWeight:700, marginTop:4 }}><span aria-hidden="true">&larr;</span> {t.groupLink}</a>
          </div>
        </nav>
        <nav aria-label={f.servicesTitle}>
          <p style={colTitle}>{f.servicesTitle}</p>
          <div style={{ display:'flex', flexDirection:'column', gap:9 }}>
            {t.services.items.filter((it) => ['shop-drawings-calculos','shop-drawings-calculations','tramite-de-permisos','permit-running','legalizacion-as-built','legalization-as-built','renderings'].indexOf(it.slug) !== -1).map((it) => (
              <a key={it.slug} href={urls.services} onClick={(e) => { if (onNav) { e.preventDefault(); onNav('services'); } }} style={{ color:'rgba(255,255,255,.82)', textDecoration:'none', fontSize:14 }}>{it.title}</a>
            ))}
          </div>
        </nav>
        <div>
          <p style={colTitle}>{f.contactTitle}</p>
          <div style={{ display:'flex', flexDirection:'column', gap:4 }}>
            <a href={'https://wa.me/' + nap.wa} target="_blank" rel="noopener noreferrer" style={rowLink}><Icon name="whatsapp" size={15} />{nap.phone}</a>
            <a href={'mailto:' + nap.email} style={rowLink}><Icon name="mail" size={15} />{nap.email}</a>
            <span style={rowLink}><Icon name="pin" size={15} />{nap.addressLine}</span>
          </div>
        </div>
      </div>
      <div style={{ position:'relative', ...stWrap, marginTop:40, borderTop:'1px solid rgba(255,255,255,.14)', padding:'18px 0 24px', display:'flex', justifyContent:'space-between', gap:16, flexWrap:'wrap', fontSize:12.5, color:'rgba(255,255,255,.62)' }}>
        <span>© {year} Canaan Structures LLC. {f.rights}</span>
        <span style={{ color:'var(--brand-accent-light)', fontWeight:600, letterSpacing:'.14em', textTransform:'uppercase' }}>In God We Trust</span>
      </div>
    </footer>
  );
}

function StructuresHome({ Button, Icon, NavBar, t, nap, onNav, urls }) {
  return (
    <div data-brand="structures" data-page="structures" data-page-auto="1" style={{ fontFamily:'var(--font-body)', background:'#fff' }}>
      <NavBar
        logo={<span style={{ display:'flex', alignItems:'center', gap:11, minWidth:0 }}>
          <img src="assets/logo-structures-mark.png" alt="" style={{ height:44, width:'auto', display:'block', borderRadius:8 }} />
          <span style={{ fontSize:13.5, fontWeight:800, letterSpacing:'.05em', color:'var(--brand-primary)', lineHeight:1.15, whiteSpace:'nowrap' }}>CANAAN STRUCTURES LLC</span>
        </span>}
        links={t.nav}
        hrefs={t.nav.map((l) => urls[t.navMap[l]] || '#')}
        active={t.nav[0]}
        onNavigate={(l) => onNav && onNav(t.navMap[l])}
        cta={<Button size="sm" onClick={() => onNav && onNav('contact')}>{t.quoteShort}</Button>}
        topBar={<StructuresTopBar Icon={Icon} nap={nap} groupLabel={t.groupLink} groupHref={urls.group} />}
      />
      <StructuresHero Button={Button} t={t} onNav={onNav} />
      <StructuresTrust Icon={Icon} t={t} />
      <StructuresServices Icon={Icon} t={t} onNav={onNav} limit={4} exclude={['patios-y-deckings','patios-and-deckings','levantamiento-y-medicion','survey-site-measurement','obra-nueva','new-construction']} />
      <StructuresGallery t={t} />
      <StructuresProjectTypes t={t} />
      <StructuresProcess t={t} />
      <StructuresWhy Button={Button} Icon={Icon} t={t} onNav={onNav} />
      <StructuresProjects t={t} limit={3} />
      <StructuresCta Button={Button} t={t} onNav={onNav} />
      <StructuresFooter Icon={Icon} t={t} nap={nap} onNav={onNav} urls={urls} />
      <StructuresMobileBar Icon={Icon} t={t} nap={nap} />
    </div>
  );
}

Object.assign(window, { StructuresHome, StructuresPtCard, StructuresTopBar, StructuresHero, StructuresTrust, StructuresMobileBar, StructuresServices, StructuresGallery, StructuresProjectTypes, StructuresProcess, StructuresWhy, StructuresProjects, StructuresCta, StructuresFooter });
