.directory {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 110px;
  padding-bottom: 120px;
}

.filter {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.filter form {
  margin-top: 28px;
}

.filter label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.filter label:hover {
  border-color: #bdbdbd;
  background: #fafafa;
}

.filter label:has(input[type="checkbox"]:checked) {
  background: #111;
  border-color: #111;
  color: #fff;
}

.filter fieldset {
  border: 0;
  padding: 0;
  margin: 28px 0;
}

.filter legend {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  font-size: 11px;
  line-height: 1;
  color: #777;
  margin-bottom: 15px;
}

.filter legend::after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}

.filter fieldset label {
  margin: 0 0 8px;
}

.filter input[type="checkbox"] {
  width: 0;
  height: 0;
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filter-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 34px;
}

.filter-actions .button {
  width: 100%;
}

.filter-toggle {
  display: none;
}

.result-bar {
  display: flex;
  justify-content: flex-start;
  color: #777;
  font: 10px ui-monospace, monospace;
  margin-bottom: 18px;
}

.filter-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .directory {
    grid-template-columns: 1fr;
    gap: 50px;
  }

  .filter {
    max-width: none;
    border-top: 0;
    padding-top: 0;
  }

  .filter-toggle {
    display: flex;
    width: 100%;
    margin: 0 0 16px;
  }

  .filter-panel {
    display: none;
    border-top: 1px solid var(--line);
    padding-top: 6px;
  }

  .filter-panel.open {
    display: block;
  }

  .filter form {
    margin-top: 10px;
  }

  .filter-actions {
    padding-bottom: 6px;
  }

  .directory-content {
    min-width: 0;
  }
}

/* Distro grid */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.distro-card {
  display: block;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.distro-card:hover {
  background: #fafafa;
  border-color: #bdbdbd;
}

.card-image {
  aspect-ratio: 1 / 1;
  border-bottom: 1px solid var(--line);
  display: grid;
  place-items: center;
  background: #fff;
  overflow: hidden;
}

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

.card-body {
  padding: 22px;
}

.card-top,
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.card-top h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.card-top span {
  font-size: 11px;
  color: #777;
}

.card-body p {
  font-size: 13px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 14px 0 28px;
}

.card-bottom b {
  font-size: 11px;
  font-weight: 500;
}

@media (max-width: 900px) {
  .cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .card-image {
    aspect-ratio: 1 / 1;
  }
}
