/*
 * The TechWeirdo — Editorial & Blog Design System
 * Extends /assets/ui.css (shadcn/ui New York, Zinc, OKLCH, Geist + Geist Mono)
 * so the blog and /tools/ share one cohesive, fast, light/dark experience.
 */

/* ---------- Reading progress bar ---------- */
.read-progress {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 45;
  height: 2px;
  background: transparent;
  pointer-events: none;
}
.read-progress-bar {
  height: 100%;
  width: var(--read-progress, 0%);
  background: linear-gradient(90deg, var(--brand), color-mix(in oklab, var(--brand) 75%, var(--info)));
  transition: width 80ms linear;
}

/* ---------- Unified brand & header tweaks ---------- */
.brand-sep {
  color: var(--muted-foreground);
  font-weight: 400;
  margin-inline: .125rem;
}
.mega-foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .25rem;
  padding: .625rem .875rem;
  border-top: 1px solid var(--border);
  font-size: .8125rem;
  color: var(--muted-foreground);
}
.mega-foot a {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  font-weight: 500;
  color: var(--foreground);
}
.mega-foot a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Section headers ---------- */
.section-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-bar-copy {
  display: grid;
  gap: .375rem;
}
.section-bar-copy h2 {
  font-size: clamp(1.375rem, 1.15rem + .9vw, 1.75rem);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -.025em;
}
.section-bar-copy p {
  font-size: .9375rem;
  color: var(--muted-foreground);
}

/* ---------- Hero refinements ---------- */
.hero-blog {
  padding-block: 4.25rem 3.25rem;
}
@media (max-width: 767px) {
  .hero-blog {
    padding-block: 2.75rem 2.25rem;
  }
}
.hero-blog .hero-search span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 639px) {
  .hero-blog .hero-search .kbd {
    display: none;
  }
  .hero-blog .hero-actions {
    flex-direction: column;
    max-width: 22rem;
    margin-inline: auto;
  }
  .hero-blog .hero-actions .btn {
    width: 100%;
  }
}
.hero-blog .hero-badge a,
.hero-blog a.hero-badge {
  transition: border-color .15s, background-color .15s;
}
.hero-blog a.hero-badge:hover {
  border-color: color-mix(in oklab, var(--foreground) 24%, var(--border));
  background: var(--surface);
}

/* Crisper active toggle pill contrast in light mode */
.toggle-item:is(.active, .is-active, [aria-pressed="true"], [aria-checked="true"], [aria-selected="true"]) {
  border-color: color-mix(in oklab, var(--foreground) 14%, var(--border));
  font-weight: 600;
}

/* ---------- Editorial post cards ---------- */
.posts-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 640px) {
  .posts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .posts-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: border-color .18s var(--ease), box-shadow .22s var(--ease), transform .22s var(--ease);
}
.post-card:hover {
  border-color: color-mix(in oklab, var(--tone, var(--foreground)) 36%, var(--border));
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.post-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.post-card-link:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.post-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.post-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s var(--ease);
}
.post-card:hover .post-card-media img {
  transform: scale(1.03);
}
:root[data-theme="dark"] .post-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(9 9 11 / .06) 0%, rgb(9 9 11 / .22) 100%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .05);
  pointer-events: none;
}
:root[data-theme="dark"] .post-card-media img {
  filter: brightness(.86) contrast(1.04) saturate(.95);
}

