/* Palimpsest mdBook Theme — Seuil-inspired
 * Matches the main site: Inter font, #f8f7f4 bg, #4f46e5 accent
 */

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

:root {
  --sidebar-width: 280px;
  --page-padding: 12px;
  --content-max-width: 820px;
}

/* ── Light Theme (Seuil) ── */
.light {
  --bg: #f8f7f4;
  --fg: #0f172a;
  --sidebar-bg: #f1f0ed;
  --sidebar-fg: #475569;
  --sidebar-non-existant: #94a3b8;
  --sidebar-active: #4f46e5;
  --sidebar-spacer: #e2e8f0;
  --scrollbar: #cbd5e1;
  --icons: #64748b;
  --icons-hover: #4f46e5;
  --links: #4f46e5;
  --inline-code-color: #4f46e5;
  --theme-popup-bg: #ffffff;
  --theme-popup-border: #e2e8f0;
  --theme-hover: #f1f5f9;
  --quote-bg: rgba(79, 70, 229, 0.04);
  --quote-border: #4f46e5;
  --table-border-color: #e2e8f0;
  --table-header-bg: #f8f7f4;
  --table-alternate-bg: #fafaf9;
  --searchbar-border-color: #e2e8f0;
  --searchbar-bg: #ffffff;
  --searchbar-fg: #0f172a;
  --searchbar-shadow-color: rgba(0,0,0,0.05);
  --searchresults-header-fg: #475569;
  --searchresults-border-color: #e2e8f0;
  --searchresults-li-bg: #fafaf9;
  --search-mark-bg: #c7d2fe;
  --warning-border: #f59e0b;
  --copy-button-bg: #f1f5f9;
  --copy-button-fg: #64748b;
}

/* ── Typography ── */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.content main {
  font-size: 0.95rem;
  line-height: 1.75;
  color: #475569;
  font-weight: 300;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', system-ui, sans-serif !important;
  color: #0f172a;
  font-weight: 500;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2rem;
  font-weight: 300;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 400;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f1f5f9;
}

h3 {
  font-size: 1.15rem;
  font-weight: 500;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  color: #1e293b;
}

h4 {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #4f46e5;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
}

strong {
  font-weight: 500;
  color: #0f172a;
}

/* ── Sidebar ── */
.sidebar .sidebar-scrollbox {
  padding: 1.5rem 1rem;
}

.sidebar ol.chapter {
  padding-left: 0;
}

.sidebar ol.chapter li {
  margin: 0.15rem 0;
}

.sidebar ol.chapter li a {
  font-size: 0.82rem;
  font-weight: 400;
  color: #475569;
  padding: 0.3rem 0.6rem;
  border-radius: 0.25rem;
  transition: all 0.15s;
  display: block;
}

.sidebar ol.chapter li a:hover {
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.06);
}

.sidebar ol.chapter li.chapter-item.expanded a.active,
.sidebar ol.chapter li a.active {
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.08);
  font-weight: 500;
  border-left: 2px solid #4f46e5;
  padding-left: calc(0.6rem - 2px);
}

.sidebar .sidebar-scrollbox .chapter li.part-title {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 1.25rem 0.6rem 0.35rem;
  margin-top: 0.5rem;
}

/* ── Code ── */
code {
  font-family: 'Geist Mono', ui-monospace, 'SF Mono', monospace !important;
  font-size: 0.85em;
}

:not(pre) > code {
  background: rgba(79, 70, 229, 0.07);
  color: #4f46e5;
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  font-weight: 400;
}

pre {
  background: #1e293b !important;
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
  line-height: 1.6;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

pre > code {
  color: #e2e8f0;
  font-size: 0.82rem;
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.88rem;
}

table th {
  background: #f8f7f4;
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid #e2e8f0;
}

table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #475569;
  vertical-align: top;
}

table tr:hover td {
  background: #fafaf9;
}

table code {
  font-size: 0.8rem;
}

/* ── Blockquotes / Callouts ── */
blockquote {
  background: rgba(79, 70, 229, 0.04);
  border-left: 3px solid #4f46e5;
  padding: 1rem 1.25rem;
  border-radius: 0 0.375rem 0.375rem 0;
  margin: 1.5rem 0;
  color: #475569;
}

blockquote p {
  margin-bottom: 0.5rem;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ── Links ── */
a {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 400;
  transition: color 0.15s;
}

a:hover {
  color: #4338ca;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* ── Lists ── */
ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.35rem;
  line-height: 1.65;
}

/* ── Horizontal Rules ── */
hr {
  border: none;
  height: 1px;
  background: #e2e8f0;
  margin: 2.5rem 0;
}

/* ── Nav buttons ── */
.nav-chapters {
  font-size: 0.8rem;
  font-weight: 400;
  color: #4f46e5;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.nav-chapters:hover {
  opacity: 1;
  color: #4338ca;
}

/* ── Search ── */
#searchbar {
  font-family: 'Inter', system-ui, sans-serif !important;
  font-size: 0.85rem;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
}

.search-results .search-results-title {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
}

/* ── Menu bar ── */
.menu-bar {
  background: rgba(248, 247, 244, 0.9) !important;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #f1f5f9;
}

.menu-bar .icon-button {
  color: #64748b;
  transition: color 0.15s;
}

.menu-bar .icon-button:hover {
  color: #4f46e5;
}

/* ── Admonitions (custom styling for > **Note:**, > **Warning:** etc.) ── */
blockquote strong {
  color: #4f46e5;
}

/* ── Definition-style lists for API docs ── */
.content main dl {
  margin: 1rem 0;
}

.content main dt {
  font-family: 'Geist Mono', monospace;
  font-size: 0.88rem;
  color: #0f172a;
  font-weight: 500;
  margin-top: 1rem;
  padding: 0.4rem 0.6rem;
  background: #f8f7f4;
  border-radius: 0.25rem;
  border-left: 2px solid #4f46e5;
}

.content main dd {
  margin-left: 1.5rem;
  margin-bottom: 0.5rem;
  color: #475569;
  font-size: 0.9rem;
}

/* ── Chapter header decorations ── */
.content main > h1::before {
  content: '';
  display: block;
  width: 2.5rem;
  height: 2px;
  background: #4f46e5;
  margin-bottom: 1rem;
}

/* ── Back to site link (injected via head.hbs) ── */
.back-to-site {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #94a3b8;
  text-decoration: none;
  padding: 0.3rem 0;
  transition: color 0.15s;
}

.back-to-site:hover {
  color: #4f46e5;
  text-decoration: none;
}

/* ── Responsive ── */
@media (max-width: 1080px) {
  :root {
    --content-max-width: 100%;
  }
}

@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  pre { padding: 1rem; }
  table { font-size: 0.8rem; }
}
