/* ============================================================
   NextHop Ghost Theme — Linux Terminal UI
   ============================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
  --bg:          #0d1117;
  --bg-term:     #161b22;
  --bg-titlebar: #21262d;
  --bg-hover:    #1c2128;

  --green:       #3fb950;
  --green-bright:#56d364;
  --green-dim:   #238636;
  --cyan:        #79c0ff;
  --cyan-dim:    #388bfd;
  --yellow:      #e3b341;
  --red:         #f85149;
  --purple:      #bc8cff;
  --orange:      #ffa657;

  --text:        #e6edf3;
  --text-muted:  #8b949e;
  --text-faint:  #484f58;
  --text-comment:#6a737d;

  --border:      #30363d;
  --border-muted:#21262d;

  --tl-red:      #ff605c;
  --tl-yellow:   #ffbd44;
  --tl-green:    #00ca4e;

  --font-mono:   'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  --font-ui:     'Inter', system-ui, sans-serif;

  --radius:      8px;
  --radius-sm:   4px;
  --max-w:       1100px;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img { display: block; max-width: 100%; height: auto; }
a   { color: inherit; text-decoration: none; transition: color 0.15s; }

/* ── tmux status bar ──────────────────────────────────────── */
.tmux-bar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #1c7c3a;
  color: #000;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 0 12px;
  height: 22px;
  user-select: none;
}
.tmux-center { text-align: center; font-weight: 600; }
.tmux-user  { color: #000; }
.tmux-sep   { color: rgba(0,0,0,0.5); }
.tmux-path  { color: #000; font-weight: 700; }
.tmux-size  { color: rgba(0,0,0,0.6); }
.tmux-left, .tmux-right { font-size: 0.68rem; color: rgba(0,0,0,0.6); white-space: nowrap; }

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 22px;
  z-index: 100;
  background: rgba(13,17,23,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Prompt logo */
.site-logo { display: flex; align-items: center; gap: 0; flex-shrink: 0; white-space: nowrap; }
.prompt-user { color: var(--green); font-weight: 600; font-size: 0.9rem; }
.prompt-sep  { color: var(--text-muted); font-size: 0.9rem; }
.prompt-title{ color: var(--text); font-weight: 600; font-size: 0.9rem; margin-left: 4px; }

/* Nav */
.site-nav { flex: 1; }
.nav-list { list-style: none; display: flex; gap: 4px; }
.nav-list a {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-list a:hover, .nav-list a.active { color: var(--text); background: var(--bg-titlebar); }
.nav-dot-slash { color: var(--text-faint); }

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* Terminal subscribe button */
.btn-terminal {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green-bright);
  background: transparent;
  border: 1px solid var(--green-dim);
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-terminal:hover {
  background: rgba(63,185,80,0.1);
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(63,185,80,0.2);
}

/* Burger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.burger-line {
  display: block;
  width: 18px; height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all 0.25s;
}

@media (max-width: 768px) {
  .site-nav { display: none; }
  .nav-toggle { display: flex; flex-shrink: 0; }
  .btn-subscribe { font-size: 0.7rem; padding: 4px 8px; }
  .header-inner { padding: 0 12px; gap: 8px; }
  .prompt-sep { display: none; }
  .prompt-title { font-size: 0.78rem; }
  .prompt-user { font-size: 0.78rem; }
  .site-nav.is-open {
    display: block;
    position: fixed;
    top: 74px;
    left: 0; right: 0;
    background: rgba(13,17,23,0.98);
    padding: 16px 20px 24px;
    z-index: 99;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  }
  .site-nav.is-open .nav-list {
    flex-direction: column;
    gap: 0;
    list-style: none;
  }
  .site-nav.is-open .nav-list li {
    border-bottom: 1px solid var(--border);
  }
  .site-nav.is-open .nav-list li:last-child {
    border-bottom: none;
  }
  .site-nav.is-open .nav-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    padding: 14px 4px;
    color: var(--text-muted);
  }
  .site-nav.is-open .nav-list a::before {
    content: "→";
    color: var(--green);
    font-family: var(--font-mono);
    font-size: 0.8rem;
  }
  .site-nav.is-open .nav-list a:hover {
    color: var(--text);
    background: none;
  }
  /* Show subscribe inside the open nav menu */
  .site-nav.is-open::after {
    content: "";
    display: block;
    margin-top: 16px;
  }
}

/* ── Layout ───────────────────────────────────────────────── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.site-content { padding: 24px 0 64px; }
.site-wrapper { min-height: 60vh; }

/* ── Terminal window component ────────────────────────────── */
.terminal-window {
  background: var(--bg-term);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

.terminal-titlebar {
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 8px 14px;
  gap: 8px;
  min-height: 36px;
}

/* Traffic lights */
.traffic-lights { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tl {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tl-red    { background: var(--tl-red); }
.tl-yellow { background: var(--tl-yellow); }
.tl-green  { background: var(--tl-green); }

.terminal-title {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-body { padding: 16px 20px; }

/* ── Shared terminal line styles ──────────────────────────── */
.term-line   { font-size: 0.88rem; line-height: 2; }
.prompt      { color: var(--green); font-weight: 600; }
.cmd         { color: var(--text); }
.cmd-flag    { color: var(--cyan); }
.term-comment{ color: var(--text-comment); font-style: italic; }
.term-ok     { color: var(--green); }
.term-error  { color: var(--red); font-weight: 700; }
.cursor-block {
  display: inline-block;
  width: 9px; height: 15px;
  background: var(--green);
  vertical-align: middle;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
.mt-2 { margin-top: 12px; }

/* ── Neofetch hero ────────────────────────────────────────── */
.neofetch-section { margin: 24px 0 20px; }

.neofetch-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  margin: 12px 0 8px;
}

.neofetch-ascii {
  color: var(--cyan-dim);
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre;
  flex-shrink: 0;
  margin-top: 4px;
}

.neofetch-info { display: flex; flex-direction: column; gap: 4px; }
.nf-row { display: flex; align-items: baseline; gap: 0; font-size: 0.85rem; }
.nf-key    { color: var(--cyan); font-weight: 600; min-width: 48px; }
.nf-eq     { color: var(--text-muted); }
.nf-val    { color: var(--text-muted); }
.nf-val-white { color: var(--text); font-weight: 600; }
.nf-val-url { color: var(--cyan); text-decoration: underline; text-underline-offset: 2px; }
.nf-val-url:hover { color: var(--text); }

.nf-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.nf-tag {
  font-size: 0.72rem;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  background: var(--bg-titlebar);
  transition: all 0.15s;
}
.nf-tag:hover {
  border-color: var(--green-dim);
  color: var(--green-bright);
  background: rgba(63,185,80,0.08);
}

@media (max-width: 600px) {
  .neofetch-ascii { display: none; }
}

/* ── Subscribe section ────────────────────────────────────── */
.subscribe-section { margin: 0 0 20px; }

.subscribe-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.sub-label { color: var(--cyan); font-size: 0.85rem; white-space: nowrap; }
.sub-input {
  flex: 1;
  min-width: 200px;
  max-width: 480px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 7px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sub-input:focus {
  border-color: var(--green-dim);
  box-shadow: 0 0 0 3px rgba(63,185,80,0.12);
}
.sub-input::placeholder { color: var(--text-faint); }
.sub-btn {
  background: transparent;
  border: 1px solid var(--green-dim);
  color: var(--green-bright);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.sub-btn:hover {
  background: rgba(63,185,80,0.1);
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(63,185,80,0.2);
}
.sub-success { font-size: 0.85rem; margin-top: 10px; color: var(--green); }

/* ── ls command line ──────────────────────────────────────── */
.ls-command { margin: 8px 0 16px; }

/* ── Ghost Portal overlay (subscription modal backdrop) ───── */
#ghost-portal-root {
  font-family: var(--font-mono) !important;
}
#ghost-portal-root > div[data-portal="root"] {
  background: rgba(13,17,23,0.88) !important;
  backdrop-filter: blur(12px) !important;
}

/* ── Post feed grid — 3 columns, equal tiles ──────────────── */
.posts-section { margin-top: 8px; }

.post-feed {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 40px;
  width: 100%;
  box-sizing: border-box;
}

.post-feed .post-card {
  width: calc(33.333% - 14px);
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 700px) {
  .post-feed .post-card { width: calc(50% - 10px); }
}
@media (max-width: 480px) {
  .post-feed .post-card { width: 100%; }
}

/* ── Post card ────────────────────────────────────────────── */
.post-card {
  display: flex;
  flex-direction: column;
}
.post-card .terminal-window {
  display: flex;
  flex-direction: column;
  flex: 1;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.post-card:hover .terminal-window {
  border-color: rgba(63,185,80,0.35);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.card-filename { font-size: 0.72rem; }
.card-dots     { margin-left: auto; color: var(--text-faint); font-size: 0.68rem; letter-spacing: 3px; }

/* ── Image zone — fixed height on every card ──────────────── */
.card-image-zone {
  width: 100%;
  height: 190px;
  overflow: hidden;
  flex-shrink: 0;
}
.card-image-zone a { display: block; width: 100%; height: 100%; }
.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
  display: block;
}
.post-card:hover .card-image { transform: scale(1.05); }

/* No-image placeholder — same aspect ratio */
.card-no-image {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #161b22 0%, #1c2128 60%, #161b22 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-no-image-cmd {
  font-size: 0.65rem;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 12px;
}

/* Card body — flex so excerpt fills remaining space */
.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
}

.card-top-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}
.card-tag-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan-dim);
  flex-shrink: 0;
}
.card-tag   { color: var(--cyan); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; position: relative; z-index: 1; }
.card-tag:hover { color: var(--text); }
.card-reading-time { color: var(--text-faint); font-size: 0.7rem; margin-left: auto; }

.card-title-link  { position: relative; z-index: 1; }
.card-title-link:hover .card-title { color: var(--green-bright); }
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  letter-spacing: -0.01em;
  transition: color 0.15s;
}

/* Fixed 3-line clamp keeps all cards' excerpt area same height */
.card-excerpt {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(0.78rem * 1.6 * 3);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border-muted);
  background: var(--bg-titlebar);
  margin-top: auto;
}
.card-author { display: flex; align-items: center; gap: 8px; }
.card-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}
.card-avatar-placeholder {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--green-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; color: #fff;
}
.card-date { font-size: 0.72rem; color: var(--text-muted); }
.card-read-cmd {
  font-size: 0.72rem;
  color: var(--green);
  font-weight: 600;
  transition: color 0.15s;
  position: relative; z-index: 1;
}
.card-read-cmd:hover { color: var(--green-bright); }

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 0 32px;
  font-size: 0.82rem;
}
.pagination .older-posts,
.pagination .newer-posts {
  color: var(--green);
  border: 1px solid var(--border);
  padding: 5px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.pagination .older-posts:hover,
.pagination .newer-posts:hover {
  border-color: var(--green-dim);
  background: rgba(63,185,80,0.08);
}
.pagination .page-number { color: var(--text-muted); }

/* ── Single Post ──────────────────────────────────────────── */
.post-breadcrumb { margin: 24px 0 16px; }

.post-header-body { padding: 20px 24px; }

.post-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
  background: rgba(121,192,255,0.08);
  border: 1px solid rgba(121,192,255,0.2);
  padding: 2px 10px;
  border-radius: 3px;
  margin-bottom: 12px;
  transition: all 0.15s;
}
.post-tag:hover { background: rgba(121,192,255,0.15); }

