/* ==========================================================================
   TEMPLATE IMPÉRIAL — al-quran.fr
   Gravure impériale ancienne : rouge bordeaux, or, parchemin.
   Fond extérieur : zellij marocain (motif géométrique généré, pas une photo).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --rouge:        #8B0000;
  --or:           #d4af37;
  --or-clair:     #f6e2a0;
  --parchemin:    #fdfaf3;
  --hors-page:    #e8e0d0;
  --texte:        #2b2b2b;
  --or-fade:      rgba(212,175,55,0.45);
  --rouge-fade:   rgba(139,0,0,0.06);
  --texte-fr:     #5a4632; /* encre sépia — traduction FR, distincte du noir arabe (--texte) */
}

/* -------------------------------------------------------------------------
   Fond extérieur : zellij marocain
   Motif à étoiles à 8 branches / croix entrelacées, en losanges or/rouge
   très estompés sur fond parchemin foncé (#e8e0d0). Généré en SVG inline,
   tuilé en repeating-* pour rester léger et net à toute résolution.
------------------------------------------------------------------------- */
html, body {
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--hors-page);
  background-image:
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%238B0000' stroke-width='1' opacity='0.16'%3E%3Cpath d='M60 0 L90 30 L60 60 L30 30 Z'/%3E%3Cpath d='M60 60 L90 90 L60 120 L30 90 Z'/%3E%3Cpath d='M0 60 L30 30 L60 60 L30 90 Z'/%3E%3Cpath d='M60 60 L90 30 L120 60 L90 90 Z'/%3E%3Ccircle cx='60' cy='60' r='14' /%3E%3C/g%3E%3Cg fill='none' stroke='%23d4af37' stroke-width='1' opacity='0.22'%3E%3Cpath d='M0 0 L60 0 L60 60 L0 60 Z'/%3E%3Cpath d='M60 0 L120 0 L120 60 L60 60 Z'/%3E%3Cpath d='M0 60 L60 60 L60 120 L0 120 Z'/%3E%3Cpath d='M60 60 L120 60 L120 120 L60 120 Z'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  font-size: 19px;
}

body {
  background: transparent;
  color: var(--texte);
  font-family: 'Lora', serif;
  line-height: 1.7;
}

/* -------------------------------------------------------------------------
   Structure de page — feuillet parchemin encadré
------------------------------------------------------------------------- */
.imperial-page-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 16px 60px;
}

.page {
  background: var(--parchemin);
  position: relative;
  padding: 28px 22px 40px;
  margin-bottom: 22px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
}

.frame-outer {
  position: absolute;
  inset: 10px;
  border: 3px solid var(--rouge);
  pointer-events: none;
}

.frame-inner {
  position: absolute;
  inset: 16px;
  border: 1px solid var(--or);
  pointer-events: none;
}

.watermark {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%) rotate(-30deg);
  font-family: 'Cinzel', serif;
  font-size: 60pt;
  color: var(--rouge-fade);
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  z-index: 0;
}

.page-content {
  width: 100%;
  position: relative;
  z-index: 30;
}

