.surface-hero::after {
  --surface-hero-watermark: "Personnages";
}

/* ============ LETTER BAR ============ */
.letter-bar-wrap {
  background: var(--background-color-muted);
  border-bottom: 1px solid var(--surface-primary-foreground-muted);
  position: sticky;
  top: var(--header-h);
  z-index: 150;
}
.letter-bar {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.6rem 4rem;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.letter-bar::-webkit-scrollbar {
  display: none;
}
.letter-bar-label {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-color-subtle);
  flex-shrink: 0;
  margin-right: 0.5rem;
}
.letter-btn {
  font-family: "Playfair Display", serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-color-subtle);
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  position: relative;
}
.letter-btn:hover {
  color: var(--surface-primary-background);
}
.letter-btn.active {
  color: var(--background-color);
  background: var(--surface-primary-background);
}
.letter-btn.disabled {
  color: var(--surface-primary-foreground-muted);
  cursor: default;
  opacity: 0.5;
}
.letter-btn-count {
  position: absolute;
  top: -2px;
  right: -2px;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--secondary-color);
  display: none;
}
.letter-btn:hover .letter-btn-count,
.letter-btn.active .letter-btn-count {
  display: block;
}
.letter-btn.active .letter-btn-count {
  color: var(--secondary-color-strong);
}

/* ============ MAIN CONTENT ============ */
.main-content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 4rem 3rem;
}

/* ============ FILTER BAR ============ */
.filter-bar {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--surface-primary-foreground-muted);
}
.filter-label {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-color-subtle);
  flex-shrink: 0;
  padding-top: 0.35rem;
}

/* Simple select (Époque, Thème) */
.filter-select {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border: 1px solid var(--surface-primary-foreground-muted);
  background: var(--background-color);
  color: var(--text-color-muted);
  padding: 0.35rem 1.6rem 0.35rem 0.6rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237A7060'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  transition: border-color 0.15s;
}
.filter-select:hover {
  border-color: var(--secondary-color);
}
.filter-select:focus {
  border-color: var(--secondary-color);
  outline: none;
}

.filter-sep {
  width: 1px;
  height: 28px;
  background: var(--surface-primary-foreground-muted);
  flex-shrink: 0;
  margin: 0 0.15rem;
}

/* ============ SEARCHABLE MULTI-SELECT ============ */
.multi-select {
  position: relative;
  display: inline-block;
}
.multi-select-trigger {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border: 1px solid var(--surface-primary-foreground-muted);
  background: var(--background-color);
  color: var(--text-color-muted);
  padding: 0.35rem 1.6rem 0.35rem 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 140px;
  transition: border-color 0.15s;
  white-space: nowrap;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237A7060'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  user-select: none;
}
.multi-select-trigger:hover {
  border-color: var(--secondary-color);
}
.multi-select.open .multi-select-trigger {
  border-color: var(--secondary-color);
}

.multi-select-badge {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--surface-primary-background);
  color: var(--background-color);
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  min-width: 16px;
  text-align: center;
}

.multi-select-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 2px;
  background: white;
  border: 1px solid var(--surface-primary-foreground-muted);
  box-shadow: var(--shadow-dropdown);
  z-index: 300;
  min-width: 280px;
  max-height: 340px;
  flex-direction: column;
}
.multi-select.open .multi-select-dropdown {
  display: flex;
}

.multi-select-search-wrap {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--surface-primary-foreground-muted);
  position: sticky;
  top: 0;
  background: white;
  z-index: 2;
}
.multi-select-search {
  width: 100%;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  border: 1px solid var(--surface-primary-foreground-muted);
  padding: 0.3rem 0.5rem;
  color: var(--text-color);
  background: var(--background-color);
}
.multi-select-search:focus {
  border-color: var(--secondary-color);
  outline: none;
}
.multi-select-search::placeholder {
  color: var(--surface-primary-foreground-strong);
  font-style: italic;
}

.multi-select-list {
  overflow-y: auto;
  flex: 1;
  padding: 0.25rem 0;
}
.multi-select-group-label {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-color-subtle);
  padding: 0.5rem 0.65rem 0.2rem;
  font-weight: 600;
}
.multi-select-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: background 0.1s;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  color: var(--text-color);
}
.multi-select-option:hover {
  background: var(--background-color-muted);
}
.multi-select-option.hidden {
  display: none;
}

