/* Ebook Corp — couche de finition.
   Chargée après le bundle "edition" de chaque page : typographie commune,
   pied de page « pages de garde », cohérence des boutons, corrections ciblées. */

/* ---------- 1. Typographie ---------- */
@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/source-sans-3-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  size-adjust: 104%;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/source-sans-3-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
  size-adjust: 104%;
}

:root {
  --sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --fin-night: #171d31;
  --fin-night-2: #1f2845;
  --fin-paper: #f7f2e7;
  --fin-gilt: #c9a86a;
  --fin-accent: #273e7b;
  --fin-accent-strong: #1f3266;
  --fin-ease: cubic-bezier(.2, .75, .15, 1);
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-kerning: normal;
  font-optical-sizing: auto;
}

h1, h2, h3, h4 { text-wrap: balance; }
main p, main li, main figcaption, main blockquote { text-wrap: pretty; }

/* Chiffres alignés dans les tableaux et compteurs */
table, .collection-stats, [data-count] { font-variant-numeric: tabular-nums lining-nums; }

/* ---------- 2. Boutons : une seule famille ---------- */
.quiz-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 760px;
  margin: 36px auto;
  padding: 20px 22px 20px 26px;
  border: 1px solid #dce4ef;
  border-radius: 20px;
  background: #f5f7fb;
}
.quiz-cta p { margin: 0; color: #253651; font-weight: 600; }
@media (max-width: 800px) {
  .quiz-cta { margin-inline: var(--gutter, 24px); }
}

.quiz-cta a,
.quiz-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border: 0;
  border-radius: 14px;
  background: var(--fin-accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 24px -14px rgba(39, 62, 123, .9);
  transition: background-color .2s ease, transform .2s var(--fin-ease), box-shadow .2s ease;
}
.quiz-cta a:hover,
.quiz-cta a:focus-visible,
.quiz-submit:hover,
.quiz-submit:focus-visible {
  background: var(--fin-accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -14px rgba(39, 62, 123, 1);
}
.quiz-cta a:active,
.quiz-submit:active { transform: translateY(0); }
html.motion-off .quiz-cta a,
html.motion-off .quiz-submit { transition: none; transform: none; }

/* ---------- 3. Corrections ciblées ---------- */

/* Articles du journal : l'ancien retrait prévu pour un en-tête flottant laissait un vide. */
.reading-guide-header.section-wrap { padding-top: clamp(26px, 3.6vw, 52px); }

/* Paragraphe de liens posé hors section : il touchait le bord de l'écran. */
p.section-wrap.book-editorial-related {
  box-sizing: border-box;
  max-width: calc(72ch + 2 * var(--gutter, 24px));
  margin: clamp(24px, 4vw, 44px) 0;
  padding-inline: var(--gutter, 24px);
  color: #46526b;
  line-height: 1.7;
}

/* Bloc éditorial « ec-next-reading » : pleine largeur et sans marges sur certaines pages. */
.section-wrap.ec-next-reading {
  box-sizing: border-box;
  width: auto;
  max-width: min(1044px, calc(100% - 2 * var(--gutter, 24px)));
  margin: clamp(28px, 5vw, 64px) auto;
  padding: clamp(24px, 3.4vw, 44px);
  border: 1px solid #dce4ed;
  border-radius: 24px;
  background: linear-gradient(120deg, #f3f6fb, #fff 70%);
}
.section-wrap.ec-next-reading > .eyebrow { margin: 0 0 10px; }
.section-wrap.ec-next-reading > h2 {
  margin: 0 0 16px;
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
  line-height: 1.1;
}
.section-wrap.ec-next-reading > h3 {
  margin: 26px 0 0;
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(1.35rem, 2vw, 1.6rem);
  font-weight: 500;
  line-height: 1.2;
}
.section-wrap.ec-next-reading > p:not(.eyebrow) {
  max-width: 72ch;
  margin: 12px 0 0;
  color: #46526b;
  line-height: 1.7;
}

/* ---------- 4. Pied de page : les pages de garde ----------
   Le site se referme comme un livre relié : papier de garde bleu nuit,
   trame de points reprise du logo, et un ex-libris collé pour la marque. */
body > .footer.footer.section-wrap {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  box-sizing: border-box;
  width: auto;
  max-width: none;
  margin: clamp(40px, 6vw, 88px) var(--sc-inset, var(--gutter, 24px)) clamp(14px, 2vw, 28px);
  padding: clamp(28px, 4vw, 60px) clamp(22px, 4.2vw, 68px) 22px;
  border-radius: var(--sc-band-radius, 28px);
  background:
    radial-gradient(70% 90% at 100% 0%, rgba(59, 85, 160, .42), transparent 62%),
    linear-gradient(160deg, var(--fin-night-2), var(--fin-night) 58%);
  color: #dfe4f0;
}
/* Trame de points, plus dense vers le coin de l'ex-libris */
body > .footer.footer.section-wrap::before,
body > .footer.footer.section-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body > .footer.footer.section-wrap::before {
  background-image: radial-gradient(circle, rgba(214, 224, 247, .16) 1.15px, transparent 1.7px);
  background-size: 13px 13px;
  -webkit-mask-image: radial-gradient(75% 115% at 0% 100%, #000 0%, rgba(0, 0, 0, .35) 42%, transparent 72%);
          mask-image: radial-gradient(75% 115% at 0% 100%, #000 0%, rgba(0, 0, 0, .35) 42%, transparent 72%);
}
body > .footer.footer.section-wrap::after {
  inset: 10px;
  border: 1px solid rgba(201, 168, 106, .22);
  border-radius: calc(var(--sc-band-radius, 28px) - 10px);
}

.footer.footer .footer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(28px, 5vw, 80px);
}

/* L'ex-libris */
.footer.footer .footer-top > div:first-child {
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 232px;
  padding: 20px 20px 18px;
  border-radius: 5px;
  background: var(--fin-paper);
  color: #5b4c2a;
  text-align: center;
  box-shadow:
    inset 0 0 0 5px var(--fin-paper),
    inset 0 0 0 6px rgba(160, 128, 66, .55),
    0 22px 40px -22px rgba(0, 0, 0, .75);
  transform: rotate(-1.4deg);
}
.footer.footer .footer-top > div:first-child::before {
  content: "Ex-libris";
  font-family: var(--serif, Georgia, serif);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: .01em;
}
.footer.footer .footer-top > div:first-child::after {
  content: "Des livres, des voix, des horizons.";
  max-width: 17ch;
  font-family: var(--serif, Georgia, serif);
  font-size: 1.02rem;
  line-height: 1.25;
  color: #3c4664;
}
html[lang="en"] .footer.footer .footer-top > div:first-child::after {
  content: "Books, voices and new horizons.";
}
.footer.footer .footer-top .brand { display: block; line-height: 0; }
.footer.footer .footer-top .brand-logo {
  width: 168px;
  height: auto;
  mix-blend-mode: multiply; /* le fond blanc du logo se fond dans le papier */
}

/* Les colonnes de liens */
.footer.footer .footer-directory {
  display: flex;
  flex-wrap: wrap;
  gap: 30px clamp(36px, 5vw, 84px);
}
.footer.footer .footer-directory > div { display: flex; flex-direction: column; gap: 9px; }
.footer.footer .footer-directory h3 {
  margin: 0 0 12px;
  color: var(--fin-gilt);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.footer.footer .footer-directory a {
  width: fit-content;
  color: rgba(226, 232, 245, .8);
  font-size: .9rem;
  line-height: 1.35;
  text-decoration: underline transparent 1px;
  text-underline-offset: 4px;
  transition: color .18s ease, text-decoration-color .18s ease;
}
.footer.footer .footer-directory a:hover,
.footer.footer .footer-directory a:focus-visible {
  color: #fff;
  text-decoration-color: rgba(201, 168, 106, .9);
}

/* Le colophon */
.footer.footer .footer-bottom {
  margin-top: clamp(28px, 4vw, 48px);
  padding-top: 20px;
  border-top: 1px solid rgba(226, 232, 245, .14);
  color: rgba(226, 232, 245, .62);
}
.footer.footer .footer-bottom a,
.footer.footer .footer-bottom button { color: inherit; }
.footer.footer .footer-bottom a:hover,
.footer.footer .footer-bottom a:focus-visible,
.footer.footer .footer-bottom button:hover,
.footer.footer .footer-bottom button:focus-visible { color: #fff; }
.footer.footer :focus-visible {
  outline: 2px solid var(--fin-gilt);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (max-width: 900px) {
  .footer.footer .footer-top { flex-direction: column; align-items: stretch; gap: 34px; }
  .footer.footer .footer-top > div:first-child { justify-self: start; margin-left: 2px; }
  .footer.footer .footer-directory {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 30px 26px;
  }
}
@media (max-width: 640px) {
  body > .footer.footer.section-wrap { padding: 26px 22px 20px; }
  .footer.footer .footer-directory { grid-template-columns: 1fr 1fr; }
  .footer.footer .footer-directory > div:nth-child(2) { grid-column: 1 / -1; order: 3; }
  .footer.footer .footer-directory a { padding-block: 3px; font-size: .95rem; }
  /* réserve la place du bouton flottant « retour en haut » */
  .footer.footer .footer-bottom { gap: 12px 18px; padding-bottom: 46px; }
}

/* ---------- 5. Impression : pas d'aplat sombre ---------- */
@media print {
  body > .footer.footer.section-wrap {
    margin: 24px 0 0;
    padding: 16px 0 0;
    border-radius: 0;
    background: none;
    color: #20283f;
  }
  body > .footer.footer.section-wrap::before,
  body > .footer.footer.section-wrap::after { display: none; }
  .footer.footer .footer-top > div:first-child { box-shadow: none; transform: none; background: none; }
  .footer.footer .footer-directory a,
  .footer.footer .footer-directory h3,
  .footer.footer .footer-bottom { color: #20283f; }
}

/* ---------- 6. Page 404 ---------- */
.fin-404 .fin-404__folio {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 14px;
  color: #8a744a;
  font-family: var(--serif, Georgia, serif);
  font-style: italic;
  font-size: 1.45rem;
  line-height: 1;
}
.fin-404 .fin-404__folio::after {
  content: "";
  width: 54px;
  height: 1px;
  background: currentColor;
  opacity: .55;
}
.fin-404 .fin-404__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  margin: 28px 0 0;
}
.fin-404 .fin-404__en {
  margin: 26px 0 0;
  color: #586277;
  font-size: .95rem;
}
.fin-404 .fin-404__en a { color: #273e7b; text-underline-offset: 3px; }

.section-wrap.fin-404__rayons { margin-block: clamp(36px, 6vw, 72px); }
.fin-404__rayons h2 {
  margin: 0 0 22px;
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.1;
}
.fin-404__rayons ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.fin-404__rayons a {
  display: grid;
  gap: 4px;
  height: 100%;
  box-sizing: border-box;
  padding: 18px 20px;
  border: 1px solid #dfe5ed;
  border-radius: 16px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: border-color .18s ease, background-color .18s ease;
}
.fin-404__rayons a:hover,
.fin-404__rayons a:focus-visible { border-color: #9fb0d6; background: #f6f8fc; }
.fin-404__rayons strong {
  font-family: var(--serif, Georgia, serif);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.15;
  color: #20283f;
}
.fin-404__rayons span { color: #586277; font-size: .95rem; line-height: 1.45; }
