

@font-face {
  font-family: 'Latin Modern';
  font-style: normal;
  font-weight: normal;
  font-display: swap;
  src: url('https://latex.vercel.app/fonts/LM-regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Latin Modern';
  font-style: italic;
  font-weight: normal;
  font-display: swap;
  src: url('https://latex.vercel.app/fonts/LM-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'Latin Modern';
  font-style: normal;
  font-weight: bold;
  font-display: swap;
  src: url('https://latex.vercel.app/fonts/LM-bold.woff2') format('woff2');
}

@font-face {
  font-family: 'Latin Modern';
  font-style: italic;
  font-weight: bold;
  font-display: swap;
  src: url('https://latex.vercel.app/fonts/LM-bold-italic.woff2') format('woff2');
}

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

:root {
  /* Couleurs de la classe colle.cls */
  --definition-color: #FF8C64;
  --formule-color: #12519f;
  --proposition-color: #8ED1E2;
  --exemple-color: #31ad85;
  --correction-color: #7D6B7D;
  --theoreme-color: #8ED1E2;
  
  /* Couleurs de base */
  --body-color: hsl(0, 5%, 10%);
  --body-bg-color: hsl(210, 20%, 98%);
  --link-visited: hsl(0, 0%, 1%);
  --link-focus-outline: hsl(220, 90%, 52%);
  --pre-bg-color: hsl(210, 28%, 93%);
  --kbd-bg-color: hsl(210, 5%, 100%);
  --kbd-border-color: hsl(210, 5%, 70%);
  --table-border-color: black;
  --border-width-thin: 1.36px;
  --border-width-thick: 2.27px;
  --sidenote-target-border-color: hsl(55, 55%, 70%);
  --footnotes-border-color: hsl(0, 0%, 39%);
  
  /* Nouvelles variables pour tailles */
  --text-primary: hsl(0, 5%, 10%);
  --text-secondary: hsl(0, 5%, 40%);
  --background-primary: hsl(210, 20%, 98%);
  --background-secondary: hsl(210, 20%, 95%);
  --primary-color: rgb(34, 84, 221);
  --border-color: hsl(0, 0%, 85%);
}

.latex-dark {
  --body-color: hsl(0, 0%, 86%);
  --body-bg-color: hsl(0, 0%, 16%);
  --link-visited: hsl(196 80% 77%);
  --link-focus-outline: hsl(215, 63%, 73%);
  --pre-bg-color: hsl(0, 1%, 25%);
  --kbd-bg-color: hsl(0, 0%, 16%);
  --kbd-border-color: hsl(210, 5%, 70%);
  --table-border-color: white;
  --sidenote-target-border-color: hsl(0, 0%, 59%);
  --footnotes-border-color: hsl(0, 0%, 59%);
  --proof-symbol-filter: invert(80%);
}

/* Remove default margin */
body,
h1,
h2,
h3,
h4,
p,
ul,
ol,
li,
figure,
figcaption,
dl,
dd {
  margin: 0;
}

/* Make default font-size 1rem and add smooth scrolling to anchors */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  font-family: 'Latin Modern', Georgia, Cambria, 'Times New Roman', Times, serif;
  line-height: 1.8;
  font-size: 13pt;  
  
  /* Marges comme dans colle.cls : margin=1.5cm */
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  margin: 0;
  padding: 1.5cm;

  counter-reset: theorem definition sidenote-counter week exercice exemple remarque;

  color: var(--body-color);
  background-color: var(--body-bg-color);

  text-rendering: optimizeLegibility;
  hyphens: auto;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
}

/* Pas d'indentation des paragraphes comme dans colle.cls */
p {
  margin-top: 1rem;
  text-indent: 0;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Make links red */
a,
a:visited {
  color: var(--link-visited);
}

a:focus {
  outline-offset: 2px;
  outline: 2px solid var(--link-focus-outline);
}

/* Make images easier to work with */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
}

/* Prevent textarea from overflowing */
textarea {
  width: 100%;
}

/* Natural flow and rhythm in articles by default */
article > * + * {
  margin-top: 1em;
}

/* Styles for inline code or code snippets */
code,
pre,
kbd {
  font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 85%;
  hyphens: none;
}

pre {
  padding: 1rem 1.4rem;
  max-width: 100%;
  overflow: auto;
  border-radius: 4px;
  background: var(--pre-bg-color);
}

pre code {
  font-size: 95%;
  position: relative;
}

kbd {
  background: var(--kbd-bg-color);
  border: 1px solid var(--kbd-border-color);
  border-radius: 2px;
  padding: 2px 4px;
  font-size: 75%;
}

/* Better tables */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: auto;
  max-width: 100%;
  border-top: var(--border-width-thick) solid var(--table-border-color);
  border-bottom: var(--border-width-thick) solid var(--table-border-color);
  overflow-x: auto;
  counter-increment: caption;
}

