/* ==========================================================================
   Components — header, footer, cards, breadcrumb, TOC, author box, buttons
   ========================================================================== */

/* ---- Buttons ---- */
.btn {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	padding: .7rem 1.5rem;
	border-radius: var(--radius-full);
	font-weight: 700;
	font-size: .95rem;
	border: 1px solid transparent;
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
	background: linear-gradient(135deg, var(--color-navy-deep), var(--color-navy));
	color: #fff;
	box-shadow: var(--shadow-card);
}
.btn-primary:hover { color: #fff; box-shadow: 0 16px 32px -12px rgba(58, 211, 177, .45); }
.btn-outline {
	background: transparent;
	border-color: var(--color-border);
	color: var(--color-fg);
}
.btn-outline:hover { border-color: var(--color-teal); color: var(--color-fg); }
.btn-sm { padding: .45rem 1rem; font-size: .85rem; }

/* ---- Header ---- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	backdrop-filter: blur(10px);
	background: color-mix(in srgb, var(--color-bg) 82%, transparent);
	border-bottom: 1px solid var(--color-border);
}
.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	padding-block: .85rem;
}
.site-branding { display: flex; align-items: center; gap: .6rem; }
.site-branding img { height: 38px; width: auto; }
.site-branding__name {
	font-weight: 800;
	font-size: 1.1rem;
	color: var(--color-fg);
}
.site-branding__name span { color: var(--color-teal); }

.primary-nav ul {
	display: flex;
	align-items: center;
	gap: 1.75rem;
	list-style: none;
	margin: 0;
	padding: 0;
}
.primary-nav a {
	color: var(--color-fg);
	font-weight: 600;
	font-size: .95rem;
}
.primary-nav a:hover { color: var(--color-teal); }

.header-actions { display: flex; align-items: center; gap: .75rem; }

.icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: var(--radius-full);
	border: 1px solid var(--color-border);
	background: var(--color-card-bg);
	color: var(--color-fg);
	cursor: pointer;
}
.icon-btn:hover { border-color: var(--color-teal); }
.icon-btn svg { width: 20px; height: 20px; }

.hamburger { display: none; }
.mobile-nav {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 200;
	background: var(--color-bg);
	padding: 1.25rem;
	overflow-y: auto;
}
.mobile-nav.is-open { display: block; }
.mobile-nav__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.mobile-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.mobile-nav a {
	display: block;
	padding: .9rem .25rem;
	font-size: 1.15rem;
	font-weight: 700;
	border-bottom: 1px solid var(--color-border);
	color: var(--color-fg);
}

@media (max-width: 860px) {
	.primary-nav { display: none; }
	.hamburger { display: inline-flex; }
}

/* Reading progress bar */
.reading-progress {
	position: fixed;
	top: 0; right: 0; left: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--color-teal), var(--color-coral));
	transform-origin: right;
	transform: scaleX(0);
	z-index: 150;
}

/* ---- Footer ---- */
.site-footer {
	background: linear-gradient(135deg, var(--color-navy-deep), var(--color-navy));
	color: #d8dcf5;
	margin-top: 4rem;
}
.site-footer a { color: #d8dcf5; }
.site-footer a:hover { color: var(--color-teal); }
.footer-grid {
	display: grid;
	grid-template-columns: 1.4fr 1fr 1fr 1.1fr;
	gap: 2.5rem;
	padding-block: 3.5rem;
}
@media (max-width: 860px) {
	.footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
	.footer-grid { grid-template-columns: 1fr; }
}
.footer-grid h3 { color: #fff; font-size: 1rem; margin-bottom: 1rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; font-size: .9rem; }
.footer-bottom {
	border-top: 1px solid rgba(255,255,255,.12);
	padding-block: 1.25rem;
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: .75rem;
	font-size: .85rem;
	color: #aab0da;
}
.footer-cta {
	background: rgba(255,255,255,.06);
	border: 1px solid rgba(255,255,255,.14);
	border-radius: var(--radius-lg);
	padding: 1.5rem;
}

/* ---- Post meta (single post header) ---- */
.post-meta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .6rem;
	flex-wrap: wrap;
	color: var(--color-muted);
	font-size: .9rem;
}
.post-meta__item {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
}
.post-meta__item svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}
.post-meta__sep { opacity: .5; }

/* ---- Breadcrumb ---- */
.breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .4rem;
	font-size: .85rem;
	color: var(--color-muted);
	margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--color-muted); }
.breadcrumb a:hover { color: var(--color-teal); }
.breadcrumb__sep { opacity: .6; }
.breadcrumb [aria-current="page"] { color: var(--color-fg); font-weight: 600; }

