:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --max: 1280px;
  --thumb-col: 110px;     /* width of each work thumbnail in the index */
  --mono: "IBM Plex Mono", "Lucida Console", "Consolas", "SF Mono", Menlo, "Courier New", Courier, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--mono);
  color: var(--ink);
  background: #ffffff;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  /* Sticky-footer layout: body fills the viewport, main expands, footer sits
     at the bottom even on short pages like the landing state. align-items:
     center centers each section's max-width box; the children themselves keep
     width:100% so they don't shrink to content (flex cross-axis auto margins
     would otherwise collapse them — see .site-header / main / .site-footer). */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
main { flex: 1; width: 100%; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--muted); }

/* Header — "FILTERS" on the LEFT, logo image on the RIGHT (single line). */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 32px 18px;
  border-bottom: 1px solid var(--line);
  width: 100%;
  max-width: var(--max);
}
.site-nav { display: flex; gap: 18px; }
.site-nav a {
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.site-nav a.active { color: var(--ink); }
.site-title {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
}
.site-logo {
  display: block;
  height: 24px;
  width: auto;
}

/* Layout */
main { max-width: var(--max); padding: 24px 32px 80px; }

/* Gallery layout — single column. The desktop sidebar was removed; the
   horizontal filter bar above the grid is the only filter UI now. */

/* Filter rows: checkbox + label + count, tight single-line spacing within a category */
.filter-list { display: flex; flex-direction: column; gap: 0; }
.filter-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: start;       /* labels can wrap to multiple lines; align tops */
  gap: 6px;
  padding: 1px 4px;
  font-size: 13px;
  line-height: 1.4;
}
.filter-check {
  display: inline-block;
  width: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;          /* match label line-height so they align */
  user-select: none;
}
.filter-check:hover { color: var(--ink); }
.filter-row.active .filter-check { color: var(--ink); }
.filter-label {
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  /* allow wrapping so long titles/exhibitions read in full */
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}
.filter-label:hover { color: var(--muted); }
.filter-row.active .filter-label { color: var(--ink); }
.filter-row .count { color: var(--muted); font-size: 11px; line-height: 1.4; }
.filter-empty { color: var(--muted); font-size: 12px; padding: 2px 8px; font-style: italic; }
.filter-search {
  width: 100%;
  max-width: 180px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 12px;
  background: #ffffff;
}
.filter-search:focus { outline: none; border-color: var(--ink); }

/* Search row below the horizontal filter bar (above the grid). Right-aligned. */
.filter-search-row {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 16px;
}

/* ---- Filter shell ----
   Wraps the (mobile-only) Filter trigger, the search row, and the horizontal
   bar. On desktop the trigger is hidden and the bar + search sit in their
   normal stacked positions. On mobile (see media query below) the shell turns
   into a grid: trigger + search share row 1; bar collapses behind the trigger
   and expands inline below when opened. Markup order is
   trigger → search → bar; on desktop we reverse the visual order via flex
   `order` so the bar still appears above the search. */
.filter-shell-wrap {
  display: flex;
  flex-direction: column;
}
.filter-shell-wrap > .filter-bar         { order: 1; }
.filter-shell-wrap > .filter-search-row  { order: 2; }
.filter-trigger {
  display: none; /* hidden on desktop; revealed at <=720px */
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 8px 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: 0.3px;
}
.filter-trigger:hover { color: var(--muted); }
.filter-trigger-count { color: var(--muted); font-size: 12px; }
.filter-trigger-caret { font-size: 10px; color: var(--muted); transition: transform 0.15s; }
.filter-shell-wrap[data-open="true"] .filter-trigger-caret {
  transform: rotate(180deg);
  color: var(--ink);
}

