@import url("inc/vars.css");
@import url("inc/fonts.css");

/* PRINT PROPERTIES */
/* ================ */

@page {
  size: A4;
  margin: 30mm 30mm 15mm 30mm;

  @top-left {
    content: string(title);
    color: var(--color-grey-medium);
    font-family: var(--font-ui);
    font-size: 0.8em;
  }
}

@page:blank {
  @top-left { 
    content: none; 
  }
}

.cover {
  page: coverLayout;
}

@page coverLayout {
  margin: 0;

  @top-left { 
    content: none; 
  }
}

.front, .souspartie {
  page: frontLayout;
}

@page frontLayout {
  margin: 15mm 30mm 15mm 30mm;

  @top-left { 
    content: none; 
  }
}

.main {
  page: mainLayout;
}

.main.article {
  break-after: page;
}

@page mainLayout:first {
  margin: 15mm 30mm 15mm 30mm;

  @top-left { 
    content: none; 
  }
}

.sommaire {
  break-before: page;
  break-after: page;
  page: sommaireLayout;
}

@page sommaireLayout {
  @top-left { 
    content: none; 
  }
}

.titrecourant {
  string-set: title content(text);
}

/* Style du numéro de page (masqué par défaut) */
@page {
  @bottom-center {
    color: var(--color-grey-dark);
    font-size: .9rem;
  }
}

@page:first {
  @bottom-center {
    content: none;
  }
}

.main {
  counter-reset: page 1;
}

/* STANDARD ELEMENTS */
/* ================= */

html, body {
  color: #000;
  background: none;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.3;
}

* {
  orphans: 2;
  widows: 2;
}

a, a:visited {
  color: var(--color-grey-dark);
  text-decoration: underline;
}

a.url-visible {
  word-break: break-all;
}

a.url-hidden:after {
  content: " (" attr(href) ")";
  font-size: 0.8em;
  text-decoration: none;
  word-break: break-all;
}

h1, h2, h3, h4, h5, h6 {
  text-align: left;
}

h1, h2, h3, h4, h5, h6, .section-header, .section-header--small {
  line-height: 125%;
  break-after: avoid;
  break-inside: avoid;
}

h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
  text-decoration: none;
}

p {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
  max-height: calc((var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom)) * .5) !important;
}

tr, td, img {
  break-inside: avoid;
}

sup, sub, .footnotecall, .FootnoteSymbol, .endnotecall, .EndnoteSymbol {
  line-height: 0;
}

.hidden {
  display: none;
}

.section-header, .section-header--small {
  break-after: avoid;
  font-weight: bold;
  font-family: var(--font-ui);
}

.section-header {
  font-size: 1.3rem;
  margin: 3rem 0 1rem 0;
  border-bottom: 1px solid var(--color-grey-dark);
  text-transform: uppercase;
  font-weight: normal;
}

.section-header--small {
  font-size: 1rem;
  margin: 1rem 0 .1rem 0;
}

/* HELPERS */
/* ======= */

.flex {
  display: flex;
}

.col {
  flex: 1;
}

* + .col {
  margin-left: 1rem;
}

/* Commented to keep a consistant behavior accross browsers */
/* .hyphenate {
  hyphens: auto;
  -ms-hyphens: auto;
  -moz-hyphens: auto;
  -webkit-hyphens: auto;
} */

.br {
  display: block;
  text-align-last: left;
  break-inside: avoid;
}

/* ARTICLE FRONT AND HEADER */
/* ======================== */

.front {
  break-after: page;
}

.site__logo {
  max-width: 300px;
  max-height: 150px;
}

.site__title {
  font-weight: bold;
  font-size: 1.3rem;
}

.issue {
  margin-top: 1rem;
  font-weight: bold;
}

.article__header {
  margin-top: 3rem;
}

.front .article__header {
  border-top: 1px solid var(--color-grey-dark);
  border-bottom: 1px solid var(--color-grey-dark);
  padding: .5rem 0;
}

.article__number {
  font-size: 1.3rem;
}

.article__subhead {
  font-family: var(--font-text);
  line-height: 125%;
}

.main-title {
  margin: .5rem 0;
  font-size: 1.7rem;
  font-family: var(--font-text);
  line-height: 120%;
  font-weight: normal;
}

.main-subtitle {
  font-family: var(--font-text);
  line-height: 120%;
  font-size: 1.3rem;
  margin: .5rem 0;
}

.main-altertitle {
  font-family: var(--font-text);
  line-height: 125%;
  font-style: italic;
  color: var(--color-grey-medium);
}

.main-altertitle em, .main-altertitle i {
  font-style: normal;
}

.article__author, .publi__director {
  margin: 1rem 0;
  font-weight: bold;
  font-size: 1.05rem;
}

.article__translator {
  margin: 1rem 0;
}

