/* GitBook Sync — front-end docs styling (GitBook-inspired three-column layout). */

/* Theme colors. Overridden per-site via an inline :root block from settings. */
:root {
	--gbsync-primary: #008A75;
	--gbsync-nav-bg: #E6F7F4;
}

.gbsync-layout {
	display: grid;
	grid-template-columns: 260px minmax(0, 1fr) 220px;
	gap: 32px;
	align-items: start;
	max-width: 1320px;
	margin: 0 auto;
	padding: 24px 20px 64px;
}

.gbsync-layout__sidebar,
.gbsync-layout__aside {
	position: sticky;
	top: 24px;
	align-self: start;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
}

.gbsync-layout__main {
	min-width: 0;
}

/* Sidebar navigation */
/* Fill the container so item highlights are full width regardless of content
   length / expand state (prevents the list shrinking to fit its labels). Only
   the nav and its top-level list — nested lists keep auto width + indent. */
.gbsync-nav {
	display: block;
	width: 100%;
	box-sizing: border-box;
}

.gbsync-nav > .gbsync-nav__list {
	width: 100%;
	box-sizing: border-box;
}

.gbsync-nav__list {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 14px;
}

/* Breathing room between items. */
.gbsync-nav__item + .gbsync-nav__item {
	margin-top: 3px;
}

.gbsync-nav__list .gbsync-nav__list {
	margin-left: 14px;
	border-left: 1px solid #e6e8eb;
	padding-left: 8px;
}

/* Collapsible: hide child lists of closed sections (only when collapsible). */
.gbsync-nav--collapsible .gbsync-nav__item.has-children:not(.is-open) > .gbsync-nav__list {
	display: none;
}

/* The whole row is the item: full-width, uniform highlight for hover/current.
   Note: ul/li fill their container by default — do NOT set an explicit width on
   the nested lists, which also carry an indent margin (that overflows). */
.gbsync-nav__row {
	display: flex;
	align-items: center;
	gap: 2px;
	width: 100%;
	box-sizing: border-box;
	border-radius: 5px;
}

.gbsync-nav__row:hover {
	background: #f1f3f5;
}

.gbsync-nav__item.is-current > .gbsync-nav__row {
	background: var(--gbsync-nav-bg);
}

.gbsync-nav__link {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1 1 auto;
	min-width: 0;
	padding: 8px 10px;
	color: #3b4251;
	text-decoration: none;
	line-height: 1.4;
}

.gbsync-nav__text {
	overflow: hidden;
	text-overflow: ellipsis;
}

.gbsync-nav__item.is-current > .gbsync-nav__row > .gbsync-nav__link,
.gbsync-nav__link[aria-current="page"] {
	color: var(--gbsync-primary);
	font-weight: 600;
}

.gbsync-nav__item.is-current > .gbsync-nav__row .gbsync-icon {
	color: var(--gbsync-primary);
}

/* Expand/collapse caret */
.gbsync-nav__toggle {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	color: #8a909c;
}

.gbsync-nav__toggle:hover {
	background: #f1f3f5;
}

/* Plus (collapsed) / minus (expanded) toggle, drawn with two bars. */
.gbsync-nav__caret {
	position: relative;
	display: inline-block;
	width: 12px;
	height: 12px;
}

.gbsync-nav__caret::before,
.gbsync-nav__caret::after {
	content: "";
	position: absolute;
	background: currentColor;
	border-radius: 1px;
}

/* Horizontal bar — always visible. */
.gbsync-nav__caret::before {
	top: 50%;
	left: 1px;
	right: 1px;
	height: 2px;
	transform: translateY(-50%);
}

/* Vertical bar — hidden when open, so a "+" becomes a "−". */
.gbsync-nav__caret::after {
	left: 50%;
	top: 1px;
	bottom: 1px;
	width: 2px;
	transform: translateX(-50%);
	transition: opacity .15s ease;
}

.gbsync-nav__item.is-open > .gbsync-nav__row > .gbsync-nav__toggle .gbsync-nav__caret::after {
	opacity: 0;
}

/* Page icons (emoji or Font Awesome) */
.gbsync-icon {
	flex: 0 0 auto;
	width: 1.1em;
	text-align: center;
	color: #8a909c;
	font-style: normal;
}

.gbsync-icon--emoji {
	color: inherit;
}

.gbsync-icon--svg svg {
	width: 1em;
	height: 1em;
	vertical-align: -0.125em;
	fill: currentColor;
}

