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

:root {
  --text: #222222;
  --text-muted: #717171;
  --border: #dddddd;
  --bg: #ffffff;
  --nav-h: 56px;
  --page-max: 1280px;
  --page-pad: 48px;
  --radius-sm: 8px;
  --radius-md: 12px;
}

html { scroll-behavior: smooth; }

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

.hidden { display: none !important; }

/* ── Nav ─────────────────────────────────────────── */
#category-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

.nav-pills {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-pills::-webkit-scrollbar { display: none; }

.nav-pill {
  padding: 0 14px;
  height: var(--nav-h);
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}

.nav-pill:hover { color: var(--text); }
.nav-pill.active { color: var(--text); border-bottom-color: var(--text); }

/* ── Loading spinner ─────────────────────────────── */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid #eee;
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Overview ────────────────────────────────────── */
.overview {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 48px var(--page-pad) 40px;
}

.overview h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 24px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px 10px;
}

.overview-thumb {
  cursor: pointer;
}

.overview-thumb-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
  transition: opacity 0.15s;
}

.overview-thumb:hover .overview-thumb-img { opacity: 0.82; }

.overview-thumb-label {
  font-size: 12px;
  color: var(--text);
  margin-top: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Category sections ───────────────────────────── */
.categories {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad) 96px;
}

.category-section {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  padding: 52px 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--nav-h) + 12px);
}

.cat-heading-col { position: relative; }

.cat-heading {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
}

.cat-heading h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

/* ── Photos column ───────────────────────────────── */
.cat-photos {
  display: grid;
  /* 2-up grid for portrait shots, full-width for landscape */
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* First photo always spans full width */
.cat-photos .photo-item:first-child {
  grid-column: 1 / -1;
}

/* If only 1 photo – also full width (already covered by first-child) */
/* If only 2 photos – first full-width, second full-width */
.cat-photos:has(.photo-item:only-child) .photo-item,
.cat-photos:has(.photo-item:nth-child(2):last-child) .photo-item:nth-child(2) {
  grid-column: 1 / -1;
}

.photo-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: zoom-in;
  background: #f0f0f0;
}

.photo-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 4 / 3;
  transition: transform 0.35s ease, opacity 0.2s;
}

.photo-item:first-child img {
  aspect-ratio: 16 / 9;
}

.photo-item:hover img { transform: scale(1.02); opacity: 0.94; }

/* ── Empty state ─────────────────────────────────── */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 48px;
}

.empty-icon { font-size: 48px; }
.empty p { font-size: 16px; }
.empty .empty-hint { font-size: 14px; line-height: 2; margin-top: 4px; }

code {
  background: #f5f5f5;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: ui-monospace, 'Cascadia Code', monospace;
}

/* ── Lightbox ────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.93);
}

.lightbox-body {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  padding: 64px 80px 16px;
}

.lightbox-body img {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  border-radius: 6px;
  user-select: none;
}

.lightbox-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 24px 20px;
  color: rgba(255,255,255,0.65);
  font-size: 13px;
}

.lightbox-category { color: rgba(255,255,255,0.85); font-weight: 500; }
.lightbox-counter::before { content: '·'; margin-right: 16px; }

.lb-btn {
  position: absolute;
  z-index: 2;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  font-size: 14px;
  line-height: 1;
}

.lb-btn:hover { background: rgba(255,255,255,0.22); }

.lightbox-close { top: 16px; right: 20px; font-size: 15px; }
.lightbox-prev  { left: 16px;  top: 50%; transform: translateY(-50%); font-size: 26px; padding-right: 2px; }
.lightbox-next  { right: 16px; top: 50%; transform: translateY(-50%); font-size: 26px; padding-left: 2px; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 900px) {
  :root {
    --page-pad: 24px;
  }

  .category-section {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .cat-heading { position: static; }
  .cat-heading h2 { font-size: 20px; }

  .cat-photos { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .overview-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px 6px; }
  .cat-photos { grid-template-columns: 1fr; }
  .cat-photos .photo-item { grid-column: 1 / -1; }
  .lightbox-body { padding: 52px 52px 12px; }
  .lightbox-prev { left: 6px; }
  .lightbox-next { right: 6px; }
}
