/* Stylesheet for the static help section
   Tokens mirror the landing page (src/components/app/global.sss and styles.sss) so that
   /help reads as part of the same site: same brand typeface, same background gradient, same
   container width and link colour */

:root {
	color-scheme: light;
	--gg-ink: #000;
	--gg-ink-muted: #5b6577;
	--gg-link: #3c3c3c;
	--gg-accent: #454e6d;
	--gg-logo: #809cbb;
	--gg-card: #fff;
	--gg-card-shadow: rgba(69, 78, 109, .1);
	--gg-rule: #dde4ed;
	--gg-page: #d6dee8;
	--gg-page-top: #ced6e1;
	--gg-page-bottom: #f3faff;
	--gg-menu: #ebeff2;
	--gg-menu-shadow: rgba(69, 78, 109, .15);
	--gg-menu-rule: rgba(69, 78, 109, .1);
	--gg-prose-link: #2f6db3;
	--gg-prose-link-hover: #1d4d84;
	--gg-prose-link-line: rgba(47, 109, 179, .35);
	--gg-code: #f1f4f9;
	--gg-field: #f7f9fc;
	--gg-field-focus: #fff;
	--gg-field-placeholder: #93a0b4;
	--gg-button: #454e6d;
	--gg-button-hover: #363d57;
	--gg-button-shadow: rgba(69, 78, 109, .22);
	--gg-success: #2f7a3f;
	--gg-warn-ink: #8a4b16;
	--gg-warn-bg: #fdf1e3;
	--gg-warn-rule: #f0d5b4;
	/* Which glyph the theme toggle shows — the one for the theme it would switch to */
	--gg-toggle-moon: block;
	--gg-toggle-sun: none;
	--gg-container: 1220px;
	--gg-reading: 820px;
}

/* Night mode
   Follows the system setting unless the toggle stored an explicit choice, which the early
   inline script stamps as data-theme on <html> before first paint. The same tokens appear
   twice because a media query and an attribute selector cannot share one rule — keep the
   two blocks identical. With scripting off only the media query applies, so the system
   setting is still honoured */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;
		--gg-ink: #e3e8ef;
		--gg-ink-muted: #97a3b6;
		--gg-link: #c9d2df;
		--gg-accent: #a9badb;
		--gg-card: #1a212c;
		--gg-card-shadow: rgba(0, 0, 0, .35);
		--gg-rule: #2a3341;
		--gg-page: #11161e;
		--gg-page-top: #161d28;
		--gg-page-bottom: #0d1117;
		--gg-menu: #222a37;
		--gg-menu-shadow: rgba(0, 0, 0, .4);
		--gg-menu-rule: rgba(128, 156, 187, .12);
		--gg-prose-link: #6fa8ec;
		--gg-prose-link-hover: #9cc4f3;
		--gg-prose-link-line: rgba(111, 168, 236, .4);
		--gg-code: #232b38;
		--gg-field: #151b24;
		--gg-field-focus: #11161e;
		--gg-field-placeholder: #6f7c90;
		--gg-button: #4b5a7c;
		--gg-button-hover: #5a6a8f;
		--gg-button-shadow: rgba(0, 0, 0, .3);
		--gg-success: #6fcf87;
		--gg-warn-ink: #f2c48d;
		--gg-warn-bg: #3a2a17;
		--gg-warn-rule: #5c4220;
		--gg-toggle-moon: none;
		--gg-toggle-sun: block;
	}
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--gg-ink: #e3e8ef;
	--gg-ink-muted: #97a3b6;
	--gg-link: #c9d2df;
	--gg-accent: #a9badb;
	--gg-card: #1a212c;
	--gg-card-shadow: rgba(0, 0, 0, .35);
	--gg-rule: #2a3341;
	--gg-page: #11161e;
	--gg-page-top: #161d28;
	--gg-page-bottom: #0d1117;
	--gg-menu: #222a37;
	--gg-menu-shadow: rgba(0, 0, 0, .4);
	--gg-menu-rule: rgba(128, 156, 187, .12);
	--gg-prose-link: #6fa8ec;
	--gg-prose-link-hover: #9cc4f3;
	--gg-prose-link-line: rgba(111, 168, 236, .4);
	--gg-code: #232b38;
	--gg-field: #151b24;
	--gg-field-focus: #11161e;
	--gg-field-placeholder: #6f7c90;
	--gg-button: #4b5a7c;
	--gg-button-hover: #5a6a8f;
	--gg-button-shadow: rgba(0, 0, 0, .3);
	--gg-success: #6fcf87;
	--gg-warn-ink: #f2c48d;
	--gg-warn-bg: #3a2a17;
	--gg-warn-rule: #5c4220;
	--gg-toggle-moon: none;
	--gg-toggle-sun: block;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	-webkit-tap-highlight-color: transparent;
}

