/* ──────────────────────────────────────────────────────────────────────────── *
 * BLOG.CSS - Archive, Index, Single Post, Related Posts
 * ──────────────────────────────────────────────────────────────────────────── */

/* ── Archive / index shared card radius ────────────────────────────────────── */
.tih-archive,
.tih-blog-index {
	--card-radius: 14px;
}

/* ── Archive hero header ────────────────────────────────────────────────────── */
.tih-archive__head {
	padding-block: clamp(40px, 6vw, 72px) clamp(32px, 5vw, 56px);
	text-align: center;
	background: linear-gradient(135deg, var(--tih-sky) 0%, #EFF6FF 55%, var(--tih-bg) 100%);
	border-bottom: 1px solid var(--tih-border);
	margin-bottom: clamp(32px, 5vw, 56px);
	max-width: 100% !important;
	margin-inline: 0 !important;
}

.tih-archive__title {
	font-size: clamp(2rem, 5vw, 3rem) !important;
	font-weight: 800 !important;
	color: var(--tih-navy) !important;
	letter-spacing: -0.02em;
	margin: 0 0 0.5em !important;
	line-height: 1.15 !important;
}

.tih-archive__desc {
	font-size: 1.125rem !important;
	color: var(--tih-text-muted) !important;
	max-width: 560px;
	margin-inline: auto !important;
	line-height: 1.7;
	margin-top: 0 !important;
}

/* ── Archive post grid ────────────────────────────────────────────────────── */
.tih-archive__query {
	padding-inline: clamp(16px, 5vw, 48px);
	max-width: var(--tih-max-wide);
	margin-inline: auto;
}

.tih-archive__grid {
	display: grid !important;
	grid-template-columns: repeat(3, 1fr) !important;
	gap: 28px !important;
	list-style: none !important;
	padding: 0 !important;
	margin: 0 0 clamp(32px, 5vw, 56px) !important;
}

/* Featured first post - full-width hero card */
.tih-archive__grid > li:first-child {
	grid-column: 1 / -1 !important;
	display: grid !important;
	grid-template-columns: 1.25fr 1fr !important;
	grid-template-rows: auto auto 1fr auto !important;
	background: var(--tih-surface);
	border: 1px solid var(--tih-border);
	border-radius: var(--card-radius);
	overflow: hidden;
	box-shadow: var(--tih-shadow-sm);
	transition: box-shadow 0.3s ease, transform 0.25s ease;
	cursor: pointer;
}

.tih-archive__grid > li:first-child:hover {
	box-shadow: 0 16px 48px rgba(15, 23, 42, 0.11);
	transform: translateY(-4px);
}

.tih-archive__grid > li:first-child .tih-archive__img {
	grid-column: 1;
	grid-row: 1 / span 4;
	border-radius: 0 !important;
	overflow: hidden;
	min-height: 340px;
}

.tih-archive__grid > li:first-child .tih-archive__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 0 !important;
	display: block;
	transition: transform 0.5s ease;
}

.tih-archive__grid > li:first-child:hover .tih-archive__img img {
	transform: scale(1.04);
}

.tih-archive__grid > li:first-child .tih-archive__cat {
	grid-column: 2;
	grid-row: 1;
	padding: clamp(24px, 4vw, 40px) clamp(24px, 4vw, 40px) 0;
	align-self: end;
}

.tih-archive__grid > li:first-child .tih-archive__post-title {
	grid-column: 2;
	grid-row: 2;
	padding: 14px clamp(24px, 4vw, 40px) 0;
	font-size: clamp(1.375rem, 2.5vw, 2rem) !important;
	line-height: 1.2 !important;
	font-weight: 800 !important;
}

.tih-archive__grid > li:first-child .tih-archive__excerpt {
	grid-column: 2;
	grid-row: 3;
	padding: 14px clamp(24px, 4vw, 40px) clamp(24px, 4vw, 40px);
	font-size: 1rem;
}

/* ── Regular archive cards ──────────────────────────────────────────────── */
.tih-archive__grid > li:not(:first-child) {
	background: var(--tih-surface);
	border: 1px solid var(--tih-border);
	border-radius: var(--card-radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.25s ease, transform 0.2s ease;
	cursor: pointer;
}

.tih-archive__grid > li:not(:first-child):hover {
	box-shadow: 0 10px 32px rgba(15, 23, 42, 0.10);
	transform: translateY(-3px);
}

.tih-archive__grid > li:not(:first-child) .tih-archive__img {
	overflow: hidden;
	border-radius: 0 !important;
	aspect-ratio: 16 / 9;
}

.tih-archive__grid > li:not(:first-child) .tih-archive__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 0 !important;
	display: block;
	transition: transform 0.45s ease;
}

.tih-archive__grid > li:not(:first-child):hover .tih-archive__img img {
	transform: scale(1.06);
}