/* ---- Chips / category nav ---- */
.chip-nav { display: flex; flex-wrap: wrap; gap: .6rem; }
.chip {
	display: inline-flex;
	align-items: center;
	padding: .45rem 1.1rem;
	border-radius: var(--radius-full);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	color: var(--color-fg);
	font-size: .85rem;
	font-weight: 600;
}
.chip:hover, .chip.is-active { background: var(--color-navy); color: #fff; border-color: var(--color-navy); }

/* ---- Post card ---- */
.post-card {
	display: flex;
	flex-direction: column;
	background: var(--color-card-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	overflow: hidden;
	box-shadow: var(--shadow-soft);
	transition: transform .2s ease, box-shadow .2s ease;
	height: 100%;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.post-card__media { aspect-ratio: 16/10; overflow: hidden; background: var(--color-surface-2); }
.post-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.post-card:hover .post-card__media img { transform: scale(1.05); }
.post-card__body { padding: 1.4rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.post-card__cat { font-size: .75rem; font-weight: 700; color: var(--color-teal); text-transform: uppercase; letter-spacing: .02em; }
.post-card__title { font-size: 1.1rem; line-height: 1.5; margin: 0; }
.post-card__title a { color: var(--color-fg); }
.post-card__title a:hover { color: var(--color-teal); }
.post-card__excerpt { color: var(--color-muted); font-size: .92rem; line-height: 1.7; margin: 0; flex: 1; }
.post-card__meta { display: flex; align-items: center; gap: .75rem; font-size: .8rem; color: var(--color-muted); margin-top: .3rem; }

.post-card--featured { flex-direction: row; }
.post-card--featured .post-card__media { flex: 1 1 50%; aspect-ratio: auto; }
.post-card--featured .post-card__body { flex: 1 1 50%; justify-content: center; padding: 2rem; }
.post-card--featured .post-card__title { font-size: 1.6rem; }
@media (max-width: 720px) {
	.post-card--featured { flex-direction: column; }
}

/* ---- Author box ---- */
.author-box {
	display: flex;
	gap: 1.1rem;
	align-items: flex-start;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	padding: 1.5rem;
}
.author-box img { width: 64px; height: 64px; border-radius: var(--radius-full); flex-shrink: 0; object-fit: cover; }
.author-box__avatar-fallback {
	width: 64px;
	height: 64px;
	border-radius: var(--radius-full);
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, var(--color-navy-deep), var(--color-navy));
	color: #fff;
	font-weight: 800;
	font-size: 1.3rem;
}
.author-box h3 { margin: 0 0 .3rem; font-size: 1rem; }
.author-box p { margin: 0; color: var(--color-muted); font-size: .9rem; }

/* ---- Share buttons ---- */
.share-buttons { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.share-buttons__label { font-size: .85rem; color: var(--color-muted); font-weight: 600; }

/* ---- Table of contents ---- */
.toc {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: 1.25rem;
}
.toc__title { font-size: .85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .75rem; color: var(--color-muted); }
.toc nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .1rem; }
.toc nav ul ul { padding-inline-start: 1rem; }
.toc nav a {
	display: block;
	padding: .35rem 0;
	font-size: .87rem;
	color: var(--color-muted);
	border-inline-start: 2px solid transparent;
	padding-inline-start: .7rem;
}
.toc nav a:hover, .toc nav a.is-active { color: var(--color-teal); border-inline-start-color: var(--color-teal); }
.toc-rail {
	position: sticky;
	top: 5.5rem;
	max-height: calc(100vh - 7rem);
	overflow-y: auto;
}

/* Mobile TOC as collapsible */
.toc-mobile { display: none; margin-bottom: 2rem; }
.toc-mobile summary { cursor: pointer; font-weight: 700; padding: .9rem 1.1rem; }
@media (max-width: 960px) {
	.toc-mobile { display: block; }
}

/* ---- Newsletter / demo CTA ---- */
.cta-banner {
	background: radial-gradient(circle at 20% 20%, rgba(58,211,177,.35), transparent 55%),
	            linear-gradient(135deg, var(--color-navy-deep), var(--color-navy));
	color: #fff;
	border-radius: var(--radius-lg);
	padding: 2.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	flex-wrap: wrap;
}
.cta-banner h3 { color: #fff; margin-bottom: .4rem; }
.cta-banner p { color: #c7cbef; margin: 0; }

/* ---- Pagination ---- */
.pagination { display: flex; justify-content: center; gap: .5rem; margin-top: 3rem; }
.pagination a, .pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding-inline: .5rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--color-border);
	color: var(--color-fg);
	font-size: .9rem;
}
.pagination .current { background: var(--color-navy); border-color: var(--color-navy); color: #fff; font-weight: 700; }
.pagination a:hover { border-color: var(--color-teal); color: var(--color-teal); }

/* ---- Search form ---- */
.search-form { position: relative; }
.search-form input[type="search"] {
	width: 100%;
	padding: .9rem 3rem .9rem 1.25rem;
	border-radius: var(--radius-full);
	border: 1px solid var(--color-border);
	background: var(--color-card-bg);
	color: var(--color-fg);
	font-size: 1rem;
}
.search-form button {
	position: absolute;
	inset-inline-start: .35rem;
	top: 50%;
	transform: translateY(-50%);
	width: 38px; height: 38px;
	border-radius: var(--radius-full);
	border: none;
	background: var(--color-navy);
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
}

/* ---- Scroll to top ---- */
.scroll-top {
	position: fixed;
	bottom: 1.5rem;
	left: 1.5rem;
	width: 46px; height: 46px;
	border-radius: var(--radius-full);
	background: var(--color-navy);
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	box-shadow: var(--shadow-card);
	opacity: 0;
	pointer-events: none;
	transform: translateY(10px);
	transition: opacity .2s ease, transform .2s ease;
	z-index: 90;
	border: none;
	cursor: pointer;
}
.scroll-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* ---- Comments ---- */
.comments-area { margin-top: 3.5rem; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-body {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: 1.25rem;
	margin-bottom: 1rem;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%;
	padding: .8rem 1rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--color-border);
	background: var(--color-card-bg);
	color: var(--color-fg);
	margin-bottom: 1rem;
	font-size: .95rem;
}

/* ---- 404 ---- */
.error-404 { text-align: center; padding-block: 5rem; }
.error-404__code {
	font-size: 6rem;
	font-weight: 900;
	background: linear-gradient(135deg, var(--color-navy), var(--color-teal));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	line-height: 1;
}
