/* ── Custom callout colours matching the PDF book's tcolorbox styles ── */

/* Hint box — green (mapped to .callout-tip) */
/* Uses Quarto's default .callout-tip which is already green — perfect */

/* Tip box — blue (mapped to .callout-note) */
/* Uses Quarto's default .callout-note which is already blue — perfect */

/* Must-read box — violet (mapped to .callout-important) */
/* Uses Quarto's default .callout-important which is already reddish — close enough */

/* Note box — pink (mapped to .callout-caution) */
/* Uses Quarto's default .callout-caution which is already orange/amber */

/* Cool box — gray, mapped to .callout-tip with .callout-cool class */
div.callout-cool.callout-tip {
  border-left-color: #999 !important;
}

div.callout-cool.callout-tip > .callout-header {
  background-color: rgba(153, 153, 153, 0.1);
}

[data-bs-theme="dark"] div.callout-cool.callout-tip > .callout-header,
.quarto-dark div.callout-cool.callout-tip > .callout-header {
  background-color: rgba(153, 153, 153, 0.15);
}

/* ── General book styling enhancements ────────────────────────────── */

/* Slightly wider content area for readability */
.content {
  max-width: 48em;
}

/* Abbreviations table styling */
.abbreviations-table table {
  width: 100%;
}

/* Definition list styling for glossary */
dt {
  font-weight: 600;
  margin-top: 0.8em;
}

dd {
  margin-left: 1.5em;
  margin-bottom: 0.5em;
}

/* ── Refined sidebar styling (Mattia-inspired) ───────────────────── */

/* Sidebar container — remove hard border, transparent bg to inherit theme */
#quarto-sidebar,
body .sidebar,
body .sidebar.sidebar-navigation {
  border-right: none !important;
  padding: 0.5rem 0.75rem !important;
  background-color: transparent !important;
}

/* Book title in sidebar */
.sidebar-title a {
  font-weight: 700 !important;
  font-size: 1.1rem !important;
  letter-spacing: -0.01em;
}

/* All sidebar link containers — rounded with hover highlight */
.sidebar-item-container {
  border-radius: 8px !important;
  margin: 1px 0 !important;
  transition: background-color 0.15s ease !important;
}

.sidebar-item-container:hover {
  background-color: rgba(128, 128, 128, 0.12) !important;
}

/* Sidebar links — padded, rounded, no left border */
.sidebar-navigation .sidebar-item .sidebar-link {
  padding: 6px 10px !important;
  border-radius: 8px !important;
  border-left: none !important;
  font-size: 0.88rem !important;
  transition: background-color 0.15s ease, color 0.15s ease !important;
}

/* Active page — handled in color fix section below */
.sidebar-navigation .sidebar-item .sidebar-link.active {
  border-left: none !important;
  font-weight: 600 !important;
}

/* Dark mode active — handled in color fix section below */

/* Part / section headers — bold uppercase */
.sidebar-item-section > .sidebar-item-container > a.sidebar-item-text {
  font-weight: 600 !important;
  font-size: 0.82rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  opacity: 0.75 !important;
}

.sidebar-item-section > .sidebar-item-container:hover > a.sidebar-item-text {
  opacity: 1 !important;
}

.sidebar-item-section > .sidebar-item-container {
  margin-top: 0.6rem !important;
}

/* Chevron toggle — smooth rotation */
.sidebar-item-toggle .bi-chevron-right {
  transition: transform 0.25s ease !important;
  font-size: 0.75rem !important;
}

.sidebar-item-toggle[aria-expanded="true"] .bi-chevron-right {
  transform: rotate(90deg) !important;
}

/* Nested chapter list — subtle left line */
ul.sidebar-section.depth1 {
  padding-left: 0.5rem !important;
  border-left: 2px solid rgba(128, 128, 128, 0.15) !important;
  margin-left: 0.5rem !important;
}

/* Search box — rounder */
.sidebar-search .aa-Form {
  border-radius: 8px !important;
  border: 1px solid rgba(128, 128, 128, 0.25) !important;
}

/* Back to site link — subtle */
.sidebar-menu-container > .list-unstyled > li:first-child .sidebar-link {
  font-size: 0.82rem !important;
  opacity: 0.6 !important;
}

.sidebar-menu-container > .list-unstyled > li:first-child .sidebar-link:hover {
  opacity: 1 !important;
}

/* Remove default hover left border */
.sidebar-navigation .sidebar-link:hover {
  border-left-color: transparent !important;
}

/* ── Fix sidebar link colors ─────────────────────────────────────── */
/* Quarto toggles body.quarto-dark / body.quarto-light, not data-bs-theme */

/* Light mode (default) — neutral dark gray links */
body nav#quarto-sidebar a,
body nav#quarto-sidebar a:link,
body nav#quarto-sidebar a:visited,
body nav#quarto-sidebar a:hover,
body nav#quarto-sidebar .sidebar-link,
body nav#quarto-sidebar .sidebar-item-text,
body nav#quarto-sidebar .sidebar-title a,
body nav#quarto-sidebar .menu-text,
body nav#quarto-sidebar .chapter-title,
body nav#quarto-sidebar .chapter-number {
  color: #343a40 !important;
  text-decoration: none !important;
}

/* Dark mode — soft white links */
body.quarto-dark nav#quarto-sidebar a,
body.quarto-dark nav#quarto-sidebar a:link,
body.quarto-dark nav#quarto-sidebar a:visited,
body.quarto-dark nav#quarto-sidebar a:hover,
body.quarto-dark nav#quarto-sidebar .sidebar-link,
body.quarto-dark nav#quarto-sidebar .sidebar-item-text,
body.quarto-dark nav#quarto-sidebar .sidebar-title a,
body.quarto-dark nav#quarto-sidebar .menu-text,
body.quarto-dark nav#quarto-sidebar .chapter-title,
body.quarto-dark nav#quarto-sidebar .chapter-number {
  color: rgba(255, 255, 255, 0.92) !important;
}

/* Active page — accent color + pill background */
body nav#quarto-sidebar .sidebar-link.active,
body nav#quarto-sidebar .sidebar-link.active .menu-text,
body nav#quarto-sidebar .sidebar-link.active .chapter-title,
body nav#quarto-sidebar .sidebar-link.active .chapter-number {
  color: #2780e3 !important;
}
body nav#quarto-sidebar .sidebar-link.active {
  background-color: rgba(39, 128, 227, 0.12) !important;
}

body.quarto-dark nav#quarto-sidebar .sidebar-link.active,
body.quarto-dark nav#quarto-sidebar .sidebar-link.active .menu-text,
body.quarto-dark nav#quarto-sidebar .sidebar-link.active .chapter-title,
body.quarto-dark nav#quarto-sidebar .sidebar-link.active .chapter-number {
  color: #00bc8c !important;
}
body.quarto-dark nav#quarto-sidebar .sidebar-link.active {
  background-color: rgba(0, 188, 140, 0.15) !important;
}