/* ---- Horizontal filter bar (under the header) ----
   No internal padding so the first dropdown lines up with the sidebar column.
   Negative top margin pulls the bar closer to the header; bottom margin
   gives breathing room before the gallery layout starts. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  padding: 0;
  margin: -14px 0 28px;
}
.bar-dropdown {
  position: relative;
}
.bar-dropdown > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 18px;
  font-size: 13px;
  color: var(--ink);
  user-select: none;
  letter-spacing: 0.3px;
}
.bar-dropdown:first-of-type > summary { padding-left: 0; }
.bar-dropdown > summary::-webkit-details-marker { display: none; }
.bar-dropdown > summary::marker { content: ''; }
.bar-dropdown > summary:hover { color: var(--muted); }
.bar-dropdown[open] > summary { color: var(--ink); background: #fafafa; }
.bar-dropdown .bar-label { white-space: nowrap; }
.bar-dropdown .caret {
  font-size: 10px;
  color: var(--muted);
  line-height: 1;
  margin-left: 2px;
  transition: transform 0.15s;
}
.bar-dropdown[open] .caret { transform: rotate(180deg); color: var(--ink); }
.bar-dropdown .count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  background: var(--ink);
  color: #ffffff;
  border-radius: 9px;
  font-size: 10px;
  padding: 0 5px;
  letter-spacing: 0;
  font-family: var(--mono);
}
.bar-panel {
  position: absolute;
  top: calc(100% + 0px);
  left: 0;
  min-width: 240px;
  max-width: 360px;
  max-height: 60vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
  padding: 10px 12px 12px;
  z-index: 60;
}
.bar-panel .filter-row { padding: 1px 0; }
.bar-panel .filter-empty { padding: 4px 0; }
.results-count {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}
.active-filter-bar {
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}
.active-filter-bar .chip {
  display: inline-block;
  padding: 2px 8px 2px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-right: 6px;
  color: var(--ink);
}
.active-filter-bar .chip a { margin-left: 6px; color: var(--muted); }
.active-filter-bar .clear-all { margin-left: 6px; }

/* Index of works — uniform-width grid, top-aligned per row, natural image heights */
.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--thumb-col), 1fr));
  gap: 22px 18px;
  align-items: start;
}
.work-card {
  display: block;
  margin: 0;
  /* Grid items default to min-width: auto (sized by content), which lets
     long unbreakable strings — e.g. "Installation,drawing,sculpture" or
     "(stand,sit,or lie)" — push the cell wider than its allotted column
     and spill over into the neighbour. Force the cell to shrink and break
     long words instead. */
  min-width: 0;
  overflow-wrap: break-word;
}
.work-card .image {
  background: #ffffff;
  display: block;
  position: relative;
  font-size: 0;       /* squash any baseline gap */
  line-height: 0;
}
.work-card .image img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
  vertical-align: top;
}
.work-card:hover .image { opacity: 0.85; }
.work-card .image-count {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 8px;
  letter-spacing: 0.3px;
  font-family: var(--mono);
}
.work-card .video-badge {
  position: absolute;
  top: 4px; left: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  line-height: 1.4;
  font-family: var(--mono);
}
.work-card .meta { padding: 6px 0 0; font-size: 11px; line-height: 1.4; }
.work-card .title {
  font-size: 11px;
  font-weight: 400;
  margin: 0;
  letter-spacing: 0.2px;
}
.work-card .sub {
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
}
.no-image {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* Empty state */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 13px;
}
/* Landing prompt — shown when no filter / no "all" selected. Right-aligned
   so it sits just below the search input as a quiet "browse all works" cue. */
.landing-prompt {
  padding: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  line-height: 2;
  text-align: right;
}
.landing-prompt .link,
.landing-prompt a {
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
}
.landing-prompt .link:hover,
.landing-prompt a:hover { color: var(--muted); border-bottom-color: var(--muted); }

/* Detail page */
.artwork-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 48px;
  align-items: start;
}

