/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
  /* Dark theme — default */
  --bg:       #0d1117;
  --bg2:      #161b22;
  --bg3:      #21262d;
  --border:   #30363d;
  --text:     #e6edf3;
  --muted:    #8b949e;
  --accent:   #2f81f7;
  --accent-h: #58a6ff;
  --code-bg:  #161b22;
  --shadow:   0 4px 24px rgba(0, 0, 0, 0.45);
  --radius:   8px;
  --radius-sm: 4px;

  /* Category accent colours */
  --cat-csharp: #2f81f7;
  --cat-sql:    #f0883e;
  --cat-iis:    #3fb950;
  --cat-vue:    #42d392;
  --cat-review: #bc8cff;
  --cat-ps:     #2ea043;
  --cat-java:   #e76f51;
  --cat-js:     #f7cc50;
}

[data-theme="light"] {
  --bg:       #ffffff;
  --bg2:      #f6f8fa;
  --bg3:      #eaeef2;
  --border:   #d0d7de;
  --text:     #1f2328;
  --muted:    #636c76;
  --accent:   #0969da;
  --accent-h: #0550ae;
  --code-bg:  #f6f8fa;
  --shadow:   0 4px 24px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background 0.2s, color 0.2s;
}

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

a:hover { text-decoration: underline; }

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

ul, ol { list-style: none; }

/* ============================================================
   3. LAYOUT
   ============================================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Constrained reading width for article content */
.content-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-main {
  min-height: 60vh;
  padding: 20px 0;
}

/* ============================================================
   4. SKIP LINK (accessibility)
   ============================================================ */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 9999;
  width: auto;
  height: auto;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

/* ============================================================
   5. HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(22, 27, 34, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

[data-theme="light"] .site-header {
  background: rgba(246, 248, 250, 0.94);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s;
}

.brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.brand-icon {
  color: var(--accent);
  font-size: 1rem;
}

/* Primary nav */
.primary-nav { flex: 1; }

.primary-nav ul {
  display: flex;
  align-items: center;
  gap: 2px;
}

.primary-nav a {
  display: block;
  padding: 6px 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.primary-nav a:hover,
.primary-nav .current-menu-item > a,
.primary-nav .current-cat > a {
  color: var(--text);
  background: var(--bg3);
  text-decoration: none;
}

/* Header action buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  line-height: 1;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--bg3);
  border-color: var(--accent);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Hamburger — hidden on desktop */
.nav-toggle { display: none; }

/* Mobile nav */
.mobile-nav {
  border-top: 1px solid var(--border);
  background: var(--bg2);
  padding: 8px 0;
}

.mobile-nav[hidden] { display: none; }

.mobile-nav ul { list-style: none; }

.mobile-nav a {
  display: block;
  padding: 11px 24px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}

.mobile-nav a:hover {
  color: var(--text);
  background: var(--bg3);
  text-decoration: none;
}

/* ============================================================
   6. SEARCH OVERLAY
   ============================================================ */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 72px 24px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.search-overlay[hidden] { display: none; }

.search-box {
  width: 100%;
  max-width: 600px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.search-box form {
  display: flex;
  align-items: center;
  padding: 4px 16px;
  gap: 12px;
}

.search-icon {
  width: 18px;
  height: 18px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  flex-shrink: 0;
}

.search-box input[type="search"] {
  flex: 1;
  padding: 16px 0;
  font-size: 1rem;
  font-family: inherit;
  background: transparent;
  border: none;
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-box input::placeholder { color: var(--muted); }

.search-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 5px;
  flex-shrink: 0;
}

/* ============================================================
   7. PAGE / ARCHIVE HEADER
   ============================================================ */
.page-hero {
  padding: 48px 0 36px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.page-hero-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
}

.page-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.page-hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 520px;
}

/* ============================================================
   8. POST CARDS GRID
   ============================================================ */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.post-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.post-card-thumb {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg3);
  text-decoration: none;
}

.post-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s;
}

.post-card:hover .post-card-thumb img { transform: scale(1.04); }

.post-card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  color: var(--border);
}

.post-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Category badge */
.post-cat-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
  transition: opacity 0.15s;
  text-decoration: none;
}

.post-cat-badge:hover { opacity: 0.8; text-decoration: none; }

/* Badge colours — scoped to .post-cat-badge to avoid conflicts */
.post-cat-badge.cat-csharp  { color: var(--cat-csharp); background: rgba(47,129,247,.14); }
.post-cat-badge.cat-sql     { color: var(--cat-sql);    background: rgba(240,136,62,.14); }
.post-cat-badge.cat-iis     { color: var(--cat-iis);    background: rgba(63,185,80,.14); }
.post-cat-badge.cat-vue     { color: var(--cat-vue);    background: rgba(66,211,146,.14); }
.post-cat-badge.cat-review  { color: var(--cat-review); background: rgba(188,140,255,.14); }
.post-cat-badge.cat-ps      { color: var(--cat-ps);     background: rgba(46,160,67,.14); }
.post-cat-badge.cat-java    { color: var(--cat-java);   background: rgba(231,111,81,.14); }
.post-cat-badge.cat-js      { color: var(--cat-js);     background: rgba(247,204,80,.14); }
.post-cat-badge.cat-default { color: var(--accent);     background: rgba(47,129,247,.14); }

