:root {
  --basalt: #1c1814;
  --lapis: #1b3a6b;
  --lapis-deep: #12264a;
  --gold: #c8a03a;
  --gold-light: #e6c971;
  --sand: #ead9b0;
  --papyrus: #f4e8c8;
  --turquoise: #2a8c82;
  --carnelian: #8e2f1c;
  --ink: #2a2219;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink);
  font: 1.15rem/1.65 'Alegreya', Georgia, serif;
  background: #5a3b12; /* couleur de secours si l'image ne charge pas */
}
/* Fond en pierre gravée : fixe, sans défiler, adapté à l'orientation de l'écran */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background: url('../img/bg-landscape.jpg') center / cover no-repeat;
}
@media (orientation: portrait) {
  body::before { background-image: url('../img/bg-portrait.jpg'); }
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--lapis); }
a:hover { color: var(--carnelian); }
:focus-visible { outline: 3px solid var(--turquoise); outline-offset: 2px; }

/* ---------- En-tête ---------- */
.site-header { background: var(--basalt); border-bottom: 4px solid var(--gold); padding: .4rem 1rem; }
.banner { display: block; max-width: 900px; margin: 0 auto; }
.banner img { width: 100%; max-height: 160px; object-fit: contain; margin: 0 auto; }
.banner-text { display: block; padding: 1.2rem 1rem; text-align: center; color: var(--gold-light);
  font: 700 1.6rem 'Cinzel', serif; }

/* ---------- Menu ---------- */
.main-nav { background: var(--lapis); border-bottom: 2px solid var(--gold); position: sticky; top: 0; z-index: 50; }
.nav-toggle { display: none; }
.nav-list { list-style: none; margin: 0 auto; padding: 0; max-width: 1200px; display: flex; flex-wrap: wrap; align-items: stretch; }
.nav-list > li { position: relative; }
.nav-list a, .sub-toggle {
  display: block; padding: .85rem 1.1rem; background: none; border: 0; cursor: pointer;
  font: 500 .92rem/1.2 'Cinzel', serif; color: var(--papyrus); text-decoration: none; letter-spacing: .03em;
}
.sub-toggle::after { content: ' \25BE'; color: var(--gold); }
.nav-list > li:hover > a, .nav-list > li:hover > .sub-toggle,
.nav-list > li.open > .sub-toggle, .nav-list > li.current > a, .nav-list > li.current > .sub-toggle {
  background: var(--lapis-deep); color: var(--gold-light);
}
.nav-list > li.current { box-shadow: inset 0 -3px 0 var(--gold); }
.sub-list {
  display: none; list-style: none; margin: 0; padding: 0; position: absolute; left: 0; top: 100%;
  min-width: 100%; width: max-content; z-index: 20;
  background: var(--lapis-deep); border: 2px solid var(--gold); border-top: 0;
}
.sub-list a { padding: .7rem 1.2rem; }
.sub-list a:hover, .sub-list a[aria-current] { background: var(--lapis); color: var(--gold-light); }
/* Ouverture : clic (classe .open), survol, ou navigation au clavier uniquement (:focus-visible).
   Pas de :focus-within : après un clic souris, le menu restait ouvert et un second s'ouvrait par-dessus au survol. */
.has-sub.open > .sub-list, .has-sub:has(:focus-visible) > .sub-list { display: block; }
@media (hover: hover) { .has-sub:hover > .sub-list { display: block; } }
/* Écran large : le dernier sous-menu (libellés longs) s'aligne à droite de son titre pour ne jamais dépasser de la fenêtre ;
   la classe .flip (posée par main.js) fait de même pour tout autre sous-menu qui déborderait. */
@media (min-width: 1001px) {
  .nav-list > li:last-child > .sub-list, .nav-list > li > .sub-list.flip { left: auto; right: 0; }
}
.nav-inner { max-width: 1200px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: stretch; }
.nav-inner .nav-list { flex: 1 1 auto; margin: 0; }
.lang-switch { margin-left: auto; display: flex; align-items: center; padding-right: .75rem; }
.lang-switch a { padding: .4rem .6rem; font: 500 .85rem 'Cinzel', serif; color: var(--papyrus); text-decoration: none; letter-spacing: .03em; }
.lang-switch a:hover { color: var(--gold-light); }
.lang-switch a.on { color: var(--gold-light); box-shadow: inset 0 -2px 0 var(--gold); }

