/* Theme toggle — matches Go back button (instance-9) */
.theme-toggle {
	position: fixed;
	top: max(1rem, env(safe-area-inset-top, 0px));
	right: max(1rem, env(safe-area-inset-right, 0px));
	z-index: 100001;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--kg-muted);
	font-family: "Helvetica", arial, sans-serif;
	font-size: 0.75em;
	line-height: 1;
	font-weight: 400;
	text-decoration: none;
	cursor: pointer;
	transition: color 0.2s ease;
}

.theme-toggle:hover {
	color: var(--kg-muted-hover);
}

:root {
	--kg-muted: rgba(0, 0, 0, 0.459);
	--kg-muted-hover: #000000;
	--kg-link-hover: rgba(0, 0, 0, 0.671);
}

html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
	transition: none !important;
}

/* Muted secondary text — same rendered grey as light mode, no alpha stacking */
[data-theme="dark"] .text-component.instance-9,
[data-theme="dark"] .text-component.instance-2,
[data-theme="dark"] .text-component.instance-4,
[data-theme="dark"] .text-component.instance-11,
[data-theme="dark"] .text-component.instance-16,
[data-theme="dark"] .text-component.instance-17,
[data-theme="dark"] .text-component.instance-28,
[data-theme="dark"] .text-component.instance-33,
[data-theme="dark"] .text-component.instance-36,
[data-theme="pink"] .text-component.instance-9,
[data-theme="pink"] .text-component.instance-2,
[data-theme="pink"] .text-component.instance-4,
[data-theme="pink"] .text-component.instance-11,
[data-theme="pink"] .text-component.instance-16,
[data-theme="pink"] .text-component.instance-17,
[data-theme="pink"] .text-component.instance-28,
[data-theme="pink"] .text-component.instance-33,
[data-theme="pink"] .text-component.instance-36 {
	color: var(--kg-muted);
}

[data-theme="dark"] .text-component.instance-9 a,
[data-theme="dark"] .text-component.instance-9 .blog-filter,
[data-theme="pink"] .text-component.instance-9 a,
[data-theme="pink"] .text-component.instance-9 .blog-filter,
[data-theme="dark"] .blog-copy-link,
[data-theme="pink"] .blog-copy-link {
	color: var(--kg-muted);
}

/* Dark mode */
[data-theme="dark"] {
	color-scheme: dark;
	--kg-muted: #8a8a8a;
	--kg-muted-hover: #efefef;
	--kg-link-hover: #afafaf;
}

[data-theme="dark"] body {
	background-color: #0c0c0c;
}

[data-theme="dark"] .text-component,
[data-theme="dark"] .text-component.style-1,
[data-theme="dark"] .text-component.style-2,
[data-theme="dark"] .text-component.style-3 {
	color: #efefef;
}

[data-theme="dark"] .text-component a:hover,
[data-theme="dark"] .links-component > li > a:hover {
	color: var(--kg-link-hover) !important;
}

[data-theme="dark"] .text-component.instance-9 a:hover,
[data-theme="dark"] .blog-filter:hover,
[data-theme="dark"] .blog-filter.active,
[data-theme="dark"] .blog-copy-link:hover,
[data-theme="dark"] .social-more-btn:hover {
	color: var(--kg-muted-hover) !important;
}

[data-theme="dark"] .links-component.style-1 > li > a,
[data-theme="dark"] .links-component.instance-1 > li > a,
[data-theme="dark"] .links-component.instance-2 > li > a,
[data-theme="dark"] .links-component.instance-3 > li > a {
	color: var(--kg-muted);
}

[data-theme="dark"] .links-component.style-1 > li > a:hover,
[data-theme="dark"] .links-component.instance-1 > li > a:hover,
[data-theme="dark"] .links-component.instance-2 > li > a:hover,
[data-theme="dark"] .links-component.instance-3 > li > a:hover {
	color: var(--kg-muted-hover) !important;
}

[data-theme="dark"] .release-type,
[data-theme="dark"] .social-more-btn {
	color: var(--kg-muted);
}

[data-theme="dark"] .social-more-btn:hover {
	color: var(--kg-muted-hover) !important;
}

