/* Terminal King — warm technical palette */
:root {
  --tk-bg: #0f0e0d;
  --tk-surface: #1c1917;
  --tk-surface-elevated: #242120;
  --tk-border: #3a3530;
  --tk-text: #f5f4f2;
  --tk-text-muted: #9e9890;
  --tk-accent: #d4a574;
  --tk-accent-hover: #e8c9a0;
  --tk-sage: #6b9080;
  --tk-warm: #c9a227;
  --tk-radius: 8px;

  /* Space Mono: logo, nav, code, tags — true terminal DNA */
  --tk-font-mono: "Space Mono", "SF Mono", "Consolas", monospace;

  /* Space Grotesk: titles, headings — geometric, web3-native */
  --tk-font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;

  /* Inter: body, excerpts, meta — gold standard for screen reading */
  --tk-font-body: "Inter", "Segoe UI", system-ui, sans-serif;
}

/* Aliases so existing rules keep working */
:root { --tk-font: var(--tk-font-mono); }

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

html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--tk-font-body);
  color: var(--tk-text);
  background: var(--tk-bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background canvas ───────────────────────── */
#tk-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#tk-bg.tk-bg-fallback {
  background: linear-gradient(180deg, var(--tk-bg) 0%, #0f0e0d 30%, #131210 60%, #0f0e0d 100%);
}
#tk-bg.tk-bg-fallback::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(212, 165, 116, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 165, 116, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

/* ── Viewport / layout ───────────────────────── */
.tk-viewport {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────── */
.tk-header {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--tk-border);
  background: rgba(15, 14, 13, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tk-nav {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.tk-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--tk-font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--tk-text);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.15s;
}

.tk-logo:hover {
  color: var(--tk-accent);
}

.tk-logo-img {
  display: block;
}

.tk-nav a:not(.tk-logo):not(.tk-btn) {
  font-family: var(--tk-font-mono);
  font-weight: 400;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--tk-text-muted);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.15s;
}

.tk-nav a:not(.tk-logo):not(.tk-btn):hover {
  color: var(--tk-accent);
}

.tk-btn {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: var(--tk-radius);
  font-family: var(--tk-font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  font-weight: 700;
  margin-left: auto;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tk-btn-ghost {
  color: var(--tk-text-muted);
  border: 1px solid var(--tk-border);
}

.tk-btn-ghost:hover {
  color: var(--tk-accent);
  border-color: var(--tk-accent);
}

.tk-btn-accent {
  background: var(--tk-accent);
  color: var(--tk-bg);
  border: 1px solid transparent;
}

.tk-btn-accent:hover {
  background: var(--tk-accent-hover);
}

/* ── Main content ─────────────────────────────── */
.tk-main {
  flex: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
  width: 100%;
}

/* Content cards sit on a surface so they're readable over the animation */
.tk-page {
  background: rgba(24, 22, 20, 0.88);
  border-radius: 12px;
  border: 1px solid var(--tk-border);
  padding: 2.5rem 2.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 0 0 1px rgba(212, 165, 116, 0.05), 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* ── Homepage tagline ─────────────────────────── */
.tk-tagline {
  font-family: var(--tk-font-body);
  color: var(--tk-text-muted);
  font-size: 1rem;
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

.tk-tagline-hero {
  font-family: var(--tk-font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: var(--tk-accent);
  margin-bottom: 2rem;
}

/* ── Feed / cards ─────────────────────────────── */
.tk-feed {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tk-card-post {
  background: var(--tk-surface-elevated);
  border-radius: var(--tk-radius);
  border: 1px solid var(--tk-border);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.tk-card-post:hover {
  border-color: var(--tk-accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.tk-card-post a {
  color: inherit;
  text-decoration: none;
  display: block;
}

.tk-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.tk-card-body {
  padding: 1.25rem 1.5rem;
}

.tk-card-title {
  font-family: var(--tk-font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  color: var(--tk-text);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.tk-card-meta {
  font-family: var(--tk-font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--tk-text-muted);
  margin: 0 0 0.6rem;
  text-transform: uppercase;
}

.tk-card-excerpt {
  font-family: var(--tk-font-body);
  font-size: 0.9rem;
  color: var(--tk-text-muted);
  margin: 0;
  line-height: 1.6;
}

/* ── Tags ─────────────────────────────────────── */
.tk-tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  background: rgba(107, 144, 128, 0.15);
  color: var(--tk-sage);
  border: 1px solid rgba(107, 144, 128, 0.3);
  border-radius: 4px;
  font-family: var(--tk-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  margin-bottom: 1rem;
  transition: background 0.15s, border-color 0.15s;
}

.tk-tag:hover {
  background: rgba(107, 144, 128, 0.25);
  border-color: var(--tk-sage);
}

/* ── Post single ──────────────────────────────── */
.tk-post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--tk-border);
}

.tk-post-title {
  font-family: var(--tk-font-display);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  color: var(--tk-text);
}

.tk-post-excerpt {
  font-family: var(--tk-font-body);
  color: var(--tk-text-muted);
  font-size: 1.05rem;
  line-height: 1.65;
  margin: 0 0 1rem;
}

.tk-post-meta {
  font-family: var(--tk-font-mono);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tk-text-muted);
}

.tk-post-meta a {
  color: var(--tk-text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.tk-post-meta a:hover {
  color: var(--tk-accent);
}

.tk-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--tk-border);
}

.tk-post-img {
  margin: 0 0 2rem;
  border-radius: var(--tk-radius);
  overflow: hidden;
}

.tk-post-img img {
  width: 100%;
  height: auto;
  display: block;
}

.tk-post-img figcaption {
  font-family: var(--tk-font-body);
  font-size: 0.82rem;
  color: var(--tk-text-muted);
  padding: 0.5rem 0;
  font-style: italic;
}

/* ── Post body ────────────────────────────────── */
.tk-post-content {
  font-family: var(--tk-font-body);
  font-size: 1.05rem;
  line-height: 1.78;
  color: var(--tk-text);
}

.tk-post-content p {
  margin: 0 0 1.2em;
}

.tk-post-content h2 {
  font-family: var(--tk-font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 2.2rem 0 0.8rem;
  color: var(--tk-accent);
  line-height: 1.2;
}

.tk-post-content h3 {
  font-family: var(--tk-font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 1.8rem 0 0.6rem;
  color: var(--tk-accent);
  line-height: 1.3;
}

.tk-post-content h4 {
  font-family: var(--tk-font-display);
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--tk-text);
}

.tk-post-content a {
  color: var(--tk-sage);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s;
}

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

.tk-post-content strong {
  font-weight: 600;
  color: var(--tk-text);
}

.tk-post-content em {
  color: var(--tk-text-muted);
}

.tk-post-content ul,
.tk-post-content ol {
  padding-left: 1.5rem;
  margin: 0 0 1.2em;
}

.tk-post-content li {
  margin-bottom: 0.35em;
  line-height: 1.65;
}

.tk-post-content pre,
.tk-post-content code {
  font-family: var(--tk-font-mono);
  background: var(--tk-surface);
  border-radius: 4px;
}

.tk-post-content code {
  padding: 0.15rem 0.45rem;
  font-size: 0.88em;
  color: var(--tk-accent);
}

.tk-post-content pre {
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--tk-border);
  border-radius: 6px;
  margin: 1.25rem 0;
}

.tk-post-content pre code {
  padding: 0;
  background: none;
  color: var(--tk-text);
  font-size: 0.88em;
}

.tk-post-content blockquote {
  border-left: 3px solid var(--tk-accent);
  margin: 1.75rem 0;
  padding: 0.5rem 0 0.5rem 1.25rem;
  color: var(--tk-text-muted);
  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.7;
}

.tk-post-content blockquote strong {
  color: var(--tk-accent);
  font-style: normal;
}

.tk-post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}

.tk-post-content th,
.tk-post-content td {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--tk-border);
  text-align: left;
  line-height: 1.5;
}

.tk-post-content th {
  background: rgba(212, 165, 116, 0.08);
  color: var(--tk-accent);
  font-family: var(--tk-font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

.tk-post-content td:first-child {
  font-weight: 500;
}

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

/* ── Task list checkboxes ─────────────────────── */
.tk-post-content ul li input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 1.5px solid var(--tk-sage);
  border-radius: 3px;
  background: transparent;
  vertical-align: middle;
  margin-right: 0.55rem;
  margin-top: -0.1em;
  flex-shrink: 0;
  position: relative;
  cursor: default;
  transition: background 0.15s, border-color 0.15s;
}

.tk-post-content ul li input[type="checkbox"]:checked {
  background: var(--tk-sage);
  border-color: var(--tk-sage);
}

.tk-post-content ul li input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 2.5px;
  top: 0px;
  width: 5px;
  height: 8px;
  border: 2px solid var(--tk-bg);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* Remove the bullet from task list items */
.tk-post-content ul li:has(> input[type="checkbox"]) {
  list-style: none;
  padding-left: 0;
  display: flex;
  align-items: baseline;
  gap: 0;
  margin-bottom: 0.55em;
}

.tk-post-content ul:has(li > input[type="checkbox"]) {
  padding-left: 0.25rem;
}

/* ── Pagination ───────────────────────────────── */
.tk-main .gh-pagination {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.tk-main .gh-pagination a,
.tk-main .gh-pagination span {
  font-family: var(--tk-font-body);
  font-size: 0.7rem;
  color: var(--tk-text-muted);
  text-decoration: none;
}

.tk-main .gh-pagination a:hover {
  color: var(--tk-accent);
}

/* ── Footer ───────────────────────────────────── */
.tk-footer {
  padding: 1.5rem 1.5rem 2rem;
  border-top: 1px solid var(--tk-border);
  background: rgba(12, 11, 10, 0.95);
  font-size: 0.85rem;
  color: var(--tk-text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.5rem;
}

.tk-footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.tk-footer-logo {
  display: block;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.15s;
}

.tk-footer-logo:hover {
  opacity: 1;
}

.tk-footer-tagline {
  font-family: var(--tk-font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--tk-text-muted);
  font-weight: 400;
}

.tk-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  font-family: var(--tk-font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tk-footer a {
  color: var(--tk-text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.tk-footer a:hover {
  color: var(--tk-accent);
}

/* ── Article images and diagrams ─────────────── */
.tk-main figure,
.tk-main figure.tk-article-figure {
  width: 100%;
  max-width: 100%;
  margin: 1.75rem auto;
  text-align: center;
}

.tk-main figure img,
.tk-main figure.tk-article-figure img {
  max-width: 100%;
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.tk-main .tk-article-diagram {
  width: 100%;
  max-width: 100%;
  margin: 1.75rem auto;
  overflow: visible;
}

.tk-main .tk-article-diagram svg {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

/* ── Koenig card widths (Ghost) ──────────────── */
.kg-width-wide { max-width: 960px; margin-left: auto; margin-right: auto; }
.kg-width-full { max-width: 100%; width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 640px) {
  .tk-nav {
    gap: 0.75rem;
  }

  .tk-btn {
    margin-left: 0;
  }

  .tk-post-title {
    font-size: 1.6rem;
  }

  .tk-page {
    padding: 1.25rem 1rem;
  }

  .tk-post-content h2 {
    font-size: 1.35rem;
  }

  .tk-post-content h3 {
    font-size: 1.1rem;
  }
}
