/*
  Portail antispéciste — feuille de style maison, sans framework.
  Structure inspirée de Pico CSS, personnalisée pour ce projet.
  Sections : 1. variables  2. reset  3. typographie  4. liens/boutons
  5. nav  6. cartes & badges  7. listings/détail  8. layout  9. a11y
*/

/* 1. Variables ------------------------------------------------------- */
:root {
  --primary: #2E7D6B;
  --primary-contrast: #ffffff;
  --background: #ffffff;
  --color: #2b2f33;
  --color-muted: #5b6168;
  --border: #d7dbde;
  --card-background: #f7f8f8;
  --focus-ring: #1d5b4d;
  --font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 0.5rem;
  --spacing: 1rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #4FAE98;
    --primary-contrast: #0b1210;
    --background: rgb(20, 24, 28);
    --color: #d6dade;
    --color-muted: #9aa2a9;
    --border: #3a4046;
    --card-background: #1c2125;
    --focus-ring: #7fd6bf;
  }
}

:root[data-theme="dark"] {
  --primary: #4FAE98;
  --primary-contrast: #0b1210;
  --background: rgb(20, 24, 28);
  --color: #d6dade;
  --color-muted: #9aa2a9;
  --border: #3a4046;
  --card-background: #1c2125;
  --focus-ring: #7fd6bf;
}

/* Teintes de badges, une par collection, dérivées de l'accent (hsl, même L/S, teinte qui tourne) */
:root {
  --hue-groupes: 162;
  --hue-blogs: 200;
  --hue-podcasts: 24;
  --hue-episodes: 24;
  --hue-livres: 280;
  --hue-films-videos: 340;
  --hue-zines: 50;
  --hue-humains: 210;
}

/* 2. Reset ------------------------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--color);
  font-family: var(--font-family);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

/* 3. Typographie ------------------------------------------------------ */
h1, h2, h3 {
  line-height: 1.2;
}

h1 { font-size: 1.9rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.4rem; margin: 2rem 0 1rem; }
h3 { font-size: 1.1rem; margin: 0 0 0.25rem; }

p.lead {
  font-size: 1.1rem;
  color: var(--color-muted);
}

p.subtitle {
  color: var(--color-muted);
  margin-top: -0.25rem;
}

.card-meta {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.lang-badge {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin: 0 0 0.5rem;
}

.a-verifier {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

/* 4. Liens / boutons ---------------------------------------------------- */
a {
  color: var(--primary);
  text-decoration-thickness: 1px;
}

.button {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  color: var(--primary);
  text-decoration: none;
}

.button.current,
.button:hover {
  background: var(--primary);
  color: var(--primary-contrast);
}

a:focus-visible,
.button:focus-visible,
.skip-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* 5. Navigation ----------------------------------------------------------
   Mobile : barre horizontale en haut de page.
   Desktop (>= 60em) : barre latérale fixe à gauche, cf. règle .page-shell
   dans la section 8 (Layout). */
.sidebar {
  border-bottom: 1px solid var(--border);
}

.sidebar nav {
  padding: 0 var(--spacing) 0.75rem;
}

.site-title {
  display: block;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color);
  text-decoration: none;
  padding: 0.75rem var(--spacing);
}

.sidebar nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* En dessous de 60em (avant la bascule en sidebar), le menu est une liste
   compacte séparée par des points plutôt que des pilules bordées — ça
   tient sur 1-2 lignes au lieu de 3-4 et réduit la hauteur du header. */
@media (max-width: 59.99em) {
  .sidebar nav ul {
    gap: 0;
    font-size: 0.95rem;
  }

  .sidebar nav li {
    display: flex;
    align-items: center;
  }

  .sidebar nav li:not(:last-child)::after {
    content: "·";
    margin: 0 0.5rem;
    color: var(--border);
  }

  .sidebar nav a,
  .sidebar nav .current {
    display: inline;
    padding: 0.15rem 0;
    border: none;
    background: none;
    color: var(--primary);
    text-decoration: underline;
  }

  .sidebar nav .current {
    color: var(--color);
    font-weight: 700;
    text-decoration: none;
  }
}

/* 6. Cartes & badges ------------------------------------------------------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-background);
  padding: 1rem;
}

.card-thumb {
  width: calc(100% + 2rem);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: calc(var(--radius) - 0.15rem);
  margin: -1rem -1rem 0.75rem;
}

.card h3 {
  margin-top: 0.5rem;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  color: #10231d;
}

/* Dans les cartes de listing, le badge est secondaire par rapport au
   titre — plus petit que sur une page de détail où il sert d'en-tête. */
.card .badge {
  font-size: 0.65rem;
  padding: 0.05rem 0.4rem;
  letter-spacing: 0.01em;
}

.badge-groupes { background: hsl(var(--hue-groupes) 55% 70%); }
.badge-blogs { background: hsl(var(--hue-blogs) 55% 70%); }
.badge-podcasts { background: hsl(var(--hue-podcasts) 65% 72%); }
.badge-episodes { background: hsl(var(--hue-episodes) 65% 78%); }
.badge-livres { background: hsl(var(--hue-livres) 45% 76%); }
.badge-films-videos { background: hsl(var(--hue-films-videos) 55% 76%); }
.badge-zines { background: hsl(var(--hue-zines) 65% 72%); }
.badge-humains { background: hsl(var(--hue-humains) 45% 74%); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge {
    color: #0b1210;
  }
}

/* 7. Listings / détail --------------------------------------------------- */
.view-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0;
}

.auteurices-list h2 {
  margin-top: 1.75rem;
}

.ressource-detail .cover {
  max-width: 12rem;
  border-radius: var(--radius);
  margin: 1rem 0;
}

nav.breadcrumb {
  margin: 0 0 1.5rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  margin: 0 0.5rem;
  color: var(--border);
}

.breadcrumb a {
  color: var(--color-muted);
}

.breadcrumb [aria-current="page"] {
  color: var(--color);
}

/* 8. Layout ---------------------------------------------------------------- */
.container {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 var(--spacing);
}

.layout-content {
  padding-top: 2rem;
  padding-bottom: 3rem;
  min-width: 0;
}

footer.container {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--color-muted);
}

/* Barre latérale sur desktop : le menu passe à gauche, en colonne fixe et
   collante, le contenu occupe le reste de la largeur. */
@media (min-width: 60em) {
  .page-shell {
    display: flex;
    align-items: flex-start;
  }

  .sidebar {
    flex: 0 0 15rem;
    width: 15rem;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    border-bottom: none;
    border-right: 1px solid var(--border);
  }

  .sidebar nav {
    padding: 0 var(--spacing) var(--spacing);
  }

  .sidebar nav ul {
    flex-direction: column;
    align-items: stretch;
  }

  .sidebar .button {
    display: block;
    text-align: left;
  }

  .layout-content {
    flex: 1 1 auto;
  }
}

/* 9. Accessibilité ---------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  background: var(--primary);
  color: var(--primary-contrast);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  z-index: 10;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
