:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: #edf0f5;
  background: #000;
}

*, *::before, *::after { box-sizing: border-box; }

body { margin: 0; }

main {
  max-inline-size: 1180px;
  margin-inline: auto;
  padding: 24px;
}

.project-grid {
  --card-width: min(100%, 128px);
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--card-width));
  justify-content: center;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-card {
  --icon-size: 42px;
  display: grid;
  aspect-ratio: 1;
  min-block-size: 0;
  justify-items: center;
  align-content: center;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--icon-size) 36px;
  gap: 9px;
  padding: 12px 10px;
  border: 1px solid #2c2c30;
  border-radius: 10px;
  background: #202022;
  box-shadow: inset 0 1px 0 #ffffff06;
  color: inherit;
  text-align: center;
  text-decoration: none;
}

@media (hover: hover) {
  .project-card:hover {
    background: #29292c;
    border-color: #3d3d42;
  }
}

.project-card:focus-visible {
  outline: 2px solid #97b8ff;
  outline-offset: 1px;
}

.project-icon {
  display: grid;
  width: var(--icon-size);
  height: var(--icon-size);
  place-items: center;
  border-radius: 8px;
  background: #303030;
  box-shadow: inset 0 0 0 1px #ffffff26;
}

.project-icon img, .icon-letter {
  width: 100%;
  height: 100%;
}

.project-icon img {
  padding: 6px;
  object-fit: contain;
}

.icon-letter {
  display: grid;
  place-items: center;
  color: #edf0f5;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.project-icon img[hidden], .project-icon img:not([hidden]) + .icon-letter { display: none; }

.project-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-width: 100%;
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  overflow-wrap: anywhere;
}

.empty-state {
  margin: 4px;
  color: #b4b8c1;
  font-size: 13px;
  text-align: center;
}

@media (min-width: 900px) {
  main {
    display: grid;
    align-content: center;
    min-block-size: 100vh;
    min-block-size: 100svh;
    padding-block: 32px;
  }
}

@media (max-width: 600px) {
  main { padding: 16px 12px; }
  .project-grid {
    --card-width: clamp(min(100%, 88px), calc((100% - 20px) / 3), 116px);
    gap: 10px;
  }
  .project-card {
    --icon-size: 34px;
    grid-template-rows: var(--icon-size) minmax(0, 30px);
    gap: 4px;
    padding: 8px 7px;
  }
  .project-icon img { padding: 5px; }
  .project-title {
    font-size: 12px;
    line-height: 15px;
  }
}