/* Breadcrumbs */
.gbsync-breadcrumbs {
	font-size: 13px;
	color: #6b7280;
	margin-bottom: 12px;
}

.gbsync-breadcrumbs a {
	color: #6b7280;
	text-decoration: none;
}

.gbsync-breadcrumbs a:hover {
	color: var(--gbsync-primary);
}

.gbsync-breadcrumbs__sep {
	color: #c4c9d0;
}

/* Content */
.gbsync-content {
	font-size: 16px;
	line-height: 1.7;
	color: #1f2430;
}

/* Content links use the theme color; underline on hover. */
.gbsync-content a {
	color: var(--gbsync-primary);
	text-decoration: none;
}

.gbsync-content a:hover {
	text-decoration: underline;
}

/* Page title with icon */
.gbsync-page-title {
	display: flex;
	align-items: center;
	gap: 12px;
	line-height: 1.2;
}

.gbsync-page-title__icon {
	flex: 0 0 auto;
	font-size: 1.4em;
	line-height: 1;
	color: #6b7280;
}

.gbsync-page-title__icon svg {
	width: 1em;
	height: 1em;
	vertical-align: -0.125em;
	fill: currentColor;
}

/* Heading anchor links */
.gbsync-heading {
	position: relative;
}

.gbsync-anchor {
	margin-left: 8px;
	color: #c4c9d0;
	text-decoration: none;
	font-weight: 400;
	opacity: 0;
	transition: opacity .12s ease;
}

.gbsync-heading:hover .gbsync-anchor,
.gbsync-anchor:focus {
	opacity: 1;
}

.gbsync-anchor:hover {
	color: var(--gbsync-primary);
}

/* Page description / subtitle (from GitBook front matter) */
.gbsync-description {
	font-size: 18px;
	line-height: 1.5;
	color: #6b7280;
	margin: 0 0 24px;
}

.gbsync-content h1,
.gbsync-content h2,
.gbsync-content h3 {
	scroll-margin-top: 24px;
	line-height: 1.3;
}

.gbsync-content pre {
	background: #1b1f27;
	color: #f3f4f6;
	padding: 16px;
	border-radius: 8px;
	overflow-x: auto;
	font-size: 14px;
}

.gbsync-content :not(pre) > code {
	background: #f1f3f5;
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 0.9em;
}

/* Tables scroll horizontally within their wrapper instead of overflowing. */
.gbsync-table-wrap {
	max-width: 100%;
	overflow-x: auto;
	margin: 16px 0;
}

.gbsync-content table {
	border-collapse: collapse;
	width: 100%;
	margin: 16px 0;
}

.gbsync-table-wrap > table {
	margin: 0;
}

.gbsync-content th,
.gbsync-content td {
	border: 1px solid #e6e8eb;
	padding: 8px 12px;
	text-align: left;
}

.gbsync-content img {
	max-width: 100%;
	height: auto;
}

/* Hint / callout blocks — icon + label header, then the body. */
.gbsync-hint {
	border-radius: 8px;
	padding: 14px 16px;
	margin: 16px 0;
	background: #eef4ff;
}

.gbsync-hint > :first-child { margin-top: 0; }
.gbsync-hint > :last-child { margin-bottom: 0; }

/* Label row (icon glyph + uppercase title), colored per type. */
.gbsync-hint::before {
	display: block;
	margin-bottom: 6px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #1a56db;
	content: "\24D8\2002 Note";
}

.gbsync-hint--success {
	background: #eafaf0;
}

.gbsync-hint--success::before {
	color: #0f9d58;
	content: "\2714\2002 Success";
}

.gbsync-hint--warning {
	background: #fff8e6;
}

.gbsync-hint--warning::before {
	color: #b7791f;
	content: "\26A0\FE0E\2002 Warning";
}

.gbsync-hint--danger {
	background: #fdecea;
}

.gbsync-hint--danger::before {
	color: #d93025;
	content: "\26A0\FE0E\2002 Caution";
}

