// site.jsx — KevlexOS.com one-page site.
// Tokens (T, serif, sans, mono) and primitives (MonoLabel, Dot, Rule, TopStrap,
// SiteHeader, SiteFooter) are provided by shared.jsx via window.

const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "theme": "split",
  "accent": "#F5A623",
  "showBrief": true,
  "badgeRadius": "circle",
  "logoOnCardSize": 96
}/*EDITMODE-END*/;

// ── Top amber strap + header ────────────────────────────────────────────────
// (TopStrap, SiteHeader, SiteFooter, T, serif, sans, mono, MonoLabel, Dot,
// Rule all come from shared.jsx.)

// ── Hero ────────────────────────────────────────────────────────────────────
function Hero({ accent, showBrief }) {
  return (
    <section style={{
      padding: '88px 56px 96px',
      display: 'grid',
      gridTemplateColumns: showBrief ? '1.05fr 0.95fr' : '1fr',
      gap: 72,
      alignItems: 'start',
      position: 'relative',
    }}>
      <div style={{ maxWidth: 640 }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 14, marginBottom: 36 }}>
          <span style={{
            fontFamily: mono, fontSize: 11, letterSpacing: '0.18em',
            textTransform: 'uppercase', color: accent,
          }}>The Index</span>
          <Rule color={T.hair} style={{ flex: 1 }} />
          <MonoLabel>Tuesday · May 2026</MonoLabel>
        </div>

        <h1 style={{
          fontFamily: serif,
          fontWeight: 400,
          fontSize: 'clamp(48px, 6.2vw, 88px)',
          lineHeight: 0.98,
          letterSpacing: '-0.02em',
          color: T.warm,
          margin: 0,
          textWrap: 'pretty',
        }}>
          A small suite of tools,
          <br />
          <em style={{
            fontStyle: 'italic',
            color: accent,
            fontWeight: 400,
          }}>built for one team.</em>
        </h1>

        <p style={{
          fontFamily: serif,
          fontSize: 19,
          lineHeight: 1.5,
          color: T.dim,
          marginTop: 36,
          maxWidth: 520,
          textWrap: 'pretty',
        }}>
          KevlexOS is the home of Kevlex Digital's internal product suite —
          a quiet, opinionated set of tools we build for how we actually work.
          Not for sale. Not for show.
        </p>

        <div style={{
          display: 'flex', gap: 32, marginTop: 48, alignItems: 'baseline',
          flexWrap: 'wrap',
        }}>
          <MetaBlock label="Status" value="Internal" />
          <MetaBlock label="Tools shipped" value="01" />
          <MetaBlock label="In development" value="03" />
          <MetaBlock label="Public launch" value="—" dim />
        </div>
      </div>

      {showBrief && <BriefPreview accent={accent} />}
    </section>
  );
}

function MetaBlock({ label, value, dim }) {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
      <MonoLabel>{label}</MonoLabel>
      <div style={{
        fontFamily: serif,
        fontSize: 26,
        fontWeight: 400,
        color: dim ? T.dimer : T.warm,
        lineHeight: 1,
      }}>{value}</div>
    </div>
  );
}

