/**
 * Blog: listing pages and single articles. Loaded on blog views only (inc/blog.php).
 */

/* ---------- Shared bits ---------- */
.post-badge {
	display: inline-block;
	font-family: var(--mk-font-body); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
	color: var(--mk-accent); text-decoration: none;
}
.post-badge:hover { color: var(--mk-ink); }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: .9rem; color: var(--mk-muted); }
.post-meta__dot, .article-meta__sep { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .5; }
.post-card__placeholder {
	display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
	background-color: var(--mk-ink); background-image: var(--mk-weave); color: var(--mk-accent);
}
.post-card__placeholder svg { width: 36px; height: 36px; }

/* ---------- Listing: header ---------- */
.blog-hero { padding: clamp(28px, 4vw, 48px) 0 clamp(22px, 3vw, 32px); border-bottom: 1px solid var(--mk-line); }
.blog-hero__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 40px; margin-top: 10px; }
.blog-hero__text { max-width: 720px; }
.blog-hero__eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: .82rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--mk-accent); }
.blog-hero__eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; }
.blog-hero__title { margin: 0; font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.02; }
.blog-hero__desc { margin-top: 12px; font-size: 1.1rem; color: var(--mk-muted); }
.blog-hero__desc p:last-child { margin-bottom: 0; }
.blog-search { position: relative; flex: 0 1 340px; }
.blog-search svg { position: absolute; left: 16px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--mk-muted); pointer-events: none; }
.blog-search input[type="search"] { width: 100%; height: var(--mk-input-h, 48px); padding: 0 18px 0 44px; border-radius: var(--mk-radius-pill, 999px); }

.blog-chips { margin-top: 22px; }
.blog-chips ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.blog-chip {
	display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px;
	border: 1px solid var(--mk-line); border-radius: var(--mk-radius-pill, 999px); background: var(--mk-white);
	font-weight: 600; font-size: .95rem; color: var(--mk-ink); text-decoration: none;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.blog-chip:hover { border-color: var(--mk-ink); color: var(--mk-ink); transform: translateY(-1px); }
.blog-chip.is-active { background: var(--mk-ink); border-color: var(--mk-ink); color: var(--mk-white); }
.blog-chip__count { font-size: .78rem; font-weight: 700; opacity: .6; }

/* ---------- Listing: featured + cards ---------- */
.blog-listing { padding-top: clamp(28px, 4vw, 44px); padding-bottom: clamp(40px, 6vw, 72px); }
.post-featured { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(22px, 4vw, 48px); align-items: center; margin-bottom: clamp(36px, 5vw, 56px); }
.post-featured__media { display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--mk-radius-lg, 14px); background: var(--mk-surface); }
.post-featured__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.post-featured:hover .post-featured__media img { transform: scale(1.04); }
.post-featured__eyebrow { margin: 0 0 10px; font-size: .82rem; font-weight: 600; color: var(--mk-muted); }
.post-featured__title { margin: 8px 0 12px; font-size: clamp(1.8rem, 3.2vw, 2.6rem); line-height: 1.05; }
.post-featured__title a, .post-card__title a { color: var(--mk-ink); text-decoration: none; }
.post-featured__title a:hover, .post-card__title a:hover { color: var(--mk-accent); }
.post-featured__excerpt { margin: 0 0 14px; font-size: 1.08rem; color: var(--mk-muted); }
.post-featured__btn { margin-top: 20px; }

