/* ============================================================
   BLOG POST / SINGLE POST STYLES
   ============================================================ */

/* ── Reading-progress bar ──────────────────────────── */
.read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: var(--amber);
  z-index: 1100;
  width: 0%;
  transition: width 0.05s linear;
}

/* ── Post hero ─────────────────────────────────────── */
.post-hero {
  padding: calc(var(--nav-h) + 64px) 0 56px;
  position: relative;
  overflow: hidden;
}
.post-hero__bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 15% 30%, rgba(1,77,78,0.14) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(185,122,62,0.06) 0%, transparent 55%);
  pointer-events: none;
}
.post-hero__inner {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.post-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  transition: color 0.2s, gap 0.2s;
  margin-bottom: 36px;
}
.post-back:hover { color: var(--text-teal); gap: 12px; }
.post-meta-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.post-meta-row .dot { color: var(--border); }
.post-meta-row span:not(.tag):not(.dot) {
  font-size: 0.82rem;
  color: var(--text-3);
}
.post-title {
  font-family: var(--font-head);
  font-size: clamp(2.2rem, 4.4vw, 3.6rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 28px;
}
.post-deck {
  font-size: 1.18rem;
  color: var(--text-2);
  line-height: 1.7;
  max-width: 660px;
}
.post-deck::first-line { color: var(--text); }

/* ── Author strip ──────────────────────────────────── */
.author-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 40px;
}
.author-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.author-name {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.author-role { font-size: 0.78rem; color: var(--text-3); }
.author-share {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.share-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  transition: border-color 0.2s, color 0.2s;
  cursor: pointer;
  background: transparent;
}
.share-btn:hover { border-color: var(--teal-light); color: var(--text-teal); }

/* ── Featured image ────────────────────────────────── */
.post-featured-img {
  max-width: 880px;
  margin: 56px auto 0;
  padding: 0 40px;
  position: relative;
}
.post-img-frame {
  height: 360px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.post-img-frame img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.post-img-frame::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(-45deg,
    rgba(1,77,78,0.05) 0px,
    rgba(1,77,78,0.05) 1px,
    transparent 1px,
    transparent 14px);
}
.post-img-label {
  position: relative;
  z-index: 1;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-align: center;
  padding: 16px;
}
.post-img-caption {
  font-size: 0.82rem;
  color: var(--text-3);
  text-align: center;
  margin-top: 14px;
  font-style: italic;
}

/* ── Article body ──────────────────────────────────── */
.post-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 80px 40px 0;
}
.post-body h2 {
  font-family: var(--font-head);
  font-size: clamp(1.5rem, 2.4vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 64px 0 20px;
  line-height: 1.2;
}
.post-body h3 {
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 40px 0 14px;
  line-height: 1.3;
}
.post-body p {
  font-size: 1.05rem;
  color: var(--text-2);
  line-height: 1.8;
  margin-bottom: 22px;
}
.post-body p strong { color: var(--text); font-weight: 600; }
.post-body p em { color: var(--text); font-style: italic; }
.post-body a {
  color: var(--text-teal);
  text-decoration: underline;
  text-decoration-color: rgba(1,77,78,0.4);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}
.post-body a:hover { text-decoration-color: var(--text-teal); }

/* Drop cap on first paragraph */
.post-body > p:first-of-type::first-letter {
  font-family: var(--font-head);
  font-size: 4.2rem;
  font-weight: 700;
  float: left;
  line-height: 0.9;
  margin: 6px 12px 0 0;
  color: var(--text);
}

/* Lists */
.post-body ul, .post-body ol {
  margin: 8px 0 28px 0;
  padding-left: 0;
  list-style: none;
}
.post-body ul li, .post-body ol li {
  position: relative;
  padding-left: 28px;
  font-size: 1.05rem;
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: 12px;
}
.post-body ul li::before {
  content: '';
  position: absolute;
  left: 6px; top: 0.78em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber);
}
.post-body ol { counter-reset: item; }
.post-body ol li { counter-increment: item; }
.post-body ol li::before {
  content: counter(item, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  font-family: var(--font-head);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-teal);
  line-height: 1.85;
}

