/*
 * InHand Markdown pages — immersive reading, unified with the eSchool design
 * language (tokens from base.css).
 *
 * The document itself is laid out directly on the page background: no card,
 * no frame — the text is the surface. Glass is reserved for tools and chrome:
 * the section indicator, the sticky header and the footer.
 */

/* ---- page frame ----------------------------------------------------------- */
body {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.legal-header {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	padding: 12px 24px;
	background: rgba(245, 245, 247, 0.72);
	-webkit-backdrop-filter: blur(20px) saturate(180%);
	backdrop-filter: blur(20px) saturate(180%);
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.legal-brand {
	display: flex;
	align-items: baseline;
	gap: 8px;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--fg);
	text-decoration: none;
}
.legal-brand-sub {
	font-size: 13px;
	font-weight: 500;
	color: var(--fg-3);
	letter-spacing: -0.01em;
}

.legal-nav {
	display: flex;
	align-items: center;
	gap: 4px;
}
.legal-nav a {
	font-size: 13px;
	font-weight: 500;
	color: var(--fg-2);
	text-decoration: none;
	padding: 6px 12px;
	border-radius: 999px;
	corner-shape: squircle;
	transition:
		background 0.15s ease,
		color 0.15s ease;
}
.legal-nav a:hover {
	background: rgba(0, 0, 0, 0.06);
	color: var(--fg);
}
.legal-nav a[aria-current="page"] {
	background: var(--fg);
	color: #fff;
}

.legal-main {
	flex: 1;
	width: 100%;
	max-width: 1180px;
	margin: 0 auto;
	padding: 40px 20px 64px;
}

/* ---- immersive document layout -------------------------------------------- */
/* Content column + sticky indicator column. The article has NO surface of its
   own — it sits directly on the page background. */
.md-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	gap: 28px;
	align-items: start;
}
.md-doc {
	min-width: 0;
	max-width: 780px;
	padding-top: 8px;
}
.md-body [id] {
	scroll-margin-top: 96px;
}

.md-back {
	font-size: 13px;
	font-weight: 500;
	color: var(--fg-3);
	margin: 0 0 18px;
}
.md-back a {
	color: var(--fg-2);
	text-decoration: none;
	transition: color 0.15s ease;
}
.md-back a:hover {
	color: var(--fg);
}

.md-updated {
	margin: 40px 0 0;
	padding-top: 14px;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	font-size: 12px;
	color: var(--fg-3);
}

/* ---- immersive typography -------------------------------------------------- */
.md-body h1,
.md-body h2,
.md-body h3,
.md-body h4 {
	letter-spacing: -0.015em;
	line-height: 1.3;
	color: var(--fg);
}
.md-body h1 {
	font-size: 32px;
	font-weight: 800;
	letter-spacing: -0.025em;
	margin: 0 0 18px;
}
.md-body h2 {
	font-size: 21px;
	font-weight: 700;
	margin: 34px 0 12px;
	padding-bottom: 8px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.07);
	scroll-margin-top: 90px;
}
.md-body h3 {
	font-size: 16px;
	font-weight: 700;
	margin: 24px 0 8px;
	scroll-margin-top: 90px;
}
.md-body h4 {
	font-size: 14px;
	font-weight: 700;
	margin: 18px 0 6px;
}

.md-body p {
	margin: 12px 0;
	font-size: 15px;
	line-height: 1.8;
}
.md-body a {
	color: #c33a2e;
	text-decoration: none;
	transition: text-decoration-color 0.15s ease;
}
.md-body a:hover {
	text-decoration: underline;
	text-decoration-color: rgba(195, 58, 46, 0.4);
}

.md-body strong {
	font-weight: 600;
}
.md-body ul,
.md-body ol {
	margin: 12px 0;
	padding-left: 26px;
}
.md-body li {
	margin: 6px 0;
	font-size: 15px;
	line-height: 1.75;
}
.md-body li::marker {
	color: var(--fg-3);
}

.md-body blockquote {
	margin: 18px 0;
	padding: 14px 18px;
	background: rgba(0, 0, 0, 0.03);
	border-left: 3px solid #e43d30;
	border-radius: 0 12px 12px 0;
	corner-shape: squircle;
	color: var(--fg-2);
	font-size: 14px;
}
.md-body blockquote p {
	margin: 4px 0;
}

.md-body code {
	font-family: "SF Mono", ui-monospace, Menlo, monospace;
	font-size: 0.88em;
	background: rgba(0, 0, 0, 0.06);
	border-radius: 5px;
	corner-shape: squircle;
	padding: 1px 5px;
}
.md-body pre {
	background: rgba(0, 0, 0, 0.04);
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 14px;
	corner-shape: squircle;
	padding: 16px 18px;
	overflow-x: auto;
}
.md-body pre code {
	background: transparent;
	padding: 0;
}

/* real app screenshots embed like framed windows */
.md-body img {
	display: block;
	max-width: 100%;
	margin: 22px auto;
	border-radius: 14px;
	corner-shape: squircle;
	border: 1px solid rgba(0, 0, 0, 0.1);
	box-shadow:
		0 14px 44px rgba(0, 0, 0, 0.1),
		0 2px 8px rgba(0, 0, 0, 0.06);
	background: #fff;
}

.md-body hr {
	border: none;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	margin: 34px 0;
}

/* tables follow base.css, widened and wrapped for long legal cells */
.md-body table {
	margin-top: 14px;
	table-layout: auto;
}
.md-body th,
.md-body td {
	white-space: normal;
}

/* ---- right-hand immersive section indicator ------------------------------- */
/* No glass, no card: the contents rail is bare, enlarged, and only the
   current section stays sharp. Everything else is softly blurred; hovering
   the rail dissolves the blur so the whole outline is readable. */