.post-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: .625rem;
  padding: 1.25rem;
  min-width: 0;
}
.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  font-size: .75rem;
  color: var(--muted-foreground);
  position: relative;
  z-index: 2;
}
.post-card-meta a.badge {
  position: relative;
  z-index: 2;
  transition: opacity .15s;
}
.post-card-meta a.badge:hover {
  opacity: .82;
}
.post-card-time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.post-card-title {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.018em;
  color: var(--foreground);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-featured .post-card-title {
  font-size: 1.125rem;
}
.post-card-excerpt {
  font-size: .875rem;
  line-height: 1.55;
  color: var(--muted-foreground);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-foot {
  margin-top: auto;
  padding-top: .625rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  border-top: 1px solid color-mix(in oklab, var(--border) 65%, transparent);
  font-size: .78rem;
  color: var(--muted-foreground);
}
.post-card-date {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
}
.post-card-arrow {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-weight: 500;
  color: var(--muted-foreground);
  transition: color .15s, gap .15s;
}
.post-card:hover .post-card-arrow {
  color: var(--foreground);
  gap: .45rem;
}

/* Compact post card (no image) */
.post-card-compact .post-card-body {
  padding: 1.25rem;
}

/* ---------- Topic cards ---------- */
.topics-grid {
  display: grid;
  gap: .875rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 640px) {
  .topics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .topics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.topic-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  height: 100%;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow-xs);
  transition: border-color .18s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
.topic-card:hover {
  border-color: color-mix(in oklab, var(--tone, var(--foreground)) 35%, var(--border));
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.topic-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}
.topic-card h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.015em;
}
.topic-card p {
  font-size: .84rem;
  line-height: 1.55;
  color: var(--muted-foreground);
}
.topic-card .tool-card-arrow {
  margin-top: auto;
}

/* ---------- Spotlight tools row on homepage ---------- */
.spotlight-grid {
  display: grid;
  gap: .875rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 640px) {
  .spotlight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .spotlight-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---------- MagicPages Partner Cards (Native shadcn/ui + Brand Lime) ---------- */
.mp-band {
  position: relative;
  display: grid;
  gap: 1.5rem;
  align-items: center;
  padding: 1.75rem;
  border: 1px solid color-mix(in oklab, var(--brand) 28%, var(--border));
  border-radius: var(--radius-2xl);
  background:
    radial-gradient(95% 140% at 100% 0%, color-mix(in oklab, var(--brand) 16%, transparent), transparent 58%),
    var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
@media (min-width: 768px) {
  .mp-band {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 2rem 2.25rem;
  }
}
.mp-band-copy {
  display: grid;
  gap: .5rem;
  min-width: 0;
}
.mp-band-title {
  font-size: clamp(1.2rem, 1.05rem + .55vw, 1.45rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.022em;
  color: var(--foreground);
}
.mp-band-desc {
  font-size: .9375rem;
  line-height: 1.6;
  color: var(--muted-foreground);
  max-width: 44rem;
}
.mp-band-desc strong {
  color: var(--foreground);
  font-weight: 600;
}
.mp-band-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .5rem;
}
@media (min-width: 768px) {
  .mp-band-actions {
    align-items: flex-end;
  }
}
.mp-band-sub {
  font-size: .75rem;
  color: var(--muted-foreground);
}

.mp-btn,
.article-prose a.mp-btn {
  background: var(--foreground) !important;
  color: var(--background) !important;
  border-color: transparent !important;
  text-decoration: none !important;
}
.mp-btn:hover,
.article-prose a.mp-btn:hover {
  background: color-mix(in oklab, var(--foreground) 88%, transparent) !important;
  color: var(--background) !important;
}
:root[data-theme="dark"] .mp-btn,
:root[data-theme="dark"] .article-prose a.mp-btn {
  background: var(--brand) !important;
  color: #09090b !important;
  font-weight: 600;
}
:root[data-theme="dark"] .mp-btn:hover,
:root[data-theme="dark"] .article-prose a.mp-btn:hover {
  background: color-mix(in oklab, var(--brand) 88%, #fff) !important;
  color: #09090b !important;
}

/* Sidebar variant */
.mp-card {
  display: grid;
  gap: .875rem;
  padding: 1.125rem;
  border: 1px solid color-mix(in oklab, var(--brand) 28%, var(--border));
  border-radius: var(--radius-xl);
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in oklab, var(--brand) 14%, transparent), transparent 60%),
    var(--surface);
  box-shadow: var(--shadow-xs);
}
.mp-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.mp-card-brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--foreground);
}
.mp-card-headline {
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.01em;
  color: var(--foreground);
}
.mp-card-list {
  display: grid;
  gap: .4rem;
  font-size: .8125rem;
  line-height: 1.45;
  color: var(--muted-foreground);
}
.mp-card-list li {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
}
.mp-card-list .icon {
  width: .875rem;
  height: .875rem;
  margin-top: .15rem;
  color: var(--success);
}
.mp-card-list strong {
  color: var(--foreground);
  font-weight: 600;
}
.mp-card-sub {
  display: block;
  text-align: center;
  font-size: .72rem;
  color: var(--muted-foreground);
}

