/**
 * Neil Patel-style two-column single-post layout
 *
 * Grid: article body left + sticky sidebar right (TOC, Knowledge Areas,
 * Recommended Product, Forminator). Self-contained color tokens so the
 * file doesn't depend on page-blog.css being enqueued.
 *
 * NOTE: Class names use `avy-post-*` for the grid containers (NOT
 * `avy-blog-*`) because avy-design-system.css:7234 already defines
 * `.avy-blog-layout` and `.avy-blog-sidebar` for the blog archive page
 * with a different column structure (1fr 260px). Reusing those names
 * would silently clobber the archive grid.
 *
 * Loaded only on is_singular('post') via functions.php.
 */

.avy-post-layout {
	--bb-cat-material: #0891b2;
	--bb-cat-artwork:  #7c3aed;
	--bb-cat-industry: #c2410c;
	--bb-cat-sourcing: #059669;
	--bb-navy:         #0033a0;
	--bb-navy-700:     #002680;
	--bb-ink:          #0f172a;
	--bb-slate:        #475569;
	--bb-line:         #e2e8f0;
	--bb-line-soft:    #eef2f7;
	--bb-paper-2:      #f8fafc;

	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	gap: 48px;
	align-items: start;
	margin-top: 24px;
	margin-bottom: 40px;
}

/* Override the default 800px centered column — the grid column now controls width */
.avy-post-layout .avy-single-post {
	max-width: none;
	margin: 0;
}

/* ─── Sidebar shell ─── */
.avy-post-sidebar {
	position: sticky;
	top: 90px;
	max-height: calc(100vh - 110px);
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 24px;
	padding: 2px 2px 2px 0;
	/* Thin scrollbar so it doesn't compete with content */
	scrollbar-width: thin;
	scrollbar-color: var(--bb-line) transparent;
}
.avy-post-sidebar::-webkit-scrollbar { width: 6px; }
.avy-post-sidebar::-webkit-scrollbar-thumb { background: var(--bb-line); border-radius: 3px; }

.avy-post-sidebar__section {
	border: 1px solid var(--bb-line);
	border-radius: 12px;
	padding: 18px 18px 20px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.avy-post-sidebar__title {
	margin: 0 0 12px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--bb-line);
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--bb-navy);
}

/* ─── 1. Table of Contents ─── */
.avy-toc[hidden] { display: none; }

.avy-toc__list {
	margin: 0;
	list-style: none;
	counter-reset: avy-toc;
}

.avy-toc__item {
	counter-increment: avy-toc;
}

.avy-toc__link {
	display: block;
	padding: 6px 8px 6px 30px;
	font-size: 13.5px;
	line-height: 1.45;
	color: var(--bb-slate);
	text-decoration: none;
	border-radius: 6px;
	position: relative;
	transition: background 0.15s ease, color 0.15s ease;
}

.avy-toc__link::before {
	content: counter(avy-toc, decimal-leading-zero);
	position: absolute;
	left: 8px;
	top: 6px;
	font-size: 11px;
	font-weight: 700;
	color: var(--bb-navy);
	opacity: 0.55;
	font-variant-numeric: tabular-nums;
}

.avy-toc__link:hover {
	background: var(--bb-paper-2);
	color: var(--bb-navy);
}

