:root {
	font-size: 16px;
	--header-height: 3rem;

	--back-button-font-size: 3rem;
	--header-font: 2rem;
	--mid-font: 1.25rem;
	--hr-color: #333;
	--margin: 1rem;
	--default-text-icon-bottom-margin: 0.45rem;
	--default-close-margin: 0.2rem;

	--background-colour: black;
	--koala-red: #fe2e5a;
	--header-fill: #2c0204;
	--border-colour: rgba(255, 255, 255, 0.25);
	--text-colour: white;
	--sub-text-colour: rgba(255, 255, 255, 0.5);
	--play-button-background: rgba(0, 0, 0, 0.25);

	--play-button-dimension: 2.5rem;

	--product-max-width: 50vw;
	--product-min-width: 130px;
	--details-image-dimension: 150px;

	--corner-radius: 0.4rem;
	--image-border: 1px solid var(--border-colour);

	--koala-font: 'Dosis';
	--paragraph-font: 'Helvetica';

	--sait: max(2em, var(--android-safe-area-inset-top, env(safe-area-inset-top)));
	--saib: var(--android-safe-area-inset-bottom, env(safe-area-inset-bottom));
	--sail: var(--android-safe-area-inset-left, env(safe-area-inset-left));
	--sair: var(--android-safe-area-inset-right, env(safe-area-inset-right));
}

@font-face {
	font-family: 'Dosis';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url(dosis.woff) format('woff');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
		U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html,
body {
	color: var(--text-colour);
	font-family: var(--koala-font);
	background-color: var(--background-colour);
	margin: 0;
	padding: 0;
	background-image: url('../img/pinstripe.png');
	background-repeat: repeat;
	width: 100%;
	height: 100%;
}

p {
	margin: 0 0 0.5em 0;
	line-height: 1.75em;
	font-family: var(--paragraph-font);
}

a {
	color: var(--koala-red);
	text-decoration: underline;
}

button {
	color: var(--text-colour);
}

header {
	height: var(--header-height);
	display: flex;
	align-items: center;
	background-color: var(--header-fill);
	padding-left: var(--margin);
	box-sizing: content-box;
	padding-top: var(--sait, 0px);
}

header h1 {
	text-transform: uppercase;
	color: var(--koala-red);
	margin: 0;
	font-size: var(--header-font);
	flex: 1 1 auto;
	font-weight: normal;
}

.close img {
	width: 0.55em;
	height: 0.55em;
	transition: transform 0.1s ease-in-out;
}

.close:active img,
.back:active img {
	/* filter: invert(1); */
	filter: invert(34%) sepia(99%) saturate(4282%) hue-rotate(333deg) brightness(111%)
		contrast(103%);
	/* Pink color */

	transform: scale(1.4);
}

header .close {
	background: none;
	border: none;
	outline: none;
	padding: 0;
	text-decoration: none;
	cursor: pointer;
	text-align: center;
	box-shadow: none;
	font-size: var(--header-font);
	font-weight: 400;
	margin: 0 var(--margin) 0 0;
	transition: transform 0.1s ease-in-out;
}

header .close:hover,
header .back:hover::before {
	color: var(--koala-red);
}

header .back {
	background: none;
	border: none;
	outline: none;
	padding: 0;
	text-decoration: none;
	cursor: pointer;
	box-shadow: none;
	font-size: var(--back-button-font-size);
	line-height: var(--back-button-font-size);
	display: flex;
	align-items: center;
	justify-content: flex-end;
	font-weight: 300;
	margin-right: 0.2em;
}

.play-button-container {
	position: absolute;
	bottom: var(--margin);
	right: var(--margin);
	display: flex;
	justify-content: center;
	align-items: center;
	width: var(--play-button-dimension);
	height: var(--play-button-dimension);
	border-radius: 50%;
	background-color: var(--play-button-background);
	backdrop-filter: blur(4px);
	cursor: pointer;
	border: 1px solid var(--border-colour);
	transition: background-color 100ms ease;
	transition: transform 100ms ease;
}

.play-button-container:active {
	transform: scale(1.4);
	background-color: var(--koala-red);
}

.play-button-container.pause {
	background-color: var(--koala-red);
}

.play-button {
	font-size: var(--mid-font, 24px);
	display: flex;
	justify-content: center;
	align-items: center;
	transition: transform 100ms ease;
	user-select: none;
	position: relative;
}

.play-button::before {
	content: '';
	background-image: url('../img/play.svg');
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	display: block;
	width: 1em;
	height: 1em;
}

.play-button-container.pause .play-button::before {
	background-image: url('../img/pause.svg');
}

.products {
	margin: 0 auto;
	padding: var(--margin);
	max-width: 1024px;
	gap: calc(var(--margin) * 2) var(--margin);
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(var(--product-min-width), 1fr));
	justify-content: center;
	align-items: top;
	box-sizing: border-box;
}

@media (max-width: 600px) {
	.products {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 265px) {
	.products {
		grid-template-columns: 1fr;
	}
}

.product {
	text-align: center;
}

.product.purchased .image-container img {
	opacity: 0.5;
}

.product.purchased .image-container::after {
	content: '';
	background-image: url('../img/green-tick.svg');

	display: block;
	width: var(--play-button-dimension);
	height: var(--play-button-dimension);
	background-size: contain;
	color: var(--koala-red);
	position: absolute;
	top: var(--margin);
	right: var(--margin);
}

.image-container {
	aspect-ratio: 1 / 1;
	border-radius: var(--corner-radius);
	border: var(--image-border);
	position: relative;
	overflow: hidden;
}

.image-container img {
	width: 100%;
	object-fit: cover;
	cursor: pointer;
}

@supports (aspect-ratio: 1 / 1) {
	.image-container img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		cursor: pointer;
	}
}

