style(v3): add relative-units rule and convert sidebar CSS from px to rem

Add .claude/rules/18-relative-units.md enforcing rem/em for layout CSS
(px only for icons/borders). Convert GlobalTabBar.svelte and App.svelte
sidebar styles from px to rem. Change rail-btn color to --ctp-subtext0.
This commit is contained in:
Hibryda 2026-03-08 00:27:20 +01:00
parent 820467c029
commit 906e967aa0
3 changed files with 28 additions and 11 deletions

View file

@ -0,0 +1,17 @@
# Relative Units (CSS)
Use relative units (`em`, `rem`, `%`, `vh`, `vw`) for layout and spacing. Pixels are acceptable only for:
- Icon sizes (`width`/`height` on `<svg>` or icon containers)
- Borders and outlines (`1px solid ...`)
- Box shadows
## Rules
- **Layout dimensions** (width, height, max-width, min-width): use `em`, `rem`, `%`, or viewport units.
- **Padding and margin**: use `em` or `rem`.
- **Font sizes**: use `rem` or `em`, never `px`.
- **Gap, border-radius**: use `em` or `rem`.
- **Media queries**: use `em`.
- When existing code uses `px` for layout elements, convert to relative units as part of the change.
- CSS custom properties for typography (`--ui-font-size`, `--term-font-size`) store `px` values because they feed into JS APIs (xterm.js) that require pixels. This is the only exception beyond icons/borders.

View file

@ -217,7 +217,7 @@
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 12px;
padding: 0.5rem 0.75rem;
border-bottom: 1px solid var(--ctp-surface0);
flex-shrink: 0;
}
@ -233,11 +233,11 @@
display: flex;
align-items: center;
justify-content: center;
width: 22px;
height: 22px;
width: 1.375rem;
height: 1.375rem;
background: transparent;
border: none;
border-radius: 4px;
border-radius: 0.25rem;
color: var(--ctp-subtext0);
cursor: pointer;
}

View file

@ -61,24 +61,24 @@
.sidebar-rail {
display: flex;
flex-direction: column;
gap: 2px;
padding: 6px 4px;
gap: 0.25rem;
padding: 0.5rem 0.375rem;
background: var(--ctp-mantle);
border-right: 1px solid var(--ctp-surface0);
flex-shrink: 0;
width: 36px;
width: 2.75rem;
}
.rail-btn {
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
width: 2rem;
height: 2rem;
background: transparent;
border: none;
border-radius: 4px;
color: var(--ctp-overlay1);
border-radius: 0.375rem;
color: var(--ctp-subtext0);
cursor: pointer;
transition: color 0.15s, background 0.15s;
}