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:
Pontoporeia
2026-05-19 16:55:32 +02:00
parent 7c30d1c55d
commit 7cf020c7bd
36 changed files with 1254 additions and 1052 deletions
@@ -0,0 +1,48 @@
/* ============================================================
BADGES — Status badges, access badges.
Root class: .status-badge
============================================================ */
.status-badge {
display: inline-block;
padding: var(--space-3xs) var(--space-2xs);
border-radius: var(--radius);
font-size: var(--step--2);
font-weight: 500;
letter-spacing: 0.04em;
}
.status-published {
background: var(--green-muted-bg);
color: var(--accent-green);
}
.status-pending {
background: var(--warning-muted-bg);
color: var(--warning);
}
.status-access {
display: inline-block;
font-size: var(--step--2);
padding: var(--space-3xs) var(--space-3xs);
border-radius: var(--radius);
background: var(--bg-tertiary);
color: var(--text-secondary);
letter-spacing: 0.03em;
}
.status-access--libre {
background: var(--green-muted-bg);
color: var(--accent-green);
}
.status-access--interne {
background: var(--blue-muted-bg);
color: var(--accent-blue);
}
.status-access--interdit {
background: var(--error-muted-bg);
color: var(--error);
}
@@ -0,0 +1,146 @@
/* ============================================================
BUTTONS — Shared .btn base class with variant modifiers.
Targets both <a> and <button>. Always has a background.
Root class: .btn
============================================================ */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--space-3xs);
padding: var(--space-xs);
border-radius: var(--radius);
font-size: var(--step--1);
font-family: inherit;
font-weight: 500;
letter-spacing: 0.04em;
cursor: pointer;
text-decoration: none;
line-height: 1.3;
border: none;
transition: background 0.15s, opacity 0.15s, box-shadow 0.15s, filter 0.15s;
width: fit-content;
}
.btn:hover { filter: brightness(0.92); }
/* Primary: accent background, white text */
.btn--primary {
background: var(--accent-primary);
color: var(--accent-foreground);
border: 1px solid transparent;
}
.btn--primary:hover {
background: var(--accent-secondary);
filter: none;
}
/* Secondary: light background with border */
.btn--secondary {
background: var(--bg-primary);
color: var(--text-secondary);
border: 1px solid var(--border-primary);
}
.btn--secondary:hover {
border-color: var(--text-secondary);
color: var(--text-primary);
filter: none;
}
/* Muted secondary: bg-secondary background */
.btn--muted {
background: var(--bg-secondary);
color: var(--text-secondary);
border: 1px solid var(--border-primary);
}
.btn--muted:hover {
background: var(--bg-tertiary);
color: var(--text-primary);
filter: none;
}
/* Ghost: transparent bg, border, for links styled as buttons */
.btn--ghost {
background: transparent;
color: var(--text-secondary);
border: 1px solid var(--border-primary);
}
.btn--ghost:hover {
border-color: var(--text-secondary);
color: var(--text-primary);
filter: none;
}
/* Danger: red background */
.btn--danger {
background: var(--accent-red);
color: var(--accent-foreground);
}
.btn--danger:hover { filter: brightness(0.9); }
/* Warning: yellow background */
.btn--warning {
background: var(--accent-yellow);
color: var(--text-primary);
}
.btn--warning:hover { filter: brightness(0.9); }
/* Success: green background */
.btn--success {
background: var(--accent-green);
color: var(--accent-foreground);
}
.btn--success:hover { filter: brightness(0.9); }
/* Small size modifier */
.btn--sm {
padding: var(--space-2xs) var(--space-xs);
font-size: var(--step--2);
}
/* Large size modifier */
.btn--lg {
padding: var(--space-s) var(--space-m);
font-size: var(--step-0);
}
/* Semantic colour modifiers on muted base (for table/action buttons) */
.btn--blue {
background: var(--blue-muted-bg);
color: var(--accent-blue);
border: 1px solid var(--blue-muted-border);
}
.btn--blue:hover { background: var(--blue-muted-bg-hover); filter: none; }
.btn--yellow {
background: var(--yellow-muted-bg);
color: var(--accent-yellow);
border: 1px solid var(--yellow-muted-border);
}
.btn--yellow:hover { background: var(--yellow-muted-bg-hover); filter: none; }
.btn--green {
background: var(--green-muted-bg);
color: var(--accent-green);
border: 1px solid var(--green-muted-border);
}
.btn--green:hover { background: var(--green-muted-bg-hover); filter: none; }
.btn--red {
background: var(--error-muted-bg);
color: var(--error);
border: 1px solid var(--danger-border-muted);
}
.btn--red:hover { filter: brightness(0.9); }
@@ -0,0 +1,30 @@
/* ============================================================
DETAILS / SUMMARY — Base styling for <details>/<summary>.
Root: element selectors
============================================================ */
details > summary {
cursor: pointer;
list-style: none;
}
details > summary::-webkit-details-marker {
display: none;
}
details {
padding: var(--space-s);
}
summary {
font-family: var(--font-display);
font-weight: 600;
text-decoration: 1px wavy;
color: var(--accent-secondary);
svg {
fill: var(--accent-secondary);
vertical-align: text-bottom;
height: 1.4em;
}
}
@@ -0,0 +1,17 @@
/* ============================================================
DIALOG — Base dialog + backdrop styling.
Root: element selector (dialog)
============================================================ */
dialog {
border: 1px solid var(--border-primary);
border-radius: var(--radius);
background: var(--bg-primary);
color: var(--text-primary);
padding: 0;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
dialog::backdrop {
background: rgba(0, 0, 0, 0.45);
}
@@ -0,0 +1,11 @@
/* ============================================================
FOCUS — Consistent keyboard-focus ring for all interactive
elements.
============================================================ */
:focus-visible {
outline: none;
box-shadow: 0 0 0 2px var(--accent-primary);
border-radius: var(--radius);
padding: var(--space-3xs) var(--space-xs);
}
+112
View File
@@ -0,0 +1,112 @@
/* ============================================================
FORMS — Base input, select, textarea, fieldset, legend
styling shared across admin + public pages.
Root: element selectors (universal form styling)
============================================================ */
/* ── Labels ─────────────────────────────────────────────────────────── */
label {
display: block;
margin-bottom: var(--space-3xs);
}
/* ── Text inputs, selects, textareas ────────────────────────────────── */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="color"]),
textarea {
font-family: inherit;
font-size: var(--step--1);
padding: var(--space-2xs) var(--space-xs);
border: 1px solid var(--border-primary);
border-radius: var(--radius);
background: transparent;
color: var(--text-primary);
transition: border-color 0.15s;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="color"]):focus,
textarea:focus {
outline: none;
border: 2px solid var(--accent-primary);
}
input::placeholder,
textarea::placeholder {
color: var(--text-tertiary);
font-size: var(--step--1);
}
textarea {
resize: vertical;
min-height: 80px;
line-height: 1.5;
}
/* ── Select ─────────────────────────────────────────────────────────── */
select {
font-family: inherit;
font-size: var(--step--1);
padding: var(--space-2xs) var(--space-xs);
padding-right: 1.75rem;
border: 1px solid var(--border-primary);
border-radius: var(--radius);
background: transparent;
color: var(--text-primary);
cursor: pointer;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 0.55rem center;
-webkit-appearance: none;
appearance: none;
transition: border-color 0.15s;
}
select:focus {
outline: none;
border: 2px solid var(--accent-primary);
}
/* ── Checkboxes & radios ────────────────────────────────────────────── */
input[type="checkbox"],
input[type="radio"] {
accent-color: var(--accent-primary);
width: 16px;
height: 16px;
cursor: pointer;
flex-shrink: 0;
margin: 0;
}
input[type="radio"] { border-radius: 50%; }
/* ── Fieldsets & legends ──────────────────────────────────────────────── */
fieldset {
border: 1px solid var(--border-primary);
border-radius: var(--radius);
padding: 0 var(--space-m) var(--space-m) var(--space-m);
margin: 0;
}
fieldset > *:not(:last-child) { margin-bottom: var(--space-xs); }
legend {
font-size: var(--step--1);
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--text-secondary);
padding: 0 var(--space-2xs);
}
/* ── Small / help text ──────────────────────────────────────────────────── */
small {
font-size: var(--step--2);
color: var(--text-secondary);
display: block;
margin-top: var(--space-3xs);
}
+218
View 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;
}
}
@@ -0,0 +1,15 @@
/* ============================================================
LINKS — Global link styles.
Root: element selector (a)
============================================================ */
a {
color: inherit;
text-decoration: none;
}
a:hover {
text-decoration-line: underline;
text-decoration-style: wavy;
text-decoration-thickness: 1px;
}
@@ -0,0 +1,13 @@
/* ============================================================
MEDIA — Embedded media (video, audio, iframe).
Root: element selectors
============================================================ */
:where(video, audio, iframe) {
border: 1px solid var(--bg-primary);
border-radius: 15px;
}
audio::-webkit-media-controls-enclosure {
border-radius: var(--radius);
}
@@ -0,0 +1,57 @@
/* ============================================================
PAGINATION — Shared pagination controls.
Root class: .pagination-wrap
============================================================ */
.pagination-wrap {
display: flex;
justify-content: center;
align-items: center;
gap: var(--space-2xs);
padding: var(--space-m) 0 var(--space-2xs);
}
.pagination-wrap ul {
display: flex;
gap: var(--space-3xs);
list-style: none;
margin: 0;
padding: 0;
}
.pagination-btn {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 2.75rem;
min-height: 2.75rem;
padding: 0 var(--space-2xs);
border: 1px solid var(--border-secondary);
border-radius: var(--radius);
color: var(--text-primary);
font-size: var(--step--1);
text-decoration: none;
transition: border-color 0.15s, color 0.15s;
}
.pagination-btn:hover:not(.disabled) {
border-color: var(--accent-primary);
color: var(--accent-primary);
}
.pagination-btn.disabled {
opacity: 0.3;
cursor: not-allowed;
pointer-events: none;
}
.pagination-info {
font-size: var(--step--1);
color: var(--text-secondary);
padding: 0 var(--space-2xs);
}
.page-current {
font-weight: 600;
color: var(--text-primary);
}
@@ -0,0 +1,43 @@
/* ============================================================
SEARCH BAR — Shared header search form
Root class: .header-search-wrap
============================================================ */
.header-search-wrap {
padding: 0;
flex-shrink: 0;
background: linear-gradient(180deg, var(--gradient-4) 0%, #ffffffee 100%);
}
.header-search-form { width: 100%; }
.header-search-input-wrap {
position: relative;
display: flex;
align-items: center;
}
.header-search-icon {
position: absolute;
left: var(--space-s);
width: 18px;
height: 18px;
stroke: var(--accent-primary);
pointer-events: none;
}
.header-search-input-wrap input {
width: 100%;
padding: var(--space-2xs) var(--space-s) !important;
padding-left: calc(18px + var(--space-l)) !important;
border: 1px solid var(--accent-primary) !important;
border-radius: var(--radius) !important;
background: var(--bg-primary) !important;
font-size: var(--step-0) !important;
color: var(--text-primary) !important;
font-family: inherit !important;
}
.header-search-input-wrap input::placeholder {
color: var(--accent-primary) !important;
}
@@ -0,0 +1,28 @@
/* ============================================================
TABLES — Base table, th, td styling.
Root: element selectors (universal table styling)
============================================================ */
table {
width: 100%;
border-collapse: collapse;
font-size: var(--step--1);
}
th {
text-align: left;
font-size: var(--step--2);
letter-spacing: 0.08em;
text-transform: uppercase;
padding: var(--space-3xs) var(--space-xs);
border-bottom: 1px solid var(--border-primary);
color: var(--text-secondary);
font-weight: 400;
white-space: nowrap;
}
td {
padding: var(--space-2xs) var(--space-xs);
border-bottom: 1px solid var(--border-primary);
vertical-align: top;
}
@@ -0,0 +1,65 @@
/* ============================================================
TOAST — Bottom-center toast messages (CSS-only auto-fade).
Root class: .toast-container + .toast
============================================================ */
#toast-region {
position: fixed;
bottom: var(--space-l);
left: 50%;
transform: translateX(-50%);
z-index: 10000;
display: flex;
flex-direction: column;
align-items: center;
gap: var(--space-xs);
pointer-events: none;
width: max-content;
max-width: min(560px, calc(100vw - 2 * var(--space-l)));
}
.toast {
padding: var(--space-s) var(--space-m);
border-radius: var(--radius);
font-size: var(--step-0);
border-left: 4px solid;
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
pointer-events: auto;
/* enter then fade out — total visible ~6.35s */
animation: toast-enter 0.35s ease-out,
toast-exit 0.5s ease-in 6s forwards;
}
.toast--error {
background: var(--bg-secondary);
border-color: var(--error);
color: var(--text-primary);
}
.toast--success {
background: var(--bg-secondary);
border-color: var(--success);
color: var(--text-primary);
}
.toast--warning {
background: var(--bg-secondary);
border-color: var(--warning);
color: var(--text-primary);
animation: toast-enter 0.35s ease-out;
}
.toast--warning a {
color: inherit;
text-decoration: underline;
}
@keyframes toast-enter {
from { opacity: 0; transform: translateY(12px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-exit {
from { opacity: 1; }
to { opacity: 0; pointer-events: none; }
}