// Direction 1 — DÍLNA
// Editorial / craft. Paper-cream background, deep walnut accents,
// big Fraunces display, generous white space. References: deVOL,
// Plain English, a more confident reading of Czech artisan.

// Hex helper — mix two hex colors for derived shades.
const _mix = (hex, target, amount) => {
  const h = hex.replace('#', '');
  const t = target.replace('#', '');
  const r = Math.round(parseInt(h.slice(0, 2), 16) * (1 - amount) + parseInt(t.slice(0, 2), 16) * amount);
  const g = Math.round(parseInt(h.slice(2, 4), 16) * (1 - amount) + parseInt(t.slice(2, 4), 16) * amount);
  const b = Math.round(parseInt(h.slice(4, 6), 16) * (1 - amount) + parseInt(t.slice(4, 6), 16) * amount);
  return '#' + [r, g, b].map(x => x.toString(16).padStart(2, '0')).join('');
};

// Hardcoded — Dílna je classic artisan cream + deep walnut. NE pull z BRAND.palette
// (Vacek scrape ukázal: light-cyan paper z JPG loga + green primary → kompletní vizuální chaos)
const dilnaTokens = {
  paper: '#F2EBDC',                  // cream paper (deVOL-style)
  paperDeep: _mix('#F2EBDC', '#000000', 0.06),
  ink: '#1F1810',
  ink2: '#3D2F22',
  walnut: '#5C3A1F',                 // deep walnut
  walnutLight: _mix('#5C3A1F', '#FFFFFF', 0.25),
  brand: '#A02122',                  // deep terracotta-red
  brandDeep: _mix('#A02122', '#000000', 0.2),
  rule: '#1F18101A',
  tagline: BRAND.tagline || (BRAND.since ? `Rodinné truhlářství od roku ${BRAND.since}${BRAND.location ? ' · ' + BRAND.location : ''}` : (BRAND.location ? `Rodinné truhlářství · ${BRAND.location}` : 'Rodinné truhlářství')),
};