.url {
  margin: 1rem 0;
  text-decoration: underline;
}

.url::before {
  content: url(../icons/link-alt.svg);
  margin-right: 5px;
  display: inline-block;
  transform: scale(0.9) translate(0, 6px);
}

.url a::after {
  content: none !important;
}

.plateforme__logo {
  height: 100px;
  margin-top: 2rem;
}

/* ABSTRACTS AND KEYWORDS */
/* ====================== */

.article__abstract-text {
  text-align: justify;
  font-family: var(--font-text);
}

.entry {
  font-family: var(--font-text);
}

/* TOC */
/* === */

.article__toc-contents {
  font-family: var(--font-text);
}

.article__toc-contents ul {
  list-style: none;
  padding-left: 1rem;
}

.article__toc-contents > ul {
  padding-left: 0;
}

.toc__link {
  text-decoration: none;
  color: var(--color-grey-dark);
}


/* ARTICLE MAIN CONTENTS */
/* ===================== */

.article__text-contents {
  display: block;
  line-height: 150%;
  font-family: var(--font-text);
  margin-top: 2rem;
  font-size: 1rem;
}

/* Numérotation des paragraphes */
.article__text-contents {
  counter-reset: p; /* Set the p counter to 0 */
  position: relative;
}

.article__text-contents > :not(table):not(ul):not(ol):not(.groupe-illustration):not(.titreillustration):not(.imageillustration):not(.legendeillustration):not(.creditillustration) {
  position: relative;
  padding-left: 3rem;
  margin-top: .7rem;
}

.article__text-contents > p.texte {
  counter-increment: p; /* Increment the p counter */
}

.article__text-contents > p.texte:before {
  content: counter(p); /* Display the counter */
  position: absolute;
  left: 0;
  font-size: .8em;
  color: var(--color-grey-medium);
  font-family: var(--font-ui);
}

.article__text-contents > ul.texte, .article__text-contents > ol.texte {
  position: relative;
  margin-top: .7rem;
  padding-left: 5rem;
}

/* Justification */
p.remerciements, p.texte, p.paragraphesansretrait, p.epigraphe, p.question, p.reponse, p.encadre, p.annexe, p.notesbaspage, p.notefin {
  text-align: justify;
}

h1.texte, h2.texte, h3.texte, h4.texte, h5.texte, h6.texte {
  margin-top: 3rem;
}

h1.texte {
  font-size: 2rem;
}

h2.texte {
  font-size: 1.7rem;
}

h3.texte {
  font-size: 1.5rem;
}

h4.texte {
  font-size: 1.3rem;
}

h5.texte {
  font-size: 1.2rem;
}

h6.texte {
  font-size: 1.1rem;
}

.accroche {
  max-width: 300px;
}

.article .accroche {
  float: left;
  clear: left;
  margin: 0 1rem 1rem -4rem;
}

.article__chapo, .chapo {
  font-weight: bold;
}

.remerciements {
  font-size: .9rem;
  line-height: 150%;
  font-style: italic;
}

.epigraphe {
  width: 50%;
  margin: 2rem 0 2rem auto;
  break-after: avoid;
  text-align: left;
  hyphens: none;
  -ms-hyphens: none;
  -moz-hyphens: none;
  -webkit-hyphens: none;
}

ul.texte, ol.texte {
  font-size: .9em;
  padding-left: 2rem;
}

blockquote {
  border: none;
  padding: 0;
  margin: 0;
}

p.citation, p.citationbis, p.citationter {
  color: var(--color-grey-medium);
  border-width: 0;
  border-left-width: 6px;
  border-color: var(--color-grey-light);
  border-style: solid;
  margin: 1.2rem 0;
  padding: .3rem 0 .3rem 1.5rem;
  font-size: .95rem;
  line-height: 150%;
  text-align: left;
  hyphens: none;
  -ms-hyphens: none;
  -moz-hyphens: none;
  -webkit-hyphens: none;
}

p.citationbis {
  border-style: dashed;
}

p.citationter {
  border-style: double;
  border-left-width: 8px;
}

.encadre {
  background-color: var(--color-grey-light);
  padding: 1.5rem;
  margin-top: 1.2rem;
  margin-left: 3rem;
}

.encadre + * {
  margin-top: 1rem;
}

.encadre + .encadre {
  margin-top: 0 !important;
}

.separateur {
  text-align: center;
  line-height: 150%;
  margin-top: 2.5rem;
  margin-bottom: 2rem;
}

.question {
  font-weight: bold;
  margin-top: 1rem;
  margin-bottom: .3rem;
}

.question + .question {
  margin-top: .7rem;
}