body {
	margin: 0;
	min-height: 100vh;
	font-family: var(--br-font);
	font-size: 16px;
	font-weight: 400;
	line-height: 1.6;
	color: var(--gg-ink);
	background-color: var(--gg-page);
	background-image: linear-gradient(180deg, var(--gg-page-top) 0%, var(--gg-page-bottom) 100%);
	background-attachment: fixed;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.container {
	width: 100%;
	max-width: var(--gg-container);
	margin: 0 auto;
	padding: 0 15px;
}

@media (min-width: 375px) {
	.container {
		padding: 0 30px;
	}
}

a {
	color: var(--gg-link);
	text-decoration: none;
	transition: color .2s ease;
}

a:hover {
	color: var(--gg-accent);
}

/* Header */

/* The gap only matters on the narrowest phones, where the logo would otherwise run into
   the header buttons */
.siteHeader {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 25px 0;
}

.siteHeader__right {
	display: flex;
	align-items: center;
	margin-left: auto;
}

.siteHeader__logo {
	display: inline-flex;
	align-items: center;
	color: var(--gg-logo);
}

.siteHeader__logo svg {
	display: block;
	fill: currentColor;
}

.siteHeader__logo svg + svg {
	margin: 0 0 0 12px;
}

/* Only the wordmark gives way on the narrowest phones, scaling down through its viewBox, so
   the header buttons always fit without a horizontal scroll */
.siteHeader__logo {
	min-width: 0;
}

.siteHeader__logo svg {
	flex: none;
}

.siteHeader__logo svg + svg {
	flex: 0 1 auto;
	min-width: 0;
	height: auto;
}

/* Theme toggle — same footprint and border as the language button beside it */

.themeToggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0 10px 0 0;
	padding: 0;
	color: var(--gg-logo);
	background: none;
	border: 2px solid rgba(128, 156, 187, .25);
	border-radius: 4px;
	cursor: pointer;
	transition: border-color .2s ease;
}

.themeToggle:hover {
	border-color: rgba(128, 156, 187, .5);
}

.themeToggle svg {
	flex: none;
}

.themeToggle__moon {
	display: var(--gg-toggle-moon);
}

.themeToggle__sun {
	display: var(--gg-toggle-sun);
}

/* Language selector — mirrors the landing page's dropdown (styles.sss .langSelector*)
   so the same control appears here, backed by the same `lang` cookie */

.langSelector {
	position: relative;
}

.langSelectorBtn {
	display: flex;
	align-items: center;
	padding: 13px 12px;
	background: none;
	border: 2px solid rgba(128, 156, 187, .25);
	border-radius: 4px;
	cursor: pointer;
}

.langSelectorBtn__flag {
	flex: none;
	display: flex;
	width: 20px;
	height: 14px;
}

.langSelectorBtn__flag svg {
	width: 20px;
	height: 14px;
}

.langSelectorBtn__arrowWrap {
	flex: none;
	display: flex;
	margin: 0 0 0 9px;
	color: var(--gg-logo);
}

.langSelectorBtn__arrowWrap svg {
	fill: currentColor;
	transform: rotate(180deg);
	transition: transform .2s ease;
}

.langSelector_open .langSelectorBtn__arrowWrap svg {
	transform: rotate(0);
}

.langSelectorBody {
	position: absolute;
	top: 100%;
	right: 0;
	min-width: 150px;
	margin: 8px 0 0;
	background-color: var(--gg-menu);
	border-radius: 4px;
	box-shadow: 0 2px 4px var(--gg-menu-shadow);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
	z-index: 20;
}