// ============================================================================
// DESKTOP — 1440 wide
// ============================================================================
const DilnaDesktop = ({ tweaks }) => {
  const t = dilnaTokens;
  const heroLayout = tweaks?.heroLayout || 'full-photo';
  const portfolioStyle = tweaks?.portfolioStyle || 'editorial';
  const [filter, setFilter] = React.useState('all');
  const filtered = filter === 'all' ? PROJECTS : PROJECTS.filter(p => p.cat === filter);

  return (
    <div style={{
      width: 1440, fontFamily: '"Inter", -apple-system, sans-serif',
      color: t.ink, background: t.paper, fontFeatureSettings: '"ss01", "cv11"',
    }}>
      {/* NAV */}
      <DilnaNav t={t} />

      {/* HERO */}
      {heroLayout === 'full-photo' && <DilnaHeroFull t={t} />}
      {heroLayout === 'split' && <DilnaHeroSplit t={t} />}
      {heroLayout === 'typographic' && <DilnaHeroType t={t} />}

      {/* CO DĚLÁME */}
      <section style={{ padding: '120px 96px 80px', borderTop: `1px solid ${t.rule}` }}>
        <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', marginBottom: 72 }}>
          <div>
            <div style={{ ...kicker, color: t.walnut }}>I · Co děláme</div>
            <h2 style={{ ...display(72, t), maxWidth: 820, margin: '16px 0 0' }}>
              Nábytek na míru, který přečká <em style={{ fontStyle: 'italic', color: t.brand }}>generace</em>.
            </h2>
          </div>
          <div style={{ ...body(t), maxWidth: 320, lineHeight: 1.6 }}>
            Pracujeme s opravdovým dřevem. Od první návštěvy
            až po montáž je u Vás vždy jeden řemeslník.
          </div>
        </div>

        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 4 }}>
          {CATEGORIES.map((c, i) => (
            <a key={c.id} href={`#${c.id}`} style={{
              position: 'relative', aspectRatio: '4 / 5', overflow: 'hidden',
              textDecoration: 'none', color: 'inherit', cursor: 'pointer',
              background: t.paperDeep,
            }}>
              <Img src={c.img} alt={c.label} tone={t.walnutLight} style={{ position: 'absolute', inset: 0 }} />
              <div style={{
                position: 'absolute', inset: 0,
                background: 'linear-gradient(180deg, transparent 40%, rgba(31,24,16,.7) 100%)',
              }} />
              <div style={{ position: 'absolute', bottom: 0, left: 0, right: 0, padding: '32px 28px', color: t.paper }}>
                <div style={{ fontSize: 12, letterSpacing: '.18em', textTransform: 'uppercase', opacity: .7, marginBottom: 8 }}>
                  {String(i + 1).padStart(2, '0')} / {String(CATEGORIES.length).padStart(2, '0')}
                </div>
                <div style={{ fontFamily: '"Fraunces", serif', fontSize: 36, fontWeight: 400, letterSpacing: '-0.01em', lineHeight: 1 }}>
                  {c.label}
                </div>
                <div style={{ fontSize: 14, marginTop: 8, opacity: .85 }}>{c.short}</div>
              </div>
            </a>
          ))}
        </div>
      </section>

      {/* REALIZACE */}
      <section style={{ padding: '120px 96px', background: t.paperDeep, borderTop: `1px solid ${t.rule}` }}>
        <div style={{ display: 'flex', alignItems: 'flex-end', justifyContent: 'space-between', marginBottom: 56 }}>
          <div>
            <div style={{ ...kicker, color: t.walnut }}>II · Realizace</div>
            <h2 style={{ ...display(72, t), margin: '16px 0 0' }}>
              Vybráno z dílny.
            </h2>
          </div>
          <div style={{ display: 'flex', gap: 4, flexWrap: 'wrap', maxWidth: 600, justifyContent: 'flex-end' }}>
            {FILTERS.map(f => (
              <button key={f.id} onClick={() => setFilter(f.id)} style={{
                padding: '10px 18px', borderRadius: 999, cursor: 'pointer',
                border: `1px solid ${filter === f.id ? t.ink : t.rule}`,
                background: filter === f.id ? t.ink : 'transparent',
                color: filter === f.id ? t.paper : t.ink,
                fontFamily: 'inherit', fontSize: 13, letterSpacing: '.02em',
                transition: 'all .15s',
              }}>{f.label}</button>
            ))}
          </div>
        </div>

        <DilnaPortfolio items={filtered} style={portfolioStyle} t={t} />
      </section>

      {/* O NÁS */}
      <section style={{ padding: '140px 96px', borderTop: `1px solid ${t.rule}` }}>
        <div style={{ display: 'grid', gridTemplateColumns: '5fr 6fr', gap: 96, alignItems: 'center' }}>
          <div style={{ position: 'relative' }}>
            <Img
              src={BRAND.ownerPhoto}
              alt={BRAND.owner} tone={t.walnut}
              style={{ aspectRatio: '4 / 5', width: '100%' }}
            />
            <div style={{
              position: 'absolute', bottom: -24, left: -24,
              background: t.paper, padding: '20px 28px',
              fontFamily: '"Fraunces", serif', fontStyle: 'italic',
              fontSize: 18, color: t.walnut,
            }}>
              „{BRAND.owner}, truhlář"
            </div>
          </div>
          <div>
            <div style={{ ...kicker, color: t.walnut }}>III · O nás</div>
            <h2 style={{ ...display(60, t), margin: '16px 0 32px' }}>
              Menší rodinná firma. <br />
              <em style={{ fontStyle: 'italic', color: t.walnut }}>Skuteční výrobci.</em>
            </h2>
            <p style={{ ...body(t), fontSize: 18, lineHeight: 1.65, maxWidth: 520, marginBottom: 24 }}>
              Působíme na trhu už několik let. Vážíme si každého zákazníka,
              ale především jsme skuteční výrobci s vlastní dílnou{BRAND.location ? ` v ${BRAND.location}` : ''}.
            </p>
            <p style={{ ...body(t), fontSize: 18, lineHeight: 1.65, maxWidth: 520, marginBottom: 40 }}>
              Vyrábíme kuchyňské linky a kompletní vybavení interiérů.
              Dále pak pergoly, přístřešky a zahradní domky. Veškeré fotografie
              na našem webu dokumentují výhradně naši práci.
            </p>
            <div style={{ display: 'flex', gap: 48, paddingTop: 32, borderTop: `1px solid ${t.rule}` }}>
              {(BRAND.stats.length ? BRAND.stats : [
                ['vlastní', 'dílna a sklad'],
                ['5 let', 'záruka'],
              ]).map(([big, small]) => (
                <div key={big}>
                  <div style={{ fontFamily: '"Fraunces", serif', fontSize: 36, color: t.walnut, lineHeight: 1 }}>{big}</div>
                  <div style={{ fontSize: 13, marginTop: 6, color: t.ink2 }}>{small}</div>
                </div>
              ))}
            </div>
          </div>
        </div>
      </section>

      {/* KONTAKT */}
      <section style={{ padding: '120px 96px 80px', background: t.ink, color: t.paper }}>
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 96 }}>
          <div>
            <div style={{ ...kicker, color: t.walnutLight, opacity: 1 }}>IV · Kontakt</div>
            <h2 style={{ ...display(72, t), color: t.paper, margin: '16px 0 32px' }}>
              Pojďte<br />s námi <em style={{ fontStyle: 'italic', color: t.walnutLight }}>navrhnout</em>.
            </h2>
            <p style={{ fontSize: 18, lineHeight: 1.6, maxWidth: 440, opacity: .75, marginBottom: 48 }}>
              Zavolejte, napište nebo přijeďte do dílny. První konzultace
              a cenová nabídka jsou zdarma.
            </p>

            <div style={{ display: 'flex', flexDirection: 'column', gap: 20, fontSize: 16 }}>
              <div style={{ display: 'flex', alignItems: 'flex-start', gap: 16 }}>
                <Icon name="phone" color={t.walnutLight} />
                <div>
                  <div style={{ fontSize: 12, opacity: .6, letterSpacing: '.1em', textTransform: 'uppercase', marginBottom: 4 }}>Telefon</div>
                  <a href={`tel:${BRAND.phone}`} style={{ color: t.paper, textDecoration: 'none', fontFamily: '"Fraunces", serif', fontSize: 24 }}>{BRAND.phoneDisplay}</a>
                </div>
              </div>
              <div style={{ display: 'flex', alignItems: 'flex-start', gap: 16 }}>
                <Icon name="mail" color={t.walnutLight} />
                <div>
                  <div style={{ fontSize: 12, opacity: .6, letterSpacing: '.1em', textTransform: 'uppercase', marginBottom: 4 }}>E-mail</div>
                  <a href={`mailto:${BRAND.email}`} style={{ color: t.paper, textDecoration: 'none', fontFamily: '"Fraunces", serif', fontSize: 20 }}>{BRAND.email}</a>
                </div>
              </div>
              <div style={{ display: 'flex', alignItems: 'flex-start', gap: 16 }}>
                <Icon name="pin" color={t.walnutLight} />
                <div>
                  <div style={{ fontSize: 12, opacity: .6, letterSpacing: '.1em', textTransform: 'uppercase', marginBottom: 4 }}>Dílna</div>
                  <div style={{ fontFamily: '"Fraunces", serif', fontSize: 20 }}>{BRAND.address}</div>
                </div>
              </div>
            </div>
          </div>

          <DilnaForm t={t} />
        </div>

        <div style={{
          marginTop: 96, paddingTop: 32, borderTop: `1px solid ${t.paper}22`,
          display: 'flex', justifyContent: 'space-between', alignItems: 'center', fontSize: 12, opacity: .6, letterSpacing: '.08em', textTransform: 'uppercase',
        }}>
          <div>© {BRAND.name}, {BRAND.location} · 2026</div>
          <div>Návrh & realizace dílny</div>
        </div>
      </section>
    </div>
  );
};