.post-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 10px;
}

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

.post-card-excerpt {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.775rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: auto;
}

.post-card-meta .sep { opacity: 0.35; }

/* ============================================================
   9. SINGLE POST HEADER
   ============================================================ */
.post-header {
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.post-header .post-cat-badge { margin-bottom: 16px; }

.post-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 0.825rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}

.post-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-meta svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  flex-shrink: 0;
}

/* ============================================================
   10. POST BODY TYPOGRAPHY
   ============================================================ */
.post-content {
  font-size: 1.05rem;
  line-height: 1.82;
  color: var(--text);
}

.post-content h2 {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
  margin: 2.4em 0 0.7em;
  padding-top: 0.5em;
  border-top: 1px solid var(--border);
}

.post-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 2em 0 0.6em;
}

.post-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.6em 0 0.5em;
}

.post-content p { margin-bottom: 1.4em; }

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

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

.post-content ul,
.post-content ol {
  margin: 0 0 1.4em 1.4em;
}

.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }

.post-content li { margin-bottom: 0.4em; }

.post-content blockquote {
  margin: 1.6em 0;
  padding: 14px 20px;
  border-left: 3px solid var(--accent);
  background: var(--bg2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
  font-style: italic;
}

.post-content blockquote p { margin-bottom: 0; }

.post-content img {
  border-radius: var(--radius);
  margin: 1.8em auto;
  border: 1px solid var(--border);
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}

.post-content th,
.post-content td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.post-content th {
  background: var(--bg3);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.post-content tr:nth-child(even) td { background: var(--bg2); }

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

/* Inline code */
.post-content :not(pre) > code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875em;
  background: var(--bg3);
  color: var(--accent-h);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ============================================================
   11. CODE BLOCKS
   ============================================================ */
.code-block {
  position: relative;
  margin: 1.8em 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--code-bg);
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

.code-lang {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

.code-copy {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  padding: 3px 8px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  line-height: 1;
}

.code-copy:hover {
  color: var(--text);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.code-copy.copied {
  color: var(--cat-iis);
  border-color: var(--cat-iis);
}

.code-copy svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* pre inside the wrapper — reset extra margins */
.code-block pre,
.post-content pre {
  margin: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

.code-block code,
.post-content pre code {
  display: block;
  padding: 20px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--text);
  background: transparent;
  tab-size: 2;
  -moz-tab-size: 2;
}

/* Bare <pre> without .code-block wrapper (WP content) */
.post-content pre:not(.code-block pre) {
  margin: 1.8em 0;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--code-bg);
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.75;
}

/* ============================================================
   12. BREADCRUMBS
   ============================================================ */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 28px;
}

.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); text-decoration: none; }
.breadcrumbs .sep { opacity: 0.35; font-size: 0.72rem; }

/* ============================================================
   13. POST NAVIGATION (prev/next)
   ============================================================ */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.post-nav-link {
  padding: 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
  display: block;
  text-decoration: none;
}

.post-nav-link:hover { border-color: var(--accent); text-decoration: none; }

.post-nav-link.next { text-align: right; }

.post-nav-label {
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  display: block;
}

.post-nav-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: block;
  transition: color 0.15s;
}

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

/* ============================================================
   14. RELATED POSTS
   ============================================================ */
.related-posts {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* ============================================================
   15. FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg2);
  padding: 40px 0 24px;
  margin-top: 80px;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: start;
  margin-bottom: 32px;
}

.footer-brand .brand { margin-bottom: 10px; }

.footer-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 320px;
}

.footer-nav ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: right;
}

.footer-nav a {
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.15s;
}

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

.footer-bottom {
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-copy {
  font-size: 0.775rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}

.social-links { display: flex; gap: 6px; }

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: color 0.15s, border-color 0.15s;
}

.social-link:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }

.social-link svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* SVG brand icons that use fill */
.social-link .icon-fill { fill: currentColor; stroke: none; }

/* ============================================================
   16. PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.pagination .page-numbers {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  font-size: 0.875rem;
  font-family: 'JetBrains Mono', monospace;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  text-decoration: none;
}

.pagination a.page-numbers:hover {
  color: var(--text);
  background: var(--bg3);
  border-color: var(--accent);
}

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

/* ============================================================
   17. SEARCH RESULTS PAGE
   ============================================================ */
.search-title {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 32px;
  font-family: 'JetBrains Mono', monospace;
}

.search-title strong { color: var(--text); }

/* ============================================================
   18. 404 PAGE
   ============================================================ */