/* ---------- Article Header & Layout ---------- */
.article-page {
  padding-top: 1.5rem;
}
.article-header {
  display: grid;
  gap: 1rem;
  max-width: 54rem;
  padding-block: 1.25rem 1.75rem;
}
.article-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.article-header h1 {
  font-size: clamp(1.875rem, 1.35rem + 2.2vw, 2.875rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.035em;
  color: var(--foreground);
}
.article-lead {
  font-size: clamp(1rem, .95rem + .25vw, 1.15rem);
  line-height: 1.65;
  color: var(--muted-foreground);
  max-width: 46rem;
}
.article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .625rem 1rem;
  padding-top: .5rem;
  font-size: .84rem;
  color: var(--muted-foreground);
}
.article-meta-group {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  white-space: nowrap;
}
.article-copy-btn {
  margin-left: auto;
}
@media (max-width: 520px) {
  .article-copy-btn {
    margin-left: 0;
  }
}
.article-author-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
}
.article-author-chip:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.article-author-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: var(--muted-foreground);
  opacity: .55;
  flex-shrink: 0;
}
.article-meta-mono {
  font-family: var(--font-mono);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}

.article-cover {
  margin-bottom: 2.5rem;
  max-width: 64rem;
}
.article-cover-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.article-cover-frame img {
  width: 100%;
  max-height: 29rem;
  object-fit: cover;
}
:root[data-theme="dark"] .article-cover-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(9 9 11 / .05) 0%, rgb(9 9 11 / .18) 100%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .06);
  pointer-events: none;
}
:root[data-theme="dark"] .article-cover-frame img {
  filter: brightness(.86) contrast(1.04) saturate(.95);
}
.article-cover figcaption {
  margin-top: .625rem;
  font-size: .8125rem;
  color: var(--muted-foreground);
}

/* 2-column reading layout: generous main prose + sticky right rail */
.article-layout {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1080px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr) 18rem;
    gap: 3.5rem;
    align-items: start;
  }
}
.article-main {
  min-width: 0;
  max-width: 49rem;
}
.article-aside {
  display: none;
}
@media (min-width: 1080px) {
  .article-aside {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
  }
}
.aside-stack {
  display: grid;
  gap: 1.25rem;
}

/* Desktop TOC rail */
.toc-rail {
  display: grid;
  gap: .625rem;
}
.toc-rail[hidden] {
  display: none !important;
}
.toc-rail-title {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--foreground);
}
.toc-rail-list {
  display: grid;
  border-left: 1px solid var(--border);
}
.toc-rail-list a {
  display: block;
  padding: .3rem 0 .3rem .875rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: .8125rem;
  line-height: 1.4;
  color: var(--muted-foreground);
  transition: color .15s, border-color .15s;
}
.toc-rail-list a.is-sub {
  padding-left: 1.5rem;
  font-size: .775rem;
}
.toc-rail-list a:hover {
  color: var(--foreground);
}
.toc-rail-list a.active {
  color: var(--foreground);
  font-weight: 500;
  border-left-color: var(--brand);
}

