AstroGlass uses Tailwind CSS v4 for styling via the @tailwindcss/vite plugin. There is no separate tailwind.config.mjs — all customization happens through CSS.
Styling Overview
Global styles and CSS variables are defined in src/styles/global.css. This file handles:
- Base layer resets
- Custom fonts (Inter & JetBrains Mono)
- CSS variables for theming (HSL color values)
Theme-specific overrides live in src/styles/_themes.css.
- src/
- styles/
- global.css — Base styles, fonts, root CSS variables
- _themes.css — Per-theme color overrides
- _animations.css — Shared animation keyframes
- _forms.css — Form input styles
- components/ — Component-specific styles (hero, pricing, etc.)
- styles/
Color System
The project uses a CSS variable-based color system. Colors are defined as HSL values (without the hsl() wrapper), allowing Tailwind’s opacity modifier syntax to work correctly.
/* src/styles/global.css */:root { --p: 260 80% 60%; /* Primary */ --s: 310 80% 60%; /* Secondary */ --a: 190 90% 60%; /* Accent */ --b1: 220 20% 10%; /* Base 1 (Background) */ --b2: 220 18% 14%; /* Base 2 (Surface) */ --bc: 220 20% 90%; /* Base Content (Text) */ --er: 0 80% 60%; /* Error */ --su: 150 80% 50%; /* Success */}Components consume these variables via Tailwind utility classes or hsl():
<div class="bg-[hsl(var(--p))] text-[hsl(var(--bc))]"> Primary Background with Base Content Text</div>To change the site’s color scheme, update the HSL values in global.css. For theme-specific overrides (light/dark mode, per-theme colors), use [data-theme="..."] selectors in _themes.css.
Adding Custom Fonts
- Place font files in
public/fonts/or import from Google Fonts inglobal.css. - Define
@font-facerules insrc/styles/global.css. - Update the font-family CSS variables or Tailwind utilities as needed.
Component Customization
Each theme has its own component variants (e.g., HeroLiquid.astro, HeroGlass.astro). To customize a specific section:
- Navigate to
src/components/sections/{section}/(e.g.,hero/). - Edit the theme-specific file directly (e.g.,
HeroGlass.astro). - Component-specific CSS lives in
src/styles/components/{section}/.
Section components do not accept text props. All content is driven by translation keys via useTranslations(). To change text, edit the JSON files in src/locales/{lang}/.