/* ── CSS Variables ── */
:root {
  --color-bg:           #fdfdfd;
  --color-bg-secondary: #f6f6f6;
  --color-text:         #1a1a1a;
  --color-text-muted:   #6b7280;
  --color-accent:       #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-border:       #e5e7eb;
  --color-code-bg:      #f3f4f6;
  --color-tag-bg:       #e5e7eb;
  --color-tag-text:     #374151;
  --color-border-hero:  #e5e7eb;

  --content-width:  700px;
  --page-width:     900px;
  --header-height:  64px;
  --line-height:    1.75;
  --paragraph-gap:  1.5rem;
  --section-gap:    3rem;
}

[data-theme="dark"] {
  --color-bg:           #1a1a2e;
  --color-bg-secondary: #16213e;
  --color-text:         #e2e8f0;
  --color-text-muted:   #94a3b8;
  --color-accent:       #f97316;
  --color-accent-hover: #fb923c;
  --color-border:       #334155;
  --color-border-hero:  #f97316;
  --color-code-bg:      #0f172a;
  --color-tag-bg:       #334155;
  --color-tag-text:     #cbd5e1;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

/* ── Layout ── */
.container {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .container {
    padding: 0 2rem;
  }
}

main {
  padding: 2rem 0;
  min-height: calc(100vh - var(--header-height) - 80px);
}

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

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 1rem;
  border-bottom: 1px solid var(--color-border-hero);
}

@media (min-width: 768px) {
  .header-inner {
    padding: 0 2rem;
  }
}

.header-logo img {
  height: 36px;
  width: auto;
  display: block;
}

.header-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.home-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 2rem 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rss-link {
  color: var(--color-accent);
  display: flex;
  align-items: center;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.rss-link:hover {
  opacity: 1;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-family: 'JetBrains Mono', monospace;
  transition: color 0.15s;
}

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

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

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

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

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* ── Theme toggle ── */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.25rem;
  color: var(--color-text-muted);
  line-height: 1;
  display: flex;
  align-items: center;
}

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

/* ── Footer ── */
footer {
  padding: 0;
}

.footer-inner {
  border-top: 1px solid var(--color-border-hero);
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

@media (min-width: 768px) {
  .footer-inner {
    padding: 1.5rem 2rem;
  }
}

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

footer a:hover {
  text-decoration: underline;
}

/* ── Post card ── */
.post-card {
  border-bottom: 1px solid var(--color-border);
  padding: 1.5rem 0;
}

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

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

.post-card-title a:hover {
  opacity: 0.85;
}

.posts-header {
  display: flex;
  justify-content: flex-end;
  padding: 1.5rem 0 0.5rem;
}

.post-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--color-accent);
  transition: color 0.15s;
}

.post-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
}

.post-meta-date {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.post-excerpt {
  margin: 0.5rem 0;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

/* ── Tag pill ── */
.tag-pill {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  border-radius: 9999px;
  font-size: 0.8125rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  font-family: 'Lato', sans-serif;
}

.tag-pill:hover {
  background: var(--color-accent);
  color: #fff;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 2rem 0;
}

.pagination a,
.pagination span {
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.875rem;
  transition: background 0.15s;
}

.pagination a:hover {
  background: var(--color-bg-secondary);
}

.pagination .current {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* ── Responsive ── */
@media (max-width: 767px) {
  .header-nav a:not(:first-child):not(:last-child) {
    display: none;
  }
}