.tih-archive__grid > li:not(:first-child) .tih-archive__cat {
	padding: 16px 18px 0;
}

.tih-archive__grid > li:not(:first-child) .tih-archive__post-title {
	padding: 8px 18px 0;
	flex: 1;
}

.tih-archive__grid > li:not(:first-child) .tih-archive__excerpt {
	padding: 8px 18px 18px;
}

/* ── Category pill ──────────────────────────────────────────────────────── */
.tih-archive__cat a {
	display: inline-flex !important;
	align-items: center !important;
	background: var(--tih-primary-light) !important;
	color: var(--tih-primary) !important;
	font-weight: 700 !important;
	font-size: 0.6875rem !important;
	text-transform: uppercase !important;
	letter-spacing: 0.08em !important;
	text-decoration: none !important;
	padding: 3px 10px !important;
	border-radius: 99px !important;
	transition: background 0.15s ease, color 0.15s ease;
}

.tih-archive__cat a:hover {
	background: #DBEAFE !important;
	color: var(--tih-primary-dark) !important;
}

/* ── Post title ──────────────────────────────────────────────────────────── */
.tih-archive__post-title {
	font-weight: 700 !important;
	line-height: 1.3 !important;
	margin: 0 !important;
}

.tih-archive__post-title a {
	text-decoration: none !important;
	color: var(--tih-navy) !important;
	transition: color 0.15s ease;
}

.tih-archive__post-title a:hover {
	color: var(--tih-primary) !important;
}

/* ── Excerpt ─────────────────────────────────────────────────────────────── */
.tih-archive__excerpt {
	color: var(--tih-text-muted) !important;
	font-size: 0.9rem !important;
	line-height: 1.6 !important;
	margin: 0 !important;
}

.tih-archive__excerpt p {
	margin: 0 !important;
}

.tih-archive__excerpt .wp-block-post-excerpt__more-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--tih-primary) !important;
	font-weight: 600;
	font-size: 0.85rem;
	text-decoration: none !important;
	margin-top: 10px;
	transition: gap 0.2s ease, color 0.15s ease;
}

.tih-archive__excerpt .wp-block-post-excerpt__more-link:hover {
	gap: 8px;
	color: var(--tih-primary-dark) !important;
}

/* ── Archive pagination ──────────────────────────────────────────────────── */
.tih-archive__pagination {
	margin-top: clamp(32px, 5vw, 56px) !important;
	gap: 8px !important;
	padding-bottom: clamp(32px, 5vw, 56px);
}

.tih-archive__pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding-inline: 12px;
	border-radius: 8px;
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: none;
	color: var(--tih-text);
	background: var(--tih-surface);
	border: 1px solid var(--tih-border);
	transition: all 0.15s ease;
}

.tih-archive__pagination .page-numbers.current,
.tih-archive__pagination .page-numbers:hover {
	background: var(--tih-primary);
	color: #fff;
	border-color: var(--tih-primary);
}

.tih-archive__pagination .wp-block-query-pagination-previous,
.tih-archive__pagination .wp-block-query-pagination-next {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 18px;
	border-radius: 8px;
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: none;
	color: var(--tih-primary);
	background: var(--tih-primary-light);
	border: 1px solid transparent;
	transition: all 0.2s ease;
}

.tih-archive__pagination .wp-block-query-pagination-previous:hover,
.tih-archive__pagination .wp-block-query-pagination-next:hover {
	background: var(--tih-primary);
	color: #fff;
}

/* ──────────────────────────────────────────────────────────────────────────── *
 * SINGLE ARTICLE
 * ──────────────────────────────────────────────────────────────────────────── */

/* ── Reading progress bar ───────────────────────────────────────────────── */
#tih-progress-bar {
	position: fixed;
	top: 0;
	left: 0;
	width: 0%;
	height: 3px;
	background: linear-gradient(90deg, var(--tih-primary) 0%, var(--tih-teal) 100%);
	z-index: 9999;
	transition: width 0.08s linear;
	pointer-events: none;
	border-radius: 0 2px 2px 0;
}

/* ── Article head ────────────────────────────────────────────────────────── */
.tih-article__head {
	max-width: var(--tih-max-wide);
	margin-inline: auto;
	padding-inline: clamp(16px, 5vw, 48px);
	padding-block: clamp(40px, 7vw, 80px) clamp(24px, 4vw, 40px);
	text-align: center;
}

.tih-article__cat {
	margin-bottom: 18px;
}

.tih-article__cat a {
	display: inline-flex;
	align-items: center;
	background: var(--tih-primary-light);
	color: var(--tih-primary) !important;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-size: 0.6875rem;
	text-decoration: none;
	padding: 4px 14px;
	border-radius: 99px;
	transition: background 0.15s ease;
}

