@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;700&display=swap');

:root {
	--background: white;
	--text: hsl(0, 0%, 11%);
	--gray-light: #f5f5f5;
	--gray-dark: #e8e8e8;
	--black-transparent-lighter: rgba(0, 0, 0, 0.07);
	--black-transparent-light: rgba(0, 0, 0, 0.3);
	--black-transparent-dark: rgba(0, 0, 0, 0.5);
	--black-transparent-darker: rgba(0, 0, 0, 0.7);
	--focus: hsl(214, 84%, 56%);
	--whiteboard: hsl(210, 20%, 98%);
	color-scheme: light;
}

html,
body {
	padding: 0;
	margin: 0;
	font-family: 'Inter', sans-serif;
	min-height: 100vh;
	/* mobile viewport bug fix */
	min-height: -webkit-fill-available;
	height: 100%;
	/* prevent two-finger swipe to go back */
	overscroll-behavior: none;
	background-color: var(--background);
	color: var(--text);
}

@media screen and (max-width: 600px) {
	html,
	body {
		font-size: 14px;
	}
}

html,
* {
	box-sizing: border-box;
}

/* NB: If we did position: fixed, Safari on iOS 18 and MacOS 15 would
 * have several rendering issues. This must stay position: absolute. */

.tldraw__editor {
	position: absolute;
	inset: 0px;
	overflow: hidden;
	overscroll-behavior: none;
	touch-action: none;
}

.example {
	display: grid;
	grid-template-columns: auto 1fr;
	grid-auto-flow: column;
}

.example__content {
	position: relative;
	height: 100%;
	width: 100%;
	overflow: auto;
}

@media screen and (max-width: 500px) {
	.example {
		display: grid;
		grid-template-columns: 1fr;
		grid-auto-flow: column;
	}
	.example__sidebar {
		display: none;
	}
}

/* --------------------- Sidebar -------------------- */

.example__sidebar {
	width: 256px;
	min-width: 256px;
	display: grid;
	grid-template-rows: auto 48px 48px 1fr auto;
	border-right: 1px solid var(--black-transparent-light);
	overflow: hidden;
	font-size: 14px;
	font-weight: 500;
	max-height: 100%;
}

.example__sidebar a {
	text-decoration: none;
	color: inherit;
}

.example__sidebar__filter {
	margin: 8px;
	padding: 8px;
	border-radius: 6px;
	border: 1px solid var(--gray-dark);
	font-size: 14px;
}

/* Header */

.example__sidebar__header {
	display: flex;
	height: 40px;
	align-items: center;
	max-width: 100%;
	padding: 0 4px 0 8px;
}

.example__sidebar__header__logo {
	all: unset;
	cursor: pointer;
	flex: none;
	font-size: 1.15rem;
	display: flex;
	align-items: center;
	justify-content: start;
	overflow: hidden;
	padding: 0px;
}

.examples__tldraw__logo {
	height: 18px;
	width: auto;
}

/* Categories */

ul.example__sidebar__categories {
	list-style: none;
	padding: 0;
	margin: 0;
	overflow: auto;
}

.example__sidebar__category__header {
	display: grid;
	grid-template-columns: 1fr auto;
	font-weight: 800;
	align-items: center;
	padding: 8px 12px;
	margin: 0px;
	font-size: 14px;
}

/* Category */

li.example__sidebar__category {
	display: none;
	position: relative;
	padding: 8px 0px;
}

.example__sidebar__category:has(> ul > li) {
	display: block;
}

ul.example__sidebar__category__items {
	list-style: none;
	padding: 0px 0px 0px 4px;
	margin: 0px;
}

li.examples__sidebar__item {
	position: relative;
	margin: 0px;
	height: 32px;
}

.examples__sidebar__item__title {
	flex-grow: 2;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	padding-right: 32px;
}

.examples__sidebar__item__link {
	display: block;
	font-weight: 500;
	margin: 0px;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	position: absolute;
	z-index: 2;
	inset: 0;
	padding: 0px 8px;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	flex-direction: row;
}

.examples__sidebar__item::after {
	content: '';
	position: absolute;
	inset: 2px 8px 2px 4px;
	z-index: 1;
	background-color: var(--gray-light);
	border-radius: 4px;
	opacity: 0;
	pointer-events: none;
}

.examples__sidebar__item__details {
	width: 100%;
	margin: 8px 0 0 0;
}

.examples__sidebar__item[data-active='true']::after {
	opacity: 1;
}

.examples__sidebar__item[data-active='false']:hover::after {
	opacity: 1;
}

/* -------------------- List Item ------------------- */

.example__sidebar__item__buttons {
	display: flex;
	flex-direction: row;
	height: 32px;
	margin-right: 0px;
	color: black;
	position: relative;
	z-index: 20;
	flex-shrink: 0;
}

.example__sidebar__item__button {
	all: unset;
	cursor: pointer;
	position: relative;
	display: block;
	opacity: 0.8;
	height: 100%;
	width: 32px;
	z-index: 10;
	color: inherit;
	display: flex;
	align-items: center;
	justify-content: center;
}

.example__sidebar__item__button:hover {
	z-index: 20;
}

.example__sidebar__item__button:nth-of-type(n + 1) {
	margin-left: -4px;
}

.example {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: stretch;
}

/* ----------------- Header/Footer Buttons ----------------- */

.example__sidebar__header-links,
.example__sidebar__footer-links {
	display: flex;
	flex-direction: column;
	gap: 8px;
	font-size: 13px;
	font-weight: 400;
	padding: 8px;
	border-top: 1px solid var(--gray-dark);
}

