/* gallery uses the wide tier (.wrap.wide) for the masonry grid */

/* tabs + search share one row: tabs flow left, search pinned right (wraps under on narrow) */
.galbar {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin: 18px 0 4px;
}
.galbar .tabs {
  margin: 0;
  flex: 1 1 auto;
}
.galbar .gsearch {
  flex: 0 0 auto;
  margin: 0;
}

/* search bar — dark field with a leading magnifier + trailing clear button */
.gsearch {
  position: relative;
  width: 260px;
  max-width: 100%;
}
svg.gs-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--text-dim-2);
  pointer-events: none;
}
.gsearch input {
  width: 100%;
  height: var(--ctl-h);
  background: var(--field);
  color: var(--white);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  font-size: 13px;
  color-scheme: dark;
  padding: 0 32px 0 34px;
}
.gsearch input:focus {
  outline: none;
  border-color: var(--accent);
}
.gs-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  color: var(--text-dim-2);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius);
}
.gs-clear:hover {
  color: var(--white);
  background: var(--surface);
}

/* category tabs: the site's underline tabs (ui.css .tabs/.tab), a count beside each */
.tabs { margin: 12px 0 4px }
.tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* JS masonry (tiles absolutely positioned into the shortest column -> no gaps) */
.grid {
  position: relative;
  margin-top: 16px;
}
.tile {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: zoom-in;
  transition:
    border-color 0.15s,
    transform 0.05s;
}
.tile:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  z-index: 1;
}
.grid.empty-state {
  position: static;
}
.tile img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--field);
}
.tile .meta {
  padding: 9px 11px;
}
.tile .t {
  color: var(--white);
  font-weight: 700;
  font-size: 13px;
}
.tile .c {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 3px;
  line-height: 1.4;
}
.empty {
  color: var(--text-dim-2);
  text-align: center;
  margin: 60px 0;
}
.empty .big {
  font-size: 46px;
}

/* fullscreen lightbox dialog */
dialog#lb {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  width: 100%;
  height: 100%;
}
dialog#lb::backdrop {
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(2px);
}
.lb-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 18px 18px;
  cursor: zoom-out;
}
.lb-stage img {
  max-width: 94vw;
  max-height: 78vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6);
}
.lb-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 14px;
  max-width: 94vw;
}
.lb-txt {
  text-align: center;
}
.lb-txt .t {
  color: var(--white);
  font-weight: 800;
  font-size: 15px;
}
.lb-txt .c {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-top: 2px;
}
.lb-dl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 800;
  background: var(--accent);
  color: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 5px 11px;
}
.lb-dl:hover {
  filter: brightness(1.1);
}
.lb-stage img,
.lb-bar {
  cursor: default;
}
.lb-x,
.lb-nav {
  position: fixed;
  z-index: 2;
  cursor: pointer;
  color: var(--text);
  height: auto;
  background: rgba(32, 34, 37, 0.7);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  user-select: none;
}
.lb-x {
  top: 14px;
  right: 16px;
  padding: 8px 12px;
}
.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  padding: 14px 16px;
  font-size: 22px;
}
.lb-nav.prev {
  left: 14px;
}
.lb-nav.next {
  right: 14px;
}
.lb-x:hover,
.lb-nav:hover {
  border-color: var(--accent);
  color: var(--white);
}
.lb-count {
  position: fixed;
  z-index: 2;
  top: 18px;
  left: 16px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}

/* ---------- site makeover (assets/css/site.css) ---------- */
.phead .gtotal { font-size: 13px; color: var(--text-dim); white-space: nowrap }
.phead .gtotal b { color: var(--accent-hi); font-size: 18px; font-weight: 800; margin-right: 3px; font-variant-numeric: tabular-nums }

/* tabs: how much each one holds */
.tabs .tab { display: inline-flex; align-items: center; gap: 7px }
.tab .tn {
  font-style: normal; font-size: 11px; font-weight: 700; color: var(--text-faint);
  background: rgba(255, 255, 255, .06); border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums;
}
.tab.active .tn { color: var(--accent-hi); background: rgba(224, 184, 96, .12) }

/* tiles: the title sits on the art, the art grows a little under the pointer */
.tile { border-color: var(--border); box-shadow: 0 6px 18px -10px rgba(0, 0, 0, .7) }
.tile img { transition: transform .35s ease }
.tile:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 16px 34px -14px rgba(0, 0, 0, .85) }
.tile:hover img { transform: scale(1.04) }
.tile .meta {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 26px 12px 10px;
  background: linear-gradient(0deg, rgba(10, 10, 12, .92) 0%, rgba(10, 10, 12, .6) 55%, rgba(10, 10, 12, 0) 100%);
  pointer-events: none;
}
.tile .t { font-size: 14px; text-shadow: 0 1px 6px rgba(0, 0, 0, .9) }
.tile .c { color: var(--text-dim); text-shadow: 0 1px 4px rgba(0, 0, 0, .9) }
.tile .tcat {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--accent-hi);
  background: rgba(10, 10, 12, .72); border: 1px solid var(--line-warm); border-radius: 999px; padding: 2px 8px;
  opacity: 0; transform: translateY(-3px); transition: opacity .15s, transform .15s;
}
.tile:hover .tcat, .tile:focus-visible .tcat { opacity: 1; transform: none }
@media (hover: none) { .tile .tcat { opacity: 1; transform: none } }
@media (prefers-reduced-motion: reduce) { .tile img, .tile .tcat { transition: none } .tile:hover img { transform: none } }

