/* ==============================================================================
   Forgeyard mdBook Custom Theme Stylesheet
   Modern, sleek dark-first design with enhanced readability & rich accents
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'Fira Code', 'JetBrains Mono', Consolas, Monaco, monospace;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: -0.01em;
}

code, pre {
  font-family: var(--font-mono) !important;
  font-size: 13.5px;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.025em;
}

h1 {
  font-size: 2.2rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, #60a5fa 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.light h1, .rust h1 {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

h2 {
  font-size: 1.55rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #38bdf8;
}

.light h2, .rust h2 {
  color: #0284c7;
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
  color: #cbd5e1;
}

.light h3, .rust h3 {
  color: #334155;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

th {
  background: rgba(30, 41, 59, 0.85);
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.light th, .rust th {
  background: #f1f5f9;
  color: #475569;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.light td, .rust td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

tr:hover td {
  background-color: rgba(255, 255, 255, 0.03);
}

.light tr:hover td, .rust tr:hover td {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Mermaid Diagrams */
div.mermaid {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

.light div.mermaid, .rust div.mermaid {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

/* Callout blocks */
blockquote {
  border-left: 4px solid #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  padding: 12px 20px;
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
}

/* Badges & Tags */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Sidebar Improvements */
.sidebar {
  font-size: 14px;
}

.sidebar .chapter li a {
  padding: 4px 10px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.sidebar .chapter li a:hover {
  background: rgba(255, 255, 255, 0.05);
}

.light .sidebar .chapter li a:hover, .rust .sidebar .chapter li a:hover {
  background: rgba(0, 0, 0, 0.05);
}
