/* Diligent Dilettante - Dark Academic Theme */
/* Matching the Eleventy blog aesthetic */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,600;0,700;0,900;1,400&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Core colors - matching Eleventy blog */
  --color-bg: #1a1412;
  --color-bg-light: #241c19;
  --color-bg-code: #1a1a1a;
  --color-text: #f5ebe0;
  --color-text-body: #d5cdc4;
  --color-text-muted: #9a8f84;
  --color-border: #4A0E0E;

  /* Crimson palette */
  --color-crimson: #8B0000;
  --color-crimson-light: #991111;
  --color-crimson-200: #FF9999;
  --color-crimson-300: #FF6666;
  --color-crimson-400: #CC0000;
  --color-oxblood: #4A0E0E;

  /* Override Verso variables */
  --verso-text-color: var(--color-text-body);
  --verso-code-color: #d4d4d4;
  --verso-structure-color: var(--color-text);
  --verso-selected-color: #2a2a3a;

  /* Messages */
  --verso-info-color: #7eb8da;
  --verso-info-indicator-color: #4777ff;
  --verso-warning-color: #e7a71d;
  --verso-warning-indicator-color: #e7a71d;
  --verso-error-color: #ff6b6b;
  --verso-error-indicator-color: #ff0000;

  /* Code highlighting - Prism dark theme colors */
  --verso-code-const-color: #ffa94d;
  --verso-code-keyword-color: #ff6b6b;
  --verso-code-var-color: #91a7ff;

  /* Typography */
  --verso-structure-font-family: "Inter", "Helvetica Neue", sans-serif;
  --verso-text-font-family: "Crimson Pro", "Georgia", serif;
  --verso-code-font-family: "JetBrains Mono", "Fira Code", monospace;
}

/* Base styles */
html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text-body);
  font-family: var(--verso-text-font-family);
  font-size: 1.125rem;
  line-height: 1.7;
}

/* Links - crimson with underline */
a {
  color: var(--color-crimson-300);
  text-decoration: underline;
  text-decoration-color: var(--color-crimson);
  text-underline-offset: 2px;
  font-weight: 600;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-crimson-200);
  text-decoration-color: var(--color-crimson-400);
}

/* Headings with colored backgrounds */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--verso-structure-font-family);
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

/* H1 - Bold crimson stripe */
h1 {
  background: var(--color-crimson-light);
  color: white;
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  padding: 1rem 1.5rem;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  position: relative;
  transform: rotate(-0.5deg);
  box-shadow: 0 4px 20px rgba(139, 0, 0, 0.4);
}

/* H2 - Oxblood stripe */
h2 {
  background: var(--color-oxblood);
  color: var(--color-crimson-200);
  font-size: 1.75rem;
  padding: 0.75rem 1.5rem;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  border-left: 6px solid var(--color-crimson);
  position: relative;
  transform: rotate(0.3deg);
}

/* H3 - Subtle dark stripe */
h3 {
  background: #1f2937;
  color: var(--color-crimson-300);
  font-size: 1.5rem;
  padding: 0.5rem 1.5rem;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  border-left: 4px solid var(--color-crimson-light);
  transform: rotate(-0.2deg);
}

h4 {
  color: var(--color-crimson-400);
  font-size: 1.25rem;
}

/* Paragraphs */
p {
  margin: 1rem 0;
  color: var(--color-text-body);
}

/* Navigation */
nav.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--color-bg-light);
  border-bottom: 1px solid var(--color-oxblood);
}

nav.site-nav .site-title {
  font-family: var(--verso-structure-font-family);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-crimson-300);
  text-decoration: none;
}

nav.site-nav .site-title:hover {
  color: var(--color-crimson-200);
}

nav.top {
  display: inline;
}

nav.top ol {
  display: inline-flex;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

nav.top a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-family: var(--verso-structure-font-family);
}

nav.top a:hover {
  color: var(--color-crimson-300);
}

/* Header */
header {
  background: var(--color-bg-light);
}

/* Main content */
main {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: calc(100vh - 200px);
}

/* Code blocks */
pre {
  background: var(--color-bg-code) !important;
  border: 1px solid var(--color-oxblood);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  font-size: 1rem;
}

code {
  font-family: var(--verso-code-font-family);
  background: #2d2d2d;
  color: var(--color-crimson-200);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* Math - KaTeX rendering */
code.math {
  background: transparent;
  color: var(--color-text);
  padding: 0;
  border: none;
  font-size: inherit;
}

code.math.inline {
  display: inline;
}

code.math.display {
  display: block;
  text-align: center;
  margin: 1.5rem 0;
  font-size: 1.2em;
}

/* Remove any blockquote-like styling from paragraphs containing display math */
p:has(> code.math.display) {
  border: none;
  border-left: none;
  padding-left: 0;
  margin-left: 0;
  background: transparent;
}

/* Lean code highlighting */
.hl.lean {
  background: var(--color-bg-code);
  border: 1px solid var(--color-oxblood);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
}

.hl.lean .keyword {
  color: #ff6b6b;
  font-weight: bold;
}

.hl.lean .const {
  color: #ffa94d;
}

.hl.lean .var {
  color: #91a7ff;
  font-style: italic;
}

.hl.lean .literal {
  color: #69db7c;
}

.hl.lean .string {
  color: #69db7c;
}

.hl.lean .comment {
  color: #6a737d;
  font-style: italic;
}

/* Post metadata */
.metadata {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-oxblood);
  font-family: var(--verso-code-font-family);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metadata .date {
  display: block;
  margin-bottom: 0.5rem;
}

.metadata .author {
  font-weight: 500;
}

/* Post list / Archive */
ul:has(> li > a.title) {
  list-style: none;
  padding: 0;
}

li:has(> a.title) {
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(36, 28, 25, 0.5);
  border-left: 4px solid var(--color-crimson);
  border-radius: 8px;
  transition: all 0.3s ease;
}

li:has(> a.title):hover {
  background: rgba(36, 28, 25, 0.7);
  border-left-color: var(--color-crimson-400);
}

a.title {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--verso-structure-font-family);
  color: var(--color-crimson-300);
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
}

