/* Darkstack — Ghost theme */
:root {
  --bg: #0b0d10;
  --surface: #14171c;
  --surface-2: #1a1e24;
  --border: #22272e;
  --text: #e6e6e6;
  --muted: #9aa0a6;
  --accent: #7ee787;
  --accent-2: #79c0ff;
  --danger: #ff7b72;

  --font-sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --maxw: 720px;
  --maxw-wide: 1080px;
  --radius: 4px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.feed .wrap, .archive-header .wrap, .post-nav { max-width: var(--maxw); }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--accent); color: #000; padding: 8px 12px; z-index: 50; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(11,13,16,0.8);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; max-width: var(--maxw-wide);
}
.brand {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text); font-weight: 700; font-size: 17px;
  font-family: var(--font-mono);
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); }
.brand img { max-height: 28px; }

.primary-nav { display: flex; align-items: center; gap: 18px; }
.primary-nav ul { display: flex; gap: 18px; list-style: none; padding: 0; margin: 0; }
.primary-nav a { color: var(--muted); font-size: 14px; font-family: var(--font-mono); }
.primary-nav a:hover { color: var(--accent); text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 14px; border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: transparent; color: var(--text);
  cursor: pointer; transition: all .15s ease;
}
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.btn-accent { background: var(--accent); color: #06250f; border-color: var(--accent); }
.btn-accent:hover { background: transparent; color: var(--accent); }
.btn-ghost { background: transparent; }

.nav-toggle {
  display: none; background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius); width: 36px; height: 36px; padding: 0;
  flex-direction: column; gap: 4px; align-items: center; justify-content: center;
  cursor: pointer;
}
.nav-toggle span { width: 16px; height: 2px; background: var(--text); display: block; }

/* Hero */
.hero { padding: 64px 0 24px; }
.prompt { color: var(--accent); margin: 0 0 12px; font-size: 13px; letter-spacing: .02em; }
.hero-title {
  font-size: clamp(34px, 6vw, 56px); line-height: 1.05; letter-spacing: -0.02em;
  font-weight: 800; margin: 0 0 16px;
}
.cursor {
  display: inline-block; color: var(--accent); margin-left: 4px;
  animation: blink 1.05s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }
.hero-sub { font-size: 18px; color: var(--muted); max-width: 560px; margin: 0; }

/* Newsletter */
.newsletter {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  margin: 48px 0;
}
.newsletter-inner { padding: 40px 20px; }
.newsletter-title { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.01em; }
.newsletter-sub { margin: 0 0 18px; font-size: 14px; }
.newsletter-form {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.newsletter-form input[type="email"] {
  flex: 1 1 240px; min-width: 0;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; font-family: var(--font-mono); font-size: 14px;
  outline: none;
}
.newsletter-form input[type="email"]:focus { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 25%, transparent); }
.form-msg { display: none; width: 100%; margin: 8px 0 0; font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.form-msg.form-err { color: var(--danger); }
.success .form-msg[data-members-success] { display: block; }
.error .form-msg[data-members-error] { display: block; }

/* Feed */
.feed { padding: 8px 0 64px; }
.section-heading { margin: 8px 0 24px; }
.post-list { display: flex; flex-direction: column; }
.post-card { border-top: 1px solid var(--border); }
.post-card:last-child { border-bottom: 1px solid var(--border); }
.post-card-link {
  display: block; padding: 22px 0; color: inherit;
}
.post-card-link:hover { text-decoration: none; }
.post-card-link:hover .post-card-title { color: var(--accent); }
.post-card-link:hover .read-more { color: var(--accent); }
.meta { color: var(--muted); font-size: 12.5px; }
.meta .dot { margin: 0 6px; }
.tag { color: var(--accent-2); }
.post-card-title {
  font-size: 22px; line-height: 1.25; margin: 6px 0 8px; letter-spacing: -0.01em;
  transition: color .15s ease;
}
.post-card-excerpt { color: var(--muted); margin: 0 0 8px; }
.read-more { color: var(--muted); font-size: 13px; transition: color .15s ease; }

/* Pagination */
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 24px 0; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.pagination a { color: var(--text); }

/* Post */
.post-header { padding: 56px 20px 12px; }
.post-title { font-size: clamp(28px, 4.5vw, 44px); line-height: 1.15; letter-spacing: -0.02em; margin: 10px 0 14px; font-weight: 800; }
.post-lede { font-size: 18px; color: var(--muted); margin: 0 0 16px; }
.byline { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; }
.post-feature { padding: 16px 20px 0; }
.post-feature img { border: 1px solid var(--border); border-radius: var(--radius); }
.post-feature figcaption { margin-top: 8px; font-size: 13px; text-align: center; }

.post-content { padding: 32px 20px 48px; }
.post-content > * + * { margin-top: 1.1em; }
.post-content h2, .post-content h3, .post-content h4 { letter-spacing: -0.01em; line-height: 1.25; margin-top: 1.6em; }
.post-content h2 { font-size: 26px; }
.post-content h3 { font-size: 21px; }
.post-content a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in oklab, var(--accent-2) 50%, transparent); }
.post-content a:hover { color: var(--accent); }
.post-content blockquote {
  margin: 1.4em 0; padding: 8px 16px; border-left: 3px solid var(--accent);
  color: var(--muted); background: var(--surface);
}
.post-content code {
  font-family: var(--font-mono); font-size: 0.9em;
  background: var(--surface-2); padding: 2px 6px; border-radius: 3px;
  border: 1px solid var(--border);
}
.post-content pre {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; overflow: auto;
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.55;
}
.post-content pre code { background: transparent; border: 0; padding: 0; font-size: inherit; }
.post-content hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.post-content img { border: 1px solid var(--border); border-radius: var(--radius); }
.post-content ul, .post-content ol { padding-left: 1.4em; }
.post-content li + li { margin-top: 0.4em; }
.post-content table { width: 100%; border-collapse: collapse; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.post-content figure { margin: 1.5em 0; }

.post-tags { padding: 0 20px 32px; display: flex; flex-wrap: wrap; gap: 10px; }
.post-tags .tag { color: var(--accent-2); font-size: 13px; }

.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  padding: 24px 20px 64px; max-width: var(--maxw); margin: 0 auto;
}
.post-nav-link {
  display: block; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--muted); font-size: 12px;
  transition: border-color .15s ease, color .15s ease;
}
.post-nav-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.post-nav-link span { display: block; color: var(--text); font-family: var(--font-sans); font-size: 15px; margin-top: 4px; line-height: 1.3; }
.post-nav-link.next { text-align: right; }
.post-nav-link.prev:only-child { grid-column: 1; }
.post-nav-link.next:only-child { grid-column: 2; }

