header .header_box {
  padding-top: 1em;
  padding-bottom: 1.5em;
  display: inline-flex;
  align-items: center;
  gap: 1em;
}

header {
  text-align: left;
}
header .header-image {
  width: 120px;
  margin-right: 13px;
  border-radius: 12px;
}
header .header-text h1 {
  font-size: 3em;
  line-height: 1em;
  margin: 0;
}
header .header-text h2 {
  font-size: 1.4em;
  margin: 0.3em 0;
  color: var(--muted-color);
}

@media (max-width: 480px) {
  header .header-text h1 {
    font-size: 1.8em;
  }
}

header,
#wrapper {
  padding: 0 10px;
  min-width: 500px;
  max-width: var(--small-screen-threshold);
  margin: auto;
}

#sidebar {
  display: none; /* Hidden by default on small screens */
}

/* Show sidebar on large displays */
@media (min-width: 1152px) {
  header,
  #wrapper {
    max-width: var(--wrapper-max-width);
  }
  #wrapper {
    display: flex;
  }
  #content {
    flex: 1;
    min-width: 0; /* Prevent flex item from overflowing */
    display: flow-root; /* Properly contain floats for date alignment */
  }
  #sidebar {
    display: block;
    width: var(--sidebar-width);
    flex-shrink: 0;
    margin-left: 32px;
  }

  .sidebar-section {
    background-color: var(--menu-background-color);
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
  }

  p.sidebar-title {
    font-style: italic;
    margin-bottom: 1.5em;
  }

  .sidebar-posts {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .sidebar-posts li {
    margin-bottom: 1em;
    padding-bottom: 1em;
    border-bottom: 1px solid var(--menu-emph-color);
  }

  .sidebar-posts li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .sidebar-posts a {
    display: block;
    font-size: 0.9em;
    line-height: 1.4em;
    margin-bottom: 0.3em;
  }

  .sidebar-posts a:hover {
  }

  .sidebar-date {
    display: block;
    font-size: 0.75em;
    color: var(--muted-color);
  }
}

/* Navigation at top right */
nav ul {
  float: right;
  list-style: none;
  margin: 0 0 0 3em;
  padding: 0;
}
nav li {
  float: left;
}
nav a {
  display: block;
  padding: 4.5em 10px 10px 10px;
  background-color: var(--secondary-color);
  color: var(--black-color);
}
nav a:hover {
  background-color: var(--primary-color);
  color: var(--white-color);
}
nav li.selected a {
  background-color: var(--primary-color);
  color: var(--white-color);
}

/* Post layout */
.post {
  margin-bottom: 4.5em;
  margin-left: var(--post-margin-left);
}
.post.archives {
  margin-bottom: 1.5em;
}
h1.title {
  margin-top: 0;
}

/* Mobile: remove left margin, stack date under title */
@media (max-width: 768px) {
  header,
  #wrapper {
    min-width: 0;
    padding: 0 15px;
  }

  .post {
    margin-left: 0;
  }
  .post.archives {
    margin-left: 0;
  }
}

.pages {
  line-height: 2.5em;
  background-color: var(--menu-background-color);
  color: var(--muted-color);
  border-radius: 5px;
  margin-bottom: 2em;
}
.pages a.next_page {
  float: right;
  width: 140px;
  text-align: center;
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
  background-color: var(--menu-emph-color);
}
.pages a.prev_page {
  float: left;
  width: 140px;
  text-align: center;
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
  background-color: var(--menu-emph-color);
}
.pages a {
  color: inherit;
  border: none;
}
.pages a:hover {
  font-weight: bold;
}
.pages span.pagination-center {
  display: block;
  margin: 0 160px;
  text-align: center;
}
.pages span.separator {
  display: inline;
  margin: 0 0.5em;
}
@media (max-width: 480px) {
  .pages a.next_page,
  .pages a.prev_page {
    width: 40px;
  }
  .pages .prev-next-text {
    display: none;
  }
  .pages span.pagination-center {
    margin: 0 50px;
  }
  .pages span.separator {
    margin: 0 0;
  }
}

/* Footer at bottom of page */
footer {
  line-height: 2.5em;
  text-align: center;
  color: var(--muted-color);
  margin: 3em 0;
  border: 1px solid var(--menu-emph-color);
  border-radius: 5px;
}
footer p {
  margin: 0;
}
