/* The help center at /docs and /ko/docs (scripts/help-site.mjs writes the pages). Same tokens
   as styles.css; neutral surfaces, the accent only for what is current or can be pressed. */

:root {
	--canvas: #faf9f7;
	--surface: #ffffff;
	--sunken: #f1efeb;
	--hover: #f4f2ee;
	--line: #e6e3de;
	--ink: #1c1a17;
	--muted: #6f6a63;
	--faint: #8c867e;
	--accent: #4b55d6;
	--accent-soft: #eceefe;
	--tip: #2f7d4f;
	--tip-soft: #ecf6ef;
	--warn: #9a6416;
	--warn-soft: #fbf3e4;
	--shadow: 0 1px 2px rgb(28 26 23 / 0.04), 0 12px 32px -12px rgb(28 26 23 / 0.18);
	--top: 56px;
	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--canvas: #141311;
		--surface: #1c1b19;
		--sunken: #252421;
		--hover: #22211e;
		--line: #2f2d2a;
		--ink: #f1efec;
		--muted: #a7a19a;
		--faint: #8a847d;
		--accent: #8f9ff6;
		--accent-soft: #262a4d;
		--tip: #7fcf9b;
		--tip-soft: #19271e;
		--warn: #e2b05a;
		--warn-soft: #2b2416;
		--shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 16px 40px -12px rgb(0 0 0 / 0.6);
	}
}

* {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-padding-top: calc(var(--top) + 16px);
}

body {
	margin: 0;
	background: var(--canvas);
	color: var(--ink);
	font-family:
		'Inter',
		ui-sans-serif,
		system-ui,
		-apple-system,
		'Segoe UI',
		'Apple SD Gothic Neo',
		'Malgun Gothic',
		sans-serif;
	font-feature-settings: 'cv11', 'ss01';
	-webkit-font-smoothing: antialiased;
	line-height: 1.6;
	overflow-wrap: break-word;
}

:lang(ko) body,
body:lang(ko) {
	word-break: keep-all;
}

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

img {
	display: block;
	max-width: 100%;
	height: auto;
}

button {
	font: inherit;
	color: inherit;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 6px;
}

.skip {
	position: absolute;
	left: 12px;
	top: -48px;
	z-index: 40;
	padding: 8px 12px;
	border-radius: 8px;
	background: var(--surface);
	box-shadow: var(--shadow);
}

.skip:focus {
	top: 12px;
}

/* --- Top bar --------------------------------------------------------------------------------- */

.topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 12px;
	height: var(--top);
	padding: 0 16px;
	border-bottom: 1px solid var(--line);
	background: color-mix(in srgb, var(--canvas) 88%, transparent);
	backdrop-filter: saturate(1.4) blur(12px);
	-webkit-backdrop-filter: saturate(1.4) blur(12px);
}

.topbar-left,
.topbar-right {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.topbar-right {
	margin-left: auto;
}

.brand {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.brand-docs {
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--sunken);
	color: var(--muted);
	font-size: 13px;
	font-weight: 500;
}

.brand-docs:hover {
	color: var(--ink);
}

.menu-button {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	margin-left: -6px;
	border: 0;
	border-radius: 8px;
	background: none;
	cursor: pointer;
}

.menu-button svg {
	width: 20px;
	height: 20px;
}

.menu-button:hover {
	background: var(--hover);
}

.search-button {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	max-width: 420px;
	height: 36px;
	margin: 0 auto;
	padding: 0 8px 0 12px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--surface);
	color: var(--muted);
	font-size: 14px;
	cursor: pointer;
	text-align: left;
}

.search-button:hover {
	border-color: var(--faint);
}

.search-button svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.search-label {
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

kbd {
	display: inline-block;
	min-width: 1.6em;
	padding: 0 5px;
	border: 1px solid var(--line);
	border-bottom-width: 2px;
	border-radius: 5px;
	background: var(--sunken);
	color: var(--ink);
	font:
		500 12px/1.6 ui-monospace,
		SFMono-Regular,
		Menlo,
		monospace;
	text-align: center;
	white-space: nowrap;
}

.search-key {
	color: var(--muted);
}

.lang-switch {
	padding: 6px 8px;
	border-radius: 8px;
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
}

.lang-switch:hover {
	background: var(--hover);
	color: var(--ink);
}

.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 36px;
	padding: 0 14px;
	border-radius: 10px;
	background: var(--ink);
	color: var(--canvas);
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
}

