/* The Cheat Code - Custom CSS */

body {
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  line-height: 1.6;
}

.book .book-body .page-wrapper .page-inner {
  max-width: 800px;
}

p {
  margin-top: 0.8em;
  margin-bottom: 0.8em;
}

h1, h2, h3, h4 {
  font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
  margin-top: 1.5em;
}

blockquote {
  border-left: 4px solid #ddd;
  padding: 0.5em 1em;
  background-color: #f9f9f9;
  margin: 1em 0;
}

code {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9em;
  background-color: #f4f4f4;
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

pre code {
  background-color: transparent;
  padding: 0;
}

/* Math display */
.math.display {
  overflow-x: auto;
}

/* Figures: left-aligned, caption above in bold */
.figure {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  text-align: left !important;
  margin: 1.5em 0;
}

.figure img {
  order: 2;
  max-width: 100%;
  height: auto;
  margin: 0.3em 0 0;
}

.figure p.caption,
.figure .caption {
  order: 1;
  font-weight: bold;
  font-style: normal !important;
  text-align: left;
  margin: 0 0 0.4em 0;
  color: inherit;
}

/* fallback for bare img tags outside .figure */
img {
  max-width: 100%;
  height: auto;
}

/* Callout / info boxes (LyX Shadowbox, Boxed, Shaded) */
.callout-box {
  border-left: 4px solid #2c5f8a;
  background: #eef4fb;
  padding: 0.8em 1.2em;
  margin: 1.5em 0;
  border-radius: 0 6px 6px 0;
}

/* Interactive exercises — per-question toggle */
.exercises-container ol.exercise-list {
  list-style: decimal;
  padding-left: 1.6em;
}

.exercises-container li.exercise-item {
  margin-bottom: 1.4em;
}

.exercise-question p {
  margin: 0 0 0.3em 0;
}

.exercise-question ol[type="a"] {
  list-style-type: lower-alpha !important;
  margin: 0.3em 0 0.4em 1.4em;
  padding: 0;
}

.exercise-question ol[type="a"] li {
  margin-bottom: 0.15em;
}

details.exercise-answer {
  margin-top: 0.4em;
  display: inline-block;
}

details.exercise-answer summary {
  font-size: 0.88rem;
  font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
  color: #2c5f8a;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

details.exercise-answer summary::-webkit-details-marker { display: none; }

details.exercise-answer summary:hover { color: #0d6efd; }

.answer-content {
  margin-top: 0.4em;
  padding: 0.5em 0.9em;
  background: #f0f5fa;
  border-left: 3px solid #2c5f8a;
  border-radius: 0 4px 4px 0;
  font-size: 0.95em;
}

/* Left-align display math inside exercises (overrides MathJax default centering) */
.exercises-container .MathJax_Display {
  text-align: left !important;
  margin-left: 1.5em !important;
}

/* Part intro pages: styled header */
.book .book-body .page-inner section.level1.unnumbered h1::before {
  content: none;
}

/* Sidebar: Part items get distinct colour band */
.book-summary ul.summary li.part > span {
  display: block;
  background: rgba(44, 95, 138, 0.12) !important;
  border-top: 2px solid rgba(44, 95, 138, 0.5);
  padding: 6px 10px 5px !important;
  margin-top: 8px;
}

.book-summary ul.summary li.part span b {
  color: #1a4a70 !important;
  font-size: 0.82em !important;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Part links (clickable part intro pages) */
.book-summary ul.summary li.part > a {
  display: block;
  background: rgba(44, 95, 138, 0.12) !important;
  border-top: 2px solid rgba(44, 95, 138, 0.5);
  padding: 6px 10px 5px !important;
  margin-top: 8px;
  color: #1a4a70 !important;
  font-size: 0.82em !important;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: bold;
}

/* Hide redundant part intro chapter entries (linked via part header instead) */
.book-summary li.part-intro-hidden {
  display: none !important;
}

/* Drag handle hover hint */
.sidebar-resize-handle:hover {
  border-right-color: rgba(44, 95, 138, 0.5) !important;
}

/* Tables: bold caption, column grid lines, smaller math in cells */
.page-inner table caption {
  font-weight: bold;
  caption-side: top;
  text-align: left;
  padding: 0.4em 0;
}

.page-inner table {
  border-collapse: collapse;
  border: 1px solid #ddd;
}

.page-inner table td,
.page-inner table th {
  border: 1px solid #ddd !important;
  font-size: 0.75em;
}