.footer-imperial {
  margin-top: 30px;
  padding-top: 10px;
  text-align: center;
}
.footer-zellij { margin: 0 auto 14px; max-width: 320px; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}
.footer-links a { color: var(--rouge); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-links .footer-sep { color: var(--or); font-size: 10px; }
.footer-sig {
  padding-top: 14px;
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--or);
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--rouge);
  text-transform: uppercase;
}
.etude-status-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.etude-status-badge.etude-status-fixe { background: #e1f5ee; color: #04342c; border: 1px solid #0f6e56; }
.etude-status-badge.etude-status-provisoire { background: #faeeda; color: #412402; border: 1px solid #854f0b; }
.etude-status-badge.etude-status-ouvert { background: #f1efe8; color: #444441; border: 1px solid #5f5e5a; }

.these-box, .demonstration-box, .conclusion-box {
  position: relative;
  margin: 18px 0;
  padding: 18px 20px 16px;
  border-radius: 4px;
}
.these-box-label, .demonstration-box-label, .conclusion-box-label {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 10px;
  margin-bottom: 10px;
}
.these-box {
  background: var(--rouge-fade);
  border: 1px solid var(--rouge);
  border-inline-start: 4px solid var(--rouge);
}
.these-box-label { background: var(--rouge); color: var(--or-clair); }
.these-box p { font-family: 'Cinzel', serif; font-size: 15px; line-height: 1.6; margin: 0; }

.demonstration-box {
  background: var(--parchemin);
  border: 1px solid var(--or-fade);
  border-inline-start: 4px solid var(--or);
}
.demonstration-box-label { background: var(--or); color: #3a2c00; }
.demonstration-box p { margin: 8px 0; line-height: 1.7; }
.demonstration-calcul { font-size: 13px; opacity: 0.85; font-style: italic; }

.conclusion-box {
  background: var(--hors-page);
  border: 1px solid var(--texte-fr);
  border-inline-start: 4px solid var(--texte-fr);
}
.conclusion-box-label { background: var(--texte-fr); color: #fff; }
.conclusion-box p { margin: 8px 0; line-height: 1.6; }
.conclusion-trad-label { font-weight: 700; margin-bottom: 2px !important; }

.verse-ref-badge {
  display: inline-flex;
  align-items: center;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 12px;
  padding: 1px 8px;
  margin: 0 2px;
  border-radius: 9px;
  background: var(--rouge);
  color: var(--or-clair);
  border: 1px solid var(--or);
  white-space: nowrap;
}
.verse-ref-sep { margin: 0 1px; opacity: 0.75; }
mark.gr-term {
  background: var(--or-clair);
  color: #4a1b0c;
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 600;
  direction: rtl;
  unicode-bidi: embed;
}

/* -------------------------------------------------------------------------
   Éléments décoratifs
------------------------------------------------------------------------- */
.badge-imp {
  display: inline-block;
  background: linear-gradient(180deg, var(--rouge), #5a0000);
  color: var(--or-clair);
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 13px;
  padding: 5px 14px;
  border: 1px solid var(--or);
}

.title-main {
  position: relative;
  font-family: 'Cinzel', serif;
  color: var(--rouge);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: clamp(24px, 4vw, 34px);
  margin: 18px 0 22px;
}
.title-main::before, .title-main::after {
  font-family: 'Traditional Arabic', 'Amiri', 'Lora', serif;
  color: var(--or);
  font-weight: 400;
  font-size: 1.3em;
  vertical-align: middle;
  margin: 0 10px;
}
.title-main::before { content: "\FD3F"; }
.title-main::after  { content: "\FD3E"; }

/* Filigrane / tachkil décoratif au-dessus du titre */
.title-flourish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--or);
  font-size: 15px;
  letter-spacing: 0.3em;
  margin: 6px 0 2px;
}
.title-flourish::before, .title-flourish::after {
  content: "";
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--or));
}
.title-flourish::after { background: linear-gradient(270deg, transparent, var(--or)); }
.title-flourish-mark { font-size: 20px; line-height: 1; }

.sep {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--or);
  margin: 18px 0;
}
.sep::before, .sep::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--or-fade);
}
.sep-d { padding: 0 14px; font-size: 16px; letter-spacing: 6px; }

.definition-box {
  border: 1px solid var(--or);
  background: var(--rouge-fade);
  padding: 16px 20px;
  margin: 16px 0;
  font-family: 'Lora', serif;
  font-size: 17px;
}
.definition-box-collapsible summary {
  list-style: none;
  display: inline-block;
}
.definition-box-collapsible summary::-webkit-details-marker { display: none; }
.definition-box-collapsible summary::before {
  content: '\25B8 ';
  margin-inline-end: 4px;
}
.definition-box-collapsible[open] summary::before { content: '\25BE '; }

/* Pagination répétée en bas de sourate (identique à celle du haut) */
.page-header-block-bottom {
  margin-top: 18px;
  padding-top: 10px;
}

/* -------------------------------------------------------------------------
   Affichage principal / secondaire selon la langue choisie dans la navbar :
   traduction principale (grande, non italique) + arabe secondaire (réduit),
   quand une langue autre que l'arabe est sélectionnée.
------------------------------------------------------------------------- */
.translation-primary {
  font-size: 21px;
  font-style: normal;
  font-weight: 500;
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}
.aya-secondary {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dotted var(--or-fade);
  opacity: 0.82;
}
body.gr-hide-arabic .aya-secondary { display: none; }
.translation-primary {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: nowrap;
}
.translation-primary > .translation-text { flex: 1 1 auto; }
.badge-translation {
  flex: 0 0 auto;
  margin: 0 8px 0 4px;
}
.manuscript-badge {
  background: #2f6b4f;
  color: #fff;
}
.aya-secondary table td:first-child { font-size: 19px; line-height: 1.5; }

