main,
footer {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

h2 {
  font-size: var(--font-h2);
  line-height: 1.1;
  margin: 0 0 2rem;
}

footer {
  padding-block: var(--space-section) clamp(2.5rem, 2rem + 2vw, 4rem);
  margin-bottom: 0;
}

.page-end {
  display: flex;
  justify-content: center;
  padding-block: 1rem clamp(3rem, 2rem + 4vw, 5rem);

  svg {
    width: 64px;
    height: auto;
    opacity: 0.7;
  }
}

#contact {
  font-size: var(--font-body-base);
  line-height: 1.55;
  color: var(--text-secondary);
}

#contact a {
  position: relative;
  text-decoration: none;
  transition: color 0.45s ease;

  &::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.3em;
    height: 3px;
    background-image: var(--squiggle-underline);
    background-repeat: repeat-x;
    background-size: 6px 3px;
    transform: scaleX(1);
    transform-origin: right;
    transition: var(--transition-underline);
  }
}

/* Hero */
#intro {
  position: relative;
  padding-block: clamp(4rem, 3rem + 7vw, 8rem) var(--space-section);
}

#intro h1 {
  font-size: var(--font-h1-hero);
  line-height: 1.04;
  letter-spacing: -0.015em;
  margin: 0 0 1.25rem;
  max-width: 16ch;
}

#intro h1 em {
  position: relative;
  font-style: italic;
  color: var(--accent-primary);
}

#intro h1 em::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(14rem, 40vw, 26rem);
  aspect-ratio: 1;
  background: radial-gradient(
    circle at center,
    var(--glow-accent) 0%,
    transparent 60%
  );
  pointer-events: none;
  z-index: -1;
  transition: var(--transition-theme-opacity);
}

.lede {
  font-size: var(--font-body-base);
  line-height: 1.55;
  max-width: 46ch;
  color: var(--text-secondary);
  margin: 0 0 2.5rem;
}

.big-btn--hover-wrap {
  margin: 0;
  padding: 0;
  display: inline-block;
}

/* Buttons */
.big-btn,
.big-btn:link,
.big-btn:visited {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--font-button-big);
  color: var(--text-primary);
  line-height: 1em;
  text-align: center;
  text-decoration: none;
  padding: 0.7em 1.5em;
  display: inline-block;
  border: 3px solid var(--border-color);
  border-radius: 5px;
  box-shadow:
    0 0 0 0 var(--accent-primary) inset,
    0.2em 0.15em 0 0 var(--accent-primary);
  transition: var(--transition-btn);

  &:focus-visible {
    outline: 2px dotted var(--accent-primary);
    outline-offset: 5px;
    border-radius: 5px;
    box-shadow: 0 0 10px 0 var(--focus-glow);
  }
}

/* Projects  */
#projects {
  padding-block: 0 var(--space-section);
}

.projects-container {
  display: grid;
  grid-gap: clamp(1.25rem, 3vw, 2.25rem);
  grid-template-columns: 1fr;

  .project-card {
    background-color: var(--project-bg);
    border: 3px solid var(--border-color);
    box-shadow: 0.35em 0.3em 0 0 var(--accent-primary);
    overflow: hidden;
    border-radius: var(--radius-card);
    height: 100%;
    will-change: transform;
    transition:
      transform 0.2s ease,
      box-shadow 0.2s ease;

    &:has(> a:focus-visible) {
      outline: 2px dotted var(--accent-primary);
      outline-offset: 6px;
      box-shadow: 0 0 14px 0 var(--focus-glow);
    }

    a {
      display: flex;
      flex-direction: column;
      height: 100%;
    }

    .project-thumbnail {
      height: 200px;
      overflow: hidden;

      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: 0.25s ease;
      }
    }

    .project-desc {
      padding: 1em;
      display: flex;
      flex-direction: column;
      flex-grow: 1;

      .project-title {
        font-size: var(--font-h3);
        font-weight: 800;
        line-height: 1.15;
        color: var(--text-primary);
        border-bottom: 1px solid var(--border-color);
        padding: 0 0 0.625em 0;
      }

      .project-about {
        font-size: var(--font-card-body);
        line-height: 1.55;
        color: var(--text-secondary);
        margin: 0.625em 0 1.1em;
        flex-grow: 1;
      }

      .project-tag {
        position: relative;
        padding-bottom: 0.3em;
        transition: 0.25s ease;

        &::after {
          content: "";
          position: absolute;
          left: 0;
          right: 0;
          bottom: 0;
          height: 3px;
          background-image: var(--squiggle-underline);
          background-repeat: repeat-x;
          background-size: 6px 3px;
        }
      }
    }
  }
}

/* Illustrations */
#illustrations > p {
  font-size: var(--font-body-base);
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 2rem;
}

/* === Tablet: 650px+ === */

@media screen and (min-width: 650px) {
  .projects-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* === Major Animations === */

@media (hover: hover) {
  .big-btn--hover-wrap:hover {
    .big-btn {
      box-shadow:
        0 3em 0 0 var(--accent-primary) inset,
        0 0 0 0 var(--btn-shadow);
      transform: translate(0.2em, 0.1em);
      color: var(--text-inverse);
    }
  }

  .project-card-wrapper:hover {
    .project-card {
      transform: translate(0.35em, 0.3em);
      box-shadow: 0 0 0 0 var(--accent-primary);
    }
    .project-thumbnail img {
      transform: scale(1.05);
    }
  }

  #contact a:hover::after {
    transform: scaleX(0);
  }
}

/* Higher specificity than the hover rule above so the press state actually
   shows while hovering-then-clicking (the normal desktop click sequence) */
.big-btn--hover-wrap:active .big-btn {
  box-shadow:
    0 3em 0 0 var(--accent-primary) inset,
    0 0 0 0 var(--btn-shadow);
  transform: translate(0.2em, 0.15em) scale(0.97);
  color: var(--text-inverse);
  transition-duration: 0.08s;
}

@media (prefers-reduced-motion: reduce) {
  .big-btn--hover-wrap:hover .big-btn,
  .project-card-wrapper:hover .project-card {
    transform: none;
  }

  #contact a::after {
    transition: none;
  }
}