// ── Morning brief preview card (echoes onboarding screen) ───────────────────
function BriefPreview({ accent }) {
  const items = [
    { n: 1, title: 'Workshop follow-up', meta: 'Internal', action: 'APPROVE' },
    { n: 2, title: 'Weekly review draft', meta: 'Strategy', action: 'DELEGATE' },
    { n: 3, title: 'Vendor shortlist', meta: 'Ops', action: 'APPROVE' },
  ];
  return (
    <div style={{ position: 'relative', paddingTop: 8 }}>
      {/* Folder tab */}
      <div style={{
        position: 'absolute',
        top: -4,
        right: 28,
        width: 64,
        height: 14,
        background: accent,
        borderRadius: '3px 3px 0 0',
      }} />
      <div style={{
        background: T.surfaceDark,
        border: `1px solid ${T.hair}`,
        borderRadius: 14,
        padding: '28px 32px 28px',
        position: 'relative',
        overflow: 'hidden',
      }}>
        {/* card header */}
        <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 28 }}>
          <Dot color={accent} size={8} />
          <MonoLabel color={accent}>Morning Brief · 05:30</MonoLabel>
          <Rule color={T.hair} style={{ flex: 1, marginLeft: 8 }} />
        </div>

        {/* serif statement */}
        <h2 style={{
          fontFamily: serif,
          fontSize: 34,
          lineHeight: 1.05,
          fontWeight: 400,
          color: T.warm,
          letterSpacing: '-0.015em',
          margin: '8px 0 24px',
        }}>
          Today, three things move
          <br />
          <em style={{ fontStyle: 'italic', color: accent }}>or nothing else does.</em>
        </h2>

        <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
          {items.map((it) => (
            <div key={it.n} style={{
              display: 'grid',
              gridTemplateColumns: '24px 1fr auto',
              alignItems: 'center',
              gap: 14,
              padding: '12px 14px',
              background: '#0F0F0F',
              border: `1px solid ${T.hair}`,
              borderRadius: 8,
            }}>
              <div style={{
                fontFamily: mono, fontSize: 12, color: T.dim,
              }}>{it.n}</div>
              <div style={{
                fontFamily: sans, fontSize: 14, color: T.warm,
                display: 'flex', alignItems: 'baseline', gap: 8,
              }}>
                <span>{it.title}</span>
                <span style={{ color: T.dimer, fontSize: 13 }}>· {it.meta}</span>
              </div>
              <div style={{
                fontFamily: mono, fontSize: 10, letterSpacing: '0.14em',
                color: accent,
                border: `1px solid ${accent}`,
                padding: '5px 10px',
                borderRadius: 4,
              }}>{it.action}</div>
            </div>
          ))}
        </div>

        <div style={{
          marginTop: 22, display: 'flex', justifyContent: 'space-between',
          alignItems: 'center',
        }}>
          <MonoLabel>Preview · Kevlex EA</MonoLabel>
          <MonoLabel color={accent}>Open ↗</MonoLabel>
        </div>
      </div>
    </div>
  );
}

// ── Index strip — divides hero from suite ───────────────────────────────────
function IndexStrip({ accent, theme }) {
  const dark = theme !== 'warm';
  return (
    <div style={{
      borderTop: `1px solid ${dark ? T.hair : T.warmHair}`,
      borderBottom: `1px solid ${dark ? T.hair : T.warmHair}`,
      padding: '20px 56px',
      display: 'grid',
      gridTemplateColumns: 'repeat(4, 1fr)',
      gap: 32,
      color: dark ? T.warm : T.ink,
      background: dark ? T.deep : T.warm,
    }}>
      {[
        ['§', '01', 'The Suite', accent],
        ['§', '02', 'Kevlex EA · in use', null],
        ['§', '03', 'Three more · in development', null],
        ['§', '∞', 'Built sharp', accent],
      ].map(([sym, n, label, hl], i) => (
        <div key={i} style={{ display: 'flex', alignItems: 'baseline', gap: 12 }}>
          <span style={{
            fontFamily: serif, fontSize: 14,
            fontStyle: 'italic',
            color: dark ? T.dimer : T.warmDimer,
          }}>{sym}</span>
          <span style={{
            fontFamily: mono, fontSize: 11, letterSpacing: '0.16em',
            color: hl || (dark ? T.dim : T.warmDim),
          }}>{n}</span>
          <span style={{
            fontFamily: mono, fontSize: 11, letterSpacing: '0.14em',
            textTransform: 'uppercase',
            color: dark ? T.warm : T.ink,
          }}>{label}</span>
        </div>
      ))}
    </div>
  );
}

