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

body {
  background: #0a0a0a;
  color: #e0e0e0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

header {
  padding: 3rem 2rem 1.5rem;
  text-align: center;
}

header h1 {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: #fff;
}

header p {
  margin-top: 0.5rem;
  color: #888;
  font-size: 0.9rem;
}

/* Search */
.search-wrap {
  text-align: center;
  padding: 0 2rem 2rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(#0a0a0a 60%, transparent);
  padding-top: 1rem;
}

#search {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #e0e0e0;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border-radius: 4px;
  width: 100%;
  max-width: 400px;
  outline: none;
  transition: border-color 0.2s;
}

#search:focus {
  border-color: #666;
}

#search::placeholder {
  color: #555;
}

/* Back link */
.back-link {
  display: inline-block;
  color: #888;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: #fff;
}

/* Card grid (index page) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 0 2rem 3rem;
}

.card {
  background: #141414;
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.card-image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #1a1a1a;
}

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

.card:hover .card-image img {
  opacity: 0.85;
}

.card-body {
  padding: 1rem 1.2rem 1.2rem;
}

.card-body h2 {
  font-size: 1rem;
  font-weight: 500;
  color: #e0e0e0;
  margin-bottom: 0.25rem;
}

.card-meta {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 0.4rem;
}

.card-description {
  font-size: 0.85rem;
  color: #888;
  line-height: 1.4;
}

.card-description p {
  margin-bottom: 0.3rem;
}

.card-description a {
  color: #aaa;
  text-decoration: underline;
  text-decoration-color: #555;
}

/* Groups */
.group {
  padding: 0 2rem 3rem;
}

.group h2 {
  font-size: 1.1rem;
  font-weight: 400;
  color: #aaa;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #222;
}

.group-description {
  color: #999;
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 640px;
  margin-bottom: 1.2rem;
}

.group-description p {
  margin-bottom: 0.5rem;
}

.group-description a {
  color: #bbb;
  text-decoration: underline;
  text-decoration-color: #555;
}

.group-description a:hover {
  color: #fff;
}

/* Masonry grid via CSS columns */
.grid {
  column-count: 4;
  column-gap: 12px;
}

.grid-item {
  break-inside: avoid;
  margin-bottom: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-radius: 3px;
  line-height: 0;
}

.grid-item img {
  width: 100%;
  display: block;
  transition: opacity 0.2s;
  border-radius: 3px;
}

.grid-item:hover img {
  opacity: 0.85;
}

.grid-item .title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 0.6rem 0.5rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  font-size: 0.75rem;
  color: #ddd;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.2s;
}

.grid-item:hover .title {
  opacity: 1;
}

/* Hidden by search filter */
.grid-item.hidden {
  display: none;
}

.group.hidden {
  display: none;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.95);
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 92vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox .caption {
  color: #aaa;
  font-size: 0.9rem;
  margin-top: 1rem;
  text-align: center;
}

.lightbox .close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
  background: none;
  border: none;
}

.lightbox .close:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.lightbox .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  font-size: 2rem;
  cursor: pointer;
  padding: 1rem;
  transition: color 0.2s;
  background: none;
  border: none;
  user-select: none;
}

.lightbox .nav:hover {
  color: #fff;
}

.lightbox .nav.prev {
  left: 1rem;
}

.lightbox .nav.next {
  right: 1rem;
}

/* Responsive */
@media (max-width: 1200px) {
  .grid { column-count: 3; }
}

@media (max-width: 800px) {
  .grid { column-count: 2; }
  header { padding: 2rem 1.5rem 1rem; }
  .group { padding: 0 1rem 2rem; }
}

@media (max-width: 500px) {
  .grid { column-count: 1; }
  .lightbox .nav { font-size: 1.5rem; padding: 0.5rem; }
}