/* the search lives in the header, next to the total, so the tabs get the whole row */
.phead .actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end }
.phead .gsearch { margin: 0; width: 280px; max-width: 100% }
.galbar { margin-top: 8px }
.galbar .tabs { gap: 18px }
@media (max-width: 760px) { .phead .actions { justify-content: flex-start } .phead .gsearch { width: 100% } }

/* ---------- spotlight + shelves (All) and a tidy grid (one category / a search) ---------- */
.grid.shelves, .grid.ugrid { position: static; height: auto !important }
.grid .tile { position: relative; top: auto; left: auto }

/* spotlight: one big story piece, cycled with the arrows / dots */
.spot {
  position: relative; overflow: hidden; margin: 6px 0 30px; border-radius: var(--radius-xl);
  border: 1px solid var(--line-warm); aspect-ratio: 21 / 8; min-height: 280px; max-height: 520px; width: 100%;
  background: #0c0c0e var(--thumb) center / cover no-repeat;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .9);
}
.spot-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 35% }
.spot::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(10, 10, 12, .92) 0%, rgba(10, 10, 12, .55) 38%, rgba(10, 10, 12, 0) 70%),
    linear-gradient(0deg, rgba(10, 10, 12, .7) 0%, rgba(10, 10, 12, 0) 40%);
}
.spot-txt { position: absolute; z-index: 1; left: 36px; bottom: 34px; max-width: min(520px, 60%) }
.spot-cat { font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent) }
.spot-t {
  margin: 8px 0 6px; font-family: var(--body); font-weight: 800; font-size: clamp(26px, 2.6vw, 40px);
  line-height: 1.1; color: var(--heading); text-shadow: 0 2px 14px rgba(0, 0, 0, .9);
}
.spot-c { margin: 0 0 4px; color: var(--text-dim); font-size: 14px; line-height: 1.5; text-shadow: 0 1px 6px rgba(0, 0, 0, .9) }
.spot-acts { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap }
.spot-nav {
  position: absolute; z-index: 2; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; padding: 0; border-radius: 50%; font-size: 26px; line-height: 1;
  color: var(--text); background: rgba(10, 10, 12, .55); border: 1px solid var(--border-2); cursor: pointer;
}
.spot-nav:hover { background: var(--accent); color: #16120a; filter: none }
.spot-nav.prev { left: 14px }
.spot-nav.next { right: 14px }
.spot-dots { position: absolute; z-index: 2; right: 24px; bottom: 20px; display: flex; gap: 6px }
.spot-dot {
  width: 8px; height: 8px; padding: 0; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .3);
}
.spot-dot.on { width: 22px; border-radius: 4px; background: var(--accent) }
.spot-dot:hover { filter: none; background: var(--accent-hi) }

/* shelves: a titled row per category that slides sideways */
.shelf { margin: 0 0 26px }
.sh-hd { display: flex; align-items: center; gap: 10px; margin: 0 0 10px }
.sh-hd h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 24px; color: var(--heading); text-transform: none; letter-spacing: 0 }
.sh-hd .tn {
  font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--text-faint);
  background: rgba(255, 255, 255, .06); border-radius: 999px; padding: 1px 8px;
}
.sh-hd::after { content: ""; flex: 1; height: 1px; background: var(--line-warm); order: 2 }
.sh-all {
  order: 3; background: none; border: 0; height: auto; padding: 2px 0; cursor: pointer;
  font-size: 12.5px; font-weight: 700; color: var(--accent);
}
.sh-all:hover { color: var(--accent-hi); filter: none }
.sh-wrap { position: relative }
.sh-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(250px, 23%, 380px); gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding: 2px 2px 10px;
  scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
}
.sh-row.sq { grid-auto-columns: clamp(150px, 13%, 210px) }
.sh-row .tile { scroll-snap-align: start }
.sh-nav {
  position: absolute; z-index: 3; top: calc(50% - 5px); transform: translateY(-50%);
  width: 38px; height: 38px; padding: 0; border-radius: 50%; font-size: 22px; line-height: 1;
  color: var(--text); background: rgba(10, 10, 12, .8); border: 1px solid var(--border-2); cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.sh-wrap:hover .sh-nav { opacity: 1 }
.sh-nav:hover { background: var(--accent); color: #16120a; filter: none }
.sh-nav.prev { left: -12px }
.sh-nav.next { right: -12px }
@media (hover: none) { .sh-nav { display: none } }

/* every card in a row / grid has the same shape; icons are square */
.shelves .tile img, .ugrid .tile img { aspect-ratio: 16 / 9; height: auto; object-fit: cover; object-position: center 30% }
.shelves .tile.sq img, .ugrid .tile.sq img { aspect-ratio: 1 / 1; object-position: center }

/* one category or a search: an even grid, no masonry */
.grid.ugrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(260px, calc((100% - 36px) / 4)), 1fr)); gap: 12px; margin-top: 16px }
.grid.ugrid.sq { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) }
.grid.ugrid .empty, .grid.shelves .empty { grid-column: 1 / -1 }

@media (max-width: 760px) {
  .spot { aspect-ratio: 4 / 5; max-height: 460px }
  .spot::after { background: linear-gradient(0deg, rgba(10, 10, 12, .95) 0%, rgba(10, 10, 12, .5) 50%, rgba(10, 10, 12, 0) 80%) }
  .spot-txt { left: 18px; right: 18px; bottom: 44px; max-width: none }
  .spot-nav { display: none }
  .spot-dots { left: 18px; right: auto; bottom: 18px }
  .sh-row { grid-auto-columns: 78% }
  .sh-row.sq { grid-auto-columns: 42% }
}

.spot-t { text-transform: none; letter-spacing: 0 }