// ── Product Suite section (warm off-white) ──────────────────────────────────
function SuiteSection({ accent, theme, badgeRadius, logoSize }) {
  const warm = theme !== 'dark';
  const bg = warm ? T.warm : T.surfaceDark2;
  const ink = warm ? T.ink : T.warm;
  const dim = warm ? T.warmDim : T.dim;
  const dimer = warm ? T.warmDimer : T.dimer;
  const hair = warm ? T.warmHair : T.hair;

  return (
    <section id="suite" style={{
      background: bg,
      color: ink,
      padding: '96px 56px 120px',
      position: 'relative',
    }}>
      {/* Section header */}
      <div style={{
        display: 'grid',
        gridTemplateColumns: '1fr auto',
        alignItems: 'end',
        gap: 24,
        marginBottom: 56,
      }}>
        <div>
          <div style={{
            display: 'flex', alignItems: 'center', gap: 14, marginBottom: 20,
          }}>
            <span style={{
              fontFamily: mono, fontSize: 11, letterSpacing: '0.18em',
              textTransform: 'uppercase', color: accent,
            }}>§ 01 — The Suite</span>
            <Rule color={hair} style={{ flex: 1, maxWidth: 240 }} />
          </div>
          <h2 style={{
            fontFamily: serif, fontWeight: 400,
            fontSize: 'clamp(40px, 4.6vw, 64px)',
            lineHeight: 1.02,
            letterSpacing: '-0.02em',
            color: ink,
            margin: 0,
            maxWidth: 760,
            textWrap: 'pretty',
          }}>
            One tool in the dock.
            {' '}
            <em style={{ fontStyle: 'italic', color: dim }}>The rest are on the bench.</em>
          </h2>
        </div>
        <MonoLabel style={{ color: dimer, whiteSpace: 'nowrap' }}>
          04 entries · 01 shipped
        </MonoLabel>
      </div>

      {/* Cards grid */}
      <div style={{
        display: 'grid',
        gridTemplateColumns: '1.4fr 1fr',
        gap: 24,
      }}>
        <EACard accent={accent} badgeRadius={badgeRadius} logoSize={logoSize} />
        <ToolCard
          accent={accent}
          index="02"
          short="PROCESS FLOW"
          name="Process Flow"
          tagline={<>The team’s <em>operating manual,</em> mid-task.</>}
          body="Process Street meets a learning module. New hires read what they need—and run the step—in the same screen."
          tag="DEV"
          capability="Checklists · Modules · Onboarding"
          stacked
        />
      </div>

      <div style={{
        display: 'grid',
        gridTemplateColumns: '1fr 1fr',
        gap: 24,
        marginTop: 24,
      }}>
        <ToolCard
          accent={accent}
          index="03"
          short="AI KNOWLEDGE BASE"
          name={<>AI Knowledge Base</>}
          tagline={<>The instructions, <em>where the AI reads.</em></>}
          body="An MCP-powered knowledge base that steers every AI on the team. Guidelines in one place, applied everywhere, output gets sharper."
          tag="DEV"
          capability="MCP · Guidelines · Quality"
        />
        <ToolCard
          accent={accent}
          index="04"
          short="TEAM PERFORMANCE MANAGER"
          name={<>Performance Manager</>}
          tagline={<>A career, <em>monitored kindly.</em></>}
          body="Skill development tracked over time. AI quietly watches output to coach—and to give every team member their own honest read."
          tag="DRAFT"
          capability="Growth · Coaching · Self-eval"
        />
      </div>
    </section>
  );
}

