/* ThinkLoop — Obsidianite-inspired deep-space theme */
/* Theme inspired by Obsidianite (MIT) by Benny Guo */

:root {
  --font: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue",
    sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas,
    "DejaVu Sans Mono", monospace;
  --max-width: 42rem;
  --bg: #100e17;
  --bg-alt: #191621;
  --fg: #bebebe;
  --muted: #7a7a8e;
  --border: rgba(14, 210, 247, 0.08);
  --accent: #0fb6d6;
  --accent-hover: #6bcafb;
  --sub-accent: #f4569d;
  --code-bg: #191621;
  --callout-border: #4aa8fb;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #faf9fc;
    --bg-alt: #f0eef5;
    --fg: #1a1a2e;
    --muted: #5a5a72;
    --border: rgba(14, 160, 200, 0.12);
    --accent: #0a8fa8;
    --accent-hover: #067a91;
    --sub-accent: #d6366f;
    --code-bg: #f0eef5;
    --callout-border: #3b82f6;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
}

body {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Navigation */
header { margin-bottom: 3rem; }

nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

nav a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
}

.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { font-weight: 400; font-size: 0.9rem; color: var(--muted); }
.nav-links a:hover { color: var(--fg); }

/* Main content */
main { min-height: 60vh; }

/* Index */
.post-list { list-style: none; }

.post-list li {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.post-list a {
  color: var(--fg);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
}

.post-list a:hover { color: var(--accent); }

.post-list time {
  font-size: 0.85rem;
  color: var(--muted);
}

.post-list .description {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

/* Article */
article h1 {
  font-size: 1.8rem;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

article h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(to right, var(--sub-accent), transparent) 1;
}

article h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.tags { display: flex; gap: 0.5rem; }

.tag {
  font-size: 0.8rem;
  color: var(--accent);
  background: rgba(15, 182, 214, 0.15);
  padding: 0.1em 0.5em;
  border-radius: 3px;
}

article p { margin-bottom: 1rem; }

article a {
  color: var(--accent);
  text-decoration: none;
  background: linear-gradient(var(--accent), var(--accent)) no-repeat left bottom;
  background-size: 0% 1px;
  transition: background-size 350ms ease;
  padding-bottom: 1px;
}

article a:hover {
  color: var(--accent-hover);
  background-size: 100% 1px;
}

article strong {
  background: linear-gradient(62deg, #87c2fd, #dcb9fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

article ul, article ol { margin: 0 0 1rem 1.5rem; }
article li { margin-bottom: 0.25rem; }

article img { max-width: 100%; height: auto; border-radius: 4px; margin: 1rem 0; }

/* Code */
code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--sub-accent);
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1rem 0;
}

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

/* Callouts */
blockquote {
  border-left: 3px solid var(--callout-border);
  background: linear-gradient(135deg, var(--bg-alt), var(--bg));
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  color: var(--muted);
  border-radius: 0 4px 4px 0;
}

blockquote.callout {
  border-left-color: var(--callout-border);
  background: var(--code-bg);
}

/* Highlights */
mark {
  background: #854d0e;
  color: #fef08a;
  padding: 0.1em 0.2em;
  border-radius: 2px;
}

@media (prefers-color-scheme: light) {
  mark { background: #fef08a; color: inherit; }
}

/* Footer */
footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

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

footer a:hover { color: var(--accent); }

/* Series TOC (in-post) */
.series-toc {
  border: 1px solid rgba(14, 210, 247, 0.15);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}

.series-toc .series-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.series-toc .series-label a {
  color: var(--fg);
  text-decoration: none;
}

.series-toc .series-label a:hover { color: var(--accent); }

.series-toc ol {
  margin: 0 0 0 1.25rem;
  padding: 0;
}

.series-toc li { margin-bottom: 0.25rem; font-size: 0.9rem; }
.series-toc li.current { color: var(--fg); font-weight: 500; }
.series-toc li a { color: var(--accent); text-decoration: none; }
.series-toc li a:hover { text-decoration: underline; }

/* Series nav (prev/next) */
.series-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.series-nav a { color: var(--accent); text-decoration: none; }
.series-nav a:hover { text-decoration: underline; }
.series-nav .series-index { font-weight: 600; color: var(--muted); }
.series-nav .series-index:hover { color: var(--fg); }
.series-prev { text-align: left; }
.series-next { text-align: right; }

/* Series index page */
.series-index { margin-top: 1rem; }
.series-index h1 { margin-bottom: 0.5rem; }

.series-count {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.series-full-toc {
  list-style: decimal;
  margin-left: 1.25rem;
  padding: 0;
}

.series-full-toc li {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.series-full-toc a {
  color: var(--fg);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
}

.series-full-toc a:hover { color: var(--accent); }

.series-full-toc time {
  font-size: 0.85rem;
  color: var(--muted);
}

.series-full-toc .description {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

/* 404 */
.not-found { text-align: center; margin-top: 4rem; }
.not-found h1 { font-size: 4rem; margin-bottom: 1rem; }
