/*
Theme Name: BPT - Bibliothèques Pour Tous
Theme URI: https://bibliothequespourtous.fr
Author: BPT Dev Team
Author URI: https://bibliothequespourtous.fr
Description: Thème PWA moderne et accessible pour réseau de 25 bibliothèques (Back-end PMB). Design épuré, navigation par onglets, accessibilité RGAA 2025.
Version: 1.0.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: bpt
Tags: accessibility-ready, pwa, responsive-layout, custom-menu
*/

/* ============================================
   BPT THEME - BASE STYLES
   Design épuré inspiré du mockup médiathèque
   ============================================ */

:root {
  --color-primary: #e85d04;
  --color-secondary: #0468d8;
  --color-accent: #f4a261;
  --color-dark: #264653;
  --color-light: #f8f9fa;
  --color-white: #ffffff;
  --color-text: #333333;
  --color-text-light: #666666;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Inter', system-ui, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
  --transition: 0.2s ease-in-out;
}

/* Reset minimal */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-white);
}

/* Focus visible pour accessibilité */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-dark);
  color: var(--color-white);
  padding: 8px 16px;
  z-index: 9999;
  transition: top var(--transition);
}
.skip-link:focus {
  top: 0;
}

/* ============================================
   LAYOUT
   ============================================ */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main {
  flex: 1;
  padding-top: 49px; /* espace pour header fixe (80px header - 31px remontée) */
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: var(--color-white);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
}

.header-tabs-nav {
  display: flex;
  gap: 1.5rem;
  position: absolute;
  bottom: 0;
  right: 0;
  padding-right: 0;
}

.header-tabs-nav .tab-btn {
  padding: 0.75rem 2rem;
  background: var(--color-white);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--color-text);
  position: relative;
  top: 3px;
}

/* Actu Réseau toujours bleu */
.header-tabs-nav #tab-reseau-header {
  background: #0468d8;
  color: white;
  border-color: #0468d8;
}

/* Ma Bib toujours orange */
.header-tabs-nav #tab-mabib-header {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Animation breath seulement quand sélectionné */
.header-tabs-nav #tab-reseau-header[aria-selected="true"] {
  animation: pulsate-glow-blue 2s ease-in-out infinite;
}

.header-tabs-nav #tab-mabib-header[aria-selected="true"] {
  animation: pulsate-glow-orange 2s ease-in-out infinite;
}

@keyframes pulsate-glow-blue {
  0%, 100% {
    box-shadow: 0 0 5px rgba(4, 104, 216, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(4, 104, 216, 0.8), 0 0 30px rgba(4, 104, 216, 0.6);
  }
}

@keyframes pulsate-glow-orange {
  0%, 100% {
    box-shadow: 0 0 5px rgba(255, 140, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 140, 0, 0.8), 0 0 30px rgba(255, 140, 0, 0.6);
  }
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-logo-img {
  max-height: 60px;
  width: auto;
}

.site-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-dark);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.site-logo span {
  color: var(--color-primary);
}

/* Barre de recherche */
.search-form {
  flex: 1;
  max-width: 400px;
  margin: 0 auto 20px auto;
  position: relative;
}

.search-form input[type="search"] {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}

.search-form input[type="search"]:focus {
  border-color: var(--color-secondary);
}

.search-form button {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-secondary);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Navigation principale */
.main-nav ul {
  display: flex;
  list-style: none;
  gap: 0.5rem;
}

.main-nav a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.main-nav a:hover,
.main-nav a:focus {
  color: var(--color-primary);
  background: rgba(232, 93, 4, 0.08);
}

.main-nav a[aria-current="page"] {
  color: var(--color-primary);
}

/* Bouton menu mobile */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  width: 44px;
  height: 44px;
  cursor: pointer;
}

/* ============================================
   ONGLET NAVIGATION (TABS)
   ============================================ */
.tabs-nav {
  display: flex;
  gap: 1.5rem;
  border-bottom: none;
  margin-bottom: 2rem;
  position: relative;
}

.tabs-nav .tab-btn {
  padding: 0.75rem 2rem;
  background: var(--color-white);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  top: 0;
}

.tab-btn:hover,
.tab-btn:focus {
  color: var(--color-primary);
}

.tab-btn[aria-selected="true"] {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Actu Réseau toujours bleu */
.tabs-nav #tab-reseau {
  background: #0468d8;
  color: white;
  border-color: #0468d8;
}

