/* global React */
const { useState } = React;
const INK = "#1A1A1A";
const GREEN = "#1A6B3C";
const GREEN_DEEP = "#0F4D29";
const BRIGHT = "#2E9E5B";
const BRIGHT_HI = "#3DB86D";
const YELLOW = "#F2C12E";
const YELLOW_HI = "#FFD34A";
const OFF = "#F5F5F0";
const PAPER = "#FFFFFF";
// ---------- Button ----------
function Button({ children, variant = "primary", size = "md", onClick, style, href, as }) {
const base = {
fontFamily: "'DM Sans', sans-serif",
fontWeight: 800,
boxSizing: "border-box",
border: `2.5px solid ${INK}`,
borderRadius: 12,
cursor: "pointer",
display: "inline-flex",
alignItems: "center",
justifyContent: "center",
gap: 10,
boxShadow: `6px 6px 0 0 ${INK}`,
transition: "transform 150ms cubic-bezier(.2,.7,.2,1), box-shadow 150ms cubic-bezier(.2,.7,.2,1), background 150ms",
textDecoration: "none",
letterSpacing: "-0.01em",
lineHeight: 1,
};
const sizes = {
sm: { padding: "10px 16px", fontSize: 14 },
md: { padding: "14px 22px", fontSize: 16 },
lg: { padding: "18px 30px", fontSize: 18 },
xl: { padding: "22px 36px", fontSize: 22 },
};
const variants = {
primary: { background: BRIGHT, color: "#fff" },
primaryHover: { background: BRIGHT_HI },
secondary: { background: YELLOW, color: INK },
secondaryHover: { background: YELLOW_HI },
ghostDark: { background: "transparent", color: "#fff", borderColor: "#fff", boxShadow: "none" },
outline: { background: "transparent", color: INK, boxShadow: `4px 4px 0 0 ${INK}` },
};
const [hover, setHover] = useState(false);
const [press, setPress] = useState(false);
const variantStyle = variants[variant] || variants.primary;
const hoverBg = variant === "primary" ? BRIGHT_HI : variant === "secondary" ? YELLOW_HI : variantStyle.background;
const hoverStyle = hover && !press ? { transform: "translate(-1px,-1px)", boxShadow: variant === "ghostDark" ? "none" : `7px 7px 0 0 ${INK}`, background: hoverBg } : {};
const pressStyle = press ? { transform: "translate(3px,3px)", boxShadow: variant === "ghostDark" ? "none" : `2px 2px 0 0 ${INK}`, background: variant === "primary" ? "#248048" : variant === "secondary" ? "#D9A719" : variantStyle.background } : {};
const Tag = as || (href ? "a" : "button");
const extra = href ? { href } : {};
return (