/* LearnaOS theme
   Identity: reading-first. Serif body for long-form course content,
   a monospace file-index sidebar, and a signature dark "console" surface
   for every code block regardless of page theme. */

:root {
  --paper: #fcfcfa;
  --panel: #f3f5f4;
  --ink: #15212b;
  --ink-soft: #4a5a63;
  --ink-faint: #7a8b92;
  --border: #e3e7e5;
  --border-strong: #cdd5d1;
  --accent: #0e7c66;
  --accent-ink: #0b5f4e;
  --accent-soft: #dcefe8;
  --link: #0e6f7c;

  /* console surface — constant across themes (the signature) */
  --console-bg: #0e1a24;
  --console-edge: #1d2c38;
  --console-text: #d6deda;

  --serif: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;

  --sidebar-w: 300px;
  --measure: 46rem;
}

html[data-theme="dark"] {
  --paper: #0f1418;
  --panel: #141b20;
  --ink: #dde5e2;
  --ink-soft: #aab6b2;
  --ink-faint: #7c8a86;
  --border: #232d33;
  --border-strong: #2f3b42;
  --accent: #3fb79c;
  --accent-ink: #66c9b1;
  --accent-soft: #16302a;
  --link: #4fc0cf;
  --console-bg: #0a1116;
  --console-edge: #1a242c;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Sidebar (file index) ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.brand a { color: var(--ink); }
.brand a:hover { text-decoration: none; color: var(--accent); }

.nav-search {
  margin: 14px 16px 6px;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  outline: none;
}
.nav-search:focus { border-color: var(--accent); }

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 28px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.4;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:hover { background: var(--accent-soft); color: var(--ink); text-decoration: none; }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-icon {
  flex: none;
  width: 17px;
  text-align: center;
  font-size: 0.66rem;
  color: var(--ink-faint);
}
.kind-notebook { color: #c8732f; }
.kind-code { color: var(--accent); }
.kind-csv { color: #6a7bb0; }

.nav-group { margin: 1px 0; }
.nav-group > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { background: var(--border); }
.nav-caret {
  display: inline-block;
  font-size: 0.6rem;
  color: var(--ink-faint);
  transition: transform 0.15s ease;
}
.nav-group[open] > summary .nav-caret { transform: rotate(90deg); }
.nav-dir-link { color: inherit; }
.nav-dir-link:hover { color: var(--accent); text-decoration: none; }
.nav-children { padding-left: 12px; border-left: 1px solid var(--border); margin-left: 14px; }

.sidebar-foot {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-faint);
  padding: 12px 22px;
  border-top: 1px solid var(--border);
}

/* ---------- Content ---------- */
.content {
  margin-left: var(--sidebar-w);
  padding: 56px 7vw 120px;
}
.doc { max-width: var(--measure); margin: 0 auto; }

.doc h1, .doc h2, .doc h3, .doc h4 {
  font-family: var(--sans);
  line-height: 1.25;
  letter-spacing: -0.012em;
  margin: 2.2em 0 0.6em;
  scroll-margin-top: 24px;
}
.doc h1 { font-size: 2.1rem; margin-top: 0; font-weight: 800; }
.doc h2 {
  font-size: 1.5rem;
  font-weight: 700;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
}
.doc h3 { font-size: 1.2rem; font-weight: 700; }
.doc h4 { font-size: 1.02rem; font-weight: 700; color: var(--ink-soft); }
.doc p { margin: 0 0 1.1em; }
.doc ul, .doc ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.doc li { margin: 0.3em 0; }
.doc blockquote {
  margin: 1.2em 0;
  padding: 0.2em 1.1em;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
}
.doc img { max-width: 100%; height: auto; border-radius: 8px; }
.doc hr { border: none; border-top: 1px solid var(--border); margin: 2.4em 0; }

.anchor {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.7em;
  margin-right: 0.4em;
  opacity: 0;
  text-decoration: none;
}
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; }

/* inline code */
.doc :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.4em;
  color: var(--accent-ink);
}

/* ---------- Console code surface (signature) ---------- */
.code-block, .code-file {
  background: var(--console-bg);
  border: 1px solid var(--console-edge);
  border-radius: 10px;
  margin: 1.4em 0;
  overflow: hidden;
  position: relative;
}
.code-block[data-lang]::before, .code-file[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0; right: 0;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--console-bg);
  background: var(--accent);
  padding: 3px 10px;
  border-bottom-left-radius: 8px;
}
.code-block pre, .code-file .code {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
}
.code-block code, .code-file code {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--console-text);
}
.copy-btn {
  position: absolute;
  bottom: 8px; right: 10px;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--console-text);
  background: var(--console-edge);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.code-block:hover .copy-btn, .code-file:hover .copy-btn { opacity: 0.85; }
.copy-btn:hover { opacity: 1; border-color: var(--accent); }

