/* ============================
   Base style for theorem-like blocks and proofs
   ============================ */

div[id^="thm-"],
div[id^="lem-"],
div[id^="cor-"],
div[id^="prp-"],
div[id^="cnj-"],
div[id^="exm-"],
div[id^="rem-"],
div[id^="def-"],
div.definition,
div.proof,
div.claim {
  border-left: 4px solid transparent;
  padding: 0.75rem 1rem;
  margin: 1.25rem 0;
  border-radius: 0.45rem;
  background-color: #f9fafb;
  /* If content (equations, diagrams) is too wide,
     enable horizontal scrolling instead of overflow */
  overflow-x: auto;
}

/* Question blocks: same idea, own colors */
div[id^="qst-"] {
  border-left: 4px solid #f97316;   /* orange-500 border */
  background-color: #fff7ed;        /* very light orange background */
  padding: 0.75rem 1rem;
  margin: 1.25rem 0;
  border-radius: 0.45rem;
  overflow-x: auto;
}

/* Theorem: pastel purple */
div[id^="thm-"] {
  border-color: #8b5cf6;      /* purple-ish border */
  background-color: #f5f3ff;  /* very light lavender */
}

/* Lemma: slightly different, indigo */
div[id^="lem-"] {
  border-color: #6366f1;      /* indigo border */
  background-color: #eef2ff;  /* very light indigo */
}

/* Corollary: fuchsia */
div[id^="cor-"] {
  border-color: #d946ef;
  background-color: #faf5ff;
}

/* Proposition: muted blue-green */
div[id^="prp-"] {
  border-color: #0f766e;      /* teal-ish border */
  background-color: #e0f2fe;  /* light bluish background */
}


/* Proof: light pink */
div.proof {
  border-color: #ec4899;
  background-color: #fdf2f8;
}

/* Example: green */
div[id^="exm-"] {
  border-color: #22c55e;
  background-color: #f0fdf4;
}

/* Remark: light blue */
div[id^="rem-"] {
  border-color: #0ea5e9;
  background-color: #eff6ff;
}

/* Conjecture: soft amber (less bright) */
div[id^="cnj-"] {
  border-color: #f59e0b;
  background-color: #fffbeb;
}

/* Claim: neutral gray */
div.claim {
  border-color: #6b7280;
  background-color: #f9fafb;
}

/* Definition: soft teal */
div[id^="def-"],
div.definition {
  border-color: #14b8a6;      /* teal-500 */
  background-color: #ecfeff;  /* very light teal */
}


/* ============================
   Global protection against wide display math
   ============================ */