.button:hover {
	opacity: 0.9;
}

/* --- Layout ---------------------------------------------------------------------------------- */

.docs {
	display: grid;
	grid-template-columns: 260px minmax(0, 1fr) 220px;
	gap: 40px;
	max-width: 1360px;
	margin: 0 auto;
	padding: 0 24px;
}

.docs-home {
	grid-template-columns: 260px minmax(0, 1fr);
}

.docs-nav {
	position: sticky;
	top: var(--top);
	align-self: start;
	height: calc(100vh - var(--top));
	height: calc(100dvh - var(--top));
	overflow-y: auto;
	padding: 24px 8px 40px 0;
	font-size: 14px;
	overscroll-behavior: contain;
}

.nav-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.nav-home {
	display: block;
	flex: 1;
	padding: 6px 10px;
	border-radius: 8px;
	font-weight: 600;
}

.nav-home:hover,
.nav-home.here {
	background: var(--hover);
}

.nav-close {
	display: none;
}

.nav-group {
	margin-top: 18px;
}

.nav-label {
	margin: 0 0 4px;
	padding: 0 10px;
	color: var(--faint);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.nav-label:lang(ko) {
	text-transform: none;
	letter-spacing: 0;
}

.docs-nav ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.docs-nav li a {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 34px;
	padding: 6px 10px;
	border-radius: 8px;
	color: var(--muted);
	line-height: 1.35;
}

.docs-nav li a:hover {
	background: var(--hover);
	color: var(--ink);
}

.docs-nav li a[aria-current='page'] {
	background: var(--accent-soft);
	color: var(--accent);
	font-weight: 500;
}

.icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.nav-scrim {
	display: none;
}

/* --- Article --------------------------------------------------------------------------------- */

.article,
.home {
	min-width: 0;
	max-width: 760px;
	padding: 32px 0 64px;
}

.home {
	max-width: 980px;
}

.crumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 12px;
	color: var(--faint);
	font-size: 13px;
}

.crumbs a:hover {
	color: var(--ink);
}

h1 {
	margin: 0;
	font-size: clamp(30px, 4vw, 38px);
	line-height: 1.15;
	letter-spacing: -0.025em;
}

.lede {
	margin: 12px 0 0;
	color: var(--muted);
	font-size: 18px;
	line-height: 1.55;
}

.prose {
	margin-top: 8px;
	font-size: 16px;
}

.prose h2 {
	position: relative;
	margin: 48px 0 12px;
	padding-top: 24px;
	border-top: 1px solid var(--line);
	font-size: 24px;
	line-height: 1.3;
	letter-spacing: -0.015em;
}

.prose h3 {
	position: relative;
	margin: 32px 0 8px;
	font-size: 18px;
	line-height: 1.4;
}

.anchor {
	position: absolute;
	left: -1.1em;
	padding-right: 0.3em;
	color: var(--faint);
	font-weight: 400;
	opacity: 0;
}

h2:hover .anchor,
h3:hover .anchor {
	opacity: 1;
}

.prose p,
.prose ul,
.prose ol {
	margin: 12px 0;
}

.prose ul,
.prose ol {
	padding-left: 1.4em;
}

.prose li {
	margin: 6px 0;
}

.prose li > ul {
	margin: 6px 0;
}

.prose li::marker {
	color: var(--faint);
}

