/* ============================================================
   Production Data Science with R — Custom Styles
   Fonts: Times New Roman (headings), Inter (body), JetBrains Mono (code)
   ============================================================ */

/* ---------- Global Typography ---------- */
.book.font-family-1 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.book .book-body .page-wrapper .page-inner {
  max-width: 920px;
  line-height: 1.75;
  font-size: 16.5px;
  color: #1a1a2e;
}

/* ---------- Headings — Times New Roman, NO underline ---------- */
.book .book-body h1 {
  font-family: 'Times New Roman', Times, Georgia, serif;
  font-weight: 700;
  font-size: 2.4em;
  color: #16213e;
  border-bottom: none;
  padding-bottom: 0;
  margin-top: 0;
  letter-spacing: -0.02em;
}

.book .book-body h2 {
  font-family: 'Times New Roman', Times, Georgia, serif;
  font-weight: 600;
  font-size: 1.7em;
  color: #1a1a2e;
  border-bottom: none;
  padding-bottom: 0;
  margin-top: 50px;
  letter-spacing: -0.01em;
}

.book .book-body h3 {
  font-family: 'Times New Roman', Times, Georgia, serif;
  font-weight: 600;
  font-size: 1.3em;
  color: #16213e;
  margin-top: 35px;
}

.book .book-body h4 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1.1em;
  color: #533483;
  margin-top: 25px;
}

/* ---------- Header / Sidebar ---------- */
.book .book-header {
  border-bottom: 2px solid #e94560;
  background: #ffffff;
}

.book .book-header h1 {
  font-family: 'Times New Roman', Times, serif;
  font-weight: 700;
  font-size: 1.1em;
  color: #16213e;
  opacity: 1;
}

.book .book-summary {
  background: #f8f9fc;
  border-right: 1px solid #e8e8f0;
}

.book .book-summary ul.summary li a {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #4a4a6a;
  padding: 8px 20px;
  transition: all 0.2s ease;
}

.book .book-summary ul.summary li a:hover {
  color: #e94560;
  background: #fff0f2;
  text-decoration: none;
}

.book .book-summary ul.summary li.active > a {
  color: #e94560;
  font-weight: 600;
  background: #fff0f2;
  border-left: 3px solid #e94560;
}

/* ---------- Callout Boxes ---------- */
.tip, .note, .warning, .important {
  padding: 18px 22px;
  margin: 24px 0;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.65;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.tip {
  background-color: #f0fdf4;
  border-left: 5px solid #22c55e;
  color: #14532d;
}

.note {
  background-color: #eff6ff;
  border-left: 5px solid #3b82f6;
  color: #1e3a5f;
}

.warning {
  background-color: #fffbeb;
  border-left: 5px solid #f59e0b;
  color: #78350f;
}

.important {
  background-color: #fef2f2;
  border-left: 5px solid #ef4444;
  color: #7f1d1d;
}

/* ---------- Code Blocks ---------- */
code {
  background-color: #f4f4f8;
  color: #c7254e;
  padding: 2px 7px;
  border-radius: 5px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Source Code Pro', monospace;
  font-size: 0.88em;
  font-weight: 500;
  border: 1px solid #e8e8f0;
}

pre {
  background-color: #1e1e2e;
  color: #cdd6f4;
  padding: 18px 22px;
  border-radius: 10px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13.5px;
  line-height: 1.6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin: 20px 0;
}

pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
  border: none;
  font-size: inherit;
}

/* Syntax highlighting colors */
pre .hljs-keyword { color: #cba6f7; }
pre .hljs-string { color: #a6e3a1; }
pre .hljs-number { color: #fab387; }
pre .hljs-comment { color: #6c7086; font-style: italic; }
pre .hljs-function { color: #89b4fa; }
pre .hljs-operator { color: #89dceb; }

/* ---------- Tables ---------- */
.book .book-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 20px 0;
  font-size: 14.5px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.book .book-body table thead {
  background: #16213e;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.book .book-body table th,
.book .book-body table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e8e8f0;
}

.book .book-body table tbody tr:nth-child(even) {
  background: #f8f9fc;
}

.book .book-body table tbody tr:hover {
  background: #fff0f2;
}

/* ---------- Blockquotes ---------- */
.book .book-body blockquote {
  border-left: 4px solid #e94560;
  background: #fafafa;
  padding: 14px 20px;
  margin: 20px 0;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: #555;
}

/* ---------- Links ---------- */
.book .book-body a {
  color: #e94560;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.book .book-body a:hover {
  border-bottom-color: #e94560;
}

/* ---------- Lists ---------- */
.book .book-body ul li,
.book .book-body ol li {
  margin-bottom: 6px;
}

/* ---------- Page Title ---------- */
.book .book-body .page-inner .page-header {
  margin-bottom: 30px;
}

/* ---------- Smooth scrolling ---------- */
html {
  scroll-behavior: smooth;
}

/* ---------- Print styles ---------- */
@media print {
  .book .book-summary {
    display: none;
  }
  .book .book-body {
    left: 0;
  }
}