// gm-info.jsx — Logo animado (intro/outro) + Infográficos hand-drawn (claro/escuro).
// Reaproveita Player/AnimCard/interp/spring01 do gm-anim e tokens do bm-core.
// Exports: GMLogoAnim, GMInfographics.

const { Player, AnimCard, interp, spring01, easeOut, easeInOut } = window;
const HAND = "'Caveat', 'Bricolage Grotesque', cursive";

/* ════════ LOGO ANIMADO ════════ */
// nⁱ OFICIAL (STIX itálico) revelado por uma máscara que "escreve" o traço — com caneta na ponta.
function WriteLogo({ f, fps }) {
  const skelN = React.useRef(null), skelI = React.useRef(null);
  const [len, setLen] = React.useState({ n: 0, i: 0 });
  const uid = React.useMemo(() => "wm" + Math.random().toString(36).slice(2, 8), []);
  React.useEffect(() => {
    if (skelN.current && skelI.current) setLen({ n: skelN.current.getTotalLength(), i: skelI.current.getTotalLength() });
  }, []);
  const p = easeInOut(interp(f, [4, 4 + 2.0 * fps], [0, 1]));
  const nP = Math.min(1, p / 0.58);
  const iP = Math.max(0, Math.min(1, (p - 0.58) / 0.30));
  const dotP = Math.max(0, Math.min(1, (p - 0.86) / 0.10));
  const safe = Math.max(0, Math.min(1, (p - 0.95) / 0.05));
  let pen = null;
  if (len.n) {
    if (nP > 0 && nP < 1) pen = skelN.current.getPointAtLength(nP * len.n);
    else if (iP > 0 && iP < 1) pen = skelI.current.getPointAtLength(iP * len.i);
  }
  const glyph = (o) => (
    <text x="16" y="86" fontFamily={F.math} fontStyle="italic" fontWeight="400" fontSize="86" opacity={o}>
      <tspan fill={T.dsand}>n</tspan><tspan fontSize="50" dy="-22" fill={T.coral}>i</tspan>
    </text>
  );
  return (
    <svg width="62%" viewBox="0 0 150 110" style={{ overflow: "visible" }}>
      <defs>
        <mask id={uid} maskUnits="userSpaceOnUse">
          <path ref={skelN} d="M30 88 L33 54 C 36 44 58 44 62 54 C 64 60 64 76 64 88" fill="none" stroke="#fff" strokeWidth="46" strokeLinecap="round" strokeLinejoin="round" strokeDasharray={len.n || 1} strokeDashoffset={(len.n || 1) * (1 - nP)} />
          <path ref={skelI} d="M96 66 L101 44" fill="none" stroke="#fff" strokeWidth="28" strokeLinecap="round" strokeDasharray={len.i || 1} strokeDashoffset={(len.i || 1) * (1 - iP)} />
          <circle cx="102" cy="32" r="12" fill="#fff" opacity={dotP} />
        </mask>
      </defs>
      <g mask={`url(#${uid})`}>{glyph(1)}</g>
      {glyph(safe)}
      {pen && <g transform={`translate(${pen.x} ${pen.y})`}><circle r="3.8" fill={T.coral} /><line x1="0" y1="0" x2="12" y2="-16" stroke={T.coral} strokeWidth="3" strokeLinecap="round" /></g>}
    </svg>
  );
}
const ANIM = {
  write: (f, fps) => <WriteLogo f={f} fps={fps} />,
  assemble: (f, fps) => {
    const eo = (a, b) => easeOut(interp(f, [a, b], [0, 1]));   // ease-out: entra e TRAVA rígido
    const L = eo(0, 18), D = eo(8, 28), R = eo(16, 38);
    let ty = -120, op = 0, sx = 1, sy = 1;
    const t = f - 40;                                          // bolinha salta DEPOIS de montar
    if (t >= 0) {
      op = 1;
      const decay = Math.exp(-t * 0.055);
      ty = -Math.abs(Math.sin(t * 0.2)) * 78 * decay;
      const contact = Math.pow(Math.max(0, Math.cos(t * 0.2)), 2) * decay;
      sy = 1 - 0.28 * contact; sx = 1 + 0.28 * contact;
    }
    return (
      <svg width="52%" viewBox="0 0 100 100" style={{ overflow: "visible" }}>
        <g fill="none" strokeWidth="11" strokeLinecap="butt" strokeLinejoin="miter">
          <path d="M27 79 L27 23" stroke="#BDBAB4" transform={`translate(${(1 - L) * -95} 0)`} />
          <path d="M27 23 L61 79" stroke={T.coral} transform={`translate(0 ${(1 - D) * -120}) rotate(${(1 - D) * -14} 44 51)`} />
          <path d="M61 23 L61 79 L85 79" stroke="#BDBAB4" transform={`translate(${(1 - R) * 120} 0) rotate(${(1 - R) * 44} 73 60)`} />
        </g>
        <g opacity={op} transform={`translate(61 ${23 + ty}) scale(${sx} ${sy})`}>
          <circle r="8" fill={T.dcyan} />
        </g>
      </svg>
    );
  },
};
const CODE_WRITE = `<!-- nⁱ escrito à mão: traça os contornos e uma "caneta" segue a ponta (Hyperframes + GSAP). -->
<div class="scene" data-duration="2.6s">
  <svg viewBox="0 0 130 112" width="320">
    <path id="n" d="M40 100 L45 56 C 47 46 61 46 67 56 C 71 62 71 82 71 100"
      fill="none" stroke="#F2D8A7" stroke-width="8" stroke-linecap="round" stroke-linejoin="round"/>
    <path id="i" d="M91 100 L97 58" fill="none" stroke="#E8553A" stroke-width="8" stroke-linecap="round"/>
    <circle id="dot" cx="99" cy="46" r="4.5" fill="#E8553A" opacity="0"/>
    <g id="pen"><circle r="3.6" fill="#E8553A"/><line x1="0" y1="0" x2="11" y2="-15" stroke="#E8553A" stroke-width="3" stroke-linecap="round"/></g>
  </svg>
</div>
<script>
  gsap.registerPlugin(MotionPathPlugin);
  const tl = gsap.timeline({defaults: {ease: 'none'}});
  [['#n', 1.4], ['#i', 0.6]].forEach(([sel, dur]) => {
    const el = document.querySelector(sel), L = el.getTotalLength();
    el.style.strokeDasharray = L; el.style.strokeDashoffset = L;        // esconde o traço
    tl.to(el, {strokeDashoffset: 0, duration: dur}, '>');               // desenha
    tl.to('#pen', {motionPath: {path: sel, align: sel, alignOrigin: [0, 0]}, duration: dur}, '<'); // caneta segue
  });
  tl.to('#dot', {opacity: 1, duration: .15}).set('#pen', {opacity: 0});
</script>`;
const CODE_GRAVITY = `import {useCurrentFrame, useVideoConfig, spring, interpolate} from 'remotion';

// Cada peça do NL entra de um jeito (mais orgânico, com profundidade).
export const LogoGravity: React.FC = () => {
  const frame = useCurrentFrame();
  const {fps} = useVideoConfig();
  const sp = (delay, damping = 13) => spring({frame: frame - delay, fps, config: {damping}});
  const L = sp(0), D = sp(8), R = sp(16), N = sp(26, 10);
  const lx = (1 - L) * -95;                       // haste esquerda: vem da esquerda
  const dy = (1 - D) * -118, dr = (1 - D) * -16;  // diagonal: cai de cima, tombando
  const rx = (1 - R) * 118, rr = (1 - R) * 46;    // haste direita + L: rola da direita
  const nsc = 1 + (1 - N) * 2.8;                  // dot azul: vem do primeiro plano (escala) e quica
  return (
    <svg width={220} height={220} viewBox="0 0 100 100">
      <g fill="none" strokeWidth="11" strokeLinecap="butt">
        <path d="M27 79 L27 23" stroke="#BDBAB4" transform={\`translate(\${lx} 0)\`} />
        <path d="M27 23 L61 79" stroke="#E8553A" transform={\`translate(0 \${dy}) rotate(\${dr} 44 51)\`} />
        <path d="M61 23 L61 79 L85 79" stroke="#BDBAB4" transform={\`translate(\${rx} 0) rotate(\${rr} 73 60)\`} />
      </g>
      <g transform={\`translate(61 23) scale(\${nsc}) translate(-61 -23)\`} opacity={Math.min(1, N * 1.7)}>
        <circle cx="61" cy="23" r="8" fill="#54C8D0" />
      </g>
    </svg>
  );
};`;

