/* ============================================================
   post.css – Static article reader
   Loaded on /post/{slug} pages by generate-static.js
   Depends on css/style.css for tokens, header, footer.

   Accessibility: All text/background combinations meet WCAG AA
   (4.5:1 minimum contrast for body text, 3:1 for large text).
   ============================================================ */

/* ============================================================
   PAGE + LAYOUT
   ============================================================ */
.post-page {
  background: #fff;
}

.post-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 30px 20px 80px;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.post-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted, #667085);
  margin-bottom: 28px;
  flex-wrap: wrap;
  line-height: 1.4;
}

.post-breadcrumb a {
  color: var(--primary-dark, #005fa3);   /* darker blue for WCAG AA */
  text-decoration: none;
  font-weight: 500;
}
.post-breadcrumb a:hover {
  text-decoration: underline;
}

.post-breadcrumb span[aria-hidden] {
  color: var(--muted, #667085);          /* darkened from muted-2 */
  font-size: 16px;
  line-height: 1;
}

.post-breadcrumb [aria-current="page"] {
  color: var(--muted, #667085);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 340px;
}

/* ============================================================
   ARTICLE HEADER
   ============================================================ */
.post-header {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.post-category {
  display: inline-block;
  padding: 4px 12px;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--primary-dark, #005fa3);   /* darker blue for contrast on light pill */
  background: rgba(0, 120, 212, .1);
  border: 1px solid rgba(0, 120, 212, .22);
  border-radius: 999px;
}

.post-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.02em;
  color: var(--text, #1a1a1a);
  margin: 0 0 20px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted, #667085);
}

.post-author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-2, #344054);
}

.post-author-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0078d4, #00b4d8);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.post-meta-sep {
  color: var(--muted, #667085);          /* darkened from muted-2 */
}

.post-lede {
  margin: 22px 0 0;
  padding: 16px 20px;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--text-2, #344054);
  background: #f8fbff;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
}

/* ============================================================
   ARTICLE BODY
   ============================================================ */
.post-content {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text, #1a1a1a);
  word-wrap: break-word;
}

.post-content > *:first-child { margin-top: 0; }
.post-content > *:last-child  { margin-bottom: 0; }

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  color: var(--text, #1a1a1a);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.01em;
  scroll-margin-top: 90px;
}
.post-content h1 { font-size: 1.75rem; margin: 2em 0 .6em; }
.post-content h2 { font-size: 1.5rem;  margin: 2em 0 .7em; }
.post-content h3 { font-size: 1.2rem;  margin: 1.6em 0 .5em; }
.post-content h4 { font-size: 1.05rem; margin: 1.4em 0 .4em; }

.post-content p { margin: 1.2em 0; }

.post-content a {
  color: var(--primary-dark, #005fa3);   /* darker blue for WCAG AA */
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 95, 163, .4);
  transition: border-color .15s ease;
  font-weight: 500;
}
.post-content a:hover {
  border-bottom-color: var(--primary-dark, #005fa3);
}

.post-content ul,
.post-content ol {
  margin: 1em 0;
  padding-left: 1.5em;
}
.post-content li {
  margin: .4em 0;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 1.5em 0;
  display: block;
}

.post-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 4px 0 4px 20px;
  margin: 1.6em 0;
  color: var(--text-2, #344054);
  font-style: italic;
  background: #fafbff;
  border-radius: 0 8px 8px 0;
}

.post-content code {
  background: #f1f3f4;
  color: #1a1a1a;                        /* explicit dark text for AA */
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .9em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.post-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 18px 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 1.6em 0;
  font-size: 14px;
  line-height: 1.55;
}
.post-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.post-content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: .95rem;
}
.post-content th,
.post-content td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
}
.post-content th {
  background: #f8fafc;
  color: var(--text, #1a1a1a);
  font-weight: 600;
}

/* ============================================================
   ARTICLE FOOTER
   ============================================================ */
.post-footer {
  margin-top: 60px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.post-share {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.post-share-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted, #667085);
  margin-right: 4px;
}

.post-share-btn {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark, #005fa3);   /* darker blue for WCAG AA */
  background: #fff;
  border: 1px solid var(--border-2, #cbd5e1);
  border-radius: 999px;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.post-share-btn:hover {
  background: rgba(0, 120, 212, .08);
  border-color: var(--primary-dark, #005fa3);
  color: var(--primary-dark, #005fa3);
}

.post-back {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark, #005fa3);   /* darker blue for WCAG AA */
  text-decoration: none;
}
.post-back:hover {
  text-decoration: underline;
}

/* ============================================================
   RELATED ARTICLES
   ============================================================ */
.related {
  max-width: 760px;
  margin: 60px auto 0;
  padding: 0 20px;
}

.related-heading {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--text, #1a1a1a);
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.related-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.related-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 12px 24px -12px rgba(0, 120, 212, .22);
}

.related-card-link {
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
  text-decoration: none;
  color: inherit;
  height: 100%;
}
.related-card-link:hover {
  text-decoration: none;
}

.related-card-cat {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 10px;
  margin-bottom: 10px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--primary-dark, #005fa3);   /* darker blue for contrast */
  background: rgba(0, 120, 212, .1);
  border: 1px solid rgba(0, 120, 212, .22);
  border-radius: 999px;
}

.related-card-title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text, #1a1a1a);
  letter-spacing: -.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card-excerpt {
  margin: 0 0 14px;
  font-size: .875rem;
  line-height: 1.55;
  color: var(--text-2, #344054);         /* darkened from muted for AA */
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted, #667085);
  flex-wrap: wrap;
}

.related-card-avatar {
  width: 20px;
  height: 20px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #0078d4, #00b4d8);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .post-container {
    padding: 20px 16px 60px;
  }

  .post-breadcrumb {
    font-size: 12.5px;
    margin-bottom: 20px;
  }
  .post-breadcrumb [aria-current="page"] {
    max-width: 180px;
  }

  .post-title {
    font-size: 1.6rem;
    margin-bottom: 16px;
  }

  .post-meta {
    font-size: 13px;
    gap: 8px;
  }

  .post-lede {
    font-size: .95rem;
    padding: 14px 16px;
    margin-top: 18px;
  }

  .post-content {
    font-size: 1rem;
    line-height: 1.75;
  }
  .post-content h2 { font-size: 1.3rem; }
  .post-content h3 { font-size: 1.1rem; }

  .post-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .related {
    margin-top: 44px;
    padding: 0 16px;
  }
  .related-grid {
    grid-template-columns: 1fr;
  }
  .related-heading {
    font-size: 1.15rem;
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: .001ms !important;
  }
  .related-card:hover {
    transform: none;
  }
}