/* Blog layout — Tailark Libre blog-one visuals, plain CSS tokens */

/* Fluid root size: the blog is a single rem-based column, so scaling the
   root scales the whole page. ~15px on phones up to 20px on desktop, which
   turns the narrow column into an XL "mobile" site on large screens. */
:root {
  font-size: clamp(15px, 12px + 0.55vw, 20px);
}

:root {
  --blog-muted: #f4f4f5;
  --blog-card: #ffffff;
  --blog-prose: var(--fg-subtle);
  --blog-shadow: rgba(0, 0, 0, 0.05);
  --blog-ring: rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --blog-muted: #141414;
    --blog-card: #1a1a1a;
    --blog-prose: var(--fg-subtle);
    --blog-shadow: rgba(0, 0, 0, 0.35);
    --blog-ring: rgba(255, 255, 255, 0.08);
  }
}

body.blog-page {
  background: var(--blog-muted);
}

.blog-shell {
  flex: 1;
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0 4rem;
}

@media (min-width: 768px) {
  .blog-shell {
    padding: 2.5rem 0 5rem;
  }
}

.blog-wrap {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Breadcrumb ─────────────────────────────────────── */

.blog-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.875rem;
  color: var(--fg-subtle);
}

.blog-breadcrumb a {
  color: var(--fg-subtle);
  text-decoration: none;
}

.blog-breadcrumb a:hover {
  color: var(--fg);
}

.blog-breadcrumb .sep {
  color: var(--fg-faint);
}

/* ── List page: single column of cards ─────────────── */

.blog-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.blog-list-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--blog-card);
  box-shadow: 0 1px 3px var(--blog-shadow);
  transition: border-color 0.15s ease;
}

/* Dither strip along the card's top edge. */
.blog-list-item::before {
  content: '';
  display: block;
  height: 6px;
  background-image: repeating-conic-gradient(var(--border-strong) 0 25%, transparent 0 50%);
  background-size: 4px 4px;
}

.blog-list-item:hover {
  border-color: var(--border-strong);
}

.blog-list-link {
  display: block;
  padding: 1.25rem 1.5rem 1.5rem;
  color: inherit;
  text-decoration: none;
}

.blog-list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.85rem;
  color: var(--fg-faint);
  font-family: 'VCR', monospace;
  font-size: 0.6875rem;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.blog-list-category {
  color: var(--fg-subtle);
}

.blog-list-title {
  margin: 0;
  color: var(--fg);
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.blog-list-desc {
  margin: 0.6rem 0 0;
  color: var(--fg);
  font-size: 1.0625rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.blog-list-lead {
  margin: 0.75rem 0 0;
  color: var(--fg-subtle);
  font-size: 0.95rem;
  line-height: 1.65;
  text-wrap: pretty;
}

.blog-list-cta {
  display: inline-block;
  margin-top: 1.25rem;
  color: var(--fg-subtle);
  font-family: 'VCR', monospace;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  transition: color 0.15s ease;
}

.blog-list-item:hover .blog-list-cta {
  color: var(--fg);
}

@media (max-width: 36rem) {
  .blog-list-link {
    padding: 1rem 1.125rem 1.25rem;
  }

  .blog-list-title {
    font-size: 1.375rem;
  }
}

.blog-empty {
  margin-top: 3rem;
  color: var(--fg-subtle);
  font-size: 0.95rem;
}

/* ── Post page ──────────────────────────────────────── */

.blog-article {
  margin-top: 0;
}

/* ── Cover ──────────────────────────────────────────── */

/* Shared 1-bit dithered cover on the list page and every post. The PNG
   is an alpha mask (ink = opaque), tinted with --fg so it follows the
   color scheme. aspect-ratio reserves the box before the mask loads, so
   nothing below it reflows; the image is preloaded in the templates. */
.blog-masthead {
  margin-bottom: 1.5rem;
}

.blog-cover {
  position: relative;
  aspect-ratio: 3 / 1;
  margin: 0;
  contain: layout paint;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--blog-card);
  box-shadow: 0 1px 3px var(--blog-shadow);
}

.blog-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--fg);
  -webkit-mask: url('/blog-cover-dither.png') center / cover no-repeat;
  mask: url('/blog-cover-dither.png') center / cover no-repeat;
}

.blog-header {
  max-width: 42rem;
  margin-bottom: 2.5rem;
}

.blog-header h1 {
  margin: 0 0 1rem;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--fg);
}