/* code file with line gutter */
.code-file { display: grid; grid-template-columns: auto 1fr; }
.code-file .gutter {
  margin: 0;
  padding: 18px 12px;
  text-align: right;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: #51626d;
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid var(--console-edge);
  user-select: none;
  white-space: pre;
}

/* ---------- Notebook ---------- */
.notebook { margin-top: 0.5em; }
.nb-cell { margin: 1.1em 0; }
.nb-md { font-family: var(--serif); }
.nb-prompt {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
  margin-bottom: 4px;
}
.nb-output {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--panel);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.nb-stderr { background: #fdecec; color: #8a2b2b; }
html[data-theme="dark"] .nb-stderr { background: #2a1818; color: #e69a9a; }
.nb-error { background: #fdecec; color: #8a2b2b; }
html[data-theme="dark"] .nb-error { background: #2a1818; color: #e69a9a; }
.nb-image { padding: 14px 16px; background: #fff; border: 1px solid var(--border); border-top: none; border-radius: 0 0 10px 10px; text-align: center; }
.nb-image img { max-width: 100%; }
.nb-html { padding: 8px 4px; overflow-x: auto; }
.nb-result { color: var(--ink-soft); }
.nb-code .code-block { margin-bottom: 0; border-radius: 10px 10px 0 0; }
.nb-code:has(.nb-output) .code-block { border-bottom: none; }

/* ---------- Tables / data ---------- */
.table-wrap { overflow-x: auto; margin: 1.2em 0; border: 1px solid var(--border); border-radius: 10px; }
table.data-table, .doc table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--sans);
  font-size: 0.85rem;
}
.doc table { margin: 1.2em 0; }
.data-table th, .data-table td, .doc th, .doc td {
  text-align: left;
  padding: 8px 13px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table thead th, .doc thead th {
  background: var(--panel);
  font-weight: 700;
  position: sticky;
  top: 0;
}
.data-table tbody tr:hover { background: var(--accent-soft); }
.data-meta { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-faint); margin-bottom: 6px; }

/* ---------- Callouts / index page ---------- */
.callout {
  margin: 1.2em 0;
  padding: 12px 16px;
  border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 0.9rem;
}
.callout.error { background: #fdecec; border-color: #f3c9c9; color: #8a2b2b; }

.page-eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.index-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 1.4em 0; }
.index-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel);
  font-family: var(--sans);
}
.index-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.index-card .ic-kind { font-family: var(--mono); font-size: 0.66rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.index-card .ic-title { font-weight: 700; color: var(--ink); margin-top: 3px; }
.gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin: 1.4em 0; }
.gallery a { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
.gallery img { width: 100%; height: 130px; object-fit: cover; display: block; }

/* ---------- Mobile ---------- */
.menu-toggle, .scrim { display: none; }
@media (max-width: 860px) {
  body { font-size: 17px; }
  .sidebar { transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: 0 0 40px rgba(0,0,0,0.18); }
  body.nav-open .sidebar { transform: translateX(0); }
  .content { margin-left: 0; padding: 76px 6vw 100px; }
  .menu-toggle {
    display: block;
    position: fixed;
    top: 14px; left: 14px;
    z-index: 40;
    width: 42px; height: 42px;
    font-size: 1.1rem;
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    cursor: pointer;
  }
  body.nav-open .scrim {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.32);
    z-index: 25;
  }
}

/* ---------- highlight.js (tuned for the dark console surface) ---------- */
.hljs-comment, .hljs-quote { color: #6b7d77; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-section, .hljs-link { color: #5fb3a1; }
.hljs-string, .hljs-bullet, .hljs-addition { color: #a8d8c4; }
.hljs-number, .hljs-symbol, .hljs-meta .hljs-number { color: #f3b562; }
.hljs-title, .hljs-title.function_, .hljs-function .hljs-title { color: #82c7ff; }
.hljs-built_in, .hljs-class .hljs-title, .hljs-title.class_ { color: #ffcb6b; }
.hljs-type, .hljs-params { color: #c9d4cf; }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-variable, .hljs-template-variable { color: #82c7ff; }
.hljs-tag, .hljs-name, .hljs-selector-id, .hljs-selector-class { color: #5fb3a1; }
.hljs-regexp, .hljs-deletion { color: #e0a8d0; }
.hljs-meta, .hljs-comment.hljs-doctag { color: #8a9aa0; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }
.hljs-deletion { background: #3a1c1c; }
.hljs-addition { background: #18301f; }
/* LearnaOS hosted course — back to marketing site */
.learnaos-site-home-sidebar {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  background: var(--paper);
}
.learnaos-site-home-sidebar:hover {
  text-decoration: none;
  color: var(--ink);
  background: var(--panel);
}
.learnaos-site-home-bar {
  position: sticky;
  top: 0;
  z-index: 15;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.learnaos-site-home-bar-link {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.learnaos-site-home-bar-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

