/**
 * SCRIBONAUTES — Liste des œuvres
 * pages/work-list.css
 * Palette : parchemin chaud + vert forêt + brun sépia (design-system.css)
 */

/* ============================================================
   HERO
   ============================================================ */
.works-hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 60% 40%, rgba(139,100,60,.09) 0%, transparent 70%),
              var(--accent-light);
  border-bottom: 1px solid var(--border);
  padding: 56px 24px 48px;
  text-align: center;
}

/* Quadrillage façon carte ancienne */
.works-hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg,   transparent, transparent 39px, rgba(92,74,58,.05) 39px, rgba(92,74,58,.05) 40px),
    repeating-linear-gradient(90deg,  transparent, transparent 39px, rgba(92,74,58,.05) 39px, rgba(92,74,58,.05) 40px);
  pointer-events: none;
}

/* Symbole géométrique en fond */
.works-hero::after {
  content: '✦';
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 16rem; line-height: 1;
  color: rgba(92,74,58,.04);
  pointer-events: none;
  font-family: serif;
}

.works-hero-inner {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.works-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-mid);
  margin-bottom: 12px;
}
.works-hero-eyebrow::before,
.works-hero-eyebrow::after {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: var(--accent-mid);
}

.works-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 10px;
}

.works-hero h1 em {
  font-style: italic;
  color: var(--green);
}

.works-hero-subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-size: .95rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

.works-hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* BARRE DE RECHERCHE */
.search-bar {
  max-width: 580px;
  margin: 0 auto;
}

.search-input-group {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
  overflow: hidden;
}

.search-input-group:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(61, 107, 94, 0.12), var(--shadow-md);
}

.search-input {
  flex: 1;
  padding: 14px 20px;
  border: none !important;
  background: transparent;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  color: var(--text);
  outline: none;
  box-shadow: none !important;
}

.search-input::placeholder {
  color: var(--text-faint);
}

.search-btn {
  flex-shrink: 0;
  margin: 5px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--trans-fast), transform var(--trans-fast);
}

.search-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

/* ============================================================
   STATS GLOBALES
   ============================================================ */
.stats-band {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
}

.stats-band-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.stats-band-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px;
  border-right: 1px solid var(--border);
}

.stats-band-item:last-child {
  border-right: none;
}

.stats-band-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stats-band-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

/* ============================================================
   BARRE DE FILTRES RESTRUCTURÉE
   ============================================================ */
.filters-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 32px 0 40px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 64px;
  z-index: var(--z-sticky);
}

/* ── Ligne 1 : recherche + toggle vue ── */
.fb-row1 {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.fb-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0 14px;
  height: 36px;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
}

.fb-search:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(61, 107, 94, 0.1);
}

.fb-search-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.fb-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text);
  outline: none;
  min-width: 0;
}

.fb-search-input::placeholder {
  color: var(--text-faint);
}

.fb-search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color var(--trans-fast);
}

.fb-search-clear:hover {
  color: var(--danger);
}

/* ── Ligne 2 : genres scrollables + tri ── */
.fb-row2 {
  display: flex;
  align-items: center;
}

.fb-genres {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  min-width: 0;
}

.fb-genres::-webkit-scrollbar {
  display: none;
}

.fb-pill {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  white-space: nowrap;
  text-decoration: none;
  transition: all var(--trans-fast);
  cursor: pointer;
}

.fb-pill:hover {
  border-color: var(--accent-mid);
  color: var(--accent);
  background: var(--accent-light);
}

.fb-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.fb-row2-divider {
  flex-shrink: 0;
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 2px;
}

.fb-sort-wrap {
  flex-shrink: 0;
  padding: 8px 14px;
}

.fb-sort-select {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
}

.fb-sort-select:hover {
  color: var(--text);
}

/* ── Filtre quêtes ── */
.fb-quest-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
}

.fb-quest-toggle input[type="checkbox"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.fb-quest-toggle:has(input:checked) .fb-quest-toggle__label {
  color: var(--primary);
  font-weight: 600;
}

/* ── Ligne 3 : filtres actifs (conditionnelle) ── */
.fb-active-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 14px;
  border-top: 1px solid var(--border);
  background: var(--accent-light);
}

.fb-active-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 2px;
}

