import * as React from 'react' import { cva, type VariantProps } from 'class-variance-authority' import { cn } from '@/lib/utils' const cardVariants = cva( 'flex flex-col rounded-lg text-card-foreground transition-[box-shadow,background-color,border-color] duration-[var(--sumi-duration-normal)] ease-out relative overflow-hidden', { variants: { variant: { /** Shadows wired to SUMI tokens via @theme — auto dark/light intensity */ default: 'bg-card border border-border shadow-card hover:shadow-card-hover hover:bg-card/95', elevated: 'bg-card border border-border shadow-lg hover:shadow-xl hover:bg-card/95', ghost: 'bg-transparent border-0', outline: 'bg-transparent border border-border', muted: 'bg-muted/50 border border-border', interactive: 'bg-card border border-transparent shadow-card cursor-pointer hover:shadow-card-hover hover:border-primary/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2', spotlight: 'bg-card/80 border border-border hover:border-border', /* Immersive surface: subtle border, lighter + diffuse shadow on hover */ surface: 'bg-card border border-border shadow-none hover:bg-card/90 hover:border-border hover:shadow-card-hover transition-all duration-[var(--sumi-duration-slow)] ease-in-out', /* Glass effect: backdrop blur, transparent background */ glass: 'bg-card/80 dark:bg-black/20 backdrop-blur-xl border border-border', }, padding: { none: '', sm: 'p-4', default: 'p-6', lg: 'p-8', }, }, defaultVariants: { variant: 'default', padding: 'none', }, }, ) interface CardProps extends React.ComponentProps<'div'>, VariantProps { spotlight?: boolean; spotlightColor?: string; } function Card({ className, variant, padding, spotlight, spotlightColor = 'rgba(255, 255, 255, 0.1)', ...props }: CardProps) { const divRef = React.useRef(null); const [position, setPosition] = React.useState({ x: 0, y: 0 }); const [opacity, setOpacity] = React.useState(0); const handleMouseMove = (e: React.MouseEvent) => { if (!divRef.current || (variant !== 'spotlight' && !spotlight)) return; const div = divRef.current; const rect = div.getBoundingClientRect(); setPosition({ x: e.clientX - rect.left, y: e.clientY - rect.top }); }; const handleMouseEnter = () => { setOpacity(1); }; const handleMouseLeave = () => { setOpacity(0); }; const isSpotlight = variant === 'spotlight' || spotlight; return (
{isSpotlight && (
)}
{props.children}
) } function CardHeader({ className, ...props }: React.ComponentProps<'div'>) { return (
) } function CardTitle({ className, ...props }: React.ComponentProps<'h3'>) { return (

) } function CardDescription({ className, ...props }: React.ComponentProps<'p'>) { return (

) } function CardAction({ className, ...props }: React.ComponentProps<'div'>) { return (

) } function CardContent({ className, ...props }: React.ComponentProps<'div'>) { return (
) } function CardFooter({ className, ...props }: React.ComponentProps<'div'>) { return (
) } export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, cardVariants, }