:root {
  --main-color: #447099 ;
}

body.quarto-dark {
  --main-color: #8fb3d9;
}

.colorized {
  color: var(--main-color) ;
}


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

a.nav-link:link {
  color: white;
}

a.nav-link:visited {
  color: white;
}

.no-anchor.card-title.listing-title {
    font-weight: bolder !important;
    color: var(--main-color) !important;
}

.card-title.listing-title {
  font-weight: bold; /* Set the card title to bold */
  margin-bottom: 1em; /* Add a little more space after the title */
}

.card-body.post-contents {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.category {
  color: #6c757d;
  display: inline-block; /* Add this line */
  border: solid 1px #dee2e6;
  border-radius: .25rem;
  text-transform: uppercase;
  font-size: .65em;
  padding-left: .5em;
  padding-right: .5em;
  padding-top: .15em;
  padding-bottom: .15em;
  cursor: pointer;
  margin-right: 4px;
  margin-bottom: 4px;
}

pre code.bash {
  position: relative;
  padding-left: 1em; /* Adjust based on prompt width */
}

pre code.bash::before {
  content: "$ ";
  position: absolute;
  left: 0;
  color: #888; /* Adjust color as needed */
}

body.quarto-dark .category {
  color: #9aa1ab;
  border-color: #2c2c2c;
}

body.quarto-dark pre code.bash::before {
  color: #9aa1ab;
}

/* Terminal theme: palette per color scheme */
/* One set of rules (below) serves both schemes; only these variables change. */
body.quarto-dark {
  --term-bg: #000000;
  --term-line: #447099;
  --term-glow: 0 1px 12px rgba(68,112,153,.35);
  --term-fg: #b8c0cc;
  --term-accent: #7fd4a0;
  --term-accent-soft: rgba(127,212,160,.08);
  --term-prompt: #8fb3d9;
  --term-dim: #5c6773;
  --term-heading: #e6e9ee;
  --term-h2: #dfe2e7;
  --term-h3: #c9ced6;
  --term-rule: #2c2c2c;
  --term-border: #262626;
  --term-bar: #141414;
  --term-window-shadow: 0 4px 18px rgba(0,0,0,.35);
  --term-glow-text: rgba(127,212,160,.25);
  --term-glow-strong: rgba(127,212,160,.5);
  --term-phosphor: #33ff66;
  --term-phosphor-glow: rgba(51,255,102,.55);
  --term-strong: #ffb547;
}

body.quarto-light {
  --term-bg: #f0eee6;
  --term-line: #447099;
  --term-glow: 0 1px 8px rgba(68,112,153,.15);
  --term-fg: #3d3d3a;
  --term-accent: #b5553a;
  --term-accent-soft: rgba(181,85,58,.08);
  --term-prompt: #447099;
  --term-dim: #a8a59b;
  --term-heading: #141413;
  --term-h2: #1f1e1d;
  --term-h3: #3d3d3a;
  --term-rule: #d9d6cb;
  --term-border: #dedcd1;
  --term-bar: #e8e6dc;
  --term-window-shadow: 0 2px 10px rgba(20,20,19,.08);
  --term-glow-text: transparent;
  --term-glow-strong: transparent;
  --term-phosphor: #1d7a3a;
  --term-phosphor-glow: transparent;
  --term-strong: #9c4a12;
}

/* Terminal theme: old-school terminal navbar */
body:is(.quarto-light, .quarto-dark) .navbar,
body:is(.quarto-light, .quarto-dark) #quarto-header {
  background-color: var(--term-bg) !important;
  box-shadow: none;
}

/* The only blue: one line under the header, with a faint glow */
body:is(.quarto-light, .quarto-dark) #quarto-header {
  border-bottom: 2px solid var(--term-line);
  box-shadow: var(--term-glow);
}

body:is(.quarto-light, .quarto-dark) .navbar .nav-link,
body:is(.quarto-light, .quarto-dark) .navbar .dropdown-item {
  font-family: "JetBrains Mono", "Fira Code", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9rem;
  letter-spacing: .02em;
}

body:is(.quarto-light, .quarto-dark) .navbar a.nav-link:link,
body:is(.quarto-light, .quarto-dark) .navbar a.nav-link:visited {
  color: var(--term-fg);
}

body:is(.quarto-light, .quarto-dark) .navbar a.nav-link:hover,
body:is(.quarto-light, .quarto-dark) .navbar a.nav-link:focus,
body:is(.quarto-light, .quarto-dark) .navbar a.nav-link.active {
  color: var(--term-accent);
  background-color: transparent;
}