function EACard({ accent, badgeRadius, logoSize }) {
  return (
    <a href="ea.html" style={{
      background: T.surfaceDark,
      color: T.warm,
      borderRadius: 16,
      padding: '40px 44px 36px',
      position: 'relative',
      overflow: 'hidden',
      display: 'flex',
      flexDirection: 'column',
      gap: 36,
      minHeight: 460,
      textDecoration: 'none',
    }}>
      {/* (Whole card is the link target.) */}
      {/* Top row: logo + status */}
      <div style={{
        display: 'flex',
        justifyContent: 'space-between',
        alignItems: 'flex-start',
      }}>
        <EALogo size={logoSize} radius={badgeRadius} amber={accent} />
        <div style={{ textAlign: 'right', display: 'flex', flexDirection: 'column', gap: 6 }}>
          <div style={{
            display: 'inline-flex', alignItems: 'center', gap: 8,
            border: `1px solid ${T.hair}`, padding: '6px 10px', borderRadius: 4,
          }}>
            <Dot color="#6FBE73" size={6} />
            <span style={{
              fontFamily: mono, fontSize: 10, letterSpacing: '0.16em',
              textTransform: 'uppercase', color: T.warm,
            }}>In use · v1.2</span>
          </div>
          <MonoLabel>Tool · 01</MonoLabel>
        </div>
      </div>

      {/* Title block */}
      <div>
        <div style={{
          fontFamily: mono, fontSize: 11, letterSpacing: '0.18em',
          textTransform: 'uppercase', color: accent, marginBottom: 12,
        }}>EA · Kevlex</div>
        <h3 style={{
          fontFamily: serif, fontWeight: 400,
          fontSize: 48, lineHeight: 1.02, letterSpacing: '-0.02em',
          color: T.warm, margin: 0,
        }}>
          Your AI-powered{' '}
          <em style={{ fontStyle: 'italic', color: accent }}>chief of staff.</em>
        </h3>
        <p style={{
          fontFamily: serif, fontSize: 17, lineHeight: 1.5,
          color: T.dim, marginTop: 18, maxWidth: 460,
        }}>
          A morning brief, an inbox of signals, and an executor that drafts,
          schedules, and logs — pending three keys: approve, delegate, dismiss.
        </p>
      </div>

      {/* Capability lines, mono uppercase tracked */}
      <div style={{ marginTop: 'auto' }}>
        <Rule color={T.hair} style={{ marginBottom: 18 }} />
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 24 }}>
          {[
            ['A', 'Morning briefs'],
            ['B', 'Inbox actions'],
            ['C', 'Auto-execution'],
          ].map(([k, v]) => (
            <div key={k} style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
              <span style={{
                fontFamily: mono, fontSize: 10, letterSpacing: '0.16em',
                color: accent,
              }}>· {k}</span>
              <span style={{
                fontFamily: mono, fontSize: 12, letterSpacing: '0.14em',
                textTransform: 'uppercase', color: T.warm,
              }}>{v}</span>
            </div>
          ))}
        </div>
      </div>

      {/* Hairline corner mark with arrow indicator */}
      <div style={{
        position: 'absolute', top: 0, right: 0,
        width: 56, height: 56,
        borderLeft: `1px solid ${T.hair}`,
        borderBottom: `1px solid ${T.hair}`,
        borderBottomLeftRadius: 0,
        display: 'flex', alignItems: 'center', justifyContent: 'center',
      }}>
        <span style={{
          fontFamily: mono, fontSize: 18, color: accent, lineHeight: 1,
        }}>↗</span>
      </div>
    </a>
  );
}