/* Ma Bib toujours orange */
.tabs-nav #tab-mabib {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Animation breath seulement quand sélectionné - même keyframes que header */
.tabs-nav #tab-reseau[aria-selected="true"] {
  animation: pulsate-glow-blue 2s ease-in-out infinite;
}

.tabs-nav #tab-mabib[aria-selected="true"] {
  animation: pulsate-glow-orange 2s ease-in-out infinite;
}

@keyframes pulse-blue {
  0%, 100% {
    box-shadow: 0 0 10px rgba(0, 157, 224, 0.7);
  }
  50% {
    box-shadow: 0 0 25px rgba(0, 157, 224, 1);
  }
}

@keyframes pulse-orange {
  0%, 100% {
    box-shadow: 0 0 10px rgba(232, 93, 4, 0.7);
  }
  50% {
    box-shadow: 0 0 25px rgba(232, 93, 4, 1);
  }
}

.tab-panel {
  display: none;
}

.tab-panel[aria-hidden="false"] {
  display: block;
}

/* ============================================
   SECTION HERO
   ============================================ */
.hero-section {
  position: relative;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-white);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.45);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  padding: 2rem;
}

.hero-title {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  margin-bottom: 2rem;
  opacity: 0.95;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   BOUTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 48px;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background: #d14f03;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--color-secondary);
  color: var(--color-white);
  border-color: var(--color-secondary);
}

.btn-secondary:hover,
.btn-secondary:focus {
  background: #007bb3;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--color-white);
  border-color: var(--color-white);
}

.btn-outline:hover,
.btn-outline:focus {
  background: var(--color-white);
  color: var(--color-dark);
}

#btn-logout {
  background: #dc3545;
  color: #ffffff;
  border-color: #dc3545;
}

#btn-logout:hover,
#btn-logout:focus {
  background: #c82333;
  border-color: #bd2130;
}

/* ============================================
   CARTES (CARDS)
   ============================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Pour centrer les services du réseau quand il y a moins de cartes */
#network-services {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
}

#network-services .card {
  flex: 0 0 280px;
  max-width: 280px;
}

/* Carrousel de livres */
.books-carousel {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
  gap: 0.75rem !important;
  margin-bottom: 2rem;
}

.book-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition);
  border: 1px solid #eee;
  display: flex;
  flex-direction: column;
  max-width: 250px !important;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.book-cover {
  width: 250px !important;
  height: auto !important;
  object-fit: cover;
  aspect-ratio: 2/3;
}

.book-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-dark);
  margin: 0.75rem 0.75rem 0.5rem 0.75rem;
}

.book-author {
  font-size: 0.95rem;
  color: var(--color-text-light);
  margin: 0 0.75rem 0.5rem 0.75rem;
  font-style: italic;
}

.book-desc {
  font-size: 0.9rem;
  color: var(--color-text);
  margin: 0 0.75rem 0.75rem 0.75rem;
  line-height: 1.5;
}

.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition);
  border: 1px solid #eee;
}

.card:hover,
.card:focus-within {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #f0f0f0;
}

.card-body {
  padding: 1.5rem;
}

.card-icon {
  width: 128px;
  height: 128px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-secondary);
  object-fit: contain;
  margin-left: auto;
  margin-right: auto;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-dark);
}

.card-text {
  font-size: 0.95rem;
  color: var(--color-text-light);
  line-height: 1.6;
}

.card-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.card-link:hover,
.card-link:focus {
  text-decoration: underline;
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
  padding: 4rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--color-dark);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.section-subtitle {
  color: var(--color-text-light);
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================
   ÉVÉNEMENTS
   ============================================ */
.events-slider {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.events-slider::-webkit-scrollbar {
  height: 6px;
}

.events-slider::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.event-card {
  flex: 0 0 220px;
  scroll-snap-align: start;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  border: 1px solid #eee;
  transition: all var(--transition);
}

.event-card:hover {
  box-shadow: var(--shadow-md);
}

.event-date {
  display: inline-block;
  background: var(--color-primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.event-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-dark);
}

.event-desc {
  font-size: 0.9rem;
  color: var(--color-text-light);
}

/* Pagination dots */
.slider-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.slider-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ddd;
  border: none;
  cursor: pointer;
  transition: background var(--transition);
}

.slider-dot[aria-current="true"] {
  background: var(--color-primary);
}

/* ============================================
   SÉLECTEUR DE VILLE
   ============================================ */
.city-selector {
  background: var(--color-light);
  padding: 2rem;
  border-radius: var(--radius-lg);
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.city-selector-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--color-dark);
}