.post-full-title {
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 12px;
}

.post-full-excerpt {
  font-size: 0.9rem;
  color: var(--text-comment);
  font-style: italic;
  margin-bottom: 16px;
  line-height: 1.6;
}

.post-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-muted);
  font-size: 0.78rem;
}
.post-meta-author { display: flex; align-items: center; gap: 12px; }
.post-author-link  { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.post-author-name  { color: var(--text-muted); transition: color 0.15s; }
.post-author-link:hover .post-author-name { color: var(--text); }
.post-meta-right { display: flex; align-items: center; gap: 8px; color: var(--text-faint); }
.meta-sep { color: var(--text-faint); }

.post-feature-image { margin: 20px 0; }
.post-feature-image img {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.post-feature-image figcaption {
  font-size: 0.75rem;
  color: var(--text-comment);
  margin-top: 8px;
  text-align: center;
}

.post-content-window { margin-top: 20px; }

/* ── Post content typography ──────────────────────────────── */
.post-full-content {
  font-size: 0.92rem;
  line-height: 1.85;
  color: var(--text);
}
.post-full-content p     { margin-bottom: 1.4em; }
.post-full-content h2    { font-size: 1.4rem; color: var(--text); margin: 2.2em 0 0.7em; letter-spacing: -0.02em; }
.post-full-content h2::before { content: "## "; color: var(--green); }
.post-full-content h3    { font-size: 1.1rem; color: var(--text); margin: 1.8em 0 0.6em; }
.post-full-content h3::before { content: "### "; color: var(--green-dim); }
.post-full-content h4    { font-size: 0.98rem; margin: 1.4em 0 0.5em; color: var(--cyan); }
.post-full-content a     { color: var(--cyan); text-decoration: underline; text-underline-offset: 2px; }
.post-full-content a:hover { color: var(--text); }
.post-full-content ul,
.post-full-content ol    { padding-left: 1.6em; margin-bottom: 1.4em; }
.post-full-content li    { margin-bottom: 0.35em; }
.post-full-content li::marker { color: var(--green); }
.post-full-content blockquote {
  border-left: 3px solid var(--green-dim);
  padding: 2px 0 2px 20px;
  margin: 1.8em 0;
  color: var(--text-comment);
  font-style: italic;
}
.post-full-content blockquote::before { content: "// "; color: var(--green-dim); }
.post-full-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}
.post-full-content strong { color: #fff; font-weight: 700; }
.post-full-content em     { color: var(--yellow); }

/* Tables */
.post-full-content table {
  width: 100%; border-collapse: collapse; margin: 1.8em 0; font-size: 0.85rem;
}
.post-full-content th,
.post-full-content td { padding: 8px 14px; border: 1px solid var(--border); text-align: left; }
.post-full-content th { background: var(--bg-titlebar); color: var(--cyan); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.post-full-content tr:hover td { background: var(--bg-hover); }

/* Code */
.post-full-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(121,192,255,0.08);
  border: 1px solid rgba(121,192,255,0.15);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--cyan);
}
.post-full-content pre {
  background: #010409;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 1.8em -20px;
  overflow-x: auto;
  font-size: 0.83rem;
  line-height: 1.65;
  position: relative;
}
.post-full-content pre::before {
  content: "$ ";
  color: var(--green);
}
.post-full-content pre code {
  background: none; border: none; padding: 0; color: var(--text);
}

/* ── Post footer ──────────────────────────────────────────── */
.post-tags-bar {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.post-return { margin-top: 32px; }
.post-return a { color: var(--green); }
.post-return a:hover { text-decoration: underline; }

/* ── Koenig editor REQUIRED classes ───────────────────────── */
.kg-width-wide {
  position: relative;
  width: 85vw;
  min-width: 100%;
  margin: 2em calc(50% - 42.5vw);
}
.kg-width-full {
  position: relative;
  width: 100vw;
  margin: 2em calc(50% - 50vw);
}

/* Gallery */
.kg-gallery-container { margin: 1.8em 0; }
.kg-gallery-row       { display: flex; gap: 6px; margin-bottom: 6px; }
.kg-gallery-image     { flex: 1; overflow: hidden; border-radius: var(--radius-sm); }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; }

/* Bookmark */
.kg-bookmark-card {
  margin: 1.8em 0;
  background: var(--bg-term);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s;
}
.kg-bookmark-card:hover { border-color: var(--green-dim); }
.kg-bookmark-container  { display: flex; text-decoration: none; }
.kg-bookmark-content    { padding: 14px 18px; flex: 1; }
.kg-bookmark-title      { font-weight: 600; font-size: 0.88rem; color: var(--text); margin-bottom: 6px; }
.kg-bookmark-description{ font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; }
.kg-bookmark-metadata   { display: flex; align-items: center; gap: 6px; }
.kg-bookmark-icon       { width: 14px; height: 14px; }
.kg-bookmark-publisher,
.kg-bookmark-author     { font-size: 0.72rem; color: var(--text-faint); }
.kg-bookmark-thumbnail  { width: 120px; flex-shrink: 0; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

/* Callout */
.kg-callout-card {
  display: flex; gap: 14px; padding: 16px 18px;
  margin: 1.8em 0;
  background: rgba(63,185,80,0.06);
  border: 1px solid rgba(63,185,80,0.2);
  border-radius: var(--radius-sm);
}
.kg-callout-emoji { font-size: 1.3rem; flex-shrink: 0; }
.kg-callout-text  { font-size: 0.88rem; line-height: 1.65; }

/* Image card */
.kg-image-card { margin: 1.8em 0; }
.kg-image-card img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.kg-image-card figcaption { text-align: center; font-size: 0.75rem; color: var(--text-comment); margin-top: 6px; }

/* Button */
.kg-button-card { margin: 1.8em 0; display: flex; justify-content: center; }
.kg-btn {
  display: inline-flex; align-items: center; padding: 8px 24px;
  background: transparent; color: var(--green-bright);
  border: 1px solid var(--green-dim); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600;
  transition: all 0.15s; text-decoration: none;
}
.kg-btn:hover { background: rgba(63,185,80,0.1); border-color: var(--green); }

/* Embed */
.kg-embed-card { margin: 1.8em 0; }
.kg-embed-card iframe { border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* Video */
.kg-video-card { margin: 1.8em 0; }
.kg-video-card video { width: 100%; border-radius: var(--radius-sm); }

/* Toggle */
.kg-toggle-card { margin: 1.8em 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.kg-toggle-heading { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; cursor: pointer; background: var(--bg-titlebar); }
.kg-toggle-heading-text { font-weight: 600; font-size: 0.88rem; }
.kg-toggle-content { padding: 12px 16px; font-size: 0.85rem; color: var(--text-muted); }

/* ── Taxonomy / author pages ──────────────────────────────── */
.author-neofetch-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--green-dim);
  flex-shrink: 0;
}

/* ── Error page ───────────────────────────────────────────── */
.error-page { padding: 40px 0; }
.error-status { font-size: 1rem; margin: 10px 0 6px; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); margin-top: 32px; }
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 640px) {
  .footer-inner { flex-direction: row; align-items: center; justify-content: space-between; }
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.footer-nav a { font-size: 0.78rem; color: var(--text-muted); transition: color 0.15s; }
.footer-nav a:hover { color: var(--text); }
.footer-nav .nav-dot-slash { color: var(--text-faint); }
.footer-inner .term-comment a { color: var(--cyan); }
.footer-inner .term-comment a:hover { color: var(--text); }

/* ── Post page — body layout with sticky TOC ──────────────── */
.post-body-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 24px;
  align-items: start;
  margin-top: 20px;
  width: 100%;
}

