/* HttpVisibleFields (TODO: less hacky solution) */

:root {
	--base-font:
		ui-sans-serif,
		system-ui,
		-apple-system,
		BlinkMacSystemFont,
		'Segoe UI',
		Roboto,
		'Helvetica Neue',
		Arial,
		'Noto Sans',
		sans-serif,
		'Apple Color Emoji',
		'Segoe UI Emoji',
		'Segoe UI Symbol',
		'Noto Color Emoji';
	font-family: var(--base-font);
	--monospace-font:
		Consolas,
		ui-monospace,
		Menlo,
		Monaco,
		'Cascadia Mono',
		'Segoe UI Mono',
		'Roboto Mono',
		'Oxygen Mono',
		'Ubuntu Mono',
		'Source Code Pro',
		'Fira Mono',
		'Droid Sans Mono',
		'Courier New',
		monospace;
}

pre,
code,
.font-mono,
.cm-scroller {
	font-family: var(--monospace-font) !important;
}

fieldset.http-visible-fields:is(:disabled, [data-disabled]) :is(button, [role='button']):not(.always-enabled) {
	display: none;
}

/* tabs (PrettyViewer) */
.tabs {
	--tw-blue-800: rgba(30, 64, 175, 1);
	--tw-blue-700: rgba(29, 78, 216, 1);
	--tw-blue-500: rgba(59, 130, 246, 1);

	--tab-width: 5rem;
	--tab-height: 2.5rem;
	margin-top: var(--tab-height);
	--active-border-color: #ddd;
	--inactive-border-color: transparent;

	position: relative;
}

.tab .tab-label {
	position: absolute;
	top: calc(1px - var(--tab-height));
	height: var(--tab-height);
	width: var(--tab-width);
	background: transparent;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border-color: var(--inactive-border-color);
}
.tab:first-child label {
	margin-left: 0;
}
.tab input[type='radio'] {
	display: none;
}
.tab-content {
	background: white;
	padding: 1rem;
	border: 1px solid var(--active-border-color);
	display: none;
}

input[type='radio']:checked ~ label {
	color: var(--tw-blue-700);
	background: white;
	border-color: var(--active-border-color);
}

input[type='radio']:not(:checked) ~ label {
	color: var(--tw-blue-500);
}
input[type='radio']:hover:not(:checked) ~ label {
	color: var(--tw-blue-800);
}

input[type='radio']:checked ~ label ~ .tab-content {
	display: block;
}

/* dropdown */

.dropdown:is(:focus-within, :hover) .dropdown__menu {
	pointer-events: initial;
	opacity: 1;
}

.dropdown__menu {
	position: absolute;
	pointer-events: none;
	opacity: 0;
	transition: 0.5s opacity;
}

/* variable controls */

.variable-control__delete-btn {
	pointer-events: none;
	opacity: 0;
	transition: 0.5s opacity, 0.2s color;
}

.variable-control:is(:focus-within, :hover) .variable-control__delete-btn {
	pointer-events: initial;
	opacity: 1;
}

/* edit-table */

edit-table {
	/* prevent FOUT */
	color: transparent;
}

/* date inputs */

input[type='date'] {
	position: relative;
}

input[type='date']::-webkit-calendar-picker-indicator {
	position: absolute;
	left: 0;
	width: 100%;
	background-position: right;
	padding-block: 1rem;
	padding-inline-end: 1rem;
	margin-inline: -1rem;
}

/* input[type='date']:before {
	content: attr(value);
	display: inline-block;
	color: black;
}

input[type='date']::-webkit-datetime-edit,
input[type='date']::-webkit-inner-spin-button,
input[type='date']::-webkit-clear-button {
	position: absolute;
	opacity: 0;
} */

/* error list */

.error-list code {
	font-size: 0.8rem;
	background: #eee;
	border-radius: 0.1em;
	padding: 0.1em 0.3em;
}

