@import "./normalize.css";

@import url("https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,100..900;1,100..900&family=Sarabun:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800&display=swap");

:root {
  --site-bg: #202426;
  --site-bg: #f5f5f5;
  --site-fg: #323232;

  --header-height: 100px;

  --menu-bg: #8c8c88;
  --menu-bg: #9da65d;
  --menu-bg: #1d1d1d;
  --menu-fg: #f2f2f2;

  --site-primary-fg: #555;
  --site-primary-bg: #000;
}

html {
  background-color: #fff;
  background-color: rgb(245, 245, 245);
  color: #454545;
  font-family: "Sarabun", sans-serif;
  font-size: 137.5%;
  -webkit-font-smoothing: antialiased;
}

html,
body {
  margin: 0;
  padding: 0;
  color: #303030;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  min-height: 100vh;

  main {
    flex-grow: 1;
  }
}

a {
  color: navy;
}

h1 {
  font-size: 2.5em;
  font-size: 2em;
  font-weight: 800;
  line-height: calc(1ex / 0.42);
  margin: calc(1ex / 0.42) 0;

  /*
  # &:first-child {
  #   margin-top: 0;
  # }
  */
}

h2 {
  font-size: 2em;
  font-size: 1.65em;
  line-height: calc(1ex / 0.42);
  margin: calc(1ex / 0.42) 0;

  &:first-child {
    margin-top: calc(1ex / 0.84);
  }
}

h3 {
  font-size: 1.75em;
  font-size: 1.5em;
  line-height: calc(1ex / 0.38);
  margin: calc(1ex / 0.38) 0;
}

h4 {
  font-size: 1.5em;
  font-size: 1.35em;
  line-height: calc(1ex / 0.37);
  margin: calc(1ex / 0.37) 0;
}

p {
  font-size: 1em;
  line-height: calc(1ex / 0.32);
  margin: calc(1ex / 0.32) 0;
}

article {
  margin-top: 1rem;
  margin-bottom: 1rem;

  .hero {
    max-height: calc(var(--header-height) * 3);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;

    img {
      min-width: 100%;
      max-width: 100%;
    }
  }
}

article+article {
  border-top: 1px solid var(--site-bg);
}

main article:first-child {
  margin-top: 0;
}

section {
  margin: 1rem 2rem;
}

.text-nowrap {
  white-space: nowrap;
}

.text-center {
  text-align: center;
}

header {
  position: sticky;
  top: 0;
  border-bottom: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2em;
  background-color: var(--site-bg);
  height: var(--header-height);

  padding: 0 2rem;

  button.menu-button {
    position: relative;
    display: flex;
    border: 0;
    background: transparent;
    margin: 0;
    padding: 0.25em;
    font-size: 2em;
    width: 30px;
    height: 30px;
    cursor: pointer;

    svg {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;

      fill: var(--site-fg);

      &.menu-open-icon {
        transition: opacity 0.3s ease-in 0.1s;
        opacity: 1;
      }

      &.menu-close-icon {
        transition: opacity 0.15s ease-in;
        opacity: 0;
      }
    }
  }

  nav menu {
    margin: 0;
    padding: 0;
    list-style-type: none;
    color: var(--menu-fg);

    li {
      a {
        display: block;
        color: inherit;
        text-decoration: none;
      }
    }
  }
}

@media screen and (width < 850px) {
  header {
    .site-menu {
      position: fixed;
      z-index: 2;
      background-color: rgba(100, 100, 100, 0.45);
      backdrop-filter: blur(2px);
      width: 100vw;
      top: var(--header-height);
      bottom: 0;
      left: 0;

      opacity: 0;
      transition: opacity 500ms ease-in-out;

      pointer-events: none;

      menu {
        position: absolute;
        right: -320px;
        background-color: var(--menu-bg);
        width: 320px;
        height: 100%;
        overflow-y: auto;
        box-shadow: -4px 0px 4px rgba(25, 25, 25, 0.25);

        transition: right 200ms ease-out;

        li {
          border-bottom: 1px solid rgba(255, 255, 255, 0.1);

          a {
            padding: 1em 1.5em;

            &:hover {
              text-decoration: underline;
            }
          }
        }
      }
    }
  }
}

@media screen and (width >=850px) {
  :root {
    --menu-fg: #000;
  }

  header {
    button.menu-button {
      display: none;
    }

    nav.site-menu {
      transition: none;

      menu {
        transition: none;

        display: flex;
        flex-direction: row;
        gap: 1rem;
        align-items: stretch;

        li {
          font-size: 80%;
          vertical-align: middle;

          a {
            padding-bottom: 0.25em;
            border-bottom: 3px solid transparent;

            &:hover {
              border-bottom-color: saddlebrown;
            }
          }
        }
      }
    }
  }
}

.erin-sharp {
  display: flex;
  flex-direction: column;

  font-family: "Public Sans", sans-serif;
  color: #303030;
  text-decoration: none;
  font-size: 1rem;

  span:first-child {
    font-size: 128%;
    font-weight: 700;
  }

  span:last-child {
    position: relative;
    top: -7px;
    font-size: 122%;
    font-weight: 200;
  }

  &:hover span:last-child {
    color: saddlebrown;
  }
}

footer {
  margin-top: 10vh;
  min-height: calc(var(--header-height) * 2);
  background-color: #1d1d1d;
  color: #f2f2f2;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  font-weight: 300;
  font-size: 75%;
  padding: 2rem;

  menu {
    margin: 1em 0;
    padding: 0;
    list-style-type: none;
    display: flex;
    flex-direction: row;

    li {
      a {
        margin: 0.5em;
        display: inline-block;
        color: inherit;
        text-decoration: none;

        &:hover {
          text-decoration: underline;
        }
      }

      &:first-child a {
        margin-left: 0;
      }
    }
  }
}

.page-content {
  padding: 2rem;
}

body.show-menu {
  overflow: hidden;

  button.menu-button {
    svg.menu-open-icon {
      transition: opacity 0.15s ease-in;
      opacity: 0;
    }

    svg.menu-close-icon {
      transition: opacity 0.3s ease-in 0.1s;
      opacity: 1;
    }
  }

  .site-menu {
    pointer-events: all;
    opacity: 1;

    menu {
      transition: right 200ms ease-in-out;
      right: 0;
    }
  }
}