[data-theme="dark"] .image-component.style-1 > .frame {
	border-color: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] .image-component .frame[style*="border"],
[data-theme="dark"] .video-component .frame[style*="border"] {
	border-color: rgba(255, 255, 255, 0.15) !important;
}

[data-theme="dark"] .video-component.instance-2 > .frame,
[data-theme="dark"] .video-component.instance-3 > .frame {
	background-color: #161616;
}

[data-theme="dark"] .container-component.instance-23 > .wrapper {
	border-color: rgba(255, 255, 255, 0.28);
}

[data-theme="dark"] .divider-component::before {
	filter: invert(1) opacity(0.35);
}

[data-theme="dark"] code,
[data-theme="dark"] mark {
	background-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] spoiler-text {
	background-color: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] spoiler-text.active {
	color: #0c0c0c;
}

[data-theme="dark"] .deferred::before {
	filter: invert(1);
}

/* Pink mode */
[data-theme="pink"] {
	color-scheme: dark;
	--kg-muted: #8a8a8a;
	--kg-muted-hover: #ffffff;
	--kg-link-hover: #ffabe2;
}

[data-theme="pink"] body {
	background-color: #ff00a7;
}

[data-theme="pink"] .text-component,
[data-theme="pink"] .text-component.style-1,
[data-theme="pink"] .text-component.style-2,
[data-theme="pink"] .text-component.style-3 {
	color: #ffffff;
}

[data-theme="pink"] .text-component a:hover,
[data-theme="pink"] .links-component > li > a:hover {
	color: var(--kg-link-hover) !important;
}

[data-theme="pink"] .text-component.instance-9 a:hover,
[data-theme="pink"] .blog-filter:hover,
[data-theme="pink"] .blog-filter.active,
[data-theme="pink"] .blog-copy-link:hover,
[data-theme="pink"] .social-more-btn:hover {
	color: var(--kg-muted-hover) !important;
}

[data-theme="pink"] .links-component.style-1 > li > a,
[data-theme="pink"] .links-component.instance-1 > li > a,
[data-theme="pink"] .links-component.instance-2 > li > a,
[data-theme="pink"] .links-component.instance-3 > li > a {
	color: var(--kg-muted);
}

[data-theme="pink"] .links-component.style-1 > li > a:hover,
[data-theme="pink"] .links-component.instance-1 > li > a:hover,
[data-theme="pink"] .links-component.instance-2 > li > a:hover,
[data-theme="pink"] .links-component.instance-3 > li > a:hover {
	color: var(--kg-muted-hover) !important;
}

[data-theme="pink"] .release-type,
[data-theme="pink"] .social-more-btn {
	color: var(--kg-muted);
}

[data-theme="pink"] .social-more-btn:hover {
	color: var(--kg-muted-hover) !important;
}

[data-theme="pink"] .image-component.instance-7 > .frame {
	border: none;
	overflow: visible;
	position: relative;
}

[data-theme="pink"] .image-component.instance-7 > .frame::after {
	content: '';
	position: absolute;
	inset: -2px;
	border: 1px solid rgba(255, 255, 255, 0.3);
	pointer-events: none;
}

[data-theme="pink"] .image-component.style-1 > .frame {
	border-color: rgba(255, 255, 255, 0.35);
}

[data-theme="pink"] .image-component .frame[style*="border"],
[data-theme="pink"] .video-component .frame[style*="border"] {
	border-color: rgba(255, 255, 255, 0.3) !important;
}

[data-theme="pink"] .video-component.instance-2 > .frame,
[data-theme="pink"] .video-component.instance-3 > .frame {
	background-color: #d9008f;
}

[data-theme="pink"] .container-component.instance-23 > .wrapper {
	border-color: rgba(255, 255, 255, 0.45);
}

[data-theme="pink"] .divider-component::before {
	filter: invert(1) opacity(0.45);
}

[data-theme="pink"] code,
[data-theme="pink"] mark {
	background-color: rgba(255, 255, 255, 0.18);
}

[data-theme="pink"] spoiler-text {
	background-color: rgba(255, 255, 255, 0.25);
}

[data-theme="pink"] spoiler-text.active {
	color: #ff00a7;
}

[data-theme="pink"] .deferred::before {
	filter: invert(1);
}