html {
	scroll-behavior: smooth;
}

.sec-indicator {
	position: sticky;
	top: 104px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 4px 0 4px 2px;
}
/* progressive blur is applied per-item by JS from the active section —
   it follows the current section, it is not a fixed veil. */
.si-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
}
.si-title {
	font-size: 12px;
	font-weight: 600;
	color: var(--fg-3);
}
.si-progress {
	font-size: 16px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--brand);
}
.si-track {
	position: relative;
	height: 3px;
	border-radius: 999px;
	corner-shape: squircle;
	background: rgba(0, 0, 0, 0.08);
	overflow: hidden;
}
.si-track-fill {
	height: 100%;
	width: 0%;
	border-radius: inherit;
	corner-shape: squircle;
	background: linear-gradient(90deg, #ee9576, #e43d30);
	transition: width 0.1s linear;
}
.si-current {
	font-size: 15px;
	font-weight: 600;
	color: var(--fg);
	line-height: 1.4;
	min-height: 2.8em;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
/* limited-height list: only the sections near the current one are visible,
   the list scrolls internally, and the edges fade + blur progressively. */
.si-list {
	list-style: none;
	margin: 0;
	/* extra top/bottom room so the first and last sections can still be
     centred in the viewport instead of sticking to the edges. */
	padding: 150px 0 150px;
	max-height: 330px;
	overflow-y: auto;
	scrollbar-width: none; /* scrollable, but no visible scrollbar */
	-webkit-mask-image: linear-gradient(
		to bottom,
		transparent 0,
		#000 22%,
		#000 78%,
		transparent 100%
	);
	mask-image: linear-gradient(
		to bottom,
		transparent 0,
		#000 22%,
		#000 78%,
		transparent 100%
	);
	transition:
		-webkit-mask-image 0.45s ease,
		mask-image 0.45s ease;
}
.si-list::-webkit-scrollbar {
	display: none;
}
/* hover: reveal the whole outline sharply */
.sec-indicator:hover .si-list {
	-webkit-mask-image: none;
	mask-image: none;
}
.toc-item {
	position: relative;
}
/* every entry is readable by default — grey, sharp, no blur. Only the
   edge masks (in .si-list) and the blur veils fade the extremes. */
.toc-item a {
	display: flex;
	align-items: baseline;
	gap: 10px;
	padding: 7px 4px 7px 12px;
	border-radius: 10px;
	corner-shape: squircle;
	text-decoration: none;
	color: var(--fg-3);
	transition: 1s;
}
/* hover: every entry snaps sharp and realigns left */
.sec-indicator:hover .toc-item a {
	filter: blur(0) !important;
	opacity: 1 !important;
	transform: translateX(0) !important;
}
.toc-item a:hover {
	color: var(--fg);
}
.toc-num {
	flex-shrink: 0;
	font-size: 11.5px;
	color: var(--fg-3);
	font-variant-numeric: tabular-nums;
	transition: color 0.2s ease;
}
.toc-label {
	font-size: 14px;
	line-height: 1.4;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition:
		font-weight 0.2s ease,
		color 0.2s ease;
}
/* sub-sections (h3) are hidden until the user scrolls into their chapter —
   then they animate open. */
.toc-item.lvl-3 {
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	transition:
		max-height 0.35s ease,
		opacity 0.35s ease;
}
.toc-item.lvl-3.expanded {
	max-height: 44px;
	opacity: 1;
}
.toc-item.lvl-3 a {
	padding-left: 30px;
}
.toc-item.lvl-3 .toc-num {
	font-size: 10.5px;
}
/* the active chapter: bold only — no bar, no background, no pill. */
.toc-item.active a {
	color: var(--fg);
}
.toc-item.active .toc-num {
	color: var(--fg);
	font-weight: 700;
}
.toc-item.active .toc-label {
	color: var(--fg);
	font-weight: 700;
}

/* mobile: replace the side rail with a top progress bar */
.si-mobile-track {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	z-index: 40;
	background: rgba(0, 0, 0, 0.06);
}
.si-mobile-track > div {
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, #ee9576, #e43d30);
	transition: width 0.1s linear;
}

@media (max-width: 1199px) {
	.md-layout {
		grid-template-columns: 1fr;
	}
	.sec-indicator {
		display: none;
	}
	.si-mobile-track {
		display: block;
	}
}

/* ---- footer --------------------------------------------------------------- */
.legal-foot {
	padding: 18px 20px 26px;
	text-align: center;
	font-size: 10px;
	color: var(--fg-4);
	letter-spacing: 0.03em;
	border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* ---- responsive ----------------------------------------------------------- */
@media (max-width: 640px) {
	.legal-main {
		padding: 28px 14px 48px;
	}
	.md-body h1 {
		font-size: 27px;
	}
	.md-body p {
		font-size: 14px;
	}
	.md-updated {
		margin-top: 28px;
	}
}

/* ---- print ---------------------------------------------------------------- */
@media print {
	body {
		background: #fff;
		color: #000;
		font-size: 11.5pt;
	}
	.legal-header,
	.legal-foot,
	.md-back,
	.sec-indicator,
	.si-mobile-track {
		display: none;
	}
	.legal-main {
		max-width: none;
		padding: 0;
	}
	.md-doc {
		max-width: none;
	}
	.md-body h1,
	.md-body h2 {
		break-after: avoid;
	}
	.md-body a {
		color: #000;
		text-decoration: underline;
	}
	.md-body blockquote {
		background: #f4f4f4;
		color: #333;
	}
}