/* Terminal prompt before each top-level link (transparent, so no layout shift) */
body:is(.quarto-light, .quarto-dark) .navbar .navbar-nav > .nav-item > .nav-link::before {
  content: "> ";
  color: transparent;
}

body:is(.quarto-light, .quarto-dark) .navbar .navbar-nav > .nav-item > .nav-link:hover::before,
body:is(.quarto-light, .quarto-dark) .navbar .navbar-nav > .nav-item > .nav-link:focus::before,
body:is(.quarto-light, .quarto-dark) .navbar .navbar-nav > .nav-item > .nav-link.active::before {
  color: var(--term-prompt);
}

/* Blinking block cursor after the active link (never on dropdown toggles, which use ::after for the caret) */
body:is(.quarto-light, .quarto-dark) .navbar .nav-link.active:not(.dropdown-toggle)::after {
  content: "▋";
  margin-left: .15em;
  color: var(--term-accent);
  animation: term-blink 1.06s steps(1) infinite;
}

@keyframes term-blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  body:is(.quarto-light, .quarto-dark) .navbar .nav-link.active:not(.dropdown-toggle)::after {
    animation: none;
  }
}

/* Dropdown menus */
body:is(.quarto-light, .quarto-dark) .navbar .dropdown-menu {
  background-color: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: 0;
  font-family: "JetBrains Mono", "Fira Code", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

body:is(.quarto-light, .quarto-dark) .navbar .dropdown-item {
  color: var(--term-fg);
  background-color: transparent;
}

body:is(.quarto-light, .quarto-dark) .navbar .dropdown-item:hover,
body:is(.quarto-light, .quarto-dark) .navbar .dropdown-item:focus {
  background-color: var(--term-accent-soft);
  color: var(--term-accent);
}

/* Dropdown menus stay above the scanline layer */
body:is(.quarto-light, .quarto-dark) .navbar .dropdown-menu {
  z-index: 1001;
}

/* Search icon, toggler and other navbar icons */
body:is(.quarto-light, .quarto-dark) .navbar .navbar-toggler,
body:is(.quarto-light, .quarto-dark) .navbar i,
body:is(.quarto-light, .quarto-dark) .navbar .bi,
body:is(.quarto-light, .quarto-dark) .navbar svg {
  color: var(--term-fg);
}

/* Light theme only: hamburger icon drawn in ink (Bootstrap's default is white, for the blue navbar) and toggler border */
body.quarto-light .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%233d3d3a' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

body.quarto-light .navbar .navbar-toggler {
  border-color: var(--term-fg);
}

/* Sélecteur de dépôt dans les boîtes de checkpoint (dépôt applicatif / GitOps) */
.checkpoint-repo-switch {
  margin-bottom: .5em;
  gap: .25em;
}

.checkpoint-repo-switch .nav-link {
  font-size: .85em;
  padding: .2em .6em;
}

/* Terminal theme: shell prompt as site title */
/* The first link reads "ensae@prod:~$" instead of "Mise en production".
   The real text stays in the DOM, visually hidden, for screen readers.
   ::before carries "ensae" (accent), ::after carries "@prod:~$" (foreground);
   a single pseudo-element cannot hold several colours. */
body:is(.quarto-light, .quarto-dark) .navbar .navbar-nav > .nav-item > a.nav-link[href="https://ensae-reproductibilite.github.io/"] .menu-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

body:is(.quarto-light, .quarto-dark) .navbar .navbar-nav > .nav-item > a.nav-link[href="https://ensae-reproductibilite.github.io/"]::before {
  content: "ensae";
  color: var(--term-accent);
  font-weight: 600;
  margin-left: 0;
  animation: none;
}

body:is(.quarto-light, .quarto-dark) .navbar .navbar-nav > .nav-item > a.nav-link[href="https://ensae-reproductibilite.github.io/"]::after {
  content: "@prod:~$";
  color: var(--term-fg);
  font-weight: 600;
  margin-left: 0;
  animation: none;
}

body:is(.quarto-light, .quarto-dark) .navbar .navbar-nav > .nav-item > a.nav-link[href="https://ensae-reproductibilite.github.io/"]:hover::before,
body:is(.quarto-light, .quarto-dark) .navbar .navbar-nav > .nav-item > a.nav-link[href="https://ensae-reproductibilite.github.io/"]:focus::before,
body:is(.quarto-light, .quarto-dark) .navbar .navbar-nav > .nav-item > a.nav-link[href="https://ensae-reproductibilite.github.io/"]:hover::after,
body:is(.quarto-light, .quarto-dark) .navbar .navbar-nav > .nav-item > a.nav-link[href="https://ensae-reproductibilite.github.io/"]:focus::after {
  text-shadow: 0 0 6px var(--term-glow-strong);
}

/* Terminal theme: terminal-style headings */
body:is(.quarto-light, .quarto-dark) #quarto-content main h1,
body:is(.quarto-light, .quarto-dark) #quarto-content main h2,
body:is(.quarto-light, .quarto-dark) #quarto-content main h3,
body:is(.quarto-light, .quarto-dark) .quarto-title h1.title {
  font-family: "JetBrains Mono", "Fira Code", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: -0.01em;
  font-weight: 600;
}

/* Title and h1 keep their own colour */
body:is(.quarto-light, .quarto-dark) .quarto-title h1.title,
body:is(.quarto-light, .quarto-dark) main.content > section > h1 {
  color: var(--term-heading);
  margin-bottom: 1rem;
}

/* Level-1 headings and the title get a "$ " shell prompt */
body:is(.quarto-light, .quarto-dark) main.content section.level1 > h1::before,
body:is(.quarto-light, .quarto-dark) .quarto-title h1.title::before {
  content: "$ ";
  color: var(--term-accent);
  font-weight: 600;
}

/* h2: "## " prefix, bottom rule, direct children of level-2 sections only (never callouts, cards, TOC or sidebar) */
body:is(.quarto-light, .quarto-dark) main.content section.level2 > h2 {
  color: var(--term-h2);
  border-bottom: 1px dashed var(--term-rule);
  padding-bottom: .2em;
  margin-top: 3rem;
  margin-bottom: .9rem;
}

body:is(.quarto-light, .quarto-dark) main.content section.level2 > h2::before {
  content: "## ";
  color: var(--term-dim);
  font-weight: 400;
}

/* h3: "### " prefix, dim and lighter */
body:is(.quarto-light, .quarto-dark) main.content section.level3 > h3 {
  color: var(--term-h3);
  margin-top: 1.6rem;
  margin-bottom: .7rem;
}

body:is(.quarto-light, .quarto-dark) main.content section.level3 > h3::before {
  content: "### ";
  color: var(--term-dim);
  font-weight: 400;
}

/* Terminal theme: code blocks as terminal windows */
body:is(.quarto-light, .quarto-dark) div.sourceCode:not(:has(> iframe)) {
  position: relative;
  border: 1px solid var(--term-border);
  border-radius: 8px;
  background: var(--term-bg);
  padding-top: 28px; /* title bar height */
  overflow: hidden;
  box-shadow: var(--term-window-shadow);
}

/* Title bar with the three window dots */
body:is(.quarto-light, .quarto-dark) div.sourceCode:not(:has(> iframe))::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 28px;
  box-sizing: border-box;
  background-color: var(--term-bar);
  border-bottom: 1px solid var(--term-border);
  background-image:
    radial-gradient(circle closest-side, #ff5f57 98%, transparent),
    radial-gradient(circle closest-side, #febc2e 98%, transparent),
    radial-gradient(circle closest-side, #28c840 98%, transparent);
  background-size: 11px 11px;
  background-repeat: no-repeat;
  background-position: 12px 8.5px, 30px 8.5px, 48px 8.5px;
}

body:is(.quarto-light, .quarto-dark) div.sourceCode pre.sourceCode {
  background-color: transparent;
  border: none;
  margin: 0;
}

/* Copy button stays above the title bar (it is a sibling of div.sourceCode, inside a positioned scaffold) */
body:is(.quarto-light, .quarto-dark) div.code-copy-outer-scaffold > .code-copy-button {
  z-index: 3;
}

/* Code with a filename: Quarto already draws a header, so no second title bar */
body:is(.quarto-light, .quarto-dark) .code-with-filename div.sourceCode {
  padding-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

body:is(.quarto-light, .quarto-dark) .code-with-filename div.sourceCode::before {
  content: none;
}

/* Dark mode only: CRT scanlines on the navbar (they do not suit the paper look of the light theme) */
/* #quarto-header is already position: fixed (fixed-top), which is the containing block */
body.quarto-dark #quarto-header::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.025) 0, rgba(255,255,255,.025) 1px, transparent 1px, transparent 3px);
  animation: term-scanline-flicker 4s ease-in-out infinite;
}

@keyframes term-scanline-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: .9; }
}

@media (prefers-reduced-motion: reduce) {
  body.quarto-dark #quarto-header::after {
    animation: none;
  }
}