.langSelector_open .langSelectorBody {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.langSelectorBody__item + .langSelectorBody__item {
	border-top: 1px solid var(--gg-menu-rule);
}

.langSelectorLang {
	display: flex;
	align-items: center;
	width: 100%;
	padding: 12px;
	background-color: transparent;
	border: 0;
	font-family: inherit;
	font-size: 14px;
	color: var(--gg-logo);
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease;
}

.langSelectorBody__item:first-child .langSelectorLang {
	border-radius: 4px 4px 0 0;
}

.langSelectorBody__item:last-child .langSelectorLang {
	border-radius: 0 0 4px 4px;
}

.langSelectorLang:not(.langSelectorLang_active):hover,
.langSelectorLang_active {
	background-color: var(--gg-button);
	color: #fff;
}

.langSelectorLang__flag {
	flex: none;
	display: flex;
	width: 20px;
	height: 14px;
}

.langSelectorLang__flag svg {
	width: 20px;
	height: 14px;
}

.langSelectorLang__name {
	margin: 0 0 0 10px;
	white-space: nowrap;
}

/* Page shell */

.page {
	padding: 10px 0 60px;
}

.breadcrumbs {
	max-width: var(--gg-reading);
	margin: 0 auto 18px;
	font-size: 14px;
	color: var(--gg-ink-muted);
}

.breadcrumbs a {
	color: var(--gg-ink-muted);
}

.breadcrumbs a:hover {
	color: var(--gg-accent);
}

.breadcrumbs__sep {
	margin: 0 8px;
	opacity: .5;
}

/* The current topic, which can be a full article title — allowed to wrap rather than
   overflow the container on narrow screens */
.breadcrumbs__current {
	overflow-wrap: anywhere;
}

.card {
	max-width: var(--gg-reading);
	margin: 0 auto;
	padding: 34px 30px 40px;
	background-color: var(--gg-card);
	border-radius: 14px;
	box-shadow: 0 6px 28px var(--gg-card-shadow);
}

@media (min-width: 768px) {
	.card {
		padding: 46px 54px 54px;
	}
}

.pageTitle {
	margin: 0 0 10px;
	font-size: 28px;
	font-weight: 600;
	line-height: 1.25;
	color: var(--gg-accent);
}

@media (min-width: 768px) {
	.pageTitle {
		font-size: 34px;
	}
}

.pageMeta {
	margin: 0 0 26px;
	font-size: 13px;
	color: var(--gg-ink-muted);
}

/* Article body — the tags the ingest allow-list can emit */

.prose {
	font-size: 16px;
}

.prose > *:first-child {
	margin-top: 0;
}

.prose > *:last-child {
	margin-bottom: 0;
}

.prose p {
	margin: 0 0 16px;
}

.prose a {
	color: var(--gg-prose-link);
	text-decoration: underline;
	text-decoration-color: var(--gg-prose-link-line);
	text-underline-offset: 2px;
	overflow-wrap: anywhere;
}

.prose a:hover {
	color: var(--gg-prose-link-hover);
	text-decoration-color: currentColor;
}

.prose strong {
	font-weight: 600;
}

.prose h2,
.prose h3,
.prose h4 {
	margin: 32px 0 12px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--gg-accent);
}

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

.prose h3 {
	font-size: 20px;
}

.prose h4 {
	font-size: 18px;
}

.prose ol,
.prose ul {
	margin: 0 0 16px;
	padding-left: 24px;
}

.prose li {
	margin: 0 0 8px;
}

.prose code {
	padding: 2px 6px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .9em;
	background-color: var(--gg-code);
	border-radius: 4px;
}

.prose pre {
	margin: 0 0 16px;
	padding: 14px 16px;
	overflow-x: auto;
	background-color: var(--gg-code);
	border-radius: 8px;
}

.prose pre code {
	padding: 0;
	background: none;
}

/* Screenshots keep their intrinsic width/height attributes, so reserving space via
   aspect-ratio costs nothing and stops the page jumping as they load */
.prose figure {
	margin: 26px 0;
}

.prose img {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 0 auto;
	border: 1px solid var(--gg-rule);
	border-radius: 8px;
}

.prose figcaption {
	margin: 10px 0 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--gg-ink-muted);
	text-align: center;
}

/* Article footer — language switch */

.articleFooter {
	max-width: var(--gg-reading);
	margin: 22px auto 0;
	font-size: 14px;
	text-align: center;
	color: var(--gg-ink-muted);
}

.articleFooter a {
	color: var(--gg-accent);
	font-weight: 500;
}

/* Index */

.indexIntro {
	margin: 0 0 22px;
	color: var(--gg-ink-muted);
}

.searchBox {
	margin: 0 0 8px;
}