.avy-toc__link.is-active {
	background: color-mix(in srgb, var(--bb-navy) 8%, #fff);
	color: var(--bb-navy);
	font-weight: 600;
}
.avy-toc__link.is-active::before {
	opacity: 1;
}

/* ─── 2. Knowledge Areas ─── */
.avy-blog-knowledge ul {
	margin: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.avy-blog-knowledge__item a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 8px;
	border-left: 3px solid var(--bb-cat);
	background: var(--bb-paper-2);
	color: var(--bb-ink);
	font-size: 13.5px;
	font-weight: 600;
	text-decoration: none;
	transition: background 0.15s ease, transform 0.15s ease;
}

.avy-blog-knowledge__item a:hover {
	background: color-mix(in srgb, var(--bb-cat) 10%, #fff);
	transform: translateX(2px);
}

.avy-blog-knowledge__item--material  { --bb-cat: var(--bb-cat-material); }
.avy-blog-knowledge__item--artwork   { --bb-cat: var(--bb-cat-artwork);  }
.avy-blog-knowledge__item--industry  { --bb-cat: var(--bb-cat-industry); }
.avy-blog-knowledge__item--sourcing  { --bb-cat: var(--bb-cat-sourcing); }

.avy-blog-knowledge__item [data-lucide],
.avy-blog-knowledge__item svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	color: var(--bb-cat);
	stroke-width: 1.8;
}

/* ─── 3. Recommended Product ─── */
.avy-blog-product__list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.avy-blog-product__card {
	display: grid;
	grid-template-columns: 80px 1fr;
	gap: 12px;
	text-decoration: none;
	color: inherit;
	align-items: start;
}

.avy-blog-product__image {
	display: block;
	width: 80px;
	height: 80px;
	border-radius: 8px;
	overflow: hidden;
	background: var(--bb-paper-2);
	border: 1px solid var(--bb-line);
}

.avy-blog-product__image .avy-blog-product__img,
.avy-blog-product__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.avy-blog-product__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.avy-blog-product__name {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.35;
	color: var(--bb-ink);
}

.avy-blog-product__price {
	font-size: 13px;
	color: var(--bb-slate);
	font-weight: 600;
}

.avy-blog-product__price del {
	color: var(--bb-line);
	font-weight: 400;
	margin-right: 4px;
}

.avy-blog-product__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-top: 2px;
	padding: 6px 12px;
	background: var(--bb-navy);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-radius: 6px;
	align-self: flex-start;
	transition: background 0.15s ease;
}

.avy-blog-product__card:hover .avy-blog-product__btn {
	background: var(--bb-navy-700);
}

/* ─── 4. Forminator ─── */
.avy-blog-forminator {
	background: linear-gradient(180deg, color-mix(in srgb, var(--bb-navy) 5%, #fff) 0%, #fff 100%);
	border-color: color-mix(in srgb, var(--bb-navy) 18%, var(--bb-line));
}

.avy-blog-forminator .forminator-custom-form {
	min-width: 0;
}

/* Tighten Forminator field spacing inside the narrow sidebar */
.avy-blog-forminator .forminator-row {
	padding: 0 !important;
	margin-bottom: 10px !important;
}

.avy-blog-forminator .forminator-col {
	min-width: 0;
}

.avy-blog-forminator .forminator-field input,
.avy-blog-forminator .forminator-field textarea,
.avy-blog-forminator .forminator-field select {
	width: 100%;
	font-size: 13px;
	padding: 8px 10px !important;
}

.avy-blog-forminator .forminator-button-submit {
	width: 100%;
	background: var(--bb-navy) !important;
	border-color: var(--bb-navy) !important;
	color: #fff !important;
	font-weight: 700 !important;
	padding: 10px !important;
	border-radius: 6px !important;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-size: 13px !important;
	transition: background 0.15s ease;
}

.avy-blog-forminator .forminator-button-submit:hover {
	background: var(--bb-navy-700) !important;
	border-color: var(--bb-navy-700) !important;
}

/* ─── Responsive: collapse grid below 992px ─── */
@media (max-width: 992px) {
	.avy-post-layout {
		grid-template-columns: 1fr;
		gap: 32px;
	}
	.avy-post-sidebar {
		position: static;
		max-height: none;
		overflow-y: visible;
	}
}

@media (max-width: 576px) {
	.avy-post-layout {
		gap: 24px;
	}
	.avy-post-sidebar__section {
		padding: 14px;
	}
	.avy-blog-product__card {
		grid-template-columns: 64px 1fr;
	}
	.avy-blog-product__image {
		width: 64px;
		height: 64px;
	}
	.avy-blog-product__list {
		gap: 10px;
	}
}