/* Mobile collapsible TOC */
.toc-mobile {
  margin-bottom: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
@media (min-width: 1080px) {
  .toc-mobile {
    display: none !important;
  }
}
.toc-mobile > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem 1rem;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
}
.toc-mobile > summary span {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.toc-mobile > summary::after {
  content: "";
  width: 1rem;
  height: 1rem;
  background: var(--muted-foreground);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .2s;
}
.toc-mobile[open] > summary::after {
  transform: rotate(180deg);
}
.toc-mobile-list {
  display: grid;
  gap: .25rem;
  padding: 0 1rem .875rem;
  border-top: 1px solid var(--border);
  padding-top: .625rem;
}
.toc-mobile-list a {
  display: block;
  padding: .25rem 0;
  font-size: .84rem;
  color: var(--muted-foreground);
}
.toc-mobile-list a.is-sub {
  padding-left: .875rem;
  font-size: .8rem;
}
.toc-mobile-list a:hover {
  color: var(--foreground);
}

/* Share card / inline bar */
.share-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
}
.share-box-label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--foreground);
}
.share-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

/* ---------- Article Prose & Ghost Card System ---------- */
.article-prose {
  color: color-mix(in oklab, var(--foreground) 86%, var(--muted-foreground));
  font-size: 1.03125rem;
  line-height: 1.78;
  min-width: 0;
  overflow-wrap: break-word;
}
.article-prose > * + * {
  margin-top: 1.25rem;
}
.article-prose h2 {
  margin-top: 2.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: clamp(1.375rem, 1.2rem + .65vw, 1.625rem);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.025em;
  color: var(--foreground);
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}
.article-prose > h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.article-prose h3 {
  margin-top: 2rem;
  font-size: 1.2rem;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -.018em;
  color: var(--foreground);
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}
.article-prose h4 {
  margin-top: 1.5rem;
  font-size: 1.025rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--foreground);
}
.article-prose h2 + *,
.article-prose h3 + *,
.article-prose h4 + * {
  margin-top: .75rem;
}
.article-prose strong,
.article-prose b {
  font-weight: 600;
  color: var(--foreground);
}
.article-prose a:not(.btn):not(.kg-btn):not(.tw-kofi-btn) {
  color: var(--foreground);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: color-mix(in oklab, var(--foreground) 32%, transparent);
  transition: text-decoration-color .15s, color .15s;
}
.article-prose a:not(.btn):not(.kg-btn):not(.tw-kofi-btn):hover {
  text-decoration-color: var(--foreground);
}
.article-prose a.btn {
  text-decoration: none;
}
.article-prose ul {
  list-style: disc;
  padding-left: 1.375rem;
}
.article-prose ol {
  list-style: decimal;
  padding-left: 1.375rem;
}
.article-prose li + li {
  margin-top: .45rem;
}
.article-prose li::marker {
  color: var(--muted-foreground);
}
.article-prose blockquote {
  margin-block: 1.5rem;
  padding: .875rem 1.25rem;
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  background: var(--surface);
  color: color-mix(in oklab, var(--foreground) 84%, var(--muted-foreground));
  font-style: normal;
}
.article-prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin-block: 2rem;
}

/* Inline code & code blocks */
.article-prose :not(pre) > code {
  padding: .15rem .4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--muted);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: .84em;
  font-weight: 500;
  word-break: break-word;
}
.article-prose pre {
  position: relative;
  margin-block: 1.5rem;
  padding: 1.125rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--code-bg);
  color: var(--foreground);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .825rem;
  line-height: 1.65;
  tab-size: 2;
}
.article-prose pre code {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: 400;
}
.code-copy-wrap {
  position: relative;
  margin-block: 1.5rem;
}
.code-copy-wrap > pre {
  margin-block: 0;
  padding-top: 2.5rem;
}
.code-copy-btn {
  position: absolute;
  top: .5rem;
  right: .5rem;
  z-index: 2;
}