table tr > th[scope='col'] {
  border-bottom: var(--border-width-thin) solid var(--table-border-color);
}

table tr > th[scope='row'] {
  border-right: var(--border-width-thin) solid var(--table-border-color);
}

th,
td {
  text-align: left;
  padding: 0.5rem;
  line-height: 1.1;
}

caption {
  text-align: left;
  font-size: 0.923em;
  padding: 0 0.25em 0.25em;
  width: 100%;
  margin-left: 0;
}

caption::before {
  content: 'Table ' counter(caption) '. ';
  font-weight: bold;
}

/* Center align the title */
h1:first-child {
  text-align: center;
}

/* ===================================
   STYLES SPÉCIFIQUES À COLLE.CLS
   =================================== */

/* --- Commande Week --- */
.week {
  page-break-before: always;
  margin-top: 3em;
  margin-bottom: 4em;
}

.week-number {
  font-size: 1.7rem;
  font-weight: normal;
  font-style: normal;
  margin-bottom: 0.5em;
}

.week-title {
  font-size: 2.5rem;
  font-style: italic;
  font-weight: normal;
  margin-bottom: 1em;
}

/* --- Chapitres --- */
.chapter {
  page-break-before: always;
  margin-top: 3em;
  margin-bottom: 4em;
}

.chapter-number {
  font-size: 1.7rem;
  font-weight: normal;
  margin-bottom: 0.5em;
}

.chapter-title {
  font-size: 2.5rem;
  font-style: italic;
  font-weight: normal;
}

/* --- Sections avec style colle.cls --- */
h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
  line-height: 1.4;
}

h2::before {
  content: counter(section) ". ";
  counter-increment: section;
  margin-right: 0.5em;
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.8rem;
  line-height: 1.4;
}

h3::before {
  content: counter(section) "." counter(subsection) ". ";
  counter-increment: subsection;
  margin-right: 0.5em;
}

body {
  counter-reset: section;
}

h2 {
  counter-reset: subsection;
}

/* --- Environnement Définition --- */
.definition {
  counter-increment: definition;
  display: block;
  margin: 10px 0;
  padding: 5px 5px 5px 10px;
  background-color: rgba(128, 128, 128, 0.1);
  border-left: 1px solid var(--definition-color);
  position: relative;
}

.definition::before {
  content: 'Définition ' counter(definition) '. ';
  font-weight: 600;
  font-style: normal;
}



/* --- Environnement Boîte (proposition style) --- */
.boite {
  display: block;
  margin: 10px 0;
  padding: 5px 5px 5px 10px;
  background-color: rgba(0, 255, 255, 0.1);
  border-left: 1px solid var(--proposition-color);
}

.boite2 {
  display: block;
  margin: 10px 0;
  padding: 5px 5px 5px 10px;
  background-color: rgba(254, 255, 255, 0.1);
  border-left: 1px solid var(--theoreme-color);
}

.boite-orange {
  display: block;
  margin: 10px 0;
  padding: 5px 5px 5px 10px;
  background-color: rgba(135, 141, 141, 0.1);
  border-left: 1px solid var(--definition-color);
}

.boite-white {
  display : block;
  margin: 10px 0;
  padding: 5px 5px 5px 10px;
  background-color: rgba(254, 255, 255, 0.1);
  border-left: 1px solid var(--definition-color);
}

/* --- Environnement Formule --- */
.formule {
  display: block;
  margin: 10px 0;
  padding: 5px 5px 5px 10px;
  background-color: rgba(128, 128, 128, 0.1);
  border-left: 4px solid var(--formule-color);
  position: relative;
}