// ── Hero variants ──────────────────────────────────────────────────────────
const DilnaHeroFull = ({ t }) => (
  <section style={{ position: 'relative', height: 820, overflow: 'hidden' }}>
    <Img
      src={BRAND.heroPhoto}
      alt={`Hero — ${BRAND.name}`} tone={t.walnut}
      style={{ position: 'absolute', inset: 0 }}
    />
    <div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(180deg, rgba(31,24,16,.25) 0%, rgba(31,24,16,.55) 100%)' }} />
    <div style={{ position: 'absolute', inset: 0, padding: '0 96px', display: 'flex', flexDirection: 'column', justifyContent: 'flex-end', paddingBottom: 80, color: '#F2EBDC' }}>
      <div style={{ fontSize: 12, letterSpacing: '.24em', textTransform: 'uppercase', marginBottom: 24, opacity: .9 }}>
        {dilnaTokens.tagline}
      </div>
      <h1 style={{
        fontFamily: '"Fraunces", serif', fontWeight: 300, fontSize: 132, lineHeight: 0.95, letterSpacing: '-0.025em',
        margin: 0, maxWidth: 1200, color: '#F2EBDC',
      }}>
        Kuchyně, interiéry<br />a nábytek <em style={{ fontStyle: 'italic', fontWeight: 300 }}>na míru</em>.
      </h1>
      <div style={{ display: 'flex', alignItems: 'flex-end', justifyContent: 'space-between', marginTop: 48 }}>
        <div style={{ maxWidth: 480, fontSize: 18, lineHeight: 1.5, opacity: .9 }}>
          Rodinná dílna{BRAND.location ? ` v ${BRAND.location}` : ''}. Navrhujeme s Vámi,
          vyrábíme od základu, montujeme sami.
        </div>
        <div style={{ display: 'flex', gap: 16 }}>
          <BtnPrimary t={t} label="Domluvit konzultaci" />
          <BtnGhost label="Prohlédnout realizace" />
        </div>
      </div>
    </div>
  </section>
);

