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

:root {
  --bg:          #ffffff;
  --bg-alt:      #f7f7f7;
  --text:        #1a1a1a;
  --text-muted:  #5a5a5a;
  --accent:      #0693e3;
  --accent-dark: #0577bf;
  --border:      #e0e0e0;
  --code-bg:     #1e1e2e;
  --code-text:   #cdd6f4;
  --radius:      4px;
  --max-width:   720px;
  --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono:   "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", Menlo, monospace;
}

/* ===== Base ===== */
html { font-size: 17px; scroll-behavior: smooth; }

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

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

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

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

main { padding: 3rem 0 4rem; background: #f3f1f2; }

main > .container { background: var(--bg); padding-top: 2rem; padding-bottom: 2rem; }

/* ===== Header ===== */
header {
  border-bottom: 1px solid var(--border);
  padding: 1.2rem 0;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.site-title:hover { text-decoration: none; color: var(--accent); }

header nav { display: flex; gap: 1.5rem; }
header nav a {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}
header nav a:hover { color: var(--accent); text-decoration: none; }

/* ===== Post List ===== */
.post-list { display: flex; flex-direction: column; gap: 2.5rem; }

.post-item h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  line-height: 1.3;
}
.post-item h2 a { color: var(--text); }
.post-item h2 a:hover { color: var(--accent); text-decoration: none; }

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

.post-summary {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===== Categories & Tags ===== */
.category, .tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.category {
  background: rgba(6, 147, 227, 0.1);
  color: var(--accent-dark);
}
.category:hover { background: rgba(6, 147, 227, 0.2); text-decoration: none; }

.tag {
  background: var(--bg-alt);
  color: var(--text-muted);
}
.tag:hover { background: var(--border); text-decoration: none; }

/* ===== Single Post ===== */
.post-header { margin-bottom: 2.5rem; border-bottom: 1px solid var(--border); padding-bottom: 1.5rem; }

.post-header h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

/* ===== Featured Image ===== */
.featured-image {
  margin-bottom: 2rem;
}
.featured-image img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: var(--radius);
}

/* ===== Post Thumbnail (listing) ===== */
.post-thumbnail-link { display: block; margin-bottom: 0.75rem; }
.post-thumbnail {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
  transition: opacity 0.2s;
}
.post-thumbnail-link:hover .post-thumbnail { opacity: 0.85; }

.post-thumbnail-bar {
  width: 100%;
  height: 2px;
  background: var(--border);
  border-radius: var(--radius);
  margin-top: 0.75rem;
}

.post-item:last-child .post-thumbnail-bar { display: none; }

/* ===== Post Content Typography ===== */
.post-content h2,
.post-content h3,
.post-content h4 {
  font-weight: 700;
  line-height: 1.3;
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.01em;
}
.post-content h2 { font-size: 1.4rem; }
.post-content h3 { font-size: 1.15rem; }
.post-content h4 { font-size: 1rem; }

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

.post-content a { text-decoration: underline; text-underline-offset: 2px; }

.post-content ul,
.post-content ol {
  margin: 0 0 1.25rem 1.5rem;
}
.post-content li { margin-bottom: 0.3rem; }

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

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}
.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.post-content th { background: var(--bg-alt); font-weight: 600; }

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

.post-content img {
  border-radius: var(--radius);
  margin: 1.5rem auto;
}

/* ===== Code — Inline ===== */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: #e8e8e8;
  color: #c7254e;
  padding: 0.15em 0.4em;
  border-radius: var(--radius);
  border: 1px solid #d0d0d0;
}

/* ===== Code Blocks ===== */
.post-content pre {
  background: var(--code-bg);
  border-radius: var(--radius);
  margin: 1.5rem 0;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}

.post-content pre code {
  background: transparent;
  color: var(--code-text);
  padding: 0;
  border: none;
  font-size: inherit;
  border-radius: 0;
}

/* Hugo highlight wrapper */
.highlight {
  margin: 1.5rem 0;
  border-radius: var(--radius);
  overflow-x: auto;
}

.highlight pre {
  margin: 0;
  padding: 1.25rem;
  border-radius: 0;
}

/* Line numbers */
.lntable {
  border-spacing: 0;
  width: 100%;
}
.lntable td { padding: 0; }
.lntd:first-child {
  padding: 1.25rem 0.75rem 1.25rem 1.25rem;
  user-select: none;
  color: #585b70;
  text-align: right;
  min-width: 2.5rem;
}
.lntd:last-child { padding: 1.25rem; width: 100%; }

/* ===== Post Navigation ===== */
.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  gap: 1rem;
}
.post-nav a { color: var(--text-muted); }
.post-nav a:hover { color: var(--accent); }
.post-nav .next { margin-left: auto; text-align: right; }

/* ===== Comments ===== */
.comments {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.comments h3 { font-size: 1.1rem; margin-bottom: 1rem; }

/* ===== Search ===== */
.search-box { margin-bottom: 2rem; }
.search-box input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  background: var(--bg);
  color: var(--text);
}
.search-box input:focus { border-color: var(--accent); }
.no-results { color: var(--text-muted); }

/* ===== Taxonomy (categories/tags pages) ===== */
.container h1 { font-size: 1.6rem; margin-bottom: 2rem; }

/* ===== Footer ===== */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--accent); }

/* ===== Responsive ===== */
@media (max-width: 600px) {
  html { font-size: 16px; }
  .post-header h1 { font-size: 1.6rem; }
  header .container { flex-direction: column; align-items: flex-start; }
  header nav { gap: 1rem; }
}