/* ---------- Contenu ---------- */
.page { max-width: 1100px; margin: 2rem auto; padding: 2rem 1.5rem 2.5rem; background: rgba(244,232,200,.85);
  border: 2px solid var(--gold); outline: 6px solid var(--sand); outline-offset: -12px; box-shadow: 0 6px 0 rgba(28,24,20,.25); }
h1, h2, h3 { font-family: 'Cinzel', serif; color: var(--lapis-deep); line-height: 1.25; }
h1 { font-size: 1.9rem; margin: 0 0 1.5rem; padding-bottom: .7rem; border-bottom: 3px double var(--gold); }
h1 small { display: block; font-size: .95rem; font-weight: 500; color: var(--carnelian); margin-bottom: .2rem; }
h2 { font-size: 1.35rem; margin: 0 0 .8rem; }
h3 { font-size: 1.1rem; margin: 1.2rem 0 .3rem; }
.block-text h3 + p { margin-top: 0; }
.block { margin: 0 0 2rem; }
.block-text { max-width: 70ch; }
.block:not(.has-media) .block-text { margin-left: auto; margin-right: auto; }
.block-text p, .block-text ul { margin: 0 0 1rem; }
.block-text li { margin-bottom: .6rem; }
.block-text blockquote { margin: 1rem 1.2rem; padding: .2rem 1rem; border-left: 4px solid var(--gold); font-style: italic; }
/* Texte justifié avec césures automatiques (la langue vient de <html lang>) ; titres centrés */
.block-text p, .block-text li, .cards-foot { text-align: justify; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
h1, h2, h3, .cards-sub { text-align: center; }
.has-media { display: flex; gap: 2rem; align-items: flex-start; }
.has-media .block-text { flex: 1 1 55%; }
.block-media { flex: 0 1 38%; margin: 0; display: flex; flex-direction: column; gap: .6rem;
  border: 3px solid var(--gold); padding: 4px; background: var(--sand); }
.block-media img, .sheet img { image-rendering: pixelated; width: 100%; }
.media-left { flex-direction: row-reverse; }
.coming-soon { display: inline-block; padding: .6rem 1.4rem; border: 2px dashed var(--carnelian);
  color: var(--carnelian); font: 500 1.1rem 'Cinzel', serif; }

/* ---------- Tableaux de données, planches ---------- */
.data-table { width: 100%; border-collapse: collapse; margin: 0 0 2rem; background: #fffaf0; border: 2px solid var(--gold); }
.data-table th { background: var(--lapis); color: var(--gold-light); text-align: left; padding: .7rem 1rem;
  font: 500 .9rem 'Cinzel', serif; letter-spacing: .05em; border-bottom: 3px solid var(--gold); }
.data-table td { padding: .6rem 1rem; border-bottom: 1px solid rgba(142,47,28,.2); }
.data-table tbody tr:nth-child(even) { background: rgba(200,160,58,.14); }
.data-table .fmt { margin-left: .4rem; font-size: .85rem; color: #6b5a40; }
.sheets { display: grid; gap: 1.5rem; margin-top: 1rem; }
.sheet { margin: 0; text-align: center; }
.sheet figcaption { font: 500 1rem 'Cinzel', serif; color: var(--lapis-deep); margin-bottom: .5rem; }
.sheet img { width: auto; max-width: 100%; margin: 0 auto; border: 3px solid var(--gold); padding: 4px; background: var(--sand); }

/* ---------- Pied de page ---------- */
/* Pied de page général : bandeau sombre lisible, bordure dorée */
.site-footer { margin-top: 2.5rem; padding: 1.1rem 1rem 1.3rem; text-align: center;
  background: rgba(28,24,20,.94); border-top: 3px solid var(--gold); box-shadow: 0 -4px 0 rgba(200,160,58,.25);
  color: var(--papyrus); font: 500 .9rem/1.6 'Cinzel', serif; letter-spacing: .03em; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--gold-light); text-decoration: none; border-bottom: 1px solid rgba(230,201,113,.5); }
.site-footer a:hover, .site-footer a:focus-visible { color: #fff; border-bottom-color: #fff; }
.site-footer .sep { margin: 0 .7rem; color: var(--gold); }

/* ---------- Paysage : colonne de contenu plus étroite et plus compacte ---------- */
@media (orientation: landscape) {
  body { font-size: 1.02rem; line-height: 1.55; }
  .site-header { padding: .25rem 1rem; }
  .banner img { max-height: 110px; }
  .page { max-width: 700px; margin: 1rem auto; padding: 1.3rem 1.5rem 1.5rem; }
  h1 { font-size: 1.55rem; margin-bottom: 1rem; padding-bottom: .5rem; }
  h2 { font-size: 1.2rem; }
  h3 { font-size: 1rem; margin-top: .9rem; }
  .block { margin-bottom: 1.3rem; }
  .has-media { gap: 1.4rem; }
  .block-media { flex-basis: 34%; }
  .block-text p, .block-text ul { margin-bottom: .75rem; }
  .block-text li { margin-bottom: .4rem; }
}
/* Écrans paysage peu hauts (téléphones) */
@media (orientation: landscape) and (max-height: 520px) {
  body { font-size: .98rem; }
  .banner img { max-height: 64px; }
  .page { margin: .6rem auto; }
}

/* ---------- Mobile portrait : images sous le texte, menu burger ---------- */
@media (max-width: 800px) and (orientation: portrait) {
  .has-media, .media-left { flex-direction: column; }
  .block-media { width: 100%; }
}
@media (max-width: 800px) {
  /* marges automatiques : sinon la boîte se colle à gauche quand max-width la rend plus étroite que l'écran */
  .page { margin: 1rem auto; width: calc(100% - 1rem); padding: 1.2rem 1rem; }
  .data-table { font-size: .85rem; }
  .data-table th, .data-table td { padding: .4rem .5rem; }
}
/* Menu replié derrière le bouton hamburger quand l'écran est trop étroit pour l'afficher en entier */
@media (max-width: 1000px) {
  .nav-inner { align-items: center; }
  .nav-toggle { display: flex; align-items: center; justify-content: center; order: 1; flex: 0 0 auto;
    width: 3rem; height: 3rem; margin: .3rem .5rem; padding: 0; background: none; border: 2px solid var(--gold);
    color: var(--gold-light); font-size: 1.6rem; line-height: 1; cursor: pointer; }
  .main-nav.open .nav-toggle { background: var(--lapis-deep); }
  .lang-switch { order: 2; margin-left: auto; padding-right: .5rem; }
  .lang-switch a { padding: .6rem .7rem; font-size: .95rem; }
  .nav-inner .nav-list { order: 3; flex: 1 1 100%; display: none; flex-direction: column; margin: 0;
    background: var(--lapis-deep); border-top: 2px solid var(--gold);
    max-height: calc(100vh - 4.5rem); max-height: calc(100dvh - 4.5rem); overflow-y: auto; }
  .main-nav.open .nav-list { display: flex; }
  .nav-list > li { border-bottom: 1px solid rgba(200,160,58,.25); }
  .nav-list > li > a, .nav-list > li > .sub-toggle { width: 100%; display: flex; justify-content: space-between;
    align-items: center; min-height: 3rem; padding: .8rem 1.2rem; text-align: left; font-size: 1rem; }
  .sub-toggle::after { content: '\25BE'; transition: transform .2s; }
  .nav-list > li.open > .sub-toggle::after { transform: rotate(180deg); }
  .nav-list > li.current { box-shadow: inset 4px 0 0 var(--gold); }
  /* Sous-menus : accordéon, uniquement piloté par le clic (pas par le survol) */
  .main-nav .nav-list .has-sub > .sub-list { position: static; display: none; width: auto; min-width: 0;
    border: 0; background: rgba(0,0,0,.25); }
  .main-nav .nav-list .has-sub.open > .sub-list { display: block; }
  .sub-list a { display: flex; align-items: center; min-height: 2.8rem; padding: .7rem 1.2rem .7rem 2.2rem;
    border-top: 1px solid rgba(200,160,58,.15); }
  .sub-list a[aria-current] { box-shadow: inset 4px 0 0 var(--gold); }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