const CODE_NI_R = `import {useCurrentFrame, useVideoConfig, interpolate, Easing} from 'remotion';
import {useRef, useEffect, useState} from 'react';

// nⁱ OFICIAL (STIX itálico) revelado por uma máscara que "escreve" o traço.
export const NiWrite: React.FC = () => {
  const frame = useCurrentFrame();
  const {fps} = useVideoConfig();
  const sn = useRef<SVGPathElement>(null), si = useRef<SVGPathElement>(null);
  const [len, setLen] = useState({n: 1, i: 1});
  useEffect(() => { setLen({n: sn.current!.getTotalLength(), i: si.current!.getTotalLength()}); }, []);
  const p = interpolate(frame, [4, 4 + 2 * fps], [0, 1],
    {extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.inOut(Easing.ease)});
  const nP = Math.min(1, p / 0.58);
  const iP = Math.max(0, Math.min(1, (p - 0.58) / 0.30));
  const dot = interpolate(p, [0.86, 0.96], [0, 1], {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'});
  return (
    <svg width={300} viewBox="0 0 150 110">
      <defs>
        <mask id="ink" maskUnits="userSpaceOnUse">
          <path ref={sn} d="M30 88 L33 54 C 36 44 58 44 62 54 C 64 60 64 76 64 88" stroke="#fff"
            strokeWidth="46" fill="none" strokeLinecap="round" strokeLinejoin="round"
            strokeDasharray={len.n} strokeDashoffset={len.n * (1 - nP)} />
          <path ref={si} d="M96 66 L101 44" stroke="#fff" strokeWidth="28" fill="none"
            strokeLinecap="round" strokeDasharray={len.i} strokeDashoffset={len.i * (1 - iP)} />
          <circle cx="102" cy="32" r="12" fill="#fff" opacity={dot} />
        </mask>
      </defs>
      <g mask="url(#ink)">
        <text x="16" y="86" fontFamily="'STIX Two Text'" fontStyle="italic" fontSize="86">
          <tspan fill="#F2D8A7">n</tspan><tspan fontSize="50" dy="-22" fill="#E8553A">i</tspan>
        </text>
      </g>
    </svg>
  );
};`;
const CODE_NI_H = `<!-- nⁱ OFICIAL revelado por máscara que "escreve", com caneta na ponta (Hyperframes + GSAP). -->
<div class="scene" data-duration="2.5s">
  <svg viewBox="0 0 150 110" width="320">
    <defs>
      <mask id="ink" maskUnits="userSpaceOnUse">
        <path id="sn" d="M30 88 L33 54 C 36 44 58 44 62 54 C 64 60 64 76 64 88"
          stroke="#fff" stroke-width="46" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
        <path id="si" d="M96 66 L101 44" stroke="#fff" stroke-width="28" fill="none" stroke-linecap="round"/>
        <circle id="dm" cx="102" cy="32" r="12" fill="#fff" opacity="0"/>
      </mask>
    </defs>
    <g mask="url(#ink)">
      <text x="16" y="86" font-family="STIX Two Text" font-style="italic" font-size="86">
        <tspan fill="#F2D8A7">n</tspan><tspan font-size="50" dy="-22" fill="#E8553A">i</tspan>
      </text>
    </g>
    <g id="pen"><circle r="3.8" fill="#E8553A"/><line x1="0" y1="0" x2="12" y2="-16" stroke="#E8553A" stroke-width="3" stroke-linecap="round"/></g>
  </svg>
</div>
<script>
  gsap.registerPlugin(MotionPathPlugin);
  const tl = gsap.timeline({defaults: {ease: 'none'}});
  [['#sn', 1.4], ['#si', 0.6]].forEach(([sel, dur]) => {
    const el = document.querySelector(sel), L = el.getTotalLength();
    el.style.strokeDasharray = L; el.style.strokeDashoffset = L;
    tl.to(el, {strokeDashoffset: 0, duration: dur}, '>');
    tl.to('#pen', {motionPath: {path: sel, align: sel, alignOrigin: [0, 0]}, duration: dur}, '<');
  });
  tl.to('#dm', {opacity: 1, duration: .12}).set('#pen', {opacity: 0});
</script>`;
const CODE_NL_R = `import {useCurrentFrame, useVideoConfig, interpolate, Easing} from 'remotion';

export const NlAssemble: React.FC = () => {
  const frame = useCurrentFrame();
  const {fps} = useVideoConfig();
  // entram e TRAVAM rígidas (ease-out, sem overshoot)
  const eo = (a, b) => interpolate(frame, [a, b], [0, 1],
    {extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.out(Easing.cubic)});
  const L = eo(0, 18), D = eo(8, 28), R = eo(16, 38);
  // só a bolinha azul salta (estilo abajur da Pixar), depois que montou
  const t = frame - 40; let ty = -120, op = 0, sx = 1, sy = 1;
  if (t >= 0) {
    op = 1;
    const decay = Math.exp(-t * 0.055);
    ty = -Math.abs(Math.sin(t * 0.2)) * 78 * decay;
    const contact = Math.pow(Math.max(0, Math.cos(t * 0.2)), 2) * decay;
    sy = 1 - 0.28 * contact; sx = 1 + 0.28 * contact;
  }
  return (
    <svg width={220} viewBox="0 0 100 100">
      <g fill="none" strokeWidth="11" strokeLinecap="butt">
        <path d="M27 79 L27 23" stroke="#BDBAB4" transform={\`translate(\${(1-L)*-95} 0)\`} />
        <path d="M27 23 L61 79" stroke="#E8553A" transform={\`translate(0 \${(1-D)*-120}) rotate(\${(1-D)*-14} 44 51)\`} />
        <path d="M61 23 L61 79 L85 79" stroke="#BDBAB4" transform={\`translate(\${(1-R)*120} 0) rotate(\${(1-R)*44} 73 60)\`} />
      </g>
      <g opacity={op} transform={\`translate(61 \${23 + ty}) scale(\${sx} \${sy})\`}>
        <circle r="8" fill="#54C8D0" />
      </g>
    </svg>
  );
};`;
const CODE_NL_H = `<!-- NL: peças entram e TRAVAM rígidas; só a bolinha azul salta (estilo abajur Pixar). -->
<div class="scene" data-duration="3.2s">
  <svg viewBox="0 0 100 100" width="240">
    <g fill="none" stroke-width="11" stroke-linecap="butt">
      <path id="s1" d="M27 79 L27 23" stroke="#BDBAB4"/>
      <path id="s2" d="M27 23 L61 79" stroke="#E8553A"/>
      <path id="s3" d="M61 23 L61 79 L85 79" stroke="#BDBAB4"/>
    </g>
    <circle id="dot" cx="61" cy="23" r="8" fill="#54C8D0" opacity="0"/>
  </svg>
</div>
<script>
  const tl = gsap.timeline();
  // entram de direções diferentes e PARAM (power3.out = sem bounce)
  tl.from('#s1', {x: -95, duration: .6, ease: 'power3.out'}, 0)
    .from('#s2', {y: -120, rotation: -14, transformOrigin: '44px 51px', duration: .6, ease: 'power3.out'}, .15)
    .from('#s3', {x: 120, rotation: 44, transformOrigin: '73px 60px', duration: .7, ease: 'power3.out'}, .3);
  // a bolinha quica (Pixar) e dá uma squash no toque
  tl.set('#dot', {opacity: 1})
    .from('#dot', {y: -90, duration: .6, ease: 'bounce.out'})
    .to('#dot', {scaleY: .75, scaleX: 1.25, transformOrigin: '61px 31px', duration: .08, yoyo: true, repeat: 1}, '<0.1');
</script>`;

