/*
 * Single post: TOC bar, content + sidebar, product category accordion, related slider.
 * Page bar, section title and post cards come from pages.css.
 */

.tipa-single {
	--tipa-sticky-top: 0px;
}

.tipa-single .tipa-page-bar-section {
	border-bottom: 1px solid var(--tipa-green-100);
}

/* TOC bar (list generated by Easy Table of Contents, H2 only) */
.tipa-toc-bar {
	position: sticky;
	top: var(--tipa-sticky-top);
	z-index: 20;
	border-bottom: 1px solid var(--tipa-green-100);
	background: var(--tipa-green-50);
}

.tipa-toc-bar ul {
	display: flex;
	gap: 36px;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	list-style: none;
	scrollbar-width: none;
}

.tipa-toc-bar ul::-webkit-scrollbar {
	display: none;
}

.tipa-toc-bar li {
	flex: 0 0 auto;
	margin: 0;
	list-style: none;
}

.tipa-toc-bar li ul {
	display: none;
}

.tipa-toc-bar a {
	position: relative;
	display: block;
	padding: 16px 0;
	color: var(--tipa-ink);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	white-space: nowrap;
	transition: color .2s ease;
}

.tipa-toc-bar a::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 2px;
	border-radius: 2px;
	background: var(--tipa-green);
	transform: scaleX(0);
	transition: transform .2s ease;
}

.tipa-toc-bar a:hover,
.tipa-toc-bar a.is-active {
	color: var(--tipa-green);
}

.tipa-toc-bar a.is-active::after {
	transform: scaleX(1);
}

/* Body: content left, sidebar right */
.tipa-single__body {
	display: grid;
	grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
	gap: 64px;
	padding-top: 56px;
	padding-bottom: 80px;
}

.tipa-single__body::before,
.tipa-single__body::after {
	display: none;
}

.tipa-single__date {
	display: block;
	margin-bottom: 16px;
	color: var(--tipa-gray);
	font-size: 14px;
	font-weight: 500;
}

.tipa-ui .tipa-single__title {
	margin: 0 0 32px;
	color: var(--tipa-ink);
	font-size: 44px;
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: -.03em;
}

.tipa-single__content {
	color: var(--tipa-text);
	font-size: 17px;
	line-height: 1.75;
}

.tipa-ui .tipa-single__content h2 {
	margin: 40px 0 16px;
	color: var(--tipa-ink);
	font-size: 24px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -.02em;
	scroll-margin-top: calc(var(--tipa-sticky-top) + 80px);
}

.tipa-ui .tipa-single__content h3 {
	margin: 32px 0 12px;
	color: var(--tipa-ink);
	font-size: 20px;
	font-weight: 600;
}

.tipa-single__content ul li {
	margin-bottom: 8px;
}

.tipa-single__content img {
	border-radius: 12px;
}

/* Sidebar */
.tipa-single__aside {
	align-self: start;
	position: sticky;
	top: calc(var(--tipa-sticky-top) + 72px);
}

.tipa-single__image img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	border-radius: 12px;
}

.tipa-single__image + .tipa-accordion {
	margin-top: 32px;
}

/* Product category accordion */
.tipa-ui .tipa-accordion__title {
	margin: 0 0 8px;
	color: var(--tipa-ink);
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.tipa-accordion__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tipa-accordion__list[hidden] {
	display: none;
}

.tipa-ui .tipa-accordion__item {
	margin: 0;
	list-style: none;
}

.tipa-accordion__list--1 > .tipa-accordion__item {
	border-bottom: 1px solid var(--tipa-green-100);
}

.tipa-accordion__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.tipa-accordion__row a {
	flex: 1;
	padding: 14px 0;
	color: var(--tipa-ink);
	font-size: 16px;
	font-weight: 500;
	line-height: 1.4;
	transition: color .2s ease;
}

.tipa-accordion__row a:hover {
	color: var(--tipa-green);
}

.tipa-accordion__list--2 .tipa-accordion__row a,
.tipa-accordion__list--3 .tipa-accordion__row a {
	padding: 8px 0;
	color: var(--tipa-text);
	font-size: 15px;
	font-weight: 400;
}

.tipa-accordion__list--2 {
	padding: 0 0 12px 16px;
	border-left: 2px solid var(--tipa-green-100);
	margin-bottom: 12px;
}

.tipa-accordion__list--3 {
	padding-left: 16px;
}

/* + / - toggle */
.tipa-accordion__toggle {
	position: relative;
	flex: 0 0 32px;
	width: 32px;
	height: 32px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--tipa-ink);
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease;
}

