/* ============================================================
   KOBO CALIBRE BROWSER — CSS E-INK
   Optimise pour Kobo Clara 2E (1072x1448px, ecran e-ink)
   Regles : zero animation, contraste maximal, tap targets >=44px
   ============================================================ */

/* === RESET ================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  animation: none !important;
  transition: none !important;
}

/* === BASE ================================================== */
html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: #ffffff;
  color: #000000;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.6;
  max-width: 1072px;
  margin: 0 auto;
  padding: 0 8px 16px;
}

a {
  color: #000000;
  text-decoration: underline;
}

a:active {
  background: #000;
  color: #fff;
}

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

h1 { font-size: 1.5rem; line-height: 1.3; margin-bottom: 12px; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 16px 0 8px; }

/* === HEADER ================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 3px solid #000;
  padding: 10px 0 12px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-title {
  font-size: 1.2rem;
  font-weight: bold;
  text-decoration: none;
  color: #000;
}

/* === BREADCRUMB =========================================== */
.breadcrumb {
  font-size: 0.9rem;
  line-height: 1.4;
  flex-wrap: wrap;
  display: flex;
  align-items: center;
  gap: 2px;
}

.breadcrumb a {
  text-decoration: underline;
  color: #000;
  padding: 4px 2px;
}

.breadcrumb .current {
  color: #444;
}

/* === BARRE DE RECHERCHE =================================== */
.search-form {
  display: flex;
  gap: 6px;
}

.search-form input[type="search"],
.search-form-main input[type="search"] {
  flex: 1;
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  min-height: 48px;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}

.search-form button,
.search-form-main button {
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  padding: 10px 16px;
  border: 2px solid #000;
  background: #000;
  color: #fff;
  min-height: 48px;
  min-width: 48px;
  cursor: pointer;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}

.search-form-main {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

/* === PAGE TITLE ============================================ */
.page-title {
  font-size: 1.4rem;
  margin-bottom: 6px;
  border-bottom: 2px solid #000;
  padding-bottom: 8px;
}

.result-count {
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 14px;
}

/* === PAGE D'ACCUEIL ======================================= */
.home-stats {
  text-align: center;
  padding: 10px 0 6px;
  font-size: 1rem;
  color: #444;
}

.stats-label {
  font-size: 0.95rem;
}

.home-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px 0;
}

.home-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid #000;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 20px 8px;
  color: #000;
  text-decoration: none;
  text-align: center;
  min-height: 80px;
  gap: 6px;
}

.home-nav a:active {
  background: #000;
  color: #fff;
}

.recent-section {
  margin-top: 20px;
}

.section-title {
  font-size: 1.1rem;
  border-bottom: 2px solid #000;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

/* === GRILLE DE LIVRES ===================================== */
.book-grid {
  overflow: hidden;
  margin-bottom: 16px;
}

.book-grid::after {
  content: '';
  display: table;
  clear: both;
}

.book-card {
  float: left;
  width: 48%;
  margin: 0 1% 14px;
  border: 2px solid #000;
  overflow: hidden;
}

.book-card a {
  display: block;
  text-decoration: none;
  color: #000;
}

.book-card a:active {
  background: #f0f0f0;
}

.book-card img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: contain;
  border-bottom: 1px solid #000;
  background: #eee;
}

.book-card-info {
  padding: 8px;
}

.book-title {
  font-size: 0.95rem;
  font-weight: bold;
  line-height: 1.3;
  margin-bottom: 4px;
}

.book-author {
  font-size: 0.85rem;
  color: #333;
  margin-bottom: 2px;
}

.book-series {
  font-size: 0.8rem;
  color: #555;
  font-style: italic;
  margin-bottom: 2px;
}

.book-formats {
  font-size: 0.75rem;
  color: #666;
}

