```
### Dark mode
```css
@media (prefers-color-scheme: dark) {
:root {
--color-bg: black;
}
}
/* Or class-based */
.dark {
--color-bg: black;
}
```
```tsx
```
### CSS-in-JS 가 적절 한 경우
```
- 매우 동적 (theme switch runtime).
- Library 가 CSS-in-JS 사용.
- Team 가 익숙.
→ 하지만 modern = native CSS 가 충분.
```
### Astro CSS
```astro
---
---
...
```
→ Component-scoped CSS native.
### Production
- **Vercel docs**: Tailwind.
- **GitHub**: 옛 Sass → 새 design system.
- **Notion**: 자체 CSS.
- **Stripe**: Sass + design system.
- **shadcn/ui**: Tailwind.
### Real-world migration
```
1. Audit current CSS.
2. Pick 1 (Tailwind / Panda / native).
3. Component 별 migrate.
4. Test (visual regression).
5. Remove old.
→ 매 milestone 의 measurable.
```
### Bundle size
```
Emotion: 12 KB runtime.
Styled-components: 16 KB.
Tailwind: 0 (build).
Panda: 0 (build).
Vanilla Extract: 0.
→ Modern = 0 runtime.
```
### LLM 도움
```
- Style migration 의 component 별.
- Tailwind class 의 codegen.
- Visual regression 검증.
→ Cursor 의 큰 use case.
```
### Tools
```
- Tailwind CSS (v4).
- Panda CSS.
- Vanilla Extract.
- StyleX (Meta).
- Lightning CSS.
- PostCSS (legacy).
```
### StyleX (Meta)
```ts
import * as stylex from '@stylex/stylex';
const styles = stylex.create({
base: { padding: 16, background: 'blue' },
});
```
→ Atomic + zero runtime + type-safe.
## 🤔 의사결정 기준
| 상황 | 추천 |
|---|---|
| New project | Tailwind 4 |
| Type-safe + JS | Panda CSS / Vanilla Extract |
| 매우 dynamic | StyleX / Emotion |
| 작은 / static | Native CSS |
| Component library | shadcn (Tailwind) |
| Migration | 점진 + visual test |
## ❌ 안티패턴
- **CSS-in-JS in 새 project**: runtime cost.
- **Dynamic Tailwind class**: JIT miss.
- **Tailwind + Sass**: 둘 다 사용.
- **Migration big bang**: visual regression.
- **No design tokens**: drift.
## 🤖 LLM 활용 힌트
- Tailwind 4 = modern default.
- Panda / Vanilla Extract = type-safe alternative.
- Native CSS 가 충분 (modern feature).
- CSS-in-JS = legacy migration.
## 🔗 관련 문서
- [[Frontend_Tailwind_Architecture]]
- [[Frontend_Bun_Lightning_Patterns]]
- [[Web_Anchor_Positioning_CSS]]