/*
 * 10K Games shell ("Race Day"): page canvas, sticky header, navigation, footer and the page
 * frame. Colours come from the theme.json palette. The platform and the games style their own
 * screens; nothing here targets their classes, except the position of the account menu in the header.
 */

:root {
	--tenk-hairline: color-mix(in srgb, var(--wp--preset--color--contrast) 9%, transparent);
	--tenk-header-height: 4rem;
	color-scheme: dark;
}

html {
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--tenk-header-height) + 1rem);
}

body {
	min-height: 100vh;
	background-color: var(--wp--preset--color--base);
	/* Dust in the floodlight: one warm light source behind the canvas, the only glow of the shell. */
	background-image: radial-gradient(60rem 26rem at 10% -8rem, color-mix(in srgb, var(--wp--preset--color--accent) 13%, transparent), transparent 70%);
	background-repeat: no-repeat;
	font-feature-settings: "cv11", "ss03";
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

::selection {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--on-accent);
}

.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	padding-left: 0;
	padding-right: 0;
}

.wp-site-blocks > * {
	margin-block: 0;
}

a {
	text-underline-offset: 0.2em;
	text-decoration-thickness: 1px;
}

:where(a, button, summary, input, select, textarea):focus-visible {
	outline: 2px solid var(--wp--preset--color--highlight);
	outline-offset: 2px;
}

code,
kbd {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.9em;
}

hr {
	border: 0;
	border-top: 1px solid var(--tenk-hairline);
}

/* ---------- Header ---------- */

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 50;
	border-bottom: 1px solid var(--tenk-hairline);
}

/*
 * The frosted glass sits on a pseudo-element: a backdrop-filter on the header itself would make it
 * the containing block of the fixed mobile navigation overlay.
 */
.wp-site-blocks > header.wp-block-template-part::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: color-mix(in srgb, var(--wp--preset--color--base) 94%, transparent);
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
	.wp-site-blocks > header.wp-block-template-part::before {
		background: color-mix(in srgb, var(--wp--preset--color--base) 72%, transparent);
		-webkit-backdrop-filter: blur(16px) saturate(140%);
		backdrop-filter: blur(16px) saturate(140%);
	}
}

.tenk-header__bar {
	gap: 1rem;
	min-height: var(--tenk-header-height);
}

/* The account menu of the platform is placed behind the navigation; it stays at the right edge. */
.tenk-header__bar > .tenk-nav {
	flex: 1 1 auto;
	min-width: 0;
}

/* ---------- Brand ---------- */

.tenk-brand {
	margin: 0;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.375rem;
	font-style: italic;
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 1;
	text-transform: uppercase;
	white-space: nowrap;
}

.tenk-brand a,
.tenk-brand:not(:has(a)) {
	display: inline-flex;
	align-items: center;
	gap: 0.625rem;
	min-height: 44px;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.tenk-brand a::before,
.tenk-brand:not(:has(a))::before {
	content: "";
	flex: none;
	width: 2rem;
	height: 2rem;
	background: url("../img/logo.svg") center / contain no-repeat;
}

.tenk-brand--quiet {
	font-size: 1rem;
	opacity: 0.85;
}

/* ---------- Navigation ---------- */

.tenk-nav {
	font-size: 0.9375rem;
	font-weight: 500;
}

.tenk-nav .wp-block-navigation__container,
.tenk-nav .wp-block-page-list {
	gap: 0.25rem;
}

.tenk-nav .wp-block-navigation-item__content {
	display: flex;
	align-items: center;
	min-height: 40px;
	padding: 0 0.875rem;
	border-radius: 4px;
	color: var(--wp--preset--color--muted);
	text-decoration: none;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.tenk-nav .wp-block-navigation-item__content:hover {
	background: color-mix(in srgb, var(--wp--preset--color--contrast) 7%, transparent);
	color: var(--wp--preset--color--contrast);
}

.tenk-nav .current-menu-item > .wp-block-navigation-item__content,
.tenk-nav .wp-block-navigation-item__content[aria-current="page"] {
	background: color-mix(in srgb, var(--wp--preset--color--accent) 22%, transparent);
	color: var(--wp--preset--color--contrast);
}

.tenk-nav .wp-block-navigation__responsive-container-open,
.tenk-nav .wp-block-navigation__responsive-container-close {
	display: grid;
	width: 44px;
	height: 44px;
	place-items: center;
	border-radius: 4px;
	color: var(--wp--preset--color--contrast);
}

/*
 * The links collapse into the sheet below 768 px. The navigation block switches at 600 px, so
 * between the two widths its inline list is hidden again and the menu button stays.
 */
@media (min-width: 600px) and (max-width: 767.98px) {
	.tenk-nav .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}

	.tenk-nav .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: grid;
	}
}

@media (min-width: 768px) {
	.tenk-nav .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: none;
	}
}

/* "Create account" of a visitor: the one filled item of the navigation (class set by the platform). */
.tenk-nav .wp-block-navigation-item__content.gaming-platform-nav-cta {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--on-accent);
	font-weight: 600;
}