.post-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(28px, 3vw, 40px) clamp(18px, 2vw, 28px); }
.layout--right .post-cards, .layout--left .post-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.post-card { display: flex; flex-direction: column; min-width: 0; }
.post-card__media { display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--mk-radius-lg, 14px); background: var(--mk-surface); }
.post-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.post-card:hover .post-card__media img { transform: scale(1.05); }
.post-card__body { display: flex; flex-direction: column; gap: 8px; padding-top: 16px; flex: 1; }
.post-card__title { margin: 0; font-size: 1.35rem; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card__excerpt { margin: 0; color: var(--mk-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .post-meta { margin-top: auto; padding-top: 4px; }

/* Pagination */
.blog-listing .pagination { margin-top: clamp(36px, 5vw, 56px); }
.blog-listing .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.blog-listing .page-numbers {
	display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 12px;
	border: 1px solid var(--mk-line); border-radius: var(--mk-radius-sm, 6px); font-weight: 700; color: var(--mk-ink); text-decoration: none;
	transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.blog-listing .page-numbers svg { width: 18px; height: 18px; }
.blog-listing a.page-numbers:hover { border-color: var(--mk-ink); }
.blog-listing .page-numbers.current { background: var(--mk-ink); border-color: var(--mk-ink); color: var(--mk-white); }
.blog-listing .page-numbers.dots { border-color: transparent; }

.blog-empty { padding: 48px 24px; border: 2px dashed var(--mk-line); border-radius: var(--mk-radius-lg, 14px); text-align: center; }
.blog-empty__title { margin: 0 0 6px; font-family: var(--mk-font-heading); font-size: 1.6rem; font-weight: 700; }

/* "Request a quote" band */
.blog-cta {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 32px;
	margin-top: clamp(40px, 6vw, 64px); padding: clamp(24px, 4vw, 36px) clamp(22px, 4vw, 40px);
	border-radius: var(--mk-radius-lg, 14px);
	background-color: var(--mk-ink); background-image: var(--mk-weave), radial-gradient(circle at 90% 20%, color-mix(in srgb, var(--mk-accent) 40%, transparent), transparent 55%);
	color: var(--mk-white);
}
.blog-cta__eyebrow { margin: 0 0 6px; font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #ff8a8d; }
.blog-cta__title { margin: 0; max-width: 34ch; font-family: var(--mk-font-heading); font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 700; line-height: 1.1; color: var(--mk-white); }

/* ---------- Single article ---------- */
.reading-progress { position: fixed; top: var(--mk-sticky-top, 0px); left: 0; right: 0; z-index: 10002; height: 3px; pointer-events: none; }
.reading-progress span { display: block; height: 100%; background: var(--mk-accent); transform: scaleX(0); transform-origin: left; }

.article-hero { padding: clamp(28px, 4vw, 48px) 0 clamp(20px, 3vw, 32px); }
.article-hero__inner { max-width: 900px; }
.article-hero .post-badge { margin-top: 10px; }
.article-hero__title { margin: 10px 0 0; font-size: clamp(2.2rem, 4.8vw, 3.8rem); line-height: 1.03; text-wrap: balance; }
.article-hero__lead { max-width: 62ch; margin: 16px 0 0; font-size: clamp(1.1rem, 1.6vw, 1.3rem); line-height: 1.55; color: var(--mk-muted); }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 22px; font-size: .95rem; color: var(--mk-muted); }
.article-meta__author { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--mk-ink); text-decoration: none; }
.article-meta__author:hover { color: var(--mk-accent); }
.article-meta__avatar { width: 40px; height: 40px; border-radius: 50%; }

.article-image { margin-top: 0; margin-bottom: clamp(28px, 4vw, 48px); }
.article-image img { display: block; width: 100%; max-height: 620px; object-fit: cover; border-radius: var(--mk-radius-lg, 14px); }
.article-image figcaption { margin-top: 10px; font-size: .9rem; color: var(--mk-muted); text-align: center; }

.article-layout { padding-bottom: clamp(40px, 6vw, 72px); }
.article-layout.layout--none .article-main { width: 100%; max-width: 760px; margin-inline: auto; }
@media (min-width: 1200px) {
	.article-layout.has-toc.layout--none { display: grid; grid-template-columns: 260px minmax(0, 760px); justify-content: center; gap: 64px; }
	.article-layout.has-toc .article-main { margin-inline: 0; }
	.article-aside { position: relative; }
	.article-aside > * { position: sticky; top: calc(var(--mk-sticky-top, 0px) + var(--mk-header-h, 84px) + 24px); }
	.article-aside .share--aside { position: static; margin-top: 18px; }
	.toc--mobile { display: none; }
}
@media (max-width: 1199px) {
	.article-aside { display: none; }
}

/* Article typography */
.article-content { max-width: none; font-size: 1.125rem; line-height: 1.75; }
.article-content > * + * { margin-top: 1.1em; }
.article-content h2, .article-content h3 { scroll-margin-top: calc(var(--mk-sticky-top, 0px) + var(--mk-header-h, 84px) + 20px); line-height: 1.15; }
.article-content h2 { margin-top: 2em; font-size: clamp(1.7rem, 2.6vw, 2.1rem); }
.article-content h3 { margin-top: 1.6em; font-size: clamp(1.35rem, 2vw, 1.6rem); }
.article-content img, .article-content .wp-block-image img { border-radius: var(--mk-radius, 10px); }
.article-content blockquote, .article-content .wp-block-quote {
	margin-inline: 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--mk-accent);
	font-family: var(--mk-font-heading); font-size: 1.4rem; line-height: 1.35; color: var(--mk-ink);
}
.article-content ul li::marker { color: var(--mk-accent); }
.article-content a { text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* Table of contents */
.toc { border-radius: var(--mk-radius, 10px); background: var(--mk-surface); }
.toc details { padding: 16px 18px; }
.toc summary { cursor: pointer; font-family: var(--mk-font-heading); font-size: 1.1rem; font-weight: 700; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s ease; margin-right: 4px; }
.toc details[open] summary::after { transform: rotate(-135deg); }
.toc__list { margin: 12px 0 0; padding: 0; list-style: none; counter-reset: toc; }
.toc__item a { position: relative; display: block; padding: 6px 0 6px 14px; font-size: .95rem; line-height: 1.35; color: var(--mk-muted); text-decoration: none; transition: color .15s ease; }
.toc__item a::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: transparent; transition: background-color .15s ease; }
.toc__item a:hover, .toc__item a.is-active { color: var(--mk-ink); }
.toc__item a.is-active { font-weight: 700; }
.toc__item a.is-active::before { background: var(--mk-accent); }
.toc__item--h3 a { padding-left: 28px; font-size: .9rem; }
.toc--inline { margin-bottom: 28px; }

/* Share */
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.share__label { font-weight: 700; font-size: .95rem; }
.share__list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.share__btn {
	display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
	border: 1px solid var(--mk-line); border-radius: 50%; background: var(--mk-white); color: var(--mk-ink); cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.share__btn:hover { background: var(--mk-ink); border-color: var(--mk-ink); color: var(--mk-white); transform: translateY(-2px); }
.share__btn--whatsapp:hover { background: #1f9d55; border-color: #1f9d55; }
.share__status { font-size: .85rem; font-weight: 600; color: #1f9d55; }

/* Article footer, author, nav */
.article-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--mk-line); }
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.article-tags a { display: inline-block; padding: 6px 12px; border-radius: var(--mk-radius-pill, 999px); background: var(--mk-surface); font-size: .9rem; font-weight: 600; color: var(--mk-ink); text-decoration: none; }
.article-tags a:hover { background: var(--mk-ink); color: var(--mk-white); }

.author-box { display: flex; gap: 18px; align-items: flex-start; margin-top: 32px; padding: 22px; border-radius: var(--mk-radius-lg, 14px); background: var(--mk-surface); }
.author-box__avatar { width: 72px; height: 72px; border-radius: 50%; flex: none; }
.author-box__label { margin: 0; font-size: .82rem; color: var(--mk-muted); }
.author-box__name { margin: 2px 0 6px; font-family: var(--mk-font-heading); font-size: 1.3rem; font-weight: 700; }
.author-box__name a { color: var(--mk-ink); text-decoration: none; }
.author-box__bio { margin: 0; color: var(--mk-muted); }

.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 40px; }
.article-nav__link {
	display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--mk-line); border-radius: var(--mk-radius-lg, 14px);
	color: var(--mk-ink); text-decoration: none; transition: border-color .15s ease, transform .2s ease, box-shadow .2s ease;
}
.article-nav__link:hover { border-color: var(--mk-ink); color: var(--mk-ink); transform: translateY(-2px); box-shadow: 0 10px 22px -16px rgba(1, 1, 1, .5); }
.article-nav__link--next { flex-direction: row-reverse; text-align: right; }
.article-nav__img { width: 64px; height: 64px; flex: none; object-fit: cover; border-radius: var(--mk-radius-sm, 6px); }
.article-nav__label { display: block; font-size: .82rem; color: var(--mk-muted); }
.article-nav__title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-family: var(--mk-font-heading); font-size: 1.1rem; font-weight: 700; line-height: 1.2; }

.related-posts { padding: clamp(44px, 6vw, 72px) 0; background: var(--mk-surface); }
.related-posts__title { margin: 0 0 clamp(20px, 3vw, 30px); font-size: clamp(1.8rem, 3vw, 2.4rem); }
.related-posts .post-card__media { background: var(--mk-white); }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
	.post-featured { grid-template-columns: 1fr; }
	.post-cards, .layout--right .post-cards, .layout--left .post-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.blog-search { flex-basis: 100%; }
}
@media (max-width: 640px) {
	.post-cards, .layout--right .post-cards, .layout--left .post-cards { grid-template-columns: 1fr; }
	.article-nav { grid-template-columns: 1fr; }
	.article-footer { flex-direction: column; align-items: flex-start; }
	.blog-cta .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
	.post-card__media img, .post-featured__media img, .blog-chip, .share__btn, .article-nav__link { transition: none; }
	.post-card:hover .post-card__media img, .post-featured:hover .post-featured__media img { transform: none; }
}