const DilnaHeroSplit = ({ t }) => (
  <section style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', minHeight: 720 }}>
    <div style={{ padding: '120px 80px', display: 'flex', flexDirection: 'column', justifyContent: 'center' }}>
      <div style={{ ...kicker, color: t.walnut }}>{dilnaTokens.tagline}</div>
      <h1 style={{
        fontFamily: '"Fraunces", serif', fontWeight: 300, fontSize: 96, lineHeight: 0.98, letterSpacing: '-0.025em',
        margin: '24px 0', color: t.ink,
      }}>
        Kuchyně,<br />interiéry,<br /><em style={{ fontStyle: 'italic', color: t.walnut }}>nábytek</em><br />na míru.
      </h1>
      <p style={{ fontSize: 18, lineHeight: 1.6, color: t.ink2, maxWidth: 460, marginBottom: 40 }}>
        Rodinná dílna{BRAND.location ? ` v ${BRAND.location}` : ''}. Pracujeme s opravdovým dřevem,
        navrhujeme s Vámi, vyrábíme od základu.
      </p>
      <div style={{ display: 'flex', gap: 16 }}>
        <BtnPrimary t={t} label="Domluvit konzultaci" />
        <BtnGhost label="Realizace" dark />
      </div>
    </div>
    <Img src={BRAND.heroPhoto} alt="" tone={t.walnut} />
  </section>
);

const DilnaHeroType = ({ t }) => (
  <section style={{ padding: '120px 96px 96px' }}>
    <div style={{ ...kicker, color: t.walnut, marginBottom: 64 }}>{dilnaTokens.tagline}</div>
    <h1 style={{
      fontFamily: '"Fraunces", serif', fontWeight: 300, fontSize: 200, lineHeight: 0.9, letterSpacing: '-0.035em',
      margin: 0, color: t.ink,
    }}>
      Dřevo<br />
      <em style={{ fontStyle: 'italic', color: t.walnut, fontWeight: 300 }}>na míru,</em><br />
      pro generace.
    </h1>
    <div style={{ marginTop: 64, display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: 48, alignItems: 'end' }}>
      <p style={{ fontSize: 18, lineHeight: 1.6, color: t.ink2, maxWidth: 360 }}>
        Rodinná dílna{BRAND.location ? ` v ${BRAND.location}` : ''}. Navrhujeme s Vámi, vyrábíme od základu,
        montujeme sami. Žádné subdodávky.
      </p>
      <div />
      <Img src={BRAND.heroPhoto} alt="" tone={t.walnut} style={{ aspectRatio: '4 / 3' }} />
    </div>
  </section>
);