.idx-entry, .toc-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  border-bottom: 1px dotted var(--or-fade);
  font-family: 'Lora', serif;
  font-size: 18px;
  text-decoration: none;
  color: var(--texte);
}
.idx-entry:hover { background: var(--rouge-fade); text-decoration: none; color: var(--texte); }
.idx-chip {
  flex: 0 0 auto;
  min-width: 30px;
  text-align: center;
  background: var(--rouge);
  color: var(--or-clair);
  font-family: 'Cinzel', serif;
  font-size: 13px;
  padding: 3px 7px;
  border: 1px solid var(--or);
}
.idx-label { flex: 1; }
.idx-page { flex: 0 0 auto; font-family: 'Cinzel', serif; color: var(--rouge); font-size: 13px; }

/* -------------------------------------------------------------------------
   Barre de navigation — pages longues (gr-langbar)
------------------------------------------------------------------------- */
.gr-langbar, .etnv-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, #7a0000, #4a0000);
  border-bottom: 3px solid var(--or);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  color: var(--or-clair);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-family: 'Cinzel', serif;
  font-size: 16px;
}
.gr-langbar a, .etnv-bar a { color: var(--or-clair); text-decoration: none; }
.gr-langbar a:hover, .etnv-bar a:hover { color: #fff; }
.gr-home { font-size: 21px; margin-right: 6px; color: var(--or-clair); }
.gr-spacer { flex: 1; }

.gr-select, .gr-zoom-controls, .gr-lang-flags {
  display: flex;
  align-items: center;
  gap: 4px;
}
.gr-select select, .gr-lang-flags select {
  background: #4a0000;
  color: var(--or-clair);
  border: 1px solid var(--or);
  font-family: 'Cinzel', serif;
  font-size: 15px;
  padding: 5px 9px;
}
.gr-lang-flags select { font-size: 16px; }
.gr-zoom-controls button, .gr-menu-btn {
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--or);
  color: var(--or-clair);
  font-family: 'Cinzel', serif;
  font-size: 15px;
  padding: 5px 12px;
  cursor: pointer;
}
.gr-zoom-controls button:hover, .gr-menu-btn:hover {
  background: var(--or);
  color: #3a0000;
}
.gr-zoom-val { min-width: 46px; text-align: center; font-size: 15px; }

.gr-dropdown { position: relative; }
.gr-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%; left: 0;
  background: #4a0000;
  border: 1px solid var(--or);
  min-width: 210px;
  flex-direction: column;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  z-index: 200;
}
.gr-dropdown-menu a {
  padding: 11px 16px;
  font-size: 16px;
  color: var(--or-clair);
  border-bottom: 1px solid rgba(212,175,55,0.25);
}
.gr-dropdown-menu a:hover { background: rgba(212,175,55,0.15); color: #fff; }
.gr-dropdown.open .gr-dropdown-menu { display: flex; }

.etnv-nav-doc { display: flex; align-items: center; gap: 6px; }

/* Groupe de contrôles secondaires (lecture du texte, ressources, sourate,
   qira'at, recherche) — visible en ligne sur grand écran, repliable en
   panneau vertical sur mobile via le bouton burger. */
.gr-collapsible {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.gr-collapsible form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0;
}

/* Bouton burger : masqué par défaut, affiché seulement sous le seuil mobile */
.gr-burger {
  display: none;
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--or);
  color: var(--or-clair);
  font-size: 20px;
  line-height: 1;
  padding: 6px 12px;
  cursor: pointer;
}
.gr-burger:hover { background: var(--or); color: #3a0000; }

@media (max-width: 900px) {
  .gr-zoom-controls { display: none !important; }
  .gr-langbar, .etnv-bar { flex-wrap: wrap; font-size: 14px; }
}

/* -------------------------------------------------------------------------
   Navbar responsive — repli des contrôles secondaires sous un burger
------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .gr-langbar { flex-wrap: nowrap; position: relative; }
  .gr-burger { display: inline-block; order: 1; }
  .gr-home { order: 0; }
  .gr-spacer { order: 2; flex: 1; }
  .gr-lang-flags { order: 3; }
  .gr-poetic-toggle { display: none; } /* replié dans le panneau mobile via .gr-collapsible */

  .gr-collapsible {
    display: none;
    order: 5;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: #4a0000;
    border-bottom: 3px solid var(--or);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    gap: 8px;
  }
  .gr-langbar.gr-mobile-open .gr-collapsible { display: flex; }
  .gr-collapsible .gr-dropdown-menu { position: static; box-shadow: none; }
  .gr-collapsible .gr-select,
  .gr-collapsible form { width: 100%; }
  .gr-collapsible .gr-select select,
  .gr-collapsible .gr-input,
  .gr-collapsible .gr-menu-btn { width: 100%; box-sizing: border-box; }
  .gr-search-form { flex-wrap: wrap; }

  .gr-langbar.gr-mobile-open .gr-poetic-toggle {
    display: flex; order: 6; width: 100%; justify-content: flex-end;
  }
}

