/* [[file:web/templates.org::arcology-css][arcology-css]] */
/* [[id:20260826T193521.010764]] */

/* ── Color variables (default — per-site CSS overrides these) ── */
:root {
  --alert: #cc6960;
  --primary: #707231;
  --secondary: #ebbe7b;
  --success: #67b4f8;
  --warning: #7e5c41;
  --white: #fcf6ed;
  --light-gray: #f6e5cb;
  --medium-gray: #baad9b;
  --dark-gray: #82796c;
  --black: #211f1c;
  --max-content: 55ch;
  --sidebar-width: 22ch;
}

/* ── Body ── */
body {
  font-family: "Vulf Mono", monospace;
  font-style: italic;
  font-size: medium;
  background-color: var(--white);
  color: var(--black);
  margin: 0;
}

/* ── Links ── */
a         { color: var(--primary); }
a:visited { color: var(--warning); }
a:hover   { text-decoration: underline; }
/* Additional in per-site css... */

code      { font-style: normal; }

/* ── Headings ── */
h1, h2, h3, h4, h5, h6 {
  font-family: "Vulf Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
}

/* ── Header ── */
header {
  background-color: var(--light-gray);
  border-bottom: 2px solid var(--dark-gray);
}
header > .header-content {
  padding: 1em;
  max-width: 120ch;
  margin-left: auto;
  margin-right: auto;
}
header h1, header h2 {
  margin-top: 0;
  display: inline;
  font-style: normal;
}
header h2:before { content: " — "; }

/* ── Footer ── */
footer {
  margin-left: auto;
  margin-right: auto;
  max-width: 120ch;
  font-size: smaller;
  text-align: center;
  padding: 1em;
}
footer a { font-weight: 500; }
footer p { max-width: 60ch; margin: 0.5em auto; }

nav.cross-site {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--dark-gray);
}

/* ── Content layout (flexbox: main + sidebar) ── */
.content {
  margin-left: auto;
  margin-right: auto;
  padding: 1em;
  padding-top: 0;
  display: flex;
  flex-flow: row wrap;
  max-width: 120ch;
}
.content > section, main {
  display: inline-block;
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: 40em;
  padding: 1em;
  overflow: auto;
}
.content > section.sidebar {
  flex-grow: 0;
  flex-shrink: 1;
  flex-basis: 30ch;
}

/* ── Sidebar ── */
section.sidebar {
  display: flex;
  flex-flow: column wrap;
}
section.sidebar > div.backlinks { flex-grow: 1; }
.content > .sidebar ul { list-style: none; padding-left: 0; }
.content > .sidebar li { margin: 0.25rem 0; }
.content > .sidebar h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--black);
  margin: 1rem 0 0.5rem;
}

/* ── Inline heading backlinks and references ── */
/* Clustered under each heading (topic.peb / wide.peb) rather than in the sidebar.
   The renderer emits <section class="heading-backlinks"> / <section class="heading-refs">
   after headings that have incoming links or external references. */
.heading-backlinks, .heading-refs {
  margin: 0.5rem 0 1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--medium-gray);
  font-size: 0.85rem;
  color: var(--dark-gray);
}
.heading-backlinks h4, .heading-refs h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0.25rem 0;
  color: var(--black);
}
.heading-backlinks ul, .heading-refs ul {
  list-style: none;
  padding-left: 0;
}
.heading-backlinks li, .heading-refs li { margin: 0.15rem 0; }
.heading-backlinks a, .heading-refs a { color: var(--primary); }
.heading-backlinks a:visited, .heading-refs a:visited { color: var(--secondary); }

/* ── Mobile collapsible TOC ── */
/* Hidden on wide screens where the sidebar TOC is visible. Shown via the
   narrow-viewport media query below. Indentation mirrors the sidebar rules
   so the outline looks the same collapsed or expanded. */
.top-toc { display: none; }
.top-toc > summary, .wide .heading > summary {
  font-family: "Vulf Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--black);
  margin: 1rem 0 0.5rem;
  cursor: pointer;
}

ul.headings { list-style: none; padding-left: 0; }
ul.headings li { margin: 0.25rem 0; }
ul.headings li.level-2 { margin-left: 1em; }
ul.headings li.level-3 { margin-left: 2em; }
ul.headings li.level-4 { margin-left: 3em; }
ul.headings li.level-5 { margin-left: 4em; }

/* ── Images ── */
.content img {
  display: block;
  width: 80%;
  margin: 0 auto;
}

