/* =========================================================
   Le contrat de travail – Tome I – Formation du contrat (2019)
   Jean-Luc PUTZ
   Feuille de style pour sortie Pandoc --to=chunkedhtml
   ========================================================= */

/* ---------- Variables générales ---------- */

:root {
  --page-bg: #f3f3f1;
  --paper-bg: #ffffff;
  --text: #222222;
  --muted: #666666;
  --line: #d7d7d2;
  --line-strong: #9b9b94;
  --link: #314b63;
  --soft-bg: #f7f7f5;
  --citation-bg: #f5f5f2;
  --renvoi-bg: #fafaf8;

  --content-width: 68rem;
  --reading-width: 58rem;
}


/* ---------- Base ---------- */

html {
  background: var(--page-bg);
  color: var(--text);
  font-size: 17px;
  scroll-behavior: smooth;
}

body {
  box-sizing: border-box;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2.4rem 3.4rem 3rem;
  background: var(--paper-bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1rem;
  line-height: 1.62;
  hyphens: auto;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

*, *::before, *::after {
  box-sizing: border-box;
}

p {
  margin: 0.8rem 0;
}

a {
  color: var(--link);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.14em;
}

a:visited {
  color: var(--link);
}

a:hover,
a:focus {
  text-decoration-thickness: 0.11em;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}


/* ---------- Header visible du livre ---------- */

.book-header {
  margin: 0 0 2.4rem;
  padding: 0 0 1.25rem;
  border-bottom: 1px solid var(--line-strong);
  text-align: left;
}

.book-header-author {
  margin-bottom: 0.28rem;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.book-header-title {
  max-width: 50rem;
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.35;
}


/* ---------- Navigation entre les fichiers chunkedhtml ---------- */

#sitenav {
  margin: 0 0 1.8rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  line-height: 1.4;
}

#sitenav .sitenav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.7rem 1.25rem;
}

#sitenav .navlink {
  flex: 1 1 15rem;
}

#sitenav .navlink:last-child {
  text-align: right;
}

#sitenav .navlink-label {
  display: inline-block;
  min-width: 4em;
  color: var(--muted);
  font-weight: 600;
}

#sitenav a {
  text-decoration: none;
}

#sitenav a:hover,
#sitenav a:focus {
  text-decoration: underline;
}


/* ---------- Titres ---------- */

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: 600;
  line-height: 1.25;
  break-after: avoid;
  page-break-after: avoid;
  scroll-margin-top: 1rem;
}

h1 {
  margin: 2.2rem 0 1.25rem;
  font-size: 2rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.45rem;
}

h2 {
  margin: 2.2rem 0 1rem;
  font-size: 1.55rem;
}

h3 {
  margin: 1.8rem 0 0.8rem;
  font-size: 1.25rem;
}

h4 {
  margin: 1.5rem 0 0.65rem;
  font-size: 1.08rem;
}

h5 {
  margin: 1.3rem 0 0.55rem;
  font-size: 1rem;
  font-style: italic;
}

h6 {
  margin: 1.2rem 0 0.5rem;
  font-size: 1rem;
  font-style: italic;
  font-weight: 400;
}


/* ---------- Table des matières Pandoc ---------- */

#TOC {
  margin: 1.8rem 0 2.7rem;
  padding: 1.15rem 1.35rem;
  border: 1px solid var(--line);
  background: var(--soft-bg);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.92rem;
  line-height: 1.42;
}

#TOC::before {
  display: block;
  margin-bottom: 0.8rem;
  content: "Table des matières";
  font-size: 1.05rem;
  font-weight: 700;
}

#TOC ul {
  margin: 0.3rem 0;
  padding-left: 1.25rem;
}

#TOC > ul {
  padding-left: 0;
}

#TOC li {
  margin: 0.22rem 0;
  list-style: none;
}

#TOC a {
  text-decoration: none;
}

#TOC a:hover,
#TOC a:focus {
  text-decoration: underline;
}


/* ---------- Listes ---------- */

ol,
ul {
  margin: 0.8rem 0;
  padding-left: 1.8rem;
}

li {
  margin: 0.22rem 0;
}

