/*
   The start screen.
   Loaded in order with the others (see index.html): a later rule wins. */

/* The start screen: what opening the app shows. Whole screen, not a dialog over the game. */
.start-screen {
	background: var(--page);
	padding-bottom: 0; /* laid out in the page, the opening placing its mark itself (--screen-middle) */
}

/* Blank until its logo and fonts are in and it knows whether there's a game to resume, then it fades in. */
.start-section {
	visibility: hidden;
	opacity: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	box-sizing: border-box;
	width: min(92%, calc(76 * var(--m)));
	max-height: 100%;
	padding: calc(2 * var(--m));
	overflow-y: auto;
	text-align: center;
}

.start-screen.ready .start-section {
	visibility: visible;
	opacity: 1;
	transition: opacity 800ms ease-out 300ms; /* a moment of plain background, then in slowly */
}

/* The name as drawn in the logo, its c the mark: on its own, never beside the mark. */
.start-wordmark {
	display: block;
	width: auto;
	height: calc(9 * var(--m));
	margin: calc(3 * var(--m)) auto calc(2 * var(--m));
	overflow: visible; /* the dart flies in from outside it, as the app opens */
}

/* As the app opens (playIntro in ui/start-screen.js), the mark, big as on its
   icon, moves into the wordmark's c and becomes it, "Darts" and "ore" sliding
   out from behind it, and a dart hits its bull. Meanwhile the wordmark waits in
   the middle of the screen (--rise down from its place), each part kept out of
   sight until its moment; then it rises to its place (--rise to 0) and the rest
   slides down out from under it (--under to 0; cut off at its bottom edge by
   playIntro), drawn frame by frame. */
/* The mark is there from the page's first frame, as an app's icon is when it
   opens: big in the middle (the page starts with .intro on), until the opening
   draws it in the wordmark's own c (.intro-c), where it is. */
.start-mark {
	position: absolute;
	left: 50%;
	top: var(--screen-middle, 50%); /* the whole screen's middle, as on the launch image (js/theme-early.js) */
	width: var(--screen-mark, 30vmin);
	height: var(--screen-mark, 30vmin);
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.start-screen:not(.intro) .start-mark,
.start-mark[hidden] {
	display: none;
}

.start-screen.intro.ready .start-section {
	transition: none;
	overflow: visible; /* the mark, big at first, and the dart, thrown from in front */
}

.start-screen.intro:not(.intro-c) .wordmark-c,
.start-screen.intro:not(.intro-dart) :is(.wordmark-dart, .wordmark-dart-shadow) {
	visibility: hidden;
}

/* Hidden at once, not faded out (the buttons fade their opacity, motion.css):
   a phone may draw the screen before the opening starts. */
.start-screen.intro .start-section > :not(.start-title) {
	opacity: var(--shown, 0);
	transform: translateY(var(--under, 0px));
	transition: none;
}

.start-screen.intro .start-title {
	position: relative;
	z-index: 1; /* the rest comes out from under it */
	transform: translateY(var(--rise, 0px));
}

/* A soft shadow along the wordmark's bottom edge, which the rest slides out from
   under as it rises: black, shaded as the one round the outer bull is
   (#wordmark-c-halo in index.html), down to where the line under the wordmark
   ends up; placed and faded by playIntro. */
.start-screen.intro .start-title::after {
	content: '';
	position: absolute;
	top: var(--veil-top, 100%);
	left: 50%;
	width: var(--veil-width, 0px);
	height: var(--veil-depth, 0px);
	transform: translateX(-50%);
	background: linear-gradient(rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.5) 36%, rgba(0, 0, 0, 0.15) 70%, rgba(0, 0, 0, 0));
	opacity: var(--veil, 0);
	pointer-events: none;
}

.start-title {
	margin: calc(1.5 * var(--m)) 0 0;
	font-family: var(--font-condensed);
	font-size: calc(9 * var(--m));
	font-weight: 500;
	line-height: 1.1;
	color: var(--text);
}

.start-tag {
	margin: calc(1 * var(--m)) 0 calc(3 * var(--m));
	font-family: var(--font-condensed);
	font-size: calc(3.2 * var(--m));
	color: var(--text-soft);
}

.start-section .settings-btn-action {
	width: 100%;
	margin-bottom: calc(1.5 * var(--m));
}

/* Two side by side: New game and Join a game (blue, as in the menu, where
   profiles are on), Player stats and Game history. */
.start-pair {
	display: flex;
	width: 100%;
	gap: calc(1.5 * var(--m));
	margin-bottom: calc(1.5 * var(--m));
}

/* The games (Resume, New game, Join a game) apart from the profile's (Sign in or
   Profile, Player stats, Game history). */
.start-pair.start-games {
	margin-bottom: calc(4.5 * var(--m));
}

.start-section .start-pair > .settings-btn-action {
	flex: 1;
	min-width: 0;
	margin-bottom: 0;
}

.start-pair > [hidden] {
	display: none;
}

.start-section .start-join {
	border-color: var(--account-line);
	background: linear-gradient(var(--account-top), var(--account-bottom));
}

.start-section .start-join:active {
	filter: brightness(0.75);
}

.start-resume[hidden] {
	display: none;
}

.start-resume-title,
.start-resume-detail {
	display: block;
}

.start-resume-detail {
	margin-top: calc(0.5 * var(--m));
	overflow: hidden;
	font-size: calc(2.8 * var(--m));
	font-weight: normal;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.start-note {
	margin: calc(1 * var(--m)) 0 0;
	font-family: var(--font-condensed);
	font-size: calc(2.8 * var(--m));
	color: var(--text-muted);
}

.start-link {
	padding: 0;
	font: inherit;
	color: var(--text-soft);
	text-decoration: underline;
	background: none;
	border: none;
	cursor: pointer;
}
