/**
 * Main CSS — shell layout, reset, layout utilities.
 * Ported from user-account `static/styles/main.css`. TrainersMap pages still scroll;
 * the status bar is fixed and reserves `--app-content-pad-bottom` (nginx_template chrome).
 * Theme variables are in `base.css` (load order in `app.html`: base → main → text → btns).
 */

:root {
	/* Toolbar bar height. The inbox account bar, both discover bars (results, map, filters),
	   and the status bar read this. The hover zone in statusBar.svelte reads the token. */
	--chrome-bar-height: 26px;
	--status-bar-height: var(--chrome-bar-height);

	/* Must match the glyph size in base.css. Both chrome navs (top bar, feed rail) read it. */
	--nav-glyph-size: 15px;

	/* Must match the reserved gutter on a `scrollbar-gutter: stable` scrollport. */
	--scrollbar-width: 16px;
	--status-bar-tray-inset: 16px;
	--status-bar-tray-radius: 10px;
	--chrome-slide-duration: 0.2s;
	--chrome-slide-easing: ease-out;
}

/*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

/* basic reset */

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

html {
	min-height: 100%;
	text-size-adjust: 100%;
	overscroll-behavior: none;
}

body {
	min-height: 100vh;
	min-height: 100dvh;
	margin: 0;
	padding: 0;
	background: var(--app-bg);
	color: var(--app-text);
	overscroll-behavior: none;
}

/* Element resets live in `@layer base` so kit / Tailwind utilities (layer `utilities`) always win.
   Unlayered rules would outrank every utility regardless of source order. */
@layer base {
	img,
	svg,
	video {
		max-width: 100%;
		display: block;
	}

	button,
	input,
	select,
	textarea {
		font: inherit;
		color: inherit;
	}

	/* UA `ButtonFace` is a fixed light grey; ghost / link kit variants set no bg and would show it in dark. */
	button {
		cursor: pointer;
		background-color: var(--app-clear);
	}

	a {
		color: inherit;
	}

	/* Kit Button rendered as <a href>: no UA underline (Preflight is off). */
	a[data-slot="button"] {
		text-decoration: none;
	}

	/* Chrome/Safari autofill paints a yellow/white inset. Cover it with the field token so dark stays dark. */
	input:-webkit-autofill,
	input:-webkit-autofill:hover,
	input:-webkit-autofill:focus,
	input:-webkit-autofill:active,
	textarea:-webkit-autofill,
	textarea:-webkit-autofill:hover,
	textarea:-webkit-autofill:focus,
	select:-webkit-autofill,
	select:-webkit-autofill:hover,
	select:-webkit-autofill:focus {
		-webkit-text-fill-color: var(--app-text);
		caret-color: var(--app-text);
		box-shadow: 0 0 0 1000px var(--app-surface) inset;
		transition: background-color 99999s ease-out 0s;
	}
}

/*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

/* app shell layout */

.app-shell,
.page-section,
.u-flex-center,
.u-flex-row,
.page-container,
.inner-container {
	display: flex;
}

.app-shell,
.page-section,
.u-flex-row,
.page-container,
.inner-container {
	flex-direction: column;
}

body,
.u-flex-row,
.page-section,
.inner-container,
.custom-container {
	width: 100%;
}

.app-shell {
	min-height: 100vh;
	min-height: 100dvh;
}

.app-content,
.page-container {
	flex: 1;
	min-height: 0;
}

/* The shell owns the clip, not the page. Every page renders an absolutely positioned
   strip that hangs off an edge (the app rail parks at `inset: 0 0 0 auto` and slides out
   by its own width), so without this rule the closed strip adds document overflow. A page
   stylesheet cannot be the owner: it arrives with the page, and for the frames before it
   loads the overflow is real, so a scrollbar appears and the sticky header lays out
   narrower than the window. That reads as the header jumping sideways on refresh. */
.app-content {
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	padding-bottom: var(--app-content-pad-bottom, 0);
	transition: padding-bottom var(--chrome-slide-duration)
		var(--chrome-slide-easing);
}

/*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

/* Layout utilities (prefix `u-`) */

.u-flex-center,
.u-flex-row,
.page-container {
	align-items: center;
}

.u-flex-center {
	justify-content: center;
}

.page-container {
	padding: var(--app-space-6);
}

.page-section {
	max-width: min(100%, 42rem);
}

.page-section + .page-section {
	margin-top: var(--app-space-10);
}

.inner-container {
	gap: var(--app-space-6);
}

/* Flex wrappers beat the UA `[hidden]` rule at equal specificity; make hidden panels collapse. */
[hidden] {
	display: none !important;
}

/*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

 /*  */

.flash {
	text-align: center;
	margin: 0 0 var(--app-space-6);
}

.flash--err {
	color: var(--app-error);
}

.app-spinner {
	flex-shrink: 0;
	color: var(--app-text-dim);
	animation: app-spin var(--animation-duration-slow) linear infinite;
}

/* Canonical rules also live in lib/utility/components/ui/spinner/styles.css. */

@keyframes app-spin {
	to {
		transform: rotate(360deg);
	}
}
