/*
   The buttons round the board, and Done. The darts card and the side info
   under it are darts-card.css.
   Loaded in order with the others (see index.html): a later rule wins. */

/* BUTTONS */

/* Beside the board, buttons in the New game screen's style: each its own
   rounded, white-edged button on the grey gradient, a little apart. Left:
   undo and redo at the top; the keypad, Settings and full screen at the
   bottom, the keypad on the left above Settings where the board leaves room.
   Right: Settings, the turn's darts, and Done. */
:root {
	--side-pad: 1.2vmin; /* from the screen's edges, and between buttons */
	--ctrl-size: 8vmin;
	/* The right column's one width, a keypad key's (four across the panel, five 5px gaps
	   and its edge): the darts card is this wide. */
	--card-w: calc((30vw - var(--side-pad) - 15px) / 4);
	/* Done's size, set per layout. Here (landscape) two board buttons and the gap
	   between, one tall: undo and redo together, as the profile and menu above it are. */
	--done-w: calc(2 * var(--ctrl-size) + var(--side-pad));
	--done-h: var(--ctrl-size);
}

.board-btn {
	display: grid;
	place-items: center;
	padding: 0;
	font-family: var(--font-condensed);
	font-weight: 500;
	color: var(--text);
	text-shadow: 0 0 8px black;
	background: var(--button);
	border: var(--border);
	border-radius: var(--radius);
	cursor: pointer;
	pointer-events: auto;
}

.board-btn.disabled {
	color: var(--text-muted);
	background: var(--button-disabled);
	border: var(--border-muted);
	cursor: default;
}

/* Line icons (the controls, the darts' Clear): drawn in the text colour. */
.icon {
	display: block;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
	filter: drop-shadow(0 0 0.6vmin black);
}

.icon.flip {
	transform: scaleX(-1);
}

.ctrl-section {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-items: flex-start;
	width: 0;
	padding: var(--side-pad) 0;
	box-sizing: border-box;
	pointer-events: none;
	z-index: 1;
}

.ctrl-top,
.ctrl-bottom {
	margin-left: var(--side-pad);
}

.ctrl-row {
	display: flex;
	gap: var(--side-pad);
}

.ctrl-btn {
	width: var(--ctrl-size);
	height: var(--ctrl-size);
}

.ctrl-btn .icon {
	width: 4.4vmin;
	height: 4.4vmin;
}

/* Keypad show/hide: a keypad, and an arrow that points down to hide it, up to show it. */
.ctrl-btn.keypad-btn {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 0.2vmin;
}

.ctrl-btn .keypad-icon {
	width: 3.6vmin;
	height: 3.6vmin;
	fill: currentColor;
	stroke: none;
}

.ctrl-btn .keypad-arrow {
	width: 2.6vmin;
	height: 2.6vmin;
	transition: transform var(--medium) var(--ease-out);
}

.keypad-btn[aria-expanded="false"] .keypad-arrow {
	transform: rotate(180deg);
}

/* Full screen: four corners pointing out; in full screen each turns to point in. */
.fs-icon path {
	transform-box: fill-box;
	transform-origin: center;
	transition: transform var(--medium) var(--ease-out);
}

.menu-full-screen.active .fs-icon path {
	transform: rotate(180deg);
}

/* The right-hand column, its buttons lined up on the right edge (wider than
   the column, they reach over the board's corners as the left ones do). */
.btn-section {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-items: flex-end;
	width: 8vw;
	padding: var(--side-pad);
	box-sizing: border-box;
	pointer-events: none;
}

.side-btn {
	width: var(--done-w);
	height: var(--done-h);
	font-size: 4.8vmin;
	white-space: nowrap;
}

/* Undo's size, and with the profile left of it, the two mirror undo and redo. */
.btn-section .settings-btn {
	width: var(--ctrl-size);
}

.btn-section .profile-btn {
	position: absolute;
	top: var(--side-pad);
	right: calc(2 * var(--side-pad) + var(--ctrl-size));
}

/* Done: a ✓ like the keypad's, with what the darts make beside it (and under
   that, what sending them would do: Bust, Leg, Set or Game). */
.done-btn {
	display: flex;
	align-items: center;
	justify-content: center;
}

/* With no dart down, it's Pass: a double arrow, on to the next player. */
.done-pass {
	display: none;
}

.done-btn.passing .done-pass {
	display: flex;
}

.done-pass .icon {
	width: 5.4vmin;
	height: 5.4vmin;
}

.done-btn.passing :is(.done-score, .done-check) {
	display: none;
}

.done-score {
	display: flex;
	flex-direction: column;
	align-items: center;
	line-height: 1;
}

.done-btn:not(.disabled) .done-score {
	margin-right: 1vmin;
}

.done-total:not(:empty) {
	font-size: 4.4vmin;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* The word after the number (cricket's marks). */
.done-unit {
	margin-left: 0.25em;
	font-size: 0.6em;
	font-weight: 500;
}

/* The word slides out from under the score, and back up. */
.done-note {
	display: grid;
	grid-template-rows: 0fr;
	width: 0; /* takes no room until it shows, so the score and ✓ stay put */
	overflow: hidden;
	font-size: 2.2vmin;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--bust) 40%, white);
	white-space: nowrap;
	transition: grid-template-rows var(--medium) var(--ease-out), width var(--medium) var(--ease-out);
}

.done-note > span {
	min-height: 0;
	transform: translateY(-100%);
	transition: transform var(--medium) var(--ease-out);
}

.done-btn.noting .done-note {
	grid-template-rows: 1fr;
	width: 5.8vmin;
}

.done-btn.noting .done-note > span {
	transform: none;
}

/* Winning something: a warm white, not the bust's red. */
.done-btn.winning .done-note {
	color: color-mix(in srgb, var(--dart-edit) 55%, white);
}

.done-check {
	font-family: var(--font);
	font-size: 4.8vmin;
}
