/* Hub tweaks — explore layout + card style. Applies choices to <body>
   data-attributes; the heavy lifting is pure CSS in site.css. */

const HUB_TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "layout": "centered",
  "cards": "magazine",
  "ringMotion": true
}/*EDITMODE-END*/;

function HubTweaks() {
  const [t, setTweak] = useTweaks(HUB_TWEAK_DEFAULTS);

  React.useEffect(() => {
    document.body.dataset.layout = t.layout;
    document.body.dataset.cards = t.cards;
    document.body.dataset.motion = t.ringMotion ? "on" : "off";
  }, [t.layout, t.cards, t.ringMotion]);

  return (
    <TweaksPanel>
      <TweakSection label="Hub layout" />
      <TweakRadio
        label="Arrangement"
        value={t.layout}
        options={["centered", "editorial"]}
        onChange={(v) => setTweak("layout", v)}
      />
      <TweakSection label="Beyond-the-work cards" />
      <TweakRadio
        label="Card style"
        value={t.cards}
        options={["magazine", "compact"]}
        onChange={(v) => setTweak("cards", v)}
      />
      <TweakSection label="Motion" />
      <TweakToggle
        label="Rotating brand ring"
        value={t.ringMotion}
        onChange={(v) => setTweak("ringMotion", v)}
      />
    </TweaksPanel>
  );
}

ReactDOM.createRoot(document.getElementById("tweaks-root")).render(<HubTweaks />);