.prose a,
.help-box a {
	color: var(--accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.prose strong {
	font-weight: 600;
}

.prose code {
	padding: 1px 5px;
	border-radius: 5px;
	background: var(--sunken);
	font:
		0.88em/1.5 ui-monospace,
		SFMono-Regular,
		Menlo,
		monospace;
	overflow-wrap: anywhere;
}

.callout {
	margin: 20px 0;
	padding: 4px 16px;
	border: 1px solid var(--line);
	border-left-width: 3px;
	border-radius: 10px;
	background: var(--surface);
}

.callout-tip {
	border-left-color: var(--tip);
	background: var(--tip-soft);
}

.callout-warning {
	border-left-color: var(--warn);
	background: var(--warn-soft);
}

.callout-note {
	border-left-color: var(--accent);
}

.table {
	margin: 16px 0;
	overflow-x: auto;
	border: 1px solid var(--line);
	border-radius: 10px;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

th,
td {
	padding: 9px 12px;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: top;
}

th {
	background: var(--sunken);
	font-weight: 600;
	white-space: nowrap;
}

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

.shot {
	margin: 24px 0;
}

.shot picture {
	display: block;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--sunken);
	box-shadow: var(--shadow);
}

.shot figcaption {
	margin-top: 8px;
	color: var(--muted);
	font-size: 13px;
	text-align: center;
}

/* --- Pager, help, contents ------------------------------------------------------------------- */

.pager {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 56px;
}

.pager a {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 14px 16px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--surface);
	font-weight: 500;
}

.pager a:hover {
	border-color: var(--faint);
}

.pager span {
	color: var(--faint);
	font-size: 13px;
	font-weight: 400;
}

.pager-next {
	grid-column: 2;
	text-align: right;
}

.help-box {
	margin-top: 32px;
	padding: 20px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--surface);
}

.help-box h2 {
	margin: 0 0 6px;
	font-size: 17px;
}

.help-box p {
	margin: 6px 0 0;
	font-size: 15px;
}

.muted {
	color: var(--muted);
}

.toc {
	position: sticky;
	top: var(--top);
	align-self: start;
	max-height: calc(100vh - var(--top));
	overflow-y: auto;
	padding: 36px 0 40px;
	font-size: 13px;
}

.toc-label {
	margin: 0 0 8px;
	color: var(--faint);
	font-weight: 600;
}

.toc ul,
.toc-mobile ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.toc a {
	display: block;
	padding: 4px 0 4px 12px;
	border-left: 1px solid var(--line);
	color: var(--muted);
	line-height: 1.4;
}

.toc a:hover {
	color: var(--ink);
}

.toc a[aria-current='true'] {
	border-left-color: var(--accent);
	color: var(--accent);
}

.toc-mobile {
	display: none;
	margin-top: 20px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--surface);
	font-size: 14px;
}

.toc-mobile summary {
	padding: 10px 14px;
	cursor: pointer;
	font-weight: 500;
}

.toc-mobile ul {
	padding: 0 14px 10px;
}

.toc-mobile a {
	display: block;
	padding: 6px 0;
	color: var(--muted);
}

/* --- Home ------------------------------------------------------------------------------------ */

.hero {
	padding: 24px 0 8px;
}

.hero-search {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	max-width: 560px;
	height: 52px;
	margin-top: 24px;
	padding: 0 16px;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: var(--surface);
	box-shadow: var(--shadow);
	color: var(--muted);
	font-size: 16px;
	text-align: left;
	cursor: pointer;
}

.hero-search svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.hero-search span {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.popular {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 8px 12px;
	margin-top: 16px;
	font-size: 14px;
}

.popular p {
	margin: 0;
	color: var(--faint);
}

.popular ul {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.popular a {
	display: inline-block;
	padding: 3px 10px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--surface);
	color: var(--muted);
}

.popular a:hover {
	color: var(--ink);
	border-color: var(--faint);
}

.home-group h2 {
	margin: 40px 0 12px;
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.home-group h2:lang(ko) {
	text-transform: none;
	letter-spacing: 0;
	font-size: 14px;
}

.cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 12px;
}

.card {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 4px 12px;
	padding: 16px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--surface);
}

.card:hover {
	border-color: var(--faint);
	box-shadow: var(--shadow);
}

.card-icon {
	grid-row: span 2;
	width: 22px;
	height: 22px;
	margin-top: 1px;
	color: var(--muted);
}

.card-title {
	font-weight: 600;
}

.card-text {
	color: var(--muted);
	font-size: 14px;
	line-height: 1.5;
}

/* --- Footer ---------------------------------------------------------------------------------- */

.docs-footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 12px;
	max-width: 1360px;
	margin: 0 auto;
	padding: 24px;
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 14px;
}

.docs-footer nav {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
}

.docs-footer a:hover {
	color: var(--ink);
}

/* --- Search ---------------------------------------------------------------------------------- */

.search[hidden] {
	display: none;
}

