mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
Replace presentational divs in index.php and main.css with elements that carry correct semantic meaning, fixing multiple WCAG 2.1 AA issues: index.php: - <div class="cards-container"> → <ul class="cards-container"> (list of navigable items) - <a class="card-link"><div class="card">…</div></a> → <li class="card"><a> (block link is the <a>, <li> is the container; removes the redundant .card div wrapper) - <div class="card__media"> → <figure class="card__media"> when wrapping an <img>; gradient placeholder stays as <div> (presentational, aria-hidden) - Improved alt text: "Couverture — [title] par [authors]" instead of bare title - Removed <div class="card__info"> wrapper; caption is now a bare <p class="card__caption"> directly inside the <a> - <div class="filter-info"> → <p class="filter-info" role="status"> (live-region semantics; announces filter state to screen readers) - ✕ symbol in clear-filter link wrapped in <span aria-hidden="true"> - Gradient placeholder div gets aria-hidden="true" (decorative; caption below carries text) - Empty-state <p style="…"> → <li class="cards-empty"> (removes inline style) - <div class="pagination-wrap"> → <nav class="pagination-wrap" aria-label="Pagination"> with <ul>/<li> children; page-info <span> → <li aria-current="page"> main.css: - .cards-container: add list-style:none; margin:0; padding:0 (reset <ul> defaults) - Remove .card-link rule; replace with .card > a (block flex link, no separate class) - .card__media: add margin:0 to reset <figure> default margin - Remove .card__info rules; rename .authors to .card__caption with same styles - Add .cards-empty rule (removes last inline style from index.php) - .pagination-wrap: restructured for <nav>/<ul>; inner <ul> carries the flex layout - prefers-reduced-motion: add .card__media--gradient guard WCAG criteria addressed: 1.1.1 (alt text), 1.3.1 (info & relationships via semantic list/figure), 2.4.1 (filter-info now live region), role="status" on filter banner.
241 lines
4.4 KiB
CSS
241 lines
4.4 KiB
CSS
/* ============================================================
|
|
HOME PAGE (index.php)
|
|
============================================================ */
|
|
|
|
.home-body {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100vh;
|
|
overflow: hidden;
|
|
background: var(--white);
|
|
}
|
|
|
|
/* Cards grid — scrollable main area */
|
|
.home-main {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
padding: 0;
|
|
}
|
|
|
|
.cards-container {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
|
gap: 0;
|
|
list-style: none;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
@media (min-width: 1400px) {
|
|
.cards-container {
|
|
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.cards-container {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
}
|
|
|
|
/* Each card = list item containing a block <a> link */
|
|
.card {
|
|
display: flex;
|
|
flex-direction: column;
|
|
cursor: pointer;
|
|
border: none;
|
|
background: var(--white);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.card > a {
|
|
text-decoration: none;
|
|
color: inherit;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex: 1;
|
|
}
|
|
|
|
/* card__media is a <figure> (with image) or <div> (gradient placeholder) */
|
|
.card__media {
|
|
width: 100%;
|
|
aspect-ratio: 4/3;
|
|
overflow: hidden;
|
|
background: #e8e8e8;
|
|
position: relative;
|
|
margin: 0; /* reset <figure> default margin */
|
|
}
|
|
|
|
.card__media img,
|
|
.card__media video {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
display: block;
|
|
transition: transform 0.3s ease;
|
|
}
|
|
|
|
.card:hover .card__media img,
|
|
.card:hover .card__media video {
|
|
transform: scale(1.02);
|
|
}
|
|
|
|
.card__media--placeholder {
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(135deg, #e8e8e8, #d0d0d0);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: #aaa;
|
|
font-size: 2rem;
|
|
}
|
|
|
|
.card__media--gradient {
|
|
width: 100%;
|
|
height: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 1rem;
|
|
text-align: center;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.card__gradient-author {
|
|
color: #fff;
|
|
font-size: 0.75rem;
|
|
opacity: .85;
|
|
margin-bottom: .25rem;
|
|
display: block;
|
|
}
|
|
|
|
.card__gradient-title {
|
|
color: #fff;
|
|
font-size: 0.85rem;
|
|
font-weight: 600;
|
|
display: -webkit-box;
|
|
-webkit-line-clamp: 3;
|
|
-webkit-box-orient: vertical;
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* Latest-year label */
|
|
.home-latest-label {
|
|
font-style: italic;
|
|
}
|
|
|
|
/* Card caption — <p> directly inside the <a>, below the media */
|
|
.card__caption {
|
|
padding: 0.55rem 0.5rem 0.65rem;
|
|
font-size: 0.88rem;
|
|
line-height: 1.35;
|
|
color: var(--black);
|
|
margin: 0;
|
|
font-weight: 400;
|
|
}
|
|
|
|
/* Empty-state message shown when no cards exist */
|
|
.cards-empty {
|
|
padding: 2rem;
|
|
color: #6b6b6b;
|
|
font-size: 0.9rem;
|
|
list-style: none;
|
|
}
|
|
|
|
/* Filter info */
|
|
.filter-info {
|
|
background: var(--purple-light);
|
|
color: var(--purple-dark);
|
|
padding: 0.4rem 1.5rem;
|
|
font-size: 0.85rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.clear-filter {
|
|
color: var(--purple-dark);
|
|
text-decoration: none;
|
|
padding: 0.15rem 0.6rem;
|
|
background: rgba(149, 87, 181, 0.12);
|
|
border-radius: 3px;
|
|
font-size: 0.82rem;
|
|
}
|
|
|
|
.clear-filter:hover {
|
|
background: rgba(149, 87, 181, 0.22);
|
|
}
|
|
|
|
/* Pagination */
|
|
.pagination-wrap {
|
|
border-top: 1px solid var(--border-color);
|
|
background: var(--white);
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.pagination-wrap ul {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
padding: 1rem;
|
|
list-style: none;
|
|
margin: 0;
|
|
}
|
|
|
|
.pagination-btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-width: 2rem;
|
|
height: 2rem;
|
|
padding: 0 0.5rem;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 3px;
|
|
color: var(--black);
|
|
font-size: 0.9rem;
|
|
text-decoration: none;
|
|
transition: all 0.15s;
|
|
}
|
|
|
|
.pagination-btn:hover:not(.disabled) {
|
|
border-color: var(--purple);
|
|
color: var(--purple);
|
|
}
|
|
|
|
.pagination-btn.disabled {
|
|
opacity: 0.3;
|
|
cursor: not-allowed;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.pagination-info {
|
|
font-size: 0.9rem;
|
|
color: var(--text-muted);
|
|
padding: 0 0.5rem;
|
|
}
|
|
|
|
.page-current {
|
|
font-weight: 600;
|
|
color: var(--black);
|
|
}
|
|
|
|
/* Suppress card hover scale for users who prefer reduced motion */
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.card__media img,
|
|
.card__media video {
|
|
transition: none;
|
|
}
|
|
.card:hover .card__media img,
|
|
.card:hover .card__media video {
|
|
transform: none;
|
|
}
|
|
.card__media--gradient {
|
|
transition: none;
|
|
}
|
|
}
|