@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .nav-bar {
    position: relative;
    width: 100vw;
    height: auto;
    flex-direction: row;              /* image left, text right */
    justify-content: center;
    align-items: center;
    gap: 1rem;
    text-align: center;
  }

  #portrait {
    width: 30%;
    max-width: 120px;
    margin: 0;
    padding: 1em;
  }

  /* Wrap text + icons in a vertical column */
  .nav-bar-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-right: 1em;
    flex: 1; /* take up remaining space */
  }

  .nav-buttons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav-bar h2,
  .nav-bar p {
    margin: 0.5rem 0;
  }

  .nav-bar center { /* the icons container */
    display: flex; /* use flexbox for layout */
    flex-wrap: wrap; /* if the icons overflow, wrap to next line */
    gap: 0.5rem; /* space between icons */
  }

  .internal-link {
    font-size: 12px;
    min-width: 40%;
  }

  .link-image {
    width: 28px;
    height: 28px;
  }

  #text-content {
    margin-left: 0;
    padding: 5%;
  }

  .katex-html {
    font-size: 0.8em;
  }
}