function ToolCard({ accent, index, short, name, tagline, body, tag, capability, stacked }) {
  return (
    <article style={{
      background: T.warm2,
      color: T.ink,
      borderRadius: 16,
      padding: '32px 32px 28px',
      border: `1px solid ${T.warmHair}`,
      display: 'flex',
      flexDirection: 'column',
      gap: 24,
      minHeight: stacked ? 460 : 320,
      position: 'relative',
      overflow: 'hidden',
    }}>
      {/* Top row: index badge + status pill */}
      <div style={{
        display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start',
      }}>
        <div style={{
          width: 56, height: 56,
          borderRadius: 28,
          background: 'rgba(15,15,15,0.04)',
          border: `1px solid rgba(15,15,15,0.12)`,
          display: 'flex', alignItems: 'center', justifyContent: 'center',
          position: 'relative',
        }}>
          <span style={{
            fontFamily: mono, fontSize: 12, letterSpacing: '0.14em',
            color: T.ink, fontWeight: 500,
          }}>{index}</span>
          <span style={{
            position: 'absolute', bottom: -2, right: -2,
            width: 10, height: 10, borderRadius: '50%',
            background: accent,
            border: `2px solid ${T.warm2}`,
          }} />
        </div>
        <div style={{
          display: 'inline-flex', alignItems: 'center', gap: 8,
          border: `1px solid ${T.warmHair}`,
          padding: '6px 10px', borderRadius: 4,
        }}>
          <Dot color={accent} size={6} />
          <span style={{
            fontFamily: mono, fontSize: 10, letterSpacing: '0.16em',
            textTransform: 'uppercase', color: T.ink,
          }}>{tag}</span>
        </div>
      </div>

      <div style={{
        fontFamily: mono, fontSize: 10, letterSpacing: '0.18em',
        textTransform: 'uppercase', color: accent,
      }}>Kevlex · {short}</div>

      <div>
        <h3 style={{
          fontFamily: serif, fontWeight: 400,
          fontSize: stacked ? 38 : 32,
          lineHeight: 1.04, letterSpacing: '-0.018em',
          color: T.ink, margin: 0,
        }}>
          {name}
        </h3>
        <div style={{
          fontFamily: serif, fontSize: stacked ? 22 : 19,
          lineHeight: 1.25, letterSpacing: '-0.01em',
          color: T.warmDim, marginTop: 10,
        }}>{tagline}</div>
      </div>

      <p style={{
        fontFamily: serif, fontSize: 15, lineHeight: 1.5,
        color: T.warmDim, margin: 0, maxWidth: 420,
      }}>{body}</p>

      <div style={{ marginTop: 'auto' }}>
        <Rule color={T.warmHair} style={{ marginBottom: 14 }} />
        <span style={{
          fontFamily: mono, fontSize: 11, letterSpacing: '0.14em',
          textTransform: 'uppercase', color: T.warmDim,
        }}>{capability}</span>
      </div>
    </article>
  );
}

function ComingCard({ accent, index, name, tag, hint, muted }) {
  const isDraft = !muted;
  return (
    <article style={{
      background: T.warm2,
      color: T.ink,
      borderRadius: 16,
      padding: '32px 32px 28px',
      border: `1px dashed ${muted ? T.warmHair : 'rgba(15,15,15,0.18)'}`,
      display: 'flex',
      flexDirection: 'column',
      gap: 28,
      minHeight: 220,
      position: 'relative',
    }}>
      <div style={{
        display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start',
      }}>
        {/* Placeholder badge — empty squircle echoing logo footprint */}
        <div style={{
          width: 56, height: 56,
          borderRadius: 28,
          background: muted ? 'transparent' : 'rgba(15,15,15,0.04)',
          border: `1px dashed ${muted ? 'rgba(15,15,15,0.15)' : 'rgba(15,15,15,0.22)'}`,
          display: 'flex', alignItems: 'center', justifyContent: 'center',
        }}>
          <span style={{
            fontFamily: mono, fontSize: 11, letterSpacing: '0.16em',
            color: T.warmDimer,
          }}>{index}</span>
        </div>
        <div style={{
          display: 'inline-flex', alignItems: 'center', gap: 8,
          border: `1px solid ${T.warmHair}`,
          padding: '6px 10px', borderRadius: 4,
        }}>
          <Dot color={muted ? 'rgba(15,15,15,0.25)' : accent} size={6} />
          <span style={{
            fontFamily: mono, fontSize: 10, letterSpacing: '0.16em',
            textTransform: 'uppercase', color: T.ink,
          }}>{tag}</span>
        </div>
      </div>

      <div style={{ marginTop: 'auto' }}>
        <h3 style={{
          fontFamily: serif, fontWeight: 400,
          fontSize: 30, lineHeight: 1.05, letterSpacing: '-0.015em',
          color: muted ? T.warmDim : T.ink,
          margin: 0,
        }}>
          {muted ? <em style={{ fontStyle: 'italic' }}>{hint}</em> : name}
        </h3>
        {!muted && (
          <p style={{
            fontFamily: serif, fontSize: 15, lineHeight: 1.45,
            color: T.warmDim, margin: '10px 0 0',
          }}>{hint}</p>
        )}
      </div>
    </article>
  );
}