.formule::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--formule-color);
  margin-left: 4px;
}

/* --- Environnement Théorème --- */
.theoreme {
  counter-increment: theorem;
  display: block;
  margin: 10px 0;
  padding: 5px 5px 5px 10px;
  background-color: white;
  border-left: 1px solid var(--theoreme-color);
  font-style: italic;
}

.theoreme::before {
  content: 'Théorème ' counter(theorem) '. ';
  font-weight: 600;
  font-style: normal;
}

/* --- Environnement Remarque --- */
.remarque {
  counter-increment: remarque;
  display: block;
  margin: 10px 0;
  padding: 5px 5px 5px 10px;
  background-color: white;
  border-left: 1px solid var(--proposition-color);
}

.remarque::before {
  content: 'Remarque ' counter(remarque) '. ';
  font-weight: 600;
  font-style: normal;
}



/* --- Environnement Exercice --- */
.exercice {
  counter-increment: exercice;
  display: block;
  margin: 10px 0;
  padding: 5px 5px 5px 10px;
  background-color: white;
  border-left: 1px solid var(--proposition-color);
}

.exercice::before {
  content: 'Exercice ' counter(exercice);
  font-weight: 600;
  font-style: normal;
  display: block;
  margin-bottom: 0.5em;
}

.resume {
  display: block;
  margin: 10px 0;
  padding: 5px 5px 5px 10px;
  background-color: white;
  border-left: 1px solid var(--exemple-color);
}
/* Exercice avec titre */
.exercice[data-title]::before {
  content: 'Exercice ' counter(exercice) ' — ' attr(data-title);
}

/* --- Environnement Exemple --- */
.exemple {
  counter-increment: exemple;
  display: block;
  margin: 10px 0;
  padding: 5px 5px 5px 10px;
  background-color: white;
  border-left: 1px solid var(--exemple-color);
}

.exemple::before {
  content: 'Exemple ' counter(exemple) '. ';
  font-weight: 600;
  font-style: normal;
}

/* --- Environnement Correction --- */
.correction {
  display: block;
  margin: 10px 0;
  padding: 5px 5px 5px 10px;
  background-color: white;
  border-left: 1px solid var(--correction-color);
}

.correction::before {
  content: 'Correction. ';
  font-weight: 600;
  font-style: normal;
}

/* --- Environnement Proof (conservé de latex.css) --- */
.proof {
  display: block;
  margin: 12px 0;
  font-style: normal;
  position: relative;
}

.proof::before {
  content: 'Preuve. ';
  font-style: italic;
}

.proof::after {
  content: '◾';
  filter: var(--proof-symbol-filter);
  position: absolute;
  right: -12px;
  bottom: -2px;
}

/* Heading typography */
h1 {
  font-size: 2.5rem;
  line-height: 3.25rem;
  margin-bottom: 1.625rem;
}

h4 {
  font-size: 1rem;
  margin-top: 2rem;
  font-weight: 600;
}

h5 {
  font-size: 1rem;
  margin-top: 1.8rem;
  font-weight: 600;
}

h6 {
  font-size: 1rem;
  font-style: italic;
  font-weight: normal;
  margin-top: 2.5rem;
}

h3,
h4,
h5,
h6 {
  line-height: 1.625rem;
}

h1 + h2 {
  margin-top: 1.625rem;
}

h2 + h3,
h3 + h4,
h4 + h5 {
  margin-top: 0.8rem;
}

h5 + h6 {
  margin-top: -0.8rem;
}

h2,
h3,
h4,
h5,
h6 {
  margin-bottom: 0.8rem;
}

/* Center author */
.author {
  margin: 0.85rem 0;
  font-variant-caps: small-caps;
  text-align: center;
}

/* Abstract */
.abstract,
.abstract p {
  text-align: center;
  margin-top: 0;
}

.abstract {
  margin: 2.25rem 0;
}

.abstract > h2 {
  font-size: 1rem;
  margin-bottom: -0.2rem;
}

/* Scroll overflow */
.scroll-wrapper {
  overflow-x: auto;
}

.scroll-wrapper > table td {
  white-space: nowrap;
}

