/* ===== BLOG STYLES ===== */

/* Prevent layout shift from scrollbar appearing/disappearing */
html.blog-page {
	overflow-y: scroll;
}

/* Skeleton-fade transition for blog cards during search */
.blog-card-wrapper {
	transition:
		opacity 0.25s ease,
		transform 0.25s ease;
}

.blog-card-wrapper.fade-out {
	opacity: 0;
	transform: translateY(-8px);
	pointer-events: none;
}

.blog-card-wrapper.fade-in {
	animation: blogCardFadeIn 0.3s ease both;
}

@keyframes blogCardFadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Container min-height to reduce collapse when fewer cards shown */
.blog-grid-container {
	min-height: 360px;
	transition: min-height 0.2s ease;
}

/* --- Base Card --- */
.blog-card {
	background: #fff;
	border: 1px solid rgba(7, 51, 65, 0.12);
	border-radius: 8px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.2s ease;
	box-shadow: 0 1px 3px rgba(7, 51, 65, 0.04);
}

.blog-card:hover {
	box-shadow: 0 4px 12px rgba(7, 51, 65, 0.07);
}

/* --- Card Image (fixed aspect ratio for uniform cards) --- */
.blog-card-image-link {
	display: block;
	text-decoration: none;
	overflow: hidden;
}

.blog-card-image-wrapper {
	position: relative;
	width: 100%;
	aspect-ratio: 21 / 9;
	overflow: hidden;
	background: rgba(7, 51, 65, 0.04);
}

.blog-card-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* --- Card Body --- */
.blog-card-body {
	padding: 1rem 1.15rem 0.85rem;
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	gap: 0.3rem;
}

.blog-card-tags {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.38rem;
	margin-bottom: 0.1rem;
	overflow: hidden;
}

/* --- Tags with Per-Category Colors --- */
.blog-tag {
	display: inline-block;
	padding: 3px 9px;
	font-size: 0.65rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-radius: 999px;
	line-height: 1.3;
	white-space: nowrap;
}

.tag-default {
	background: rgba(7, 51, 65, 0.1);
	color: #073341;
}

.tag-product {
	background: rgba(27, 109, 143, 0.14);
	color: #0e4d68;
}

.tag-guides {
	background: rgba(8, 106, 98, 0.14);
	color: #075b53;
}

.tag-tips {
	background: rgba(46, 82, 153, 0.14);
	color: #1f3e7a;
}

.tag-best-practices {
	background: rgba(91, 79, 122, 0.14);
	color: #42385e;
}

.tag-customer-support {
	background: rgba(61, 115, 84, 0.14);
	color: #2a5c42;
}

.tag-automation {
	background: rgba(106, 79, 124, 0.14);
	color: #533d63;
}

.tag-productivity {
	background: rgba(200, 150, 40, 0.14);
	color: #8f6b1e;
}

.tag-tutorial {
	background: rgba(200, 80, 60, 0.14);
	color: #8f3b2e;
}

/* --- Featured Card (larger, horizontal-ish) --- */
.blog-card-featured {
	border-radius: 16px;
	border-color: rgba(7, 51, 65, 0.13);
	box-shadow: 0 6px 20px rgba(7, 51, 65, 0.07);
}

.blog-card-featured .blog-card-body {
	padding: 1.6rem 1.4rem;
	gap: 0.5rem;
	justify-content: center;
}

.blog-card-featured:hover {
	transform: translateY(-4px);
	box-shadow: 0 16px 36px rgba(7, 51, 65, 0.12);
}

/* --- Featured "More Articles" divider --- */
.blog-listing .text-uppercase.text-muted.h4 {
	font-size: 0.78rem;
	letter-spacing: 0.1em;
}

/* --- Title --- */
.blog-card-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.blog-card-title-lg {
	font-size: 1.3rem;
	line-height: 1.25;
}

.blog-title-link {
	color: #0a2c3e;
	transition: color 0.2s ease;
}

.blog-title-link:hover {
	color: #0f5d78;
}