/* === FICHE LIVRE ========================================== */
.book-detail {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.book-detail-cover {
  text-align: center;
  padding: 8px 0;
}

.book-detail-cover img {
  max-width: 280px;
  height: auto;
  border: 2px solid #000;
  margin: 0 auto;
}

.book-detail-meta h1 {
  font-size: 1.4rem;
  margin-bottom: 10px;
}

.meta-authors {
  font-size: 1rem;
  margin-bottom: 6px;
}

.meta-authors a {
  font-weight: bold;
}

.meta-series {
  font-size: 0.95rem;
  font-style: italic;
  margin-bottom: 10px;
  color: #333;
}

.meta-list {
  font-size: 0.95rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin-top: 10px;
}

.meta-list dt {
  font-weight: bold;
  color: #444;
}

.meta-list dd {
  margin: 0;
}

.tag-link {
  text-decoration: underline;
}

/* === RESUME =============================================== */
.book-comment {
  border-top: 2px solid #000;
  padding-top: 14px;
}

.comment-text {
  font-size: 0.95rem;
  line-height: 1.7;
}

.comment-text p { margin-bottom: 10px; }
.comment-text p:last-child { margin-bottom: 0; }

/* === BOUTONS DE TELECHARGEMENT ============================ */
.download-section {
  border-top: 2px solid #000;
  padding-top: 14px;
}

.download-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.btn-download {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 16px 20px;
  border: 3px solid #000;
  background: #000;
  color: #fff;
  text-decoration: none;
  min-height: 56px;
}

.btn-download:active {
  background: #333;
}

.file-size {
  font-size: 0.85rem;
  font-weight: normal;
  opacity: 0.85;
}

/* === LISTES (auteurs, genres, series) ===================== */
.list-index {
  list-style: none;
  border-top: 1px solid #000;
}

.list-index li {
  border-bottom: 1px solid #000;
}

.list-index li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 8px;
  color: #000;
  text-decoration: none;
  min-height: 52px;
  gap: 8px;
}

.list-index li a:active {
  background: #f0f0f0;
}

.item-name {
  font-size: 1rem;
  flex: 1;
}

.count {
  font-size: 0.85rem;
  color: #555;
  white-space: nowrap;
}

/* === PAGINATION =========================================== */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 2px solid #000;
  margin-top: 8px;
  gap: 8px;
}

.btn-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  padding: 12px 18px;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  text-decoration: none;
  min-height: 48px;
  min-width: 48px;
}

.btn-page:active {
  background: #000;
  color: #fff;
}

.btn-disabled {
  color: #aaa;
  border-color: #aaa;
  pointer-events: none;
}

.page-info {
  font-size: 0.95rem;
  color: #444;
  white-space: nowrap;
}

/* === ETATS VIDES ========================================== */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  font-size: 1rem;
  color: #555;
  border: 2px dashed #aaa;
  margin: 16px 0;
}

/* === PAGE D'ERREUR ======================================== */
.error-page {
  text-align: center;
  padding: 60px 16px;
}

.error-code {
  font-size: 5rem;
  font-weight: bold;
  line-height: 1;
  margin-bottom: 16px;
}

.error-message {
  font-size: 1.2rem;
  margin-bottom: 32px;
  color: #444;
}

.btn-home {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 16px 32px;
  border: 3px solid #000;
  background: #000;
  color: #fff;
  text-decoration: none;
  min-height: 56px;
}

/* === FOOTER =============================================== */
.site-footer {
  border-top: 2px solid #000;
  margin-top: 24px;
  padding: 14px 0 8px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.site-footer a {
  color: #000;
  text-decoration: underline;
  padding: 6px 2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.site-footer span {
  color: #aaa;
}

/* === BOUTONS DE DEFILEMENT ================================ */
.scroll-buttons {
  position: fixed;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.btn-scroll {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 3px solid #000;
  background: #fff;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.btn-scroll:active {
  background: #000;
}

.btn-scroll-up::before {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 20px solid #000;
}

.btn-scroll-up:active::before {
  border-bottom-color: #fff;
}

.btn-scroll-down::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 20px solid #000;
}

.btn-scroll-down:active::after {
  border-top-color: #fff;
}