a.title:hover {
  color: var(--color-crimson-200);
}

a.read-more {
  display: inline-block;
  margin-top: 1rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-decoration: none;
}

a.read-more:hover {
  color: var(--color-crimson-300);
}

/* Lists */
ul, ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
  color: var(--color-text-body);
}

ul {
  list-style-type: disc;
}

ol {
  list-style-type: decimal;
}

li {
  margin: 0.5rem 0;
}

li::marker {
  color: var(--color-crimson);
}

/* Images - inverted for dark theme */
img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem auto;
  display: block;
  filter: invert(1) hue-rotate(180deg);
}

/* Blockquotes - academic style */
blockquote {
  border-left: 4px solid var(--color-crimson);
  margin: 1.5rem 0;
  margin-left: 1.5rem;
  padding: 1rem 2rem;
  background: rgba(36, 28, 25, 0.5);
  color: #b8aea4;
  font-style: italic;
}

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

th {
  padding: 0.75rem;
  background: var(--color-crimson);
  color: var(--color-crimson-200);
  font-family: var(--verso-structure-font-family);
  font-weight: 700;
  border: 1px solid var(--color-oxblood);
  text-align: left;
}

td {
  padding: 0.75rem;
  border: 1px solid #374151;
  color: var(--color-text-body);
}

tr:nth-child(even) {
  background: rgba(36, 28, 25, 0.3);
}

/* Horizontal rules */
hr {
  border: none;
  border-top: 1px solid var(--color-oxblood);
  margin: 3rem 0;
}

/* Footer */
footer {
  background: var(--color-bg-light);
  border-top: 1px solid var(--color-oxblood);
  padding: 2rem;
  text-align: center;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Categories */
.categories ul {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  flex-wrap: wrap;
}

.categories li {
  background: var(--color-oxblood);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Math (KaTeX) */
.katex-display {
  overflow-x: auto;
  padding: 0.5rem 0;
}

/* Lean output messages */
.information, .warning, .error {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-family: var(--verso-code-font-family);
  font-size: 0.9rem;
}

.information {
  background: rgba(71, 119, 255, 0.1);
  border-left: 3px solid var(--verso-info-indicator-color);
}

.warning {
  background: rgba(231, 167, 29, 0.1);
  border-left: 3px solid var(--verso-warning-indicator-color);
}

.error {
  background: rgba(255, 0, 0, 0.1);
  border-left: 3px solid var(--verso-error-indicator-color);
}

/* Tippy tooltips - dark theme for Lean documentation popups */
.tippy-box[data-theme~='lean'],
.tippy-box {
  background-color: var(--color-bg-light) !important;
  color: var(--color-text-body) !important;
  border: 1px solid var(--color-oxblood) !important;
}

.tippy-box[data-theme~='lean'][data-placement^='top'] > .tippy-arrow::before,
.tippy-box[data-placement^='top'] > .tippy-arrow::before {
  border-top-color: var(--color-bg-light) !important;
}

.tippy-box[data-theme~='lean'][data-placement^='bottom'] > .tippy-arrow::before,
.tippy-box[data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: var(--color-bg-light) !important;
}

.tippy-box[data-theme~='lean'][data-placement^='left'] > .tippy-arrow::before,
.tippy-box[data-placement^='left'] > .tippy-arrow::before {
  border-left-color: var(--color-bg-light) !important;
}

.tippy-box[data-theme~='lean'][data-placement^='right'] > .tippy-arrow::before,
.tippy-box[data-placement^='right'] > .tippy-arrow::before {
  border-right-color: var(--color-bg-light) !important;
}

.tippy-box[data-theme~='lean'] .tippy-content,
.tippy-box .tippy-content {
  color: var(--color-text-body) !important;
}

/* Tactic state in tooltips */
.tippy-box .tactic-state,
.tippy-box .tactic-state *,
.tactic-state,
.tactic-state * {
  color: var(--color-text-body) !important;
  background: transparent !important;
  background-color: transparent !important;
}

/* Docstrings inside tooltips */
.tippy-box[data-theme~='lean'] .docstring,
.tippy-box[data-theme~='lean'] .docstring p,
.tippy-box[data-theme~='lean'] .docstring span,
.tippy-box[data-theme~='lean'] .hover-info,
.tippy-box[data-theme~='lean'] p,
.tippy-box[data-theme~='lean'] span {
  color: var(--color-text-body) !important;
}

.tippy-box[data-theme~='lean'] a {
  color: var(--color-crimson-200);
}

.tippy-box[data-theme~='lean'] code,
.tippy-box[data-theme~='lean'] .docstring code,
.tippy-box[data-theme~='lean'] .hover-info code,
.tippy-box[data-theme~='lean'] .hl.lean code,
.tippy-box .hl.lean .hover-info code,
.hl.lean .hover-info code,
.tippy-box code {
  color: var(--color-crimson-200) !important;
  background: var(--color-bg-code) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  main {
    padding: 1rem;
  }

  h1 {
    font-size: 2rem;
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 0.75rem 1rem;
  }

  h2, h3 {
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  nav.site-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  nav.top ol {
    flex-wrap: wrap;
    gap: 1rem;
  }
}
