:root {
  --bg: #0f1117;
  --bg-raised: #161822;
  --text: #c9cdd8;
  --text-muted: #6b7084;
  --text-bright: #e8eaf0;
  --accent: #7eb8a4;
  --accent-dim: rgba(126, 184, 164, 0.12);
  --border: #23273a;
  --code-bg: #1a1d2e;
  --max-width: 680px;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ─── NAV ─── */
header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

header .site-name {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 0.9rem;
}

header .site-name:hover {
  color: var(--text-bright);
}

header nav {
  display: flex;
  gap: 1.6rem;
}

header nav a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

header nav a:hover {
  color: var(--text);
}

/* ─── HOME ─── */
.home-hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 1.5rem 3rem;
}

.home-hero h1 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-bright);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.home-hero .tagline {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 520px;
  line-height: 1.65;
}

.home-hero .tagline a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color 0.2s;
}

.home-hero .tagline a:hover {
  border-color: var(--accent);
}

/* ─── POST LIST ─── */
.post-list {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

.post-list .section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.8rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.post-item {
  margin-bottom: 2rem;
  display: block;
  text-decoration: none;
  padding: 1rem 1.2rem;
  border-radius: 6px;
  transition: background 0.2s;
}

.post-item:hover {
  background: var(--bg-raised);
}

.post-item .post-title {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

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

.post-item .post-excerpt {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 0.5rem;
}

.post-item .post-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
  align-items: center;
}

.post-item .post-meta .tag {
  color: var(--accent);
  opacity: 0.7;
}

/* ─── BACK LINK ─── */
.back-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}

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

/* ─── TAG CLOUD ─── */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}

.tag-chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  background: var(--accent-dim);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  opacity: 0.8;
  transition: opacity 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tag-chip:hover {
  opacity: 1;
  border-color: var(--accent);
}

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

/* ─── DIVIDER ─── */
.section-divider {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section-divider hr {
  border: none;
  border-top: 1px solid var(--border);
  margin-bottom: 3rem;
}

/* ─── SECTION LIST ─── */
.section-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.section-page h1 {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.year-group {
  margin-bottom: 2.5rem;
}

.year-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.year-group .post-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.year-group .post-row a {
  color: var(--text-bright);
  text-decoration: none;
  font-size: 0.98rem;
  transition: color 0.2s;
}

.year-group .post-row a:hover {
  color: var(--accent);
}

.year-group .post-row .post-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── POST PAGE ─── */
.post-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.post-page .post-header {
  margin-bottom: 3rem;
}

.post-page .post-header h1 {
  font-family: var(--font-body);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin-bottom: 0.8rem;
}

.post-page .post-header .post-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.post-page .post-header .post-meta .post-tags a {
  color: var(--accent);
  text-decoration: none;
  opacity: 0.7;
}

.post-page .post-header .post-meta .post-tags a:hover {
  opacity: 1;
}

/* ─── ARTICLE BODY ─── */
.post-body p {
  margin-bottom: 1.4rem;
  color: var(--text);
}

.post-body h2 {
  font-family: var(--font-body);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-top: 2.8rem;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.post-body h3 {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-top: 2rem;
  margin-bottom: 0.7rem;
}

.post-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(126, 184, 164, 0.3);
  transition: border-color 0.2s;
}

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

.post-body strong {
  color: var(--text-bright);
  font-weight: 600;
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.1rem 0 0.1rem 1.2rem;
  margin: 1.6rem 0;
  color: var(--text-muted);
  font-style: italic;
}

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

.post-body li {
  margin-bottom: 0.3rem;
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--accent);
}

.post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.2rem 1.4rem;
  margin: 1.6rem 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text);
}

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

.post-body .profile-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
}

.post-body pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

/* Hugo syntax highlight table layout */
.post-body .highlight {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 1.6rem 0;
  overflow-x: auto;
}

.post-body .highlight table {
  width: 100%;
  border-collapse: collapse;
}

.post-body .highlight td {
  padding: 0;
  vertical-align: top;
}

.post-body .highlight td:first-child {
  width: 1%;
  white-space: nowrap;
  padding: 1.2rem 0 1.2rem 1.4rem;
}

.post-body .highlight td:last-child {
  width: 100%;
  padding: 1.2rem 1.4rem;
}

/* Reset pre and chroma inside highlight tables — container provides the box */
.post-body .highlight pre,
.post-body .highlight .chroma {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  overflow-x: visible;
  color: inherit;
}

.post-body .highlight .lnt {
  color: var(--text-muted);
  user-select: none;
  font-size: 0.82rem;
  line-height: 1.6;
}

/* code block filename label */
.code-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-bottom: none;
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 6px 6px 0 0;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}

.code-label + pre {
  border-top-left-radius: 0;
}

/* ─── PROFILE IMAGE ─── */
.profile-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin-bottom: 1.5rem;
  border: 2px solid var(--border);
}

/* ─── ADMONITIONS ─── */
.admonition {
  border-left: 3px solid var(--accent);
  background: var(--bg-raised);
  border-radius: 0 6px 6px 0;
  padding: 1rem 1.2rem;
  margin: 1.6rem 0;
}

.admonition-warning { border-color: #e0a060; }
.admonition-bug, .admonition-danger { border-color: #c96060; }
.admonition-success { border-color: #60c090; }
.admonition-question { border-color: #a080d0; }

.admonition-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.admonition-content p:last-child {
  margin-bottom: 0;
}

.twitter-embed {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1.6rem 0;
  font-style: normal;
  color: var(--text-muted);
}

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

/* ─── FOOTER ─── */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

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

footer .footer-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 600px) {
  html { font-size: 16px; }
  .home-hero { padding-top: 3rem; }
  .post-page .post-header h1 { font-size: 1.65rem; }
  header { flex-direction: column; gap: 0.8rem; }
  .post-item { padding: 0.8rem; }
}

/* ─── SUBTLE ANIMATION ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.home-hero, .post-item, .post-page {
  animation: fadeUp 0.4s ease-out both;
}

.post-item:nth-child(2) { animation-delay: 0.05s; }
.post-item:nth-child(3) { animation-delay: 0.1s; }
.post-item:nth-child(4) { animation-delay: 0.15s; }
.post-item:nth-child(5) { animation-delay: 0.2s; }
.post-item:nth-child(6) { animation-delay: 0.25s; }