// ── System / about strip ─────────────────────────────────────────────────────
function SystemStrip({ accent, theme }) {
  const warm = theme !== 'dark';
  const bg = warm ? T.warm : T.surfaceDark2;
  const ink = warm ? T.ink : T.warm;
  const dim = warm ? T.warmDim : T.dim;
  const hair = warm ? T.warmHair : T.hair;

  return (
    <section style={{
      background: bg, color: ink,
      padding: '0 56px 96px',
    }}>
      <Rule color={hair} style={{ marginBottom: 56 }} />
      <div style={{
        display: 'grid',
        gridTemplateColumns: '0.85fr 1.15fr',
        gap: 56,
      }}>
        <div>
          <span style={{
            fontFamily: mono, fontSize: 11, letterSpacing: '0.18em',
            textTransform: 'uppercase', color: accent,
          }}>§ 02 — The System</span>
          <h2 style={{
            fontFamily: serif, fontWeight: 400,
            fontSize: 'clamp(32px, 3.6vw, 48px)',
            lineHeight: 1.04, letterSpacing: '-0.02em',
            color: ink, margin: '20px 0 0',
            maxWidth: 460, textWrap: 'pretty',
          }}>
            One team. One vocabulary.{' '}
            <em style={{ fontStyle: 'italic', color: dim }}>One dock.</em>
          </h2>
        </div>
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 40, paddingTop: 8 }}>
          <Tenet n="A" title="Editorial, not enterprise.">
            Built like a magazine you can run from. Confident type, generous
            whitespace, no chrome you'll grow tired of.
          </Tenet>
          <Tenet n="B" title="Sharp by default.">
            Three keys, not three menus. Every tool answers the same question
            first: what moves today?
          </Tenet>
          <Tenet n="C" title="Built in the open.">
            Each tool ships internally before it ships anywhere else.
            We use what we build, every day, before we trust it to anyone else.
          </Tenet>
          <Tenet n="D" title="Quiet on purpose.">
            No marketing site. No public roadmap. No CTA. The work is the brief.
          </Tenet>
        </div>
      </div>
    </section>
  );
}

function Tenet({ n, title, children }) {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
      <span style={{
        fontFamily: mono, fontSize: 10, letterSpacing: '0.18em',
        color: 'currentColor', opacity: 0.5,
      }}>· {n}</span>
      <div style={{
        fontFamily: serif, fontSize: 22, fontWeight: 500,
        letterSpacing: '-0.01em', lineHeight: 1.15,
      }}>{title}</div>
      <p style={{
        fontFamily: serif, fontSize: 15, lineHeight: 1.55,
        color: 'currentColor', opacity: 0.6, margin: 0,
        maxWidth: 320,
      }}>{children}</p>
    </div>
  );
}

// ── Footer ──────────────────────────────────────────────────────────────────
// Footer comes from shared.jsx as <SiteFooter />.