// ── Nav ────────────────────────────────────────────────────────────────────
const DilnaNav = ({ t }) => (
  <nav style={{
    display: 'flex', alignItems: 'center', justifyContent: 'space-between',
    padding: '28px 96px', fontSize: 13, letterSpacing: '.08em', textTransform: 'uppercase',
  }}>
    <img src={BRAND.logoPath} alt={BRAND.name} style={{ height: 56, width: 'auto', display: 'block' }} />
    <div style={{ display: 'flex', gap: 40 }}>
      {['Co děláme', 'Realizace', 'O nás', 'Kontakt'].map(l => (
        <a key={l} href="#" style={{ color: t.ink, textDecoration: 'none', opacity: .75 }}>{l}</a>
      ))}
    </div>
    <a href={`tel:${BRAND.phone}`} style={{ color: t.brand, textDecoration: 'none', fontWeight: 500 }}>{BRAND.phoneDisplay}</a>
  </nav>
);

// ── Portfolio variants ─────────────────────────────────────────────────────
const DilnaPortfolio = ({ items, style, t }) => {
  if (style === 'masonry') {
    // Two columns, alternating heights
    const cols = [[], []];
    items.forEach((it, i) => cols[i % 2].push(it));
    return (
      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 24 }}>
        {cols.map((col, ci) => (
          <div key={ci} style={{ display: 'flex', flexDirection: 'column', gap: 24, paddingTop: ci === 1 ? 96 : 0 }}>
            {col.map(p => <PortfolioCard key={p.id} p={p} t={t} />)}
          </div>
        ))}
      </div>
    );
  }
  if (style === 'carousel') {
    return (
      <div style={{ display: 'flex', gap: 24, overflow: 'hidden' }}>
        {items.slice(0, 5).map((p, i) => (
          <div key={p.id} style={{ flex: i === 0 ? '0 0 60%' : '0 0 30%' }}>
            <PortfolioCard p={p} t={t} large={i === 0} />
          </div>
        ))}
      </div>
    );
  }
  // editorial — asymmetric grid
  return (
    <div style={{ display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)', gap: 24 }}>
      {items.map((p, i) => {
        // pattern: large, small, small, small, large, small, small, small
        const isLarge = i % 4 === 0;
        return (
          <div key={p.id} style={{ gridColumn: isLarge ? 'span 4' : 'span 2' }}>
            <PortfolioCard p={p} t={t} large={isLarge} />
          </div>
        );
      })}
    </div>
  );
};

const PortfolioCard = ({ p, t, large }) => (
  <a href={`#${p.id}`} style={{ display: 'block', textDecoration: 'none', color: 'inherit', cursor: 'pointer' }}>
    <Img src={p.img} alt={p.title} tone={t.walnut} style={{ aspectRatio: large ? '4 / 3' : '1 / 1', width: '100%' }} />
    <div style={{ padding: '20px 4px 0', display: 'flex', justifyContent: 'space-between', alignItems: 'baseline' }}>
      <div>
        <div style={{ fontFamily: '"Fraunces", serif', fontSize: large ? 28 : 20, lineHeight: 1.1, color: t.ink }}>
          {p.title}
        </div>
        <div style={{ fontSize: 12, marginTop: 6, color: t.ink2, letterSpacing: '.04em' }}>
          {p.material}
        </div>
      </div>
      <div style={{ fontSize: 12, color: t.walnut, letterSpacing: '.08em' }}>{p.year}</div>
    </div>
  </a>
);

