:root {
  color-scheme: light dark;
  --bg: #faf9f7;
  --fg: #1c1917;
  --muted: #6b6560;
  --accent: #e8571e;
  --border: #e2ddd8;
  --code-bg: #f2f0ed;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1713;
    --fg: #e8e3dc;
    --muted: #9e9590;
    --accent: #ff7a40;
    --border: #2e2a26;
    --code-bg: #252119;
  }
}

:root[data-theme="light"] {
  --bg: #faf9f7;
  --fg: #1c1917;
  --muted: #6b6560;
  --accent: #e8571e;
  --border: #e2ddd8;
  --code-bg: #f2f0ed;
}

:root[data-theme="dark"] {
  --bg: #1a1713;
  --fg: #e8e3dc;
  --muted: #9e9590;
  --accent: #ff7a40;
  --border: #2e2a26;
  --code-bg: #252119;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Work Sans", system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  letter-spacing: 0.015em;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Archivo", sans-serif;
  line-height: 1.2;
}

h1 { font-size: 2rem; font-weight: 900; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }

main {
  max-width: 992px;
  margin: 0 auto;
  padding: 1rem 1.5rem 4rem;
}

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

/* ── Header ── */

.site-header {
  max-width: 992px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  text-decoration: none;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-nav a {
  margin-left: 1.25rem;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  transition: color 0.2s;
}

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

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  transition: border-color 0.2s, color 0.2s;
}

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

/* ── Footer ── */

.site-footer {
  max-width: 992px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* ── Post list ── */

.post-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 500px) {
  .post-list {
    grid-template-columns: 1fr;
  }
}

.post-card {
  margin-bottom: 0;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
  transition: box-shadow 0.25s, border-color 0.25s;
}

.post-card:hover {
  box-shadow: 0 4px 20px hsla(0 0% 0% / 0.08);
  border-color: var(--accent);
}

.post-card-image-link {
  display: block;
  line-height: 0;
}

.post-card-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.post-card-content {
  padding: 1.25rem 1.5rem 1.5rem;
}

.post-card-content h2 {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
}

.post-title-link {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.2s;
}

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

time {
  color: var(--muted);
  font-size: 0.875rem;
}

.post-meta {
  color: var(--muted);
  font-size: 0.875rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.post-meta .badge {
  background: var(--code-bg);
  color: var(--accent);
  font-weight: 700;
  padding: 0.1rem 0.6rem;
  border-radius: 1rem;
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

/* ── Tag list (single post) ── */

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  gap: 0.5rem;
}

.tag-list li a {
  background: var(--code-bg);
  color: var(--accent);
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 1rem;
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

/* ── Post content ── */

.post-hero-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  display: block;
  border-radius: 0.5rem;
  margin-bottom: 2rem;
}

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

.post-content {
  font-size: 1.05rem;
}

.post-content code {
  font-family: "JetBrains Mono", "Cascadia Code", "Fira Code", monospace;
  background: var(--code-bg);
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.post-content pre {
  font-family: "JetBrains Mono", "Cascadia Code", "Fira Code", monospace;
  background: var(--code-bg);
  padding: 1.25rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

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