.tipa-accordion__toggle::before,
.tipa-accordion__toggle::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 14px;
	height: 1.5px;
	background: currentColor;
	transform: translate(-50%, -50%);
	transition: transform .2s ease;
}

.tipa-accordion__toggle::after {
	transform: translate(-50%, -50%) rotate(90deg);
}

.tipa-accordion__toggle[aria-expanded="true"]::after {
	transform: translate(-50%, -50%) rotate(0);
}

.tipa-accordion__toggle:hover,
.tipa-accordion__toggle[aria-expanded="true"] {
	background: var(--tipa-green-100);
	color: var(--tipa-green-700);
}

.tipa-accordion__toggle:focus-visible {
	outline: 2px solid var(--tipa-green);
	outline-offset: 2px;
}

/* Related content slider */
.tipa-related {
	padding: 80px 0;
	background: var(--tipa-green-50);
}

.tipa-related__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 32px;
}

.tipa-ui .tipa-related__head .tipa-section-title {
	margin: 0;
}

.tipa-related__nav {
	display: flex;
	gap: 8px;
}

.tipa-hslider.is-static .tipa-related__nav {
	display: none;
}

.tipa-related__arrow {
	width: 44px;
	height: 44px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 1px solid var(--tipa-green-100);
	border-radius: 50%;
	background: var(--tipa-white);
	color: var(--tipa-ink);
	font-size: 22px;
	line-height: 42px;
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.tipa-related__arrow:hover:not(:disabled) {
	border-color: var(--tipa-green);
	background: var(--tipa-green);
	color: var(--tipa-white);
}

.tipa-related__arrow:disabled {
	opacity: .4;
	cursor: default;
}

.tipa-related__track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - 60px) / 2.5);
	column-gap: 30px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	cursor: grab;
	padding-bottom: 4px;
}

.tipa-related__track::-webkit-scrollbar {
	display: none;
}

.tipa-related__track.is-dragging {
	cursor: grabbing;
	scroll-snap-type: none;
	scroll-behavior: auto;
	user-select: none;
}

.tipa-related__slide {
	display: flex;
	scroll-snap-align: start;
}

.tipa-related__slide .tipa-post-card {
	width: 100%;
}

/* The shared CTA block after related posts */
.tipa-single .tipa-cta-section {
	margin-top: 0;
}

/* Tablet */
@media (max-width: 849px) {
	.tipa-single__body {
		grid-template-columns: 1fr;
		gap: 40px;
		padding-top: 40px;
		padding-bottom: 56px;
	}

	.tipa-single__aside {
		position: static;
		display: contents;
	}

	/* Image above the content, categories below it */
	.tipa-single__image { order: -1; }
	.tipa-single__image + .tipa-accordion { margin-top: 0; }

	.tipa-ui .tipa-single__title { font-size: 34px; }
	.tipa-related { padding: 56px 0; }
	.tipa-related__track { grid-auto-columns: calc((100% - 30px) / 1.6); }
}

/* Mobile */
@media (max-width: 549px) {
	.tipa-ui .tipa-single__title { font-size: 28px; margin-bottom: 24px; }
	.tipa-single__content { font-size: 16px; }
	.tipa-ui .tipa-single__content h2 { font-size: 21px; }
	.tipa-toc-bar ul { gap: 28px; }
	.tipa-related__track { grid-auto-columns: 85%; column-gap: 16px; }
	.tipa-related__nav { display: none; }
}

/* Tables inside articles: same look as product spec tables, scroll sideways on small screens */
.tipa-single__main {
	min-width: 0; /* grid item: let wide tables scroll instead of widening the column */
}

.tipa-single__content .tipa-table-scroll {
	max-width: 100%;
	margin: 0 0 24px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.tipa-single__content table {
	width: 100%;
	min-width: 560px;
	margin: 0;
	border: 1px solid var(--tipa-green-100);
	border-collapse: separate;
	border-spacing: 0;
	border-radius: 12px;
	overflow: hidden;
}

.tipa-single__content th,
.tipa-single__content td,
.tipa-single__content th:first-child,
.tipa-single__content td:first-child {
	padding: 12px 16px;
	border: 0;
	border-top: 1px solid var(--tipa-green-100);
	text-align: left;
	vertical-align: top;
}

.tipa-single__content th {
	border-top: 0;
	background: var(--tipa-green);
	color: var(--tipa-white);
	font-weight: 600;
}

.tipa-single__content tbody tr:nth-child(even) td {
	background: var(--tipa-green-50);
}