.post-main { min-width: 0; width: 100%; }

/* Desktop: sidebar sticky */
.toc-sidebar {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  overflow-x: visible;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

@media (max-width: 900px) {
  .post-body-layout {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  .post-main {
    width: 100% !important;
    min-width: 0 !important;
  }
  /* TOC: static at top, not sticky, not overlapping */
  .toc-sidebar {
    order: -1;
    position: static !important;
    max-height: none;
    overflow: visible;
    width: 100%;
  }
  /* Clap: show the inline one (in post-main), hide sidebar clap */
  .clap-sidebar { display: none !important; }
  .clap-inline  { display: block !important; }
}

@media (min-width: 901px) {
  /* Desktop: hide inline clap, show sidebar clap */
  .clap-inline  { display: none; }
  .clap-sidebar { display: block; }
}

.toc-window { font-size: 0.78rem; }
.toc-body   { padding: 12px 14px; }
.toc-prompt { margin-bottom: 10px; font-size: 0.72rem; }
.toc-label  { color: var(--text-muted); }

#toc-nav { display: flex; flex-direction: column; gap: 2px; }

.toc-link {
  display: block;
  padding: 4px 8px;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.4;
  border-left: 2px solid transparent;
  border-radius: 0 3px 3px 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toc-link::before { content: "# "; color: var(--text-faint); }
.toc-link.toc-h3  { padding-left: 20px; font-size: 0.68rem; }
.toc-link.toc-h3::before { content: "## "; }
.toc-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.toc-link.is-active {
  color: var(--green-bright);
  border-left-color: var(--green);
  background: rgba(63,185,80,0.06);
}

/* ── Clap widget ──────────────────────────────────────────── */
.clap-widget {
  font-family: var(--font-mono);
  margin-bottom: 24px;
}
.clap-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.clap-comment {
  font-size: 0.72rem;
  color: var(--text-comment);
}

.clap-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
}

.clap-btn {
  background: none;
  border: 1px solid #30363d;
  border-radius: 6px;
  cursor: pointer;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: border-color 0.15s, background 0.15s, opacity 0.2s;
  position: relative;
  font-family: inherit;
}
.clap-btn:hover {
  border-color: #3fb950;
  background: #0f2b14;
}
.clap-btn.is-active { border-color: #3fb950; }
.clap-btn.is-exhausted {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.clap-icon {
  font-size: 16px;
  display: inline-block;
  transition: transform 0.15s;
}
.clap-btn.is-animating .clap-icon {
  animation: clapBurst 0.35s ease forwards;
}
@keyframes clapBurst {
  0%   { transform: scale(1)    rotate(0deg); }
  40%  { transform: scale(1.35) rotate(-12deg); }
  70%  { transform: scale(1.2)  rotate(5deg); }
  100% { transform: scale(1)    rotate(0deg); }
}

.clap-btn-text { font-size: 12px; color: #e6edf3; }
.clap-brace    { font-size: 12px; color: #8b949e; }
.clap-count    { font-size: 12px; color: #3fb950; min-width: 22px; text-align: center; font-weight: 700; }

.clap-share      { font-size: 12px; font-family: 'Courier New', Courier, monospace; }
.clap-share-cmd  { color: #79c0ff; }
.clap-share-flag { color: #8b949e; }

.clap-output {
  font-size: 11px;
  color: #8b949e;
  margin-top: 10px;
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.clap-cursor {
  display: inline-block;
  width: 7px; height: 13px;
  background: #3fb950;
  vertical-align: middle;
  animation: blink 1s step-end infinite;
}

/* Float label above button */
.clap-float {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #3fb950;
  font-family: 'Courier New', Courier, monospace;
  pointer-events: none;
  animation: floatUp 0.65s ease forwards;
  white-space: nowrap;
}
@keyframes floatUp {
  from { opacity: 1; top: -18px; }
  to   { opacity: 0; top: -40px; }
}

/* ── Ghost Portal — custom overlay backdrop ───────────────── */
#ghost-portal-root > div {
  background: rgba(13, 17, 23, 0.92) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
}

/* ── Subscribe section spacing ────────────────────────────── */
.subscribe-section { margin-top: 24px; }

/* ── Traceroute section ───────────────────────────────────── */
.traceroute-section { margin: 20px 0; }

.tr-live-dot {
  margin-left: auto;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: tr-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes tr-pulse {
  0%,100% { opacity: 1; box-shadow: 0 0 6px var(--green); }
  50%      { opacity: 0.5; box-shadow: 0 0 2px var(--green); }
}

.tr-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin: 12px 0 4px;
}
.tr-hops { flex: 1; min-width: 0; }
.tr-globe-wrap {
  flex-shrink: 0;
  width: 160px;
  height: 160px;
}
#tr-globe {
  width: 160px;
  height: 160px;
  display: block;
  opacity: 0.85;
}

.tr-hop-list { display: flex; flex-direction: column; gap: 2px; margin: 8px 0; }
.tr-hop {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  line-height: 1.8;
  animation: tr-hop-in 0.4s ease both;
}
@keyframes tr-hop-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.tr-hop-num   { color: var(--text-faint); min-width: 18px; text-align: right; }
.tr-hop-flag  { font-size: 1rem; }
.tr-hop-city  { color: var(--cyan); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-hop-ms    { color: var(--green); min-width: 60px; text-align: right; }
.tr-hop-bar   { height: 2px; background: var(--green-dim); border-radius: 2px; flex-shrink: 0; }
.tr-hop.is-you .tr-hop-city { color: var(--green-bright); font-weight: 700; }

.tr-summary { margin-top: 10px; font-size: 0.82rem; }
.tr-count   { color: var(--green); font-weight: 700; }

@media (max-width: 560px) {
  .tr-globe-wrap { display: none; }
}

/* ── Git diff / versioning widget ────────────────────────────── */
.post-changelog-rendered {
  margin: 20px 0;
  font-family: var(--font-mono);
}
.changelog-header {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.terminal-window.changelog-window { margin-bottom: 16px; }
.changelog-body { padding: 14px 18px; font-size: 0.8rem; }

.git-log-entry { margin-bottom: 14px; }
.git-commit-line {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.git-hash   { color: var(--yellow); font-size: 0.75rem; }
.git-date   { color: var(--text-faint); font-size: 0.72rem; }
.git-msg    { color: var(--text); font-size: 0.82rem; font-weight: 600; }

.git-diff   { padding: 8px 0 0 12px; border-left: 2px solid var(--border); }
.diff-add   { display: block; color: var(--green); }
.diff-add::before  { content: "+ "; }
.diff-rem   { display: block; color: var(--red); }
.diff-rem::before  { content: "- "; }
.diff-ctx   { display: block; color: var(--text-muted); }
.diff-ctx::before  { content: "  "; }

/* hide the source .post-changelog block — JS renders it instead */
.post-full-content .post-changelog { display: none; }

/* ── Ghost {{navigation}} helper output styling ───────────── */
.site-nav .nav,
.footer-nav .nav,
.nf-tags .nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-nav .nav li a,
.footer-nav .nav li a {
  color: var(--green);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  transition: color 0.2s;
}

.site-nav .nav li a::before,
.footer-nav .nav li a::before {
  content: './';
  color: var(--text-muted);
}

.site-nav .nav li a:hover,
.footer-nav .nav li a:hover {
  color: var(--green-bright);
}

.site-nav .nav li a.nav-current {
  color: var(--green-bright);
  text-decoration: underline;
}

.nf-tags .nav {
  gap: 0.4rem;
}

.nf-tags .nav li a {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--green-dim);
  border-radius: 4px;
  color: var(--green);
  text-decoration: none;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  transition: background 0.2s, color 0.2s;
}

.nf-tags .nav li a:hover {
  background: var(--green-dim);
  color: var(--bg);
}
