<script>
  import {createEventDispatcher} from 'svelte';

  const dispatch = createEventDispatcher();

  function handleStart() {
    dispatch("start");
  }
</script>

<div class="start-screen">
  <div class="title">
    <div class="big">
      <img src="/assets/quetzalcoatl.png" alt="left icon" class="title-icon left" />
      <h1>QUETZALCOATL</h1>
      <img src="/assets/quetzalcoatl.png" alt="right icon" class="title-icon right" />
    </div>
    <h2>The Fifth Sun</h2>
  </div>
  <button on:click={handleStart}>Start Game</button>
</div>

<style>
  .start-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    width: 100%;
    background-color: #210140;
    color: #18a48e;
    padding: 40px;
  }

  button {
    position: relative;
    display: block;
    margin: 40px auto 0;
    padding: 4px;
    width: fit-content;
    cursor: pointer;
    font-size: 1.2rem;
    text-align: center;
    background-color: transparent;
    color: white;
    border-radius: 8px;
    border: none;
    font-family: 'Aztec';
  }

  button::before,
  button::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 24px;
    height: 24px;
    background-image: url("/assets/obstacle.png");
    background-size: cover;
    opacity: 0;
    transform: translateY(-50%);
  }

  button::before {
    left: -30px;
  }

  button::after {
    right: -30px;
  }

  button:hover::before,
  button:hover::after {
    opacity: 1;
  }

  .title {
    margin: 4px;
  }

  .big {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
  }

  .title-icon {
    width: 64px; 
    height: auto;
  }

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

  h1 {
    text-align: center;
    font-size: 4rem;
    margin: 0;
  }

  h2 {
    text-align: center;
    margin: 0;
    color: #eef251;
    font-size: 2.4rem;
  }
</style>