/* Archive headers */
.archive-header { padding: 56px 0 8px; }
.archive-title { font-size: clamp(28px, 5vw, 40px); margin: 8px 0 8px; letter-spacing: -0.02em; }
.archive-desc { margin: 0 0 12px; max-width: 560px; }
.author-head { display: flex; gap: 18px; align-items: center; }

/* Error */
.error { padding: 96px 20px; text-align: left; }
.error-title { font-size: clamp(28px, 5vw, 44px); margin: 8px 0 12px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 32px; }
.footer-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 20px; max-width: var(--maxw-wide); font-size: 12.5px;
  flex-wrap: wrap; gap: 8px;
}

/* Responsive */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px; display: none;
  }
  .primary-nav.is-open { display: flex; }
  .primary-nav ul { flex-direction: column; gap: 0; }
  .primary-nav ul li a { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .primary-nav .btn { margin-top: 8px; width: 100%; }
  .header-row { position: relative; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-link.next { text-align: left; }
  .hero { padding: 40px 0 16px; }
  .post-header { padding-top: 36px; }
}

/* Copy code button */
.code-wrap { position: relative; }
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--font-mono); font-size: 11px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 3px 8px; cursor: pointer; opacity: 0; transition: opacity .15s ease;
}
.code-wrap:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Koenig editor required classes */
.kg-width-wide { max-width: 1100px; margin-left: 50%; transform: translateX(-50%); }
.kg-width-full { max-width: 100vw; margin-left: 50%; transform: translateX(-50%); }
.kg-width-full img { width: 100vw; }
.kg-image { max-width: 100%; height: auto; display: block; margin: 1.5rem auto; }
.kg-embed-card { display: flex; flex-direction: column; align-items: center; min-width: 100%; margin: 1.5rem 0; }
.kg-gallery-container { display: flex; flex-direction: column; max-width: 1100px; margin-left: 50%; transform: translateX(-50%); }
.kg-gallery-row { display: flex; flex-direction: row; justify-content: center; }
.kg-gallery-image img { display: block; margin: 0; width: 100%; height: 100%; }
.kg-gallery-row:not(:first-of-type) { margin: 0.75em 0 0 0; }
.kg-gallery-image:not(:first-of-type) { margin: 0 0 0 0.75em; }
.kg-bookmark-card { width: 100%; position: relative; }
.kg-bookmark-container { display: flex; color: inherit; text-decoration: none; background: var(--surface, #14171c); border: 1px solid var(--border, #22272e); }
.kg-bookmark-content { flex: 1 1 auto; padding: 1rem; }
.kg-bookmark-thumbnail { flex: 0 0 30%; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.kg-callout-card { display: flex; padding: 1rem; margin: 1.5rem 0; border: 1px solid var(--border, #22272e); }
.kg-toggle-card { padding: 1rem; border: 1px solid var(--border, #22272e); margin: 1.5rem 0; }
