@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,600;1,9..144,300&display=swap');

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

:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1e252e;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #39d353;
  --accent2: #58a6ff;
  --accent3: #f78166;
  --mono: 'JetBrains Mono', monospace;
  --serif: 'Fraunces', Georgia, serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  min-height: 100vh;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }

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

/* ── HEADER ── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon svg { width: 16px; height: 16px; }

.logo-text {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
  display: block;
}

.logo-domain {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.02em;
  display: block;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s;
  border: 1px solid transparent;
  font-family: var(--mono);
}

.site-nav a:hover {
  color: var(--text);
  background: var(--bg3);
  border-color: var(--border);
}

.site-nav a.nav-current {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(57, 211, 83, 0.06);
}

.nav-rss {
  color: var(--accent3) !important;
  border-color: var(--accent3) !important;
  background: rgba(247, 129, 102, 0.06) !important;
}

.nav-rss:hover {
  background: rgba(247, 129, 102, 0.12) !important;
}

/* ── HERO ── */
.hero-strip {
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  padding: 2.5rem 2rem;
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
}

.hero-label {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 300;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
}

.hero-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  max-width: 540px;
}

.hero-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: right;
}

.stat-block {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 18px;
  min-width: 120px;
}

.stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 2px;
}

.stat-num.green { color: var(--accent); }
.stat-num.blue { color: var(--accent2); }

.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── LAYOUT ── */
.main-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2.5rem;
  align-items: start;
}

/* ── FILTERS ── */
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 4px;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-block;
}

.filter-btn:hover,
.filter-btn.active {
  color: var(--accent2);
  border-color: var(--accent2);
  background: rgba(88, 166, 255, 0.08);
}

/* ── POST LIST ── */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.post-card {
  background: var(--bg);
  padding: 1.5rem;
  transition: background 0.15s;
  position: relative;
  display: block;
}

.post-card:hover { background: var(--bg2); }

.post-card.featured {
  background: var(--bg2);
  border-left: 3px solid var(--accent);
}

.post-card.featured:hover { background: var(--bg3); }

.post-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.post-date {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.dot { color: var(--border); font-size: 10px; }

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: 0.03em;
  display: inline-block;
}