.search {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding: 10vh 16px 16px;
}

.search-backdrop {
	position: absolute;
	inset: 0;
	background: rgb(20 19 17 / 0.4);
}

.search-panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 640px;
	max-height: 76vh;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: var(--surface);
	box-shadow: var(--shadow);
}

.search-field {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 12px 0 16px;
	border-bottom: 1px solid var(--line);
}

.search-field svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	color: var(--muted);
}

.search-field input {
	flex: 1;
	min-width: 0;
	height: 52px;
	border: 0;
	background: none;
	color: var(--ink);
	font: inherit;
	font-size: 16px;
	outline: none;
}

.search-field input::-webkit-search-cancel-button {
	display: none;
}

.search-esc {
	padding: 2px 8px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: var(--sunken);
	color: var(--muted);
	font-size: 12px;
	cursor: pointer;
}

.search-results {
	margin: 0;
	padding: 6px;
	overflow-y: auto;
	list-style: none;
}

.search-results:empty {
	display: none;
}

.search-results a {
	display: block;
	padding: 10px 12px;
	border-radius: 10px;
}

.search-results [aria-selected='true'] a {
	background: var(--accent-soft);
}

.result-where {
	display: block;
	color: var(--faint);
	font-size: 12px;
}

.result-title {
	display: block;
	font-weight: 600;
	font-size: 15px;
}

.result-text {
	display: block;
	color: var(--muted);
	font-size: 13px;
	line-height: 1.45;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.search-results mark {
	background: none;
	color: var(--accent);
	font-weight: 600;
}

.search-status {
	margin: 0;
	padding: 12px 16px;
	color: var(--muted);
	font-size: 14px;
}

.search-status:empty {
	display: none;
}

/* --- Smaller screens ------------------------------------------------------------------------- */

@media (min-width: 1025px) {
	.menu-button {
		display: none;
	}
}

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

	.toc {
		display: none;
	}

	.toc-mobile {
		display: block;
	}
}

@media (max-width: 1024px) {
	.docs,
	.docs-home {
		display: block;
		padding: 0 16px;
	}

	.article,
	.home {
		margin: 0 auto;
	}

	.docs-nav {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		z-index: 30;
		width: min(320px, 86vw);
		height: auto;
		padding: 12px 12px 40px;
		border-right: 1px solid var(--line);
		background: var(--canvas);
		box-shadow: var(--shadow);
		transform: translateX(-105%);
		transition: transform 0.2s ease;
		visibility: hidden;
	}

	.nav-open .docs-nav {
		transform: none;
		visibility: visible;
	}

	.nav-close {
		display: grid;
		place-items: center;
		width: 36px;
		height: 36px;
		border: 0;
		border-radius: 8px;
		background: none;
		cursor: pointer;
	}

	.nav-close:hover {
		background: var(--hover);
	}

	.nav-open .nav-scrim {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 25;
		background: rgb(20 19 17 / 0.4);
	}

	.nav-open {
		overflow: hidden;
	}
}

@media (max-width: 640px) {
	.topbar {
		gap: 6px;
		padding: 0 12px;
	}

	.brand span {
		display: none;
	}

	.search-button {
		flex: 0 0 auto;
		width: 36px;
		margin: 0 0 0 auto;
		padding: 0;
		justify-content: center;
	}

	.search-label,
	.search-key {
		display: none;
	}

	.topbar-right {
		margin-left: 0;
	}

	.button.small {
		padding: 0 10px;
		font-size: 13px;
	}

	.article,
	.home {
		padding-top: 24px;
	}

	.lede {
		font-size: 17px;
	}

	.prose h2 {
		font-size: 21px;
	}

	.pager {
		grid-template-columns: 1fr;
	}

	.pager-next {
		grid-column: 1;
	}

	.search {
		padding: 0;
	}

	.search-panel {
		max-width: none;
		max-height: none;
		height: 100%;
		border: 0;
		border-radius: 0;
	}

	.cards {
		grid-template-columns: 1fr;
	}

	.anchor {
		display: none;
	}

	/* A phone screenshot on a phone: narrower than the column, so it reads as a phone. */
	.shot picture {
		max-width: 300px;
		margin: 0 auto;
		border-radius: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.docs-nav {
		transition: none;
	}
}