.city-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.city-chip {
  padding: 0.75rem 1.5rem;
  background: #333 !important;
  border: 2px solid #333 !important;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white !important;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.city-chip::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #ff5252, #ff6b35, #f7931e, #ffd700, #4caf50);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.city-chip:hover::before,
.city-chip:focus::before {
  opacity: 0.7;
}

.city-chip span {
  position: relative;
  z-index: 1;
}

.city-chip:hover,
.city-chip:focus {
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.city-chip.is-active {
  background: var(--color-secondary);
  color: white;
  border-color: var(--color-secondary);
}

.city-chip.is-active::before {
  opacity: 0.7;
}

.btn-geo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--color-dark);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-geo:hover,
.btn-geo:focus {
  background: #1a333d;
}

/* ============================================
   AUTHENTIFICATION / COMPTE
   ============================================ */
.user-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--color-light);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
}

.user-greeting {
  font-weight: 700;
  color: var(--color-dark);
}

.user-greeting span {
  color: var(--color-primary);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  min-height: 40px;
}

/* Mes emprunts - confidentialité */
.loans-toggle {
  margin-top: 1rem;
}

.loans-panel {
  display: none;
  margin-top: 1rem;
  padding: 1.5rem;
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid #eee;
}

.loans-panel.is-open {
  display: block;
}

.loan-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #eee;
}

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

.loan-cover {
  width: 50px;
  height: 70px;
  background: #eee;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  object-fit: cover;
}

.loan-info h4 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.loan-info p {
  font-size: 0.85rem;
  color: var(--color-text-light);
}

/* ============================================
   LECTEUR AUDIO (Text-to-Speech)
   ============================================ */
.audio-player {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--color-light);
  border-radius: var(--radius-lg);
  margin: 1rem 0;
}

.audio-player button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--color-secondary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.audio-player button:hover,
.audio-player button:focus {
  background: #007bb3;
}

.audio-player button[aria-pressed="true"] {
  background: var(--color-primary);
}

.audio-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-dark);
}

.audio-status {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  background: var(--color-secondary);
  color: white;
  padding: 3rem 0 1.5rem;
}

.site-footer a {
  color: white;
  text-decoration: underline;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

/* Grille spécifique pour footer-bib avec 3 colonnes égales */
#footer-bib .footer-grid,
#footer-reseau .footer-grid {
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
}

/* Aligner les titres sur la même ligne */
#footer-bib .footer-grid .footer-title,
#footer-reseau .footer-grid .footer-title {
  min-height: 2rem;
}

/* Centrer la colonne horaires */
#footer-bib .footer-grid .footer-col:nth-child(2) {
  text-align: center;
}

/* Centrer la colonne mentions légales */
#footer-reseau .footer-grid .footer-col:nth-child(2) {
  text-align: center;
}

/* Centrer la colonne réseaux sociaux footer-bib */
#footer-bib .footer-grid .footer-col:nth-child(3) {
  text-align: center;
}

/* Centrer la colonne réseaux sociaux footer-reseau */
#footer-reseau .footer-grid .footer-col:nth-child(3) {
  text-align: center;
}

/* Centrer les réseaux sociaux sur le titre */
#footer-bib .footer-grid .footer-col:nth-child(3) .footer-social,
#footer-reseau .footer-grid .footer-col:nth-child(3) .footer-social {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

@media (max-width: 768px) {
  #footer-bib .footer-grid,
  #footer-reseau .footer-grid {
    grid-template-columns: 1fr;
  }
  #footer-bib .footer-grid .footer-col:nth-child(2),
  #footer-bib .footer-grid .footer-col:nth-child(3),
  #footer-reseau .footer-grid .footer-col:nth-child(2),
  #footer-reseau .footer-grid .footer-col:nth-child(3) {
    text-align: left;
  }
  #footer-bib .footer-grid .footer-col:nth-child(3) .footer-social,
  #footer-reseau .footer-grid .footer-col:nth-child(3) .footer-social {
    justify-content: flex-start;
  }
}

.footer-col-wide {
  grid-column: span 2;
}

.footer-title {
  font-size: 1rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}

.footer-address,
.footer-hours {
  font-size: 0.9rem;
  line-height: 1.8;
}