/* --- Excerpt --- */
.blog-excerpt {
	margin: 0;
	color: #5a6a7a;
	font-size: 0.82rem;
	line-height: 1.5;
	flex-grow: 1;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* --- Meta Footer --- */
.blog-card-meta {
	margin-top: 0.5rem;
	padding-top: 0.5rem;
	border-top: 1px solid rgba(7, 51, 65, 0.07);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.8rem;
}

.blog-card-meta-author {
	display: flex;
	align-items: center;
	gap: 0.52rem;
	min-width: 0;
}

.blog-card-avatar {
	width: 28px;
	height: 28px;
	border-radius: 6px;
	background: #eef2f5;
	color: #3a4a5a;
	font-size: 0.65rem;
	font-weight: 600;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-family: system-ui, sans-serif;
}

.blog-card-author-name {
	font-size: 0.78rem;
	font-weight: 600;
	color: #1a2f3e;
	line-height: 1.2;
}

.blog-card-author-role {
	font-size: 0.68rem;
	color: #6c7a8a;
	line-height: 1.2;
}

.blog-card-meta-info {
	font-size: 0.73rem;
	color: #7a8a9a;
	white-space: nowrap;
	flex-shrink: 0;
}

.blog-card-meta-dot {
	margin: 0 0.2rem;
	color: #b0c0d0;
}

/* --- Blog Post Page (single article) --- */
.blog-tag-lg {
	padding: 4px 12px;
	font-size: 0.78rem;
}

.blog-tag-sm {
	padding: 2px 8px;
	font-size: 0.6rem;
}

.blog-content h2 {
	color: #0a2c3e;
	font-weight: 700;
}

.blog-content h3 {
	color: #1a3a4a;
	font-weight: 700;
}

.blog-content table {
	width: 100%;
	margin-bottom: 2rem;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.blog-content th,
.blog-content td {
	padding: 0.7rem 0.85rem;
	border: 1px solid rgba(7, 51, 65, 0.12);
	vertical-align: top;
}

.blog-content th {
	background: rgba(7, 51, 65, 0.04);
	font-weight: 700;
	color: #073341;
}

.blog-content td {
	color: #3a4a5a;
	line-height: 1.55;
}

.blog-content p {
	color: #3a4a5a;
	font-size: 1.02rem;
	line-height: 1.75;
}

.blog-content ul {
	list-style: disc;
}

.blog-content li {
	color: #3a4a5a;
	font-size: 1.02rem;
	line-height: 1.7;
}

/* --- Search Bar --- */
.blog-search-wrapper {
	position: relative;
}

.blog-search-icon {
	position: absolute;
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
	color: #8a9aaa;
	font-size: 1.2rem;
	z-index: 2;
}

.blog-search-input {
	padding-left: 2.8rem !important;
	border-radius: 50px;
	border: 1px solid rgba(7, 51, 65, 0.15);
	background: #f8fafc;
	transition:
		border-color 0.2s,
		box-shadow 0.2s;
}

.blog-search-input:focus {
	border-color: #0f5d78;
	box-shadow: 0 0 0 3px rgba(15, 93, 120, 0.15);
	background: #fff;
}

.blog-select:focus {
	border-color: #0f5d78;
	box-shadow: 0 0 0 3px rgba(15, 93, 120, 0.15);
	outline: none;
}

.blog-search-clear {
	line-height: 1;
	z-index: 2;
	color: #8a9aaa;
}

.blog-search-clear:hover {
	color: #3a4a5a;
}

/* --- CTA Banner --- */
.blog-cta-banner {
	background: linear-gradient(135deg, #073341 0%, #0f5d78 50%, #1a7a9a 100%);
	color: #fff;
}

.blog-cta-banner .btn-primary,
.blog-cta-banner a.btn-primary {
	background: #ffffff !important;
	color: #073341 !important;
	border: 2px solid #ffffff !important;
}

.blog-cta-banner .btn-primary:hover,
.blog-cta-banner a.btn-primary:hover {
	background: #e8f0f4 !important;
	color: #073341 !important;
	border-color: #e8f0f4 !important;
}

/* --- Social Share Links --- */
.blog-share-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 999px;
	background: rgba(7, 51, 65, 0.07);
	color: #3a4a5a;
	font-size: 1rem;
	text-decoration: none;
	transition:
		background 0.2s,
		color 0.2s,
		transform 0.2s;
}

.blog-share-link:hover {
	color: #fff;
	transform: translateY(-2px);
}

.blog-share-link[aria-label="Share on X"]:hover {
	background: #000;
}

.blog-share-link[aria-label="Share on LinkedIn"]:hover {
	background: #0a66c2;
}

.blog-share-link[aria-label="Share via Email"]:hover {
	background: #ea4335;
}

.blog-share-link-btn:hover {
	background: #0f5d78;
	color: #fff;
}

.blog-share-link-btn {
	border: none;
	cursor: pointer;
	padding: 0;
	line-height: 1;
}

/* --- Newsletter Signup --- */
.blog-newsletter {
	background: rgba(7, 51, 65, 0.04);
	border: 1px solid rgba(7, 51, 65, 0.09);
}

.blog-newsletter .form-control:focus {
	border-color: #0f5d78;
	box-shadow: 0 0 0 3px rgba(15, 93, 120, 0.15);
}

/* --- Collapsible Table of Contents --- */
.blog-toc {
	background: rgba(7, 51, 65, 0.03);
	border-color: rgba(7, 51, 65, 0.1) !important;
}

.blog-toc-toggle {
	cursor: pointer;
	outline: none;
	transition: background 0.2s;
}

.blog-toc-toggle:hover {
	background: rgba(7, 51, 65, 0.03);
}

.blog-toc-toggle:focus-visible {
	outline: 2px solid #0f5d78;
	outline-offset: -2px;
}

.blog-toc-collapse {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease;
}

/* max-height is set dynamically via JS to avoid truncation with many headings */

.transition-rotate {
	transition: transform 0.3s ease;
}

.transition-rotate.rotated {
	transform: rotate(180deg);
}

.blog-toc-list {
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.blog-toc-item {
	list-style: none;
}

.blog-toc-item-h3 {
	padding-left: 1.2rem;
}

.blog-toc-link {
	color: #3a4a5a;
	text-decoration: none;
	font-size: 0.95rem;
	padding: 0.3rem 0;
	display: block;
	border-radius: 4px;
	transition:
		color 0.2s,
		padding-left 0.2s;
}

.blog-toc-link:hover {
	color: #0f5d78;
	padding-left: 0.3rem;
}

.blog-toc-link.active {
	color: #0f5d78;
	font-weight: 600;
	padding-left: 0.75rem;
	position: relative;
}

.blog-toc-link.active::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 3px;
	background: #0f5d78;
	border-radius: 2px;
}

/* --- Related Posts Card --- */
.blog-related-card {
	background: #fff;
	transition:
		box-shadow 0.2s,
		transform 0.2s;
	border-color: rgba(7, 51, 65, 0.1) !important;
}

.blog-related-card:hover {
	box-shadow: 0 6px 16px rgba(7, 51, 65, 0.08);
	transform: translateY(-2px);
	border-color: rgba(7, 51, 65, 0.2) !important;
}

/* --- Responsive: featured card on smaller screens --- */
@media (max-width: 767.98px) {
	.blog-card-featured .blog-card-body {
		padding: 1rem;
	}

	.blog-card-title-lg {
		font-size: 1.1rem;
	}
}