.example__sidebar__header-link,
.example__sidebar__footer-link {
	padding: 8px 8px;
	border-radius: 6px;
	background-color: hsl(214, 92%, 50%);
	display: flex;
	flex: 1 1 auto;
	text-align: center;
	align-items: center;
	justify-content: center;
	color: #fff;
	text-decoration: none;
	box-shadow:
		0px 1px 2px rgba(0, 0, 0, 0.12),
		0px 1px 3px rgba(0, 0, 0, 0.04);
}

a.example__sidebar__header-link {
	color: white;
}

.example__sidebar__footer-link--grey {
	background-color: var(--gray-light);
	color: black;
	border: 1px solid var(--gray-dark);
	font-size: 14px;
}

/* ------------------ Social Links ------------------ */

.example__sidebar__header__socials {
	display: flex;
	flex-direction: row;
	justify-content: flex-end;
	flex-grow: 2;
}

.example__sidebar__header__socials a {
	color: var(--text);
	height: 32px;
	width: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
}

.example__sidebar__icon {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	color: var(--text);
	background-color: var(--text);
}

/* --------------------- Scroll --------------------- */

.scroll-light {
	scrollbar-width: thin;
}

.scroll-light::-webkit-scrollbar {
	display: block;
	width: 8px;
	height: 8px;
	position: absolute;
	top: 0;
	left: 0;
	background-color: inherit;
}

.scroll-light::-webkit-scrollbar-button {
	display: none;
	width: 0;
	height: 10px;
}

.scroll-light::-webkit-scrollbar-thumb {
	background-clip: padding-box;
	width: 0;
	min-height: 36px;
	border: 2px solid transparent;
	border-radius: 6px;
	background-color: var(--black-transparent-light);
}

.scroll-light::-webkit-scrollbar-thumb:hover {
	background-color: var(--black-transparent-light);
}

/* ---------------------- Hover --------------------- */

.hoverable::after {
	display: block;
	content: '';
	position: absolute;
	inset: 1px;
	opacity: 0;
	z-index: -1;
	background-color: var(--gray-light);
	border-radius: 4px;
}

.hoverable:hover::after {
	opacity: 1;
}

/* --------------------- Dialog --------------------- */

.example__dialog__overlay {
	position: fixed;
	inset: 0;
	z-index: 9999999998;
	background-color: var(--black-transparent-dark);
}

.example__dialog__content {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 9999999999;
	width: 680px;
	max-width: calc(100% - 40px);
	max-height: calc(100vh - 40px);
	overflow: auto;
	border-radius: 8px;
	box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.12);
	padding: 16px;
	background-color: white;
}

.example__dialog__content h1 {
	font-size: 20px;
	margin: 0px;
}

.example__dialog__markdown {
	min-height: 40px;
	line-height: 1.5;
	font-size: 16px;
}

.example__dialog__markdown p {
	margin: 12px 0px;
}

.example__dialog__markdown a {
	color: royalblue;
	text-decoration: none;
}

.example__dialog__markdown a:hover {
	text-decoration: underline;
}

.example__dialog__actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 24px;
	gap: 16px;
}

.example__dialog__actions a,
.example__dialog__actions button {
	cursor: pointer;
	padding: 8px 12px;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	gap: 8px;
	background-color: var(--gray-light);
	color: black;
	border: 1px solid var(--gray-dark);
	font-size: 14px;
}

.example__dialog__content p > code {
	font-size: 14px;
	font-family: monospace;
	padding: 1px 4px;
	margin: 0px -2px;
	background-color: var(--black-transparent-lighter);
	border-radius: 4px;
}

.example__dialog__close {
	all: unset;
}

:root:has(.tl-theme__dark) .MultiplayerExampleWrapper {
	--background: black;
	--text: hsl(0, 9%, 94%);
	--gray-light: #333;
	--gray-dark: #444;
	--black-transparent-lighter: rgba(255, 255, 255, 0.15);
	--black-transparent-light: rgba(255, 255, 255, 0.4);
	--black-transparent-dark: rgba(255, 255, 255, 0.6);
	--black-transparent-darker: rgba(255, 255, 255, 0.7);
	--focus: hsl(217, 89%, 61%);
	--whiteboard: hsl(240, 5%, 6.5%);
	color-scheme: dark;
}

.MultiplayerExampleWrapper {
	display: flex;
	flex-direction: column;
	/* container: example / size; */
	position: absolute;
	inset: 0px;
}

.MultiplayerExampleWrapper-picker {
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
	align-items: center;
	padding: 8px 16px;
	gap: 16px;
	background: var(--background);
	border-bottom: 1px solid var(--gray-dark);
	color: var(--text);
	font-size: 14px;
}

.MultiplayerExampleWrapper-copy {
	background: var(--black-transparent-lighter);
	border: 1px solid var(--gray-dark);
	border-radius: 4px;
	padding: 4px 12px;
	height: 24px;
	cursor: pointer;
	position: relative;
	text-align: center;
}

.MultiplayerExampleWrapper-copy:has(.MultiplayerExampleWrapper-copied) {
	color: transparent;
}

.MultiplayerExampleWrapper-copied {
	color: var(--text);
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.MultiplayerExampleWrapper-copy:hover {
	border: 1px solid var(--black-transparent-lighter);
}

.MultiplayerExampleWrapper-example {
	position: relative;
	flex: 1;
}