/* Image thread (multi-image vertical scroll) */
.artwork-detail .thread-col {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.image-thread {
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.thread-item {
  margin: 0;
}
.thread-item img {
  display: block;
  width: 100%;          /* uniform column width */
  height: auto;         /* natural aspect ratio -> varying height */
  background: #fafafa;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.thread-item figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  font-style: italic;
}

/* Video items in the thread — 16:9 responsive iframe */
.thread-video .video-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%;   /* 16:9 */
  background: #000000;
  border: 1px solid var(--line);
}
.thread-video .video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.thread-empty {
  border: 1px solid var(--line);
  padding: 60px 20px;
  text-align: center;
  background: #fafafa;
}

/* Sticky info panel on detail */
.artwork-detail .info {
  position: sticky;
  top: 24px;
  align-self: start;
}
.artwork-detail .info h1 {
  font-size: 24px;
  font-weight: 400;
  margin: 0 0 6px;
}
.artwork-detail .info .yearline {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
}
.artwork-detail .info .image-count-note {
  margin-top: 20px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.artwork-detail dl {
  margin: 0;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 14px;
  font-size: 14px;
}
.artwork-detail dt {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-top: 2px;
}
.artwork-detail dd { margin: 0; }
.artwork-detail .back-link {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
}

/* Detail-page top nav row: back link on the left, "more from <filter> →" on the right */
.detail-nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 18px;
  font-size: 13px;
}
.detail-nav .back-link,
.detail-nav .next-link {
  color: var(--muted);
}
.detail-nav .back-link:hover,
.detail-nav .next-link:hover { color: var(--ink); }
.detail-nav .next-link { text-align: right; }

/* Footer — right-aligned so the line sits under the gallery column */
.site-footer {
  padding: 24px 32px;
  font-size: 12px;
  color: var(--muted);
  width: 100%;
  max-width: var(--max);
  text-align: right;
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 95vw; max-height: 95vh; object-fit: contain; }
.lightbox .lb-close {
  position: absolute; top: 16px; right: 22px;
  background: none; border: none; color: #fff;
  font-size: 32px; cursor: pointer;
  padding: 6px 12px;
}

@media (max-width: 720px) {
  .artwork-detail { grid-template-columns: 1fr; gap: 24px; }
  .artwork-detail .info { position: static; }
  .site-header { padding: 18px 20px 12px; }
  main { padding: 18px 20px 60px; }
  .image-thread { gap: 24px; }
  /* Filter shell on mobile —
     Row 1: [Filter ▾]  …  [Search]
     Row 2 (when open):  vertical stack of category dropdowns, each expanding
                         its options inline below. */
  .filter-shell-wrap {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "trigger search"
      "bar     bar";
    column-gap: 12px;
    align-items: center;
    margin: -6px 0 16px;
  }
  .filter-shell-wrap > .filter-bar,
  .filter-shell-wrap > .filter-search-row,
  .filter-trigger { order: initial; } /* grid-area governs placement now */

  .filter-trigger { display: inline-flex; grid-area: trigger; }

  .filter-shell-wrap > .filter-search-row {
    grid-area: search;
    justify-content: flex-end;
    margin: 0;
  }

  .filter-shell-wrap > .filter-bar {
    grid-area: bar;
    margin: 8px 0 0;
    padding: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    border-top: 1px solid var(--line);
  }
  .filter-shell-wrap[data-open="false"] > .filter-bar { display: none; }
  .filter-shell-wrap[data-open="true"]  > .filter-bar { display: flex; }

  /* Each category becomes a full-width row inside the stacked panel.
     Tap the row to expand its options inline below. */
  .bar-dropdown {
    width: 100%;
    border-bottom: 1px solid var(--line);
  }
  .bar-dropdown > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 11px 0;
    font-size: 13px;
    letter-spacing: 0.3px;
    white-space: normal;
    gap: 8px;
  }
  .bar-dropdown:first-of-type > summary { padding-left: 0; }
  .bar-dropdown:last-of-type > summary  { padding-right: 0; }
  .bar-dropdown[open] > summary { background: transparent; }
  .bar-dropdown .bar-label { flex: 1; }
  .bar-dropdown .caret { font-size: 10px; margin-left: 0; }
  .bar-dropdown .count-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    border-radius: 9px;
  }
  /* Panel renders inline (not as a popover) under each row */
  .bar-panel {
    position: static;
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0 0 12px 4px;
    min-width: 0;
    max-width: none;
    max-height: 50vh;
    overflow-y: auto;
  }
}
