﻿/* ============================================
   The Agentic OS — Custom mdBook Theme
   ============================================ */

/* --- Typography --- */

:root {
  --sidebar-width: 320px;
  --content-max-width: 820px;
  --sidebar-resize-indicator-width: 4px;
}

.content main {
  font-size: 1.05rem;
  line-height: 1.78;
  letter-spacing: -0.003em;
}

h1 {
  font-size: 2.2em;
  margin-top: 0;
  margin-bottom: 0.6em;
  padding-bottom: 0.3em;
  border-bottom: 2px solid var(--sidebar-separator);
}

h2 {
  font-size: 1.55em;
  margin-top: 2em;
  margin-bottom: 0.5em;
  padding-bottom: 0.2em;
  border-bottom: 1px solid var(--sidebar-separator);
}

h3 {
  font-size: 1.25em;
  margin-top: 1.6em;
  margin-bottom: 0.4em;
}

/* --- Blockquotes (used for the book's epigraph style) --- */

blockquote {
  border-left: 4px solid #10b981;
  padding: 0.8em 1.2em;
  margin: 1.5em 0;
  background: rgba(16, 185, 129, 0.05);
  border-radius: 0 6px 6px 0;
  font-style: italic;
}

.navy blockquote,
.ayu blockquote,
.coal blockquote {
  background: rgba(16, 185, 129, 0.08);
}

/* --- Code blocks --- */

pre {
  border-radius: 6px;
  padding: 1em 1.2em;
  margin: 1.2em 0;
  line-height: 1.5;
}

code {
  border-radius: 3px;
  padding: 0.15em 0.35em;
  font-size: 0.9em;
}

/* --- Tables --- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95em;
}

table th {
  background: rgba(16, 185, 129, 0.1);
  padding: 0.7em 1em;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--sidebar-separator);
}

table td {
  padding: 0.6em 1em;
  border-bottom: 1px solid var(--sidebar-separator);
}

table tr:hover td {
  background: rgba(16, 185, 129, 0.03);
}

.navy table tr:hover td,
.ayu table tr:hover td,
.coal table tr:hover td {
  background: rgba(16, 185, 129, 0.06);
}

/* --- Horizontal rules (part separators) --- */

hr {
  border: none;
  border-top: 2px solid var(--sidebar-separator);
  margin: 2.5em 0;
}

/* --- Sidebar refinements --- */

.sidebar .sidebar-scrollbox {
  padding: 10px 20px;
}

.sidebar ol.chapter li.chapter-item {
  margin-top: 0.4em;
}

.sidebar ol.chapter li.part-title {
  font-size: 0.85em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 1.8em;
  margin-bottom: 0.3em;
  color: var(--sidebar-fg);
  opacity: 0.7;
}

/* --- Navigation buttons --- */

.nav-chapters {
  font-size: 2em;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.nav-chapters:hover {
  opacity: 1;
}

/* --- Print styles --- */

@media print {
  .content main {
    max-width: 100%;
    font-size: 11pt;
    line-height: 1.6;
  }

  h1 {
    page-break-before: always;
  }

  h1:first-of-type {
    page-break-before: avoid;
  }

  pre {
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }

  table {
    page-break-inside: avoid;
  }
}

/* --- ASCII diagrams in code blocks --- */

pre code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Source Code Pro', monospace;
}

/* --- Lists --- */

.content main ul,
.content main ol {
  margin: 0.8em 0;
  padding-left: 1.8em;
}

.content main li {
  margin: 0.3em 0;
}

.content main li > p {
  margin: 0.3em 0;
}

/* --- Strong/emphasis styling --- */

strong {
  font-weight: 700;
}

/* --- Pattern chapter formatting --- */

.content main h3 + h3 {
  margin-top: 1em;
}

/* --- Zoom controls --- */

/* --- Mermaid diagrams --- */

.mermaid {
  text-align: center;
  margin: 1.5em 0;
  padding: 1em;
  background: rgba(16, 185, 129, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, 0.08);
  overflow-x: auto;
}

.navy .mermaid,
.ayu .mermaid,
.coal .mermaid {
  background: rgba(16, 185, 129, 0.04);
  border-color: rgba(16, 185, 129, 0.12);
}

.mermaid svg {
  max-width: 100%;
  height: auto;
}

.mermaid svg {
  max-width: 100%;
  height: auto;
}

@media print {
  .mermaid {
    page-break-inside: avoid;
  }
}

/* --- Zoom controls --- */

#zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 8px;
  vertical-align: middle;
}

#zoom-controls button {
  background: none;
  border: 1px solid var(--sidebar-separator);
  color: var(--icons);
  cursor: pointer;
  font-size: 0.85em;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 0;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

#zoom-controls button:hover {
  background: var(--sidebar-separator);
  color: var(--icons-hover);
}

#zoom-level {
  font-size: 0.75em;
  min-width: 38px;
  text-align: center;
  color: var(--icons);
  user-select: none;
}

@media print {
  #zoom-controls {
    display: none;
  }
}