.ms-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--surface-primary-foreground-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  font-size: 0.72rem;
  color: white;
}
.multi-select-option.selected .ms-check {
  background: var(--surface-primary-background);
  border-color: var(--surface-primary-background);
}
.multi-select-option.selected .ms-check::after {
  content: "✓";
}

.multi-select-footer {
  padding: 0.35rem 0.5rem;
  border-top: 1px solid var(--surface-primary-foreground-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--background-color-muted);
}
.ms-clear-btn {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  color: var(--primary-color);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ms-clear-btn:hover {
  color: var(--surface-primary-background);
}
.ms-done-btn {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--surface-primary-background);
  color: var(--background-color);
  border: none;
  padding: 0.25rem 0.65rem;
  cursor: pointer;
  transition: background 0.15s;
}
.ms-done-btn:hover {
  background: var(--secondary-color);
  color: var(--surface-primary-background);
}

/* ============ NAME SEARCH ============ */
.filter-search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 280px;
}
.filter-search {
  width: 100%;
  font-family: "EB Garamond", serif;
  font-size: 0.95rem;
  border: 1px solid var(--surface-primary-foreground-muted);
  background: var(--background-color);
  color: var(--text-color);
  padding: 0.32rem 0.6rem 0.32rem 1.8rem;
  transition: border-color 0.15s;
}
.filter-search:focus {
  border-color: var(--secondary-color);
  outline: none;
}
.filter-search::placeholder {
  color: var(--surface-primary-foreground-strong);
  font-style: italic;
}
.filter-search-icon {
  position: absolute;
  left: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--text-color-subtle);
  pointer-events: none;
}

.filter-count {
  margin-left: auto;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-color-subtle);
  white-space: nowrap;
  padding-top: 0.35rem;
}

/* ============ ACTIVE FILTER PILLS ============ */
.active-filters {
  display: none;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.active-filters.visible {
  display: flex;
}
.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  background: var(--surface-primary-background);
  color: var(--background-color);
  padding: 0.22rem 0.55rem;
  cursor: pointer;
  transition: background 0.15s;
}
.active-filter-pill:hover {
  background: var(--primary-color);
}
.active-filter-pill .pill-x {
  font-size: 0.7rem;
  opacity: 0.6;
}
.filter-reset {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  color: var(--primary-color);
  letter-spacing: 0.06em;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.filter-reset:hover {
  color: var(--surface-primary-background);
}

/* ============ LETTER SECTION ============ */
.letter-section {
  margin-bottom: 2.5rem;
}
.letter-section-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--surface-primary-background);
}
.letter-section-letter {
  font-family: "Playfair Display", serif;
  font-size: 3rem;
  font-weight: 900;
  color: var(--surface-primary-background);
  line-height: 1;
}
.letter-section-count {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-color-subtle);
}

/* ============ PERSONNAGE CARDS — HORIZONTAL 2-COLUMN ============ */
.person-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.person-card {
  display: flex;
  flex-direction: row;
  text-decoration: none;
  background: white;
  border: 1px solid var(--surface-primary-foreground-muted);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s;
  overflow: hidden;
  position: relative;
}
.person-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(26, 42, 66, 0.1);
  border-color: var(--secondary-color);
}
.person-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--secondary-color);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.person-card:hover::after {
  transform: scaleX(1);
}

/* Portrait area — fixed width, fills height */
.person-card-portrait {
  flex: 0 0 100px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-primary-background);
  position: relative;
  overflow: hidden;
}
.person-card-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(20%) contrast(1.1);
}
.person-card-monogram {
  font-family: "Playfair Display", serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: rgba(201, 150, 12, 0.3);
  line-height: 1;
}
.person-card-portrait::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(201, 150, 12, 0.08);
  pointer-events: none;
  z-index: 2;
}

/* Fiche count — bottom of portrait */
.person-card-fiches {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  background: rgba(26, 42, 66, 0.88);
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: rgba(245, 240, 232, 0.7);
  padding: 0.25rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}
.person-card-fiches strong {
  color: var(--secondary-color);
  font-weight: 600;
  font-size: 0.82rem;
}

/* Card body */
.person-card-body {
  flex: 1;
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.person-card-name {
  font-family: "Playfair Display", serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--surface-primary-background);
  line-height: 1.2;
  margin-bottom: 0.1rem;
}
.person-card-dates {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--secondary-color);
  font-weight: 600;
}
.person-card-role {
  font-family: "EB Garamond", serif;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--text-color-muted);
  line-height: 1.35;
  margin-top: 0.2rem;
}
.person-card-origin {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--text-color-subtle);
  margin-top: 0.35rem;
  line-height: 1.35;
  padding-top: 0.3rem;
  border-top: 1px solid var(--surface-primary-foreground-muted);
}

