/* archives.css */
@import url('styles.css');

/* ===== Reset & Base ===== */
body {
  background-color: #1e1e1e;
  color: #f7f7f7;
}

h1,
h2,
h3 {
  font-family: "OdibeeSans", sans-serif;
  color: #f7f7f7;
  font-size: 30px;
}

/* ===== Header & Navigation ===== */
.site-header a {
  font-family: "OdibeeSans", sans-serif;
  text-decoration: none;
  color: #f7f7f7;
}

.header-content {
  border-bottom: 3px solid #f7f7f7;
}

.nav-links a {
  border: 3px solid #f7f7f7;
}

.nav-links a:hover {
  background-color: #FFB800;
  color: #1e1e1e;
  box-shadow: 0 0 0 2px #1e1e1e inset;
}

.nav-links .active {
  color: #1e1e1e;
  background-color: #f7f7f7;
  box-shadow: 0 0 0 2px #1e1e1e inset;
}

/* ===== Main Content ===== */
.site-main {
  padding: 2rem;
  height: auto;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 5rem auto 30px;
}

.description {
  margin: 0.5rem 0 1.5rem;
  text-align: left;
}

.search-container {
  background-color: #f7f7f7;
  border: 2px solid #1e1e1e;
  padding: 20px 30px;
  border-radius: 25px;
  gap: 2rem;
  box-shadow: 0 0 2px #1e1e1e inset;
  display: grid;
  grid-template-columns: 1fr 2fr;
  color: #1e1e1e;
  overflow: hidden;
  min-width: 1100px;
}

.search-bar {
  margin-bottom: 1rem;
}

.search-bar input {
  width: 100%;
  max-width: 400px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 16px;
}

.sort-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.sort-controls select {
  background: #f7f7f7;
  border: 1px #1e1e1e solid;
  border-radius: 5px;
  padding: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: 'PTMono', monospace;
  flex-grow: 1;
  /* Makes selects take up equal width */
}

/* ===== Sidebar Filters ===== */
.filters {
  flex: 1;
  border: 1px solid #1e1e1e;
  border-radius: 5px;
  padding: 1rem;
  max-width: 300px;
}

.filter-section {
  margin-bottom: 2rem;
}

.filters button {
  background: #1e1e1e;
  border: 2px #1e1e1e solid;
  border-radius: 25px;
  padding: 10px 20px;
  box-shadow: 0 0 0 2px #f7f7f7 inset;
  cursor: pointer;
  color: #f7f7f7;
  font-size: 0.9rem;
  font-family: 'PTMono', monospace;
}

.filters h2 {
  color: #1e1e1e;
}

input[type="text"] {
  border: 1px solid #1e1e1e;
  border-radius: 5px;
  width: auto;
  padding: 10px;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.filter-tags button {
  background: #f7f7f7;
  border: 2px #1e1e1e solid;
  border-radius: 25px;
  color: #1e1e1e;

  cursor: pointer;
  font-size: 0.9rem;
  font-family: 'PTMono', monospace;
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: center;
}

.filter-tags img {
  max-width: 30px;
  max-height: 20px;
  fill: #1e1e1e;
}

.filter-tags button:hover img,
.filter-tags button.active-filter img {
  filter: invert(1);
}

.filter-tags button.active-filter {
  background-color: #9c321f;
  color: #f7f7f7;
  box-shadow: 0 0 0 2px #f7f7f7 inset;
}

.filter-tags button:hover {
  background-color: #9c321f;
  color: #f7f7f7;
  box-shadow: 0 0 0 2px #f7f7f7 inset;
}

/* ===== Archive Grid ===== */
.archive-grid {
  flex: 3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-height: 70vh;
  overflow-y: auto;
  padding: 1rem;
}

.archive-item {
  border: 1px solid #1e1e1e;
  padding: 0.5rem;
  border-radius: 5px;
  min-width: 200px;
  max-height: 300px;
  text-decoration: none;
}

.archive-item a {
  color: inherit;
  text-decoration: none;
}

.archive-item .item-text strong {
  font-family: "OdibeeSans", sans-serif;
  font-size: 20px;
  text-transform: uppercase;
  display: block;
  text-decoration: none;
}

.archive-item img,
.placeholder-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background-color: #f7f7f7;
  border-radius: 5px;
}

.archive-item .icon-thumbnail {
  max-width: 150px;
  max-height: 150px;
  display: block;
  margin: auto;
  object-fit: contain;
  background-color: #f7f7f7;
  padding: 20px;
}

.item-text {
  margin-top: 0.5rem;
  font-size: 12px;
  color: #1e1e1e;
  text-decoration: none;
  padding: 5px;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  grid-column: 1 / 3;
  /* Spans across both columns of the search container */
}

.pagination-controls .pagination-button {
  background: #9c321f;
  color: #f7f7f7;
  border: 2px solid #1e1e1e;
  border-radius: 25px;
  padding: 10px 25px;
  cursor: pointer;
  font-family: 'PTMono', monospace;
  font-size: 0.9rem;
  box-shadow: 0 0 0 2px #f7f7f7 inset;
  transition: all 0.2s ease-in-out;
}

