:root {
  --bg: #f2ede4;
  --card-bg: #ffffff;
  --ink: #1a1815;
  --muted: #7a746a;
  --line: #ddd5c7;
  --chip-bg: #ffffff;
  --chip-active-bg: #1a1815;
  --chip-active-ink: #f2ede4;
  --tag-bg: #f0ece3;
  --accent: #d9542b;
  --header-bg: #241f20;
  --header-bg-2: #34282f;
  --header-line: rgba(255, 255, 255, 0.12);
  --header-ink: #f7f4ee;
  --header-muted: #b8b0aa;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}

.topbar {
  background: linear-gradient(135deg, var(--header-bg) 0%, var(--header-bg-2) 100%);
  border-bottom: 1px solid var(--header-line);
}
.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.topbar-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}
.topbar-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 20px;
  border-left: 1px solid var(--header-line);
}
.topbar h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--header-ink);
  font-weight: 600;
}
.subhead {
  margin: 0;
  color: var(--header-muted);
  font-size: 13px;
}

.page-body {
  padding: 28px 32px 60px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.chip {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--chip-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.chip:hover { border-color: var(--ink); }
.chip.active {
  background: var(--chip-active-bg);
  color: var(--chip-active-ink);
  border-color: var(--chip-active-bg);
}
.chip .count {
  opacity: 0.55;
  font-size: 10px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-thumb-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  cursor: zoom-in;
  background: #eee;
}
.card-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: transform 0.25s ease;
}
.card-thumb-wrap:hover img { transform: scale(1.04); }

.card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.card-title-row h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.card-subtitle {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-size: 11px;
  background: var(--tag-bg);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--ink);
}

.card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.category-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
}
.category-label::before {
  content: "\25C6";
  font-size: 9px;
}
.index-label {
  font-family: var(--mono);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 13, 10, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 40px;
}
.lightbox.open { display: flex; }
.lb-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lb-close {
  position: absolute;
  top: 20px;
  right: 28px;
  background: none;
  border: none;
  color: #fff;
  font-size: 34px;
  cursor: pointer;
  line-height: 1;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-nav:hover { background: rgba(255,255,255,0.18); }
.lb-prev { left: 24px; }
.lb-next { right: 24px; }
.lb-caption {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: 13px;
  font-family: var(--mono);
  opacity: 0.85;
}

@media (max-width: 640px) {
  .page-body { padding: 20px 16px 40px; }
  .topbar-inner { padding: 16px 20px; gap: 14px; }
  .topbar-logo { height: 20px; }
  .topbar-text { padding-left: 14px; }
  .topbar h1 { font-size: 16px; }
  .subhead { font-size: 12px; }
  .grid { grid-template-columns: 1fr; }
  .lb-nav { width: 40px; height: 40px; font-size: 22px; }
}
