<script lang="ts">
	import TestCard from '$lib/TestCard.svelte';
	import { page } from '$app/state';
	import { goto } from '$app/navigation';
	import { m } from '$lib/paraglide/messages';
	interface Props {
		children?: import('svelte').Snippet;
	}

	let { children }: Props = $props();
</script>

<TestCard bg onfocus={() => goto('/card')} />
<main class:sub={!page.data.root}>
	<a href=".." class="button button-back"><i class="ti ti-arrow-back"></i>{m.common_back()}</a>
	{@render children?.()}
</main>

<style>
	main {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		height: 90vh;
		width: 90vw;

		background: rgba(0, 0, 0, 0.85);
		border-radius: 0.5rem;
		border: 1px solid white;

		padding: 1rem;

		display: flex;
		flex-direction: column;
	}

	.button-back {
		position: absolute;
		top: 1rem;
		right: 1rem;

		opacity: 0.66;
		transition: opacity 0.3s;
		&:hover {
			opacity: 1;
		}
	}

	main:not(.sub) .button-back {
		display: none;
	}
</style>
