body {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.animated-p {
  animation-name: anim-text, fade-in;
  animation-duration: 0.5s;
}

.animated-header {
  animation-name: fade-in, slide-in;
  animation-duration: 0.5s;
}

.animated-quote {
  span:nth-child(2n) {
    animation: blur-in-and-out 8s 0s ease-in infinite;
  }
  span:nth-child(2n + 1) {
    animation: blur-in-and-out 8s 0.2s ease-in infinite;
  }
  span:nth-child(3n) {
    animation: blur-in-and-out 8s 0.4s ease-in infinite;
  }
  span:nth-child(4n) {
    animation: blur-in-and-out 8s 1.1s ease-in infinite;
  }
  span:nth-child(5n) {
    animation: blur-in-and-out 8s 0.5s ease-in infinite;
  }
  span:nth-child(6n) {
    animation: blur-in-and-out 8s 0.8s ease-in infinite;
  }
  span:nth-child(7n) {
    animation: blur-in-and-out 8s 0.9s ease-in infinite;
  }
  figcaption {
    animation: blur-in-and-out 8s 0.6s ease-in-out infinite;
  }
}

@keyframes anim-text {
  from {
    transform: rotateY(-20deg);
  }
}

@keyframes slide-in {
  from {
    transform: translateY(-30%);
  }
}

@keyframes fade-in {
  from {
    opacity: 0.5;
  }
}

header {
  --transition-duration: 0.5s;
  --header-height: 90px;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: center;

  .shadow {
    position: absolute;
    height: var(--header-height);
    width: 100%;
    z-index: -1;
    background: linear-gradient(black, 80%, transparent);
  }

  #toggle,
  .toggle-container {
    display: none;
  }

  #logo {
    position: absolute;
    left: 0;
    margin: 0.5rem 2rem;
    img {
      height: var(--header-height);
      filter: saturate(80%);
    }
  }

  #social {
    position: absolute;
    right: 0;
    font-size: 1.5rem;
    margin-right: 3rem;
  }

  nav {
    font-size: 1.5rem;
    font-weight: 200;
    font-variant: small-caps;
    text-transform: uppercase;
    margin: 1rem;
    transition: var(--transition-duration);
  }

  ul {
    display: flex;
    gap: 1.5rem;
    padding: 0;
    margin: 0;

    a.active:not(:hover) {
      font-weight: 400;
      text-shadow: 1px 1px 2px var(--hl-color);
    }
  }
  .wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem;
  }

  @media (max-width: 51em) {
    .wrap {
      display: none;
      width: 100%;
      padding-top: var(--header-height);
      background-color: color-mix(in srgb, var(--bg-color) 90%, transparent);
      justify-content: space-between;
      align-items: start;
      margin: 0;
    }
    ul {
      flex-direction: column;
      gap: 0.5rem;
    }
    #social {
      position: inherit;
      margin: 1rem 2rem 1rem;
    }
    #toggle:checked {
      & ~ .toggle-container {
        border: 4px solid var(--dimmed-fg-color);
        border-radius: 50%;
        height: 40px;
        top: 2rem;
        right: 2rem;
        width: 40px;
        transform: rotate(-135deg);
        &::before {
          background: var(--dimmed-fg-color);
          top: 1rem;
          left: 4px;
          width: 24px;
        }
        &::after {
          background: var(--dimmed-fg-color);
          opacity: 1;
          top: 1rem;
          left: 4px;
          visibility: visible;
          width: 24px;
        }
        &:hover {
          border-color: var(--hl-color);
          &::before,
          &::after {
            background: var(--hl-color);
          }
        }
      }
      ~ .wrap {
        display: flex;
        position: absolute;
        justify-content: center;
      }
    }

    /* Toggle Button */
    .toggle-container {
      background: none transparent;
      border: 4px solid var(--fg-color);
      border-left: 0 solid transparent;
      border-right: 0 solid transparent;
      cursor: pointer;
      display: block;
      height: 24px;
      position: absolute;
      top: 2.5rem;
      right: 2rem;
      width: 2.5rem;
      transition: all 0.2s;
      &::before {
        background: var(--fg-color);
        content: "";
        height: 4px;
        left: 0;
        position: absolute;
        top: 6px;
        width: 2.2rem;
        transition: all 0.2s;
      }
      &::after {
        background: var(--fg-color);
        content: "";
        height: 4px;
        left: 0;
        position: absolute;
        top: 6px;
        opacity: 0;
        visibility: hidden;
        width: 100%;
        transform: rotate(90deg);
        transition: all 0.2s;
      }
      &:hover {
        border-color: var(--hl-color);
        &::after,
        &::before {
          background: var(--hl-color);
        }
      }
    }
  }
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;

  section {
    display: flex;
    margin: 0 3rem 2rem;
    justify-content: center;
  }
}

.content-max-width {
  max-width: 1100px;
}

