---
import '@fontsource/work-sans/800.css'
import '@fontsource/work-sans/600.css'
export interface Props {
  maintext: string
  subtext: string
  fadeout?: boolean
  baseurl?: string
  returnbutton?: boolean
}
const { maintext, subtext, fadeout, baseurl, returnbutton } = Astro.props
const displayFadeout = fadeout ? "": "display: none"
const displayBackButton = returnbutton ? "": "display: none"

let text
if (baseurl) {
  text = baseurl?.split("/").pop()
  text = text?.replace("-", " ").replace("-", ".")
  text = text?.includes('eq 20') ? text?.replace("eq", "EQ") : text
}

---

<div class="wrap">
  <div class="head">{maintext}</div>
  <div class="sub">{subtext}</div>
  <a href=`/${baseurl}` style={displayBackButton}>&lt&lt Back to {text}</a>
  <div class="fade" style={displayFadeout}></div>
</div>

<style>
  a {
    font-weight: 600;
    font-family: 'Work Sans', 'Helvetica Neue', Helvetica, Helvetica, Arial, sans-serif;
    color: white;
    margin: 1rem 0px 0px;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    background-color: var(--c-lightgray);
    border-radius: 10px;
    border-style: solid;
    border-width: 2px;
    border-color: var(--c-lightgray);
    text-transform: capitalize;
  }

  a:hover {
    border-color: var(--c-darkpurple);
  }

  .wrap {
    position: relative;
    width: 100%;
    display: flex;
    text-align: center;
    align-items: center;
    flex-wrap: wrap;
    flex-direction: column;
    color: var(--c-lighter);
    background-color: var(--c-darkergray);
  }

  .fade {
    margin-top: 2rem;
    background: linear-gradient(to bottom, transparent, var(--c-lightgray));
    height: 2.5rem;
    width: 100%;
  }

  .head {
    hyphens: auto;
    padding-top: 2rem;
    font-size: 2rem;
    font-weight: 800;
    font-family: 'Work Sans', 'Helvetica Neue', Helvetica, Helvetica, Arial,
      sans-serif;
  }

  .sub {
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Work Sans', 'Helvetica Neue', Helvetica, Helvetica, Arial,
      sans-serif;
  }

  .head {
    color: var(--c-darkpurple);
  }

  @supports (background-clip: text) {
    .head {
      background: linear-gradient(125deg, var(--c-darkpurple), var(--c-purplepink), var(--c-reddish) );
      background-clip: text;
      color: transparent;
    }
  }

  @media (min-width: 620px) {
    .head {
      hyphens: none;
      font-size: 3rem;
    }
    .sub {
      font-size: 0.75rem;
    }
  }

  @media (min-width: 1000px) {
    .head {
      font-size: 4rem;
    }
    .sub {
      font-size: 1rem;
    }
  }
</style>