// ── Wordmark detail block (showcases the typographic split) ────────────────
function WordmarkDetail({ accent, theme }) {
  const warm = theme !== 'dark';
  const bg = warm ? T.warm2 : T.deep;
  const ink = warm ? T.ink : T.warm;
  const dim = warm ? T.warmDim : T.dim;
  const hair = warm ? T.warmHair : T.hair;
  return (
    <section style={{
      background: bg, color: ink, padding: '72px 56px',
      borderTop: `1px solid ${hair}`,
      borderBottom: `1px solid ${hair}`,
    }}>
      <div style={{
        display: 'grid', gridTemplateColumns: '0.9fr 1.1fr', gap: 56,
        alignItems: 'center',
      }}>
        <div style={{
          fontFamily: serif, fontSize: 'clamp(72px, 9vw, 144px)',
          lineHeight: 1, letterSpacing: '-0.025em',
          display: 'flex', alignItems: 'baseline', gap: '0.06em',
        }}>
          <span>Kevlex</span>
          <span style={{
            fontFamily: mono, fontWeight: 500,
            fontSize: '0.32em', letterSpacing: '0.14em',
            textTransform: 'uppercase',
            color: accent,
            transform: 'translateY(-0.4em)',
            display: 'inline-block',
          }}>OS</span>
        </div>
        <div>
          <span style={{
            fontFamily: mono, fontSize: 11, letterSpacing: '0.18em',
            textTransform: 'uppercase', color: accent,
          }}>§ 00 — The Wordmark</span>
          <p style={{
            fontFamily: serif, fontSize: 20, lineHeight: 1.5,
            color: dim, margin: '20px 0 0', maxWidth: 460, textWrap: 'pretty',
          }}>
            Editorial serif for the company name. Tracked uppercase mono for the suffix.
            Same split runs through every tool in the dock — display lines speak,
            labels keep order.
          </p>
        </div>
      </div>
    </section>
  );
}

// ── App ─────────────────────────────────────────────────────────────────────
function App() {
  const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);
  const theme = t.theme; // 'split' | 'dark' | 'warm'
  const accent = t.accent;
  const showBrief = t.showBrief;

  // Page background follows the hero half — splits join visually via section bgs
  const pageBg = theme === 'warm' ? T.warm : T.deep;
  const pageFg = theme === 'warm' ? T.ink : T.warm;

  return (
    <div style={{
      background: pageBg, color: pageFg, minHeight: '100vh',
      fontFamily: sans,
      WebkitFontSmoothing: 'antialiased',
    }}>
      <TopStrap accent={accent} />
      <SiteHeader accent={accent} theme={theme === 'warm' ? 'warm' : 'dark'} current="home" />

      {theme === 'warm'
        ? <HeroWarm accent={accent} showBrief={showBrief} />
        : <Hero accent={accent} showBrief={showBrief} />}

      <IndexStrip accent={accent} theme={theme} />
      <SuiteSection accent={accent} theme={theme} badgeRadius={t.badgeRadius} logoSize={t.logoOnCardSize} />
      <SystemStrip accent={accent} theme={theme} />
      <SiteFooter accent={accent} />

      <TweaksPanel title="KevlexOS · Tweaks">
        <TweakSection label="Theme" />
        <TweakRadio
          label="Surface"
          value={theme}
          options={['split', 'dark', 'warm']}
          onChange={(v) => setTweak('theme', v)}
        />
        <TweakColor
          label="Accent"
          value={accent}
          options={['#F5A623', '#FFB930', '#C75A3A', '#CFAE6B', '#E9DCC4']}
          onChange={(v) => setTweak('accent', v)}
        />

        <TweakSection label="Hero" />
        <TweakToggle
          label="Brief preview"
          value={showBrief}
          onChange={(v) => setTweak('showBrief', v)}
        />

        <TweakSection label="EA Logo" />
        <TweakRadio
          label="Badge"
          value={t.badgeRadius}
          options={['circle', 'squircle']}
          onChange={(v) => setTweak('badgeRadius', v)}
        />
        <TweakSlider
          label="Card size"
          value={t.logoOnCardSize}
          min={64}
          max={144}
          step={4}
          unit="px"
          onChange={(v) => setTweak('logoOnCardSize', v)}
        />

        <TweakSection label="Logo · preview" />
        <LogoPreviewStack accent={accent} radius={t.badgeRadius} />
      </TweaksPanel>
    </div>
  );
}

