/* Reduce header size on mobile */
@media only screen and (max-width: 980px) {

  html {
    font-size: 14px;
    /* 1rem = 14px */
  }

  h1 {
    font-weight: var(--light-font-weight);
    font-size: 2.4rem;
    text-align: center;
  }

  h2 {
    font-size: 1.6rem;
    text-align: center;
  }

  h3 {
    font-size: 1.6rem;
    text-align: center;
  }

  h4 {
    font-size: 1.15rem;
    text-align: center;
  }

  textarea,
  select,
  input {
    width: 100%;
  }

  aside {
    width: 100%;
    float: none;
    margin-inline-start: 0;
  }

  section {
    padding: 1rem 2rem;
  }

  section h2 {
    margin-top: 4rem;
  }

  .grid-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    /* Add spacing between stacked elements */
  }

  .news * em {
    font-size: 1.6rem;
    font-weight: 400;
  }

  body * td,
  body * tr,
  body * th,
  body * p,
  .grid-item * h2,
  .grid-item * p,
  body * em,
  body * strong,
  body * button {
    font-size: 2rem;
    font-weight: var(--light-font-weight);
  }

  .grayList img {
    filter: none;
  }

  footer p {
    font-size: 0.75rem;
  }

  article * strong {
    font-size: 1.4rem; /* Make strong text slightly larger on mobile */
    font-weight: var(--heavy-font-weight);
  }

  main {
    grid-column:1;
    width: 100%;
  }
  .news p {
    margin-left: var(--sidenav-width);
  }
  .sidenav {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidenav-width);
    height: 100%;
    padding: 2px;
    background-color: var(--accent-bg);
    justify-content: space-between;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    /* overflow-y: auto; */
    /* Allow scrolling if content overflows */
    align-items: center;
    /* Center links horizontally */
    z-index: 1000;
    /* Ensure it stays above other elements */
  }

  .sidenav a {
    text-decoration: none;
    color: var(--text-light);
    display: block;
    margin: 0; /* Remove margin to allow even spacing */
    font-size: 2rem;
    transform: rotate(-90deg);
    flex: 1;
    /* Spread links out evenly */
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .sidenav button {
    margin-block-start: 4rem;
    display: block;
    transform: rotate(-90deg);
    flex: 1;
    /* Spread links out evenly */
    display: flex;
    align-items: center;
    justify-content: center;
  }
  dialog {
    width: 60rem; /* Increase the width of the dialog */
  }
  dialog p,
  dialog img,
  dialog a {
    max-width: 100%;
    width: 100%; /* Ensure the image and link take full width */
    display: block; /* Ensure proper block-level rendering */
  }
  .grayList img {
    filter: grayscale(100%);
    min-width: 48px;
    margin-inline-end: 6rem;
  }
  .contact-grid {
    display: block;
  }
  .contact-grid h3 {
    font-size: 2.5rem;
  }
  .contact-grid .smaller {
    font-size: 1.5rem;
  }
  .theme-toggle {
    font-size: 1.5rem;
    padding: 0.5rem;
    margin-top: 0.5rem;
  }

}

@media only screen and (max-width: 480px) {
  html {
    font-size: 22px;
    /* 1rem = 12px */
  }
}

/* Misc body elements */
@media print {
  @page {
    margin: 1cm;
  }

  body {
    display: block;
  }

  article {
    border: none;
    padding: 0;
  }

  a[href^="http"]::after {
    content: " <" attr(href) ">";
  }

  abbr[title]:after {
    content: " (" attr(title) ")";
  }

  p {
    widows: 3;
    orphans: 3;
  }

  hr {
    border-top: 1px solid var(--border);
  }

  mark {
    border: 1px solid var(--border);
  }

  pre,
  table,
  figure,
  img,
  svg {
    break-inside: avoid;
  }

  pre code {
    white-space: pre-wrap;
  }
}