function GMLogoAnim() {
  return (
    <Section id="logo-anim">
      <SecHead n="09" kicker="Logo animado" title="Abertura e encerramento."
        lead="Quatro assinaturas pra intro e outro: cada logo em Remotion (principal) e em Hyperframes. O nⁱ é escrito à mão (o logo oficial); o NL monta rígido e só a bolinha azul salta. Preview ao vivo + código." />
      <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 22, marginBottom: 24 }}>
        <AnimCard title="nⁱ · Remotion" sub="escrito à mão · logo oficial" badge="Remotion" badgeColor={T.coral} durationInFrames={75} render={ANIM.write} code={CODE_NI_R} />
        <AnimCard title="nⁱ · Hyperframes" sub="escrito à mão · logo oficial" badge="Hyperframes" badgeColor={T.teal} durationInFrames={75} render={ANIM.write} code={CODE_NI_H} />
        <AnimCard title="NL · Remotion" sub="monta rígido · só a bolinha quica" badge="Remotion" badgeColor={T.coral} durationInFrames={105} render={ANIM.assemble} code={CODE_NL_R} />
        <AnimCard title="NL · Hyperframes" sub="monta rígido · só a bolinha quica" badge="Hyperframes" badgeColor={T.teal} durationInFrames={105} render={ANIM.assemble} code={CODE_NL_H} />
      </div>
      <Note title="Intro x outro">
        Abra com o <strong>nⁱ sendo escrito</strong> (constrói expectativa) e feche com o <strong>NL se montando</strong> (energia) — ou inverta por vídeo. As peças travam rígidas; só a bolinha azul tem vida própria (estilo abajur da Pixar). Segure 1–2s no logo estático antes de cortar e respeite <span style={{ fontFamily: F.mono, fontSize: 13 }}>prefers-reduced-motion</span>.
      </Note>
    </Section>
  );
}

