/* Minimal site styles — external assets only */

:root {
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --bg: #0b0f19;
  --border: #1e293b;
  --link: #ffffff;
  --code-bg: #020617;
  --callout-note: rgba(165, 180, 252, 0.15);
  --callout-warning: rgba(253, 230, 138, 0.15);
  --callout-important: rgba(252, 165, 165, 0.15);
  --callout-tip: rgba(134, 239, 172, 0.15);
  --callout-caution: rgba(253, 186, 116, 0.15);
}



*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Source Serif 4", Georgia, serif;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3, h4, h5, h6, .site-title, .toc-title, .breadcrumb, .page-toc a {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--text);
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 2px solid var(--text-muted);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--bg);
  color: var(--link);
  padding: 8px;
  z-index: 100;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* Header */
.site-header {
  padding: 2.5rem 1rem 1.5rem;
  text-align: center;
}

.header-inner {
  max-width: 42rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.site-title {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.95rem;
}

.site-nav a {
  text-decoration: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.site-nav a.site-title,
.site-nav a.site-title:hover,
.site-nav a.site-title[aria-current="page"] {
  text-decoration: none;
}

/* Main */
.site-main {
  max-width: 65rem; /* Expanded to allow room for the sidebar */
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.content-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .content-wrapper {
    grid-template-columns: minmax(0, 42rem) 220px;
    gap: 4rem;
    align-items: start;
    justify-content: center;
  }
}

.page-header h1 {
  font-size: 1.75rem;
  margin: 0 0 1rem;
  line-height: 1.25;
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
  color: var(--text);
}

/* Sidebar & TOC */
.sidebar-right {
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  display: none;
}

@media (min-width: 1024px) {
  .sidebar-right {
    display: block;
  }
}

.page-toc {
  font-size: 0.85rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}

.page-toc .toc-title {
  margin: 0 0 0.75rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.page-toc ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.page-toc li ul {
  padding-left: 0.75rem;
  margin-left: 0.25rem;
  border-left: 1px solid var(--border);
  margin-top: 0.25rem;
}

.page-toc li {
  margin: 0.4rem 0;
}

.page-toc a {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  transition: color 0.2s;
}

.page-toc a:hover {
  color: var(--text);
}

/* Typography & Book Organization */
.page-body {
  counter-reset: h1-counter;
}

.page-body h1 {
  counter-increment: h1-counter;
  counter-reset: h2-counter;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 3.5rem;
  margin-bottom: 2rem;
  line-height: 1.1;
}

.page-body h1::before {
  content: counter(h1-counter) ". ";
  color: var(--text-muted);
}

.home-body h1 {
  counter-increment: none;
}

.home-body h1::before {
  content: none;
}

.page-body h2 {
  counter-increment: h2-counter;
  counter-reset: h3-counter;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 4rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.page-body h2::before {
  content: counter(h1-counter) "." counter(h2-counter) " ";
  color: var(--text-muted);
  font-weight: 400;
}

.page-body h3 {
  counter-increment: h3-counter;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.page-body h3::before {
  content: counter(h1-counter) "." counter(h2-counter) "." counter(h3-counter) " ";
  color: var(--text-muted);
  font-weight: 400;
}

.page-body h4 {
  font-size: 1rem;
  margin-top: 1.25rem;
}

.page-body p,
.page-body ul,
.page-body ol {
  margin: 0.75rem 0;
}

.page-body img {
  max-width: 100%;
  height: auto;
}

.page-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1rem 0;
}

.page-body th,
.page-body td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.page-body th {
  background: var(--code-bg);
}

.page-body pre {
  overflow-x: auto;
  padding: 0.75rem 1rem;
  background: var(--code-bg);
  border-radius: 2px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.page-body code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
}

.page-body :not(pre) > code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.page-body blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}

.page-body iframe {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.page-body details {
  margin: 1rem 0;
}

/* Callouts */
.callout {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--border);
}

.callout p:first-child {
  margin-top: 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout-note {
  background: var(--callout-note);
  border-left-color: #0284c7;
}

.callout-warning {
  background: var(--callout-warning);
  border-left-color: #d97706;
}

.callout-important {
  background: var(--callout-important);
  border-left-color: #dc2626;
}

.callout-tip {
  background: var(--callout-tip);
  border-left-color: #059669;
}

.callout-caution {
  background: var(--callout-caution);
  border-left-color: #ea580c;
}

/* Home Index */
.home-index {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
  padding: 3rem 0;
}

.home-index a {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.15rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s ease-in-out;
}

.home-index a:hover {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* Footer */
.site-footer {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.site-footer p {
  margin: 0.35rem 0;
}

.copyright {
  font-size: 0.8rem;
}

/* KaTeX overflow */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
}
