# Shadows

import { Callout } from "fumadocs-ui/components/callout";
import { Tabs, Tab } from "fumadocs-ui/components/tabs";
import { Steps, Step } from "fumadocs-ui/components/steps";
import {
  Badge,
  Card,
  CardHeader,
  CardTitle,
  CardContent,
} from "@pycolors/ui";
import { CheckCircle, Layers3, PanelsTopLeft, ShieldCheck, XCircle } from "lucide-react";
import { PreferAvoid } from '@/components/docs/prefer-avoid';
import { DocsFeatureGrid } from "@/components/docs/docs-feature-grid";

<div className="flex flex-wrap items-center gap-2">
  <Badge variant="outline">
    Design System
  </Badge>

  <Badge>
    Shadows
  </Badge>
</div>

## Overview

Shadows define **depth and hierarchy** in the interface.

In PyColors, elevation is intentionally subtle. The goal is not visual drama, but **predictable structure**.

A controlled shadow system ensures that:

* surfaces feel layered without noise
* focus states are clear
* overlays feel intentional
* the UI remains calm and readable

<Callout title="Why this matters">
  When shadows are inconsistent or too strong, interfaces feel noisy and unstructured. A restrained elevation system improves clarity and perceived quality.
</Callout>

### What you’ll define

<DocsFeatureGrid
  columns={3}
  tone="platform"
  items={[
  {
    title: 'Elevation scale',
    description:
      'A small set of shadow levels used across all surfaces.',
    icon: Layers3,
  },
  {
    title: 'Usage rules',
    description:
      'Clear constraints to avoid visual noise and inconsistency.',
    icon: ShieldCheck,
  },
  {
    title: 'Surface hierarchy',
    description:
      'Define how components relate visually through depth.',
    icon: PanelsTopLeft,
  },
]}
/>

## Steps

<Steps>
  <Step>
    ### Use a limited elevation scale

    PyColors defines a small set of shadow tokens:

    | Token       | Typical use                     |
    | ----------- | ------------------------------- |
    | `shadow-xs` | buttons, inputs, small controls |
    | `shadow-sm` | default cards and surfaces      |
    | `shadow-md` | popovers, dropdowns             |
    | `shadow-lg` | modals and overlays             |

    Each level increases elevation gradually.
  </Step>

  <Step>
    ### Apply shadows consistently

    <Tabs items={["Preview", "Code"]}>
      <Tab value="Preview">
        <div className="grid gap-4 sm:grid-cols-2">
          <div className="rounded-lg border bg-card p-4 shadow-xs">
            <div className="text-xs text-muted-foreground mb-1">
              shadow-xs
            </div>

            <div className="text-sm">
              Small controls
            </div>
          </div>

          <div className="rounded-lg border bg-card p-4 shadow-sm">
            <div className="text-xs text-muted-foreground mb-1">
              shadow-sm
            </div>

            <div className="text-sm">
              Default cards
            </div>
          </div>

          <div className="rounded-lg border bg-card p-4 shadow-md">
            <div className="text-xs text-muted-foreground mb-1">
              shadow-md
            </div>

            <div className="text-sm">
              Popovers
            </div>
          </div>

          <div className="rounded-lg border bg-card p-4 shadow-lg">
            <div className="text-xs text-muted-foreground mb-1">
              shadow-lg
            </div>

            <div className="text-sm">
              Modals
            </div>
          </div>
        </div>
      </Tab>

      <Tab value="Code">
        ```tsx title="components/shadow-preview.tsx"
        export function ShadowPreview() {
          return (
            <div className="grid gap-4 sm:grid-cols-2">
              <div className="rounded-lg border bg-card p-4 shadow-xs">
                shadow-xs
              </div>

              <div className="rounded-lg border bg-card p-4 shadow-sm">
                shadow-sm
              </div>

              <div className="rounded-lg border bg-card p-4 shadow-md">
                shadow-md
              </div>

              <div className="rounded-lg border bg-card p-4 shadow-lg">
                shadow-lg
              </div>
            </div>
          );
        }
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step>
    ### Avoid custom shadows

    Do not introduce custom `box-shadow` values inside components.

    Instead:

    * reuse existing tokens
    * extend the system if necessary
    * keep visual hierarchy predictable

    <Callout type="info" title="System rule">
      If a new shadow is needed more than once, it should become a token.
    </Callout>
  </Step>
</Steps>

## Decision guide

Use this system if:

* you need consistent elevation across multiple surfaces
* you are building dashboards or SaaS products
* you want predictable layering behavior
* you want UI clarity without visual overload

Avoid if:

* the shadow is decorative only
* it breaks the system scale
* it duplicates an existing token
* it creates visual noise

<PreferAvoid
  prefer={[
  'use predefined shadow tokens',
  'keep elevation subtle',
  'increase depth only when needed',
  'align shadow with radius and surface',
]}
  avoid={[
  'stacking multiple shadows',
  'high contrast or heavy shadows',
  'custom box-shadow per component',
  'inconsistent elevation levels',
]}
/>

## Why it matters

Shadows are one of the fastest ways to break visual consistency.

* too many shadows → noisy UI
* too strong shadows → cheap look
* inconsistent shadows → broken hierarchy

A controlled system ensures:

* clarity
* structure
* visual calm
* perceived product quality