/* ============================================================================
   lameute · SOCLE PDF UNIFIÉ  (décision 13/06 — chantier dédié)
   ----------------------------------------------------------------------------
   Le squelette commun à TOUS nos documents imprimables : fiche RDV, playbook,
   lead magnets, et les futurs rapports hebdo (emails PDF).

   Ce que le socle porte :
     · page A4 LITTÉRALE (210mm × 297mm, flex-shrink:0)
     · @page A4 margin 0 + print-color-adjust (les aplats ink/cream sortent)
     · le surround écran (fond sunken, gouttière, ombre douce, radius) qui
       DISPARAÎT à l'impression (chrome masqué, ombres coupées, page-break)
     · le footer mono paginé
     · la couverture / clôture ink centrée (motif maison)
     · la barre d'impression écran (.pdf-bar) masquée au print

   Ce que CHAQUE document ajoute par-dessus :
     · son fond de page (blanc, cream…) et sa forme (typo, blocs, couleurs).

   Chargement : APRÈS styles.css (DS) et lm-polish.css, pour hériter des tokens.
   Conventions de classes : préfixe .pdf-  (jamais de collision avec l'app).
   ========================================================================== */

:root {
  --pdf-pw: 210mm;            /* largeur page A4 */
  --pdf-ph: 297mm;            /* hauteur page A4 */
  --pdf-gap: 22px;            /* gouttière entre pages (écran) */
  --pdf-surround: var(--surface-sunken, #F4F2EC);   /* fond derrière les pages */
  --pdf-page-bg: #FAF8F1;     /* fond de page standard : crème lameute (branding) */
  --pdf-radius: 6px;          /* coins de page (écran seulement) */
  --pdf-shadow: 0 10px 40px rgba(11, 11, 10, 0.10), 0 1px 3px rgba(11, 11, 10, 0.06);
}

/* --- Conteneur défilant : centre la pile de pages, l'aère ------------------ */
.pdf-surface {
  margin: 0;
  min-height: 100%;
  background: var(--pdf-surround);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  font-family: var(--font-sans);
  color: var(--text-primary);
}
.pdf-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--pdf-gap);
  padding: 28px 16px 60px;
}

/* --- La page A4 ------------------------------------------------------------ */
.pdf-page {
  width: var(--pdf-pw);
  max-width: 100%;
  flex-shrink: 0;
  background: var(--pdf-page-bg);
  border-radius: var(--pdf-radius);
  box-shadow: var(--pdf-shadow);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
/* Page à hauteur VERROUILLÉE (couverture, fiche, clôture : 1 page = 1 feuille). */
.pdf-page--fixed { height: var(--pdf-ph); }
/* Page à hauteur LIBRE qui épouse son contenu sans descendre sous l'A4
   (sections de playbook : un livre, pas une présentation). */
.pdf-page--flow { min-height: var(--pdf-ph); }

/* Marge interne standard. Les docs peuvent la surcharger (cover plus large…). */
.pdf-pad {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24mm 22mm;
  box-sizing: border-box;
}

/* --- Footer mono paginé ---------------------------------------------------- */
.pdf-foot {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.pdf-foot--onink { color: var(--n-500); border-top: 1px solid rgba(255, 255, 255, 0.14); }

/* --- Couverture / clôture ink (motif maison) ------------------------------- */
.pdf-cover {
  --pdf-page-bg: var(--n-950);
  color: #fff;
  border: none;
}
.pdf-cover .pdf-pad { padding: 28mm 26mm; }
/* Les titres héritent mal sur fond ink (le DS pose une couleur ink directe) :
   on force le blanc sur toute couverture/clôture ink, une fois pour toutes. */
.pdf-cover h1, .pdf-cover h2, .pdf-cover h3 { color: #fff; }
.pdf-cover__eyebrow {
  display: inline-flex; align-items: center; gap: 14px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--n-500);
  white-space: nowrap;
}
.pdf-cover__foot {
  margin-top: auto; padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11px; color: var(--n-500);
}

/* La touche « n » du logo (keycap crème) — réutilisée sur les couvertures. */
.pdf-keyn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; box-sizing: border-box;
  border-radius: 8px; background: #FAF8F1; border: 1px solid #D9D3C4;
  box-shadow: 0 2px 0 #D9D3C4;
  font-family: var(--font-mono); font-size: 14px; color: #161513; line-height: 1;
  user-select: none;
}

/* --- Barre d'impression (écran seulement) ---------------------------------- */
.pdf-bar {
  position: fixed; top: 16px; right: 16px; z-index: 50;
  display: flex; gap: 8px;
}
.pdf-bar button {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-md, 10px);
  border: 1px solid var(--border-strong); background: var(--surface-card);
  color: var(--text-primary); font-family: var(--font-sans);
  font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-md);
  transition: background 140ms var(--ease-standard, cubic-bezier(0.2,0,0,1));
}
.pdf-bar button:hover { background: var(--surface-hover); }

/* --- IMPRESSION : on retire tout le chrome, une page = une feuille --------- */
@page { size: A4; margin: 0; }

@media print {
  .pdf-surface { background: #fff; }
  .pdf-stack { gap: 0; padding: 0; }
  .pdf-page {
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    break-after: page;
    page-break-after: always;
  }
  .pdf-page:last-child { break-after: auto; page-break-after: auto; }
  .pdf-bar { display: none !important; }
  /* Tout aplat de couleur (cover ink, encadrés) doit sortir à l'impression. */
  .pdf-surface, .pdf-page { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
