/* ──────────────────────────────────────────────────────────────────────────────
   blog.css  –  Blog & dynamic pages: layered on top of v2 main.css
   Loaded only on PHP-rendered pages (blog, admin via SiteLayout)
   ────────────────────────────────────────────────────────────────────────────── */

/* colour tokens used by the blog templates (aliases onto the current brand palette) */
:root {
  --f7: #0f3d2e;
  --f9: #f5f0e6;
  --line: rgba(15, 61, 46, 0.2);
  --gray-500: #5f6b64;
  --gray-600: #4a5650;
  --gray-700: #36413b;
  --gray-800: #1f2a25;
  --font-heading: var(--font-body);
}

/* Blog pages use the same scroll model as the static pages: #page is the scroller (Lenis wrapper). */
.blog-main {
  padding-top: 0;
}

/* ── Loader: hide completely on blog pages ── */
.blog-body .loader { display: none !important; }

/* ─────────────────── BLOG HERO ──────────────────────────────────────────── */
.blog-hero {
  background: var(--f9);
  border-bottom: 1px solid var(--line);
  padding: 120px 0 64px;
}
.blog-hero .container,
.blog-empty,
.blog-card-body,
.related .container,
.post-layout,
.post-header .container,
.post-cover,
section.section-sm .container,
.cta-section .container,
.pagination {
  max-width: 1140px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8125rem;
  color: var(--gray-500);
  margin-bottom: 1.25rem;
}
.breadcrumb a { color: inherit; text-decoration: underline; }
.breadcrumb span[aria-hidden] { opacity: .4; }

.blog-hero .label {
  display: inline-block;
  font-size: .75rem;
  font-family: var(--font-mono, monospace);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--f7);
  margin-bottom: .75rem;
}
.blog-hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.08;
  text-transform: uppercase;
  letter-spacing: -.01em;
  margin-bottom: 1rem;
}
.blog-hero .lead {
  font-size: 1.0625rem;
  color: var(--gray-600);
  max-width: 680px;
  line-height: 1.65;
  margin-bottom: 1.75rem;
}

/* ── Category chip bar ── */
.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.5rem;
}
.cat-chips a {
  display: inline-flex;
  align-items: center;
  padding: .35rem .9rem;
  border-radius: 2rem;
  border: 1.5px solid var(--line);
  font-size: .8125rem;
  font-weight: 500;
  color: var(--gray-700);
  text-decoration: none;
  transition: border-color .18s, background .18s, color .18s;
}
.cat-chips a:hover,
.cat-chips a.active {
  border-color: var(--f7);
  background: var(--f7);
  color: var(--cream);
}

/* ── Blog grid ── */
.section-sm { padding: 64px 0 80px; }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 2rem;
}

.blog-card {
  border-radius: .75rem;
  overflow: hidden;
  border: 1.5px solid var(--line);
  background: var(--cream);
  display: flex;
  flex-direction: column;
  transition: box-shadow .22s, transform .22s;
}
.blog-card:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,.08);
  transform: translateY(-3px);
}

.blog-card-img {
  display: block;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--f7);
  color: var(--cream);
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.blog-card-img.placeholder { background: var(--f7); }
.blog-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.blog-card:hover .blog-card-img img { transform: scale(1.04); }

.blog-card-body {
  padding: 1.25rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.blog-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  font-size: .75rem;
  color: var(--gray-500);
  margin-bottom: .75rem;
}
.blog-meta .cat {
  background: var(--f7);
  color: var(--cream);
  padding: .2rem .6rem;
  border-radius: 2rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.blog-card-body h2,
.blog-card-body h3 {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: .5rem;
  letter-spacing: -.01em;
}
.blog-card-body h2 a,
.blog-card-body h3 a {
  color: inherit;
  text-decoration: none;
}
.blog-card-body h2 a:hover,
.blog-card-body h3 a:hover { color: var(--f7); }
.blog-card-body p {
  font-size: .9rem;
  color: var(--gray-600);
  line-height: 1.6;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.pagination a,
.pagination .current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding-inline: .75rem;
  border-radius: .375rem;
  border: 1.5px solid var(--line);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--gray-700);
  transition: border-color .18s, background .18s, color .18s;
}
.pagination a:hover { border-color: var(--f7); color: var(--f7); }
.pagination .current {
  background: var(--f7);
  border-color: var(--f7);
  color: var(--cream);
}