/* ── Task states (org TODO keywords) ── */
.task.task-DONE::before { content: '\002611  '; }
.task.task-DONE { color: var(--success); }
.task.task-NEXT::before { content: '\01F195  '; }
.task.task-NEXT { color: var(--primary); }
.task.task-INPROGRESS::before { content: '\01F51C  '; }
.task.task-INPROGRESS { color: var(--secondary); }
.task.task-WAITING::before { content: '\00231A  '; }
.task.task-WAITING { color: var(--warning); }
.task.task-CANCELLED::before { content: '\002612  '; }
.task.task-CANCELLED { color: var(--alert); }
.task {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  font-style: normal;
}

/* ── Code blocks ── */
pre, code, .verse, .latex, .math {
  font-family: "Vulf Mono", monospace;
  font-size: 0.9em;
}
pre {
  background-color: var(--light-gray);
  padding: 0.75rem 1rem;
  overflow-x: auto;
}
pre code { background: none; padding: 0; font-style: normal; }

/* ── Source block figures (literate programming) ── */
figure.src-block {
  margin: 1rem 0;
}
figure.src-block > pre {
  margin: 0;
  /* Let the highlight.js theme own the code block background. The theme CSS
     targets `code.hljs` / `.hljs`; we undo arcology's light-gray pre bg so the
     theme's bg shows through. */
  background: transparent;
  padding: 0;
}
figure.src-block > pre > code {
  display: block;
  padding: 0.75rem 1rem;
  overflow-x: auto;
}
figcaption.src-block-meta {
  font-family: "Vulf Mono", monospace;
  font-size: 0.75rem;
  font-style: normal;
  color: var(--dark-gray);
  background-color: var(--light-gray);
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--medium-gray);
  display: flex;
  flex-flow: row wrap;
  gap: 0.5rem;
}
figcaption.src-block-meta .src-lang {
  font-weight: 800;
  color: var(--black);
  text-transform: uppercase;
}
figcaption.src-block-meta .src-arg {
  white-space: nowrap;
}
figcaption.src-block-meta .src-name {
  color: var(--primary);
  font-weight: 600;
}
/* Noweb directive links inside code bodies */
.noweb-link a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-style: dotted;
}
.noweb-link a:visited {
  color: var(--secondary);
}
.noweb-link {
  font-style: normal;
}
/* Noweb backlink footers at the bottom of named source blocks */
footer.src-block-backlinks {
  font-family: "Vulf Mono", monospace;
  font-size: 0.75rem;
  font-style: normal;
  color: var(--dark-gray);
  background-color: var(--light-gray);
  padding: 0.25rem 0.5rem;
  border-top: 1px solid var(--medium-gray);
}
footer.src-block-backlinks a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-style: dotted;
}
footer.src-block-backlinks a:visited {
  color: var(--secondary);
}

/* ── Tables ── */
table { border-collapse: collapse; margin: 1rem 0; }
th, td { border: 1px solid var(--medium-gray); padding: 0.4rem 0.6rem; text-align: left; }

/* ── Blockquote, verse, fixed ── */
blockquote {
  border-left: 3pt solid var(--secondary);
  padding-left: 0.5em;
  color: var(--dark-gray);
}
.verse { white-space: pre-wrap; }
.fixed { white-space: pre-wrap; }

/* ── Sidenotes: Tufte-style margin column ── */
.sidenote {
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--dark-gray);
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--medium-gray);
}
.sidenote sup { font-weight: 600; color: var(--black); }
.margin-toggle { display: none; }

/* ── Narrow viewport: sidenotes collapse to inline toggled blocks ── */
@media (max-width: 768px) {
  .content {
    flex-direction: column;
    max-width: 100%;
    padding: 1rem;
  }
  .content > main { max-width: 100%; }
  .content > .sidebar {
    flex: 1 1 auto;
    border-left: none;
    border-top: 1px solid var(--medium-gray);
    padding-left: 0;
    padding-top: 1rem;
  }
  /* Hide the sidebar TOC on mobile — the collapsible .top-toc at the
     top of the content block takes over. Other sidebar panels
     (backlinks, tags, references, keywords) still stack below. */
  section.sidebar > .headings { display: none; }
  .top-toc { display: block; }
  .margin-toggle { display: inline; }
  .margin-toggle[type="checkbox"] { display: none; }
  .margin-toggle + .sidenote-ref { display: inline; }
  label.margin-toggle { cursor: pointer; color: var(--primary); font-size: 0.8rem; }
  .sidenote {
    display: none;
    border-left: none;
    padding: 0.5rem 0.75rem;
    background: var(--light-gray);
  }
  .margin-toggle:checked ~ .sidenote { display: block; }
}

/* ── Misc ── */
.unpublished { color: #999; text-decoration: line-through; }
.hashtag { color: var(--dark-gray); }
.cloze { background: var(--light-gray); padding: 0 0.2rem; border-radius: 0.2rem; }
/* arcology-css ends here */