/* Callout links match the callout's accent color. */
.gbsync-hint a { color: #1a56db; }
.gbsync-hint--success a { color: #0f9d58; }
.gbsync-hint--warning a { color: #b7791f; }
.gbsync-hint--danger a { color: #d93025; }

/* Child-page card grid (placeholder pages) */
.gbsync-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 16px;
	margin: 24px 0;
}

.gbsync-card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px 18px;
	border: 1px solid #e6e8eb;
	border-radius: 10px;
	text-decoration: none;
	background: #fff;
	transition: border-color .15s, box-shadow .15s, transform .15s;
}

.gbsync-card:hover {
	border-color: var(--gbsync-primary);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
	transform: translateY(-1px);
}

.gbsync-card__icon {
	font-size: 20px;
	line-height: 1;
	color: var(--gbsync-primary);
}

.gbsync-card__title {
	font-weight: 600;
	color: var(--gbsync-primary);
}

.gbsync-card__desc {
	font-size: 13px;
	line-height: 1.5;
	color: #6b7280;
}

/* Stepper */
.gbsync-stepper {
	list-style: none;
	counter-reset: gbsync-step;
	margin: 24px 0;
	padding: 0;
}

.gbsync-stepper > .gbsync-step {
	position: relative;
	counter-increment: gbsync-step;
	padding: 0 0 20px 44px;
	border-left: 2px solid #e6e8eb;
	margin-left: 14px;
}

.gbsync-stepper > .gbsync-step:last-child {
	border-left-color: transparent;
	padding-bottom: 0;
}

.gbsync-stepper > .gbsync-step::before {
	content: counter(gbsync-step);
	position: absolute;
	left: -15px;
	top: -2px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--gbsync-primary);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gbsync-stepper > .gbsync-step > :first-child { margin-top: 0; }

/* Titled code block */
.gbsync-code {
	margin: 16px 0;
	border: 1px solid #e6e8eb;
	border-radius: 8px;
	overflow: hidden;
}

.gbsync-code__title {
	padding: 8px 14px;
	background: #f1f3f5;
	border-bottom: 1px solid #e6e8eb;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
	color: #3b4251;
}

.gbsync-code pre {
	margin: 0;
	border-radius: 0;
}

/* Embeds */
.gbsync-embed {
	margin: 16px 0;
}

.gbsync-embed iframe {
	max-width: 100%;
	width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
	border: 0;
	border-radius: 8px;
}

/* Table of contents */
.gbsync-toc {
	font-size: 13px;
}

.gbsync-toc__title {
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-size: 11px;
	color: #8a909c;
	margin: 0 0 8px;
}

.gbsync-toc__list {
	list-style: none;
	margin: 0;
	padding: 0;
	border-left: 2px solid #e6e8eb;
}

.gbsync-toc__item a {
	display: block;
	padding: 3px 12px;
	color: #6b7280;
	text-decoration: none;
	border-left: 2px solid transparent;
	margin-left: -2px;
}

.gbsync-toc__item--h3 a {
	padding-left: 24px;
}

.gbsync-toc__item a:hover,
.gbsync-toc__item.is-active a {
	color: var(--gbsync-primary);
	border-left-color: var(--gbsync-primary);
}

/* Prev / next */
.gbsync-prevnext {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	margin-top: 48px;
	padding-top: 24px;
	border-top: 1px solid #e6e8eb;
}

.gbsync-prevnext__link {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 12px 16px;
	border: 1px solid #e6e8eb;
	border-radius: 8px;
	text-decoration: none;
}

.gbsync-prevnext__next {
	text-align: right;
	align-items: flex-end;
}

.gbsync-prevnext__label {
	font-size: 12px;
	color: #8a909c;
}

.gbsync-prevnext__title {
	color: var(--gbsync-primary);
	font-weight: 600;
}

/* Mobile */
.gbsync-nav-toggle {
	display: none;
}

@media (max-width: 1024px) {
	.gbsync-layout {
		grid-template-columns: 240px minmax(0, 1fr);
	}

	.gbsync-layout__aside {
		display: none;
	}
}

@media (max-width: 768px) {
	.gbsync-layout {
		grid-template-columns: 1fr;
	}

	.gbsync-layout__sidebar {
		position: static;
		max-height: none;
	}

	.gbsync-nav-toggle {
		display: inline-block;
		margin-bottom: 12px;
		padding: 8px 14px;
		border: 1px solid #e6e8eb;
		border-radius: 6px;
		background: #fff;
		cursor: pointer;
	}

	.gbsync-layout__sidebar.is-collapsed .gbsync-nav {
		display: none;
	}

	/* Larger tap area on mobile (the symbol itself stays the same size). */
	.gbsync-nav__link {
		padding: 11px 12px;
	}

	.gbsync-nav__toggle {
		width: 40px;
		height: 40px;
	}
}
