/* ===== BLOG (extends styles.css design system) ===== */

/* Visually hidden, available to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Blog index hero --- */
.blog-hero {
  padding: 64px 0 48px;
  text-align: center;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

.blog-hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(30px, 4.5vw, 44px);
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.blog-hero h1 span { color: var(--primary); }

.blog-hero p {
  font-size: 17px;
  color: var(--gray-500);
  max-width: 560px;
  margin: 0 auto;
}

/* --- Post cards grid (index) --- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  padding: 48px 0 80px;
}

.post-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  transition: box-shadow var(--transition), transform var(--transition);
}

.post-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.post-card-img {
  aspect-ratio: 1200 / 630;
  width: 100%;
  object-fit: cover;
  background: var(--surface);
}

.post-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  flex: 1;
}

.post-card-tag {
  display: inline-flex;
  align-self: flex-start;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
}

.post-card h2 {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.35;
}

.post-card h2 a { color: inherit; }
.post-card h2 a:hover { color: var(--primary); }

/* Make the whole card clickable without nesting links */
.post-card { position: relative; }
.post-card h2 a::after { content: ""; position: absolute; inset: 0; }

.post-card p {
  font-size: 14px;
  color: var(--gray-500);
  line-height: 1.6;
  flex: 1;
}

.post-card-meta {
  font-size: 12.5px;
  color: var(--gray-300);
  display: flex;
  gap: 8px;
  align-items: center;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  padding: 20px 0 0;
  font-size: 13px;
  color: var(--gray-500);
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 6px;
  color: var(--gray-300);
}

/* --- Article layout --- */
.post {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 0 64px;
}

.post-header { margin-bottom: 28px; }

.post-tag {
  display: inline-flex;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.post h1 {
  font-family: var(--font-heading);
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 14px;
  color: var(--gray-500);
}

.post-meta .dot { color: var(--gray-300); }

.post-hero-img {
  border-radius: var(--radius);
  margin: 28px 0;
  box-shadow: var(--shadow-md);
}

/* --- Article typography --- */
.post h2 {
  font-family: var(--font-heading);
  font-size: clamp(22px, 3vw, 27px);
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.01em;
  margin: 44px 0 14px;
  scroll-margin-top: 84px;
}

.post h3 {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 30px 0 10px;
  scroll-margin-top: 84px;
}

.post p {
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--gray-700);
  margin-bottom: 16px;
}

.post ul, .post ol {
  padding-left: 26px;
  margin-bottom: 18px;
}

.post li {
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.post li::marker { color: var(--primary); font-weight: 600; }

.post code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--surface);
  color: var(--primary);
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
}

.post a { text-decoration: underline; text-underline-offset: 2px; }

/* --- TL;DR / answer box --- */
.tldr {
  background: var(--surface);
  border: 1px solid #99F6E4;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin: 24px 0 28px;
}

.tldr p { margin-bottom: 0; font-size: 16px; }
.tldr p + p { margin-top: 10px; }

.tldr .tldr-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  margin-bottom: 8px;
}

/* --- Tables --- */
.table__container {
  overflow-x: auto;
  margin: 24px 0 28px;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}

.table__container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  min-width: 540px;
}

.table__container th {
  background: var(--surface);
  color: var(--gray-900);
  font-family: var(--font-heading);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid var(--primary-light);
  white-space: nowrap;
}

.table__container td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: top;
  line-height: 1.55;
}

.table__container tr:last-child td { border-bottom: none; }
.table__container tr:nth-child(even) td { background: var(--bg-alt); }

.cell-yes { color: var(--success); font-weight: 600; white-space: nowrap; }
.cell-no { color: #B91C1C; font-weight: 600; white-space: nowrap; }

/* --- Steps (numbered walkthrough) --- */
.post ol.steps-list { counter-reset: step; list-style: none; padding-left: 0; }

.post ol.steps-list > li {
  counter-increment: step;
  position: relative;
  padding-left: 52px;
  margin-bottom: 18px;
}

.post ol.steps-list > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 34px;
  height: 34px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
}

.post ol.steps-list > li strong:first-child {
  display: block;
  font-family: var(--font-heading);
  color: var(--gray-900);
  font-size: 16.5px;
  margin-bottom: 2px;
}

/* --- In-article CTA --- */
.post-cta {
  background: linear-gradient(135deg, #0F766E 0%, #115E59 100%);
  border-radius: var(--radius);
  padding: 32px;
  margin: 36px 0;
  color: #fff;
  text-align: center;
}

.post-cta h3 {
  font-family: var(--font-heading);
  color: #fff;
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 8px;
}

.post-cta p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 15px;
  margin-bottom: 20px;
}

.post-cta .btn-accent { background: #D97706; }
.post-cta .btn-accent:hover { background: var(--accent-hover); }

.post-cta-note {
  display: block;
  margin-top: 12px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.65);
}

/* --- FAQ --- */
.faq { margin: 28px 0; }

.faq details {
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background: var(--bg);
  overflow: hidden;
}

.faq details[open] { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }

.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  transition: background var(--transition);
}

.faq summary:hover { background: var(--bg-alt); }
.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 500;
  transition: transform var(--transition);
}

.faq details[open] summary::after { content: "−"; }

.faq .faq-answer { padding: 0 20px 18px; }
.faq .faq-answer p { font-size: 15.5px; margin-bottom: 8px; }
.faq .faq-answer p:last-child { margin-bottom: 0; }

/* --- Table of contents --- */
.toc {
  background: var(--bg-alt);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin: 24px 0 32px;
}

.toc-label {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-500);
  margin-bottom: 10px;
}

.toc ol {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
  columns: 2;
  column-gap: 28px;
}

.toc li { margin-bottom: 7px; font-size: 14.5px; break-inside: avoid; }
.toc a { text-decoration: none; color: var(--gray-700); }
.toc a:hover { color: var(--primary); }

/* --- Author / updated footer --- */
.post-footer {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 14px;
}

.post-footer .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.post-footer .who { font-size: 14px; color: var(--gray-500); }
.post-footer .who strong { color: var(--gray-900); display: block; font-size: 15px; }

/* --- Related posts --- */
.related { margin-top: 40px; }

.related h2 {
  font-family: var(--font-heading);
  font-size: 21px;
  margin-bottom: 16px;
}

.related ul { list-style: none; padding-left: 0; }

.related li {
  margin-bottom: 10px;
  padding: 14px 18px;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.related li:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }
.related li a { text-decoration: none; font-weight: 600; color: var(--gray-900); font-size: 15px; }
.related li a:hover { color: var(--primary); }
.related li span { display: block; font-size: 13px; color: var(--gray-500); margin-top: 2px; font-weight: 400; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .post-grid { grid-template-columns: 1fr; padding: 32px 0 56px; }
  .blog-hero { padding: 44px 0 32px; }
  .toc ol { columns: 1; }
  .post-cta { padding: 24px 20px; }
  .post { padding-bottom: 48px; }
}

@media (max-width: 480px) {
  .post p, .post li { font-size: 15.5px; }
  .post ol.steps-list > li { padding-left: 44px; }
  .post ol.steps-list > li::before { width: 30px; height: 30px; font-size: 14px; }
  .post code { white-space: normal; }
}

/* Print: hide chrome, keep content */
@media print {
  .nav, .footer, .post-cta, .breadcrumbs { display: none; }
}