/* Format the LaTeX symbol */
.latex span:nth-child(1) {
  text-transform: uppercase;
  font-size: 0.75em;
  vertical-align: 0.28em;
  margin-left: -0.48em;
  margin-right: -0.15em;
  line-height: 1ex;
}

.latex span:nth-child(2) {
  text-transform: uppercase;
  vertical-align: -0.5ex;
  margin-left: -0.1667em;
  margin-right: -0.125em;
  line-height: 1ex;
}

/* Footnotes */
.footnotes p {
  line-height: 1.5;
  font-size: 85%;
  margin-bottom: 0.4rem;
}

.footnotes {
  border-top: 1px solid var(--footnotes-border-color);
}

/* Lists */
ul, ol {
  padding-left: 2rem;
}

li {
  margin: 0.5rem 0;
}

/* Blockquotes */
blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--table-border-color);
  font-style: italic;
}

/* Navigation for TOC */
nav ol {
  counter-reset: item;
  padding-left: 2rem;
}

nav ol > li {
  display: block;
}

nav ol > li::before {
  content: counters(item, '.') ' ';
  counter-increment: item;
  padding-right: 0.85rem;
}

/* Format figure captions */
figure {
  counter-increment: figcaption;
  margin: 1rem 0;
}

figcaption {
  text-align: left;
  font-size: 0.923em;
  padding: 0.25em 0.25em 0;
  width: 100%;
  margin-left: 0;
}

figcaption::before {
  content: 'Figure ' counter(figcaption) '. ';
  font-weight: bold;
}

/* ===================================
   BOUTONS STYLE LATEX
   =================================== */

button,
.button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  font-family: 'Latin Modern', Georgia, Cambria, 'Times New Roman', Times, serif;
  font-size: 0.9rem;
  padding: 0.4rem 1rem;
  margin: 0.25rem;
  background-color: var(--body-bg-color);
  color: var(--body-color);
  border: 1px solid var(--body-color);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  line-height: 1.5;
}

button:hover,
.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
input[type="reset"]:hover {
  background-color: var(--body-color);
  color: var(--body-bg-color);
  border-color: var(--body-color);
}

button:active,
.button:active,
input[type="submit"]:active,
input[type="button"]:active,
input[type="reset"]:active {
  transform: translateY(1px);
}

button:focus,
.button:focus,
input[type="submit"]:focus,
input[type="button"]:focus,
input[type="reset"]:focus {
  outline: 2px solid var(--link-focus-outline);
  outline-offset: 2px;
}

/* Boutons de couleur (optionnel) */
button.primary,
.button.primary {
  background-color: var(--link-visited);
  color: white;
  border-color: var(--link-visited);
}

button.primary:hover,
.button.primary:hover {
  background-color: hsl(0, 100%, 25%);
  border-color: hsl(0, 100%, 25%);
}

button.secondary,
.button.secondary {
  background-color: var(---proposition-color);
  color: var(--body-color);
  border-color: var(--proposition-color);
}

button.secondary:hover,
.button.secondary:hover {
  background-color: hsl(190, 60%, 60%);
  border-color: hsl(190, 60%, 60%);
}

button.success,
.button.success {
  background-color: #4CAF50;
  color: white;
  border-color: #4CAF50;
}

button.success:hover,
.button.success:hover {
  background-color: #45a049;
  border-color: #45a049;
}

/* Bouton désactivé */
button:disabled,
.button:disabled,
button[disabled],
.button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--body-bg-color);
  color: var(--body-color);
}

button:disabled:hover,
.button:disabled:hover {
  background-color: var(--body-bg-color);
  color: var(--body-color);
}

/* Petits boutons */
button.small,
.button.small {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
}

/* Grands boutons */
button.large,
.button.large {
  font-size: 1.1rem;
  padding: 0.6rem 1.5rem;
}

/* ===================================
   HEADER ET FOOTER
   =================================== */

/* Header */
header {
  border-bottom: var(--border-width-thick) solid var(--table-border-color);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  margin-top: -0.5rem;
}

header h1,
header .header-title {
  font-size: 1.5rem;
  margin: 0;
  padding: 0;
  text-align: left;
  font-weight: normal;
}

header p,
header .header-subtitle {
  margin: 0.5rem 0 0 0;
  font-size: 0.9rem;
  color: var(--body-color);
  opacity: 0.8;
}