/* Responsive markdown / HTML tables inside prose */
.article-prose .table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  margin-block: 1.5rem;
}
.article-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  line-height: 1.5;
}
.article-prose th {
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .8rem;
  color: var(--foreground);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.article-prose td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.article-prose tbody tr:last-child td {
  border-bottom: 0;
}
.article-prose tbody tr:hover {
  background: color-mix(in oklab, var(--muted) 45%, transparent);
}

/* Ghost cards — clean shadcn/ui equivalents in light + dark mode */
.article-prose .kg-card {
  margin-block: 1.75rem;
  max-width: 100%;
}
.article-prose .kg-image-card {
  display: grid;
  gap: .5rem;
}
.article-prose .kg-image-card img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
}
:root[data-theme="dark"] .article-prose .kg-image-card img {
  filter: brightness(.94);
}
.article-prose .kg-image-card figcaption,
.article-prose figure figcaption {
  font-size: .8125rem;
  color: var(--muted-foreground);
  text-align: center;
}

/* Ghost Callout Cards -> shadcn Alert aesthetic */
.article-prose .kg-callout-card {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--foreground);
  font-size: .925rem;
  line-height: 1.6;
}
.article-prose .kg-callout-emoji {
  font-size: 1.125rem;
  line-height: 1.4;
  flex-shrink: 0;
}
.article-prose .kg-callout-text {
  min-width: 0;
  flex: 1;
}
.article-prose .kg-callout-card-yellow {
  border-color: color-mix(in oklab, var(--warning) 32%, var(--border));
  background: color-mix(in oklab, var(--warning) 8%, var(--surface));
}
.article-prose .kg-callout-card-green {
  border-color: color-mix(in oklab, var(--success) 32%, var(--border));
  background: color-mix(in oklab, var(--success) 8%, var(--surface));
}
.article-prose .kg-callout-card-blue {
  border-color: color-mix(in oklab, var(--info) 32%, var(--border));
  background: color-mix(in oklab, var(--info) 8%, var(--surface));
}
.article-prose .kg-callout-card-red,
.article-prose .kg-callout-card-pink {
  border-color: color-mix(in oklab, var(--destructive) 32%, var(--border));
  background: color-mix(in oklab, var(--destructive) 8%, var(--surface));
}
.article-prose .kg-callout-card-purple {
  border-color: color-mix(in oklab, oklch(0.606 0.25 292.717) 32%, var(--border));
  background: color-mix(in oklab, oklch(0.606 0.25 292.717) 8%, var(--surface));
}
.article-prose .kg-callout-card-accent {
  border-color: color-mix(in oklab, var(--brand) 36%, var(--border));
  background: color-mix(in oklab, var(--brand) 9%, var(--surface));
}

/* Ghost Bookmark Cards -> sleek shadcn link card */
.article-prose .kg-bookmark-card {
  width: 100%;
}
.article-prose .kg-bookmark-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  overflow: hidden;
  text-decoration: none !important;
  box-shadow: var(--shadow-xs);
  transition: border-color .18s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
