@layer reset, vars, theme, typography, layout, components, utilities;
/** CSS reset **/
@layer reset {
	/* simpler sizing */
	*, *::before, *::after {
		box-sizing: border-box;
	}

	/* remove default margin */
	* {
		margin: 0;
	}

	/* enable keyword animations */
	@media (prefers-reduced-motion: no-preference) {
		html {
			interpolate-size: allow-keywords;
		}
	}

	/* color mode user-agent styles */
	html {
		color-scheme: light;
	}

	body {
		/* min body height */
		min-height: 100svh;
		/* default to system fonts */
		font-family: system-ui, sans-serif;
		/* improve text rendering & line-sizing */
		-webkit-font-smoothing: antialiased;
		text-rendering: optimizeSpeed;
		line-height: 1.5;
		hanging-punctuation: first last;
	}

	/* improve media controls */
	img, svg, video, canvas, audio, iframe, embed, object {
		/* responsive embeds, maintain aspect ratios */
		display: block;
		max-width: 100%;
		vertical-align: middle;
		shape-margin: 1rem;
	}
	img, svg, video, canvas {
		height: auto;
	}
	audio:not([controls]) { display: none; }
	audio { width: 100%; }
	picture { display: contents; }
	source { display: none; }

	/* spacing & fallback tweaks*/
	img, picture, video {
		font-style: italic;
		text-align: center;
		background-repeat: no-repeat;
		background-size: cover;
	}

	/* inherit fonts for form controls */
	input, button, textarea, select {
		font: inherit;
	}

	/* legacy browser cleanup */
	img { border-style: none; }
	svg { overflow: hidden; }
	article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section {
		display: block;
	}
	[type='checkbox'], [type='radio'] {
		box-sizing: border-box;
		padding: 0;
	}

	/* cleaner type layouts */
	h1, h2, h3, h4, h5, h6 {
		text-wrap: balance;
		/* avoid text overflows */
		overflow-wrap: break-word;
		line-height: initial;
	}
	p {
		text-wrap: pretty;
	}

	/* switch to em units for headings */
	h1 { font-size: 2em; }
	h2 { font-size: 1.5em; }
	h3 { font-size: 1.17em; }
	h4 { font-size: 1.00em; }
	h5 { font-size: 0.83em; }
	h6 { font-size: 0.67em; }

	/* keep h1 margins consistent, even when nested */
	h1 {
		margin: 0.67em 0;
	}

	/* don't overflow <pre>s by default */
	pre { white-space: pre-wrap; }

	/* <a> elements that don't have a class get default styles */
	a:not([class]) {
		text-decoration-skip-ink: auto;
	}

	/* uniform baseline horizontal rule */
	hr {
		border-style: solid;
		border-width: 1px 0 0;
		color: inherit;
		height: 0;
		overflow: visible;
	}

	/* table improvements */
	table {
		border-collapse: collapse;
	}

	th, td {
		border: 1px solid;
		vertical-align: baseline;
	}

	th, caption {
		text-align: start;
	}

	thead th {
		vertical-align: bottom;
	}

	th, td, caption {
		padding: 0.25rem 0.75rem;
	}


	/* animate & pad same-page navigation */
	@media (prefers-reduced-motion: no-preference) {
		html {
			scroll-behavior: smooth;
		}
		:has(:target) {
			scroll-padding-top: 3rem;
		}
	}

	/* ignore children for <a> & <button> event listeners */
	:is(a, button) * {
		pointer-events: none;
	}

	/* maintain 'hidden' behaviour when overriding 'display' values */
	[hidden] {
		display: none;
	}

	/* remove list styles and default spacing on ul & ol elements with a 'list' role, which suggests default styling will be removed */
	ul[role='list'],
	ol[role='list'] {
		list-style: none;
		padding: 0;

		& li {
			margin: 0;
		}
	}
}

