/* =========================================
   Archie Theme — The Number Crunch Edition
   ========================================= */

/* --- Variables & Root --- */
:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --fg-muted: #555555;
  --border: #e0e0e0;
  --accent: #d35400;
  --accent-hover: #b94600;
  --code-bg: #f5f5f5;
  --code-fg: #333333;
  --max-width: 720px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --fg: #e8e8e8;
  --fg-muted: #999999;
  --border: #333333;
  --accent: #e67e22;
  --accent-hover: #f39c12;
  --code-bg: #272727;
  --code-fg: #e8e8e8;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.75;
  transition: background 0.2s ease, color 0.2s ease;
  padding: 0 1rem;
}

/* --- Layout --- */
header, main.main-content, footer {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* --- Header & Nav --- */
header {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

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

.nav-title a {
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.nav-links a {
  font-size: 0.9rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  transition: border-color 0.15s, color 0.15s;
}

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

/* --- Home Page --- */
.site-intro {
  margin-bottom: 3rem;
}

.site-intro h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
}

.site-description {
  color: var(--fg-muted);
  font-size: 1.05rem;
}

/* --- Post List --- */
.posts-list h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--fg-muted);
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

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

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

.post-meta {
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-preview h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: -0.3px;
}

.post-preview h3 a {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.15s;
}

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

.post-summary { color: var(--fg-muted); font-size: 0.95rem; }

/* --- Tags & Categories (inline) --- */
a.category, a.category-tag {
  background: var(--code-bg);
  color: var(--accent);
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-size: 0.78rem;
  text-decoration: none;
  font-weight: 500;
}

a.category:hover, a.category-tag:hover { background: var(--accent); color: var(--bg); }

/* --- Single Post --- */
.post { padding-bottom: 3rem; }

.post-header { margin-bottom: 2rem; }

.post-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.5px;
  margin-bottom: 0.75rem;
}

.post-meta { margin-bottom: 0.75rem; }

.post-categories { margin-top: 0.5rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* --- Post Content Typography --- */
.post-content { font-size: 1.05rem; line-height: 1.8; }

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
  font-weight: 700;
}

.post-content h1 { font-size: 1.7rem; }
.post-content h2 { font-size: 1.4rem; }
.post-content h3 { font-size: 1.2rem; }
.post-content h4 { font-size: 1rem; }

.post-content p { margin-bottom: 1.25rem; }

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

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

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

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  color: var(--fg-muted);
  font-style: italic;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5rem auto;
  display: block;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* --- Code --- */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

.post-content pre {
  background: var(--code-bg);
  padding: 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.88rem;
  line-height: 1.6;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* --- Post Tags --- */
.post-tags {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--fg-muted);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

a.tag {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

/* --- Post Navigation --- */
.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.post-nav a {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
  max-width: 45%;
}

.post-nav a:hover { color: var(--accent); }
.post-nav .next-post { margin-left: auto; text-align: right; }

/* --- List Page --- */
.list-page { padding-bottom: 3rem; }

.list-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--fg-muted);
}

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

.pagination a:hover { text-decoration: underline; }

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

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

/* --- Responsive --- */
@media (max-width: 600px) {
  .post-title { font-size: 1.5rem; }
  .site-intro h1 { font-size: 1.5rem; }
  nav { flex-direction: column; align-items: flex-start; }
  .post-nav a { max-width: 100%; }
}