@media (min-width: 768px) {
  .blog-header h1 {
    font-size: 2.25rem;
    line-height: 1.15;
  }
}

.blog-deck {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--fg-subtle);
}

.blog-date {
  font-size: 0.875rem;
  color: var(--fg-subtle);
}

.blog-layout {
  display: flex;
  gap: 3rem;
}

.blog-main {
  max-width: 42rem;
  min-width: 0;
  flex: 1;
}

.blog-toc {
  display: none;
  order: 2;
  margin-left: auto;
  width: 14rem;
  flex-shrink: 0;
  position: sticky;
  top: 5rem;
  align-self: flex-start;
  height: fit-content;
}

.blog-toc-title {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
}

.blog-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.blog-toc-list a {
  display: block;
  font-size: 0.875rem;
  color: var(--fg-subtle);
  text-decoration: none;
  transition: color 0.15s ease;
}

.blog-toc-list a:hover {
  color: var(--fg);
}

.blog-toc-list .toc-h3 {
  padding-left: 1rem;
}

.blog-hero {
  position: relative;
  margin-bottom: 3rem;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px var(--blog-shadow);
}

.blog-hero img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* ── Prose ──────────────────────────────────────────── */

.blog-prose {
  max-width: none;
}

.blog-prose > *:first-child {
  margin-top: 0;
}

.blog-prose h2 {
  margin: 4rem 0 1rem;
  scroll-margin-top: 5rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--fg);
}

.blog-prose h3 {
  margin: 1.5rem 0 0.75rem;
  scroll-margin-top: 5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--fg);
}

.blog-prose h4 {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--fg);
}

.blog-prose p {
  margin: 0 0 1rem;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--blog-prose);
}

.blog-prose ul,
.blog-prose ol {
  margin: 0 0 1rem 1.5rem;
  color: var(--blog-prose);
}

.blog-prose ul {
  list-style: disc;
}

.blog-prose ol {
  list-style: decimal;
}

.blog-prose li {
  margin-bottom: 0.5rem;
  line-height: 1.65;
}

.blog-prose li > p {
  margin-bottom: 0.35rem;
}

.blog-prose blockquote {
  margin: 2rem 0;
  padding-left: 1rem;
  border-left: 4px solid var(--border);
  font-size: 1.25rem;
  color: var(--fg);
}

.blog-prose blockquote p {
  color: var(--fg);
  font-size: inherit;
}

.blog-prose strong {
  color: var(--fg);
  font-weight: 600;
}

.blog-prose em {
  font-style: italic;
}

.blog-prose code {
  background: var(--blog-card);
  color: var(--fg);
  border-radius: 0.25rem;
  padding: 0.15rem 0.4rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875em;
}

.blog-prose pre {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--blog-card);
}

.blog-prose pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 0.85rem;
}

.blog-prose a {
  color: var(--fg);
  text-underline-offset: 2px;
}

.blog-prose a:hover {
  text-decoration: underline;
}

.blog-prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem 0;
  border-radius: 0.5rem;
}

.blog-prose hr {
  margin: 2.5rem 0;
  border: none;
  border-top: 1px solid var(--border);
}

/* ── Post footer ────────────────────────────────────── */

.blog-post-footer {
  margin-top: 3rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--blog-muted) 50%, transparent);
}

.blog-post-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.blog-post-footer a {
  font-size: 0.875rem;
  color: var(--fg-subtle);
  text-decoration: none;
  transition: color 0.15s ease;
}

.blog-post-footer a:hover {
  color: var(--fg);
}

/* Avatar-style logo overlapping the cover's bottom-left edge. */
.blog-brand-link {
  --avatar: 7rem;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--avatar);
  height: var(--avatar);
  margin: calc(var(--avatar) / -2) 0 0 2rem;
  border-radius: 50%;
  background: var(--blog-muted);
  color: var(--fg);
  text-decoration: none;
}

.blog-brand-mark {
  display: block;
  width: 64%;
  height: 64%;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url('/ispo-icon.svg') center / contain no-repeat;
  mask: url('/ispo-icon.svg') center / contain no-repeat;
}

.blog-brand-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Mobile overrides (kept last so they win on source order) ── */

@media (max-width: 36rem) {
  .blog-cover {
    aspect-ratio: 16 / 10;
  }

  .blog-brand-link {
    --avatar: 4.5rem;
    margin-left: 1rem;
  }
}
