/* Base styles */
:root {
  --primary-color: #0066cc;
  --secondary-color: #333;
  --background-color: #f5f5f5;
  --text-color: #333;
  --border-color: #ddd;
  --link-hover-color: #004499;
  --container-width: 1200px;
  --content-background: #fff;
  --sidebar-background: #fff;
  --header-background: #fff;
  --nav-background: #000;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
}

.site-wrapper {
  background-color: var(--background-color);
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 2rem;
  box-sizing: border-box;
}

.main-container {
  background-color: #fff;
  border: 1px solid #ddd;
  border-top-width: 0;
  border-top-color: transparent;
  box-shadow: 0 4px 5px rgba(0,0,0,0.1);
  padding: 0;
  margin: 0 auto;
  overflow: hidden;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

ul, ol {
  list-style-position: inside;
}

/* Pagination navigation */
.pagination-nav {
  display: flex;
  justify-content: space-between;
  margin: 2em 0 0 0;
  font-size: 1.1em;
}
.pagination-nav a {
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
}
.pagination-nav a:hover {
  color: #000;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  display: none; /* Hidden by default, shown on mobile */
  background-color: transparent;
  color: white;
  border: none;
  width: 36px;
  height: 41px; /* Match the height of the navigation bar */
  padding: 0 15px;
  cursor: pointer;
  box-shadow: none;
  margin-right: 0;
  position: relative;
  z-index: 10;
}

.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 4px auto;
  background-color: white;
  transition: all 0.3s ease-in-out;
}

/* Two-column layout */
.content-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  margin-top: 0;
  padding: 20px;
  background-color: #fff;
}

.content-area {
  flex: 1;
  min-width: 0;
  max-width: 95vw;
  background: var(--content-background);
  padding: 0;
}

.sidebar {
  width: 28%;
  min-width: 200px;
  background: var(--sidebar-background);
  padding: 1.25rem;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.site-content {
  padding: 30px 0;
}

@media (max-width: 768px) {
  html body.sidebar-open {
    overflow: hidden;
  }
  
  html .sidebar-toggle {
    display: block;
  }
  
  html .main-navigation ul {
    flex-wrap: nowrap;
  }
  
  /* Reduced padding/margins on mobile */
  html .content-wrapper {
    padding: 0.5rem !important;
    gap: 15px !important;
	margin-left: .3rem;
	margin-right: .5rem;
  }
  
  html header {
    padding: 1rem 0.5rem 0.5rem !important;
    margin: 0 !important;
    border-bottom: none !important;
  }
  
  html .banner-image {
    width: 100% !important;
    margin: 0 !important;
  }
  
  html .main-navigation {
    width: 100% !important;
    margin: 0 !important;
    border-top: none !important;
    justify-content: space-between !important;
    padding: 0 0.5rem !important;
    box-sizing: border-box !important;
  }
  
  html .main-navigation a {
    font-size: 1rem !important;
    padding: 10px 8px !important;
  }
  
  html .float-left, html .float-right {
    float: none !important;
    margin: 1rem 0 !important;
    max-width: 100% !important;
  }
  
  html .thumbnail, html .thumbnail-small {
    max-width: 100% !important;
    margin-right: 0 !important;
  }
  
  html .post-thumbnail {
    float: none !important;
    margin: 1rem 0 !important;
    max-width: 100% !important;
    text-align: center !important;
  }
  
  html .post-thumbnail img {
    width: 100% !important;
    max-width: 300px !important;
    margin: 0 auto !important;
  }
  
  html .post-summary {
    min-height: auto !important;
  }
  
  html .content-wrapper {
    flex-direction: column !important;
  }
  
  html .sidebar {
    position: fixed !important;
    top: 0 !important;
    right: -90vw !important; /* Start off-screen using viewport width */
    width: 85vw !important; /* Use viewport width for more responsive sizing */
    max-width: 350px !important; /* Set a maximum width for very large screens */
    height: 100% !important;
    z-index: 999 !important;
    transition: right 0.3s ease !important;
    overflow-y: auto !important;
    box-shadow: -2px 0 5px rgba(0,0,0,0.2) !important;
    padding-top: 4.5rem !important; /* Make room for the toggle button using relative units */
  }
  
  html body.sidebar-open .sidebar {
    right: 0 !important;
  }
  
  /* Overlay when sidebar is open */
  html body.sidebar-open:before {
    content: '' !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0,0,0,0.5) !important;
    z-index: 998 !important;
  }
  
  /* Toggle button animation when sidebar is open */
  body.sidebar-open .sidebar-toggle span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  body.sidebar-open .sidebar-toggle span:nth-child(2) {
    opacity: 0;
  }
  
  body.sidebar-open .sidebar-toggle span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
  }
}

/* Header and Navigation */
header {
  padding: 20px 20px 20px;
  border-bottom: 1px solid #ddd;
  margin: 20px 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.site-title {
  margin: 0;
  font-size: 1.8rem;
  font-weight: bold;
  display: inline-block;
}

.site-title a {
  color: #000;
  text-decoration: none;
}

.site-title a:hover {
  color: #666;
}

.site-description {
  font-style: italic;
  color: #666;
  font-size: 0.9rem;
  text-align: right;
  display: inline-block;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .site-title {
    margin-bottom: 0.5rem;
  }
  
  .site-description {
    text-align: left;
    margin-left: 2px;
  }
}

/* Banner Image */
.banner-image {
  width: calc(100% - 40px);
  height: auto;
  overflow: hidden;
  margin: 0 20px;
  padding: 0;
}

.banner-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  object-position: center top;
}