.tenk-nav .wp-block-navigation-item__content.gaming-platform-nav-cta:hover {
	background: color-mix(in srgb, var(--wp--preset--color--accent) 86%, #fff);
	color: var(--wp--preset--color--on-accent);
}

/* The mobile sheet: the second (and last) glass surface of the shell. */
.tenk-nav .wp-block-navigation__responsive-container.is-menu-open {
	padding: 1rem clamp(1rem, 4vw, 2rem) 2rem;
	background: color-mix(in srgb, var(--wp--preset--color--base) 96%, transparent);
	color: var(--wp--preset--color--contrast);
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
	.tenk-nav .wp-block-navigation__responsive-container.is-menu-open {
		background: color-mix(in srgb, var(--wp--preset--color--base) 80%, transparent);
		-webkit-backdrop-filter: blur(20px) saturate(140%);
		backdrop-filter: blur(20px) saturate(140%);
	}
}

.tenk-nav .is-menu-open .wp-block-navigation__container,
.tenk-nav .is-menu-open .wp-block-page-list {
	width: 100%;
	gap: 0.25rem;
}

.tenk-nav .is-menu-open .wp-block-navigation-item {
	width: 100%;
}

.tenk-nav .is-menu-open .wp-block-navigation-item__content {
	width: 100%;
	min-height: 48px;
	border-radius: 12px;
	font-size: 1.0625rem;
}

/* ---------- Page frame ---------- */

.tenk-main {
	flex: 1 0 auto;
	width: 100%;
	box-sizing: border-box;
	padding-block: clamp(1.5rem, 4vw, 3rem) clamp(3rem, 8vw, 5rem);
	padding-inline: clamp(1rem, 4vw, 2rem);
}

.tenk-main--lobby {
	padding-top: clamp(1rem, 3vw, 2rem);
}

.tenk-main--centered {
	display: grid;
	align-content: center;
	justify-items: center;
	text-align: center;
}

.tenk-page-title {
	margin-block: 0 1.5rem;
}

/*
 * Pages share one left edge with the logo: text and forms keep the reading width, wide content
 * (tables, grids) uses the full frame.
 */
.tenk-main > .wp-block-post-content > :not(.alignwide, .alignfull, .aligncenter) {
	margin-left: 0 !important;
}

.tenk-entry {
	padding-block: 1.25rem;
	border-bottom: 1px solid var(--tenk-hairline);
}

.tenk-404__code {
	margin: 0;
	background: linear-gradient(120deg, var(--wp--preset--color--accent-text), var(--wp--preset--color--highlight));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(4rem, 18vw, 8rem);
	font-style: italic;
	font-weight: 700;
	line-height: 1;
}

/*
 * Integration with the platform pages: the page title above already names the screen, so the
 * first heading of these screens stays for assistive technology only. The streaks screen starts
 * with a different heading and keeps it.
 */
.tenk-main .gaming-platform-account-area > h2:first-child,
.tenk-main .gaming-platform-shop:not(.gaming-platform-streaks, .gaming-platform-message) > h2:first-child {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Core blocks inside page content. */
.wp-element-button,
.wp-block-button__link {
	min-height: 44px;
	padding: 0.625rem 1.375rem;
	box-sizing: border-box;
	transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.wp-element-button:hover,
.wp-block-button__link:hover {
	background: color-mix(in srgb, var(--wp--preset--color--accent) 86%, #fff);
	color: var(--wp--preset--color--on-accent);
}

.wp-element-button:active,
.wp-block-button__link:active {
	transform: translateY(1px);
}

:where(.wp-block-table) table {
	border-collapse: collapse;
}

:where(.wp-block-table) :where(th, td) {
	border: 0;
	border-bottom: 1px solid var(--tenk-hairline);
	padding: 0.625rem 0.75rem;
}

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

.wp-site-blocks > footer.wp-block-template-part {
	margin-top: auto;
	border-top: 1px solid var(--tenk-hairline);
}

.tenk-footer {
	padding-inline: clamp(1rem, 4vw, 2rem);
}

.tenk-footer__bar {
	gap: 0.5rem 1.5rem;
	padding-block: 1.5rem;
}

.tenk-footer__note {
	margin: 0;
	color: var(--wp--preset--color--muted);
	font-size: 0.875rem;
}

.tenk-footer__links {
	display: flex;
	flex-wrap: wrap;
	gap: 0 1.25rem;
	margin: 0;
	font-size: 0.875rem;
}

.tenk-footer__links a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--wp--preset--color--muted);
}

.tenk-footer__links a:hover {
	color: var(--wp--preset--color--contrast);
}

/* Legal pages: a reading column with quiet headings. */
.tenk-legal h3 {
	margin-block: 2rem 0.5rem;
	font-size: 1.125rem;
}

.tenk-header {
	padding-inline: clamp(1rem, 4vw, 2rem);
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.tenk-nav .wp-block-navigation-item__content,
	.wp-element-button,
	.wp-block-button__link {
		transition: none;
	}
}

@media (forced-colors: active) {
	.tenk-brand a::before,
	.tenk-brand:not(:has(a))::before {
		forced-color-adjust: none;
	}
}