/* Zoom frame: le contenu interne reste LTR pour ne pas casser les calculs pixel */
#gr-zoom-frame {
  direction: ltr;
  transform-origin: top center;
  transition: transform 0.12s ease-out;
}
[dir="rtl"] #gr-zoom-frame .page-content { direction: rtl; }

/* -------------------------------------------------------------------------
   Remplacements 100% maison des utilitaires auparavant fournis par Bootstrap
   (aucun fichier bootstrap.css/js n'est plus chargé sur le site)
------------------------------------------------------------------------- */
* { box-sizing: border-box; }

.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 15px; }
.text-center { text-align: center; }
.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;
}

.jumbotron { background: transparent; padding: 0; }

/* Listes de versets */
.list-group { list-style: none; padding: 0; margin: 0; }
.list-group-item {
  display: block;
  padding: 12px 14px;
  background: var(--parchemin);
  border: 1px solid var(--or-fade);
  margin-bottom: 6px;
}
.list-group-item.active { border-color: var(--rouge); box-shadow: 0 0 0 1px var(--rouge) inset; }

/* Badge générique (numéro de verset, etc.) */
.badge {
  display: inline-block;
  min-width: 10px;
  padding: 3px 9px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  background: var(--rouge);
  color: var(--or-clair);
  border: 1px solid var(--or);
}
.label { display: inline-block; padding: 4px 9px; font-size: 13px; font-weight: 600; }
.label-info { background: var(--rouge); color: var(--or-clair); }

/* Tableaux */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 17px;
  background: var(--parchemin);
  border: 1px solid var(--or);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.table td, .table th { padding: 10px 12px; border: 1px solid var(--or-fade); }
.table-bordered td, .table-bordered th { border: 1px solid var(--or-fade); }
.table-striped tbody tr:nth-child(odd) { background: var(--rouge-fade); }
.table tbody tr:hover { background: rgba(212,175,55,0.16); }