.not-found {
  text-align: center;
  padding: 100px 24px;
}

.not-found-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 7rem;
  font-weight: 700;
  color: var(--bg3);
  line-height: 1;
  margin-bottom: 16px;
  user-select: none;
}

.not-found h1 {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.not-found p {
  color: var(--muted);
  margin-bottom: 32px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================
   19. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-h);
  border-color: var(--accent-h);
  color: #fff;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ============================================================
   20. HOME + ARCHIVE — TWO COLUMN LAYOUT
   ============================================================ */
.home-wrap {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  align-items: start;
}

.home-main { min-width: 0; }

.home-hero {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.home-hero h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 8px;
}

.home-hero p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

/* ============================================================
   21. POST LIST ITEM (c-sharpcorner style)
   ============================================================ */
.post-list-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  padding: 16px 0 12px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.post-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

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

/* Circular category icon */
.post-list-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.75rem;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.2s;
  overflow: hidden;
  background: var(--bg3);
  color: var(--muted);
}

.post-list-icon:hover { opacity: 0.85; transform: scale(1.06); }

.post-list-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Per-category circle colours */
.post-list-icon.cat-csharp  { background: color-mix(in srgb, var(--cat-csharp) 22%, var(--bg2)); color: var(--cat-csharp); }
.post-list-icon.cat-sql     { background: color-mix(in srgb, var(--cat-sql)    22%, var(--bg2)); color: var(--cat-sql); }
.post-list-icon.cat-iis     { background: color-mix(in srgb, var(--cat-iis)    22%, var(--bg2)); color: var(--cat-iis); }
.post-list-icon.cat-vue     { background: color-mix(in srgb, var(--cat-vue)    22%, var(--bg2)); color: var(--cat-vue); }
.post-list-icon.cat-review  { background: color-mix(in srgb, var(--cat-review) 22%, var(--bg2)); color: var(--cat-review); }
.post-list-icon.cat-ps      { background: color-mix(in srgb, var(--cat-ps)     22%, var(--bg2)); color: var(--cat-ps); }
.post-list-icon.cat-java    { background: color-mix(in srgb, var(--cat-java)   22%, var(--bg2)); color: var(--cat-java); }
.post-list-icon.cat-js      { background: color-mix(in srgb, var(--cat-js)     22%, var(--bg2)); color: var(--cat-js); }

/* Text content */
.post-list-body {
  flex: 1;
  min-width: 0;
}

.post-list-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 4px;
}

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

.post-list-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.775rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.post-list-meta .sep { opacity: 0.3; }

/* Right-side category tag (like "Articles" pill in c-sharpcorner) */
.post-list-tag {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 20px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.post-list-tag:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* ============================================================
   22. SIDEBAR WIDGETS
   ============================================================ */
.sidebar {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.widget {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.widget-title {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Sidebar trending post */
.widget-post {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
  transition: background 0.15s;
}

.widget-post:last-child { border-bottom: none; }
.widget-post:hover { background: var(--bg3); }

.widget-post-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--border);
  min-width: 16px;
  padding-top: 2px;
  font-weight: 700;
}

.widget-post-title {
  font-size: 0.825rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
  display: block;
  transition: color 0.15s;
}

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

.widget-post-date {
  font-size: 0.68rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px;
  display: block;
}

/* Sidebar category list */
.widget-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  gap: 8px;
}

.widget-cat:last-child { border-bottom: none; }
.widget-cat:hover { background: var(--bg3); }

.widget-cat a {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
  flex: 1;
  transition: color 0.15s;
}

.widget-cat a:hover { color: var(--accent); text-decoration: none; }

.widget-cat-count {
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 26px;
  text-align: center;
  flex-shrink: 0;
}

/* ============================================================
   23. RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .home-wrap { grid-template-columns: 1fr 260px; gap: 32px; }
}

@media (max-width: 900px) {
  .home-wrap { grid-template-columns: 1fr; }
  .sidebar   { position: static; }
  .posts-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-nav ul { text-align: left; flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 768px) {
  .site-main { padding: 32px 0; }

  .primary-nav { display: none; }
  .nav-toggle   { display: flex; }

  .posts-grid { grid-template-columns: 1fr; }

  .post-nav { grid-template-columns: 1fr; }
  .post-nav-link.next { text-align: left; }

  .related-grid { grid-template-columns: 1fr; }

  .footer-bottom { flex-direction: column; align-items: flex-start; }

  .page-hero { padding: 32px 0 24px; }
  .post-header { padding: 32px 0 28px; margin-bottom: 32px; }
}

@media (max-width: 480px) {
  .container    { padding: 0 16px; }
  .content-wrap { padding: 0 16px; }
  .header-inner { gap: 8px; }
  .post-meta    { gap: 12px; }

  .post-list-icon  { width: 40px; height: 40px; font-size: 0.65rem; }
  .post-list-title { font-size: 0.9rem; }
}
