/*
  blog.css — QuietCraft.tech journal styles
  Loaded by blog/index.html, blog/template.html, and all blog/posts/*.html pages.
  Requires main.css to be loaded first.
*/

/* ── Blog index header ─────────────────────────── */
.blog-header {
  padding-top: 140px;
  padding-bottom: 80px;
  border-bottom: 1px solid var(--border);
}
.blog-kicker {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-green);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.blog-kicker::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--accent-green);
}
.blog-title {
  font-family: var(--font-head);
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin-bottom: 20px;
}
.blog-desc {
  font-size: 1.0625rem;
  line-height: 1.75;
  opacity: 0.62;
  max-width: 480px;
}

/* ── Posts grid ────────────────────────────────── */
.posts-section { padding: var(--section-pad) 0; }
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 40px;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: box-shadow 0.35s ease, transform 0.35s ease;
  text-decoration: none;
  color: inherit;
}
.post-card:hover {
  box-shadow: 0 6px 32px rgba(0,0,0,0.07);
  transform: translateY(-3px);
}

.post-card-tag {
  font-size: 0.7188rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-green);
}
.post-card-title {
  font-family: var(--font-head);
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1.22;
  color: var(--text);
}
.post-card-excerpt {
  font-size: 0.9375rem;
  line-height: 1.75;
  opacity: 0.62;
  flex: 1;
}
.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
}
.post-card-date { opacity: 0.42; }
.post-card-read {
  color: var(--accent-blue);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 1;
}
.post-card-read svg { width: 13px; height: 13px; transition: transform 0.25s; }
.post-card:hover .post-card-read svg { transform: translateX(3px); }

/* Empty state — shown via :has() when no .post-card siblings exist */
.posts-empty {
  display: none;
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 0;
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-style: italic;
  opacity: 0.35;
}
.posts-grid:not(:has(.post-card)) .posts-empty {
  display: block;
}

@media (max-width: 640px) {
  .posts-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ── Article layout ────────────────────────────── */
.article-wrap {
  padding-top: 130px;
  padding-bottom: var(--section-pad);
}

/* Back link */
.article-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text);
  opacity: 0.48;
  margin-bottom: 56px;
  transition: opacity 0.2s, color 0.2s;
  text-decoration: none;
}
.article-back:hover { opacity: 1; color: var(--accent-blue); }
.article-back svg   { width: 14px; height: 14px; }

/* Header */
.article-header { margin-bottom: 60px; max-width: 820px; }
.article-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-green);
  margin-bottom: 18px;
}
.article-title {
  font-family: var(--font-head);
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--text);
  opacity: 0.45;
  flex-wrap: wrap;
}
.meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.article-rule {
  height: 1px;
  background: var(--border);
  margin: 40px 0;
  max-width: 820px;
}

/* Body prose */
.article-body {
  max-width: 680px;
  font-size: 1.0625rem;
  line-height: 1.85;
}
.article-body > * + * { margin-top: 1.55em; }

.article-body p          { }
.article-body h2 {
  font-family: var(--font-head);
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin-top: 2.5em;
  margin-bottom: -0.5em;
}
.article-body h3 {
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.25;
  margin-top: 2em;
  margin-bottom: -0.6em;
}
.article-body a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.2s;
}
.article-body a:hover { color: #5a7d9e; }

.article-body ul,
.article-body ol {
  padding-left: 1.5em;
  list-style: revert;
}
.article-body li + li { margin-top: 0.5em; }

.article-body hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 3em 0;
}
.article-body strong { font-weight: 600; }
.article-body em     { font-style: italic; }

.article-body img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
}

/* Pull quote */
.article-body blockquote {
  margin: 0.5em 0;
  padding: 24px 32px;
  border-left: 2px solid var(--accent-blue);
  background: rgba(108, 145, 178, 0.05);
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-style: italic;
  font-weight: 300;
  line-height: 1.5;
}
.article-body blockquote > * + * { margin-top: 0; }

/* Inline code */
.article-body code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875em;
  background: var(--border);
  padding: 0.15em 0.4em;
  border: 1px solid var(--border);
}
/* Code blocks — fixed dark bg works in both modes */
.article-body pre {
  background: #1A1816;
  color: #D8D3CC;
  padding: 24px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.65;
}
.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* ── Article footer ────────────────────────────── */
.article-footer {
  max-width: 680px;
  margin-top: 80px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}
.article-footer-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hover);
  margin-bottom: 12px;
}
.article-author {
  font-size: 0.9375rem;
  line-height: 1.7;
  opacity: 0.62;
}
.article-author strong {
  display: block;
  font-weight: 500;
  font-size: 1rem;
  color: var(--text);
  opacity: 1;
  margin-bottom: 2px;
}

/* ── Post nav (prev / next) ────────────────────── */
.post-nav {
  display: flex;
  gap: 24px;
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
  max-width: 680px;
}
.post-nav-prev { margin-right: auto; }
.post-nav-next { margin-left: auto; text-align: right; }

.post-nav a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 280px;
  opacity: 0.55;
  transition: opacity 0.2s;
  text-decoration: none;
}
.post-nav a:hover  { opacity: 1; }
.post-nav-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hover);
}
.post-nav-title {
  font-family: var(--font-head);
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--text);
}

@media (max-width: 640px) {
  .post-nav          { flex-direction: column; }
  .post-nav-next     { text-align: left; margin-left: 0; }
  .article-title     { font-size: 2rem; }
  .article-body      { font-size: 1rem; }
}

/* ── Dark mode ──────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  .post-card:hover {
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.4);
  }

  .article-body blockquote {
    background: rgba(122, 172, 200, 0.08);
  }

  /* Back link hover colour already inherits --accent-blue ✓ */
}