.table tr.info, .table thead tr {
  background: linear-gradient(180deg, #8B0000, #5a0000);
}
.table tr.info td, .table tr.info th,
.table thead tr td, .table thead tr th {
  position: sticky;
  top: 58px;
  color: var(--or-clair);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.04em;
  border-color: var(--or);
  background: linear-gradient(180deg, #8B0000, #5a0000);
  box-shadow: 0 2px 0 var(--or);
}
.table tr.success  { background: rgba(212,175,55,0.14); }
.table td.danger     { background: rgba(139,0,0,0.12); font-weight: 700; }
.table td.success    { background: rgba(212,175,55,0.18); font-weight: 700; }
.table td.info        { background: rgba(139,0,0,0.06); }
.table tr.primary   {
  background: linear-gradient(180deg, #8B0000, #5a0000);
  color: var(--or-clair);
  font-family: 'Cinzel', serif;
}

/* Clone JS de l'en-tête de tableau (actif uniquement en zoom, cf. footer.php) */
.gr-sticky-thead {
  z-index: 150;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}
.gr-sticky-thead table {
  border-collapse: collapse;
  background: var(--parchemin);
}
.gr-sticky-thead td, .gr-sticky-thead th {
  background: linear-gradient(180deg, #8B0000, #5a0000);
  color: var(--or-clair);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.04em;
  border: 1px solid var(--or);
  padding: 10px 12px;
  box-shadow: 0 2px 0 var(--or);
}

/* Alertes */
.alert {
  padding: 14px 18px;
  margin-bottom: 16px;
  border: 1px solid var(--or);
  background: var(--rouge-fade);
  color: var(--texte);
  position: relative;
}
.alert-danger { border-color: var(--rouge); }
.alert .close {
  float: left;
  font-size: 20px;
  line-height: 1;
  color: var(--rouge);
  text-decoration: none;
  cursor: pointer;
}
.alert .close:hover { color: #5a0000; }

/* Bouton retour en haut */
.gr-top-link {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border: 1px solid var(--or);
  background: var(--rouge);
  color: var(--or-clair);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.gr-top-link.visible { opacity: 0.9; pointer-events: auto; }
.gr-top-link:hover { background: #5a0000; }

/* Champs de la barre de navigation */
.gr-search-form { display: flex; gap: 4px; margin: 0; }
.gr-input {
  background: #4a0000;
  color: var(--or-clair);
  border: 1px solid var(--or);
  font-family: 'Lora', serif;
  font-size: 15px;
  padding: 5px 10px;
}
.gr-input::placeholder { color: rgba(246,226,160,0.65); }

/* Tooltip léger (remplace le plugin Bootstrap) */
.gr-tooltip {
  display: none;
  position: absolute;
  z-index: 500;
  max-width: 320px;
  background: #1f0000;
  color: var(--or);
  border: 1px solid var(--or);
  padding: 8px 10px;
  font-size: 15px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  box-sizing: border-box;
}
.gr-tooltip img { max-width: 100%; display: block; }
@media (max-width: 480px) {
  .gr-tooltip { max-width: calc(100vw - 24px); font-size: 14px; }
}
/* -------------------------------------------------------------------------
   En-tête de page — masthead harmonisé (utilisé sur toutes les pages)
------------------------------------------------------------------------- */
.page-masthead { text-align: center; margin-bottom: 8px; }
.page-masthead .title-main { margin: 12px 0 4px; }
.page-subtitle {
  font-family: 'Cinzel', serif;
  color: var(--or-clair);
  background: linear-gradient(180deg, var(--rouge), #5a0000);
  display: inline-block;
  padding: 3px 16px;
  font-size: 13px;
  letter-spacing: 0.12em;
  margin-bottom: 18px;
  border: 1px solid var(--or);
}

.zellij-band {
  height: 22px;
  margin: 0 auto 28px;
  max-width: 620px;
  background-image:
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='22' viewBox='0 0 44 22'%3E%3Cg fill='none' stroke='%238B0000' stroke-width='1.4' opacity='0.55'%3E%3Cpath d='M22 0 L33 11 L22 22 L11 11 Z'/%3E%3C/g%3E%3Cg fill='none' stroke='%23d4af37' stroke-width='1.2' opacity='0.8'%3E%3Ccircle cx='0' cy='11' r='4'/%3E%3Ccircle cx='44' cy='11' r='4'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: center;
  border-top: 1px solid var(--or-fade);
  border-bottom: 1px solid var(--or-fade);
}

.sura-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 20px;
  padding: 4px 2px 10px;
}

.sura-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 14px 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(212,175,55,0.10), transparent 60%),
    var(--parchemin);
  border: 1px solid var(--or-fade);
  text-decoration: none;
  color: var(--texte);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.sura-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 22px rgba(139,0,0,0.22);
  border-color: var(--or);
  color: var(--texte);
  text-decoration: none;
}

/* Petits fermoirs dorés aux quatre coins de chaque carte */
.sura-card-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--or);
  opacity: 0.85;
  pointer-events: none;
}
.sura-card-corner-tl { top: 6px; left: 6px; border-right: none; border-bottom: none; }
.sura-card-corner-tr { top: 6px; right: 6px; border-left: none; border-bottom: none; }
.sura-card-corner-bl { bottom: 6px; left: 6px; border-right: none; border-top: none; }
.sura-card-corner-br { bottom: 6px; right: 6px; border-left: none; border-top: none; }

.sura-medallion {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rouge);
  color: var(--or-clair);
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--parchemin), 0 0 0 4px var(--or);
}

.sura-name {
  font-family: 'Lora', serif;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
}

.sura-tag {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--rouge);
  border-top: 1px dotted var(--or-fade);
  padding-top: 8px;
  width: 100%;
  text-align: center;
}

@media (max-width: 560px) {
  .sura-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .sura-name { font-size: 18px; }
}

.list-group.verse { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.list-group-item.aya, .list-group-item.ayasearch {
  position: relative;
  background: var(--parchemin);
  border: 1px solid var(--or-fade);
  border-radius: 0;
  margin-bottom: 0;
  padding: 16px 20px 16px 16px;
  font-family: 'Lora', serif;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.list-group-item.aya::before, .list-group-item.ayasearch::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 4px;
  background: var(--or);
}
.list-group-item.aya:hover {
  box-shadow: 0 4px 16px rgba(139,0,0,0.12);
  border-color: var(--or);
}
.list-group-item.ayasearch {
  background: var(--rouge-fade);
  border-color: var(--rouge);
}
.list-group-item.ayasearch::before { background: var(--rouge); }
.aya, .ayasearch { font-size: 28px; line-height: 1.95; font-weight: 600; color: var(--texte); }

.list-group-item table { border-collapse: collapse; }
.list-group-item .badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 32px;
  padding: 0 10px;
  border-radius: 16px;
  background: var(--rouge);
  color: var(--or-clair);
  font-weight: 700;
  font-family: 'Cinzel', serif;
  font-size: 15px;
  border: 1px solid var(--or);
  box-shadow: 0 0 0 2px var(--parchemin), 0 0 0 3px var(--or-fade);
  text-shadow: 0 1px 1px rgba(0,0,0,0.35);
  white-space: nowrap;
  z-index: 1;
}
/* Rosette façon marque de fin de verset (fawasil coranique) */
.list-group-item .badge::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 18px;
  background-image: repeating-conic-gradient(var(--or) 0deg 6deg, transparent 6deg 18deg);
  opacity: 0.45;
  z-index: -1;
  pointer-events: none;
}