.banner.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
}

/* Main Navigation */
.main-navigation {
  background-color: var(--nav-background);
  width: calc(100% - 40px);
  padding: 0;
  margin: 0 20px;
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 41px; /* Set fixed height to match the original */
}

.main-navigation .nav-links {
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.main-navigation a {
  color: white;
  text-decoration: none;
  font-weight: normal;
  font-size: 0.9rem;
  padding: 10px 15px;
  display: inline-block;
}

.main-navigation a:hover {
  background-color: #333;
}

/* Apps dropdown */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

.nav-dropdown-toggle {
  color: white;
  font-size: 0.9rem;
  padding: 10px 15px;
  display: inline-flex;
  align-items: center;
  cursor: default;
  user-select: none;
  white-space: nowrap;
}

.nav-dropdown:hover .nav-dropdown-toggle {
  background-color: #333;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #111;
  border: 1px solid #444;
  border-top: none;
  min-width: 160px;
  z-index: 100;
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 10px 15px;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .main-navigation ul {
    flex-direction: column;
  }
}

/* Posts */
.posts {
  margin-bottom: 40px;
  margin-right: .5rem;
}

.posts h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: normal;
}

.posts h2 a {
  color: var(--primary-color);
  text-decoration: none;
}

.posts h2 a:hover {
  text-decoration: underline;
}

.post-summary {
  margin-bottom: 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid #eee;
  overflow: hidden; /* Contain floated children */
  clear: both; /* Clear previous floats */
  display: flow-root; /* Better for containing floats - modern approach */
}

/* Remove border from the last post summary in a listing */
.posts .post-summary:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.post-thumbnail {
  float: right; /* Position the image to the right of text */
  margin: 0 0 10px 20px; /* Spacing: top right bottom left */
  overflow: hidden;
  max-width: 30%; /* Slightly reduced to leave more space for text */
  display: inline; /* Ensure proper flow around the image */
}

.post-thumbnail img {
  width: 10rem;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin: 0 auto;
  display: block;
}

.post-title {
  font-size: 1.8rem;
  margin-bottom: 10px;
  /* Removed width constraint since we're using absolute positioning for image */
}

.post-meta {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 15px;
  /* Removed width constraint since we're using absolute positioning for image */
}

.post-author {
  margin-left: 10px;
}

.post-excerpt {
  margin: 1rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
  text-align: justify;
  /* Removed display: flow-root which was creating a new formatting context */
  /* Removed width: 100% - default behavior is better for text wrapping */
}

.read-more {
  font-weight: normal;
  font-size: 0.9rem;
}

.post-categories ul {
  display: flex;
  list-style: none;
  gap: 10px;
  margin-top: 15px;
}

.post-categories li {
  background-color: #f0f0f0;
  padding: 5px 10px;
  border-radius: 3px;
  font-size: 0.8rem;
}

/* Single post */
.post {
  margin-bottom: 40px;
  margin-right: .5rem;
}

.post-header {
  margin-bottom: 30px;
}

.post-content {
  margin-bottom: 30px;
}

.post-content h2 {
  margin-top: 30px;
  margin-bottom: 15px;
}

.post-content p {
  margin-bottom: 20px;
  text-align: justify;
}

.post-content img {
  margin: 20px auto;
  display: block;
  max-width: 100%;
}

.post-footer {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.post-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.post-nav-links {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.post-nav-prev,
.post-nav-next {
  display: flex;
  flex-direction: column;
  max-width: 45%;
}

.post-nav-prev span:first-child,
.post-nav-next span:first-child {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #666;
}

/* Sidebar */
.widget {
  margin-bottom: 20px;
  background-color: #f9f9f9;
  padding: 15px;
  border: 1px solid #eee;
  font-size: 0.8rem;
}

.widget h3 {
  margin-top: 0;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
  font-size: 1.2rem;
}

.widget ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.widget li {
  margin-bottom: 8px;
}

.widget a {
  text-decoration: none;
  color: var(--primary-color);
}

/* Recent Posts Widget */
.recent-posts li {
  padding-left: 12px;
  position: relative;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-posts li:before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
}

.recent-posts a {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget a:hover {
  text-decoration: underline;
}

/* Archives */
.archives-list {
  margin-bottom: 40px;
}

.archive-month {
  margin-bottom: 30px;
}

.archive-month h2 {
  margin-bottom: 15px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-color);
}

.archive-month ul {
  list-style: none;
}

.archive-month li {
  margin-bottom: 10px;
  display: flex;
  gap: 15px;
}

.archive-month time {
  color: #666;
  min-width: 120px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  margin: 30px 0;
  padding-top: 20px;
  border-top: 1px solid #eee;
  font-size: 0.9rem;
}

.pagination a {
  color: var(--primary-color);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid #ddd;
  background-color: #f9f9f9;
}

.pagination a:hover {
  background-color: #eee;
  text-decoration: none;
}

/* Footer */
footer {
  padding: 15px 0;
  margin-top: 0;
  text-align: center;
  font-size: 0.85rem;
  border-top: 1px solid #ddd;
  color: #666;
}

footer a {
  color: #0066cc;
}

footer a:hover {
  color: #004499;
  text-decoration: underline;
}
