@media screen and (max-width: 70rem) and (resolution >= 2dppx), screen and (max-width: 50rem) and (resolution < 2dppx) {

  .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, max(1fr));
    margin-left: 0.2rem;
    margin-right: 0.2rem;
    margin-bottom: 6.4rem;
  }

  .card {
    justify-self: stretch;
    min-width: 95%;
  }

  .card-header {
    font-size: 1.8rem;
  }

  .card-body{
    height:auto;
    line-height: 2.4rem;
  }

  .card-body h5 {
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-size:2.4rem;
    line-height: 2.4rem;
    height:auto;
  }

  .card-text-container {
    padding-top: 0.5rem;
    margin-top: 4rem;
    height: auto;
  }

  .card-text {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  font-size: 2.2rem;
  margin-bottom: 0.2rem;
  }

  .card-footer {
    font-size: 1.8rem;
  }  

  
  .search-panel {
  /* ensures height is 5 rem */
  padding: 0rem 0rem 0rem 0rem;
  }
  
  .search-panel input[type="text"] {
    padding: 0.3125rem 0.5rem 0.3125rem 0.5rem;
    width: 90%;
    font-size: 2rem;
    height: 5rem;
  }

  .sortButtons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1.25rem;
  }

  .sortButtons button {
    font-size:2rem;
    width: 23%;
    height: 5rem;
  }

  .sortButtons button:hover {
    background-color: #02394A;
    color: white;
  }

  .filter-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1.25rem;
  }

  .filter-buttons button {
    font-size:2rem;
    width: 96%;
    height: 5rem;
  }

  .filter-buttons .button-group {
    width: 32%;
  }

/* --- Dropdown Styling --- */
  .filter-buttons .dropdown-box {
    display: none; /* Hidden by default */
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-dropdown);
    color: var(--color-text-dropdown);
    padding: 0;
    margin: 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow-y: auto;    
}

  .filter-buttons .dropdown-box.active {
    display: block;
    }

  .filter-buttons .dropdown-box-header {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 10px solid white;
    padding-bottom: 0.5rem;
  }

  .filter-buttons .dropdown-box-header h3 {
    margin: 0;
    font-size: 2rem;
    text-transform: capitalize;
    color: white;
  }

  .filter-buttons .dropdown-box-header .close-button {
    background: whitesmoke;
    border: 0.05rem;
    border-color: #ffffff;
    color: #000000;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.5rem;
  }

  .filter-buttons .dropdown-menu {
    list-style: none;
    padding: 1rem;
    margin: 1rem;
    column-count: 2;
    column-gap: 1.5rem;
  }

  .filter-buttons .dropdown-menu li {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    max-width: 40rem;
    break-inside: avoid; /* Prevent splitting items across columns */
    page-break-inside: avoid;
  }

  .filter-buttons .dropdown-menu label {
    margin-left: 0.5rem;
    cursor: pointer;
    font-size: 2rem;
    /* Text wrapping logic */
    max-width: 40rem;
    display: inline-block;
    vertical-align: top;
  }

  .modern-checkbox {
    /* 1. Remove the default browser styling */
    appearance: none;
    -webkit-appearance: none;
    
    width: 2rem;
    height: 2rem;
    border: 2px solid #cbd5e1;
    border-radius: 0.5rem;
    background-color: white;
    cursor: pointer;
    display: inline-grid;
    place-content: center;
    transition: all 0.2s ease-in-out;
  }

  .modern-checkbox:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
  }

  .modern-checkbox:checked {
    background-color: #3b82f6;
    border-color: #2563eb;
  }

  .modern-checkbox::before {
    content: "";
    width: 1rem;
    height: 1rem;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1.5rem 1.5rem white;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  }

  .modern-checkbox:checked::before {
      transform: scale(1);
  }

  /* Focus state for accessibility */
  .modern-checkbox:focus-visible {
      outline: 3px solid #93c5fd;
      outline-offset: 2px;
  }

}









