/* State Route Index Categories */
.state-route-index-categories {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.state-route-index-categories h1 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #333;
}

.state-info {
    margin: 20px 0;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.state-map {
    margin-bottom: 10px;
    max-width: 100%;
    height: auto;
}
.route-index-gallery-item .flex {
    display: flex;
    align-items: center;
    margin-top: 5px;
}
.route-index-gallery-item img[alt*="Shield"] {
    max-height: 50px;
    margin-right: 10px;
}

/* Routes Section (Card Layout for Subpages) */
.routes {
    margin: 20px 0;
}

.routes h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 0 10px;
}

.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card h3 {
    font-size: 18px;
    margin: 15px 0 10px;
    color: #333;
}

.card p {
    font-size: 14px;
    color: #666;
    margin: 0 15px 15px;
    padding-bottom: 15px;
}

.state-map {
  margin-bottom: 10px;
  max-width: 100%;
  height: auto;
}

/* Route Index Thumbnail Gallery */
.route-index-thumbnail-gallery {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
  }
  
  .route-index-thumbnail-gallery h2 {
    margin-bottom: 20px;
    color: #333;
  }
  
  .route-index-gallery-rows {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
  }
  
  .route-index-gallery-item {
    width: 200px; /* Default width for larger screens */
    text-align: center;
    flex: 0 0 auto; /* Allows items to maintain their width */
  }
  
  /* applies the border only to non-shield images, e.g. thumbnails */
  .route-index-gallery-item img:not([src*="/routemarkers/"]) {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: opacity 0.3s;
  }

  /* ensures shields have no borders */
  .route-index-gallery-item img[src*="/routemarkers/"] {
      border: none;
  }
  
  .route-index-gallery-item img:hover {
    opacity: 0.8;
  }
  
  .route-index-gallery-caption p {
    margin: 5px 0;
    font-size: 14px;
  }
  
  .route-index-gallery-caption a {
    text-decoration: none;
    color: #0066cc;
  }
  
  .route-index-gallery-caption a:hover {
    text-decoration: underline;
  }
  
/* Mobile Adjustments (≤414px) - Two Columns for Galleries */
@media screen and (max-width: 414px) {
    .route-index-gallery-rows {
        justify-content: space-between;
        margin: 0 -10px;
        gap: 10px;
    }
    .route-index-gallery-item {
        width: calc(50% - 20px);
        flex: 0 0 calc(50% - 20px);
        padding: 0 10px;
        box-sizing: border-box;
    }
    .route-index-gallery-item img {
        max-width: 100%;
    }
    .route-index-gallery-caption p {
        font-size: 12px;
    }
    .card {
        margin: 10px 0;
    }
    .card img {
        height: 150px;
    }
    .card h3 {
        font-size: 16px;
    }
    .card p {
        font-size: 12px;
    }
}

/* County Subpage Gallery */
.county-index-thumbnail-gallery {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.county-index-gallery-rows {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.county-index-gallery-item {
  width: 200px;
  text-align: center;
  flex: 0 0 auto;
}

.county-index-gallery-item img:not([src*="/routemarkers/"]) {
  max-width: 100%;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: opacity 0.3s;
}

.county-index-gallery-item img[src*="/routemarkers/"] {
  border: none;
}

.county-index-gallery-item img:hover {
  opacity: 0.8;
}

.county-index-gallery-caption p {
  margin: 5px 0;
  font-size: 14px;
}

@media screen and (max-width: 414px) {
  .county-index-gallery-rows {
      justify-content: space-between;
      margin: 0 -10px;
      gap: 10px;
  }
  .county-index-gallery-item {
      width: calc(50% - 20px);
      flex: 0 0 calc(50% - 20px);
      padding: 0 10px;
      box-sizing: border-box;
  }
}

/* ---------Population Table---------- */
.popstat {
    width: 100%;
    border-collapse: collapse;
  }
  
  .popstat th, .popstat td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
  }
  
  .popstat th {
    background-color: #f2f2f2;
  }
  
  .popstat thead th {
    text-align: center;
  }
  
  .popstat .pssources {
    text-align: center;
    font-size: 0.8em;
  }
  
  /* Responsive Styles */
  @media (max-width: 768px) {
    .popstat thead, .popstat tr {
      display: block;
    }
  
    .popstat thead th {
      display: block;
      text-align: left;
      padding: 10px;
    }
  
    .popstat td {
      display: block;
      border: none;
      border-bottom: 1px solid #eee;
      position: relative;
      padding-left: 50%; /* Adjust as needed */
    }
  
    .popstat td:before {
      position: absolute;
      top: 6px;
      left: 6px;
      width: 45%;
      padding-right: 10px;
      white-space: nowrap;
      content: attr(data-label);
      font-weight: bold;
    }
  
    .popstat tbody tr {
      margin-bottom: 10px;
      border: 1px solid #ddd;
    }
  
    .popstat td[colspan="6"] {
      text-align: center;
      padding-left: 8px;
    }
  }

  @media (max-width: 768px) {
    .population-section {
        display: none;
    }
}