.fb-active-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px 8px 3px 10px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.fb-active-tag-x {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color var(--trans-fast);
}

.fb-active-tag-x:hover {
  color: var(--danger);
}

.fb-clear-all {
  margin-left: auto;
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  transition: color var(--trans-fast);
}

.fb-clear-all:hover {
  color: var(--danger);
}

@media (max-width: 768px) {
  .filters-bar {
    position: relative;
    top: 0;
  }

  /* Row 2 : genres sur une ligne, sort + quest sur la suivante */
  .fb-row2 {
    flex-wrap: wrap;
  }

  .fb-genres {
    flex-basis: 100%;
    width: 100%;
    border-bottom: 1px solid var(--border);
    padding: 8px 14px 6px;
  }

  .fb-row2-divider {
    display: none;
  }

  .fb-sort-wrap {
    flex: 1;
    padding: 6px 14px;
  }

  .fb-quest-toggle {
    padding: 6px 14px;
  }
}

.fb-search-clear--hidden {
  display: none;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.works-section {
  margin-bottom: 64px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.02em;
}

.section-icon {
  font-size: 1.5rem;
}

.btn-see-all {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--green);
  text-decoration: none;
  transition: opacity var(--trans-fast);
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-see-all:hover {
  color: var(--green-hover);
  opacity: 0.8;
}

/* ============================================================
   GRILLE UNIVERSELLE (.works-grid)
   Mode compact par défaut — bascule en vertical via
   #works-container.is-vertical
   ============================================================ */
.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
  align-items: start;
}

/* ── Mode vertical (togglé globalement) ── */
#works-container.is-vertical .works-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  align-items: stretch;
}

/* ============================================================
   CARD UNIVERSELLE (.wc-h)
   Markup : div.wc-h > div.wc-h__cover + div.wc-h__body
   Aucune dépendance avec .work-card
   ============================================================ */
.wc-h {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  height: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--trans-base), border-color var(--trans-base);
}

.wc-h:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-mid);
}

/* ── Vignette gauche ── */
.wc-h__cover {
  flex-shrink: 0;
  width: 68px;
  min-height: 96px;
  height: 100%;
  overflow: hidden;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  position: relative;
}

.wc-h__in-list {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.85rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.45));
  pointer-events: none;
}

.wc-h__cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wc-h__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* ── Corps droit ── */
.wc-h__body {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 1px solid var(--border);
  overflow: hidden;
}

/* Ligne 1 : titre + badge */
.wc-h__top {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.wc-h__title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.wc-h__title-link {
  color: inherit;
  text-decoration: none;
}

.wc-h__title-link:hover {
  color: var(--accent);
}

.wc-h__badge {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.wc-h__badge--in_progress { background: rgba(59,130,246,0.15);  color: #1d4ed8; }
.wc-h__badge--completed   { background: rgba(34,197,94,0.15);   color: #15803d; }
.wc-h__badge--published   { background: rgba(34,197,94,0.15);   color: #15803d; }
.wc-h__badge--draft       { background: rgba(100,100,100,0.12); color: #555;    }
.wc-h__badge--archived    { background: rgba(150,100,50,0.15);  color: #7c4f1e; }

/* Ligne 2 : auteur */
.wc-h__author {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wc-h__author-link {
  color: var(--green);
  font-weight: 500;
  text-decoration: none;
}

.wc-h__author-link:hover {
  text-decoration: underline;
  color: var(--accent);
}

/* Description (visible uniquement en mode vertical) */
.wc-h__desc {
  display: none; /* caché en mode compact, activé en mode vertical */
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
  overflow: hidden;
}

/* Ligne 3 : genre + stats */
.wc-h__bottom {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}

.wc-h__genre {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--green-light, var(--accent-light));
  color: var(--green);
  border: 1px solid var(--green-border, var(--border));
  white-space: nowrap;
  flex-shrink: 0;
}

.wc-h__sep { flex: 1; }

.wc-h__stat {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Mode vertical ── */
#works-container.is-vertical .wc-h {
  flex-direction: column;
  height: auto;
  min-height: 280px;
  position: relative;
}

#works-container.is-vertical .wc-h:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

#works-container.is-vertical .wc-h__cover {
  width: 100%;
  height: 160px;
  flex-shrink: 0;
  font-size: 2.5rem;
}

#works-container.is-vertical .wc-h__body {
  border-left: none;
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  flex: 1;
  justify-content: flex-start;
  gap: 4px;
}

#works-container.is-vertical .wc-h__title {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--text-md);
}

#works-container.is-vertical .wc-h__badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.65rem;
  padding: 3px 8px;
}

#works-container.is-vertical .wc-h__desc {
  flex: 1;
  min-height: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 2px 0;
}

#works-container.is-vertical .wc-h__bottom {
  margin-top: 6px;
  padding-top: 0;
}

/* ============================================================
   BOUTON TOGGLE VUE GLOBAL
   ============================================================ */
.btn-view-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  cursor: pointer;
  transition: border-color var(--trans-fast), background var(--trans-fast);
  flex-shrink: 0;
  padding: 0;
}