/* ════════ INFOGRÁFICOS (hand-drawn) ════════ */
function HDArrow({ color = "#211913", w = 116 }) {
  return (
    <svg viewBox="0 0 120 46" width={w} style={{ overflow: "visible" }}>
      <path d="M6 30 C 38 8, 78 8, 110 24" fill="none" stroke={color} strokeWidth="2.6" strokeLinecap="round" />
      <path d="M98 15 L113 25 L96 31" fill="none" stroke={color} strokeWidth="2.6" strokeLinecap="round" strokeLinejoin="round" />
    </svg>
  );
}
function HDCircle({ color = "#E8553A", children }) {
  return (
    <span style={{ position: "relative", display: "inline-flex", alignItems: "center", justifyContent: "center", padding: "6px 14px" }}>
      <svg viewBox="0 0 150 80" preserveAspectRatio="none" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", overflow: "visible" }}>
        <path d="M75 7 C 120 4, 145 22, 140 41 C 136 62, 104 73, 64 70 C 26 67, 7 50, 11 30 C 14 13, 42 9, 78 10" fill="none" stroke={color} strokeWidth="2.6" strokeLinecap="round" />
      </svg>
      {children}
    </span>
  );
}
function HDUnderline({ color = "#E8A33D", w = 130 }) {
  return <svg viewBox="0 0 140 14" width={w} style={{ overflow: "visible" }}><path d="M4 8 C 40 3, 80 12, 136 5" fill="none" stroke={color} strokeWidth="3.5" strokeLinecap="round" /></svg>;
}

