mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 08:09:18 +02:00
Refactor CSS architecture per css-methodology-spec.md
Split CSS into named layers: reset → colors → typography → base →
components → utilities. Each component has one unique root class in
its own file. No cross-component overrides.
New files:
- reset.css (modern-normalize base — matches project's prior reset)
- colors.css (all colour variables)
- typography.css (font faces, size/space scale, font-family vars)
- base.css (≤ 5 site-wide rules: layout, headings)
- utilities.css (sr-only, skip-link, reduced-motion)
- style.css (root @import file loading all layers)
- components/{links,focus,forms,tables,dialog,details,media,
buttons,badges,toasts,pagination,header,search}.css
Existing files:
- variables.css → backward-compat wrapper (imports colors + typography)
- common.css → backward-compat wrapper (imports style.css)
- Page files (admin, public, form, tfe, apropos, repertoire, system,
file-access) → removed redundant @import url(./variables.css)
- head.php → loads style.css instead of modern-normalize + common.css
- partage pages → load style.css
Fixes vs initial refactoring:
- reset.css: use modern-normalize base (not Tailwind Preflight) to
avoid border/list/heading regressions from aggressive defaults
- components/search.css: restore !important flags on input styles
(needed to override forms.css base input selectors)
- acces.php: add toast feedback on password copy button
Cleaned up duplicate status-badge/toast definitions from admin.css
(now live in components/badges.css and components/toast.css).
This commit is contained in:
218
app/public/assets/css/components/header.css
Normal file
218
app/public/assets/css/components/header.css
Normal file
@@ -0,0 +1,218 @@
|
||||
/* ============================================================
|
||||
HEADER — Site header, navigation, hamburger menu
|
||||
Root class: header (element selector — the only instance)
|
||||
============================================================ */
|
||||
|
||||
/* ── Header bar ─────────────────────────────────────────────────────── */
|
||||
|
||||
header {
|
||||
vertical-align: center;
|
||||
flex-shrink: 0;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
var(--gradient-1) 0%,
|
||||
var(--gradient-2) 33%,
|
||||
var(--gradient-3) 66%,
|
||||
var(--gradient-4) 100%
|
||||
);
|
||||
|
||||
.nav-logo {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav-left-links,
|
||||
.nav-right-links {
|
||||
display: flex;
|
||||
gap: var(--space-l);
|
||||
align-items: center;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
nav {
|
||||
padding: var(--space-s) var(--space-s);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: var(--step-0);
|
||||
|
||||
a {
|
||||
font-family: var(--font-display);
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--accent-foreground);
|
||||
text-decoration: none;
|
||||
padding: var(--space-3xs) var(--space-xs);
|
||||
border-radius: var(--radius);
|
||||
text-shadow:
|
||||
0 0 16px var(--header-shadow-strong),
|
||||
0 0 32px var(--header-shadow-soft);
|
||||
}
|
||||
|
||||
ul {
|
||||
display: flex;
|
||||
gap: var(--space-l);
|
||||
align-items: center;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul a {
|
||||
transition: opacity 0.15s;
|
||||
}
|
||||
|
||||
ul a:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
ul a[aria-current="page"] {
|
||||
opacity: 1;
|
||||
border-bottom: 1px solid var(--header-nav-active-border);
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
.nav-top-row {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.nav-mobile-links {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Hamburger menu (pure CSS, checkbox trick) ──────────────────────── */
|
||||
/* DOM order (public only):
|
||||
input.menu-btn ← off-screen checkbox
|
||||
nav
|
||||
div.nav-top-row ← always-visible row
|
||||
ul.nav-left-links ← logo + Répertoire
|
||||
ul.nav-right-links ← Licences, À Propos
|
||||
label.menu-icon ← burger icon trigger
|
||||
ul.nav-mobile-links ← full dropdown (hidden by default) */
|
||||
|
||||
.menu-btn {
|
||||
position: absolute;
|
||||
top: -9999px;
|
||||
left: -9999px;
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
display: none;
|
||||
cursor: pointer;
|
||||
padding: var(--space-2xs) var(--space-s);
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* Middle bar of the burger icon */
|
||||
.navicon {
|
||||
background: var(--accent-foreground);
|
||||
display: block;
|
||||
height: 2px;
|
||||
width: 24px;
|
||||
position: relative;
|
||||
transition: all 0.3s ease-out;
|
||||
}
|
||||
|
||||
.navicon::before,
|
||||
.navicon::after {
|
||||
content: "";
|
||||
background: var(--accent-foreground);
|
||||
display: block;
|
||||
height: 2px;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
transition: all 0.3s ease-out;
|
||||
}
|
||||
|
||||
.navicon::before { top: -7px; }
|
||||
.navicon::after { bottom: -7px; }
|
||||
|
||||
/* ── Mobile (≤ 640px) ───────────────────────────────────────────────── */
|
||||
|
||||
@media screen and (max-width: 640px) {
|
||||
header nav[aria-label="Navigation principale"] {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
header nav[aria-label="Navigation principale"] .nav-top-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: var(--space-s);
|
||||
}
|
||||
|
||||
header nav[aria-label="Navigation principale"] .nav-right-links {
|
||||
display: none;
|
||||
}
|
||||
|
||||
header nav[aria-label="Navigation principale"] .nav-left-links {
|
||||
display: flex;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
header nav[aria-label="Navigation principale"]
|
||||
.nav-left-links li:not(:first-child) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menu-icon { display: flex; }
|
||||
|
||||
header nav[aria-label="Navigation principale"] .nav-mobile-links {
|
||||
display: block;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
transition: max-height 0.2s ease-out;
|
||||
}
|
||||
|
||||
.menu-btn:checked
|
||||
~ nav[aria-label="Navigation principale"]
|
||||
.nav-mobile-links {
|
||||
max-height: 300px;
|
||||
}
|
||||
|
||||
header nav[aria-label="Navigation principale"] .nav-mobile-links li {
|
||||
border-top: 1px solid var(--header-nav-active-border);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
header nav[aria-label="Navigation principale"] .nav-mobile-links li a {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: var(--space-s) var(--space-s);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* Animate burger → X */
|
||||
.menu-btn:checked
|
||||
~ nav[aria-label="Navigation principale"]
|
||||
.menu-icon
|
||||
.navicon {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.menu-btn:checked
|
||||
~ nav[aria-label="Navigation principale"]
|
||||
.menu-icon
|
||||
.navicon::before {
|
||||
transform: rotate(-45deg);
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.menu-btn:checked
|
||||
~ nav[aria-label="Navigation principale"]
|
||||
.menu-icon
|
||||
.navicon::after {
|
||||
transform: rotate(45deg);
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user