/* Résultats de recherche : mots-clés surlignés */
mark {
  background: var(--or);
  color: #3a0000;
  padding: 0 3px;
  font-weight: 700;
}

table.sourate td a.sourate,
table.sourate td a { color: var(--texte); text-decoration: none; }

.jumbotron p, .container p { font-size: 17px; }

/* Le .container Bootstrap est neutralisé ici : le cadre parchemin
   (.page / .page-content) gère déjà la largeur et le padding. Sans ceci,
   les deux systèmes de centrage se cumulaient et décalaient les boutons
   précédent/suivant du pager. */
.page-content .container {
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
}

a { color: var(--rouge); }
a:hover { color: #5a0000; }

.page-header-block { margin: 6px 0 4px; }
.page-header-pagers {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}

.pager-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, var(--rouge), #5a0000);
  border: 1px solid var(--or);
  color: var(--or-clair);
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 15px;
  padding: 10px 18px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-weight: bold;
}
.pager-btn:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(139,0,0,0.30);
}

@media (max-width: 700px) {
  .page-header-pagers { flex-wrap: wrap; justify-content: center; }
  .pager-btn { font-size: 12px; padding: 8px 14px; }
}

/* Print */
@media print {
  .gr-langbar, .etnv-bar { display: none !important; }
  html { background: #fff; }
  .page { box-shadow: none; }
}

/* -------------------------------------------------------------------------
   Responsive — écrans étroits (mobile / petites tablettes)
------------------------------------------------------------------------- */
@media (max-width: 700px) {
  html { font-size: 16px; }
  .imperial-page-wrap { padding: 14px 8px 40px; }
  .page { padding: 16px 10px 26px; }
  .frame-outer { inset: 5px; }
  .frame-inner { inset: 8px; }
  .watermark { font-size: 34pt; }

  .aya, .ayasearch { font-size: 22px; line-height: 1.75; }
  .list-group-item.aya, .list-group-item.ayasearch { padding: 12px 14px 12px 12px; }

  .title-main { font-size: 20px; }
  .title-main::before, .title-main::after { margin: 0 4px; font-size: 1.1em; }
  .title-flourish::before, .title-flourish::after { width: 28px; }
  .badge-imp { font-size: 11px; padding: 4px 10px; }
  .page-subtitle { font-size: 11px; }
  .zellij-band { max-width: 90%; }

  .sura-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .sura-name { font-size: 17px; }
  .sura-medallion { width: 46px; height: 46px; font-size: 17px; }

  /* Tableaux larges : défilement horizontal plutôt que débordement */
  /* Défilement horizontal des tableaux larges — sans casser le sticky
     vertical de l'en-tête (overflow-x seul, jamais overflow-y) */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { font-size: 13px; }
  .table tr.info td, .table thead tr td { top: 96px; }

  /* Verset : la table interne (texte + badge) passe en colonne */
  .list-group-item table,
  .list-group-item table tbody,
  .list-group-item table tr {
    display: block;
    width: 100%;
  }
  .list-group-item table td {
    display: block;
    width: 100% !important;
    text-align: right;
  }
  .list-group-item table td:last-child { text-align: left; margin-top: 6px; }
}

@media (max-width: 460px) {
  .gr-langbar .gr-select select,
  .gr-langbar .gr-input { max-width: 90px; }
  .sura-grid { grid-template-columns: 1fr; }
}

/* -------------------------------------------------------------------------
   Page "كُتّاب الظل" — récit du découpage oral (heritage.php)
------------------------------------------------------------------------- */
.scribes-intro {
  font-family: 'Lora', serif;
  font-size: 17px;
  line-height: 1.9;
  color: var(--texte);
  text-align: justify;
}
.scribes-intro .drop-cap {
  float: right;
  font-family: 'Cinzel', serif;
  color: var(--rouge);
  font-size: 74px;
  line-height: 0.8;
  padding: 6px 0 0 10px;
  font-weight: 700;
}
.scribes-explain {
  font-family: 'Lora', serif;
  font-size: 16.5px;
  line-height: 1.85;
  text-align: justify;
  color: var(--texte);
  margin-top: 6px;
}
.vocal-metric {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.vocal-metric-card {
  background: var(--rouge-fade);
  border: 1px solid var(--or);
  padding: 18px 12px;
  text-align: center;
}
.vocal-metric-number {
  font-family: 'Cinzel', serif;
  color: var(--rouge);
  font-size: 30px;
  font-weight: 700;
  display: block;
}
.vocal-metric-label {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b5a2a;
  display: block;
  margin-top: 6px;
}
.scribes-tribute {
  margin-top: 24px;
  padding: 16px 20px;
  border-right: 3px solid var(--rouge);
  background: rgba(212,175,55,0.08);
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 15.5px;
  color: #4a3c1a;
}
@media (max-width: 700px) {
  .scribes-intro .drop-cap { font-size: 54px; }
  .vocal-metric { grid-template-columns: 1fr; }
}

/* -------------------------------------------------------------------------
   Page "ديوان الفروق" — tableau comparatif Hafs/Warsh (variantes.php)
------------------------------------------------------------------------- */
.diwan-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 4px 0 20px;
}
.diwan-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.diwan-tab {
  font-family: 'Cinzel', serif;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  padding: 8px 16px;
  border: 1px solid var(--or);
  background: transparent;
  color: var(--rouge);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.diwan-tab.active, .diwan-tab:hover {
  background: linear-gradient(180deg, var(--rouge), #5a0000);
  color: var(--or-clair);
}
.diwan-search-wrap { flex: 1; min-width: 200px; margin-inline-start: auto; }
.diwan-search {
  width: 100%;
  font-family: 'Lora', serif;
  font-size: 14px;
  padding: 9px 14px;
  border: 1px solid var(--or);
  background: #fff;
  color: var(--texte);
}
.diwan-search:focus { outline: 2px solid var(--rouge); outline-offset: 1px; }

.diwan-table-wrap { overflow-x: auto; }
.diwan-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Lora', serif;
  font-size: 15px;
  background: var(--parchemin);
  border: 1px solid var(--or);
}
.diwan-table thead th {
  background: linear-gradient(180deg, #8B0000, #5a0000);
  color: var(--or-clair);
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: 0.03em;
  padding: 12px 10px;
  border: 1px solid var(--or);
}
.diwan-table tbody td {
  padding: 12px 10px;
  border: 1px solid var(--or-fade);
  text-align: center;
  vertical-align: middle;
}
.diwan-table tbody tr:nth-child(odd) { background: rgba(212,175,55,0.06); }
.diwan-table tbody tr:hover { background: rgba(212,175,55,0.16); }
.diwan-ref { font-family: 'Cinzel', serif; color: var(--rouge); font-weight: 700; white-space: nowrap; }
.diwan-context { font-style: italic; color: #6b5a2a; font-size: 13.5px; }
.diwan-word { font-size: 20px; }
.diwan-word.hafs { color: var(--texte); }
.diwan-word.warsh { color: var(--rouge); font-weight: 600; }

.pill {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 4px 12px;
  border: 1px solid var(--or);
}
.pill-rasm { background: var(--rouge); color: var(--or-clair); }
.pill-tashkil { background: var(--or); color: #4a3c1a; }

.diwan-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Cinzel', serif;
  font-size: 12px;
  color: var(--or-clair);
  background: linear-gradient(180deg, var(--rouge), #5a0000);
  border: 1px solid var(--or);
  padding: 7px 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.diwan-action:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 6px 14px rgba(139,0,0,0.3); }

.diwan-empty {
  text-align: center;
  font-family: 'Lora', serif;
  font-style: italic;
  color: #8a7a4a;
  padding: 24px;
  display: none;
}

@media (max-width: 700px) {
  .diwan-search-wrap { margin-inline-start: 0; flex: 1 1 100%; }
  .diwan-table { font-size: 13px; }
  .diwan-word { font-size: 17px; }
}

/* -------------------------------------------------------------------------
   Badges de lectures (qira'at) divergentes en bas de chaque verset
------------------------------------------------------------------------- */
.qiraat-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dotted var(--or-fade);
}
.qiraa-badge {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  background: var(--rouge-fade);
  color: var(--rouge);
  border: 1px solid var(--or);
  text-decoration: none;
  cursor: help;
  transition: background 0.15s, color 0.15s;
}
.qiraa-badge:hover {
  background: var(--rouge);
  color: var(--or-clair);
  text-decoration: none;
}

@media (max-width: 700px) {
  .qiraat-badges { gap: 4px; }
  .qiraa-badge { font-size: 10px; padding: 2px 8px; }
}

/* -------------------------------------------------------------------------
   Traduction française — affichage bilingue (sélecteur AR/FR de la nav-barre)
   Même thème impérial (parchemin/Lora), texte LTR, encre sépia distincte du
   noir du texte arabe (--texte) pour marquer visuellement que c'est une
   traduction, pas le texte source.
------------------------------------------------------------------------- */
.fr-line {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dotted var(--or-fade);
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 17px;
  line-height: 1.7;
  color: var(--texte-fr);
  text-align: left;
}

.tadabbur-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--texte-fr);
  color: var(--parchemin);
  font-family: 'Cinzel', serif;
  font-style: normal;
  font-size: 11px;
  text-decoration: none;
  cursor: help;
  vertical-align: middle;
}
.tadabbur-flag:hover { background: var(--rouge); color: var(--or-clair); }

/* Toggle "version poétique" dans la nav-barre */
.gr-poetic-toggle { padding: 0 4px; }
.gr-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--or-clair);
  font-family: 'Cinzel', serif;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.gr-toggle-label input[type="checkbox"] {
  accent-color: var(--or);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Ligne de traduction poétique alternative (alexandrins / pentamètre iambique) */
.poetic-line {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--or);
  background: rgba(212,175,55,0.07);
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 16px;
  line-height: 1.6;
  color: var(--texte-fr);
  text-align: left;
}
.poetic-label {
  display: block;
  font-family: 'Cinzel', serif;
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(216, 27, 27);
  margin-bottom: 3px;
}

/* -------------------------------------------------------------------------
   Études (etudes.php, etude_*.php) — dossiers de tadabbur thématique
------------------------------------------------------------------------- */
.etude-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.etude-card {
  position: relative;
  display: block;
  padding: 20px 16px;
  border: 1px solid var(--or);
  background: var(--rouge-fade);
  text-decoration: none;
  color: var(--texte);
  transition: background 0.2s, transform 0.15s;
}
.etude-card:hover { background: rgba(212,175,55,0.16); transform: translateY(-2px); }
.etude-card-num {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--rouge);
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.etude-card-title {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 700;
  color: #4a3c1a;
  display: block;
  margin-bottom: 6px;
  line-height: 1.3;
}
.etude-card-desc {
  font-family: 'Lora', serif;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--texte);
  display: block;
}
.etude-card-status {
  display: inline-block;
  margin-top: 10px;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid var(--or);
  color: #6b5a2a;
}
@media (max-width: 900px) {
  .etude-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .etude-grid { grid-template-columns: 1fr; }
}

