:root {
  --bg: #0b0d12;
  --surface: #11141b;
  --text: #e9ecf1;
  --muted: #8a93a6;
  --accent: #cfe2ff;
  --accent-dark: #8ec5fc;
  --border: #1f2530;
  --gap: 24px;
  --max-width: 1040px;
}

[data-theme="light"] {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #11141b;
  --muted: #5a6378;
  --accent: #1f5fd4;
  --accent-dark: #1040aa;
  --border: #d8dee8;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 150px;
  padding-left: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  margin-left: -22px;
}
.brand:hover { text-decoration: none; }

.brand-logo {
  height: 140px;
  width: auto;
  display: block;
}

.nav { display: flex; gap: 18px; }
.nav a {
  color: var(--muted);
  font-weight: 500;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--text); text-decoration: none; }

.hero {
  padding: 80px 0 40px;
}

.hero h1 {
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.1;
  margin: 0 0 16px;
  letter-spacing: -0.5px;
}

.hero p {
  color: var(--muted);
  font-size: 18px;
  max-width: 640px;
  margin: 0;
}

.cta-row { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 600;
}
.primary {
  background: linear-gradient(135deg, #8ec5fc, #7c9cff);
  color: #001026;
}
.secondary {
  background: rgba(255,255,255,0.06);
  color: var(--accent);
  border: 1px solid var(--border);
}

.latest { padding: 20px 0 80px; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}
.link { color: var(--accent-dark); }

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

.latest .post-grid {
  grid-template-columns: repeat(2, 1fr);
}

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

  .latest .post-grid {
    grid-template-columns: 1fr;
  }

  .about-hero img, .post-hero {
    width: 86%;
    margin-left: auto;
    margin-right: auto;
  }
}

.post-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  overflow: hidden;
}

.post-card:hover {
  border-color: rgba(142,197,252,0.35);
  transform: translateY(-2px);
}

.post-card-inner { color: inherit; display: block; }
.post-card:hover .post-card-inner { text-decoration: none; }

.post-card h3 { margin: 0 0 8px; font-size: 20px; }
.post-card-image { display: block; max-height: 160px; max-width: 100%; height: auto; width: auto; object-fit: contain; border-radius: 10px; margin-top: 12px; border: 1px solid var(--border); }
.post-card .excerpt { color: var(--muted); margin: 0; }
.post-card .meta { margin-top: 14px; color: var(--muted); font-size: 13px; }

.post-list { display: flex; flex-direction: column; gap: var(--gap); }

.post-row {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid var(--border);
  border-radius: 16px;
}

.post-row:hover { border-color: rgba(142,197,252,0.35); }

.post-row-inner { color: inherit; display: block; padding: 18px; }
.post-row:hover .post-row-inner { text-decoration: none; }

.post-row h2 { margin: 0 0 6px; font-size: 20px; }
.post-row .excerpt { color: var(--muted); margin: 0; }
.post-row .meta { margin-top: 12px; color: var(--muted); font-size: 13px; }

.prose { max-width: 720px; padding-top: 48px; padding-bottom: 90px; }
.prose figure.post-hero { margin: 0 0 18px; }
.prose figure.post-hero img { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 12px; }
.prose h1 { font-size: 38px; margin: 0 0 6px; letter-spacing: -0.3px; }
.prose .post-date { color: var(--muted); font-size: 14px; margin-bottom: 18px; display: block; }
.prose .meta { color: var(--muted); margin-bottom: 28px; }
.prose .lead { color: var(--text); font-size: 17px; margin: 0 0 24px; }
.share-row { margin: 14px 0 18px; }
.share-linkedin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: #e9ecf1;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.share-linkedin:hover {
  border-color: rgba(142,197,252,0.35);
  text-decoration: none;
  background: rgba(255,255,255,0.06);
}
.share-linkedin::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23e9ecf1'%3E%3Cpath d='M20.45 20.45h-3.56v-5.57c0-1.33-.02-3.04-1.85-3.04-1.86 0-2.14 1.45-2.14 2.95v5.66H9.34V9h3.42v1.56h.05a3.75 3.75 0 0 1 3.38-1.85c3.61 0 4.28 2.38 4.28 5.47v6.27zM5.34 7.43a2.07 2.07 0 1 1 0-4.14 2.07 2.07 0 0 1 0 4.14zM7.12 20.45H3.56V9h3.56v11.45zM22.22 0H1.78A1.77 1.77 0 0 0 0 1.76v20.49A1.77 1.77 0 0 0 1.78 24h20.44A1.77 1.77 0 0 0 24 22.24V1.76A1.77 1.77 0 0 0 22.22 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  flex-shrink: 0;
}

#theme-toggle {
  background: transparent;
  border: 0;
  padding: 6px 4px;
  cursor: pointer;
  line-height: 0;
  color: #b39ddb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border-radius: 0;
  box-shadow: none;
}
#theme-toggle svg {
  display: block;
  width: 22px;
  height: 22px;
}
.prose h2 { font-size: 22px; margin: 28px 0 10px; }
.prose p { color: var(--text); }
.prose ul { color: var(--text); }

.benchmark-figure {
  margin: 10px 0 28px;
  padding: 0;
}
.benchmark-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.benchmark-figure figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.post-nav { margin-top: 32px; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-inner .links { display: flex; gap: 16px; }

@media (max-width: 640px) {
  .header-inner { height: auto; padding: 14px 0; flex-wrap: wrap; gap: 10px; justify-content: center; }
  .brand { margin-left: 0; flex: 1 1 100%; justify-content: center; }
  .brand-logo { height: auto; width: 100%; }
  .nav { width: 100%; gap: 12px; justify-content: center; margin-left: 0; }
  .footer-inner { flex-direction: column; gap: 10px; align-items: flex-start; }
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 0 0 32px;
}
.category-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  padding: 28px 18px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  transition: transform .08s ease, background .12s ease;
}
.category-btn:hover {
  background: rgba(255,255,255,0.06);
  transform: translateY(-1px);
}
.category-btn[data-count] {
  position: relative;
}
.category-btn[data-count]::after {
  content: "(" attr(data-count) ")";
  display: block;
  font-size: 12px;
  font-weight: 600;
  opacity: .7;
  margin-top: 6px;
}
.post-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}
.post-list li {
  margin: 10px 0;
}
.post-list .post-date {
  opacity: .7;
  margin-left: 6px;
}
/* Category button counts - rendered as detached centred pill */
.category-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.category-count {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}