@media (min-width: 600px) {
  .article-prose .kg-bookmark-container {
    grid-template-columns: minmax(0, 1fr) 14rem;
  }
}
.article-prose .kg-bookmark-container:hover {
  border-color: color-mix(in oklab, var(--foreground) 22%, var(--border));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.article-prose .kg-bookmark-content {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: 1.125rem 1.25rem;
  min-width: 0;
}
.article-prose .kg-bookmark-title {
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--foreground);
}
.article-prose .kg-bookmark-description {
  font-size: .825rem;
  line-height: 1.5;
  color: var(--muted-foreground);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-prose .kg-bookmark-metadata {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-top: auto;
  padding-top: .45rem;
  font-size: .75rem;
  color: var(--muted-foreground);
}
.article-prose .kg-bookmark-icon {
  width: 1rem;
  height: 1rem;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
}
.article-prose .kg-bookmark-author {
  font-weight: 500;
  color: var(--foreground);
}
.article-prose .kg-bookmark-publisher::before {
  content: "·";
  margin-right: .45rem;
}
.article-prose .kg-bookmark-thumbnail {
  position: relative;
  min-height: 8.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
@media (min-width: 600px) {
  .article-prose .kg-bookmark-thumbnail {
    border-top: 0;
    border-left: 1px solid var(--border);
  }
}
.article-prose .kg-bookmark-thumbnail img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: .375rem;
  background: var(--surface);
}
:root[data-theme="dark"] .article-prose .kg-bookmark-thumbnail img {
  filter: brightness(.9);
}

/* Ghost Button Card */
.article-prose .kg-button-card {
  display: flex;
  justify-content: flex-start;
}
.article-prose .kg-button-card.kg-align-center {
  justify-content: center;
}
.article-prose .kg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.5rem;
  padding: .5rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--primary-foreground) !important;
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none !important;
  box-shadow: var(--shadow-xs);
  transition: opacity .15s, transform .15s;
}
.article-prose .kg-btn:hover {
  opacity: .9;
  transform: translateY(-1px);
}

/* Ko-fi / Support button normalized to shadcn aesthetic */
.article-prose .tw-kofi-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: .5rem !important;
  height: 2.5rem !important;
  padding: 0 1.125rem !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  background: var(--surface) !important;
  color: var(--foreground) !important;
  font-size: .875rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  box-shadow: var(--shadow-xs) !important;
  transition: background-color .15s, border-color .15s !important;
}
.article-prose .tw-kofi-btn:hover {
  background: var(--accent) !important;
  border-color: color-mix(in oklab, var(--foreground) 22%, var(--border)) !important;
}

/* Dark-mode safety overrides for legacy embedded HTML callout boxes in older posts */
:root[data-theme="dark"] .article-prose div[style*="background-color: #e8f5e9"],
:root[data-theme="dark"] .article-prose div[style*="background-color: #fae5e1"],
:root[data-theme="dark"] .article-prose div[style*="background-color: #f0f8ff"],
:root[data-theme="dark"] .article-prose div[style*="background-color: #fff0f5"],
:root[data-theme="dark"] .article-prose div[style*="linear-gradient(to right, #e0f9e0"] {
  background: var(--surface) !important;
  color: var(--foreground) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}
:root[data-theme="dark"] .article-prose div[style*="background-color: #e8f5e9"] *,
:root[data-theme="dark"] .article-prose div[style*="background-color: #fae5e1"] *,
:root[data-theme="dark"] .article-prose div[style*="background-color: #f0f8ff"] *,
:root[data-theme="dark"] .article-prose div[style*="background-color: #fff0f5"] *,
:root[data-theme="dark"] .article-prose div[style*="linear-gradient(to right, #e0f9e0"] * {
  color: var(--foreground) !important;
}
:root[data-theme="dark"] .article-prose code[style*="background-color: #e8e8e8"] {
  background: var(--muted) !important;
  color: var(--foreground) !important;
}

