/* Gallery with filters + two lightboxes; cleaned hover effects to prevent flicker */

:root {
  --content-pad: 20px;
  --gap: 14px;
  --tile-radius: 14px;
  --tile-border: rgba(255,255,255,.16);
  --tile-bg: rgba(255,255,255,.04);

  /* Selects */
  --select-bg: #0b0b0e;
  --select-text: #fff;
  --select-border: rgba(255,255,255,.25);
  --select-focus: #e3a369;

  /* Overlay */
  --overlay-bg: rgba(0,0,0,.84);
  --arrow-size: 44px;
  --arrow-offset: 16px;
  --close-offset: 14px;

  /* Info sheet */
  --sheet-w: 420px;
  --sheet-pad: 14px;
  --sheet-border: rgba(255,255,255,.22);
  --sheet-bg: rgba(14,14,18,.6);
}

/* Page */
.content.gallery-page { padding: var(--content-pad); }
.gallery-wrap { max-width: 100%; margin: 0 auto; }
.gallery-hero { margin: 4px 0 14px; }
.gallery-hero h2 { margin: 0 0 6px; }
.gallery-hero .sub { opacity: .9; }

/* Filters */
.filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: var(--gap);
  align-items: end;
  margin: 8px 0 16px;
}
.filters .filter label { display: block; font-size: .92rem; opacity: .85; margin-bottom: 4px; }
.filters .select { position: relative; }
.filters .select::after {
  content: "expand_more";
  font-family: "Material Symbols Outlined";
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none; font-size: 20px; opacity: .95;
}
.filters select {
  width: 100%;
  padding: 10px 34px 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--select-border);
  background: var(--select-bg);
  color: var(--select-text);
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  accent-color: var(--select-focus);
}
.filters select:focus {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--select-focus), transparent 70%);
  border-color: var(--select-focus);
}
.filters .filters-spacer { display: none; }
.filters .count { justify-self: end; align-self: center; opacity: .9; }

/* Grid */
.grid {
  display: grid;
  grid-template-columns: 1fr;   /* MOBILE: always 1 col */
  gap: var(--gap);
}

.tile {
  position: relative;
  border: 1px solid var(--glass-border, rgba(231,236,243,0.16));
  border-radius: var(--tile-radius);
  background: var(--panel-bg, rgba(12, 18, 34, 0.62));
  overflow: hidden;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  transition: border-color .2s ease, background .25s ease, box-shadow .25s ease;
  box-shadow: var(--panel-shadow, 0 22px 60px rgba(5, 10, 20, 0.4));
}
.tile picture, .tile img {
  display: block;
  width: 100%;
  height: auto;
}
.tile figcaption {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}
.tile .meta .title { margin: 0 0 2px; font-size: 1rem; line-height: 1.25; }
.tile .meta .sub   { margin: 0; opacity: .9; font-size: .92rem; }
.tile .badge {
  align-self: start; justify-self: end;
  padding: 4px 8px; border-radius: 999px;
  border: 1px solid rgba(231,236,243,0.28);
  background: rgba(231,236,243,0.14);
  font-size: .82rem; line-height: 1; white-space: nowrap;
}

/* Tile buttons */
.tile .open, .tile .info {
  position: absolute;
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--glass-border, rgba(231,236,243,0.22));
  background: var(--panel-bg, rgba(12, 18, 34, 0.62));
  color: var(--text-primary);
  cursor: pointer;
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.tile .open { inset: 8px 8px auto auto; width: 34px; padding: 0; }
.tile .info { inset: 8px auto auto 8px; }
.tile .open:hover,
.tile .info:hover {
  background: var(--panel-hover-bg, rgba(18, 26, 42, 0.76));
  border-color: var(--glass-border-strong, rgba(231,236,243,0.26));
  box-shadow: 0 22px 60px rgba(3, 6, 14, 0.48);
  color: var(--accent);
}
.tile:hover,
.tile:focus-within {
  background: var(--panel-hover-bg, rgba(18, 26, 42, 0.76));
  border-color: var(--glass-border-strong, rgba(231,236,243,0.26));
  box-shadow: 0 30px 90px rgba(3, 6, 14, 0.52);
}

/* Overlay base */
.lightbox.hidden, .infobox.hidden { display: none; }
.lightbox, .infobox {
  position: fixed; inset: 0;
  background: var(--overlay-bg);
  z-index: 1000;
  display: grid; place-items: center;
  padding: 14px;
  overflow: hidden;
}

/* Lightbox A */
.lightbox .frame {
  position: relative;
  display: grid; gap: 10px;
  max-width: min(96vw, 2400px);
  max-height: 92vh;
  margin: 0;
}
.lightbox img {
  max-width: 100%;
  max-height: 84vh;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.2);
}
.lightbox figcaption { display: grid; gap: 2px; text-align: center; }

/* Lightbox B */
.infobox .frame {
  position: relative;
  display: grid;
  gap: 10px;
  max-width: min(96vw, 2400px);
  max-height: 92vh;
  margin: 0;
  grid-template-columns: 1fr var(--sheet-w);
  align-items: stretch;
}
.infobox .pane.image,
.infobox .pane.sheet {
  position: relative;
  border-radius: 12px;
}
.infobox .pane.image {
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.2);
  display: grid; place-items: center;
}
.infobox #buyThisPrint {
  position: absolute;
  top: var(--close-offset);
  left: var(--close-offset);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(0,0,0,.55);
  color: #fff;
  text-decoration: none;
  font-size: .95rem;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}

.infobox #buyThisPrint:hover {
  background: rgba(0,0,0,.65);
  transform: translateY(-1px);
}
.infobox .pane.image img {
  max-width: 100%;
  max-height: 84vh;
  border-radius: 12px;
  display: block;
}
.infobox .pane.sheet {
  border: 1px solid var(--sheet-border);
  background: var(--sheet-bg);
  overflow: hidden;
}
.infobox .sheet-inner {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: var(--sheet-pad);
}
.infobox h3 { margin: 0; font-size: 1.05rem; }
.infobox .subline { opacity: .9; font-size: .95rem; }
.infobox .blurb { opacity: .96; line-height: 1.35; }
.infobox .details {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 12px; align-items: start;
  font-size: .95rem;
}
.infobox .details .label { opacity: .85; }
.infobox .details .value { opacity: .95; }
.infobox .related { margin-top: 6px; }
.infobox .related .grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.infobox .related .thumb {
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}
.infobox .related .thumb img { display: block; width: 100%; height: auto; }

/* Overlay controls */
.lb-close, .lb-prev, .lb-next,
.ib-close, .ib-prev, .ib-next {
  position: fixed;
  width: var(--arrow-size); height: var(--arrow-size);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(0,0,0,.35);
  color: inherit;
  display: grid; place-items: center;
  cursor: pointer;
  z-index: 1002;
}

/* Prevent background scroll when any overlay is open */
.no-scroll { overflow: hidden; }

/* RESPONSIVE LAYOUT */

/* Tablet / laptop: 2 columns */
@media (min-width: 1221px) and (max-width: 1920px) {
  .gallery-wrap { max-width: 1600px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}

/* Desktop: 3 columns */
@media (min-width: 1921px) {
  .gallery-wrap { max-width: 2000px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile overlays */
@media (max-width: 1220px) {
  .lightbox, .infobox { overflow: auto; }
  .infobox .frame { grid-template-columns: 1fr; max-height: none; }
  .infobox .pane.sheet { height: auto; }
}