.tih-article__cat a:hover {
	background: #DBEAFE;
}

.tih-article__title {
	font-size: clamp(2rem, 5vw, 3rem) !important;
	font-weight: 800 !important;
	line-height: 1.15 !important;
	letter-spacing: -0.025em !important;
	color: var(--tih-navy);
	margin: 0 0 1.25rem !important;
}

.tih-article__meta {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 12px !important;
	color: var(--tih-text-muted) !important;
	font-size: 0.875rem !important;
}

.tih-article__meta .wp-block-post-date,
.tih-article__meta .wp-block-post-author-name {
	color: var(--tih-text-muted);
}

.tih-article__meta p {
	margin: 0;
	color: var(--tih-border);
	font-size: 1.1em;
}

/* Reading time (injected via JS) */
.tih-reading-time {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	color: var(--tih-text-muted);
	font-size: 0.875rem;
}

.tih-reading-time svg {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	opacity: 0.65;
}

/* ── Hero image ──────────────────────────────────────────────────────────── */
.tih-article__hero {
	margin-bottom: clamp(32px, 5vw, 60px);
}

.tih-article__hero .wp-block-post-featured-image,
.tih-article__hero figure {
	border-radius: var(--tih-radius-lg) !important;
	overflow: hidden;
}

.tih-article__hero img {
	width: 100%;
	border-radius: var(--tih-radius-lg) !important;
	max-height: 540px;
	object-fit: cover;
	display: block;
}

/* ── Article body typography ─────────────────────────────────────────────── */
.tih-article__body {
	max-width: var(--tih-max-wide);
	margin-inline: auto;
	padding-inline: clamp(16px, 5vw, 48px);
	font-size: 1.0625rem;
	line-height: 1.82;
	color: var(--tih-text);
	padding-bottom: clamp(32px, 5vw, 60px);
}

.tih-article__body p {
	margin-top: 0;
	margin-bottom: 1.5em;
}

/* Lead paragraph */
.tih-article__body > div > p:first-of-type,
.tih-article__body > p:first-of-type {
	font-size: 1.1875rem;
	line-height: 1.75;
	color: #334155;
}

.tih-article__body h2 {
	font-size: clamp(1.375rem, 3vw, 1.75rem);
	font-weight: 800;
	letter-spacing: -0.015em;
	color: var(--tih-navy);
	margin-top: 2.75em;
	margin-bottom: 0.75em;
	padding-bottom: 0.5em;
	border-bottom: 2px solid var(--tih-border);
	line-height: 1.2;
}

.tih-article__body h3 {
	font-size: clamp(1.125rem, 2.5vw, 1.375rem);
	font-weight: 700;
	color: var(--tih-navy);
	margin-top: 2em;
	margin-bottom: 0.6em;
	line-height: 1.25;
}

.tih-article__body h4 {
	font-size: 1.0625rem;
	font-weight: 700;
	color: var(--tih-navy);
	margin-top: 1.75em;
	margin-bottom: 0.5em;
}

/* Blockquote */
.tih-article__body blockquote,
.tih-article__body .wp-block-quote {
	border-left: 4px solid var(--tih-primary) !important;
	background: var(--tih-primary-light);
	margin: 2em 0 !important;
	padding: 20px 28px !important;
	border-radius: 0 var(--tih-radius-md) var(--tih-radius-md) 0;
	font-style: italic;
	color: var(--tih-navy);
	font-size: 1.0625rem;
}

.tih-article__body blockquote p,
.tih-article__body .wp-block-quote p {
	margin: 0;
	line-height: 1.7;
}

/* Lists */
.tih-article__body ul,
.tih-article__body ol {
	padding-left: 1.75em;
	margin-bottom: 1.5em;
}

.tih-article__body li {
	margin-bottom: 0.6em;
	line-height: 1.7;
}

/* Tables */
.tih-article__body table,
.tih-article__body .wp-block-table table {
	width: 100%;
	border-collapse: collapse;
	margin: 2em 0;
	font-size: 0.9375rem;
	border-radius: var(--tih-radius-md);
	overflow: hidden;
	border: 1px solid var(--tih-border);
}

.tih-article__body th {
	background: var(--tih-surface-alt);
	color: var(--tih-navy);
	font-weight: 700;
	font-size: 0.8125rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 12px 16px;
	text-align: left;
	border-bottom: 2px solid var(--tih-border);
}

.tih-article__body td {
	padding: 12px 16px;
	border-bottom: 1px solid var(--tih-border);
	vertical-align: top;
}

.tih-article__body tr:last-child td {
	border-bottom: none;
}

.tih-article__body tr:nth-child(even) td {
	background: var(--tih-surface-alt);
}

/* Links inside body */
.tih-article__body a {
	color: var(--tih-primary);
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1.5px;
	transition: color 0.15s ease;
}

