:root {
  --bg: #0b0b0e;
  --bg-soft: #141418;
  --panel: #17171c;
  --line: #26262e;
  --text: #ece9e6;
  --dim: #9a98a4;
  --faint: #6b6975;
  --accent: #c9a96a;       /* warm gold — gallery placard */
  --accent-soft: #e7d9b8;
  --radius: 14px;
  --maxw: 1500px;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #1a1206; }

a { color: inherit; }

/* ---------- header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-row {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 24px 12px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: flex; align-items: baseline; gap: 12px; flex: 0 0 auto; }
.brand-mark {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.brand-mark::first-letter { color: var(--accent); }
.brand-count {
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4px;
}

.search {
  position: relative;
  flex: 1 1 auto;
  max-width: 560px;
  margin-left: auto;
  display: flex;
  align-items: center;
}
.search-ico { position: absolute; left: 14px; color: var(--faint); pointer-events: none; }
.search input {
  width: 100%;
  background: #1c1c22;
  border: 1px solid #3a3a45;
  border-radius: 999px;
  color: var(--text);
  font-size: 14.5px;
  padding: 11px 40px 11px 42px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.search input::placeholder { color: #93919e; }
.search input:focus { border-color: var(--accent); background: #101015; }
.search input::-webkit-search-decoration,
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-clear {
  position: absolute; right: 8px;
  width: 26px; height: 26px;
  border: none; background: transparent;
  color: var(--dim); font-size: 20px; line-height: 1;
  cursor: pointer; border-radius: 50%;
}
.search-clear:hover { color: var(--text); background: var(--line); }

.filters {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4px 24px 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  font-size: 12.5px;
  letter-spacing: 0.3px;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all .14s;
  white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip.on {
  color: #1a1206;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.chip .c-n { opacity: .6; margin-left: 5px; font-variant-numeric: tabular-nums; }
.chip.on .c-n { opacity: .7; }

/* ---------- facet selects (movement / artist) ---------- */
.facets {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 16px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.facet { display: inline-flex; align-items: center; gap: 7px; }
.facet > span {
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--faint);
}
.facet select {
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  max-width: 240px;
}
.facet select:hover { border-color: var(--faint); }
.facet select:focus { outline: none; border-color: var(--accent); }
.facet-clear {
  font-size: 12px;
  color: var(--dim);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
}
.facet-clear:hover { color: var(--text); border-color: var(--faint); }

/* ---------- grid (masonry via columns) ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 26px 24px 60px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
  gap: 16px;                       /* black page shows through as spacing */
}
/* dark grey tile grouping the name + thumbnail */
.card {
  display: flex;
  flex-direction: column;
  background: #1d1d24;
  border: 1px solid #2e2e38;
  border-radius: 14px;
  padding: 11px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.card:hover {
  transform: translateY(-3px);
  background: #24242d;
  border-color: color-mix(in srgb, var(--accent) 45%, #2e2e38);
  box-shadow: 0 16px 36px -18px rgba(0,0,0,.85);
}
/* style name — readable on the grey tile, above the image */
.card-name {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.32;
  letter-spacing: .2px;
  color: #c4c2cd;
  margin: 1px 2px 8px;
  min-height: calc(1.32em * 2);    /* reserve 2 lines so thumbnails align */
  display: -webkit-box;
  -webkit-line-clamp: 2;           /* clamp long names to 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .15s;
}
.thumb {
  aspect-ratio: 1 / 1;             /* uniform square thumbnail */
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-soft);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;              /* crop to square (portraits center-cropped) */
  display: block;
}
.card:hover .card-name { color: var(--accent-soft); }

.empty {
  text-align: center;
  color: var(--dim);
  padding: 80px 20px;
  font-size: 15px;
}

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
  text-align: center;
  padding: 26px 20px 40px;
  letter-spacing: .3px;
}

/* ---------- lightbox ---------- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(6,6,9,.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  animation: fade .16s ease;
}
/* `.lb { display:flex }` overrides the UA `[hidden]` rule, so hide it explicitly */
.lb[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.lb-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 0;
  max-width: 1180px;
  width: 100%;
  max-height: calc(100vh - 56px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 90px -30px rgba(0,0,0,.9);
}
.lb-stage {
  background: #050507;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 14px;
}
.lb-stage img {
  max-width: 100%;
  max-height: calc(100vh - 84px);
  object-fit: contain;
  border-radius: 6px;
}
.lb-meta {
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  border-left: 1px solid var(--line);
}
.lb-meta-top { margin-bottom: 18px; }
.lb-meta h2 {
  font-family: Georgia, serif;
  font-size: 23px;
  font-weight: 600;
  line-height: 1.25;
}
.lb-model {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  padding: 3px 10px;
}
/* lightbox tag chips: movements / artists (filterable) + techniques (search) */
.lb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.lb-tags:empty { display: none; }
.tag {
  font: inherit;
  font-size: 11.5px;
  line-height: 1;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all .12s;
}
.tag:hover { color: var(--text); border-color: var(--faint); }
.tag-artist { color: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.tag-artist:hover { border-color: var(--accent); }
.tag-technique { opacity: .85; font-size: 11px; }
.lb-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--faint);
  margin-bottom: 8px;
}
.copy {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--accent);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all .14s;
}
.copy:hover { background: var(--accent); color: #1a1206; }
.copy.done { color: #7fdca0; border-color: #2f6b46; }
.lb-prompt {
  flex: 1 1 auto;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  margin-bottom: 16px;
}
.lb-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lb-link {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--accent);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all .14s;
}
.lb-link:hover { background: var(--accent); color: #1a1206; }
.lb-link.done { color: #7fdca0; border-color: #2f6b46; }
.lb-orig { font-size: 12.5px; color: var(--dim); text-decoration: none; white-space: nowrap; }
.lb-orig:hover { color: var(--accent); }

.lb-close, .lb-nav {
  position: fixed;
  z-index: 70;
  background: rgba(20,20,24,.7);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .14s, transform .14s;
}
.lb-close { top: 20px; right: 24px; width: 42px; height: 42px; font-size: 24px; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 28px; }
.lb-prev { left: 22px; }
.lb-next { right: 22px; }
.lb-close:hover, .lb-nav:hover { background: var(--accent); color: #1a1206; }
.lb-nav:hover { transform: translateY(-50%) scale(1.06); }

@media (max-width: 820px) {
  .lb { padding: 0; }
  .lb-inner {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    border-radius: 0;
    max-height: 100vh;
    height: 100vh;
  }
  .lb-stage img { max-height: 52vh; }
  .lb-meta { border-left: none; border-top: 1px solid var(--line); max-height: 48vh; }
  .lb-nav { display: none; }
  .top-row { flex-wrap: wrap; gap: 14px; }
  .search { max-width: none; margin-left: 0; order: 3; flex-basis: 100%; }
}