/* MathJax v3 display math (what Quarto uses with mathjax) */
mjx-container[display="true"] {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

/* Legacy Pandoc / MathJax wrapper */
.math.display {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

/* KaTeX display math (in case you ever switch) */
.katex-display {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}


/* ============================
   Figures and quiver diagrams
   ============================ */

img,
svg,
.quarto-figure img,
.quarto-figure svg,
.quarto-figure iframe {
  max-width: 100%;
  height: auto;
}


/* Make quiver.app iframes responsive and large enough */
iframe.quiver-embed {
  display: block;
  margin: 0.75rem auto;
  width: 100% !important;        /* take full width of the text / theorem box */
  max-width: 800px;              /* but don't grow beyond this on huge screens */
  min-height: 260px;             /* avoid ridiculously short iframes */
}


/* ============================
   Mobile tweaks
   ============================ */

@media (max-width: 768px) {

  /* Make page margins even thinner on mobile (half of 0.2rem) */
  main.content,
  .page-layout-article main.content {
    max-width: 100%;
    padding-left: 0.1rem;
    padding-right: 0.1rem;
  }

  /* Slightly larger, more readable base font on mobile */
  body {
    font-size: 17px;
    line-height: 1.55;
  }

  /* Theorem/lemma/corollary/… blocks: slightly slimmer on mobile */
  div[id^="thm-"],
  div[id^="lem-"],
  div[id^="cor-"],
  div[id^="prp-"],
  div[id^="cnj-"],
  div[id^="exm-"],
  div[id^="rem-"],
  div[id^="def-"],
  div.definition,
  div.proof,
  div.claim,
  div[id^="qst-"] {
    margin-left: 0;
    margin-right: 0;
    padding: 0.65rem 0.85rem;
    border-left-width: 3px;
    border-radius: 0.35rem;
  }

  /* Heading spacing a bit tighter to reduce empty space */
  h1, h2, h3 {
    margin-top: 1.6rem;
    margin-bottom: 0.8rem;
  }

  /* Navbar slightly slimmer on mobile so it wastes less space */
  .navbar {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
  }
}

/* ============================
   Dark-mode colors for theorem-like blocks
   ============================ */

/* In Quarto, dark mode adds the class `quarto-dark` to <body>.
   We use that to override colors. */

/* Make all theorem-like blocks use light text in dark mode */
body.quarto-dark div[id^="thm-"],
body.quarto-dark div[id^="lem-"],
body.quarto-dark div[id^="cor-"],
body.quarto-dark div[id^="prp-"],
body.quarto-dark div[id^="cnj-"],
body.quarto-dark div[id^="exm-"],
body.quarto-dark div[id^="rem-"],
body.quarto-dark div[id^="def-"],
body.quarto-dark div.definition,
body.quarto-dark div.proof,
body.quarto-dark div.claim,
body.quarto-dark div[id^="qst-"] {
  color: #e5e7eb;  /* light gray text */
}

/* Theorem */
body.quarto-dark div[id^="thm-"] {
  border-color: #a5b4fc;      /* light indigo border */
  background-color: #111827;  /* dark slate */
}

/* Lemma */
body.quarto-dark div[id^="lem-"] {
  border-color: #818cf8;
  background-color: #020617;  /* very dark navy */
}

/* Proposition */
body.quarto-dark div[id^="prp-"] {
  border-color: #5eead4;      /* bright teal border */
  background-color: #022c22;  /* dark teal background */
}


/* Corollary */
body.quarto-dark div[id^="cor-"] {
  border-color: #f472b6;
  background-color: #4a044e;  /* dark magenta */
}

/* Proof */
body.quarto-dark div.proof {
  border-color: #f9a8d4;
  background-color: #3b0764;  /* dark purple */
}

/* Example */
body.quarto-dark div[id^="exm-"] {
  border-color: #4ade80;
  background-color: #022c22;  /* dark green */
}

/* Remark */
body.quarto-dark div[id^="rem-"] {
  border-color: #38bdf8;
  background-color: #0f172a;  /* dark navy */
}

/* Definition */
body.quarto-dark div[id^="def-"],
body.quarto-dark div.definition {
  border-color: #2dd4bf;
  background-color: #042f2e;  /* dark teal */
}

/* Conjecture */
body.quarto-dark div[id^="cnj-"] {
  border-color: #fbbf24;
  background-color: #451a03;  /* dark amber-brown */
}

/* Question */
body.quarto-dark div[id^="qst-"] {
  border-color: #fdba74;
  background-color: #431407;  /* dark orange-brown */
}

/* Claim */
body.quarto-dark div.claim {
  border-color: #9ca3af;
  background-color: #111827;  /* dark neutral gray */
}



/* ============================
   Style the Quarto color-scheme toggle
   ============================ */

.navbar .quarto-color-scheme-toggle {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  padding: 0;
  margin-left: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background-color: transparent;
  cursor: pointer;
}

/* Hide the default Bootstrap icon inside the button */
.navbar .quarto-color-scheme-toggle i {
  display: none;
}

/* Light-mode icon (sun) */
.navbar .quarto-color-scheme-toggle::before {
  content: "☀";
  font-size: 1.2rem;
  line-height: 1;
}

/* Dark-mode icon (moon) */
body.quarto-dark .navbar .quarto-color-scheme-toggle::before {
  content: "🌙";
}

/* Slight background on hover */
.navbar .quarto-color-scheme-toggle:hover {
  background-color: rgba(148, 163, 184, 0.15);
}

/* Remove underline in all states */
.navbar .quarto-color-scheme-toggle,
.navbar .quarto-color-scheme-toggle:hover,
.navbar .quarto-color-scheme-toggle:focus {
  text-decoration: none !important;
}



/* ---------- Language switch (ENG / ITA) ---------- */

.lang-switch {
  display: flex;
  justify-content: flex-end;   /* push to the right */
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.lang-switch a,
.lang-switch .lang-current {
  text-decoration: none;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
}

/* Current language: filled pill */
.lang-switch .lang-current {
  font-weight: 600;
  background-color: #111827;
  color: #f9fafb;
}

/* Other language: outlined pill */
.lang-switch a {
  border: 1px solid #d1d5db;
  color: #374151;
}

.lang-switch a:hover {
  background-color: #e5e7eb;
}

/* Dark mode variants */

:root[data-bs-theme="dark"] .lang-switch .lang-current {
  background-color: #e5e7eb;
  color: #111827;
}

:root[data-bs-theme="dark"] .lang-switch a {
  border-color: #4b5563;
  color: #e5e7eb;
}

:root[data-bs-theme="dark"] .lang-switch a:hover {
  background-color: #374151;
}

/* Do not show language switch inside listing previews */
.quarto-listing .lang-switch {
  display: none;
}