/* ============ PAGINATION ============ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin: 2.5rem 0 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--surface-primary-foreground-muted);
}
.page-btn {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  background: none;
  border: 1px solid var(--surface-primary-foreground-muted);
  color: var(--text-color-muted);
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 34px;
  text-align: center;
}
.page-btn:hover {
  border-color: var(--secondary-color);
  color: var(--surface-primary-background);
}
.page-btn.active {
  background: var(--surface-primary-background);
  border-color: var(--surface-primary-background);
  color: var(--background-color);
  font-weight: 600;
}
.page-ellipsis {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  color: var(--text-color-subtle);
  padding: 0 0.25rem;
}
.page-nav {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--surface-primary-foreground-muted);
  color: var(--text-color-muted);
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.page-nav:hover {
  border-color: var(--secondary-color);
  color: var(--surface-primary-background);
}
.page-nav.disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .person-grid {
    gap: 0.85rem;
  }
}
@media (max-width: 900px) {
  .main-content {
    padding: 2rem 2rem 2.5rem;
  }
  .letter-bar {
    padding: 0.6rem 2rem;
  }
  .person-card-portrait {
    flex: 0 0 88px;
    min-height: 110px;
  }
}
@media (max-width: 750px) {
  .person-grid {
    grid-template-columns: 1fr;
  }
  .letter-bar {
    padding: 0.6rem 1.2rem;
    gap: 0.08rem;
  }
  .letter-btn {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }
  .multi-select-dropdown {
    min-width: 240px;
  }
  .person-card-portrait {
    flex: 0 0 100px;
    min-height: 120px;
  }
}
@media (max-width: 600px) {
  .main-content {
    padding: 1.5rem 1.2rem 2rem;
  }
  .letter-bar {
    padding: 0.5rem 1rem;
  }
  .person-grid {
    grid-template-columns: 1fr;
  }
  .person-card-portrait {
    flex: 0 0 80px;
    min-height: 100px;
  }
  .person-card-monogram {
    font-size: 1.5rem;
  }
  .person-card-body {
    padding: 0.55rem 0.7rem;
  }
  .person-card-name {
    font-size: 0.88rem;
  }
  .person-card-role {
    font-size: 0.85rem;
  }
  .person-card-origin {
    font-size: 0.7rem;
  }

  .letter-section-letter {
    font-size: 2.2rem;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .filter-select {
    width: 100%;
  }
  .multi-select {
    width: 100%;
  }
  .multi-select-trigger {
    width: 100%;
  }
  .multi-select-dropdown {
    min-width: 100%;
    left: 0;
    right: 0;
  }
  .filter-search-wrap {
    max-width: none;
  }
  .filter-count {
    margin-left: 0;
    margin-top: 0.25rem;
  }
  .filter-sep {
    display: none;
  }
}
@media (max-width: 400px) {
  .person-card-portrait {
    flex: 0 0 68px;
    min-height: 88px;
  }
  .person-card-fiches {
    font-size: 0.72rem;
  }
  .person-card-fiches strong {
    font-size: 0.72rem;
  }
}

/* ============ RESULTS BAR (tri) ============ */
/* Repris de evenements-index.css : même barre de tri que les événements (2026-09-13). */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.results-count {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  color: var(--text-color-subtle);
  letter-spacing: 0.03em;
}

.results-count strong {
  color: var(--text-color);
  font-weight: 600;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sort-label {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-color-subtle);
}

.sort-btn {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  background: none;
  border: none;
  color: var(--text-color-subtle);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  transition: color 0.15s;
}

.sort-btn:hover {
  color: var(--surface-primary-background);
}

.sort-btn.active {
  color: var(--surface-primary-background);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--primary-color);
  text-underline-offset: 3px;
}

@media (max-width: 860px) {
  .results-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* Sur petit écran, un libellé de tri ne se coupe jamais : ce sont les boutons entiers qui passent
   à la ligne suivante. */
.sort-group {
  flex-wrap: wrap;
  row-gap: 0.15rem;
}
.sort-label,
.sort-btn {
  white-space: nowrap; /* un libellé de tri reste sur une ligne */
}