/* ---------- Native Ghost Hosting 2026 Price Calculator ---------- */
.ghost-calc {
  margin-block: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.ghost-calc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.ghost-calc-head h3 {
  margin: 0 !important;
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  letter-spacing: -.015em;
  color: var(--foreground);
}
.ghost-calc-head p {
  margin: .2rem 0 0;
  font-size: .8125rem;
  color: var(--muted-foreground);
}
.ghost-calc-controls {
  display: grid;
  gap: 1.25rem;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 640px) {
  .ghost-calc-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.ghost-calc-field {
  display: grid;
  gap: .625rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.ghost-calc-field-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.ghost-calc-field-top label {
  font-size: .84rem;
  font-weight: 500;
  color: var(--foreground);
}
.ghost-calc-num {
  width: 6.75rem !important;
  height: 2rem !important;
  text-align: right;
  font-family: var(--font-mono);
  font-size: .8125rem !important;
  background: var(--background) !important;
}
.ghost-calc-toggles {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.5rem;
}
.ghost-calc-grid {
  display: grid;
  gap: .875rem;
  padding: 1.5rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 600px) {
  .ghost-calc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 820px) {
  .ghost-calc-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.calc-plan {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--background);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.calc-plan.is-best {
  border-color: color-mix(in oklab, var(--brand) 65%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--brand) 38%, transparent), var(--shadow-md);
  background: radial-gradient(120% 90% at 100% 0%, color-mix(in oklab, var(--brand) 11%, transparent), transparent 60%), var(--background);
}
.calc-plan.is-dimmed {
  opacity: .56;
}
.calc-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.calc-plan-name {
  margin: 0 !important;
  font-size: .95rem !important;
  font-weight: 600 !important;
  color: var(--foreground);
}
.calc-plan-price {
  display: flex;
  align-items: baseline;
  gap: .25rem;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.calc-plan-price span {
  font-size: .8125rem;
  font-weight: 400;
  color: var(--muted-foreground);
  letter-spacing: 0;
}
.calc-plan-sub {
  font-size: .75rem;
  color: var(--muted-foreground);
  min-height: 1.15rem;
}
.calc-plan-list {
  display: grid;
  gap: .35rem;
  list-style: none !important;
  padding: 0 !important;
  margin: .25rem 0 0 !important;
  font-size: .8rem;
  line-height: 1.45;
  color: var(--muted-foreground);
}
.calc-plan-list li {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  margin: 0 !important;
}
.calc-plan-list li::before {
  content: "✓";
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
}
.calc-plan-list li.is-no::before {
  content: "–";
  color: var(--muted-foreground);
}
.calc-plan-cta {
  margin-top: auto;
  padding-top: .5rem;
}
.ghost-calc-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .875rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: .78rem;
  color: var(--muted-foreground);
}

/* ---------- Archive timeline ---------- */
.archive-groups {
  display: grid;
  gap: 2.25rem;
}
.archive-year-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}
.archive-year-head h2 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -.015em;
  font-family: var(--font-mono);
}
.archive-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem 1rem;
  padding: .875rem 1.125rem;
  transition: background-color .15s;
}
.archive-row:hover {
  background: color-mix(in oklab, var(--muted) 55%, transparent);
}
.archive-row + .archive-row {
  border-top: 1px solid var(--border);
}
.archive-date {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.archive-title {
  font-size: .95rem;
  font-weight: 500;
  color: var(--foreground);
  min-width: 0;
}
.archive-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
@media (max-width: 639px) {
  .archive-row {
    grid-template-columns: minmax(0, 1fr);
    gap: .35rem;
  }
  .archive-meta {
    justify-content: flex-start;
  }
}

/* ---------- Author Card ---------- */
.author-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}
.author-box-avatar {
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.author-box-body {
  flex: 1 1 16rem;
  display: grid;
  gap: .35rem;
  min-width: 0;
}
.author-box-name {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--foreground);
}
.author-box-bio {
  font-size: .875rem;
  color: var(--muted-foreground);
  line-height: 1.55;
}
.author-box-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .25rem;
}

/* ---------- Pagination ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.pager-info {
  font-family: var(--font-mono);
  font-size: .8125rem;
  color: var(--muted-foreground);
}

/* ---------- Search page ---------- */
.search-results-grid {
  display: grid;
  gap: .75rem;
  margin-top: 1.5rem;
}
.search-result-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.125rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.search-result-card:hover {
  border-color: color-mix(in oklab, var(--foreground) 22%, var(--border));
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.search-result-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: .25rem;
}
.search-result-card p {
  font-size: .875rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}

/* ---------- Footer social links ---------- */
.footer-social {
  display: flex;
  align-items: center;
  gap: .375rem;
  margin-top: 1rem;
}