function Placeholder({ label, dark, h = 96 }) {
  const stripe = dark ? "rgba(242,216,167,0.09)" : "rgba(33,25,19,0.06)";
  return (
    <div style={{ height: h, borderRadius: 10, border: `1.5px dashed ${dark ? T.dline : T.line2}`, backgroundImage: `repeating-linear-gradient(45deg, ${stripe} 0 7px, transparent 7px 14px)`, display: "flex", alignItems: "center", justifyContent: "center" }}>
      <span style={{ fontFamily: F.mono, fontSize: 10, letterSpacing: 1, textTransform: "uppercase", color: dark ? T.dim : T.sub }}>{label}</span>
    </div>
  );
}

function InfoExample({ dark }) {
  const ink = dark ? T.dsand : T.ink, sub = dark ? T.dim : T.sub, bg = dark ? T.dbg : T.card, line = dark ? T.dline : T.line;
  const handC = dark ? T.dsand : T.ink;
  const steps = [["Coletar", "logs · API"], ["Modelar", "embeddings"], ["Servir", "resposta"]];
  return (
    <div style={{ background: bg, border: `1px solid ${line}`, borderRadius: 14, padding: "26px 24px", position: "relative", overflow: "hidden" }}>
      <div style={{ display: "flex", alignItems: "baseline", gap: 12, marginBottom: 4 }}>
        <div style={{ fontFamily: F.display, fontWeight: 800, fontSize: 22, color: ink, letterSpacing: -0.6 }}>Como o RAG funciona</div>
        <span style={{ fontFamily: HAND, fontSize: 22, color: T.coral, transform: "rotate(-4deg)", display: "inline-block" }}>na real!</span>
      </div>
      <div style={{ marginBottom: 18 }}><HDUnderline color={T.amber} w={150} /></div>

      <div style={{ display: "grid", gridTemplateColumns: "1fr auto 1fr auto 1fr", alignItems: "center", gap: 6 }}>
        {steps.map((s, i) => (
          <React.Fragment key={i}>
            <div>
              <Placeholder label={i === 1 ? "diagrama" : "screenshot"} dark={dark} />
              <div style={{ marginTop: 9, textAlign: "center" }}>
                <div style={{ fontFamily: F.display, fontWeight: 700, fontSize: 15, color: ink }}>{s[0]}</div>
                <div style={{ fontFamily: HAND, fontSize: 17, color: sub, lineHeight: 1 }}>{s[1]}</div>
              </div>
            </div>
            {i < 2 && <HDArrow color={dark ? T.dterra : T.clay} w={84} />}
          </React.Fragment>
        ))}
      </div>

      <div style={{ display: "flex", alignItems: "center", gap: 16, marginTop: 22, paddingTop: 18, borderTop: `1px dashed ${line}` }}>
        <HDCircle color={T.coral}><span style={{ fontFamily: F.display, fontWeight: 800, fontSize: 30, color: T.coral }}>40%</span></HDCircle>
        <span style={{ fontFamily: HAND, fontSize: 22, color: ink, transform: "rotate(-2deg)" }}>menos latência depois do passo 2 ↑</span>
      </div>
    </div>
  );
}

