/* General body styles */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header and footer styles */
header, footer {
  background-color: var(--header-footer-bg);
  padding: 1em;
  text-align: center;
}

/* Navigation bar styles */
header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 10%; /* Add margin for better reading experience on desktop */
}

.nav-left .site-name {
  font-size: 1.5em;
  font-weight: bold;
}

.nav-right {
  display: flex;
  align-items: center;
}

header nav a, footer nav a {
  margin: 0 1em;
  text-decoration: none;
  color: var(--nav-link-color); 
  font-size: 1em;
}

header nav a {
  font-weight: 600; /* Make top bar links bold */
}

/* Mobile optimized navigation */
@media (max-width: 768px) {
  header nav {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav-right {
    flex-direction: column;
    align-items: flex-start;
    margin-top: 1em;
  }
  header nav a {
    margin: 0.5em 0;
  }
}

/* Main content styles */
main {
  padding: 2em;
  flex: 1;
}

.home-page {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1em;
}

.other-page {
  display: flex;
  flex-direction: column;
}

.blog-post {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1em;
  margin-bottom: 1em;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  border-radius: 10px;
}

/* Root variables for light and dark mode */
:root {
  --bg-color: #e4e8e9;
  --text-color: #000000;
  --header-footer-bg: #ffffff; /*#f1f1f1;*/
  --nav-link-color: #000000;
  --border-color: #cccccc;
}

body.dark-mode {
  --bg-color: #121212;
  --text-color: #ffffff;
  --header-footer-bg: #1e1e1e;
  --nav-link-color: #ffffff; 
  --border-color: #333333;
}

/* Ensure single blog post does not stretch */
@media (min-width: 600px) {
  .home-page {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

@media (min-width: 900px) {
  .home-page {
    grid-template-columns: repeat(3, 1fr);
    margin: 0 10%; /* Add margin for better reading experience */
  }
  .other-page{
    margin: 0 10%; /* Add margin for better reading experience */
  }
}

@media (max-width: 599px) {
  .home-page {
    grid-template-columns: 1fr;
  }
}

/* Styles for the theme toggle button */
#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: 16px;
}

#theme-toggle img {
  width: 24px;
  height: 24px;
}