/* Faint glow on hovered or active links */
body:is(.quarto-light, .quarto-dark) .navbar a.nav-link:hover,
body:is(.quarto-light, .quarto-dark) .navbar a.nav-link:focus,
body:is(.quarto-light, .quarto-dark) .navbar a.nav-link.active {
  text-shadow: 0 0 4px var(--term-glow-text);
}

/* Terminal theme: active TOC entry as a terminal line */
/* Quarto's margin TOC (#quarto-margin-sidebar.sidebar) styles .active in light blue with a left rule;
   Bootstrap's scrollspy marks only the link of the section in view, but the cursor is limited to the
   deepest active link anyway, in case a parent is marked too. */
body:is(.quarto-light, .quarto-dark) #TOC a.nav-link.active {
  color: var(--term-accent) !important;
  border-left: 0;
}

/* File-tree TOC (like `tree` output). Each sub-list is indented by 2em and carries a dim
   dotted guide on its left edge; the branch glyph hangs in that indent, before the link text.
   The glyph sits in ::before, so the active cursor (::after) is untouched.
   Only colours and padding change: display is never set, so Quarto's collapse still works. */
body:is(.quarto-light, .quarto-dark) #TOC ul ul {
  padding-left: 2em;
  background: linear-gradient(var(--term-dim), var(--term-dim)) no-repeat 0.3em 0 / 1px 100%;
}