function GMInfographics() {
  const Tool = ({ label, dark, children }) => (
    <div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
      <div style={{ background: dark ? T.dbg : T.panel, borderRadius: 12, height: 92, display: "flex", alignItems: "center", justifyContent: "center", border: `1px solid ${dark ? T.dline : T.line}` }}>{children}</div>
      <Mono color={T.sub} size={9.5}>{label}</Mono>
    </div>
  );
  return (
    <Section id="infografia" alt>
      <SecHead n="10" kicker="Infográficos" title="Imagem + dado + fluxo, com mão."
        lead="Infográfico é mais solto que diagrama: combina imagens, números e narrativa. Aqui a marca ganha um sotaque hand-drawn — setas, círculos e anotações desenhados à mão (fonte Caveat) sobre a base geométrica. Documentado em claro e escuro." />

      {/* kit hand-drawn */}
      <div style={{ fontFamily: F.display, fontWeight: 800, fontSize: 20, marginBottom: 16 }}>Kit hand-drawn</div>
      <div style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 16, marginBottom: 14 }}>
        <Tool label="Seta desenhada"><HDArrow color={T.ink} /></Tool>
        <Tool label="Círculo de ênfase"><HDCircle color={T.coral}><span style={{ fontFamily: F.display, fontWeight: 800, fontSize: 22 }}>!</span></HDCircle></Tool>
        <Tool label="Sublinhado"><HDUnderline color={T.amber} /></Tool>
        <Tool label="Anotação (Caveat)"><span style={{ fontFamily: HAND, fontSize: 26, color: T.clay, transform: "rotate(-3deg)" }}>importante!</span></Tool>
      </div>
      <div style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 16, marginBottom: 30 }}>
        <Tool label="Seta · escuro" dark><HDArrow color={T.dsand} /></Tool>
        <Tool label="Círculo · escuro" dark><HDCircle color={T.dterra}><span style={{ fontFamily: F.display, fontWeight: 800, fontSize: 22, color: T.dsand }}>!</span></HDCircle></Tool>
        <Tool label="Sublinhado · escuro" dark><HDUnderline color={T.amber} /></Tool>
        <Tool label="Anotação · escuro" dark><span style={{ fontFamily: HAND, fontSize: 26, color: T.dcyan, transform: "rotate(-3deg)" }}>importante!</span></Tool>
      </div>

      <Note title="A regra do hand-drawn">
        O sotaque desenhado é <strong>camada de cima</strong>, não a base: estrutura, imagens e dados continuam limpos e geométricos; setas, círculos e anotações em Caveat entram só pra guiar o olho e dar calor humano. Use com parcimônia — 2 a 3 marcações por peça.
      </Note>

      {/* exemplo claro/escuro */}
      <div style={{ fontFamily: F.display, fontWeight: 800, fontSize: 20, margin: "40px 0 18px" }}>Exemplo · claro ⇄ escuro</div>
      <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 22 }}>
        <div style={{ display: "flex", flexDirection: "column", gap: 9 }}><InfoExample dark={false} /><Mono color={T.sub} size={9.5}>Claro</Mono></div>
        <div style={{ display: "flex", flexDirection: "column", gap: 9 }}><InfoExample dark={true} /><Mono color={T.sub} size={9.5}>Escuro</Mono></div>
      </div>

      {/* assets */}
      <div style={{ fontFamily: F.display, fontWeight: 800, fontSize: 20, margin: "40px 0 16px" }}>Assets hand-drawn</div>
      <div style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 16 }}>
        {[["hd-arrow", "Seta"], ["hd-circle", "Círculo"], ["hd-underline", "Sublinhado"], ["hd-bracket", "Chave"]].map(([id, label]) => (
          <a key={id} href={`assets/${id}.svg`} download style={{ textDecoration: "none", display: "flex", alignItems: "center", justifyContent: "space-between", background: T.card, border: `1px solid ${T.line2}`, borderRadius: 8, padding: "11px 14px", fontFamily: F.mono, fontSize: 11, color: T.ink }}><span>{label} (.svg)</span><span style={{ color: T.cyan }}>↓</span></a>
        ))}
      </div>
    </Section>
  );
}

Object.assign(window, { GMLogoAnim, GMInfographics });