/**** Base Variables ****/
@layer variables {
    :where(:root) {
		/* Text & Spacing Scales */
		--scale-factor: 1.5;
		--font-step--2: clamp(0.64rem,  9.431px + 0.263vw, 0.8rem);
		--font-step--1: clamp(0.8rem,  11.789px + 0.263vw, 1rem);
		--font-step-0: clamp(1rem,  14.736px + 0.263vw, 1.25rem);
		--font-step-1: clamp(1.25rem,  18.42px + 0.263vw, 1.563rem);
		--font-step-2: clamp(1.563rem,  23.025px + 0.263vw, 1.953rem);
		--font-step-3: clamp(1.953rem,  28.781px + 0.263vw, 2.441rem);
		--font-step-4: clamp(2.441rem,  35.977px + 0.263vw, 3.052rem);
		--font-step-5: clamp(3.052rem,  44.971px + 0.263vw, 3.815rem);

		--space-3xs: clamp(0.25rem, 0.2369rem + 0.0525vw, 0.3125rem);
		--space-2xs: clamp(0.5rem, 0.4737rem + 0.105vw, 0.625rem);
		--space-xs: clamp(0.75rem, 0.7106rem + 0.1576vw, 0.9375rem);
		--space-s: clamp(1rem, 0.9475rem + 0.2101vw, 1.25rem);
		--space-m: clamp(1.5rem, 1.4212rem + 0.3151vw, 1.875rem);
		--space-l: clamp(2rem, 1.895rem + 0.4202vw, 2.5rem);
		--space-xl: clamp(3rem, 2.8424rem + 0.6303vw, 3.75rem);
		--space-2xl: clamp(4rem, 3.7899rem + 0.8403vw, 5rem);
		--space-3xl: clamp(6rem, 5.6849rem + 1.2605vw, 7.5rem);
	}
}
/**** Fonts ****/
/* Suez One - display font (match game font) */
@font-face {
	font-family: 'Suez One';
	font-style: normal;
	src: url('/assets/suezone-v14-latin-regular.woff2') format('woff2');
	font-weight: 400;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Montserrat - body */
@font-face {
	font-family: 'Montserrat';
	src: url('/assets/montserrat_20240519_variable.woff2') format('woff2');
	font-style: normal;
	font-weight: 100 900; /* variable weight range */
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: 'Montserrat';
	src: url('/assets/montserrat-italic_20240519_variable.woff2') format('woff2');
	font-style: italic;
	font-weight: 100 900; /* variable weight range */
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@layer variables {
    :where(:root) {
		--font-base: Montserrat, Avenir, Corbel, 'URW Gothic', source-sans-pro, system-ui, sans-serif;
		--font-display: 'Suez One', Optima, Candara, 'Noto Sans', source-sans-pro, system-ui, sans-serif;;
		/* --font-display: Optima, Candara, 'Noto Sans', source-sans-pro, sans-serif; */
		--font-mono: ui-monospace, monospace;
	}
}
/**** Theme ****/
@layer theme {
	:where(:root) {
		--brand-palette-indigo-neutral: #1c205a;
		--brand-palette-indigo-lighter: #242975;
		--brand-palette-indigo-darker: #13163e;

		--brand-palette-gold-neutral: #d5934b;
		--brand-palette-gold-lighter: #ffbf61;
		--brand-palette-gold-darker: #956634;

		--brand-palette-icy-neutral: #d9e7f8;
		--brand-palette-icy-lighter: #e9f1fb;
		--brand-palette-icy-darker: #c9d5e3;

		--brand-palette-magenta-neutral: #cd81a3;
		--brand-palette-magenta-lighter: #ffa7d3;
		--brand-palette-magenta-darker: #8f5a72;

		--brand-palette-cosmic-neutral: #492861;
		--brand-palette-cosmic-lighter: #70418d;
		--brand-palette-cosmic-darker: #2d123c;

		--brand-logo-yellow: #f6bb43;

		--color-orange: #e56509;

		--color-bg-start: var(--brand-palette-indigo-neutral);
		--color-bg-end: var(--brand-palette-indigo-darker);
		--color-bg-shadow: #090d35;

		--color-text-base: white;
		--color-text-bold: color-mix(in oklab, var(--color-text-base) 90%, var(--color-bg-end));
		--color-text-body: color-mix(in oklab, var(--color-text-base) 85%, var(--color-bg-end));

		--border-size-s: 1px;
		--border-size-m: 2px;
		--border-size-l: 4px;

		--focus-outline: 5px solid var(--color-focused, currentColor);
		--focus-offset: 3px;
		--focus-radius: 3px;

		--bg-gradient-1: radial-gradient(
			ellipse at center 150%,
			var(--brand-palette-indigo-neutral),
			var(--brand-palette-indigo-darker) 80%);
		--bg-gradient-1h: radial-gradient(
			ellipse at center 150%,
			var(--brand-palette-indigo-neutral),
			var(--brand-palette-indigo-lighter) 80%);
	}
	html {
		background-color: var(--brand-palette-indigo-darker);
	}

	body {
		/* background: var(--color-background); */
		background-image:
			radial-gradient(transparent 60%, var(--color-bg-shadow)),
			linear-gradient(to right, var(--color-bg-end), var(--color-bg-start) 30vw 70vw, var(--color-bg-end));
		background-size: cover;
		background-attachment: fixed;
	}

	body,
	#mobile-menu {
		color: var(--color-text-body);
	}

	#mobile-menu {
		background-color: var(--color-bg-shadow);
		border: none;

		& section[aria-label="Guides"] {
			& summary {
				border-block-end: 1px solid currentColor;
			}
		}
	}

	#mobile-menu-open,
	#mobile-menu-close,
	#card-viewer-close {
		fill: currentColor;
		background-color: transparent;
		border: 1px solid transparent;
		border-radius: 5px;

		&:where(:hover,:focus,:focus-within) {
			background-color: var(--brand-palette-indigo-lighter);
			border-color: currentColor;
		}

	}
	#card-viewer-close {
		background-color: var(--color-bg-shadow);
		border-color: currentColor;
	}

	strong, .bold,
	button:not([class]), .button {
		color: var(--color-text-bold);
	}

	h1, h2, h3, h4, .display {
		color: var(--color-text-base);
	}

	::selection {
		background-color: var(--brand-palette-gold-lighter);
		color: black;
		text-shadow: none;
	}


	/* large outlines for keyboard navigation */
    #site-home, a:not([class]), a.button,
	#mobile-menu-open, #mobile-menu-close,
	#card-viewer-close, summary,
	.wordmark:focus-visible,
	.big-focus {
		outline-offset: var(--focus-offset);
		border-radius: var(--focus-radius);

		&:focus-visible {
			outline: var(--focus-outline);
		}
	}
    [role="list"] > li:has(> a:only-child:focus-visible),
    :is(h1, h2, h3, h4):has(> a:focus-visible),
    :is(h1, h2, h3, h4):has(> q > a:focus-visible) {
		width: fit-content;
		height: fit-content;
		outline: var(--focus-outline);
		outline-offset: var(--focus-offset);
		border-radius: var(--focus-radius);
		border-color: transparent !important;

		& > a {
			outline: none !important;
		}
	}

	body > :not(#page-header, #page-footer, #mobile-menu) a:not([class]),
	a.underline-decorate {
		--underline-color-start: var(--color-text-body);
		--underline-color-end: to right, var(--brand-palette-gold-lighter) 80%, var(--color-orange);
		--underline-size: var(--border-size-s);
		text-decoration: none;
		padding-block-end: 0.1lh;
		background:
			linear-gradient(var(--underline-color-start)),
    		linear-gradient(var(--underline-color-end));
		background-size: 100% var(--underline-size), 0 var(--underline-size);
		background-position: 100% 100%, 0 100%;
		background-repeat: no-repeat;
  		transition: background-size .2s ease-in-out;

		&:where(:hover, :focus) {
			background-size: 0 var(--underline-size), 100% var(--underline-size);
		}

		:is(h1, h2, h3, h4) & {
			--underline-size: .1ch;
		}
	}

	:where(#page-header, #mobile-menu) > nav,
	.sidebar-layout nav[aria-label="Tools"] {
		& a:not(.main-site-link):where(:hover, :focus, :focus-within) {
			background-color: var(--color-bg-shadow);
		}
	}

	.galaxy-border,
	lite-youtube {
		border: 1px solid var(--brand-palette-gold-lighter);
	}

	nav[aria-label="Guides"],
	#mobile-menu section[aria-label="Guides"] {
		& a {
			--underline-color-start: transparent;
		}
	}


	nav[aria-label="Guides"] details > summary:where(:hover, :focus, :focus-within) {
		background-color: var(--brand-palette-indigo-lighter);
	}
}
/**** Typography ****/
@layer typography {
	:where(:root) {
		/* Semantic Text & Spacing */
		--text-size-small: var(--font-step--1);
		--text-size-base: var(--font-step-0);
		--text-size-large: var(--font-step-1);
		--text-size-h3: var(--font-step-1);
		--text-size-h2: var(--font-step-2);
		--text-size-h1: var(--font-step-3);
		--text-size-massive: var(--font-step-4);

		--line-height-xs: 1.2;
		--line-height-s: 1.4;
		--line-height-m: 1.5;
		--line-height-l: 1.7;
	}

	body {
		font-family: var(--font-base);
        font-size: var(--text-size-base);
		font-weight: 450;
		line-height: var(--line-height-l);
	}

	strong, .bold { font-weight: 650; }
	em, .italic { font-style: italic; }

	h1, h2, h3, h4,
	hgroup, .display,
	button:not([class]), .button {
		font-family: var(--font-display);
		/* This specific display font only has one weight,
		 * always render @ 100 to avoid the browser trying to add thickness
		 */
		 font-weight: 100;
	}

	h1, .h1 {
		font-size: var(--text-size-h1);
		/* font-weight: 800; */
	}
    h2, .h2 {
		font-size: var(--text-size-h2);
		/* font-weight: 750; */
	}
    h3, .h3 {
		font-size: var(--text-size-h3);
		/* font-weight: 725; */
	}
    h4, .h4 {
		font-size: var(--text-size-large);
		/* font-weight: 700; */
	}
	h1, h2, h3, h4, button:not([class]), .button { line-height: 1.1; }

	h1, .h1,
	h2, .h2 {
		/* -webkit-text-stroke: 0.2em black; */
		/* paint-order: stroke fill; */
		text-shadow: 0.1em 0.1em black;
	}

	table:not([class]) {

		& thead {
			font-weight: 600;
			text-transform: uppercase;
			background-color: hsl(0 0% 100% / .15);
		}

		& tbody tr:nth-child(2n) {
			background-color: hsl(0 0% 100% / .05);
		}
	}

	caption {
		font-size: var(--text-size-large);
		font-weight: 500;
	}

	dd, ul, ol {
		padding-inline-start: var(--space-l);
	}

	:is(ul, ol) :is(ul, ol) {
		padding-inline-start: var(--space-m);
	}

	/* style for ~plain~ unordered lists */
	ul:not([class]) li {
		padding-inline-start: var(--space-xs);
	}

	/* style marker for ordered lists */
	ol {
		list-style-type: decimal;

		& > li > ol {
			list-style-type: lower-roman;

			& > li > ol {
				list-style-type: lower-latin;

				& ::marker {
					font-family: var(--font-mono);
				}
			}
		}
	}

	:is(ul, ol)[role='list'] {
		&, & > li {
			padding-inline-start: 0;
		}
	}

	blockquote:not([class]) {
		padding-inline: var(--space-s) 0;
		padding-block: var(--space-2xs);
		border-inline-start: var(--space-2xs) solid;
		font-style: italic;
		font-size: var(--text-size-large);
		font-weight: 300;

		& em {
			font-style: normal;
		}

		& cite {
			display: block;
			text-align: right;
		}
	}

	a {
		color: currentColor;

		&:not([class]) {
			text-decoration-color: var(--color-primary, currentColor);
			text-decoration-thickness: 0.3ex;
			text-underline-offset: 0.3ex;
		}
	}

	.flow,
	.flow hgroup {
		& h1 { margin-block-end: 0; }

		& > * + *,
		& :is(ul, ol, td) > * + *,
		& li > :is(ul, ol),
		& > picture img {
			margin-block-start: var(--flow-space, 1lh);
		}

		& :is(h1, h2, h3, hgroup, blockquote),
		& hgroup + * {
			--flow-space: var(--space-l);
		}

		& :is(h1, h2, h3) + * {
			--flow-space: var(--space-xs);
		}

		& :is(ul, ol) > *  {
			--flow-space: var(--space-3xs);
		}
	}

	button:not([class]), .button,
	.trim-text {
		text-box-edge: cap alphabetic;
		text-box-trim: trim-both;
	}

	:where(#page-header, #page-footer, #mobile-menu, nav[aria-label="Tools"]) a {
		/* --hitbox-padding: var(--space-xs); */
		/* padding: var(--hitbox-padding); */
		height: fit-content;
		text-box-edge: text;
		text-box-trim: trim-both;

		font-family: var(--font-base);
		font-size: var(--text-size-small);
		text-transform: uppercase;
		font-weight: 600;

		text-decoration: none;
	}

	#mobile-menu {
		& summary,
		& .site-nav a {
			font-size: var(--text-size-large);
		}
		& details a {
			font-size: var(--text-size-base);
		}
		& a {
			font-weight: 450;
		}

		& section[aria-label="Guides"] {
			& > a {
				background-color: var(--color-bg-shadow);
			}
		}
	}
	nav[aria-label="Guides"],
	#mobile-menu section[aria-label="Guides"] {
		& a [aria-current="page"] {
			font-style: italic;
		}
		& details {
			& > summary {
				font-family: var(--font-display);
				user-select: none;
			}
		}
	}

	nav[aria-label="Guides"],
	#page-footer .cr {
		font-size: var(--text-size-small);
	}
}
/**** Layout ****/
@layer layout {
	:root {
		--gutter: clamp(16px, 11vw - 50px, 60px);
		--__article-max-width: 1000px;
		--__content-max-width: 1600px;
		--__full-width: calc(100vw - (var(--gutter) * 2));

		--article-width: min(var(--__article-max-width), var(--__full-width));
		--content-width: min(var(--__content-max-width), var(--__full-width));
		--content-side-width: calc( (var(--content-width) - var(--article-width)) / 2);

		scrollbar-gutter: stable;
	}

	body {
		display: grid;
		grid-template-columns:
			var(--gutter)
			[full-width-start]
				1fr
				[content-start]
					var(--content-side-width)
					[article-start]
						var(--article-width)
					[article-end]
					var(--content-side-width)
				[content-end]
				1fr
			[full-width-end]
			var(--gutter);
		grid-template-rows: auto 1fr auto;
		container-type: inline-size;
	}

	/* #page-header, */
	#page-content,
	#page-footer,
	.subgrid {
		display: grid;
		grid-template-columns: subgrid;
		grid-auto-rows: min-content;
	}

	#page-header,
	#page-content,
	#page-footer {
		/* TODO temp fix, not sure why this is breaking overflow on Chrome (scrollbar-related?) */
		grid-column: 2/-2;
		/* grid-column: 1/-1; */
	}

	nav[aria-label="Guides"] {
		grid-column: full-width-start / article-start;
		grid-row: 2;
		/* justify-content: center; */
		height: fit-content;
		margin-block-start: var(--gutter);

		& > ul {
			max-width: max-content;
			margin-right: var(--space-m);
		}

		& details > ul {
			margin-inline-end: 0;
		}
	}

	/* :where(#page-header > *), */
	:where(#page-footer > *),
	:where(#page-content > *),
	:where(#page-content > picture > img) {
		grid-column: content;
	}

	.edge-content > * { grid-column: 1 / -1; }
	.full-content > *  { grid-column: full-width; }
	.content-content > * { grid-column: content; }
	.article-content > * { grid-column: article; }

	.col-edge { grid-column: 1 / -1; }
	.col-full  { grid-column: full-width; }
	.col-content { grid-column: content; }
	.col-article { grid-column: article; }

	#page-header,
	#page-footer {
		padding-block: var(--space-s);
	}

	#page-content {
		padding-block: var(--gutter);
	}

	#page-content > :first-child,
	#page-content > hgroup:first-child > :first-child {
		margin-block-start: 0;
	}

	:where(#page-header, #page-footer, #mobile-menu) nav,
	.sidebar-layout nav[aria-label="Tools"] {
		&,
		& > section,
		& .site-nav {
			display: flex;
			flex-flow: row nowrap;
			gap: var(--space-m);
			align-items: center;
		}
		& .site-nav li {
			display: flex;
			flex-flow: row nowrap;
			flex: 0 0 auto;
		}

		& a,
		& li:has(> a) {
			flex-shrink: 0;
		}

		& a:has(.nav-icon) {
			display: flex;
			flex-flow: row nowrap;
			align-items: center;
			gap: .5ch;
			padding-block: .5ch;
			padding-inline: .5ch 1ch;
		}

		& .nav-icon {
			--size: 1lh;
			flex-shrink: 0;
			display: inline-block;
			height: var(--size);
			width: auto;
			margin-block: calc(var(--size) * -.25);
		}
	}

	#site-home {
		place-content: center;
		flex-shrink: 0;
	}
	:where(#page-header, #page-footer) .site-wordmark {
		height: 30px;
		width: auto;
	}

	#mobile-menu-open,
	#mobile-menu-close,
	#card-viewer-close {
		--size: 1.5em;
		padding: .25lh .5lh;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	#page-header {
		display: flex;
		flex-flow: row wrap;

		& > nav {
			flex-grow: 1;
			justify-content: center;
		}

		& #site-home > .site-wordmark {
			width: auto;
		}
		& #site-home > .nav-icon {
			--size: 2lh;
		}
		& section[aria-label="Main"] {
			justify-content: center;
		}
		& #main-nav-toggle {
			all: unset;
		}
		@media screen and (width >= 1700px) {
			& #mobile-menu-open {
				display: none;
			}
		}
		@media screen and (500px <= width < 1700px) {
			& #site-home {
				margin-inline: auto;
			}
		}
		@media screen and (width < 500px) {
			& > nav {
				justify-content: end;
			}
			& #site-home {
				padding-inline-end: 0;
			}
			& section[aria-label="Main"] {
				display: none;
			}
		}
		@media screen and (width < 370px) {
			& #site-home .site-wordmark {
				display: none;
			}
		}
	}

	:root:has(#mobile-menu[open]) {
		overflow: hidden;
	}

	#mobile-menu {
		width: 100%;
		height: 100svh;
		max-width: unset;
		max-height: unset;
		padding: var(--space-s) var(--gutter);
		/* overflow-x: scroll; */

		/* @media (prefers-reduced-motion: no-preference) {
			animation: slide-in .2s cubic-bezier(.79,.14,.15,.86);
		} */

		& > nav {
			&,
			& > section,
			& .site-nav {
				flex-flow: column;
				/* justify-content: start; */
				/* align-items: center; */
			}

			& #site-home {
				flex-flow: column;
				padding: 0 0 var(--space-m);

				& .nav-icon {
					width: 100%;
					height: auto;
				}
			}
			/* & #mobile-menu-close {
				display: flex;
				justify-content: end;
				align-items: start;
			} */
		}

		& #site-home {
			padding-block-start: 2rem;

			& .site-wordmark {
				width: 240px;
				max-width: 80vw;
				height: auto;
				margin-inline: auto;
			}
		}

		& section[aria-label="Tools"] {
			flex-grow: 1;
			flex-direction: column;
			align-items: center;
			gap: var(--space-l);

			& > li {
				border: solid var(--color-bg-tint);
				border-width: 1px 0;
				padding-block: .5em;
			}
		}
	}
	#page-footer {
		/* display: flex;
		flex-flow: row wrap; */
		gap: var(--space-m);
		justify-content: center;

		& nav {
			justify-content: center;
			align-items: center;
		}
		& .site-nav {
			flex-wrap: wrap;
			justify-content: center;
		}

		/* & .site-nav,
		& .cr {
			justify-content: center;
			align-items: end;
		} */

		& .cr {
			/* flex-grow: 1; */
			display: grid;
			margin-inline: auto;
		}
	}

	nav[aria-label="Guides"],
	#mobile-menu section[aria-label="Guides"] {
		--spacing: .5lh;

		& > ul {
			height: 100%;
			display: flex;
			flex-direction: column;
			gap: var(--space-s);
		}

		& a {
			display: inline-block;
			width: fit-content;
			padding: var(--spacing);
		}

		& details {
			& > summary {
				padding: var(--spacing);
			}
			& > ul {
				margin-inline: var(--space-s) var(--space-m);

				& ul {
					padding-inline-start: 2ch;
				}
			}
		}

		& details::details-content {
			block-size: 0;
			overflow-y: clip;
			transition-property: block-size, content-visibility;
			transition-duration: .5s;
			transition-timing-function: ease-in-out;
			transition-behavior: allow-discrete;
		}

		& details[open]::details-content {
			block-size: auto;
		}
	}

	#mobile-menu section[aria-label="Guides"] {
		& details {
			& > ul > li:first-child {
				margin-block-start: var(--space-2xs);
			}
			& ul a {
				display: block;
				width: 100%;
			}
		}
	}

	table:not([class]) {
		display: block;
		width: max-content;
		max-width: 100%;
		overflow-x: auto;

		&,
		& thead {
			border: 1px solid currentColor;
		}
		& th,
		& td {
			padding: .25rem .75rem;
			vertical-align: top;
		}
		& td {
			padding-block: .75rem;
		}
	}

	#page-content.article > picture img {
		margin-inline: auto;
	}

	figure:has(img):not([role="group"], #card-display, .group-item) {
		inline-size: fit-content;
		margin-inline: auto;

		& figcaption {
			contain: inline-size;
		}
	}
}
@layer components {
	.svg-icon {
		width: var(--size, 1em);
		height: var(--size, 1em);

		&.mono-color {
			fill: currentColor;
		}

		#page-footer & {
			--size: var(--space-s);
		}
	}
	.icon-link {
		--size: 1.5em;
		display: inline-block;
	}
	video.example-gif {
		/* max-width: fit-content; */
		height: auto;
		margin-inline: auto;
	}

	h1#card-name:has(+ card-infobox) {
		text-align: center;
	}
	card-infobox {
		display: flex;
		flex-flow: row wrap;
		justify-content: center;
		align-items: start;
    	column-gap: var(--space-m);

		& table {
			--table-gap: var(--space-xs);
			width: min(100%, 400px);
			display: grid;
			grid-template-columns: auto 1fr;
			margin-block-start: var(--space-m);

			&,
			& tbody {
				row-gap: var(--space-2xs);
			}

			& tbody,
			& tr,
			& th {
				grid-column: 1 / -1;
				display: grid;
				grid-template-columns: subgrid;
			}

			& th, td {
				padding: unset;
				border: none;
			}

			& tbody + tbody {
				border-block-start: 2px solid var(--color-bg-shadow);
				padding-block-start: var(--table-gap);
			}

			& tr {
				column-gap: var(--table-gap);
			}

			& th {
				align-items: center;

				font-weight: 600;
				font-size: var(--text-size-small);
				text-transform: uppercase;

				& > * {
					grid-column: 2;
				}

				& .svg-icon {
					--size: var(--text-size-large);
					grid-column: 1;
				}
			}

			& td {
				grid-column: 2;
				color: var(--color-text-base);
			}

			& .rules td {
				font-style: italic;
			}

			& tr[data-rules="golden"] th::before {
				content: "";
			}

			& td[data-stat-atk] {
				font-family: var(--font-mono);
			}

			& td.rarity-field:has(.gem-icon) {
				display: inline-flex;
				align-items: center;
				gap: .5ch;
			}
		}
	}
	.gem-icon {
		display: inline-block;
	}

	card-infobox[data-character-version]:has(tr[data-rules="golden"]) {
		&:not([data-character-version="golden"]) tr[data-rules="golden"],
		&[data-character-version="golden"] tr[data-rules="default"] {
			opacity: .75;
		}
	}

	.btn-group {
		display: flex;
		flex-flow: row wrap;
		justify-content: center;
		gap: var(--space-3xs);
		margin-block-start: var(--space-m);
		font-family: var(--font-display);

		& label {
			flex: 0 0 max-content;
			padding: .5ch 1ch;

			background-color: var(--brand-palette-cosmic-neutral);
			border-radius: 10px;
			text-box-edge: cap alphabetic;
			text-box-trim: trim-both;

			user-select: none;

			&:has(input:checked) {
				outline: 1px solid currentColor;
			}

			&:active {
				background-color: var(--brand-palette-cosmic-darker);
			}

			&:where(:hover) {
				background-color: var(--brand-palette-cosmic-lighter);
			}

			&:has(input:focus-visible) {
				background-color: var(--brand-palette-cosmic-lighter);
				outline: var(--focus-outline);
				outline-offset: var(--focus-offset);
				border-radius: var(--focus-radius);

				z-index: 1;

				& > input {
					outline: none !important;
				}
			}
		}
		& input[type="radio"] {
			appearance: none;
		}
	}

	.cards-list {
		column-count: auto;
    	column-width: 300px;

		& > li {
			margin-block: 0 .5lh;

			& > a {
				padding-block-start: .5lh;
			}
		}
	}

	lite-youtube {
		margin-inline: auto;
		width: min(720px, 100%);
	}

	galaxy-card:has(> button) {
		display: inline-block;
	}
	galaxy-card > button {
		display: inline-flex;
    	column-gap: .1ch;
		align-items: baseline;
		padding: 0 .2ch 0 0;

		cursor: default;
		color: inherit;
		text-align: start;
		background-color: transparent;
		border: 1px solid transparent;
		text-decoration: 2px underline dotted;
		text-decoration-color: currentColor;
		text-underline-offset: var(--space-3xs);

		& > .svg-icon {
			align-self: center;
		}

		&:where(:hover, :focus, :focus-within) {
			background-color: var(--brand-palette-indigo-lighter);
			border-color: currentColor;
		}

		&:active {
			background-color: var(--brand-palette-indigo-darker);
		}
	}
	#card-viewer {
		color: var(--color-text-base);
		background-color: transparent;
		border: none;

		@supports (bottom: anchor(top)) {
			margin: 0;
			inset: auto;
			bottom: anchor(top);
			position-try-fallbacks: flip-block;
			justify-self: anchor-center;
		}

		@supports not (bottom: anchor(top)) {
			margin: auto;

			&::backdrop {
				background: rgb(0 0 0 / .5);
			}
		}

		& > figure {
			filter: drop-shadow(0px 5px 10px black);
		}

		& figcaption {
			margin-block-start: var(--space-xs);
			padding: var(--space-2xs);
			text-align: center;
			outline: 1px solid var(--brand-palette-gold-lighter);
			background-image: var(--bg-gradient-1);

			& .rules-text {
				font-style: italic;
			}
		}
	}

	figure[role="group"] {
		& > div {
			display: flex;
			flex-flow: row wrap;
			justify-content: space-evenly;
			gap: var(--space-l);

			& > figure {
				/* flex: 1 0 50px; */
				/* outline: 1px solid magenta; */
				margin-inline: unset;
				display: grid;
				justify-items: center;

				.gem-group & {
					flex-basis: 100px;
				}
			}
		}
	}

	body:has(> .sidebar-layout) {
		& nav[aria-label="Guides"] {
			display: none;
		}
		@media (width <= 1700px) {
			.sidebar-layout {
				display: contents;
			}
			& #page-content {
				grid-column: article;
				grid-row: 2;
			}
		}

		@media (width >= 1700px) {
			.sidebar-layout {
				grid-column: 2 / -2;
				grid-row: 2;
				display: grid;
				grid-template-columns: 1fr auto minmax(0px, 1fr);
			}
			& #page-content {
				grid-column: 2;
				grid-row: 1;
				display: block;
				width: var(--__article-max-width);
			}
			/* & #page-content {
				grid-column: article-start / -2;
			} */

			& nav[aria-label="Guides"] {
				grid-column: 1;
				grid-row: 1;
				display: grid;
			}
		}
	}

	#page-content.article {
		--__max-sidebar-offset: -300px;
		--calc-sidebar-offset: clamp(
			var(--__max-sidebar-offset),
			((100vw - var(--__article-max-width)) / -2) + var(--gutter),
			0px

		);

		grid-column: article;
		grid-row: 2;
		display: block;
		container-type: inline-size;

		@container (width >= 800px) {
			& > * {
				max-width: var(--__article-max-width);
			}
		}

		& > .sidebar,
		& > picture.sidebar img,
		& > figure:has(.sidebar) {
			@container (width < 800px) {
				margin-inline: auto;
			}

			@container (width >= 800px) {
					float: right;
					margin-inline-start: var(--space-m);
					margin-block-end: var(--space-m);
					max-width: 40cqi;
			}
			@container (width >= 1000px) { /* >> 1000px == --__article-max-width */
					margin-inline-end: var(--calc-sidebar-offset);
			}
		}


		& figcaption {
			text-align: center;
			font-style: italic;
			font-size: var(--text-size-small);
		}
	}

	.article img.half-col-right:not(.sidebar) {
		float: right;
		max-inline-size: 40vw;
	}
}
@keyframes slide-in {
	from { transform: translateX(var(--slide-in-start, 100%)); }
	to { transform: translateX(0); }
}