/* ── Blog empty state ── */
.blog-empty {
  text-align: center;
  padding: 5rem 1rem;
  color: var(--gray-600);
}
.blog-empty .heading-md {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .7rem 1.5rem; border-radius: .375rem; font-weight: 600; text-decoration: none; transition: opacity .18s; }
.btn-primary { background: var(--f7); color: var(--cream); }
.btn-primary:hover { opacity: .88; }
.btn-wa { background: #25D366; color: #fff; }
.btn-wa:hover { opacity: .88; }
.btn-arrow { font-size: .875em; }

/* ── Blog CTA section ── */
.cta-section {
  background: var(--f7);
  color: var(--cream);
  padding: 5rem 0;
  text-align: center;
}
.cta-section h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -.02em;
  margin-bottom: 2rem;
  line-height: 1.08;
}
.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}
.cta-note {
  margin-top: 1.25rem;
  font-size: .875rem;
  opacity: .7;
}

/* ─────────────────── BLOG POST PAGE ─────────────────────────────────────── */
.post-header {
  background: var(--f9);
  border-bottom: 1px solid var(--line);
  padding: 120px 0 48px;
}
.post-header h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.875rem, 4.5vw, 3.125rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.02em;
  margin-bottom: .75rem;
}
.post-header .label {
  display: inline-block;
  background: var(--f7);
  color: var(--cream);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .2rem .65rem;
  border-radius: 2rem;
  margin-bottom: .75rem;
  text-decoration: none;
}
.post-header .excerpt {
  font-size: 1.0625rem;
  color: var(--gray-600);
  line-height: 1.65;
  max-width: 720px;
  margin-bottom: .75rem;
}
.post-header .blog-meta { margin-top: .75rem; }

.post-cover {
  margin: 0;
  padding: 0;
  max-width: 900px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
  padding-block: 2rem;
}
.post-cover img {
  width: 100%;
  height: auto;
  border-radius: .75rem;
  display: block;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.post-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 3rem;
  padding-block: 3rem 5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .post-layout { grid-template-columns: 1fr; }
  .toc { order: -1; }
}

/* ── Post content prose ── */
.post-content {
  max-width: 72ch;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--gray-800, #1a1a1a);
}
.post-content h2 { font-family: var(--font-heading); font-size: 1.625rem; font-weight: 800; margin: 2.5rem 0 .75rem; }
.post-content h3 { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 700; margin: 2rem 0 .5rem; }
.post-content h4 { font-size: 1.05rem; font-weight: 700; margin: 1.5rem 0 .5rem; }
.post-content p { margin-bottom: 1.35rem; }
.post-content ul, .post-content ol { padding-left: 1.5rem; margin-bottom: 1.35rem; }
.post-content li { margin-bottom: .5rem; }
.post-content a { color: var(--f7); text-decoration: underline; }
.post-content strong { font-weight: 700; }
.post-content blockquote {
  border-left: 3px solid var(--f7);
  margin: 1.75rem 0;
  padding: 1rem 1.5rem;
  background: color-mix(in srgb, var(--f7) 8%, transparent);
  border-radius: 0 .5rem .5rem 0;
  font-style: italic;
  color: var(--gray-700);
}
.post-content pre {
  background: #1a1a2e;
  color: #e2e8f0;
  padding: 1.25rem 1.5rem;
  border-radius: .5rem;
  overflow-x: auto;
  font-size: .875rem;
  margin-bottom: 1.35rem;
}
.post-content code { font-family: monospace; font-size: .875em; background: color-mix(in srgb, var(--f7) 10%, transparent); padding: .1em .35em; border-radius: .2em; }
.post-content pre code { background: none; padding: 0; }
.post-content img { max-width: 100%; height: auto; border-radius: .5rem; margin-block: 1.5rem; }
.post-content table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; font-size: .9375rem; }
.post-content th, .post-content td { border: 1px solid var(--line); padding: .6rem 1rem; text-align: left; }
.post-content th { background: var(--f9); font-weight: 700; }

/* ── FAQ accordion in post ── */
.post-faq { margin-top: 3rem; }
.post-faq h2 { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 800; margin-bottom: 1.25rem; }
.faq-simple details {
  border-bottom: 1px solid var(--line);
  padding: .875rem 0;
}
.faq-simple summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.faq-simple summary::-webkit-details-marker { display: none; }
.faq-simple summary::after { content: '+'; font-size: 1.25rem; line-height: 1; flex-shrink: 0; color: var(--f7); }
.faq-simple details[open] summary::after { content: '−'; }
.faq-simple p { margin-top: .75rem; color: var(--gray-600); font-size: .9375rem; line-height: 1.65; }