#slideshow {
  position: relative;
  width: 100%;
  margin: -90px 0 4rem; /* 90px is var(--header-height) */
  height: 100vh;
  img {
    position: absolute;
    top: 0;
    left: 0;
    object-fit: cover;
    width: 100%;
    height: 100vh;
    opacity: 0;
    animation: slideshow 50s infinite;

    &:nth-child(2) {
      animation-delay: 10s;
      object-position: 20% 50%;
    }
    &:nth-child(3) {
      animation-delay: 20s;
    }
    &:nth-child(4) {
      animation-delay: 30s;
    }
    &:nth-child(5) {
      animation-delay: 40s;
    }
  }
}

@media (max-width: 51em) {
  #slideshow {
    margin: 0 0 4rem;
  }
}

@keyframes slideshow {
  5% {
    opacity: 1;
  }
  25% {
    opacity: 1;
  }
  30% {
    opacity: 0;
  }
}

@keyframes blur-in-and-out {
  0% {
    opacity: 0;
    filter: blur(0.5rem);
  }
  15% {
    opacity: 1;
    filter: blur(0);
  }
  70% {
    filter: blur(0);
    opacity: 1;
  }
  80% {
    filter: blur(0.5rem);
    opacity: 0;
  }
  90% {
  }
}

#project {
  gap: 2rem;
  flex-wrap: wrap;
  .left {
    width: 55%;
    flex-grow: 1;
  }
  .right {
    width: 40%;
    align-content: center;
  }
  .quote {
    margin: 0;
    blockquote {
      font-family: Georgia, "Times New Roman", Times, serif;
      font-size: 2.7rem;
      font-style: italic;
      font-weight: 300;
      padding-bottom: 2rem;
      margin: 2.5rem 1rem 0;

      span {
        opacity: 0;
      }
    }
    figcaption {
      font-weight: 100;
      display: flex;
      justify-content: center;
      margin-left: 50%;
      opacity: 0;
    }
  }
}

#members {
  flex-direction: column;
  align-items: center;
  .cards {
    display: flex;
    flex-wrap: wrap;
  }
  .card {
    width: 50%;
    min-width: 300px;
    padding: 1rem;
    flex-grow: 1;
    margin-bottom: 2rem;
  }
  h3 {
    text-transform: uppercase;
    margin: 0.8rem 0 0;
    padding: 0;
  }
  h4 {
    font-variant: small-caps;
    font-weight: 400;
    margin: 0.2rem;
    padding: 0;
  }
  .highlight {
    font-size: x-large;
    color: var(--hl-color);
  }
  p {
    margin-top: 0.5rem;
  }
  .attribute {
    font-style: italic;
    font-size: 0.8rem;
  }
  .value {
    font-variant: small-caps;
    font-size: 1.1rem;
  }

  @media (max-width: 400px) {
    .card {
      min-width: 200px;
    }
  }
}

#photos {
  flex-direction: column;
  max-width: 100%;
  overflow-x: auto;
  h2 {
    align-self: center;
    margin-bottom: 3rem;
  }

  #gallery {
    display: flex;
    overflow: auto hidden;
    align-items: flex-start;
    padding: 1rem;
    cursor: grab;
  }

  .polaroid {
    margin: 1rem;
    padding: 2rem 2rem 6rem;
    background-color: white;
    border: 1px solid gray;
    -webkit-box-shadow: 5px 5px 15px 5px var(--bg-color);
    box-shadow: 5px 5px 15px 5px var(--bg-color);
    &:hover {
      filter: none;
    }

    @media (min-width: 51em) {
      filter: grayscale(100%);
    }

    img {
      object-fit: cover;
      aspect-ratio: 1/1;
      width: 100%;
      min-width: 300px;
      max-width: 500px;
      border: 1px solid gray;
    }
  }
  .polaroid:nth-of-type(2n + 1) {
    rotate: -6deg;
  }
  .polaroid:nth-of-type(2n) {
    rotate: 3deg;
  }
}

#videos {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;

  .video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio (divide 9 by 16 = 0.5625) */
    iframe {
      border: none;
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
      width: 100%;
      height: 100%;
    }
  }
}

#contact {
  display: flex;
  align-items: center;
  flex-direction: column;
  text-align: center;
  overflow-wrap: anywhere;
  p a i {
    padding: 0 1rem;
    vertical-align: middle;
  }
  .social {
    font-size: 3rem;
    ul {
      display: flex;
      gap: 3rem;
      flex-wrap: wrap;
      justify-content: center;
      a {
        display: flex;
        flex-direction: column;
        align-items: center;
      }
      span {
        font-size: 0.8rem;
        padding: 0.5rem 0;
      }
    }
  }
}

footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 300;
  margin-bottom: 1rem;

  hr {
    width: 30%;
  }

  #copyright {
    color: var(--ll-color);
    text-align: center;
    padding: 0 1rem;
  }
  .legal {
    color: var(--hl-color);
    text-decoration: underline;
  }
}

#lightbox {
  display: none;
  padding: 1em;
  background: rgba(0, 0, 0, 0.8);
  position: fixed;
  z-index: 999;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;

  &:target {
    display: block;
  }

  span {
    display: block;
    width: 100%;
    height: 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
  }
}

.maximizable {
  cursor: pointer;
}