.footer-hours dt {
  font-weight: 600;
  color: white;
}

.footer-hours dd {
  margin-left: 0;
  margin-bottom: 0.5rem;
}

.footer-social {
  display: flex;
  gap: 1rem;
}

.footer-social a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  color: white;
  text-decoration: none;
  transition: background var(--transition);
}

.footer-social a:hover,
.footer-social a:focus {
  background: var(--color-primary);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: white;
}

/* ============================================
   MODALES
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  transform: scale(0.95);
  transition: transform var(--transition);
}

.modal-overlay.is-open .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--color-text-light);
  transition: background var(--transition);
}

.modal-close:hover,
.modal-close:focus {
  background: var(--color-light);
  color: var(--color-dark);
}

/* ============================================
   ALERTES & FEEDBACK
   ============================================ */
.alert {
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-success {
  background: rgba(0, 157, 224, 0.1);
  color: #007bb3;
  border: 1px solid rgba(0, 157, 224, 0.2);
}

.alert-error {
  background: rgba(232, 93, 4, 0.1);
  color: #b84a03;
  border: 1px solid rgba(232, 93, 4, 0.2);
}

/* ============================================
   HIGHLIGHT CARTE (mise en avant au clic)
   ============================================ */
.is-highlighted {
  animation: card-highlight 2.5s ease-out;
}

@keyframes card-highlight {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 157, 224, 0.6);
    transform: scale(1);
  }
  15% {
    transform: scale(1.02);
  }
  40% {
    box-shadow: 0 0 0 12px rgba(0, 157, 224, 0);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 157, 224, 0);
    transform: scale(1);
  }
}

