* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: #0d1117;
  color: #e6edf3;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

a {
  color: #58a6ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
nav a:focus-visible::after {
  outline: 1px solid #58a6ff;
  outline-offset: 2px;
}

header {
  text-align: center;
  padding: 24px 0;
  border-bottom: 1px solid #30363d;
}

header h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

header h1 a {
  color: #e6edf3;
}

header p a {
  font-weight: 600;
}

header p {
  color: #8b949e;
  font-size: 0.875rem;
}

nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 0;
  flex-wrap: wrap;
}

nav a,
nav span {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.8rem;
  border: 1px solid #30363d;
  border-radius: 4px;
}

nav a {
  position: relative;
}

nav a:focus-visible {
  outline: none;
}

nav a:focus-visible::after {
  content: '';
  position: absolute;
  inset: -1px;
  pointer-events: none;
}

nav span {
  background: #58a6ff;
  color: #0d1117;
  border-color: #58a6ff;
}

nav .nav-arrow {
  border: none;
  font-size: 1rem;
  padding: 4px 6px;
}

nav .nav-arrow.disabled {
  color: #30363d;
  background: none;
}

main {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 16px;
  padding: 16px 0;
}

.card {
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #161b22;
}

.card img {
  border-radius: 5px 5px 0 0;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #0d1117;
}

.card-body {
  padding: 10px 12px;
}

.card-body h2 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.card-body .meta {
  font-size: 0.75rem;
  color: #8b949e;
  margin-bottom: 4px;
}

.card-body .site-link {
  white-space: nowrap;
}

.card-body .separator {
  margin: 0 8px;
}

.card-body .desc {
  font-size: 0.8rem;
  color: #c9d1d9;
}

.bottom-nav {
  border-top: 1px solid #30363d;
  margin-top: 8px;
}

.preview {
  display: block;
}

:root:has(.lightbox[open]) {
  overflow: hidden;
}

.lightbox {
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 3vmin;
  border: 0;
  border-radius: 8px;
  background: #21262d;
  cursor: pointer;
}

.lightbox::backdrop {
  background: rgb(0 0 0 / 0.9);
}

.lightbox button {
  display: block;
  border: 0;
  background: none;
  cursor: inherit;
}

/* lightbox.js sets --ratio to the preview's width / height. */
.lightbox img {
  display: block;
  width: min(85vw - 6vmin, (85dvh - 6vmin) * var(--ratio));
  aspect-ratio: var(--ratio);
  image-rendering: pixelated;
}