@keyframes show {
	from { content-visibility: hidden; }
	to { content-visibility: visible; }
}

@keyframes hide {
	from { content-visibility: visible; }
	to { content-visibility: hidden; }
}

/* View transitions, if browser-supported */
@media (prefers-reduced-motion: no-preference) {
	@view-transition {
		navigation: auto;
	}
}

#page-header { view-transition-name: page-header; }
#page-footer { view-transition-name: page-footer; }
/**** Utilities ****/
@layer utilities {
	.visually-hidden:not(:active, :focus) {
		&, & * {
			border: 0;
			clip-path: rect(0 0 0 0);
			height: 1px;
			margin: -1px;
			overflow: hidden;
			padding: 0;
			position: absolute;
			white-space: nowrap;
			width: 1px;
		}
	}
}
@media print {
	html {
		font-size: 8pt;
	}

	*,
	*::before,
	*::after,
	*:first-letter,
	p:first-line,
	div:first-line,
	blockquote:first-line,
	li:first-line {
		background: transparent !important;
		color: #000 !important;
		box-shadow: none !important;
		text-shadow: none !important;
		font-size: revert;
		overflow: revert;
	}

	body {
		display: block;
	}

	body > *:not(main),
	#page-content:has(> .article-content) > *:not(.article-content),
	.article-content .article-other {
		display: none;
	}

	a,
	a:visited {
		text-decoration: underline;
		color: #000;
	}

	abbr[title]::after {
		content: ' (' attr(title) ')';
	}

	a[href]:not([href^="#"], [href^="javascript:"])::after {
		content: ' (' attr(href) ')';
	}

	pre {
		white-space: pre-wrap !important;
	}

	pre,
	blockquote {
		border: 1px solid #999;
		page-break-inside: avoid;
	}

	tr,
	img {
		page-break-inside: avoid;
	}

	p,
	h2,
	h3,
	h4 {
		orphans: 3;
		widows: 3;
	}

	h2,
	h3,
	h4 {
		page-break-after: avoid;
	}
}

/* Visualize hitboxes */
/* a:where(:hover, :focus, :focus-within) {
	outline: 2px dotted rgba(255, 0, 255, 50%) !important;
} */

/* Visualize errors, messages as variables for in-browser testing */
a[href=""] {
	--error: "href is empty";
	font-weight: bold;
	color: red;
}
