:root {
	--bg: #0f1115;
	--fg: #e6e6e6;
	--muted: #a0a0a0;
	--border: 0.15rem solid #22252b;
	--accent: #8ab4f8;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	scroll-behavior: smooth;
	height: 100vh;
	width: 100vw;
	overflow-x: hidden;
}

body {
	font-family: system-ui, -apple-system, sans-serif;
	background: var(--bg);
	color: var(--fg);
	line-height: 1.6;
}

h2, h3, h4, p {
 	scroll-margin-top: 5rem;
}

hr {
	height: 0.2rem;
	width: 100%;
	border: none;
	background: #22252b;
}

a {
	color: var(--accent);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

table {
	width: 100%;
	border-collapse: separate; 
	border-spacing: 0; 
	margin: 1.5rem 0;
	font-size: 0.95rem;
	border: var(--border);
	border-radius: 1rem;
	overflow: hidden; 
}

th, td {
	border-bottom: var(--border);
	border-right: var(--border);
	padding: 0.5rem 0.75rem;
	text-align: left;
}

th:last-child, td:last-child {
	border-right: none;
}

tr:last-child td {
	border-bottom: none;
}

th {
	background: #111318;
	font-weight: 600;
}

tr:nth-child(odd) {
	background: #0b0d10;
}

.search-overlay {
	position: fixed;
	top: 0;
	left: 20%;
	right: 20%;
	bottom: 0;
	background: rgba(0,0,0,0.85);
	backdrop-filter: blur(3px);
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding-top: 10vh;
	z-index: 20;
}

.search-overlay.hidden {
	display: none;
}

.search-box {
	width: 80%;
	max-height: 70%;
	overflow-y: auto;
	background: #0b0d10;
	border: var(--border);
	border-radius: 1rem;
	padding: 1rem;
	padding-top: 0;
}

.search-box > span {
	width: 100%;
	display: flex;
	justify-content: center;
	font-weight: bold;
	padding: 0.5rem 0;
	border-bottom: var(--border);
	top: 0;
	position: sticky;
	background: inherit;
}

.listing {
	list-style: none;
}

.listing a {
	color: inherit;
}

.listing > li {
	padding: 0.5rem;
	border-bottom: var(--border);
	display: flex;
	justify-content: flex-start;
}

.listing > li > .no-results {
	width: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	font-weight: bold;
	padding-top: 1rem;
}

.listing > li:last-child {
	border-bottom: none;
}

.listing > li > a {
	height: auto;
	display: flex;
	color: var(--fg);
	justify-content: flex-start;
	align-items: center;
}

.listing > li > a:hover {
	text-decoration: none;
}

.listing > li .content {
	padding-left: 1rem;
	border-left: var(--border);
}

.listing-description, .listing-tag {
	font-size: 0.8rem;
	color: var(--muted);
}

.listing-tag {
	font-weight: bold;
}

.listing > li img {
	width: 3rem;
	height: 3rem;
	border-radius: 1rem;
	margin-right: 1rem;
}

.imageblock {
	display: flex;
	justify-content: center;
	padding-bottom: 1rem;
}

.admonitionblock {
	margin: 1.5rem 0;
	border: var(--border);
	border-radius: 1rem;
	background: #0b0d10;
}

.admonitionblock > table,
.admonitionblock th, 
.admonitionblock td {
	border: 0;
}

.admonitionblock .icon {
	display: none;
}

.admonitionblock .content {
	padding: 0 1rem;
}

.admonitionblock.note {
  border-color: #4ea1ff;
}

.admonitionblock.tip {
  border-color: #4caf50;
}

.admonitionblock.warning {
  border-color: #ff9800;
}

.admonitionblock.caution {
  border-color: #f44336;
}

.admonitionblock.important {
  border-color: #9c27b0;
}

.admonitionblock::before {
  display: flex;
  justify-content: center;
  font-weight: bold;
  color: black;
  border-top-right-radius: 0.5rem;
  border-top-left-radius: 0.5rem;
}

.admonitionblock.note::before {
  content: "NOTE";
  background: #4ea1ff;
}

.admonitionblock.tip::before {
  content: "TIP";
  background: #4caf50;
}

.admonitionblock.warning::before {
  content: "WARNING";
  background: #ff9800;
}

.admonitionblock.caution::before {
  content: "CAUTION";
  background: #f44336;
}

.admonitionblock.important::before {
  content: "IMPORTANT";
  background: #9c27b0;
}

.codeblock {
  width: auto;
  height: 100%;
  border: var(--border);
  border-radius: inherit;
  background: #0b0d10;
}

.codeblock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  padding: 0.4rem 0.6rem;
  background: #111318;
  border-bottom: var(--border);
  border-top-right-radius: inherit;
  border-top-left-radius: inherit;
}

.codeblock-lang {
  color: var(--muted);
  text-transform: lowercase;
}

.codeblock-copy {
  background: none;
  color: var(--muted);
  border: none;
  cursor: pointer;
  font-size: 0.7rem;
}

.codeblock-copy > svg {
	width: 1rem;
	height: 1rem;
}

.codeblock-copy:hover {
  color: var(--fg);
  border-color: var(--fg);
}

.codeblock pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
}

blockquote {
  border-left: var(--border);
  padding-left: 1rem;
  color: var(--muted);
}

/* --- Layout Grid --- */
.layout {
	display: grid;
	grid-template-columns: 2fr 6fr 2fr;
	min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
	padding: 1.5rem 1rem;
	position: sticky;
	top: 0;
	height: 100vh;
	display: flex;
	flex-direction: column;
}

.sidebar h1 {
	font-size: 1.2rem;
	margin-bottom: 0.25rem;
}

.sidebar p {
	font-size: 0.85rem;
	color: var(--muted);
	margin-bottom: 1rem;
}

/* --- Main --- */
.main {
	position: relative;
}

/* Content */
.main-content {
	padding: 3.5rem;
	padding-top: 0;
	width: 100%;
	max-height: 100%;
}

.main-content h1, .main-content h2, .main-content h3, .main-content h4 {
	margin-top: 1.5rem;
}

.main-content p {
	margin: 1rem 0;
}

.hamburger-toggle {
	display: none;
	background: none;
	border: none;
	color: var(--fg);
	font-size: 1.2rem;
	cursor: pointer;
}

/* --- Responsive --- */
@media (max-width: 1100px) {
	.layout {
		grid-template-columns: 1fr 3fr;
	}

	.main-content {
		padding: 2rem;
		padding-top: 0;
	}

	#toc-toggle {
		display: block;
	}

	#right-sidebar {
		position: fixed;
		right: -100%;
		top: 8%;
		height: 50vh;
		width: 40vw;
		background: rgba(0,0,0,0.9);
		transition: right 0.2s ease;
		z-index: 90;
		border: var(--border);
		border-radius: 1rem;
	}

	#right-sidebar.open {
		right: 5%;
	}

	.search-overlay {
		right: 0;
		left: 25%;
	}
}

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

	.search-overlay {
		left: 0;
		right: 0;
	}

	#menu-toggle {
		display: block;
	}

	#left-sidebar {
		position: fixed;
		left: -100%;
		top: 8%;
		height: 50vh;
		width: 60vw;
		background: rgba(0,0,0,0.9);
		border: var(--border);
		border-radius: 1rem;
		transition: left 0.2s ease;
		z-index: 90;
	}

	#right-sidebar {
		width: 60vw;
	}

	#left-sidebar.open {
		left: 5%;
	}
}

@media (max-width: 480px) {
	.header > a {
		display: none;
	}
}
