body {
  font-family: system-ui, sans-serif;
  background-color: #fafafa;
  color: #333;
  max-width: 720px;
  margin: 2rem auto;
  padding: 1rem;
  line-height: 1.6;
}

nav {
  margin-bottom: 2rem;
}

nav a {
  margin-right: 1rem;
  text-decoration: none;
  color: #007acc;
}

h1, h2, h3 {
  margin-top: 1.5em;
  line-height: 1.2;
}

a:hover {
  text-decoration: underline;
}

footer {
  margin-top: 3rem;
  font-size: 0.875rem;
  color: #777;
  border-top: 1px solid #ddd;
  padding-top: 1rem;
}

/* Portfolio listing grid */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.portfolio-card {
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}

.portfolio-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.portfolio-card img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.portfolio-card h3 {
  padding: 0.75rem 1rem;
  margin: 0;
  font-size: 1rem;
}

/* Gallery grid on individual pages */
.gallery {
  display: grid;
  gap: 0.5rem;
  margin: 2rem 0;
}

.gallery-cols-4 { grid-template-columns: repeat(4, 1fr); }
.gallery-cols-5 { grid-template-columns: repeat(5, 1fr); }
.gallery-cols-6 { grid-template-columns: repeat(6, 1fr); }
/* 8 columns is too narrow for most screens; cap at 4 */
.gallery-cols-8 { grid-template-columns: repeat(4, 1fr); }

.gallery-item {
  margin: 0;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

@media (prefers-color-scheme: dark) {
  body {
    background-color: #1a1a2e;
    color: #ccc;
  }
  nav a { color: #5ca8d6; }
  a { color: #5ca8d6; }
  footer { color: #888; border-top-color: #444; }
  .portfolio-card { background: rgba(255, 255, 255, 0.08); }
  .portfolio-card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); }
}

@media (max-width: 768px) {
  .gallery[class*="gallery-cols-"] { grid-template-columns: repeat(2, 1fr); }
  .portfolio-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