.tih-article__body a:hover {
	color: var(--tih-primary-dark);
}

/* Callout / info boxes in content */
.tih-article__body .wp-block-notice,
.tih-article__body .wp-block-callout {
	border-radius: var(--tih-radius-md);
	padding: 16px 20px;
	margin: 2em 0;
}

/* Image captions */
.tih-article__body figcaption,
.tih-article__body .wp-element-caption {
	font-size: 0.8125rem;
	color: var(--tih-text-muted);
	text-align: center;
	margin-top: 8px;
}

/* Code */
.tih-article__body code {
	font-size: 0.875em;
	background: var(--tih-surface-alt);
	color: var(--tih-primary-dark);
	padding: 2px 6px;
	border-radius: 4px;
	border: 1px solid var(--tih-border);
}

.tih-article__body pre {
	background: var(--tih-navy);
	color: #e2e8f0;
	padding: 20px 24px;
	border-radius: var(--tih-radius-md);
	overflow-x: auto;
	font-size: 0.875rem;
	margin: 2em 0;
}

.tih-article__body pre code {
	background: none;
	border: none;
	color: inherit;
	padding: 0;
	font-size: inherit;
}

/* ── Related posts ─────────────────────────────────────────────────────────── */

.tih-article__related {
	padding-block: clamp(48px, 7vw, 80px) !important;
}

.tih-related {
	max-width: var(--tih-max-wide);
	margin-inline: auto;
	padding-inline: clamp(16px, 5vw, 48px);
}

.tih-related__title {
	font-size: clamp(1.25rem, 3vw, 1.75rem) !important;
	font-weight: 800 !important;
	color: var(--tih-navy);
	margin: 0 0 clamp(20px, 3vw, 36px) !important;
	letter-spacing: -0.015em;
}

.tih-related__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}

.tih-related__card {
	display: flex;
	flex-direction: column;
	text-decoration: none !important;
	color: inherit;
	background: var(--tih-surface);
	border: 1px solid var(--tih-border);
	border-radius: 14px;
	overflow: hidden;
	transition: box-shadow 0.25s ease, transform 0.2s ease;
	cursor: pointer;
}

.tih-related__card:hover {
	box-shadow: 0 12px 36px rgba(15, 23, 42, 0.11);
	transform: translateY(-4px);
}

/* Image wrapper for zoom effect */
.tih-related__img-wrap {
	overflow: hidden;
	aspect-ratio: 16 / 9;
}

.tih-related__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.45s ease;
}

.tih-related__card:hover .tih-related__img {
	transform: scale(1.06);
}

/* Card content */
.tih-related__content {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px 18px 20px;
	flex: 1;
}

.tih-related__cat {
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--tih-primary);
}

.tih-related__name {
	font-weight: 700;
	font-size: 0.9375rem;
	line-height: 1.4;
	color: var(--tih-navy);
	flex: 1;
}

.tih-related__date {
	font-size: 0.8125rem;
	color: var(--tih-text-muted);
	margin-top: auto;
	padding-top: 8px;
}

/* Fallback: old .tih-related__img (without wrapper) */
a.tih-related__card > img.tih-related__img {
	width: 100%;
	height: 180px;
	object-fit: cover;
	display: block;
	transition: transform 0.45s ease;
}

a.tih-related__card > .tih-related__name {
	font-weight: 700;
	padding: 14px 16px 18px;
}

/* ── Mobile & responsive ──────────────────────────────────────────────────── */

@media (max-width: 1024px) {
	.tih-archive__grid {
		grid-template-columns: repeat(2, 1fr) !important;
	}

	.tih-archive__grid > li:first-child {
		grid-column: 1 / -1 !important;
		grid-template-columns: 1fr 1fr !important;
	}
}

@media (max-width: 768px) {
	.tih-archive__grid {
		grid-template-columns: 1fr !important;
	}

	.tih-archive__grid > li:first-child {
		grid-template-columns: 1fr !important;
		grid-template-rows: auto auto auto auto !important;
	}

	.tih-archive__grid > li:first-child .tih-archive__img {
		grid-column: 1 !important;
		grid-row: 1 !important;
		min-height: 220px;
		height: 220px;
	}

	.tih-archive__grid > li:first-child .tih-archive__cat {
		grid-column: 1 !important;
		grid-row: 2 !important;
		padding-top: 18px;
	}

	.tih-archive__grid > li:first-child .tih-archive__post-title {
		grid-column: 1 !important;
		grid-row: 3 !important;
		font-size: 1.25rem !important;
	}

	.tih-archive__grid > li:first-child .tih-archive__excerpt {
		grid-column: 1 !important;
		grid-row: 4 !important;
	}

	.tih-related__grid {
		grid-template-columns: 1fr;
	}
}

@media (min-width: 480px) and (max-width: 768px) {
	.tih-related__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}