/* ── Post in-content CTA ── */
.post-cta {
  background: var(--f7);
  color: var(--cream);
  padding: 2rem 2.25rem;
  border-radius: .75rem;
  margin-top: 3rem;
}
.post-cta h2 { font-family: var(--font-heading); font-size: 1.375rem; font-weight: 800; margin-bottom: .5rem; }
.post-cta p { font-size: .9375rem; opacity: .88; margin-bottom: 1.25rem; }
.post-cta .hero-ctas { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ── TOC ── */
.toc {
  position: sticky;
  top: 100px;
  border: 1.5px solid var(--line);
  border-radius: .625rem;
  padding: 1.25rem 1.5rem;
  font-size: .875rem;
}
.toc p { font-weight: 700; font-size: .8125rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .75rem; color: var(--gray-500); }
.toc ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.toc li a { color: var(--gray-600); text-decoration: none; display: block; line-height: 1.45; }
.toc li a:hover { color: var(--f7); }
.toc li.l2 { padding-left: 1rem; }
.toc li.l3 { padding-left: 1.75rem; }

/* ── Related posts ── */
.related {
  background: var(--f9);
  border-top: 1px solid var(--line);
  padding: 4rem 0;
}
.related h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.375rem, 3vw, 2rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -.01em;
  margin-bottom: 2rem;
}

/* ── Blog nav active state ── */
.navbar-wrap .nav-pill[href="/blog/"] .nav-pill-text { opacity: 1; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .blog-hero { padding: 100px 0 48px; }
  .post-header { padding: 100px 0 40px; }
  .post-layout { padding-block: 2rem 4rem; }
  .blog-grid { gap: 1.25rem; }
}

@media (max-width: 767px) {
  .blog-hero { padding: 6.4rem 0 2.4rem; }
  .blog-grid { gap: 1.2rem; }
  .pagination { margin-top: 2rem; }
}

/* ── Blog listing: full width, 3 cards per row ── */
.blog-hero .container,
section.section-sm .container,
section.section-sm .pagination {
  max-width: none;
  padding-inline: clamp(1.25rem, 4vw, 4.5rem);
}
section.section-sm .container .pagination { padding-inline: 0; }
.blog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.25rem, 2vw, 2rem); }
.blog-card-body { max-width: none; margin-inline: 0; }
@media (max-width: 1024px) { .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .blog-grid { grid-template-columns: 1fr; } }
.related .blog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1024px) { .related .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .related .blog-grid { grid-template-columns: 1fr; } }

/* ── Single post: full width ── */
.post-header .container,
.post-cover,
.post-layout,
.related .container,
.cta-section .container {
  max-width: none;
  padding-inline: clamp(1.25rem, 4vw, 4.5rem);
}
.post-header h1, .post-header .excerpt { max-width: 1100px; }
.post-cover { padding-block: 1.5rem 0; }
.post-cover img { aspect-ratio: auto; max-height: none; width: 100%; height: auto; object-fit: contain; }
.post-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(2rem, 4vw, 4rem); }
.post-content { max-width: none; font-size: 1.125rem; }
.post-content img { display: block; width: 100%; max-width: 1280px; height: auto; margin-inline: auto; }
.post-content figure { margin: 1.5rem 0; }
.post-content figure img { margin-block: 0; }
.post-content table { display: block; overflow-x: auto; }
@media (max-width: 900px) { .post-layout { grid-template-columns: 1fr; } }
.post-cover img { max-width: 1400px; margin-inline: auto; }

/* ── TOC: wider + active section highlight ── */
.post-layout { grid-template-columns: minmax(0, 1fr) clamp(300px, 24vw, 440px); }
.toc { max-height: calc(100vh - 130px); overflow-y: auto; padding: 1.5rem 1.5rem 1.5rem 1.25rem; font-size: .95rem; scrollbar-width: thin; }
.toc li a { position: relative; padding: .3rem .75rem; border-radius: .5rem; border-left: 3px solid transparent; transition: background .2s, color .2s, border-color .2s; }
.toc li a:hover { background: color-mix(in srgb, var(--f7) 7%, transparent); }
.toc li a.is-active { color: var(--f7); font-weight: 700; background: color-mix(in srgb, var(--f7) 12%, transparent); border-left-color: var(--f7); }
.toc ol { gap: .15rem; }
.toc li.l2 { padding-left: 0; }
.toc li.l3 { padding-left: 1rem; }
@media (max-width: 900px) { .post-layout { grid-template-columns: 1fr; } .toc { position: static; max-height: none; } }
