import type { ReactNode } from 'react'
import { cn } from '@/lib/utils'

export function SectionHeading({
  tag,
  title,
  body,
  align = 'center',
  className,
}: {
  tag?: string
  title: string
  body?: string
  align?: 'center' | 'left'
  className?: string
}) {
  return (
    <div
      className={cn(
        'max-w-2xl',
        align === 'center' ? 'mx-auto text-center' : 'text-left',
        className,
      )}
    >
      {tag && (
        <span className="text-xs font-semibold uppercase tracking-[0.3em] text-primary">
          {tag}
        </span>
      )}
      <h2 className="mt-3 text-balance font-serif text-3xl font-semibold leading-tight text-foreground md:text-4xl">
        {title}
      </h2>
      {body && (
        <p className="mt-4 text-pretty leading-relaxed text-muted-foreground">
          {body}
        </p>
      )}
    </div>
  )
}

export function ReadNode({ children }: { children: ReactNode }) {
  return <>{children}</>
}