body:is(.quarto-light, .quarto-dark) #TOC > ul > li > a.nav-link {
  padding-left: 0;
  border-left: 0;
}

body:is(.quarto-light, .quarto-dark) #TOC ul ul > li > a.nav-link {
  position: relative;
  padding-left: 0;
  border-left: 0;
}

body:is(.quarto-light, .quarto-dark) #TOC ul ul > li > a.nav-link::before {
  content: "\251C\2500\2500";
  position: absolute;
  left: -2em;
  top: 0;
  font-family: var(--bs-font-monospace), ui-monospace, monospace;
  white-space: pre;
  color: var(--term-dim);
  pointer-events: none;
}

body:is(.quarto-light, .quarto-dark) #TOC ul ul > li:last-child > a.nav-link::before {
  content: "\2514\2500\2500";
}

body:is(.quarto-light, .quarto-dark) #TOC a.nav-link.active:not(:has(~ ul a.nav-link.active))::after {
  content: "▋";
  margin-left: .2em;
  color: var(--term-accent);
  animation: term-blink 1.06s steps(1) infinite;
}

@media (prefers-reduced-motion: reduce) {
  body:is(.quarto-light, .quarto-dark) #TOC a.nav-link.active:not(:has(~ ul a.nav-link.active))::after {
    animation: none;
  }
}

/* ---------------------------------------------------------------
   Galerie de projets (chapters/gallery.ejs, chapters/galerie.qmd)
   Bootstrap CSS variables only, so light and dark themes both work.
   --------------------------------------------------------------- */
.gallery-grid {
  /* Mosaïque : colonnes de largeur minimale 17rem, cartes de hauteur libre */
  columns: 17rem;
  column-gap: 0.75rem;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  background: transparent;
}

.gallery-item .gallery-title {
  margin: 0 0 0.2rem 0;
  font-size: 1rem;
  line-height: 1.3;
}

.gallery-meta {
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
  margin-bottom: 0.3rem;
}

.gallery-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0 0.45rem;
  margin-left: 0.25rem;
  border-radius: 999px;
  background-color: var(--bs-secondary-bg);
  color: var(--bs-body-color);
}

.gallery-description {
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 0.3rem;
}

.gallery-stack {
  margin-bottom: 0.3rem;
  line-height: 1.6;
}

.gallery-stack code {
  font-size: 0.7rem;
  margin-right: 0.15rem;
}

.gallery-links {
  font-size: 0.8rem;
  margin-bottom: 0;
}

/* Page title: phosphor-green terminal title, with room before the description. */
body:is(.quarto-light, .quarto-dark) .quarto-title h1.title {
  color: var(--term-phosphor);
  font-size: clamp(2.6rem, 5vw, 3.6rem);
  line-height: 1.1;
  margin-bottom: 1.6rem;
  text-shadow: 0 0 6px var(--term-phosphor-glow), 0 0 18px var(--term-phosphor-glow);
}

body:is(.quarto-light, .quarto-dark) .quarto-title h1.title::before {
  color: var(--term-phosphor);
}

