/* BearMinimal Theme - A minimal, readable blog theme */

/* CSS Variables for theming */
:root {
  --bg: #faf9f6;
  --text: #1a1a1a;
  --text-muted: #666;
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --border: #e5e5e5;
  --code-bg: #f5f5f5;
  --code-text: #1a1a1a;
}

html[data-theme="dark"] {
  --bg: #1a1a1a;
  --text: #e8e8e8;
  --text-muted: #888;
  --link: #7dd3fc;
  --link-hover: #38bdf8;
  --border: #333;
  --code-bg: #242424;
  --code-text: #e8e8e8;
}

/* Base styles */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navigation */
header {
  padding: 2rem 0;
  margin-bottom: 2rem;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.logo:hover {
  color: var(--link);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-links a:hover {
  color: var(--link);
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.theme-toggle:hover {
  background-color: var(--border);
}

/* Main content */
main {
  min-height: calc(100vh - 300px);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 2rem 0 1rem;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p {
  margin: 0 0 1.25rem;
}

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

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

/* Blog list styles */
.post-list {
  margin: 2rem 0;
}

.post-item {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-item:last-child {
  border-bottom: none;
}

.post-header {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.post-date {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-family: "SF Mono", Monaco, monospace;
  white-space: nowrap;
}

.post-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.post-title a {
  color: var(--text);
}

.post-title a:hover {
  color: var(--link);
  text-decoration: none;
}

.post-tags {
  margin-top: 0.5rem;
}

.tag {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-right: 0.75rem;
}

.tag:hover {
  color: var(--link);
}

.tag::before {
  content: "#";
}

/* Post content styles */
.post-content {
  margin-top: 2rem;
}

.post-content h1,
.post-content h2,
.post-content h3 {
  margin-top: 2.5rem;
}

.post-content h2 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content code {
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
  font-size: 0.9em;
  background-color: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

.post-content pre {
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--border);
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--code-text);
}

/* Dark mode code block refinements */
/* Only apply background to inline code, not code blocks */
html[data-theme="dark"] .post-content :not(pre) > code {
  background-color: rgba(255, 255, 255, 0.08);
  color: #e8e8e8;
}

html[data-theme="dark"] .post-content pre {
  box-shadow: none;
}

/* Remove text-shadow and fix selection in dark mode code blocks */
html[data-theme="dark"] code[class*="language-"],
html[data-theme="dark"] pre[class*="language-"] {
  text-shadow: none !important;
}

/* Remove background from tokens that have it in light mode */
html[data-theme="dark"] .token.operator,
html[data-theme="dark"] .token.entity,
html[data-theme="dark"] .token.url,
html[data-theme="dark"] .language-css .token.string,
html[data-theme="dark"] .style .token.string {
  background: transparent !important;
}

html[data-theme="dark"] code[class*="language-"] ::selection,
html[data-theme="dark"] code[class*="language-"]::selection,
html[data-theme="dark"] pre[class*="language-"] ::selection,
html[data-theme="dark"] pre[class*="language-"]::selection {
  text-shadow: none;
  background: rgba(125, 211, 252, 0.3);
}

.post-content blockquote {
  margin: 0 0 1.25rem;
  padding-left: 1rem;
  border-left: 3px solid var(--link);
  color: var(--text-muted);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
}

.post-content th,
.post-content td {
  padding: 0.5rem;
  border: 1px solid var(--border);
  text-align: left;
}

.post-content th {
  background-color: var(--code-bg);
  font-weight: 600;
}

/* Post meta */
.post-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 1rem 0 2rem;
}

.post-meta a {
  color: var(--text-muted);
}

.post-meta a:hover {
  color: var(--link);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 3rem 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.pagination a {
  color: var(--text);
}

.pagination a:hover {
  color: var(--link);
}

.pagination .disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

.pagination-prev,
.pagination-next {
  color: var(--text);
}

.pagination-prev.disabled,
.pagination-next.disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Tags page */
.tag-list {
  margin: 2rem 0;
}

.tag-item {
  display: inline-block;
  margin: 0.5rem 1rem 0.5rem 0;
}

.tag-count {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.tag-count {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* About page */
.about-content {
  margin: 2rem 0;
}

.about-section {
  margin: 2.5rem 0;
}

.about-section h2 {
  font-size: 1.25rem;
  margin: 0 0 1rem;
  color: var(--text);
}

.about-section p {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.about-section ul {
  margin: 0;
  padding-left: 1.5rem;
  color: var(--text-muted);
}

.about-section li {
  margin-bottom: 0.5rem;
}

.contact-list {
  list-style: none;
  padding-left: 0;
}

.contact-list li {
  margin-bottom: 0.75rem;
}

.contact-list strong {
  display: inline-block;
  min-width: 80px;
  color: var(--text);
}

/* Footer */
footer {
  margin-top: 4rem;
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}

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

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

/* Home page */
.home-intro {
  margin: 2rem 0 3rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.intro-line {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.intro-line:last-child {
  margin-bottom: 0;
}

.source-link {
  text-align: right;
}

.recent-posts {
  margin: 2rem 0;
}

.recent-posts h2 {
  margin-bottom: 1.5rem;
}

/* Comments */
.comments {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

/* Mobile responsive */
@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

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

  .nav-links {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .post-header {
    flex-direction: column;
    gap: 0.25rem;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.1rem; }
}

/* Print styles */
@media print {
  header nav,
  .theme-toggle,
  footer,
  .comments {
    display: none;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
  }

  a {
    text-decoration: underline;
  }

  .post-content a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: var(--text-muted);
  }
}

/* Dark mode code syntax highlighting overrides for Prism */
html[data-theme="dark"] code[class*="language-"],
html[data-theme="dark"] pre[class*="language-"] {
  color: #e8e8e8;
  text-shadow: none;
}

html[data-theme="dark"] pre[class*="language-"] {
  background: #242424;
}

/* Token colors for dark mode - warmer, neutral palette */
html[data-theme="dark"] .token.comment,
html[data-theme="dark"] .token.prolog,
html[data-theme="dark"] .token.doctype,
html[data-theme="dark"] .token.cdata {
  color: #6a737d;
}

html[data-theme="dark"] .token.punctuation {
  color: #d1d5db;
}

html[data-theme="dark"] .token.namespace {
  opacity: .7;
}

html[data-theme="dark"] .token.property,
html[data-theme="dark"] .token.tag,
html[data-theme="dark"] .token.boolean,
html[data-theme="dark"] .token.number,
html[data-theme="dark"] .token.constant,
html[data-theme="dark"] .token.symbol,
html[data-theme="dark"] .token.deleted {
  color: #60a5fa;
}

html[data-theme="dark"] .token.selector,
html[data-theme="dark"] .token.attr-name,
html[data-theme="dark"] .token.string,
html[data-theme="dark"] .token.char,
html[data-theme="dark"] .token.builtin,
html[data-theme="dark"] .token.inserted {
  color: #a5f3fc;
}

html[data-theme="dark"] .token.operator,
html[data-theme="dark"] .token.entity,
html[data-theme="dark"] .token.url,
html[data-theme="dark"] .language-css .token.string,
html[data-theme="dark"] .style .token.string {
  color: #d8b4fe;
}

html[data-theme="dark"] .token.atrule,
html[data-theme="dark"] .token.attr-value,
html[data-theme="dark"] .token.keyword {
  color: #f472b6;
}

html[data-theme="dark"] .token.function,
html[data-theme="dark"] .token.class-name {
  color: #c084fc;
}

html[data-theme="dark"] .token.regex,
html[data-theme="dark"] .token.important,
html[data-theme="dark"] .token.variable {
  color: #fbbf24;
}