/* Pull quote */
.post-pullquote {
  margin: 48px 0;
  padding: 8px 0 8px 28px;
  border-left: 3px solid var(--amber);
}
.post-pullquote p {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin: 0;
}

/* Code */
.post-body code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--text);
}
.post-body pre {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin: 28px 0;
  overflow-x: auto;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text);
  position: relative;
}
.post-body pre::before {
  content: 'sql';
  position: absolute;
  top: 12px; right: 16px;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.post-body pre code { background: transparent; border: none; padding: 0; color: inherit; }
.code-comment { color: var(--text-3); }
.code-keyword { color: var(--amber); }
.code-string { color: var(--text-teal); }

/* Callout box */
.post-callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-teal);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 32px 0;
}
.post-callout__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-teal);
  margin-bottom: 10px;
}
.post-callout p { font-size: 0.95rem; color: var(--text-2); line-height: 1.7; margin: 0; }

/* Inline figure */
.post-figure {
  margin: 40px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.post-figure__body {
  padding: 24px 28px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}
.post-figure__row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  padding: 8px 0;
  font-size: 0.82rem;
  align-items: center;
}
.post-figure__row + .post-figure__row { border-top: 1px solid var(--border); }
.post-figure__label { color: var(--text-3); font-family: monospace; font-size: 0.75rem; }
.post-figure__bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; position: relative; }
.post-figure__bar-fill { height: 100%; border-radius: 3px; }
.post-figure__bar-fill--bad { background: linear-gradient(90deg, var(--copper), var(--amber)); }
.post-figure__bar-fill--good { background: linear-gradient(90deg, var(--teal), var(--text-teal)); }
.post-figure__caption { padding: 14px 28px; font-size: 0.82rem; color: var(--text-3); font-style: italic; }

/* Tag list at bottom */
.post-tags {
  max-width: 720px;
  margin: 64px auto 0;
  padding: 0 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.post-tag {
  font-size: 0.78rem;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-2);
}

/* Author bio card */
.post-author-card {
  max-width: 720px;
  margin: 56px auto 0;
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  gap: 28px;
  align-items: flex-start;
}
.post-author-card img {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.post-author-card h4 {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.post-author-card .role { font-size: 0.82rem; color: var(--text-teal); margin-bottom: 14px; }
.post-author-card p { font-size: 0.92rem; color: var(--text-2); line-height: 1.7; margin-bottom: 16px; }

/* CTA block */
.post-cta {
  max-width: 880px;
  margin: 80px auto 0;
  padding: 0 40px;
}
.post-cta__inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 36px;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.post-cta__inner::before {
  content: '';
  position: absolute;
  top: -40%; right: -10%;
  width: 50%; height: 200%;
  background: radial-gradient(ellipse, rgba(1,77,78,0.14) 0%, transparent 70%);
  pointer-events: none;
}
.post-cta__title {
  font-family: var(--font-head);
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.2;
}
.post-cta__sub { font-size: 0.95rem; color: var(--text-2); }

/* Related posts */
.related {
  padding: 80px 0;
  margin-top: 80px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
}
.related__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px;
}
.related__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 32px;
}
.related__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-decoration: none;
  transition: border-color 0.25s, transform 0.25s;
  display: block;
}
.related__card:hover { border-color: var(--teal-light); transform: translateY(-3px); }
.related__title {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin: 12px 0;
}
.related__excerpt { font-size: 0.88rem; color: var(--text-2); line-height: 1.65; }

@media (max-width: 720px) {
  .post-hero { padding-top: calc(var(--nav-h) + 32px); }
  .post-featured-img, .post-body, .post-tags, .post-author-card, .post-cta { padding-left: 24px; padding-right: 24px; }
  .post-author-card { flex-direction: column; align-items: flex-start; padding: 28px; }
  .post-author-card img { width: 60px; height: 60px; }
  .post-cta__inner { grid-template-columns: 1fr; padding: 32px 28px; }
  .post-img-frame { height: 220px; }
  .related__grid { grid-template-columns: 1fr; }
  .post-body > p:first-of-type::first-letter { font-size: 3.2rem; }
}