/* Blinking block cursor after the title */
body:is(.quarto-light, .quarto-dark) .quarto-title h1.title::after {
  content: "\258B";
  color: var(--term-phosphor);
  margin-left: 0.15em;
  font-weight: 400;
  animation: term-blink 1.06s steps(1) infinite;
}

@media (prefers-reduced-motion: reduce) {
  body:is(.quarto-light, .quarto-dark) .quarto-title h1.title::after {
    animation: none;
  }
}

/* Description as a terminal comment: dim, monospace, "# " prefix, more air above */
body:is(.quarto-light, .quarto-dark) .quarto-title-block .description {
  font-family: "JetBrains Mono", "Fira Code", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--term-fg);
  opacity: 0.8;
  font-size: 0.95rem;
  margin-top: 1.6rem;
}

body:is(.quarto-light, .quarto-dark) .quarto-title-block .description::before {
  content: "# ";
  color: var(--term-phosphor);
  opacity: 0.7;
}

/* Bold text in the content: amber, the second colour of old terminals, so it stands out
   from the body text. Bold inside links keeps the link colour. */
body:is(.quarto-light, .quarto-dark) main.content strong:not(a strong) {
  color: var(--term-strong);
}

/* ==========================================================================
   Readability pass for long pages (site-wide, main.content only)
   ========================================================================== */

/* Typography: airier line height and paragraph spacing (text stays left-aligned) */
body:is(.quarto-light, .quarto-dark) main.content {
  line-height: 1.7;
}

body:is(.quarto-light, .quarto-dark) main.content p {
  margin-bottom: 1.1em;
}

/* Loose list items: pandoc wraps their content in <p>, so space the items and the paragraphs inside them */
body:is(.quarto-light, .quarto-dark) main.content li + li:not(.filetree li) {
  margin-top: .35em;
}

body:is(.quarto-light, .quarto-dark) main.content li > p {
  margin-bottom: .4em;
}

/* Long pages: each level-1 part starts with air and a terminal separator (dashed rule) */
body:is(.quarto-light, .quarto-dark) main.content section.level1 + section.level1 {
  margin-top: 4.5rem;
  padding-top: 2.5rem;
  border-top: 1px dashed var(--term-rule);
}

/* Exercise callouts: the ordered list inside is the list of steps */
body:is(.quarto-light, .quarto-dark) .callout-application .callout-body {
  padding: .9rem 1.2rem 1rem;
}

body:is(.quarto-light, .quarto-dark) .callout-application .callout-body > ol > li {
  margin-top: .9em;
  padding-left: .3em;
}

body:is(.quarto-light, .quarto-dark) .callout-application .callout-body ol > li::marker {
  color: var(--term-phosphor);
  font-family: "JetBrains Mono", "Fira Code", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
}

/* Nested lists: indented under a dashed left guide */
body:is(.quarto-light, .quarto-dark) .callout-application .callout-body ol ol,
body:is(.quarto-light, .quarto-dark) .callout-application .callout-body ol ul,
body:is(.quarto-light, .quarto-dark) .callout-application .callout-body ul ul {
  border-left: 1px dashed var(--term-rule);
  padding-left: 1.2em;
  margin-top: .4em;
}

/* <details> as terminal panels: solutions and long snippets inside exercises.
   Folders of the filetree extension are <details> too: they keep their own style. */
body:is(.quarto-light, .quarto-dark) main.content details:not(.filetree details) {
  border: 1px solid var(--term-border);
  border-radius: 0;
  background: var(--term-accent-soft);
  margin: .8em 0;
  padding: 0 .8em;
}

/* Summary line: monospace, phosphor-coloured, with a shell-style chevron */
body:is(.quarto-light, .quarto-dark) main.content details:not(.filetree details) > summary {
  font-family: "JetBrains Mono", "Fira Code", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85rem;
  cursor: pointer;
  color: var(--term-phosphor);
  padding: .45em 0;
  list-style: none;
}

body:is(.quarto-light, .quarto-dark) main.content details:not(.filetree details) > summary::-webkit-details-marker {
  display: none;
}

body:is(.quarto-light, .quarto-dark) main.content details:not(.filetree details) > summary::before {
  content: "\25B8  ";
}

body:is(.quarto-light, .quarto-dark) main.content details:not(.filetree details)[open] > summary::before {
  content: "\25BE  ";
}

/* Open panel: rule between the summary and the content */
body:is(.quarto-light, .quarto-dark) main.content details:not(.filetree details)[open] > summary {
  border-bottom: 1px dashed var(--term-rule);
  margin-bottom: .6em;
}