.pagination-controls .pagination-button:hover {
  background-color: #f7f7f7;
  color: #1e1e1e;
  box-shadow: 0 0 0 2px #1e1e1e inset;
}

.pagination-controls .pagination-button:disabled {
  background-color: #1e1e1e;
  color: #f7f7f7;
  border-color: #a0a0a0;
  cursor: not-allowed;
  box-shadow: none;
}

.pagination-controls .page-info {
  color: #1e1e1e;
  font-size: 1rem;
  font-family: 'PTMono', monospace;
}

/* ===== Footer ===== */
.site-footer {
  background-color: #f7f7f7;
  color: #1e1e1e;
}

.footer-left p {
  font-size: 15px;
  color: #1e1e1e;
}

.footer-links a {
  color: #1e1e1e;
  text-decoration: none;
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {

  .search-container {
    flex-direction: column;
    width: auto;
    min-width: 0;
    padding: 1rem;
  }

  .archive-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    max-height: none;
    overflow-y: visible;
  }

  .filters {
    height: fit-content;
  }
}

@media (max-width: 768px) {

  /* Header */
  .site-header {
    padding: 1rem;

  }

  .site-header a {
    text-wrap: nowrap;
  }

  .site-title {
    text-wrap: nowrap;
  }

  .header-content {
    flex-direction: column;
    align-items: center;
  }

  .nav-links {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .nav-links a {
    width: auto;
    text-align: center;
    margin: 0.5rem 0;
  }

  /* Main Content */
  .site-main {
    padding: 0 1rem;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    margin: 2rem auto 30px;
  }

  .description {
    text-align: center;
    padding: 0 1rem;
    width: 100%;
    box-sizing: border-box;
  }

  .search-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 90%;
    min-width: 0;
    /* This is the key fix */
    margin: 0 auto;
    padding: 1rem;
    gap: 20px;
  }

  /* Search & Sort Controls */
  .search-bar {
    width: 100%;
    margin-bottom: 0;
  }

  .search-bar input {
    width: 100%;
  }

  .sort-controls {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
  }

  .sort-controls select {
    flex-shrink: 1;
    width: auto;
  }

  /* Filters */
  .filters {
    width: auto;
    max-width: none;
    margin-bottom: 20px;
  }

  .filter-section {
    overflow: auto;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    border-radius: 5px;
    width: 100%;
    margin: auto;
    box-sizing: border-box;
  }

  .filters h2 {
    text-align: left;
    font-size: 24px;
    text-wrap: nowrap;
  }

  .filter-tags {
    display: flex;
    align-self: center;
    flex-wrap: nowrap;
    overflow-x: scroll;
    gap: 0.5rem;
    justify-content: flex-start;
    border-radius: 5px;
    width: 100%;
    margin-bottom: 20px;
  }

  .filter-tags button {
    flex-shrink: 1;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .filter-tags img {
    max-width: 20px;
    max-height: 20px;
  }

  #reset-filters-button {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.9rem;
    margin-top: 1rem;
  }

  /* Archive Grid */
  .archive-grid {
    grid-template-columns: 1fr;
    max-height: none;
    margin: auto 0;
    overflow-y: visible;
    width: auto;
    padding: 0;
  }

  .archive-item img,
  .placeholder-img,
  .archive-item .icon-thumbnail {
    width: 150px;
    /* Specific width for the image */
    height: 150px;
    object-fit: cover;
    padding: 0;
  }

  .archive-item .icon-thumbnail {
    object-fit: contain;
    padding: 20px;
  }

  .archive-item a {
    display: flex;
    flex-direction: row;
    /* Aligns content in a row */
    gap: 1rem;
    align-items: center;
    /* Vertically centers content */
  }

  .archive-item {
    min-width: unset;
    max-height: unset;
    text-decoration: none;
    box-sizing: border-box;
    display: flex;
    /* Make the item a flex container */
    padding: 1rem;
  }

  .item-text {
    flex: 1;
    /* Takes up the remaining space */
    margin-top: 0;
    font-size: 14px;
  }

  /* Footer */
  .footer-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer-left {
    align-items: center;
  }
}

@media (max-width: 400px) {
  .search-container {
    width: auto;
    padding: 20px 10px;
  }

  .filter-tags {
    gap: 0.2rem;
  }

  .filter-tags button {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }

  .pagination-controls {
    gap: 0.5rem;
  }

  .pagination-controls .pagination-button {
    padding: 8px 15px;
  }

  .pagination-controls .page-info {
    font-size: 0.8rem;
  }

  .archive-item {
    padding: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    width: auto;
    color: #000;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .archive-item a {
    flex-direction: column;
    /* Stacks image and text vertically */
    text-align: center;
  }

  .archive-item img {
    width: 100%;
    height: auto;
    max-height: 180px;
    object-fit: cover;
  }
}