.btn-view-toggle:hover {
  border-color: var(--accent-mid);
  background: var(--accent-light);
}

/* Icône : lignes horizontales = vue compacte */
.btn-view-toggle-icon {
  display: block;
  width: 16px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='14' viewBox='0 0 16 14'%3E%3Crect x='0' y='0' width='16' height='3' rx='1.5' fill='%23888'/%3E%3Crect x='0' y='5.5' width='16' height='3' rx='1.5' fill='%23888'/%3E%3Crect x='0' y='11' width='16' height='3' rx='1.5' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* Icône : grille 2×2 = vue verticale */
.btn-view-toggle.is-vertical .btn-view-toggle-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='14' viewBox='0 0 16 14'%3E%3Crect x='0' y='0' width='6.5' height='6' rx='1.5' fill='%23888'/%3E%3Crect x='9.5' y='0' width='6.5' height='6' rx='1.5' fill='%23888'/%3E%3Crect x='0' y='8' width='6.5' height='6' rx='1.5' fill='%23888'/%3E%3Crect x='9.5' y='8' width='6.5' height='6' rx='1.5' fill='%23888'/%3E%3C/svg%3E");
}

@media (max-width: 768px) {
  .works-grid { grid-template-columns: 1fr; }
  #works-container.is-vertical .works-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 480px) {
  .wc-h__cover { width: 56px; }
  .wc-h__stat:nth-child(n+5) { display: none; }
  #works-container.is-vertical .wc-h__stat:nth-child(n+5) { display: inline; }
}

/* ============================================================
   ÉTAT VIDE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.empty-icon {
  font-size: 4rem;
  opacity: 0.25;
  margin-bottom: 20px;
  display: block;
}

.empty-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.empty-text {
  color: var(--text-muted);
  font-family: var(--font-body);
  font-style: italic;
  margin-bottom: 24px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .stats-band-inner {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-band-item:nth-child(2) { border-right: none; }
  .stats-band-item:nth-child(3) { border-top: 1px solid var(--border); }
  .stats-band-item:nth-child(4) { border-top: 1px solid var(--border); border-right: none; }
}

@media (max-width: 768px) {
  .works-hero { padding: 48px 0 36px; }

  .works-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .works-grid { grid-template-columns: 1fr; }
}


 
/* ── Badge de statut sur les cartes (positionné en absolu) ── */
.work-card {
  position: relative;   /* nécessaire pour le badge absolu */
}
 
.work-status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  z-index: 2;
  backdrop-filter: blur(4px);
}
 