.code, pre, code {
  font-family: var(--font-mono);
  line-height: 125%;
  margin-left: 2rem;
  font-size: .95rem;
  text-align: left;
  hyphens: none;
  -ms-hyphens: none;
  -moz-hyphens: none;
  -webkit-hyphens: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  font-size: .8em;
  margin: 1.5em auto;
  line-height: 125%;
}

table.example {
  margin: 1.2rem 0 1.2rem 3rem;
}

table.example + table.example {
  margin-top: 0;
}

table p, table p.texte {
  padding: 0;
  text-align: left;
}

td {
  padding: .3rem;
  vertical-align: top;
}

.groupe-illustration {
  margin: 2rem 0;
}

.titreillustration, .legendeillustration, .creditillustration {
  font-family: var(--font-ui);
  margin: .5rem 0;
  text-align: center;
}

.titreillustration {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: bold;
  break-after: avoid;
}

.imageillustration, table {
  margin-bottom: 2rem;
}

.imageillustration {
  text-align: center;
}

.imageillustration img {
  display: inline;
}

.legendeillustration, .creditillustration {
  line-height: 130%;
  font-size: .9rem;
  margin: -1.5rem 0 2rem;
}

.creditillustration {
  color: var(--color-grey-medium);
}

.footnotecall, .endnotecall {
  font-size: 0.8em;
  vertical-align: super;
  margin-left: .2em;
  color: inherit;
  text-decoration: none;
}

h1 .footnotecall, h1 .endnotecall, h2 .footnotecall, h2 .endnotecall {
  font-size: 0.6em;
}

/* ARTICLE BIBLIOGRAPHY */
/* ==================== */

.article__biblio {
  margin-top: 4rem;
}

.article__biblio-contents {
  line-height: 150%;
  font-family: var(--font-text);
  font-size: .9rem;
  display: block;
  columns: 2;
  column-gap: 2rem;
}

.article__biblio-contents p {
  text-align: left;
}

.article__biblio-contents p:not(:first-child) {
  margin-top: .5rem;
}

.article__biblio-contents > h1:first-child {
  margin-top: 0;
}

/* APPENDIX */
/* ======== */

.article__appendix {
  margin-top: 4rem;
}

.article__appendix-contents {
  display: block;
  line-height: 150%;
  font-family: var(--font-text);
  margin-top: 2rem;
  font-size: 1rem;
}

.article__appendix-contents > * {
  margin-top: .7rem;
}

/* NOTES */
/* ===== */

.article__footnotes-contents, .article__endnotes-contents {
  font-size: 1rem;
  line-height: 150%;
  font-family: var(--font-text);
}

.article__footnotes-contents > *, .article__endnotes-contents > * {
  margin-top: .5rem;
}

.FootnoteSymbol, .EndnoteSymbol {
  margin-right: .5em;
  font-size: .8rem;
  text-decoration: none;
}

/* COUVERTURE */
/* ========== */

.cover {
  width: 210mm;
  height: 297mm;
}

.cover img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none !important;
  break-after: page;
  margin: 0;
  padding: 0;
  object-fit: contain;
}

/* NUMERO */
/* ====== */

.cols {
  display: flex;
}

.cols .accroche {
  max-width: 250px;
  margin: 1rem 1rem 1rem -4rem;
}

.numero__header {
  width: 100%;
  border-bottom: 1px solid var(--color-grey-dark);
}

.numero__metadata {
  break-after: page;
}

.numero .site {
  border-bottom: 1px solid var(--color-grey-dark);
}

.numero .site .site__logo {
  display: none;
}

.numero .site .col {
  margin: .5rem 0 1rem;
}

.publi__descriptionouvrage, .publi__isbn, .publi__urlpublicationediteur, .publi__introduction {
  margin: .7rem 0;
}

.publi__urlpublicationediteur a {
  text-decoration: none;
  color: inherit;
}

.publi__urlpublicationediteur a.url-hidden:after {
  content: none;
}

/* SOMMAIRE */
/* ======== */

.toc__contents {
  list-style: none;
  padding: 0;
}

.toc__li {
  margin: .6rem 0;
}

.toc__link > span + span {
  display: block;
}

.toc__header {
  margin: 1rem 0;
}

.toc__publi-title {
  margin: 1rem 0 0 0;
}

/* SOUS-PARTIES */
/* ============ */

.souspartie {
  break-before: page;
  margin-top: 8cm;
}

.souspartie + .souspartie {
  break-before: auto;
  margin-top: 1cm !important; /* paged.js workaround */
}

.souspartie + :not(.souspartie) {
  break-before: page;
}

h2.souspartie__title {
  font-family: var(--font-ui);
  text-align: center;
  font-size: 1.6rem;
  font-weight: normal;
}

h2.souspartie__title--level1 {
  font-size: 2.2rem;
}

h2.souspartie__title--level2 {
  font-size: 1.9rem;
}
