:root {
  --bg-color: #ffffff;
  --text-color: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #888888;
  --accent-color: #2b7fff;
  --accent-hover: #1a6feb;
  --border-color: #e0e0e0;
  --code-bg: #f5f5f5;
  --code-color: #333333;
  --archive-banner-bg: #fff3cd;
  --archive-banner-color: #856404;
  --archive-banner-border: #ffeaa7;
  --header-bg: #ffffff;
}

[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #e8e8e8;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --accent-color: #4da3ff;
  --accent-hover: #66b3ff;
  --border-color: #333333;
  --code-bg: #2d2d2d;
  --code-color: #e0e0e0;
  --archive-banner-bg: #3d3210;
  --archive-banner-color: #ffeaa7;
  --archive-banner-border: #5c4a18;
  --header-bg: #1a1a1a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-color: #1a1a1a;
    --text-color: #e8e8e8;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent-color: #4da3ff;
    --accent-hover: #66b3ff;
    --border-color: #333333;
    --code-bg: #2d2d2d;
    --code-color: #e0e0e0;
    --archive-banner-bg: #3d3210;
    --archive-banner-color: #ffeaa7;
    --archive-banner-border: #5c4a18;
    --header-bg: #1a1a1a;
  }
}

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

html {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

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

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

/* External link indicator */
a[href^="http"]:not(.no-external)::after,
a[href^="https"]:not(.no-external)::after {
  content: " ↗";
  font-size: 0.85em;
  opacity: 0.7;
}

a[href^="http"]:not(.no-external):hover::after,
a[href^="https"]:not(.no-external):hover::after {
  opacity: 1;
}

h1, h2, h3, h4, h5, h6 {
  margin: 1.5rem 0 1rem;
  line-height: 1.3;
  font-weight: 600;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.1rem;
}

p {
  margin-bottom: 1rem;
}

img {
  max-width: 100%;
  height: auto;
}

code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.9em;
  background-color: var(--code-bg);
  color: var(--code-color);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

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

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

blockquote {
  border-left: 3px solid var(--accent-color);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

ul, ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

li {
  margin: 0.5rem 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2.5rem 0;
}

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.site-header h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.site-header h1 a {
  color: var(--text-color);
}

.site-header h1 a:hover {
  color: var(--accent-color);
  text-decoration: none;
}

.site-header nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.site-header nav a {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.site-header nav a:hover {
  color: var(--accent-color);
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

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

/* Archive banner */
.archive-banner {
  background-color: var(--archive-banner-bg);
  color: var(--archive-banner-color);
  border: 1px solid var(--archive-banner-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}

.archive-banner strong {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.archive-banner a {
  color: var(--archive-banner-color);
  text-decoration: underline;
}

.archive-banner a:hover {
  opacity: 0.8;
}

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

/* Post list - compact style */
.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  margin: 0;
  padding: 0.6rem 0;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

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

.post-list a:hover {
  text-decoration: underline;
}

.post-list .post-date {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.post-list .post-description {
  display: none;
}

/* Regular post listings (for blog/feed pages) */
.post-list-detailed {
  list-style: none;
  padding: 0;
}

.post-list-detailed li {
  margin: 1.5rem 0;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.post-list-detailed li:last-child {
  border-bottom: none;
}

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

.post-list-detailed .post-title {
  font-size: 1.25rem;
  margin: 0.25rem 0;
  font-weight: 600;
}

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

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

.post-list-detailed .post-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

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

/* Post content */
.post-content {
  line-height: 1.7;
}

.post-content h2 {
  margin-top: 1rem;
  font-size: 1.5rem;
}

.post-content h3 {
  margin-top: 1rem;
  font-size: 1.1rem;
}

.post-content figure {
  margin: 1.5rem 0;
}

.post-content figcaption {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.tag {
  background-color: var(--code-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Alert boxes */
.alert-box {
  padding: 1rem;
  border-radius: 6px;
  margin: 1rem 0;
}

.alert-box__info {
  background-color: var(--code-bg);
  border-left: 3px solid var(--accent-color);
}

/* Responsive adjustments */
@media (max-width: 600px) {
  body {
    padding: 1rem;
  }
  
  .site-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .post-list {
    font-size: 0.95rem;
  }
  
  .post-list .post-date {
    font-size: 0.8rem;
  }
}