li > ol,
li > ul {
  margin-top: 0.2rem;
}


/* ---------- Citations générales ---------- */

blockquote {
  margin: 1.2rem 1.6rem;
  padding: 0.15rem 0 0.15rem 1rem;
  border-left: 3px solid var(--line-strong);
  color: #444444;
  font-style: italic;
}

blockquote p:first-child {
  margin-top: 0;
}

blockquote p:last-child {
  margin-bottom: 0;
}


/* ---------- Styles Word spécifiques au livre ---------- */

/* Citations du Code du travail */
[data-custom-style="aa_citation_CT"] {
  margin: 1.15rem 1.4rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--line-strong);
  background: var(--citation-bg);
  font-size: 0.94rem;
  line-height: 1.5;
}

[data-custom-style="aa_citation_CT"] p {
  margin: 0.3rem 0;
}

/* Renvois vers d'autres passages */
[data-custom-style="aa_renvoi"] {
  margin: 1rem 1.4rem;
  padding: 0.65rem 0.9rem;
  border-left: 2px solid var(--line);
  background: var(--renvoi-bg);
  font-size: 0.92rem;
}

[data-custom-style="aa_renvoi"] p {
  margin: 0.25rem 0;
}

/* Texte de tableaux */
[data-custom-style="aa_tableau"] {
  font-size: 0.91rem;
  line-height: 1.4;
}

[data-custom-style="aa_tableau"] p {
  margin: 0.15rem 0;
}

/* Bibliographie */
[data-custom-style="dev_pbib"] {
  margin: 0.24rem 0;
  padding-left: 1.35rem;
  text-indent: -1.35rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

[data-custom-style="inter_biblio"] {
  margin-top: 1.3rem;
  margin-bottom: 0.45rem;
  font-weight: 700;
}

/* Style Word "Quote" */
[data-custom-style="Quote"] {
  margin: 1.2rem 1.6rem;
  padding-left: 1rem;
  border-left: 3px solid var(--line);
  color: #444444;
  font-style: italic;
}

/* Paragraphe indenté */
[data-custom-style="Body Text Indent"] {
  margin-left: 1.5rem;
}

/* Paragraphes Normal (Web) */
[data-custom-style="Normal (Web)"] {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

/* Styles de caractères */
[data-custom-style="Light_ital"],
[data-custom-style="Emphasis"] {
  font-style: italic;
}

[data-custom-style="Strong"],
[data-custom-style="Gras"] {
  font-weight: 700;
}

[data-custom-style="Exposant"] {
  position: relative;
  top: -0.35em;
  font-size: 0.74em;
  line-height: 0;
}

/* Styles hérités éventuellement présents dans d'autres tomes */
[data-custom-style="Excurs"] {
  margin: 1.25rem 1.4rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  background: var(--soft-bg);
}

[data-custom-style="Exemple"],
[data-custom-style="aaexemple"],
[data-custom-style="aa_exemple"] {
  margin: 1.25rem 1.4rem;
  padding: 0.8rem 1rem;
  border-left: 3px solid var(--line-strong);
  background: var(--soft-bg);
}

[data-custom-style="Randnummer"],
[data-custom-style="RandNummer"] {
  font-weight: 700;
}


/* ---------- Tableaux ---------- */

table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  border-spacing: 0;
  display: block;
  overflow-x: auto;
  font-size: 0.92rem;
  line-height: 1.4;
  font-variant-numeric: lining-nums tabular-nums;
}

table caption {
  margin-bottom: 0.65rem;
  font-weight: 600;
  text-align: left;
}

thead,
tbody,
tfoot {
  width: 100%;
}

th,
td {
  min-width: 4rem;
  padding: 0.48rem 0.58rem;
  border: 1px solid var(--line-strong);
  vertical-align: top;
  text-align: left;
}

th {
  background: var(--soft-bg);
  font-weight: 700;
}

td p,
th p {
  margin: 0.2rem 0;
}


/* ---------- Notes de bas de page ---------- */

.footnotes {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-strong);
  font-size: 0.84rem;
  line-height: 1.45;
}

.footnotes::before {
  display: block;
  margin-bottom: 0.7rem;
  content: "Notes";
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
}

