<script lang="ts">
    import { page } from '$app/stores';
    import '$lib/blog.scss';

    export let data: any;

    data.date = new Date();
    data.date = [
        data.date.getFullYear(),
        (data.date.getMonth() + 1).toString().padStart(2, '0'),
        data.date.getDate().toString().padStart(2, '0')
    ].join('-');
    data.image = '/img/error.jpg';
    data.title = 'Something went wrong :(';
</script>

<svelte:head>
    <title>{$page.status} | Blog | HareWorks</title>
    <meta name="robots" content="noindex" />
</svelte:head>

<!-- <div class="hero">
    <img src={data.image} alt="" />
</div> -->
<div class="container">
    <div class="title">
        <h1>{data.title}</h1>
        <div class="meta">
            <span>{data.date}</span>
            <span />
        </div>
    </div>
    <div class="panel">
        <main>
            <div class="document">
                <h1>{$page.status} {$page.error?.message}</h1>
        <a href="/">Home</a>
            </div>
        </main>
    </div>
</div>

<style lang="scss">
  :global(body) {
    background-color: var(--background-primary);
  }
    .back {
        position: fixed;
        z-index: -1;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #000;
        color: white;
        filter: brightness(0.8) grayscale(0.5);
    }
    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .container {
        color: white;
        min-height: 100%;
        padding-top: 100px;
    width: 1000px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
    }
    .title {
        h1 {
            font-size: 2rem;
            text-align: center;
            margin: 0;
            padding: 12px 100px 12px 0;
            border-bottom: 1px solid rgba(255, 255, 255, 0.3);
            box-sizing: border-box;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .meta {
            display: flex;
            justify-content: space-between;
            padding: 0 20px;
            font-size: 0.8rem;
            span {
                opacity: 0.6;
            }
            a {
                &:first-child {
                    &::before {
                        content: '🗀 ';
                    }
                    &::after {
                        content: '|';
                        margin-left: 15px;
                    }
                }
                margin-left: 5px;
                padding: 0 5px;
                color: inherit;
                text-decoration: none;
                &:hover {
                    text-decoration: underline;
                }
            }
        }
    }
    .panel {
        flex: 1;
        background-color: var(--background-primary);
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;
    }
    main {
        padding: 20px;
        box-sizing: border-box;
        width: 1000px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    @media (max-width: 1000px) {
        .container {
      width: 100%;
        }
        .title {
            h1 {
                padding: 8px 20px;
            }
        }
        main {
            max-width: 100%;
        }
    }
</style>