*, *::before, *::after {
  box-sizing: border-box;
  /* outline: 1px solid red; */
}

.visually-hidden:not(:focus):not(:active) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

:root {
  background-color: var(--bg);
  color: var(--primary);
  font-family: "Work Sans", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  scroll-behavior: smooth;

  /* CSS Variables: */
  --bg: oklch(96.592% 0.00261 230.414);
  --primary: oklch(18.604% 0.00261 248.156);
  --bg-cards: oklch(76.617% 0.11875 265.702);
  --link-color: oklch(48.915% 0.20621 261.704);
  --grey: oklch(90.468% 0.0036 220.822);
  --dark-grey: oklch(68.622% 0.00008 271.152);
  --border-radius-small: 0.5em;

  @media (min-width: 50em) {
    font-size: 1.125rem;
  }
  @media (min-width: 100em) {
    font-size: 1.25rem;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.container {
  max-width: 60rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

.textarea {
  max-width: 40em;
}

header, footer {
  background-color: var(--primary);
  color: var(--bg);
}

main {
  padding-block-start: 2vh;
  padding-block-end: 4vw;
}

@keyframes rotate {
  from {
    transform: rotate(0deg) scale(1.5);
  }
  to {
    transform: rotate(360deg) scale(1.5);
  }
}

header {
  .container {
    > a:first-child {
      display: inline-block;
      color: inherit;
      padding-block: 1.5em;

      > span {
        transition: transform;

        &:hover {
          animation-name: rotate;
          animation-duration: 5s;
          animation-iteration-count: infinite;
          animation-timing-function: linear;
        }
      }
    }

    @media (min-width: 40em) {
      display: flex;
      justify-content: space-between;
      align-items: center;

      .navlist {
        display: flex;
        gap: 1em;
        margin-block-end: 0;

        li {
          a {
            width: auto;

            &[aria-current="page"] {
              display: inline-block;
              position: relative;
            }

            &::before {
              width: 0;
              margin-inline-end: 0;
            }

            &[aria-current="page"]::before {
              content: "▾";
              position: absolute;
              width: 1em;
              top: -.4em;
              left: calc(50% - 0.5em);
            }
          }
        }
      }
    }
  }
}

a {
  color: var(--link-color);
  text-decoration: none;

  &:hover {
    color: oklch(from var(--link-color) calc(l - 0.2) c h);
  }

  &.blocklink {
    display: inline-block;
    width: 100%;
    height: 100%;
  }

  &.bordered-link {
    border-radius: .5em;
    border: 2px solid var(--link-color);
    padding: .5em;
  }
}

.navlist {
  padding: 0;
  margin: 0;
  list-style: none;
  margin-block-end: 1em;

  li {
    a {
      display: inline-block;
      color: inherit;
      text-decoration: none;
      border-radius: 3em;
      padding-block: 0.5em;
      padding-inline: 1.5em;
      margin-block: 0.2em;
      width: 12em;
      font-weight: 600;

      &:hover {
        background-color: var(--bg);
        color: var(--primary);
      }

      &:focus-visible {
        outline: 4px dotted var(--link-color);
      }

      &::before {
        content: "";
        display: inline-block;
        width: 1em; /* reserve space for ► arrow */
        margin-inline-end: .5em;
      }

      &[aria-current="page"]::before {
        content: "►";
        margin-inline-end: .5em;
      }
    }
  }
}

.socialmedia {
  max-width: 24rem;
  margin-inline: auto;
  padding-inline: 1.25rem;

  ul {
    display: flex;
    justify-content: space-around;
    list-style: none;
    padding: 0;

    a {
      display: inline-flex;
      align-items: center;
      gap: 1em;
      flex-direction: column;
      text-decoration: none;
      color: inherit;

      &:hover {
        color: var(--link-color);
      }
    }
  }
}

footer {
  .container {
    display: flex;
    flex-wrap: wrap;
    gap: 2em;
    padding-block: 1.5em;
    justify-content: space-between;
    align-items: center;

    a {
      color: inherit;

      &:hover {
        transform: scale(1.35);
      }
    }
  }

  @media (min-width: 40em) {
    .container {
      justify-content: space-evenly;
    }
  }
}

.icon-small {
  min-width: 1.7em;
  min-height: 1.7em;
}

.icon-large {
  min-width: 4em;
  min-height: 4em;
}

.favicon {
  display: inline-block;
  mask: url("./images/favicon.svg") no-repeat center;
  background-color: currentColor;
  min-width: 2.5em;
  min-height: 2.5em;
}

.github-icon {
  display: inline-block;
  mask: url("./images/github-icon.svg") no-repeat center;
  background-color: currentColor;
}

.linkedin-icon {
  display: inline-block;
  mask: url("./images/linkedin-icon.svg") no-repeat center;
  background-color: currentColor;
}

.email-icon {
  display: inline-block;
  mask: url("./images/email-icon.svg") no-repeat center;
  background-color: currentColor;
}

.location-icon {
  display: inline-block;
  mask: url("./images/location-icon.svg") no-repeat center;
  background-color: currentColor;
}

.py1 {
  padding-block: 1rem;
}

.px1 {
  padding-inline: 1rem;
}

.my1 {
  margin-block: 1rem;
}

.my3 {
  margin-block: 3rem;
}

.mx1 {
  margin-inline: 1rem;
}

.row-between {
  display: flex;
  justify-content: space-between;
}

.row-around {
  display: flex;
  justify-content: space-around;
}

.cards {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 60rem;

  li {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 16rem;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 0 .2rem oklch(0 0 0 / .2);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    background-color: oklch(from var(--bg-cards) l c h / 15%);

    &:hover {
      transform: translateY(-4px);
      box-shadow: 0 0 2rem oklch(0 0 0 / .4);
    }

    > div:first-child {
      display: flex;
      flex-direction: column;
      padding: 1rem;
      margin: 0;

      > h2, > h3 {
        margin-top: 0;
      }
      > p {
        font-weight: 500;
      }
      > a {
        position: relative;
        z-index: 1;
        align-self: flex-end;
        color: var(--link-color);
        text-decoration: none;
        font-style: italic;
      }
    }

    > a {
      position: absolute;
      inset: 0;
      text-indent: 120%;
      overflow: hidden;
      white-space: nowrap;

      &:hover {
        background-color: oklch(from var(--bg-cards) l c h / 8%);
      }
    }

    > div:last-child {
      height: 10rem;
      width: 100%;
      order: -1;

      img {
        display: block;
        height: 100%;
        width: 100%;
      }
    }
  }
}

/* Typography */
@font-face {
  font-family: "Work Sans";
  font-style: normal;
  src: url("./fonts/WorkSans-VariableFont_wght.woff2") format("woff2");
}

@font-face {
  font-family: "Work Sans";
  font-style: italic;
  src: url("./fonts/WorkSans-Italic-VariableFont_wght.woff2") format("woff2");
}

h3 {
  font-size: 1.2em;
  line-height: 1.3;
  margin-block-start: 3rem;
  margin-block-end: 1rem;

  + p {
    margin-block-start: 0;
  }
}

h2 {
  font-size: 1.8em;
  line-height: 1.2;
  margin-block-start: 3rem;
  margin-block-end: 1rem;

  &:has(+ h3) {
    margin-block-end: 0.5rem;
  }
  + p, + h3 {
    margin-block-start: 0;
  }
}

h1 {
  font-size: 2.7em;
  line-height: 1.1;
  margin-block-start: 3rem;
  margin-block-end: 1rem;

  &:has(+ h2) {
    margin-block-end: 0.5rem;
  }
  + p, + h2 {
    margin-block-start: 0;
  }
}

p {
  margin-block: 1.5rem;
}

.break-long-words {
  word-break: break-all;
}

#aboutme {
  ul {
    padding-inline-start: 1.1em;
  }

  .contact-list {
    padding-inline-start: 0.25em;

    li {
      display: flex;
      gap: 1rem;
      margin-block: 0.5rem;

      a {
        display: flex;
        gap: 1rem;
        text-decoration: none;
        color: inherit;
      }
    }
  }

  .tiered-list {
    li {
      margin: 0 0 .25rem 0;

      p {
        margin: 0 0 .25rem 0;

        &:first-child {
          display: flex;

          span:first-child {
            display: inline-block;
            min-width: 8rem;
            font-style: italic;
          }
          span:nth-child(2) {
            font-weight: 600;
          }
        }

        &:nth-child(2) {
          margin-inline-start: 8rem;
        }
      }
    }
  }
}

.button {
  padding: 0.5em;
  background-color: var(--grey);
  cursor: pointer;
  font-size: 0.875em;
  border-radius: var(--border-radius-small);
  border: 1px solid var(--dark-grey);

  &:hover {
    background-color: oklch(from var(--grey) calc(l - 0.05) c h);
  }
}

/* Contact Form Fields: */
#contact-form {
  h2 {
    font-size: 1.4rem;
  }

  input[type=text],
  input[type=email],
  textarea {
    display: block;
    width: 100%;
    max-width: 40rem;
    padding: .75em;
    border: 1px solid #666;
    border-radius: .3rem;
  }

  input[type=submit] {
    margin-top: 3rem;
    padding: .5em 2em;
    cursor: pointer;
  }
  label[for=name], label[for=email], label[for=message] {
    display: block;
    margin-top: 3rem;
    margin-bottom: .2em;
    font-weight: bold;
  }

  .message {
    font-size: 1.4rem;
  }
  .message.error {
    color: #b90e0a;
  }
}