.etude-body { font-family: 'Lora', serif; font-size: 16.5px; line-height: 1.9; color: var(--texte); text-align: justify; }
.etude-body h2 {
  font-family: 'Cinzel', serif;
  font-size: 21px;
  color: var(--rouge);
  margin: 38px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--or);
}
.etude-body h2 .etude-h2-num { color: #6b5a2a; margin-right: 8px; }
.etude-body h3 {
  font-family: 'Cinzel', serif;
  font-size: 15px;
  color: #6b5a2a;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 22px 0 10px;
}
.etude-body p { margin: 0 0 14px; }
.etude-verse {
  margin: 16px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--rouge);
  background: rgba(212,175,55,0.08);
}
.etude-verse-ar {
  display: block;
  font-family: 'Amiri', 'Traditional Arabic', serif;
  direction: rtl;
  font-size: 20px;
  color: #4a3c1a;
  margin-bottom: 6px;
  line-height: 1.8;
}
.etude-verse-fr {
  display: block;
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 15px;
  color: var(--texte);
}
.etude-verse-ref {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--rouge);
  margin-top: 6px;
}
.etude-caveat {
  margin: 22px 0;
  padding: 14px 18px;
  border: 1px dashed var(--or);
  background: rgba(255,255,255,0.5);
  font-family: 'Lora', serif;
  font-size: 14.5px;
  line-height: 1.7;
  color: #5a4a20;
}
.etude-caveat strong { color: var(--rouge); }
.etude-toc {
  margin: 24px 0;
  padding: 16px 20px;
  background: rgba(212,175,55,0.07);
  border: 1px solid var(--or);
}
.etude-toc-title {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b5a2a;
  display: block;
  margin-bottom: 8px;
}
.etude-toc a {
  display: block;
  font-family: 'Lora', serif;
  font-size: 14.5px;
  color: var(--texte);
  text-decoration: none;
  padding: 3px 0;
}
.etude-toc a:hover { color: var(--rouge); }