// ── Form ───────────────────────────────────────────────────────────────────
const DilnaForm = ({ t }) => (
  <form style={{ display: 'flex', flexDirection: 'column', gap: 20 }} onSubmit={e => e.preventDefault()}>
    <Field label="Vaše jméno" placeholder="Jan Novák" t={t} dark />
    <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 20 }}>
      <Field label="Telefon" placeholder="+420 …" t={t} dark />
      <Field label="E-mail" placeholder="vy@email.cz" t={t} dark />
    </div>
    <Field label="O čem chcete mluvit" placeholder="Stručně, co plánujete…" t={t} dark multi />
    <button type="submit" style={{
      marginTop: 12, padding: '20px 32px', border: 'none', background: t.paper, color: t.ink,
      fontFamily: 'inherit', fontSize: 15, fontWeight: 500, letterSpacing: '.04em', textTransform: 'uppercase',
      cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'space-between',
    }}>
      <span>Poslat nezávazně</span>
      <Icon name="arrow" size={20} />
    </button>
  </form>
);

const Field = ({ label, placeholder, t, dark, multi }) => (
  <label style={{ display: 'block' }}>
    <div style={{ fontSize: 11, letterSpacing: '.12em', textTransform: 'uppercase', marginBottom: 8, opacity: dark ? .6 : .7, color: dark ? t.paper : t.ink2 }}>
      {label}
    </div>
    {multi ? (
      <textarea placeholder={placeholder} rows={4} style={fieldStyle(dark, t)} />
    ) : (
      <input placeholder={placeholder} style={fieldStyle(dark, t)} />
    )}
  </label>
);
const fieldStyle = (dark, t) => ({
  width: '100%', padding: '14px 16px', border: 'none', borderBottom: `1px solid ${dark ? '#F2EBDC33' : t.rule}`,
  background: 'transparent', color: dark ? t.paper : t.ink, fontFamily: 'inherit', fontSize: 16,
  resize: 'vertical', outline: 'none',
});

// ── Buttons ────────────────────────────────────────────────────────────────
const BtnPrimary = ({ label, t }) => (
  <button style={{
    padding: '18px 28px', border: 'none', background: t.brand, color: t.paper,
    fontFamily: 'inherit', fontSize: 14, fontWeight: 500, letterSpacing: '.04em', textTransform: 'uppercase',
    cursor: 'pointer', display: 'inline-flex', alignItems: 'center', gap: 12,
  }}>
    {label} <Icon name="arrow" size={18} />
  </button>
);
const BtnGhost = ({ label, dark }) => (
  <button style={{
    padding: '18px 28px', border: `1px solid ${dark ? '#1F1810' : '#F2EBDC55'}`, background: 'transparent', color: dark ? '#1F1810' : '#F2EBDC',
    fontFamily: 'inherit', fontSize: 14, fontWeight: 500, letterSpacing: '.04em', textTransform: 'uppercase',
    cursor: 'pointer',
  }}>{label}</button>
);

// ── style helpers ──────────────────────────────────────────────────────────
const kicker = {
  fontSize: 12, letterSpacing: '.2em', textTransform: 'uppercase',
  opacity: 1, fontWeight: 500,
};
const display = (size, t) => ({
  fontFamily: '"Fraunces", serif', fontWeight: 300, fontSize: size, lineHeight: 1, letterSpacing: '-0.025em',
  margin: 0, color: t.ink,
});
const body = (t) => ({ fontSize: 15, lineHeight: 1.55, color: t.ink2 });

