body {
  background-color: #2B2B2B;
  color: #ffc35d;

  /* Pagefind UI Customizations */
  --pagefind-ui-primary: #ffc35d;
  /* Highlight color for search terms */
  --pagefind-ui-text: rgb(213, 203, 176);
  /* Main text color for results */
  --pagefind-ui-background: #3d3737;
  /* Background of the search modal */
  --pagefind-ui-border: #5a5252;
  /* Border color */
  --pagefind-ui-font: 'Lora', serif;
  /* Match the site's font */

  text-shadow: black 2px 2px 10px;
  /* A classic serif font, may need to import this from Google Fonts later */
  font-family: 'Lora', serif;
  line-height: 1;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  max-width: 120ch;
  margin: auto;
  padding: .5rem;
}

p {
  font-family: sans-serif;
  color: rgb(213, 203, 176);
  line-height: 1.75;
}

h1 {
  font-family: 'Playfair Display', serif;
  /* An elegant display serif for headings */
  font-size: 3rem;
  font-style: oblique;
  color: #ffc35d;
  padding-bottom: 3rem;
  text-shadow: black 2px 2px 10px;
  /* A muted gold accent color */
  text-align: center;
}

h2 {
  text-align: center;
}

.page-title {
  margin-left: 1rem;
  /* Or adjust as needed for page subtitles */
}

nav ul {
  display: flex;
  justify-content: center;
  list-style: none;
  padding: 0;
  text-shadow: black 2px 2px 10px;
}

nav li {
  margin: 2rem;
  font-size: large;
}

nav a {
  color: #ffc35d;
}

footer {
  margin: auto;
  text-align: center;
}

footer a {
  color: #5da1ff;
  padding: 2rem;
}

#site-image {
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 3rem;
  width: 50%;
  border: 2px solid #ffc35d;
  border-radius: 10px;
}

.topic-page-image {
  width: 100%;
  object-fit: cover;
}

#topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.topic-card {
  background-color: #3d3737;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}


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

.topic-card img {
  width: 100%;
  object-fit: cover;
}

.topic-card-content {
  padding: 1rem;
  flex-grow: 1;
}

.topic-card-content h2 {
  margin: 0;
  text-align: center;
  font-size: 2rem;
}

/* Make the entire Pagefind search result item show a pointer on hover */
.pagefind-ui__result {
  cursor: pointer;
}

/* Styles for filter buttons */
#filter-buttons {
  margin: 1rem;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 1.5px solid black;
  background-color: rgb(205, 205, 205);
  cursor: pointer;
  margin-right: 0.7rem;
  border-radius: 13px;
}

.filter-btn.active {
  background-color: #ffc35d;
  color: black;
  border-color: black;
}

/* Form Styles */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid #5a5252;
  padding: 2rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 1);
}

label {
  font-weight: bold;
}

input,
textarea {
  color: white;
  width: 100%;
  padding: 0.5rem;
  margin-top: .5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  background-color: #3d3737;
  border: 1px solid #5a5252;
}

/* Form validation styles */
input:invalid,
textarea:invalid {
  border-color: #ff6b6b;
  box-shadow: 0 0 5px rgba(255, 107, 107, 0.5);
}

button[type="submit"] {
  width: auto;
  padding: 0.5rem 1rem;
  border: 2px solid black;
  background-color: #ffc35d;
  color: black;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s ease-in-out;
}

button[type="submit"]:hover {
  background-color: #ffdb8a;
}

button[type="reset"] {
  width: auto;
  padding: 0.5rem 1rem;
  border: 2px solid black;
  color: black;
  cursor: pointer;
  border-radius: 4px;
  background-color: #808080; /* Gray background */
}

button[type="reset"]:hover {
  background-color: #a9a9a9; /* Lighter gray on hover */
}

.form-buttons {
  display: flex;
  justify-content: space-between;
}

/* Media queries should be at the end of the stylesheet to ensure they override base styles */
@media (max-width: 600px) {
  nav {
    margin: auto;
  }

  #topic-grid {
    /* This sets two columns, each taking up 1 fractional unit (1fr), 
      meaning they will be equal in width and occupy the full screen width.
    */
    grid-template-columns: 1fr 1fr;
  }

  .topic-card-content h2 {
    /* Reduce font size on smaller screens to prevent overflow */
    font-size: 1rem;
  }
}