---
export interface Props {
  title: string
  hidetitle?: boolean
  description: string
}

const { title, hidetitle, description } = Astro.props
const override = hidetitle ? "display: None" : ""
---

<div class="base">
  <h1 style={override}>{title}</h1>
  <h2 style={override}>{description}</h2>
  <div>
    <slot />
  </div>
</div>

<style>
  div {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;

    div {
      gap: 1em;
      align-self: center;
      flex-flow: row wrap;
      padding-top: 1em;
      position: relative;
    }

    h1 {
      font-size: 40px;
      line-height: 48px;
      letter-spacing: -1px;
      color: white;
      margin: 2rem auto 0px auto;
      padding: 0.25rem 1.5rem;
      border-radius: 0.5rem;
      max-width: max-content;
      background-color: var(--c-darkgray);
      padding-bottom: 0.5rem;
    }

    h2 {
      color: white;
      font-size: 16px;
      font-weight: 600;
      max-width: 75;
      margin: 1rem;
      line-height: 20px;
      text-align: center;

      @supports (text-align-last: center) {
        text-align: justify;
        text-align-last: center;
      }
    }
  }

  .base {
    margin-left: 1rem;
    margin-right: 1rem;
  }
  @media (min-width: 512px) {
    div {
      row-gap: 1.5em;
      column-gap: 1.5em;
    }
  }

  @media (min-width: 1000px) {
    .base {
      margin-left: 3rem;
      margin-right: 3rem;
    }
  }

  @media (min-width: 1140px) {
    .base {
      margin-left: 10%;
      margin-right: 10%;
    }

    div {
      h1 {
        margin-left: unset;
        margin-right: unset;
      }
      h2 {
        text-align: left;
        @supports (text-align-last: center) {
          text-align-last: unset;
        }
      }
    }
  }
</style>