// ============================================================================
// MOBILE — 390 wide
// ============================================================================
const DilnaMobile = ({ tweaks }) => {
  const t = dilnaTokens;
  const heroLayout = tweaks?.heroLayout || 'full-photo';
  const portfolioStyle = tweaks?.portfolioStyle || 'editorial';
  const [filter, setFilter] = React.useState('all');
  const filtered = filter === 'all' ? PROJECTS : PROJECTS.filter(p => p.cat === filter);

  return (
    <div style={{
      width: 390, fontFamily: '"Inter", sans-serif',
      color: t.ink, background: t.paper, overflow: 'hidden',
    }}>
      {/* NAV */}
      <nav style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '20px 24px' }}>
        <img src={BRAND.logoPath} alt={BRAND.name} style={{ height: 42, width: 'auto', display: 'block' }} />
        <div style={{ width: 32, height: 32, border: `1px solid ${t.rule}`, borderRadius: 999, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
            <div style={{ width: 14, height: 1, background: t.ink }} />
            <div style={{ width: 14, height: 1, background: t.ink }} />
          </div>
        </div>
      </nav>

      {/* HERO */}
      <section style={{ position: 'relative', height: heroLayout === 'typographic' ? 'auto' : 640, overflow: 'hidden' }}>
        {heroLayout !== 'typographic' && (
          <Img src={BRAND.heroPhoto} alt="" tone={t.walnut} style={{ position: 'absolute', inset: 0 }} />
        )}
        {heroLayout !== 'typographic' && <div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(180deg, rgba(31,24,16,.2) 0%, rgba(31,24,16,.6) 100%)' }} />}
        <div style={{ position: heroLayout === 'typographic' ? 'static' : 'absolute', inset: 0, padding: heroLayout === 'typographic' ? '40px 24px' : '0 24px', display: 'flex', flexDirection: 'column', justifyContent: 'flex-end', paddingBottom: heroLayout === 'typographic' ? 40 : 40, color: heroLayout === 'typographic' ? t.ink : t.paper }}>
          <div style={{ fontSize: 10, letterSpacing: '.2em', textTransform: 'uppercase', marginBottom: 16, opacity: .9 }}>
            {dilnaTokens.tagline}
          </div>
          <h1 style={{
            fontFamily: '"Fraunces", serif', fontWeight: 300, fontSize: heroLayout === 'typographic' ? 72 : 56, lineHeight: 0.95, letterSpacing: '-0.025em',
            margin: 0,
          }}>
            Kuchyně,<br />interiéry,<br /><em style={{ fontStyle: 'italic', color: heroLayout === 'typographic' ? t.walnut : t.paper }}>nábytek</em><br />na míru.
          </h1>
          <div style={{ marginTop: 32, fontSize: 14, lineHeight: 1.5, opacity: heroLayout === 'typographic' ? 1 : .9 }}>
            Rodinná dílna{BRAND.location ? ` v ${BRAND.location}` : ''}. Žádné subdodávky.
          </div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 12, marginTop: 24 }}>
            <BtnPrimary t={t} label="Domluvit konzultaci" />
          </div>
        </div>
        {heroLayout === 'typographic' && (
          <Img src={BRAND.heroPhoto} alt="" tone={t.walnut} style={{ width: '100%', aspectRatio: '4/3', marginTop: 32 }} />
        )}
      </section>

      {/* CO DĚLÁME */}
      <section style={{ padding: '64px 24px', borderTop: `1px solid ${t.rule}` }}>
        <div style={{ ...kicker, color: t.walnut, marginBottom: 12 }}>I · Co děláme</div>
        <h2 style={{ ...display(40, t), marginBottom: 32 }}>
          Nábytek na míru, <em style={{ fontStyle: 'italic', color: t.walnut }}>pro generace</em>.
        </h2>
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 4 }}>
          {CATEGORIES.map((c, i) => (
            <a key={c.id} style={{ position: 'relative', aspectRatio: '3 / 4', overflow: 'hidden', textDecoration: 'none', background: t.paperDeep }}>
              <Img src={c.img} tone={t.walnut} style={{ position: 'absolute', inset: 0 }} />
              <div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(180deg, transparent 50%, rgba(31,24,16,.75) 100%)' }} />
              <div style={{ position: 'absolute', bottom: 0, padding: 16, color: t.paper }}>
                <div style={{ fontSize: 9, letterSpacing: '.2em', opacity: .7, marginBottom: 4 }}>{String(i + 1).padStart(2, '0')}</div>
                <div style={{ fontFamily: '"Fraunces", serif', fontSize: 22, lineHeight: 1 }}>{c.label}</div>
              </div>
            </a>
          ))}
        </div>
      </section>

      {/* REALIZACE */}
      <section style={{ padding: '64px 24px', background: t.paperDeep, borderTop: `1px solid ${t.rule}` }}>
        <div style={{ ...kicker, color: t.walnut, marginBottom: 12 }}>II · Realizace</div>
        <h2 style={{ ...display(40, t), marginBottom: 24 }}>Vybráno z dílny.</h2>
        <div style={{ display: 'flex', gap: 6, overflowX: 'auto', marginBottom: 24, paddingBottom: 4 }}>
          {FILTERS.map(f => (
            <button key={f.id} onClick={() => setFilter(f.id)} style={{
              flexShrink: 0, padding: '8px 14px', borderRadius: 999, cursor: 'pointer',
              border: `1px solid ${filter === f.id ? t.ink : t.rule}`,
              background: filter === f.id ? t.ink : 'transparent',
              color: filter === f.id ? t.paper : t.ink, fontSize: 12, letterSpacing: '.02em',
            }}>{f.label}</button>
          ))}
        </div>
        <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
          {filtered.slice(0, 6).map(p => <PortfolioCard key={p.id} p={p} t={t} large />)}
        </div>
      </section>

      {/* O NÁS */}
      <section style={{ padding: '64px 24px', borderTop: `1px solid ${t.rule}` }}>
        <div style={{ ...kicker, color: t.walnut, marginBottom: 12 }}>III · O nás</div>
        <h2 style={{ ...display(40, t), marginBottom: 24 }}>
          Menší rodinná firma.<br /><em style={{ fontStyle: 'italic', color: t.walnut }}>Skuteční výrobci.</em>
        </h2>
        <Img src={BRAND.ownerPhoto} alt={BRAND.owner} tone={t.walnut} style={{ aspectRatio: '4/5', width: '100%', marginBottom: 24 }} />
        <p style={{ ...body(t), fontSize: 16, lineHeight: 1.6, marginBottom: 16 }}>
          Působíme na trhu už několik let. Vážíme si každého zákazníka,
          ale především jsme skuteční výrobci s vlastní dílnou{BRAND.location ? ` v ${BRAND.location}` : ''}.
        </p>
        <p style={{ ...body(t), fontSize: 16, lineHeight: 1.6 }}>
          Vyrábíme kuchyňské linky a kompletní vybavení interiérů.
          Veškeré fotografie na našem webu dokumentují výhradně naši práci.
        </p>
      </section>

      {/* KONTAKT */}
      <section style={{ padding: '64px 24px 48px', background: t.ink, color: t.paper }}>
        <div style={{ ...kicker, color: t.walnutLight, marginBottom: 12 }}>IV · Kontakt</div>
        <h2 style={{ ...display(48, t), color: t.paper, marginBottom: 24 }}>
          Pojďte<br />s námi <em style={{ fontStyle: 'italic', color: t.walnutLight }}>navrhnout</em>.
        </h2>
        <div style={{ display: 'flex', flexDirection: 'column', gap: 20, marginBottom: 32 }}>
          <a href={`tel:${BRAND.phone}`} style={{ display: 'flex', alignItems: 'center', gap: 12, color: t.paper, textDecoration: 'none' }}>
            <Icon name="phone" color={t.walnutLight} />
            <span style={{ fontFamily: '"Fraunces", serif', fontSize: 20 }}>{BRAND.phoneDisplay}</span>
          </a>
          <a href={`mailto:${BRAND.email}`} style={{ display: 'flex', alignItems: 'center', gap: 12, color: t.paper, textDecoration: 'none' }}>
            <Icon name="mail" color={t.walnutLight} />
            <span style={{ fontFamily: '"Fraunces", serif', fontSize: 16 }}>{BRAND.email}</span>
          </a>
          <div style={{ display: 'flex', alignItems: 'flex-start', gap: 12 }}>
            <Icon name="pin" color={t.walnutLight} />
            <span style={{ fontFamily: '"Fraunces", serif', fontSize: 16 }}>{BRAND.address}</span>
          </div>
        </div>
        <DilnaForm t={t} />
        <div style={{ marginTop: 48, paddingTop: 24, borderTop: `1px solid ${t.paper}22`, fontSize: 11, opacity: .6, letterSpacing: '.08em', textTransform: 'uppercase' }}>
          © {BRAND.name} · 2026
        </div>
      </section>
    </div>
  );
};

Object.assign(window, { DilnaDesktop, DilnaMobile });
