body {
  background-color: var(--base);
  color: var(--text);
  font-family: "JetBrains Mono", sans-serif;
  font-weight: 400;
  line-height: 1.7;
  max-width: 45em;
  margin: 0 auto;
  padding: 0 1rem;
  background-image:
    radial-gradient(var(--surface0) 1px, transparent 1px),
    radial-gradient(var(--surface0) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
  background-attachment: fixed;
}

main a,
main a:visited {
  color: var(--accent-primary);
  text-decoration: none;
  position: relative;
  font-weight: 500;
  transition: var(--hover-transition);
}

main a:hover {
  color: var(--accent-secondary);
}

main a::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 1px;
  bottom: 0;
  left: 0;
  background-color: var(--accent-secondary);
  transform: scaleX(0);
  transform-origin: bottom right;
  transition: transform 0.3s ease-out;
}

main a:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

header a,
header a:visited {
  color: var(--subtext1);
}

footer a,
footer a:visited {
  color: var(--overlay2);
}

p {
  margin: 1rem 0;
}

h1, h2, h3 {
  margin: 1.5rem 0 1rem;
  line-height: 1.4;
  font-weight: 600;
  position: relative;
  display: inline-block;
}

h1::after, h2::after, h3:not(.no-underline)::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 30%;
  height: 3px;
  background-color: var(--accent-secondary);
  border-radius: 10px;
}

.no-underline {
  display: block;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

code {
  color: var(--red);
  font-family: "JetBrains Mono";
}

main {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background-color: var(--base);
  box-shadow: var(--card-shadow);
  border-radius: 0.5rem;
}

footer {
  color: var(--overlay2);
  display: flex;
  justify-content: center;
  font-size: 0.85em;
  margin-top: 4rem;
  margin-bottom: 3rem;
  font-weight: 300;
}

header {
  display: flex;
  gap: 1em 0.5em;
  align-items: center;
  padding: 1em;
  justify-content: space-between;
}

hr {
  margin: 1.5rem 0;
  border: none;
  height: 1px;
  background-color: var(--surface0);
}

header a[href]:not(:hover) {
  text-decoration: none;
}

.nav {
  display: flex;
  padding: 0;
  margin: 0;
  list-style: none;
}

.nav-item {
  display: inline-block;
  margin-right: 1.5em;
  font-weight: 500;
  transition: var(--hover-transition);
  position: relative;
}

.nav-item:hover {
  color: var(--accent-secondary);
}

.nav a[href][aria-current="page"] {
  color: var(--accent-primary);
  font-weight: 600;
}

.nav a[href][aria-current="page"]::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--accent-primary);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2rem 0 2.5rem;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .hero {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
    margin: 3rem 0 3.5rem;
  }
}

/* Mobile styles */
@media (max-width: 767px) {
  body {
    padding: 0 1.25rem;
  }

  .hero {
    text-align: center;
    margin: 1.5rem 0 2rem;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  header nav {
    width: 100%;
  }

  .nav {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .nav-item {
    margin-right: 0;
  }

  #theme-toggle {
    align-self: flex-end;
  }
}

.headshot {
  max-width: 250px;
  width: 100%;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: var(--card-shadow);
  margin: 5px;
  border: 3px solid var(--accent-secondary);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.headshot:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

@media (max-width: 767px) {
  .headshot {
    max-width: 200px;
  }
}

.links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.links a {
  margin-left: 1rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

@media (max-width: 767px) {
  .links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .links p:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .links a {
    margin-left: 0;
  }
}

.timestamp {
  color: var(--subtext0);
  font-size: 0.9em;
}

/* https://www.a11yproject.com/posts/how-to-hide-content/ */
.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;
}

.visually-hidden:focus,
.visually-hidden:active {
  color: var(--blue);
  clip: auto;
  clip-path: none;
  height: auto;
  overflow: visible;
  position: static;
  white-space: normal;
  width: auto;
}

/* Add smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Improve focus styles */
:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Adjust images to be responsive */
img {
  max-width: 100%;
  height: auto;
}

/* Resume styles */
.resume-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.resume-header h2 {
  margin-top: 0;
  margin-bottom: 0;
}

.resume-header h2::after {
  width: 100%;
}

.download-button {
  display: inline-flex;
  align-items: center;
  background-color: var(--accent-primary);
  color: var(--base) !important;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 500;
  transition: var(--hover-transition);
  margin: 1rem 0;
}

.download-button:hover {
  background-color: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.download-button:hover::after {
  display: none;
}

@media (max-width: 768px) {
  .resume-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .download-button {
    margin-top: 1rem;
  }
}
