:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-hover: #242424;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-muted: #888;
  --accent: #5b9bd5;
  --accent-hover: #7bb3e8;
  --tag-bg: #1e2a3a;
  --tag-text: #5b9bd5;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 4rem 1.5rem 2rem;
}

/* Header */
header {
  margin-bottom: 4rem;
}

h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.tagline {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 1.2rem;
}

nav.links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

nav.links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}

nav.links a:hover {
  color: var(--accent-hover);
}

/* Sections */
section {
  margin-bottom: 4rem;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 1.2rem;
}

/* Project cards */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.4rem;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
  display: block;
}

.project-card:hover {
  background: var(--surface-hover);
  border-color: #333;
}

a.project-card {
  cursor: pointer;
}

.project-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-weight: 500;
}

/* Books */
.shelf-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

#recently-read .shelf-label {
  margin-top: 1.5rem;
}

.book-grid {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.book {
  flex-shrink: 0;
  text-decoration: none;
  color: var(--text);
  width: 100px;
  text-align: center;
}

.book img {
  width: 100px;
  height: 150px;
  object-fit: cover;
  border-radius: 4px;
  transition: transform 0.15s;
}

.book:hover img {
  transform: scale(1.05);
}

.book-title {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  line-height: 1.3;
}

.goodreads-link {
  margin-top: 1.2rem;
}

.goodreads-link a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.15s;
}

.goodreads-link a:hover {
  color: var(--accent);
}

.reading-stats {
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 1.2rem;
  display: flex;
  gap: 0;
  align-items: center;
}

.reading-stats .stat-sep {
  margin: 0 0.5rem;
  color: var(--text-muted);
}

.book-pages {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
  aspect-ratio: 1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.gallery-item:hover img {
  transform: scale(1.03);
}

.gallery-item .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  font-size: 0.8rem;
  color: #ddd;
  opacity: 0;
  transition: opacity 0.2s;
}

.gallery-item:hover .caption {
  opacity: 1;
}

.placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
}

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

.lightbox.active {
  display: flex;
}

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

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 2rem;
  padding: 0.5rem;
  transition: color 0.15s;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  color: #fff;
}

.lightbox-close {
  top: 1rem;
  right: 1.5rem;
  font-size: 2.5rem;
}

.lightbox-prev {
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
}

.lightbox-next {
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
}

.lightbox-caption {
  color: var(--text-muted);
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  max-width: 720px;
  margin: 0 auto;
}

/* Responsive */
@media (max-width: 500px) {
  .container {
    padding: 2.5rem 1rem 1.5rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}