.featured-badge {
  font-size: 10px;
  padding: 2px 7px;
  background: rgba(57, 211, 83, 0.15);
  color: var(--accent);
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.post-title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.post-excerpt {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 14px;
  max-width: 620px;
}

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

.read-time {
  font-size: 11px;
  color: var(--muted);
}

.read-link {
  font-size: 12px;
  color: var(--accent2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.02em;
  transition: gap 0.15s;
}

.post-card:hover .read-link { gap: 7px; }

/* ── TAG COLORS ── */
.tag-blue { background: rgba(88,166,255,0.12); color: #58a6ff; }
.tag-green { background: rgba(57,211,83,0.12); color: #39d353; }
.tag-orange { background: rgba(247,129,102,0.12); color: #f78166; }
.tag-purple { background: rgba(188,140,255,0.12); color: #bc8cff; }
.tag-yellow { background: rgba(230,197,80,0.12); color: #e6c550; }
.tag-default { background: rgba(139,148,158,0.12); color: #8b949e; }

/* ── PAGINATION ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 2rem;
}

.page-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  text-decoration: none;
}

.page-btn:hover,
.page-btn.current {
  color: var(--accent2);
  border-color: var(--accent2);
  background: rgba(88,166,255,0.06);
}

/* ── SIDEBAR ── */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.widget-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 500;
}

.widget-body { padding: 12px 16px; }

/* stack widget */
.stack-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.stack-item:last-child { border-bottom: none; }
.stack-name { color: var(--text); }

/* topics widget */
.topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  transition: all 0.15s;
}
.topic-row:last-child { border-bottom: none; }
.topic-row:hover .topic-name { color: var(--accent2); }
.topic-name { font-size: 13px; color: var(--text); transition: color 0.15s; }
.topic-count {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topic-bar {
  height: 3px;
  border-radius: 2px;
  background: var(--accent2);
  opacity: 0.4;
}

/* newsletter */
.newsletter-blurb {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 12px;
}
.nl-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  outline: none;
  transition: border-color 0.15s;
}
.nl-input:focus { border-color: var(--accent2); }
.nl-input::placeholder { color: var(--muted); }
.nl-btn {
  width: 100%;
  background: var(--accent);
  color: #0d1117;
  border: none;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  padding: 9px;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: opacity 0.15s;
}
.nl-btn:hover { opacity: 0.85; }

/* activity grid */
.activity-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 3px;
  margin-bottom: 8px;
}
.act-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--bg3);
}
.act-cell.l1 { background: #0e4429; }
.act-cell.l2 { background: #006d32; }
.act-cell.l3 { background: #26a641; }
.act-cell.l4 { background: #39d353; }
.activity-label {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

/* ── SINGLE POST ── */
.post-hero {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 3rem 2rem;
}

.post-hero-inner {
  max-width: 760px;
  margin: 0 auto;
}

.post-hero .post-meta-row { margin-bottom: 1.25rem; }

.post-hero-title {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 600;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.post-hero-excerpt {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.post-hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.post-feature-image {
  max-width: 760px;
  margin: 0 auto 2rem;
  padding: 0 2rem;
}

.post-feature-image img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.post-content-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

.post-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: var(--serif);
  color: var(--text);
  margin: 2rem 0 1rem;
  line-height: 1.3;
}

.post-content h2 { font-size: 26px; }
.post-content h3 { font-size: 20px; }

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

.post-content a { color: var(--accent2); text-decoration: underline; text-decoration-color: rgba(88,166,255,0.3); }
.post-content a:hover { text-decoration-color: var(--accent2); }

.post-content code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent3);
}

.post-content pre {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

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

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

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

.post-content li { margin-bottom: 0.5rem; }

.post-content img {
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 1.5rem 0;
}

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

.post-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ── FOOTER ── */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 2rem;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.footer-inner { max-width: 1100px; margin: 0 auto; }

.footer-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.footer-links a { color: var(--muted); transition: color 0.15s; }
.footer-links a:hover { color: var(--accent2); }

/* ── ERROR / EMPTY STATES ── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

.empty-state h2 {
  font-family: var(--serif);
  font-size: 24px;
  margin-bottom: 0.75rem;
  color: var(--text);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-stats { flex-direction: row; text-align: left; }
  .main-wrap { grid-template-columns: 1fr; padding: 1.5rem 1rem; }
  .sidebar { display: none; }
  .header-inner { padding: 0 1rem; }
  .site-nav { display: none; }
  .hero-strip { padding: 1.5rem 1rem; }
}

/* ── KOENIG EDITOR REQUIRED CLASSES ── */
.kg-width-wide {
  margin-left: -4rem;
  margin-right: -4rem;
}

.kg-width-full {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
}

.kg-image { max-width: 100%; }

.kg-gallery-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 1.5rem 0;
}

.kg-gallery-row {
  display: flex;
  gap: 4px;
}

.kg-gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.kg-bookmark-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 1.5rem 0;
}

.kg-bookmark-container {
  display: flex;
  text-decoration: none;
  color: var(--text);
}

.kg-bookmark-content {
  padding: 1rem;
  flex: 1;
}

.kg-bookmark-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.kg-bookmark-description {
  font-size: 13px;
  color: var(--muted);
}

.kg-bookmark-thumbnail img {
  width: 160px;
  height: 100%;
  object-fit: cover;
}

.kg-callout-card {
  display: flex;
  gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1.5rem 0;
}

.kg-toggle-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1.5rem 0;
}

.kg-video-card { margin: 1.5rem 0; }
.kg-video-card video { width: 100%; border-radius: 8px; }

.kg-audio-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1.5rem 0;
}

.kg-product-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.kg-header-card {
  background: var(--bg2);
  border-radius: 8px;
  padding: 2rem;
  margin: 1.5rem 0;
  text-align: center;
}

.kg-divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