/* Header avec navigation */
header nav {
  margin-top: 1rem;
}

header nav a {
  margin-right: 1.5rem;
  text-decoration: none;
  font-size: 0.95rem;
}

header nav a:hover {
  text-decoration: underline;
}

/* Header avec logo/titre à gauche et navigation à droite */
header.split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

header.split .header-left {
  flex: 1;
}

header.split .header-right {
  flex: 0 0 auto;
}

header.split nav {
  margin-top: 0;
}

header.split nav a {
  margin-right: 0;
  margin-left: 1.5rem;
}

/* Footer */
footer {
  border-top: var(--border-width-thin) solid var(--footnotes-border-color);
  padding-top: 1rem;
  margin-top: 3rem;
  font-size: 0.85rem;
  color: var(--body-color);
  opacity: 0.8;
}

footer p {
  margin: 0.5rem 0;
}

footer a {
  color: inherit;
}

/* Footer avec colonnes */
footer.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

footer.columns .footer-section {
  margin-bottom: 1rem;
}

footer.columns .footer-section h4 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  opacity: 1;
}

footer.columns .footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

footer.columns .footer-section li {
  margin: 0.25rem 0;
}

footer.columns .footer-section a {
  text-decoration: none;
}

footer.columns .footer-section a:hover {
  text-decoration: underline;
}

/* Footer centré */
footer.center,
footer.center p {
  text-align: center;
}

/* Footer avec copyright */
footer .copyright {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--footnotes-border-color);
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ===================================
   BARRE DE NAVIGATION STICKY
   =================================== */

nav.sticky {
  position: sticky;
  top: 0;
  background-color: var(--body-bg-color);
  z-index: 100;
  border-bottom: var(--border-width-thin) solid var(--table-border-color);
  padding: 0.75rem 0;
  margin: -2rem -1.25rem 2rem -1.25rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

nav.sticky a {
  margin-right: 1.5rem;
  text-decoration: none;
  font-size: 0.95rem;
}

nav.sticky a:hover {
  text-decoration: underline;
}

/* ===================================
   GROUPES DE BOUTONS
   =================================== */

.button-group {
  display: inline-flex;
  gap: 0;
}

.button-group button,
.button-group .button {
  margin: 0;
  border-radius: 0;
}

.button-group button:first-child,
.button-group .button:first-child {
  border-right: none;
}

.button-group button:last-child,
.button-group .button:last-child {
  border-left: none;
}

.button-group button:not(:first-child):not(:last-child),
.button-group .button:not(:first-child):not(:last-child) {
  border-left: none;
  border-right: none;
}

/* ===================================
   CARDS POUR ANNALES
   =================================== */

.exam-card {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1rem 0;
  transition: all 0.2s ease;
}

.exam-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Media queries pour impression */
@media print {
  body {
    padding: 1.5cm;
    font-size: 11pt;
  }
  
  .week,
  .chapter {
    page-break-before: always;
  }
  
  .definition,
  .theoreme,
  .remarque,
  .exercice,
  .exemple,
  .correction,
  .formule,
  .boite {
    page-break-inside: avoid;
  }
  
  /* Masquer les boutons et navigation à l'impression */
  button,
  .button,
  nav,
  header nav {
    display: none;
  }
  
  header,
  footer {
    border-color: black;
  }
}

/* Responsive pour mobile */
@media (max-width: 768px) {
  body {
    font-size: 12pt;
    padding: 0.5cm;   /* ← AJOUTÉ */
  }
  
  header.split {
    flex-direction: column;
    align-items: flex-start;
  }
  
  header.split .header-right {
    margin-top: 1rem;
  }
  
  header.split nav a {
    margin-left: 0;
    margin-right: 1.5rem;
  }
  
  footer.columns {
    grid-template-columns: 1fr;
  }
  
  nav.sticky {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
  }
  
  /* ← AJOUTÉ TOUT CE QUI SUIT */
  h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
  }
  
  h2 {
    font-size: 1.3rem;
    margin-top: 1.5rem;
  }
  
  .exam-card {
    padding: 1rem;
  }
  
  .sidebar {
    padding: 1rem;
  }
}
}