# Iliya Theme — Project Context

## Stack
- WordPress (classic PHP theme, **not** a block theme)
- Tailwind CSS v4 (config lives in `assets/css/site.css`, compiled to `dist.css`)
- **Motion** (motion.dev) for animation — vanilla JS, bundled with esbuild to `assets/js/dist.js`
- **RTL Persian site** (`dir="rtl"`, `lang="fa"`)
- No WooCommerce (content / corporate site)

## Build
- `npm run dev` — watch CSS + JS together (Tailwind watch + esbuild watch)
- `npm run build` — minified CSS + JS for production
- `npm run dev:css` / `npm run build:css` — Tailwind only
- `npm run dev:js` / `npm run build:js` — esbuild bundle only
- `npm run format` — Prettier (php/html/css/js)
- Always re-run a build after editing `site.css` or `main.js`; templates load the compiled `dist.*`.

## Motion + WordPress — how it works
Framer Motion's React API (`motion/react`) needs React. This theme is PHP templates,
so we use the same team's vanilla engine: `import { animate, inView, stagger } from 'motion'`.
esbuild bundles it into `dist.js` (IIFE) — no React, no build step in the browser.
- Reveal an element on scroll: add `data-motion="fade-up"` (optional `data-motion-delay="0.1"`).
- Stagger a list: add `data-motion-group` to the container.
- `prefers-reduced-motion` is respected in both JS and `site.css`.
- If you later want true React islands (e.g. an interactive widget) you *can* add
  `motion/react` + a React mount — but keep it to isolated islands, not the whole theme.

## First-load loader (`template-parts/loader.php`)
- Homepage only, once per session (sessionStorage `iliyaSeen`). Logo `logo-stack.webp` on a near-black overlay.
- Motion does grow+fade (scale/opacity); the top→bottom "draw" reveal is a **CSS `clip-path` inset transition** (`.is-revealed`) — Motion does NOT reliably animate clip-path, so don't move it into Motion.
- 5s guard timeout + `<noscript>` hide so the overlay can never trap the user. Respects reduced-motion (instant skip).
- Why image not inline-SVG path-draw: the brand SVG is 171 gradient-filled facets (not line-art); per-path stroke/opacity animation read as a faint tangle and fought SVG-attr-vs-style + Motion-array quirks. Image grow+wipe is the clean, reliable result.

## RTL — CRITICAL RULES
- Use Tailwind **logical** properties: `ps/pe/ms/me`, `start/end`, `text-start/text-end` — never `pl/pr/ml/mr/left/right`.
- `start-0` = right edge, `end-0` = left edge.
- Gradients/absolute positioning: think about which side is the start in RTL.
- Offcanvas/sidebars slide from the RIGHT.

## Design System
- **Border radius: 0 everywhere** — all `--radius-*` tokens are `0px`. Never use `rounded-*`.
- Body font: `AzarMehr` (`--font-body`). Headings: `Dana VF` (`--font-display`, class `.font-dana`).
- Persian numerals: `font-feature-settings: "ss02"` (auto on body + headings).
- Colors: **luxury emerald green (`--color-accent` #168f4c) + metallic gold (`--color-gold`)** from the brand logo. Deep green-black darks (`--color-dark` #08160f). Gold for eyebrows/accents/hairlines/icons-on-dark; green for CTAs/links. See `DESIGN-SYSTEM.md`.
- Brand logo: `assets/images/logo-mark.webp` (header/footer), `logo-stack.webp` (watermark). Tagline: «ساختمان و تجارت فولاد».
- Company: ایلیا فخر آسیا (Iliya Fakhr Asia) — steel/scrap trading + heavy construction & infrastructure contracting.
- Container: `max-w-[1200px]` centered. Section padding ~`py-16`/`py-20`.

## File Structure
- `header.php` / `footer.php` — chrome, `wp_nav_menu('primary')` + `wp_nav_menu('footer')`
- `front-page.php` — homepage (placeholder hero + latest posts)
- `index.php` / `archive.php` / `search.php` / `single.php` / `page.php` / `404.php`
- `template-parts/post-card.php` — reusable card
- `template-parts/breadcrumb.php` — RTL breadcrumb
- `searchform.php`, `sidebar.php`
- `functions.php` — setup, enqueue, menus, widgets, `iliya_icon()` inline-SVG helper
- `assets/css/site.css` — Tailwind source + tokens; `dist.css` — compiled
- `assets/js/main.js` — source; `dist.js` — bundled
- `assets/fonts/` — AzarMehr + Dana VF (woff2)

## Local Dev
- Served via Valet at `http://iliya.test` (run `valet link iliya` from the site root once; needs sudo).
- DB `iliya` (user `root`, no password), table prefix `il_`.
- WP admin user `iliya` / `iliya`. Language `fa_IR`. Timezone `Asia/Tehran`.

## Design tooling
- **21st.dev Magic MCP** is installed (user scope) — use it to generate/inspect UI components during design.
