:root {
  --bg:          #0d0d0d;
  --surface:     #141414;
  --strip-bg:    #111111;
  --border:      #242424;
  --text:        #e0e0e0;
  --muted:       #555555;
  --muted2:      #888888;
  --accent:      #c9a84c;
  --accent-dim:  rgba(201,168,76,0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
}

/* ─────────────────────────────────────────
   TOP BAR
───────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 58px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.site-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: .04em;
  color: #fff;
  white-space: nowrap;
}

.site-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* sort buttons */
.sort-btns { display: flex; }

.sort-btn {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: .04em;
  padding: 5px 14px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted2);
  cursor: pointer;
  margin-left: -1px;
  position: relative;
}
.sort-btn:first-child { border-radius: 2px 0 0 2px; margin-left: 0; }
.sort-btn:last-child  { border-radius: 0 2px 2px 0; }
.sort-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  z-index: 1;
}
.sort-btn:hover:not(.active) {
  border-color: var(--muted2);
  color: var(--text);
  z-index: 1;
}

/* ─────────────────────────────────────────
   TAG STRIP BAR
───────────────────────────────────────── */
.tag-strip-bar {
  position: sticky;
  top: 58px;
  z-index: 19;
  background: var(--strip-bg);
  border-bottom: 1px solid var(--border);
}

.tag-strip-row {
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.tag-strip-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  white-space: nowrap;
  padding-right: 16px;
  border-right: 1px solid var(--border);
  margin-right: 14px;
  flex-shrink: 0;
  line-height: 1;
}

.tag-strip {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 10px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tag-strip::-webkit-scrollbar { display: none; }

.tag-pill {
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: .04em;
  padding: 5px 13px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted2);
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tag-pill:hover { border-color: var(--muted2); color: var(--text); }
.tag-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.pill-count { font-size: 10px; opacity: .5; }
.tag-pill.active .pill-count { opacity: .65; }

/* active chips row — hidden when no filters */
.active-chips-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 24px 10px;
  border-top: 1px solid var(--border);
}
.active-chips-row.hidden { display: none; }

.chips-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  flex-shrink: 0;
}

.chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 10px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 2px;
}

.chip-remove {
  background: none;
  border: none;
  color: rgba(201,168,76,.45);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}
.chip-remove:hover { color: var(--accent); }

.filter-mode-btns {
  display: flex;
  margin-left: auto;
  flex-shrink: 0;
}

.fm-btn {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 4px 11px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  margin-left: -1px;
  position: relative;
}
.fm-btn:first-child { border-radius: 2px 0 0 2px; margin-left: 0; }
.fm-btn:last-child  { border-radius: 0 2px 2px 0; }
.fm-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  z-index: 1;
}

/* ─────────────────────────────────────────
   MAIN / GRID
───────────────────────────────────────── */
.main { padding: 20px 24px 60px; }

.status {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  letter-spacing: .03em;
  min-height: 18px;
}

/* Flex-column masonry — round-robin column assignment keeps left-to-right order */
.grid {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.grid-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tile {
  margin-bottom: 0;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.tile img {
  width: 100%;
  height: auto;
  display: block;
}

.tile-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 200ms ease;
  display: flex;
  align-items: flex-end;
  padding: 8px;
}

@media (hover: hover) {
  .tile:hover .tile-overlay { background: rgba(0,0,0,.45); }
  .tile:hover .tile-tags    { display: flex; }
}

.tile-tags {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
}

.tile-tag {
  font-size: 10px;
  color: rgba(255,255,255,.85);
  background: rgba(0,0,0,.55);
  padding: 2px 7px;
  border-radius: 1px;
  letter-spacing: .04em;
}

.loadmore-wrap {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.loadmore-btn {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: .06em;
  padding: 9px 28px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted2);
  cursor: pointer;
  border-radius: 2px;
}
.loadmore-btn:hover { border-color: var(--muted2); color: var(--text); }

/* ─────────────────────────────────────────
   LIGHTBOX
───────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: #080808;
  z-index: 100;
  overscroll-behavior: contain;
}
.lightbox.hidden { display: none; }

.lb-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
}
@supports (height: 100dvh) {
  .lb-shell { height: 100dvh; }
}

/* film strip bar */
.lb-strip-bar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 10px 52px 10px 16px; /* right padding makes room for close btn */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lb-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.lb-strip::-webkit-scrollbar { display: none; }

.lb-strip-thumb {
  width: 60px;
  height: 42px;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid #2a2a2a;
  cursor: pointer;
  opacity: .35;
  transition: opacity 150ms;
}
.lb-strip-thumb:hover { opacity: .7; }
.lb-strip-thumb.active {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.lb-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.45);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 14px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lb-close:hover { color: #fff; border-color: rgba(255,255,255,.3); }

/* image area */
.lb-body {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: stretch;
  padding: 10px 8px;
  gap: 6px;
}

.lb-nav {
  flex-shrink: 0;
  align-self: center;
  background: rgba(0,0,0,.5);
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.45);
  width: 40px;
  height: 52px;
  cursor: pointer;
  font-size: 24px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-nav:hover { color: #fff; border-color: rgba(255,255,255,.25); }

.lb-center {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lb-imgwrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  width: auto;
  height: auto;
}

/* footer: metadata + tags */
.lb-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  max-height: 110px;
  overflow: hidden;
}

.lb-meta-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  flex: 1;
}

.lb-meta-key {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  margin-bottom: 4px;
}

.lb-meta-val {
  font-size: 12px;
  color: #ccc;
  white-space: nowrap;
}

.lb-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: flex-start;
}

.lb-tag {
  font-size: 10px;
  letter-spacing: .06em;
  padding: 3px 10px;
  border: 1px solid var(--border);
  color: var(--muted2);
  border-radius: 1px;
}

/* tags matching the current filter get a gold tint */
.lb-tag.filter-match {
  border-color: rgba(201,168,76,.45);
  color: rgba(201,168,76,.8);
}

/* ─────────────────────────────────────────
   MOBILE  (≤ 700px)
───────────────────────────────────────── */
@media (max-width: 700px) {
  .topbar { padding: 0 14px; height: 50px; }
  .site-title { font-size: 18px; }
  .site-sub { display: none; }
  .sort-btn { padding: 5px 10px; font-size: 10px; }

  .tag-strip-bar { top: 50px; }
  .tag-strip-row { padding: 0 14px; }
  .active-chips-row { padding: 7px 14px 9px; }
  .filter-mode-btns { display: none; }

  .main { padding: 14px 8px 60px; }
  .grid { gap: 4px; }
  .grid-col { gap: 4px; }

  /* lightbox mobile */
  .lb-strip-bar { padding: 8px 44px 8px 10px; }
  .lb-strip-thumb { width: 48px; height: 34px; }

  .lb-body { padding: 6px 4px; gap: 0; }
  .lb-nav { display: none; }
  .lb-center { touch-action: pan-y; }

  .lb-footer {
    padding: 10px 14px;
    gap: 12px;
    max-height: 120px;
  }
  .lb-meta-grid { gap: 14px; }
  .lb-meta-val { font-size: 11px; }
}