function LogoPreviewStack({ accent, radius }) {
  return (
    <div style={{
      display: 'flex', alignItems: 'center', gap: 14,
      padding: '12px 4px 4px',
    }}>
      <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 6 }}>
        <EALogo size={24} amber={accent} radius={radius} />
        <span style={{ fontFamily: mono, fontSize: 9, color: 'rgba(41,38,27,0.5)' }}>24</span>
      </div>
      <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 6 }}>
        <EALogo size={48} amber={accent} radius={radius} />
        <span style={{ fontFamily: mono, fontSize: 9, color: 'rgba(41,38,27,0.5)' }}>48</span>
      </div>
      <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 6 }}>
        <EALogo size={96} amber={accent} radius={radius} />
        <span style={{ fontFamily: mono, fontSize: 9, color: 'rgba(41,38,27,0.5)' }}>96</span>
      </div>
    </div>
  );
}

// ── Warm theme variants (header comes from shared SiteHeader; Hero & Meta only) ──
function HeroWarm({ accent, showBrief }) {
  return (
    <section style={{
      padding: '88px 56px 96px',
      background: T.warm,
      color: T.ink,
      display: 'grid',
      gridTemplateColumns: showBrief ? '1.05fr 0.95fr' : '1fr',
      gap: 72,
      alignItems: 'start',
    }}>
      <div style={{ maxWidth: 640 }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 14, marginBottom: 36 }}>
          <span style={{
            fontFamily: mono, fontSize: 11, letterSpacing: '0.18em',
            textTransform: 'uppercase', color: accent,
          }}>The Index</span>
          <Rule color={T.warmHair} style={{ flex: 1 }} />
          <MonoLabel style={{ color: T.warmDim }}>Tuesday · May 2026</MonoLabel>
        </div>
        <h1 style={{
          fontFamily: serif, fontWeight: 400,
          fontSize: 'clamp(48px, 6.2vw, 88px)',
          lineHeight: 0.98, letterSpacing: '-0.02em',
          color: T.ink, margin: 0, textWrap: 'pretty',
        }}>
          A small suite of tools,
          <br />
          <em style={{ fontStyle: 'italic', color: accent, fontWeight: 400 }}>
            built for one team.
          </em>
        </h1>
        <p style={{
          fontFamily: serif, fontSize: 19, lineHeight: 1.5,
          color: T.warmDim, marginTop: 36, maxWidth: 520, textWrap: 'pretty',
        }}>
          KevlexOS is the home of Kevlex Digital's internal product suite —
          a quiet, opinionated set of tools we build for how we actually work.
          Not for sale. Not for show.
        </p>
        <div style={{
          display: 'flex', gap: 32, marginTop: 48, alignItems: 'baseline', flexWrap: 'wrap',
        }}>
          <MetaBlockWarm label="Status" value="Internal" />
          <MetaBlockWarm label="Tools shipped" value="01" />
          <MetaBlockWarm label="In development" value="03" />
          <MetaBlockWarm label="Public launch" value="—" dim />
        </div>
      </div>
      {showBrief && <BriefPreview accent={accent} />}
    </section>
  );
}

function MetaBlockWarm({ label, value, dim }) {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
      <span style={{
        fontFamily: mono, fontSize: 11, letterSpacing: '0.16em',
        textTransform: 'uppercase', color: T.warmDimer,
      }}>{label}</span>
      <div style={{
        fontFamily: serif, fontSize: 26, fontWeight: 400,
        color: dim ? T.warmDimer : T.ink, lineHeight: 1,
      }}>{value}</div>
    </div>
  );
}

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<App />);