.badge-status--in_progress { background: rgba(59, 130, 246, 0.85); color: #fff; }
.badge-status--completed   { background: rgba(34, 197,  94, 0.85); color: #fff; }
.badge-status--published   { background: rgba(34, 197,  94, 0.85); color: #fff; }
.badge-status--draft       { background: rgba(100,100,100, 0.75); color: #fff; }
.badge-status--archived    { background: rgba(150,100, 50, 0.75); color: #fff; }
 
/* ── Description courte sur les cartes ── */
.work-desc {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
  margin: 6px 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
 
/* ── Badges en bas de carte ── */
.work-badges--bottom {
  margin-top: 8px;
}
 
/* ── Icône genre dans le placeholder ── */
.work-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: var(--accent-light);
  color: var(--accent);
  height: 140px;
  width: 100%;
}

/* ============================================================
   LISTE COMPACTE : NOUVEAUX CHAPITRES
   ============================================================ */
.new-chapters-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.new-chapter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  transition: background var(--trans-fast);
  min-width: 0;
}

.new-chapter-item:last-child {
  border-bottom: none;
}

.new-chapter-item:hover {
  background: var(--accent-light);
}

.new-chapter-genre-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.new-chapter-work-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  flex-shrink: 0;
  transition: color var(--trans-fast);
}

.new-chapter-work-title:hover {
  color: var(--accent);
}

.new-chapter-author {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--green);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.new-chapter-sep {
  color: var(--border-strong);
  flex-shrink: 0;
  font-size: var(--text-xs);
}

.new-chapter-link {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  transition: color var(--trans-fast);
}

.new-chapter-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.new-chapter-time {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

@media (max-width: 600px) {
  .new-chapter-item {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
  }

  .new-chapter-work-title {
    max-width: 160px;
  }

  .new-chapter-time {
    margin-left: 0;
    width: 100%;
    padding-left: 30px; /* aligner sous le titre */
  }
}

/* ============================================================
.wc-h {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  height: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--trans-base), border-color var(--trans-base);
}

.wc-h:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-mid);
}

.wc-h__title-link {
  color: inherit;
  text-decoration: none;
}

.wc-h__title-link:hover {
  color: var(--accent);
}

/* ── Vignette gauche ── */
.wc-h__cover {
  flex-shrink: 0;
  width: 68px;
  min-height: 96px;
  height: 100%;
  overflow: hidden;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  position: relative;
}

.wc-h__in-list {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.85rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.45));
  pointer-events: none;
}

.wc-h__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Corps droit ── */
.wc-h__body {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 1px solid var(--border);
  overflow: hidden;
}

/* Ligne 1 : titre + badge statut */
.wc-h__top {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.wc-h__title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.wc-h__badge {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.wc-h__badge--in_progress { background: rgba(59,130,246,0.15); color: #1d4ed8; }
.wc-h__badge--completed   { background: rgba(34,197,94,0.15);  color: #15803d; }
.wc-h__badge--published   { background: rgba(34,197,94,0.15);  color: #15803d; }
.wc-h__badge--draft       { background: rgba(100,100,100,0.12); color: #555; }
.wc-h__badge--archived    { background: rgba(150,100,50,0.15);  color: #7c4f1e; }

/* Ligne 2 : auteur */
.wc-h__author {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wc-h__author-link {
  color: var(--green);
  font-weight: 500;
  text-decoration: none;
}

.wc-h__author-link:hover {
  text-decoration: underline;
  color: var(--accent);
}

/* Ligne 3 : genre + stats */
.wc-h__bottom {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}

.wc-h__genre {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--green-light, var(--accent-light));
  color: var(--green);
  border: 1px solid var(--green-border, var(--border));
  white-space: nowrap;
  flex-shrink: 0;
}

.wc-h__sep {
  flex: 1;
}

.wc-h__stat {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .works-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .wc-h { height: 80px; }
  .wc-h__cover { width: 56px; }
  .wc-h__stat:nth-child(n+5) { display: none; }
}

/* ============================================================
   MODE VERTICAL (toggle) — la grille compacte affiche des
   grandes cards identiques au format standard
   ============================================================ */














/* ============================================================
   BOUTON TOGGLE VUE (horizontal ↔ vertical)
   ============================================================ */
.section-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-view-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  cursor: pointer;
  transition: border-color var(--trans-fast), background var(--trans-fast);
  flex-shrink: 0;
  padding: 0;
}

.btn-view-toggle:hover {
  border-color: var(--accent-mid);
  background: var(--accent-light);
}

/* Icône SVG inline via background-image — représente des lignes horizontales (vue compacte) */
.btn-view-toggle-icon {
  display: block;
  width: 16px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='14' viewBox='0 0 16 14'%3E%3Crect x='0' y='0' width='16' height='3' rx='1.5' fill='%23888'/%3E%3Crect x='0' y='5.5' width='16' height='3' rx='1.5' fill='%23888'/%3E%3Crect x='0' y='11' width='16' height='3' rx='1.5' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* En mode vertical, l'icône bascule sur une grille 2×2 */
.btn-view-toggle.is-vertical .btn-view-toggle-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='14' viewBox='0 0 16 14'%3E%3Crect x='0' y='0' width='6.5' height='6' rx='1.5' fill='%23888'/%3E%3Crect x='9.5' y='0' width='6.5' height='6' rx='1.5' fill='%23888'/%3E%3Crect x='0' y='8' width='6.5' height='6' rx='1.5' fill='%23888'/%3E%3Crect x='9.5' y='8' width='6.5' height='6' rx='1.5' fill='%23888'/%3E%3C/svg%3E");
}


/* ============================================================
   ACTIVITÉ RÉCENTE — blocs commentaires / annotations
   ============================================================ */
.activity-trio {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.activity-bloc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.activity-bloc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.activity-bloc-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.activity-bloc-title {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.activity-bloc-more {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--green);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.activity-bloc-more:hover {
  text-decoration: underline;
  color: var(--accent);
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-item {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  transition: background var(--trans-fast);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item:hover {
  background: var(--accent-light);
}

.activity-actor {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--green);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-actor:hover {
  text-decoration: underline;
}

.activity-verb {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-target {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  flex-shrink: 0;
}

.activity-target:hover {
  color: var(--accent);
  text-decoration: underline;
}

.activity-extra {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-excerpt {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.activity-time {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

@media (max-width: 768px) {
  .activity-trio {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   DARK MODE — work-list.css
   À ajouter à la FIN de static/css/pages/work-list.css
   ============================================================ */

/* ── Badges statut (couleurs hardcodées RGBA) ────────────── */
/* wc-h__badge — badges textuels sur les cartes */
[data-theme="dark"] .wc-h__badge--in_progress {
  background: rgba(96, 165, 250, 0.18);
  color: #60a5fa;
}
[data-theme="dark"] .wc-h__badge--completed,
[data-theme="dark"] .wc-h__badge--published {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}
[data-theme="dark"] .wc-h__badge--draft {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}
[data-theme="dark"] .wc-h__badge--archived {
  background: rgba(201, 168, 130, 0.18);
  color: #c9a882;
}

/* work-status-badge — badge absolu sur la couverture */
/* (fond semi-transparent sur image : les couleurs restent lisibles,
    on corrige juste le badge "draft" trop sombre en mode nuit) */
[data-theme="dark"] .badge-status--draft {
  background: rgba(148, 163, 184, 0.80);
  color: #fff;
}

/* profile-work-status-badge (partagé avec profile.css) */
[data-theme="dark"] .badge-status--in_progress { background: rgba(96, 165, 250, 0.80); color: #fff; }
[data-theme="dark"] .badge-status--completed,
[data-theme="dark"] .badge-status--published   { background: rgba(74, 222, 128, 0.80); color: #1a1815; }
[data-theme="dark"] .badge-status--archived    { background: rgba(201, 168, 130, 0.80); color: #1a1815; }

/* ── Focus ring recherche ────────────────────────────────── */
[data-theme="dark"] .search-input-group:focus-within,
[data-theme="dark"] .fb-search:focus-within {
  box-shadow: 0 0 0 3px rgba(106, 173, 152, 0.20);
}

/* ── SVG icône toggle vue (fill hardcodé %23888) ─────────── */
/* Les SVG inline data:url ne répondent pas aux variables CSS.
   En dark, le gris #888 est encore visible mais un peu faible —
   on filtre pour l'éclaircir légèrement. */
[data-theme="dark"] .btn-view-toggle-icon {
  filter: brightness(1.6);
}

/* ── Défis section ──────────────────────────────────────────── */
.chal-library-block {
  margin-bottom: 40px;
}

.chal-library-block__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-left: 4px;
}

.chal-library-block__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.chal-library-block__title:hover { text-decoration: underline; }

.chal-library-block__badge {
  font-size: var(--text-xs);
  font-family: var(--font-ui);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent);
}
.chal-library-block__badge--voting  { background: #fef9c3; color: #854d0e; }
.chal-library-block__badge--closed  { background: var(--surface-alt); color: var(--text-muted); }

[data-theme="dark"] .chal-library-block__badge--voting { background: rgba(234,179,8,.15); color: #fde047; }
[data-theme="dark"] .chal-library-block__badge--closed { background: var(--surface-alt); color: var(--text-muted); }

/* ── Sort select : background transparent = correct,
      mais la flèche SVG encodée (#999) reste visible — OK ── */