/* Halcyonic Systems — Verso Theme Override */
/* Foundations for Mathematical Systems Science */

:root {
  --halcyonic-cream: #FAFAF7;
  --halcyonic-gold: #8B6914;
  --halcyonic-gold-light: #a67f1a;
  --halcyonic-dark: #1C1917;
  --halcyonic-code-bg: #F0EBE2;
  --halcyonic-code-border: #8B6914;
  --halcyonic-quote-bg: #F5F0E8;
  --halcyonic-hover-bg: #EDE7DB;

  /* Verso code highlighting — light-on-light scheme */
  --verso-code-color: #3a3530;
  --verso-code-const-color: #3a3530;
  --verso-code-keyword-color: #8B6914;
  --verso-code-var-color: #2a6e5a;
}

body {
  font-family: Georgia, 'Times New Roman', serif !important;
  background: var(--halcyonic-cream) !important;
  color: var(--halcyonic-dark) !important;
  line-height: 1.7;
}

h1, h2, h3, h4 {
  color: var(--halcyonic-gold) !important;
  font-family: Georgia, 'Times New Roman', serif !important;
}

/* === CODE BLOCKS === */

pre, code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace !important;
}

/* Main Lean code blocks — warm light, not dark */
.hl.lean,
.hl.lean.block,
code.hl.lean {
  background: var(--halcyonic-code-bg) !important;
  color: #3a3530 !important;
  border-left: 3px solid var(--halcyonic-code-border) !important;
  border-radius: 0 5px 5px 0;
  padding: 1.25rem 1.5rem !important;
}

/* Inline lean code */
.hl.lean.inline {
  background: rgba(240, 235, 226, 0.6) !important;
  color: var(--halcyonic-dark) !important;
  border-left: none !important;
  padding: 0.15rem 0.4rem !important;
  border-radius: 3px;
  font-size: 0.9em;
}

/* === SYNTAX HIGHLIGHTING (light background) === */

.hl.lean .keyword,
.hl.lean .atom {
  color: #8B6914 !important;
  font-weight: bold;
}

.hl.lean .const {
  color: #3a3530 !important;
}

.hl.lean .type {
  color: #2a6e5a !important;
}

.hl.lean .var {
  color: #4a6e8a !important;
  font-style: italic;
}

.hl.lean .literal,
.hl.lean .number {
  color: #b35a3a !important;
}

.hl.lean .string {
  color: #8a5a2a !important;
}

.hl.lean .comment {
  color: #8a8478 !important;
  font-style: italic;
}

/* Links inside lean blocks */
.hl.lean a,
.hl.lean a:visited {
  color: #2a6e5a !important;
  text-decoration: none;
}

.hl.lean a:hover {
  color: #1a5a48 !important;
  text-decoration: underline;
}

/* === LEAN OUTPUT (#check, #eval results) === */

.lean-output,
.lean-output.information {
  background: var(--halcyonic-code-bg) !important;
  color: #3a3530 !important;
  border-left-color: #2a6e5a !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 0 3px 3px 0;
  margin: 0.5rem 0.85rem !important;
}

.lean-output *,
.lean-output.information * {
  color: #3a3530 !important;
}

.lean-output.warning {
  border-left-color: #a67f1a !important;
}

.lean-output.error {
  border-left-color: #b35a3a !important;
}

/* === HOVER POPUPS === */
/* Verso injects inline <style> with hardcoded black text / #e5e5e5 bg */
/* Must use !important on everything to override */

.hl.lean .hover-info,
.hl.lean .token .hover-info,
.hl.lean .hover-info.messages {
  background-color: var(--halcyonic-hover-bg) !important;
  border: 1px solid #cdc5b5 !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
  color: #3a3530 !important;
  padding: 0.6rem 0.8rem !important;
}

.hl.lean .hover-info code,
.hl.lean .hover-info.messages > code,
.hl.lean .hover-info * {
  color: #3a3530 !important;
  background: none !important;
}

.hl.lean .hover-info .keyword,
.hl.lean .hover-info .atom {
  color: #8B6914 !important;
}

.hl.lean .hover-info .const {
  color: #3a3530 !important;
}

.hl.lean .hover-info .type,
.hl.lean .hover-info a {
  color: #2a6e5a !important;
}

.hl.lean .hover-info .var {
  color: #4a6e8a !important;
}

.hl.lean .hover-info .literal,
.hl.lean .hover-info .number {
  color: #b35a3a !important;
}

/* Tippy fallback */
.tippy-box {
  background: var(--halcyonic-hover-bg) !important;
  color: #3a3530 !important;
  border: 1px solid #cdc5b5 !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
}

.tippy-box * {
  color: #3a3530 !important;
}

.tippy-box[data-placement^='top'] > .tippy-arrow::before { border-top-color: var(--halcyonic-hover-bg) !important; }
.tippy-box[data-placement^='bottom'] > .tippy-arrow::before { border-bottom-color: var(--halcyonic-hover-bg) !important; }
.tippy-box[data-placement^='left'] > .tippy-arrow::before { border-left-color: var(--halcyonic-hover-bg) !important; }
.tippy-box[data-placement^='right'] > .tippy-arrow::before { border-right-color: var(--halcyonic-hover-bg) !important; }

/* === BLOCKQUOTES === */

blockquote {
  background: var(--halcyonic-quote-bg) !important;
  border-left: 3px solid var(--halcyonic-gold) !important;
  padding: 1rem 1.25rem !important;
  margin: 0 !important;
  font-style: italic;
}

/* Fix Verso empty blockquote bars — consecutive blockquotes should merge visually */
blockquote + blockquote {
  border-top: none !important;
  padding-top: 0 !important;
}

/* Hide empty blockquotes entirely */
blockquote:empty {
  display: none !important;
}

/* Blockquote that only contains whitespace */
blockquote:not(:has(*)):not(:empty) {
  display: none !important;
}

/* === MATH === */

.math.display {
  margin: 1.5rem 0 !important;
}

/* === NAVIGATION === */

nav a, .toc a {
  color: var(--halcyonic-dark) !important;
}

nav a:hover, .toc a:hover {
  color: var(--halcyonic-gold) !important;
}

.current > a {
  color: var(--halcyonic-gold) !important;
  font-weight: bold;
}

/* === LINKS === */

a {
  color: var(--halcyonic-gold);
}

a:hover {
  color: #6B5010;
}

/* === PAGE LAYOUT === */

.page {
  background: var(--halcyonic-cream) !important;
}

header, .local-nav {
  background: var(--halcyonic-cream) !important;
  border-color: #E8E0D0 !important;
}

.header-title-wrapper {
  overflow: hidden !important;
  margin-right: 0.5rem !important;
}

.header-title {
  margin: 0 !important;
}

.header-title h1 {
  text-wrap: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 1.4rem !important;
}

/* === SPACING FIXES === */

/* Reduce excessive margins on code blocks */
.hl.lean.block {
  margin-top: 0.75em !important;
  margin-bottom: 0.75em !important;
}

/* Tighten spacing between consecutive blockquotes */
blockquote + blockquote:not(:empty) {
  margin-top: -0.5rem !important;
}
