---
export interface Props {
  url: string | undefined
  title: string
  pubdate: string
  description: string
}

const options_date: Intl.DateTimeFormatOptions = {
  year: 'numeric',
  month: 'long',
  day: '2-digit',
}
const { description, pubdate, url, title } = Astro.props
const date = new Date(pubdate).toLocaleDateString('en-GB', options_date)
---

<a href={url} rel="noopener noreferrer">
  <div class="circle"></div>
  <article>
    <h2>{title}</h2>
    <h3>{date}</h3>
    <p>{description}</p>
  </article>
</a>

<style>
  .circle {
    display: none;
  }
  @media (min-width: 900px) {
    .circle {
      margin: 1rem 1rem 1rem 0rem;
      position: relative;
      display: flex;
      visibility: visible;
      height: 1.5rem;
      width: 1.5rem;
      border-radius: 50%;
      background-color: var(--c-darkpurple);
    }

    a:hover > .circle {
      transform: none;
    }

    article {
      margin-left: 0.5rem;
    }
  }

  a {
    align-items: center;
    justify-content: center;
    display: flex;
    text-decoration: none;
    height: auto;
    margin: 0.5rem;
    width: 100%;
  }
  p {
    color: white;
    text-align: left;
    font-size: 1.1em;
    margin: 0.5em;
  }
  article > h2 {
    margin: 0.3rem 0.5rem;
    color: var(--c-darkpurple);
    font-size: 1.5rem;
    line-height: normal;
    text-decoration: none;
  }
  article > h3 {
    margin: 0.2em 0.5rem;
    color: white;
    font-size: 1rem;
    line-height: normal;
    text-decoration: none;
  }
  article {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    flex-direction: column;
    align-items: flex-start;
    align-content: flex-start;
    justify-content: center;
    background-color: var(--c-darkergray);
    padding: 10px;
    text-align: center;
    transition: transform var(--speed) var(--ease);
    min-height: 100%;
  }
  a:hover > article {
    transform: scaleY(102.5%) scaleX(101%);
  }
</style>