.footnotes hr {
  display: none;
}

.footnotes ol {
  padding-left: 1.65rem;
}

.footnotes li {
  margin-bottom: 0.55rem;
}

.footnotes p {
  margin: 0.25rem 0;
}

.footnote-ref {
  font-size: 0.78em;
  vertical-align: super;
  line-height: 0;
  text-decoration: none;
}

.footnote-back {
  margin-left: 0.18rem;
  text-decoration: none;
}


/* ---------- Liens, ancres et références ---------- */

a[id],
span[id],
section[id] {
  scroll-margin-top: 1rem;
}

sup {
  line-height: 0;
}


/* ---------- Code éventuel ---------- */

code,
pre {
  font-family: Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

code {
  font-size: 0.88em;
}

pre {
  overflow-x: auto;
  padding: 0.8rem 1rem;
  background: var(--soft-bg);
  font-size: 0.88rem;
  line-height: 1.45;
}


/* ---------- Figures ---------- */

figure {
  margin: 1.6rem auto;
  text-align: center;
}

figcaption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}


/* ---------- Footer visible ---------- */

.book-footer {
  margin-top: 3.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: left;
}

.book-footer-contact {
  margin-top: 0.15rem;
}

.book-footer a {
  color: inherit;
}


/* ---------- Accessibilité ---------- */

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}


/* ---------- Écrans moyens ---------- */

@media (max-width: 900px) {
  html {
    background: var(--paper-bg);
  }

  body {
    max-width: none;
    padding: 1.8rem 2rem 2.5rem;
  }
}


/* ---------- Smartphone ---------- */

@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  body {
    padding: 1.1rem 1rem 2rem;
    line-height: 1.55;
    hyphens: none;
  }

  p {
    text-align: left;
  }

  .book-header {
    margin-bottom: 1.6rem;
    padding-bottom: 0.9rem;
  }

  .book-header-author {
    font-size: 0.75rem;
  }

  .book-header-title {
    font-size: 1rem;
  }

  #sitenav {
    margin-bottom: 1.35rem;
  }

  #sitenav .sitenav {
    display: block;
  }

  #sitenav .navlink {
    display: block;
    margin: 0.32rem 0;
    text-align: left !important;
  }

  h1 {
    margin-top: 1.6rem;
    font-size: 1.65rem;
  }

  h2 {
    margin-top: 1.55rem;
    font-size: 1.35rem;
  }

  h3 {
    font-size: 1.16rem;
  }

  h4 {
    font-size: 1.02rem;
  }

  #TOC {
    margin: 1.3rem 0 2rem;
    padding: 0.9rem 0.85rem;
    font-size: 0.88rem;
  }

  #TOC ul {
    padding-left: 0.9rem;
  }

  blockquote,
  [data-custom-style="aa_citation_CT"],
  [data-custom-style="aa_renvoi"],
  [data-custom-style="Quote"],
  [data-custom-style="Excurs"],
  [data-custom-style="Exemple"],
  [data-custom-style="aaexemple"],
  [data-custom-style="aa_exemple"] {
    margin-left: 0;
    margin-right: 0;
  }

  [data-custom-style="Body Text Indent"] {
    margin-left: 0.8rem;
  }

  table {
    font-size: 0.84rem;
  }

  th,
  td {
    padding: 0.38rem 0.42rem;
  }

  .footnotes {
    margin-top: 2.2rem;
    font-size: 0.8rem;
  }
}


/* ---------- Impression ---------- */

@media print {
  html,
  body {
    background: #ffffff;
  }

  body {
    max-width: none;
    margin: 0;
    padding: 0;
    color: #000000;
    font-size: 11pt;
    line-height: 1.45;
  }

  #sitenav {
    display: none;
  }

  .book-header {
    margin-bottom: 1.5rem;
  }

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

  h1,
  h2,
  h3,
  h4 {
    break-after: avoid-page;
    page-break-after: avoid;
  }

  p,
  li,
  blockquote,
  table {
    orphans: 3;
    widows: 3;
  }

  table {
    display: table;
  }

  .book-footer {
    margin-top: 2rem;
  }
}