/* gfm */
.markdown-body[data-color-mode='light'][data-light-theme='light'] {
	--color-canvas-subtle: #fff;
}

.markdown-body pre {
	white-space: pre-wrap;
}

.markdown-body :is(p, h1, h2, h3, h4, h5, h6, ol, ul, li, blockquote, pre, dl, hr) {
	padding: revert;
	margin: revert;
}

/* hljs */
code[class^='language-'] .token.comment {
	color: #00000058;
}

kbd {
	font-size: 0.8em;
	display: inline-flex;
	padding: 0em 0.5em;
	background: #0001;
	border: 1px solid #0001;
	border-radius: 0.3em;
	box-shadow: 0px 1px 0px #0002;
}

#route-nav :is([data-current], li:has([data-current], [data-ancestor]) .nav-level-0) {
	color: #fff;
}

#route-nav .nav-menu-sublist-parent:not(:hover, :focus, :focus-within) .nav-menu-list {
	display: none !important;
}

#route-nav .nav-menu-sublist-parent:is(:hover, :focus, :focus-within) .nav-menu-list {
	position: absolute;
	background: hsl(224.44deg 78.17% 19.68%);
	display: flex;
	flex-direction: column;
	z-index: 1000;
	align-items: flex-start;
	gap: 1rem;
	padding: 1.5rem;
	box-shadow: 0px 1px 0px #0002;
}

/* observablehq notebooks */

.ohq-notebook {
	font-family:
		'Source Serif Pro', 'Iowan Old Style', 'Apple Garamond', 'Palatino Linotype', 'Times New Roman', 'Droid Serif',
		Times, serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
	--sans-serif:
		-apple-system,
		BlinkMacSystemFont,
		'avenir next',
		avenir,
		helvetica,
		'helvetica neue',
		ubuntu,
		roboto,
		noto,
		'segoe ui',
		arial,
		sans-serif;
	display: grid;
	gap: 0.5rem;
}

.ohq-notebook :is(*, ::before, ::after) {
	box-sizing: initial;
}

.ohq-notebook :is(input:is([type='text'], [type='number']), textarea) {
	border: revert;
	outline: revert;
	font-family: sans-serif;
}

.ohq-notebook label {
	font: 13px / 1.2 var(--sans-serif);
}

/* .ohq-notebook :where(button, [type=button], [type=submit]) { */
.ohq-notebook :where(button:not([hidden]), [type='button']:not([hidden]), [type='submit']:not([hidden])) {
	all: revert;
}

.ohq-notebook :is(h1, h2, h3, h4, h5, h6) {
	margin: 0.6em 0 0.4em 0;
	font-weight: bold;
}

.ohq-notebook p {
	margin: 0.8em 0;
}

.ohq-notebook a[href] {
	color: #3182bd;
}

.ohq-notebook a[href]:hover {
	text-decoration: underline;
}

.observablehq--inspect,
.observablehq:has(.observablehq--inspect),
.observablehq:not(:has(*)) {
	display: none;
}

.qrcode-outer {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.qrcode {
	--node-size: 20px;
	--on-color: hsl(0deg 0% 0%);
	--off-color: hsl(0deg 0% 100% / 0);

	display: inline-flex;
	flex-direction: column;
	padding-block-end: 1rem;
}

.qrcode > * {
	display: flex;
	flex-direction: row;
}

.qrcode :is(.on, .off) {
	display: flex;

	width: var(--node-size);
	height: var(--node-size);
}

.qrcode .on {
	background: var(--on-color);
}

.qrcode .off {
	background: var(--off-color);
}

.pagination-buttons {
	display: flex;
	flex-direction: row;
	gap: 0.5rem;
}
.px-placeholder::after {
	content: 'px';
	opacity: 0.4;
	position: absolute;
	top: 0.6rem;
	right: 2rem;
}

/* TextBox */

.text-box-container:has(textarea:disabled) .cm-editor {
	display: flex;
	flex-direction: column;
}