.searchBox__input {
	width: 100%;
	padding: 13px 16px;
	font-family: inherit;
	font-size: 15px;
	color: var(--gg-ink);
	background-color: var(--gg-field);
	border: 2px solid rgba(128, 156, 187, .25);
	border-radius: 8px;
	transition: border-color .2s ease, background-color .2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.searchBox__input::placeholder {
	color: var(--gg-field-placeholder);
}

.searchBox__input:focus {
	outline: none;
	background-color: var(--gg-field-focus);
	border-color: var(--gg-logo);
}

.articleList {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* border-bottom on every row rather than a sibling selector, so rows disappearing to the
   language filter or the search cannot leave a stray rule behind */
.articleList__item {
	border-bottom: 1px solid var(--gg-rule);
}

.articleList__item[hidden] {
	display: none;
}

/* Language filtering
   The early inline script stamps data-content-lang on <html> before the body is parsed, so
   the list is already correct on first paint. With scripting off no attribute is set and
   every article stays listed, which is also what crawlers see */
html[data-content-lang="en"] .articleList__item[data-lang="ru"],
html[data-content-lang="ru"] .articleList__item[data-lang="en"] {
	display: none;
}

.articleLink {
	display: block;
	padding: 18px 0;
}

/* Preview — the article's lead screenshot, as the old channel showed per post.
   Sitting below the text it needs no fixed box, so there is nothing to letterbox against
   and nothing to crop: the width/height attributes carry the real aspect ratio and the
   height cap just scales it down. These are pictures of error dialogs, and both cropping
   and letterboxing made them worse */
.articleLink__preview {
	display: block;
	margin: 14px 0 0;
}

.articleLink__preview img {
	display: block;
	/* Bounded by both edges, never upscaled: auto sizing plus the two maxima keeps the
	   real aspect ratio, so a tall screenshot uses the height and a wide one the width */
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 340px;
	border: 1px solid var(--gg-rule);
	border-radius: 6px;
}

.articleLink__preview_empty {
	display: none;
}

.articleLink__body {
	display: block;
}

.articleLink__title {
	display: block;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--gg-accent);
}

.articleLink__description {
	display: block;
	margin: 6px 0 0;
	font-size: 14px;
	line-height: 1.5;
	color: var(--gg-ink-muted);
}

/* Less vertical room on a phone, so the screenshots take a little less of it */
@media (max-width: 560px) {
	.articleLink__preview img {
		max-height: 200px;
	}
}

/* "Help topic not found" banner on the 404 document */
.notFound {
	max-width: var(--gg-reading);
	margin: 0 auto 16px;
	padding: 14px 18px;
	font-size: 15px;
	font-weight: 500;
	color: var(--gg-warn-ink);
	background-color: var(--gg-warn-bg);
	border: 1px solid var(--gg-warn-rule);
	border-radius: 10px;
}

.searchEmpty {
	margin: 22px 0 0;
	color: var(--gg-ink-muted);
	text-align: center;
}

.searchEmpty[hidden] {
	display: none;
}

/* Share row */

.shareRow {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px 12px;
	max-width: var(--gg-reading);
	margin: 20px auto 0;
}

.shareRow__label {
	font-size: 14px;
	color: var(--gg-ink-muted);
}

.shareRow__items {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.shareRow__item {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	color: #fff;
	background-color: var(--gg-logo);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: transform .15s ease, filter .2s ease;
}

.shareRow__item:hover {
	color: #fff;
	transform: translateY(-2px);
	filter: brightness(1.08);
}

.shareRow__item svg {
	fill: currentColor;
}

.shareRow__item_telegram {
	background-color: #2aabee;
}

.shareRow__item_vk {
	background-color: #0077ff;
}

.shareRow__item_x {
	background-color: #000;
}

.shareRow__item_facebook {
	background-color: #1877f2;
}

.shareRow__item_copy {
	background-color: var(--gg-button);
}

.shareRow__copied {
	font-size: 13px;
	font-weight: 500;
	color: var(--gg-success);
}

.shareRow__copied[hidden] {
	display: none;
}

/* Support call to action */

.support {
	max-width: var(--gg-reading);
	margin: 26px auto 0;
	text-align: center;
}

.support__hint {
	margin: 0 0 12px;
	font-size: 14px;
	color: var(--gg-ink-muted);
}

.supportButton {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 28px;
	font-size: 15px;
	font-weight: 600;
	color: #fff;
	background-color: var(--gg-button);
	border-radius: 8px;
	box-shadow: 0 4px 14px var(--gg-button-shadow);
	transition: background-color .2s ease, transform .2s ease;
}

.supportButton:hover {
	color: #fff;
	background-color: var(--gg-button-hover);
	transform: translateY(-1px);
}

/* Footer */

.siteFooter {
	padding: 30px 0 40px;
	font-size: 13px;
	color: var(--gg-ink-muted);
	text-align: center;
}