/* Curseur pointer sur les cartes cliquables */
.bpt-dynamic-card {
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.bpt-dynamic-card:hover,
.bpt-dynamic-card:focus-within {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Les boutons à l'intérieur conservent leur curseur normal */
.bpt-dynamic-card button {
  cursor: pointer;
}

/* ============================================
   BIBLIOTHÈQUES DU RÉSEAU — Badges Arc-en-ciel
   ============================================ */
.bib-network {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem 0;
}

/* Force exactement 2 lignes de 13 badges */
.bib-network-2lines {
  flex-wrap: wrap;
}

.bib-network-2lines .bib-badge {
  flex-basis: calc(100% / 13 - 0.75rem);
  flex-grow: 0;
  flex-shrink: 0;
  min-width: 0;
  padding: 0.5rem 0.25rem;
  font-size: 0.85rem;
}

/* Force exactement 3 lignes de 9 badges avec chroma vertical (colonnes) */
.bib-network-3lines {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-start;
  align-items: stretch;
}

.bib-network-3lines .bib-badge {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  min-width: auto;
  max-width: none;
  white-space: normal;
  word-wrap: break-word;
  hyphens: auto;
}

.bib-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  text-align: center;
  line-height: 1.3;
  min-height: 44px;
  min-width: 120px;
  transition: transform var(--transition), box-shadow var(--transition);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.bib-badge:hover,
.bib-badge:focus {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  color: #fff;
  outline: none;
}

.bib-badge:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

/* Couleurs Arc-en-ciel LGBTQ */
.bib-red    { background: #333 !important; color: white !important; }
.bib-orange { background: #333 !important; color: white !important; }
.bib-yellow { background: #333 !important; color: white !important; text-shadow: none; }
.bib-green  { background: #333 !important; color: white !important; }
.bib-blue   { background: #333 !important; color: white !important; }
.bib-violet { background: #333 !important; color: white !important; }

/* Couleurs psychédéliques 70ties supplémentaires */
.bib-pink   { background: #333 !important; color: white !important; }
.bib-lime   { background: #333 !important; color: white !important; }
.bib-teal   { background: #333 !important; color: white !important; }
.bib-magenta { background: #333 !important; color: white !important; }
.bib-cyan   { background: #333 !important; color: white !important; }
.bib-gold   { background: #333 !important; color: white !important; }
.bib-coral  { background: #333 !important; color: white !important; }
.bib-turquoise { background: #333 !important; color: white !important; }
.bib-fuchsia { background: #333 !important; color: white !important; }
.bib-salmon { background: #333 !important; color: white !important; }
.bib-violet2 { background: #333 !important; color: white !important; }
.bib-indigo { background: #333 !important; color: white !important; }
.bib-maroon { background: #333 !important; color: white !important; }
.bib-olive  { background: #333 !important; color: white !important; }
.bib-navy   { background: #333 !important; color: white !important; }
.bib-aqua   { background: #333 !important; color: white !important; }
.bib-silver { background: #333 !important; color: white !important; }
.bib-sienna { background: #333 !important; color: white !important; }
.bib-khaki  { background: #333 !important; color: white !important; }
.bib-plum   { background: #333 !important; color: white !important; }
.bib-tomato { background: #333 !important; color: white !important; }
.bib-springgreen { background: #333 !important; color: white !important; }
.bib-royalblue { background: #333 !important; color: white !important; }
.bib-hotpink { background: #333 !important; color: white !important; }
.bib-deeppink { background: #333 !important; color: white !important; }
.bib-orangered { background: #333 !important; color: white !important; }
.bib-darkorange { background: #333 !important; color: white !important; }
.bib-limegreen { background: #333 !important; color: white !important; }
.bib-mediumorchid { background: #333 !important; color: white !important; }
.bib-mediumslateblue { background: #333 !important; color: white !important; }

/* Couleurs au survol - psychédéliques 70ties */
.bib-red:hover    { background: #E40303 !important; }
.bib-orange:hover { background: #FF8C00 !important; }
.bib-yellow:hover { background: #FFED00 !important; color: #333 !important; text-shadow: none; }
.bib-green:hover  { background: #008026 !important; }
.bib-blue:hover   { background: #004DFF !important; }
.bib-violet:hover { background: #750787 !important; }
.bib-pink:hover   { background: #FF69B4 !important; }
.bib-lime:hover   { background: #32CD32 !important; }
.bib-teal:hover   { background: #008080 !important; }
.bib-magenta:hover { background: #FF00FF !important; }
.bib-cyan:hover   { background: #00FFFF !important; }
.bib-gold:hover   { background: #FFD700 !important; color: #333 !important; }
.bib-coral:hover  { background: #FF7F50 !important; }
.bib-turquoise:hover { background: #40E0D0 !important; }
.bib-fuchsia:hover { background: #FF00FF !important; }
.bib-salmon:hover { background: #FA8072 !important; }
.bib-violet2:hover { background: #8B008B !important; }
.bib-indigo:hover { background: #4B0082 !important; }
.bib-maroon:hover { background: #800000 !important; }
.bib-olive:hover  { background: #808000 !important; }
.bib-navy:hover   { background: #000080 !important; }
.bib-aqua:hover   { background: #00FFFF !important; }
.bib-silver:hover { background: #C0C0C0 !important; color: #333 !important; }
.bib-sienna:hover { background: #A0522D !important; }
.bib-khaki:hover  { background: #F0E68C !important; color: #333 !important; }
.bib-plum:hover   { background: #DDA0DD !important; }
.bib-tomato:hover { background: #FF6347 !important; }
.bib-springgreen:hover { background: #00FF7F !important; }
.bib-royalblue:hover { background: #4169E1 !important; }
.bib-hotpink:hover { background: #FF69B4 !important; }
.bib-deeppink:hover { background: #FF1493 !important; }
.bib-orangered:hover { background: #FF4500 !important; }
.bib-darkorange:hover { background: #FF8C00 !important; }
.bib-limegreen:hover { background: #32CD32 !important; }
.bib-mediumorchid:hover { background: #BA55D3 !important; }
.bib-mediumslateblue:hover { background: #7B68EE !important; }

/* ============================================
   UTILITAIRES
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .site-main {
    padding-top: 60px;
  }
  
  .site-header {
    height: 60px;
  }
  
  .site-logo {
    font-size: 1.25rem;
  }
  
  .header-tabs-nav {
    gap: 0.75rem;
  }
  
  .header-tabs-nav .tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .main-nav {
    display: none;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .search-form {
    max-width: none;
    order: 3;
    flex-basis: 100%;
    margin-top: 0.5rem;
  }
  
  .hero-section {
    min-height: 400px;
  }
  
  .section {
    padding: 2.5rem 0;
  }
  
  .cards-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .hero-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .hero-actions .btn {
    width: 100%;
  }
  
  .tab-btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
}

/* ============================================
   SUPPORT ZOOM 200%
   ============================================ */
@media (min-resolution: 192dpi) {
  html {
    font-size: 110%;
  }
}

/* ============================================
   ANIMATIONS RÉDUITES (Accessibilité)
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
