/* General Styles */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.sermon-img {
  width: 100%; /* Image takes up full width of its container */
  height: auto;
  max-width: 600px; /* Maximum width for larger screens */
  transition: width 0.3s ease;
  margin: 0 auto; /* Centers the image */
}

.w3-container {
  padding: 64px 16px;
}

.w3-row-padding {
  display: flex;
  justify-content: space-around; /* Adjust space between columns */
  flex-wrap: wrap;
}

.w3-third {
  padding: 16px;
  flex-basis: 30%; /* Default width for desktop screens */
  box-sizing: border-box;
}

/* Ensure elements stack nicely on mobile */
@media (max-width: 1024px) {
  .sermon-img {
    width: 80%; /* Reduce image size on medium screens */
  }

  .w3-third {
    flex-basis: 48%; /* Two columns for medium-sized screens */
  }
}

/* Mobile screens */
@media (max-width: 768px) {
  .sermon-img {
    width: 100%; /* Full width on mobile screens */
  }

  .w3-third {
    flex-basis: 100%; /* Stack columns on mobile screens */
  }

  .w3-container {
    padding: 48px 16px; /* Reduce padding for smaller screens */
  }

  h3 {
    font-size: 24px; /* Adjust heading size */
  }

  .w3-large {
    font-size: 18px; /* Adjust paragraph size */
  }
}

/* Very small screens (Phones in portrait mode) */
@media (max-width: 480px) {
  .sermon-img {
    width: 90%; /* Slightly smaller images on small phones */
  }

  .w3-row-padding {
    flex-direction: row; /* Stack items vertically on very small screens */
  }

  .w3-container {
    padding: 32px 8px; /* More padding adjustment */
  }

  h3 {
    font-size: 20px; /* Even smaller heading size */
  }

  .w3-large {
    font-size: 16px; /* Even smaller paragraph size */
  }
}

/* CSS for Flex Grid in Books Section */
#work .w3-row-padding {
  display: flex;
  flex-wrap: wrap;
  gap: 1px; /* Adjusts spacing between items */
  justify-content: left; /* Centers items on larger screens */
}

#work .w3-col {
  flex: 1 1 calc(33.333% - 32px); /* Three items per row with spacing */
  max-width: calc(33.333% - 32px);
  box-sizing: border-box; /* Ensures padding/border does not affect width */
  display: flex;
  justify-content: left;
}

#work .w3-card {
  width: 100%; /* Ensure cards span the full width of their container */
  border: 1px solid #ccc; /* Adds a border around the card */
  border-radius: 8px; /* Optional for rounded corners */
  overflow: hidden; /* Ensures content doesn't overflow */
}

/* Stack items on smaller screens */
@media (max-width: 768px) {
  #work .w3-col {
    flex: 1 1 100%; /* Full width for smaller screens */
    max-width: 100%;
  }
}
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f9f9f9;
  color: #333;
}

.container {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly; 
  align-items: flex-start;
  
}

.header {
  position: relative;
  text-align: center;
  color: white;
}

.header img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  filter: brightness(70%);
}

.header-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.header h1 {
  margin: 0;
  font-size: 2.5rem;
}

.header p {
  margin: 10px 0 0;
  font-size: 1.2rem;
}

.home-button {
  position: absolute;
  top: 20px;
  left: 20px;
  background-color: #000000;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 1rem;
  cursor: pointer;
}

.home-button:hover {
  background-color: #ff0000;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  grid-template-rows: auto;
  gap: 1em; /* Adjusts spacing between items */
  padding: 1em; /* Matches the grid gap for consistency */
  margin-top: 40px;
}

.book-item {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  transition: transform 0.3s, box-shadow 0.3s;
}

.book-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.book-item img {
  width: 100%;
  height: auto;
}

.book-content {
  padding: 15px;
}

.book-content h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.book-content p {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 15px;
}

.book-content a {
  text-decoration: none;
  background-color: #4CAF50;
  color: white;
  padding: 10px 15px;
  border-radius: 4px;
  text-align: center;
  display: inline-block;
}

.book-content a:hover {
  background-color: #45a049;
}



/* Sermons Section */
#sermons .sermons-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px; /* Adjust spacing between sermon items */
  justify-content: left; /* Aligns items on larger screens */
}

#sermons .sermon-item {
  flex: 1 1 calc(33.333% - 32px); /* Three items per row with spacing */
  max-width: calc(33.333% - 32px);
  box-sizing: border-box; /* Ensures padding/border does not affect width */
  border: 1px solid #ccc;
  border-radius: 8px; /* Rounded corners */
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

#sermons .sermon-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

#sermons .sermon-item img {
  width: 100%;
  height: auto;
  border-bottom: 2px solid #ddd; /* Border between image and content */
}

#sermons .sermon-item h3 {
  font-size: 1.2rem;
  margin: 15px 15px 10px;
  text-align: center;
}

#sermons .sermon-item p {
  font-size: 0.9rem;
  color: #666;
  margin: 0 15px 15px;
  text-align: center;
}

/* Stack sermon items on smaller screens */
@media (max-width: 768px) {
  #sermons .sermon-item {
    flex: 1 1 100%; /* Full width for smaller screens */
    max-width: 100%;
  }
}

/* Articles Section */
#articles {
  padding: 64px 16px;
}

#articles h3 {
  text-align: center;
  font-size: 36px;
  font-weight: bold;
  margin-bottom: 16px;
}

#articles p {
  text-align: center;
  font-size: 18px;
  color: #777;
  margin-bottom: 32px;
}

/* Articles Grid */
.articles-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* Ensures even spacing */
  gap: 32px;
}


.article-item {
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  width: calc(33.333% - 32px);
  transition: transform 0.3s ease-in-out;
}

.article-item:hover {
  transform: translateY(-5px);
}

.article-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.article-item h3 {
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  margin-top: 16px;
}

.article-item p {
  text-align: center;
  font-size: 16px;
  color: #555;
  margin: 8px 0;
}

.article-item a {
  text-decoration: none;
}

/* See More Button */
.w3-center {
  text-align: center;
  margin-top: 64px;
  margin-bottom: 64px;
}

.w3-center .w3-button {
  padding: 16px 32px;
  font-size: 18px;
  text-decoration: none;
  background-color: #d3d3d3;
  color: #333;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.w3-center .w3-button:hover {
  background-color: #a3a3a3;
  color: #fff;
}

/* Responsive Design */
@media (max-width: 768px) {
  .articles-grid {
    flex-direction: column;
    gap: 16px;
  }

  .article-item {
    width: 100%;
  }
}