.product img:active {
	filter: invert(1);
}

#product-title {
	font-size: 1.6em;
}

.product-title,
.product-genre {
	width: 100%;
	max-width: var(--product-max-width);
	min-width: var(--product-min-width);
	line-height: var(--product-text-height);
	margin: 0.3rem 0 0 0;
	padding: 0;
	text-transform: uppercase;
}

.product-title {
	font-size: var(--mid-font);
}

.product-genre {
	color: var(--sub-text-colour);
}

.koala-button {
	background-color: #31101e;
	color: var(--koala-red);
	border: 1px solid rgba(255, 255, 255, 0.25);
	cursor: pointer;
	font-family: 'Dosis';
	text-transform: uppercase;
	font-size: var(--mid-font);
	align-self: center;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--corner-radius);
	padding: 1rem 1rem;
	height: 2em;
	/* safe area for soft buttons */
	transition: transform 0.1s ease-in-out;
	margin-bottom: calc(var(--saib, 0px) + 0.5em);
}

.koala-button:active {
	transform: scale(1.2);
	color: white;
	border-color: white;
}

.spinner {
	vertical-align: middle;
	width: 1em;
	height: 1em;
	margin-right: 0.5em;
}

.koala-button.purchased {
	display: none;
}

.pack-status {
	color: var(--koala-red);
	border: 0px solid var(--koala-red);
	font-family: 'Dosis';
	font-size: var(--mid-font);
	align-self: center;
	align-items: center;
	justify-content: center;
	padding: 1rem 1rem;
	height: 2em;
	margin-bottom: -1em;
}

.pack-status.unpurchased {
	display: none;
}

.pack-status.purchased {
	display: flex;
}

.price-value {
	white-space: nowrap;
}

.detail-container {
	display: flex;
	flex-direction: column;
	gap: var(--margin);
	max-height: 100%;
	width: 100%;
	overflow: hidden;
	padding-bottom: 0.5em;
}
/* on some android tablets there is a dock, this pushes the buy button up on every platform to compensate for this stupidity */
@media (orientation: portrait) and (min-aspect-ratio: 5.8/10) and (max-aspect-ratio: 10/5.8) and (min-width: 400px) {
	.detail-container {
		padding-bottom: 2em;
	}
}

.detail-info {
	font-size: 15px;
	background-color: #111;
	flex: 1 1 auto;
	padding: var(--margin);
	overflow-y: auto;
}

.freeToyName {
	text-transform: uppercase;
	color: #01d1fd;
	font-weight: bold;
}

#detail-info-header {
	text-transform: uppercase;
	display: flex;
	justify-content: space-between;
	color: #aaa;
	margin-bottom: var(--margin);
}

#detail-body img {
	display: block;
	width: 90%;
	text-align: center;
	margin: 1em auto;
}

.product-details {
	display: flex;
	margin: var(--margin);
	gap: var(--margin);
}

hr {
	background: var(--hr-color);
	border: 0;
	font-size: 0;
	height: 1px;
	margin-bottom: 0.5rem;
}

@media (orientation: portrait) {
	.product-details {
		margin: var(--margin) 0;
		flex-direction: column;
		align-items: center;
		width: 100%;

		height: calc(100% - (var(--margin) * 2));
		position: absolute;
		max-height: calc(100% - var(--header-height) - (var(--margin) * 2));
	}

	.detail-container {
		max-height: calc(100vh - (var(--margin) * 4));
	}

	.image-container {
		max-width: 80vw;
	}

	.detail-info {
		border-top: 1px var(--hr-color) solid;
		border-bottom: 1px var(--hr-color) solid;
		height: 55vh;
	}
}

@media (orientation: landscape) {
	.product-details {
		flex-direction: row;
		align-items: flex-start;
		height: calc(100vh - var(--header-height) - (var(--margin) * 2));
	}

	.detail-info {
		border-radius: var(--corner-radius);
	}

	.detail-container {
		align-self: stretch;
	}

	.detail-image {
		max-height: calc(50vw - var(--header-height) - (var(--margin) * 1.5));
		max-width: 70vw;
	}
}

.more-soon {
	text-align: center;
	margin: 2em;
}

.overlay {
	position: fixed;
	display: flex;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 1000;
	justify-content: center;
	align-items: center;
}

.dialog {
	position: fixed;

	width: min(calc(100% - 5rem), 20rem);
	box-shadow: 0 0 20px rgb(0, 0, 0, 0.5);
	border: 1px rgba(255, 255, 255, 0.25) solid;
	background: #31101e;
	padding: 0.5em;
	border-radius: var(--corner-radius);
	z-index: 1001;
}

.dialog .koala-button {
	font-size: 1em;
	color: #01d1fd;
}

.dialog-button-container {
	display: flex;

	justify-content: center;
	gap: 0.5em;
	margin-top: 1.5rem;
}

.dialog-header {
	text-transform: uppercase;
	color: white;
	margin: 0;
	text-align: center;
	font-size: 1.2em;
	font-weight: normal;
	flex: 1 1 auto;
	font-weight: normal;
}

.dialog-text {
	margin: 1em 0 0.5em 0;
	font-size: var(--small-font);
	color: var(--text-colour);
	flex: 1 1 auto;
	font-size: 0.9em;
	text-align: center;
}

.restore-container {
	margin-top: 2em;
	margin-bottom: 0.5em;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: row;
}
