.bmag{display:grid;grid-template-columns:repeat(var(--bmag-cols,4),minmax(0,1fr));gap:12px}.bmag-item{border:0;background:transparent;padding:0;cursor:zoom-in;display:flex;align-items:center;justify-content:center;min-width:0}.bmag-item img{display:block;width:100%;height:auto;max-height:330px;object-fit:contain}.bmag-item:focus-visible{outline:2px solid currentColor;outline-offset:3px}@media(max-width:640px){.bmag{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}}
.bmag-overlay{position:fixed;inset:0;z-index:999999;background:rgba(0,0,0,.89);display:grid;grid-template-rows:56px minmax(0,1fr) 72px;align-items:stretch;box-sizing:border-box;color:#fff;padding:env(safe-area-inset-top,0px) 8px env(safe-area-inset-bottom,0px);overscroll-behavior:contain}.bmag-overlay[hidden],.bmag-overlay [hidden]{display:none!important}.bmag-header{display:flex;justify-content:flex-end;align-items:center;padding:0 6px;z-index:2}.bmag-close,.bmag-prev,.bmag-next{font-family:Arial,sans-serif;border:0;color:white;background:rgba(0,0,0,.45);cursor:pointer;line-height:1}.bmag-close{font-size:34px;width:44px;height:44px}.bmag-stage{display:flex;align-items:center;justify-content:center;position:relative;min-width:0;min-height:0;width:100%;height:100%}.bmag-stage img{display:block;max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain}.bmag-prev,.bmag-next{position:absolute;top:50%;transform:translateY(-50%);z-index:1;font-size:42px;width:38px;height:58px}.bmag-prev{left:0}.bmag-next{right:0}.bmag-footer{height:72px;min-height:0;display:flex;flex-direction:column;justify-content:center;align-items:center;max-width:100%;text-align:center;box-sizing:border-box;padding:4px 8px}.bmag-caption{margin:0 0 5px;font-size:12px;max-width:90vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bmag-article{display:block;box-sizing:border-box;background:#fff;color:#171717!important;border-radius:5px;padding:10px 18px;font-weight:600;font-size:14px;text-decoration:none!important;max-width:min(90vw,700px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bmag-article:focus-visible,.bmag-close:focus-visible,.bmag-prev:focus-visible,.bmag-next:focus-visible{outline:2px solid #fff;outline-offset:3px}@media(max-width:640px){.bmag-prev,.bmag-next{font-size:36px;width:32px}}

/* Compact exhibition and category tabs */
.bmag{gap:5px}
.bmag-item img{max-height:none}
@media(max-width:640px){.bmag{grid-template-columns:repeat(var(--bmag-cols,4),minmax(0,1fr));gap:0}}
.bmag-tab-buttons{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 12px}
.bmag-tab-break{flex-basis:100%;height:0;padding:0;margin:0;border:0}
.bmag-tab{font:inherit;font-size:13px;line-height:1.4;padding:7px 11px;border:1px solid #aaa;border-radius:4px;background:transparent;color:inherit;cursor:pointer}
.bmag-tab[aria-selected="true"]{background:#333;color:#fff;border-color:#333}
.bmag-tab:focus-visible,.bmag-page:focus-visible{outline:2px solid currentColor;outline-offset:2px}
.bmag-tab-panel[hidden],.bmag-item[hidden]{display:none!important}
.bmag-pagination{display:flex;justify-content:center;align-items:center;gap:7px;margin:15px 0 5px}
.bmag-page{font:inherit;font-size:13px;min-width:32px;min-height:32px;border:1px solid #aaa;border-radius:3px;background:transparent;color:inherit;cursor:pointer}
.bmag-page[aria-current="page"]{background:#333;color:#fff;border-color:#333}

/* v0.4.1: stable exhibition viewport, pagination above thumbnails */
.bmag-tabs .bmag-pagination{justify-content:flex-start;margin:0 0 16px;min-height:32px;gap:2px}
.bmag-tabs .bmag-pagination:empty{min-height:32px;margin:0 0 16px}
.bmag-tabs .bmag-pagination .bmag-page{min-width:28px;min-height:28px;padding:0 5px;border:0;border-radius:3px;background:transparent;color:#777;font-size:12px}
.bmag-tabs .bmag-pagination .bmag-page[aria-current="page"]{background:#eee;color:#222;font-weight:700}
.bmag-tabs .bmag{grid-template-rows:repeat(var(--bmag-rows,2),minmax(0,1fr));aspect-ratio:calc(var(--bmag-cols,4) / var(--bmag-rows,2));align-items:stretch}
.bmag-tabs .bmag-item{width:100%;height:100%;min-height:0;overflow:visible}
.bmag-tabs .bmag-item img{display:block;width:auto;height:auto;max-width:100%;max-height:100%;object-fit:contain;object-position:center;margin:0!important}


/* v0.4.4: on phones, let each thumbnail use the full column width. */
@media(max-width:640px){
  .bmag-tabs .bmag{
    grid-template-rows:none;
    aspect-ratio:auto;
    align-items:start;
    column-gap:0;
    row-gap:0;
  }
  .bmag-tabs .bmag-item{
    width:100%;
    height:auto;
    align-self:start;
  }
  .bmag-tabs .bmag-item img{
    display:block;
    width:100%;
    height:auto;
    max-width:none;
    max-height:none;
    object-fit:fill;
  }
}

/* v0.5.0: restore a very small gap between illustration thumbnails on phones. */
@media(max-width:640px){
  .bmag-tabs .bmag{column-gap:4px;row-gap:4px}
}

/* Short/direct works: structural layout only. Visual styling belongs in the child theme. */
.bmag-short-grid{
  display:grid;
  grid-template-columns:repeat(var(--bmag-short-cols,4),minmax(0,1fr));
}
.bmag-short-item{
  display:block;
  min-width:0;
  margin:0;
  padding:0;
  border:0;
  background:transparent;
  text-decoration:none!important;
  box-sizing:border-box;
  line-height:0;
  font-size:0;
  overflow:hidden;
}
.bmag-short-item img{
  display:block;
  width:100%;
  height:auto;
  max-width:100%;
  margin:0!important;
  padding:0;
}
.bmag-short-item:focus-visible{outline:2px solid currentColor;outline-offset:3px}
.bmag-short-item[hidden]{display:none!important}
.bmag-short-pagination{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:7px;
  margin:16px 0 0;
  min-height:34px;
}
.bmag-short-page{
  font:inherit;
  font-size:13px;
  min-width:32px;
  min-height:32px;
  padding:0 7px;
  border:0;
  border-radius:3px;
  background:transparent;
  color:inherit;
  cursor:pointer;
}
.bmag-short-page[aria-current="page"]{
  border:1px solid #ccc;
  background:#fff;
}
.bmag-short-page:focus-visible{outline:2px solid currentColor;outline-offset:2px}
@media(max-width:640px){
  .bmag-short-grid{grid-template-columns:repeat(var(--bmag-short-cols,4),minmax(0,1fr))}
}

/* v0.5.4: short cards keep their natural thumbnail height instead of stretching to the tallest item in the row. */
.bmag-short-grid{align-items:start}
.bmag-short-item{align-self:start}


/* Legacy long-work layout: structural only. */
.bmag-long-grid{
  display:grid;
  grid-template-columns:repeat(var(--bmag-long-cols,4),minmax(0,1fr));
  gap:0;
  align-items:start;
}
.bmag-long-item{
  display:block;
  min-width:0;
  margin:0;
  padding:0;
  border:0;
  background:transparent;
  text-decoration:none!important;
  box-sizing:border-box;
  line-height:0;
  overflow:hidden;
}
.bmag-long-item img{display:block;width:100%;height:auto;max-width:100%;margin:0!important}
.bmag-long-item:focus-visible{outline:2px solid currentColor;outline-offset:3px}
.bmag-long-viewall{margin:14px 0 2px;text-align:right}
.bmag-long-viewall a{text-decoration:none}
.bmag-long-note{margin:2px 0 0;text-align:right;font-size:.9em;color:#777}

/* v0.6.1: short-work pagination matches the illustration pagination. */
.bmag-shorts .bmag-short-pagination{
  display:flex;
  justify-content:flex-start;
  align-items:center;
  gap:2px;
  margin:0 0 16px;
  min-height:32px;
}
.bmag-shorts .bmag-short-pagination:empty{
  min-height:32px;
  margin:0 0 16px;
}
.bmag-shorts .bmag-short-page{
  font:inherit;
  font-size:12px;
  min-width:28px;
  min-height:28px;
  padding:0 5px;
  border:0;
  border-radius:3px;
  background:transparent;
  color:#777;
  cursor:pointer;
}
.bmag-shorts .bmag-short-page[aria-current="page"]{
  background:#eee;
  color:#222;
  font-weight:700;
  border:0;
}

/* v0.7.0: reusable direct-link gallery aliases. */
.bmag-direct-grid{align-items:start}
.bmag-direct-item{align-self:start}
.bmag-paged > .bmag-pagination{
  display:flex;
  justify-content:flex-start;
  align-items:center;
  gap:2px;
  margin:0 0 16px;
  min-height:32px;
}
.bmag-paged > .bmag-pagination:empty{min-height:32px;margin:0 0 16px}


/* v0.7.2: compact visitor-selectable page size. */
.bmag-page-size{
  display:flex;
  align-items:center;
  gap:5px;
  width:max-content;
  margin:0 0 6px;
  font-size:12px;
  color:#777;
}
.bmag-page-size-label{white-space:nowrap}
.bmag-page-size-select{
  font:inherit;
  color:#555;
  background:#fff;
  border:1px solid #ccc;
  border-radius:4px;
  padding:3px 22px 3px 7px;
  min-height:28px;
}
.bmag-page-size-select:focus-visible{outline:2px solid currentColor;outline-offset:2px}


/* v0.8.0: structural thumbnail rules only. Visual styling lives in the child theme. */
.bmag-short-grid,
.bmag-direct-grid{
  margin:0;
  padding:0;
  line-height:0;
}
.bmag-short-item,
.bmag-direct-item{
  display:block;
  min-width:0;
  margin:0;
  padding:0;
  border:0;
  background:transparent;
  line-height:0;
  font-size:0;
  overflow:hidden;
  text-decoration:none!important;
  box-sizing:border-box;
  align-self:start;
}
.bmag-short-item img,
.bmag-direct-item img{
  display:block;
  width:100%;
  height:auto;
  max-width:100%;
  margin:0!important;
  padding:0;
  vertical-align:top;
}

/* Optional article metadata on listing cards (homepage use). */
.bmag-listing-card{min-width:0;display:flex;flex-direction:column;gap:0}
.bmag-listing-card>.bmag-item{width:100%;min-width:0}
.bmag-listing-details{display:flex;flex-direction:column;gap:3px;padding:5px 2px 2px;min-width:0}
.bmag-listing-date{font-size:11px;color:#777;line-height:1.3}
.bmag-listing-title{font-size:13px;line-height:1.45;overflow-wrap:anywhere;text-align:left}

/* v0.8.12: listing-only cards with clear per-work grouping. */
.bmag.bmag-listing{column-gap:14px;row-gap:20px;align-items:stretch}
.bmag-listing .bmag-listing-card{display:flex;flex-direction:column;min-width:0;background:#fff;border:1px solid #e3e3e3;box-sizing:border-box}
.bmag-listing .bmag-listing-card>.bmag-item{display:block;flex:0 0 auto;min-width:0}
.bmag-listing .bmag-listing-card>.bmag-item img{display:block;width:100%;height:auto;margin:0!important}
.bmag-listing .bmag-listing-details{display:flex;flex-direction:column;gap:4px;padding:8px 9px 11px;min-width:0;align-items:flex-start}
.bmag-listing .bmag-listing-date{font-size:11px;line-height:1.4;color:#777}
.bmag-listing .bmag-listing-title{font-size:13px;line-height:1.5;overflow-wrap:anywhere;text-decoration:underline;text-underline-offset:2px;color:inherit}
@media(max-width:640px){.bmag.bmag-listing{column-gap:8px;row-gap:12px}.bmag-listing .bmag-listing-details{padding:6px 6px 9px}}

/* v0.8.14: original-aspect-ratio, row-aligned art and listing galleries.
   Direct/short/long thumbnail grids are deliberately untouched. */
.bmag.bmag-justified,
.bmag-tabs .bmag.bmag-justified {
  display:flex;flex-wrap:wrap;align-content:flex-start;align-items:flex-start;
  column-gap:8px;row-gap:8px;aspect-ratio:auto;grid-template-rows:none;
}
.bmag.bmag-justified > .bmag-item,
.bmag.bmag-justified > .bmag-listing-card,
.bmag-tabs .bmag.bmag-justified > .bmag-item {
  box-sizing:border-box;flex:0 0 auto;min-width:0;max-width:100%;
  width:var(--bmag-row-width,auto);height:auto;
}
.bmag.bmag-justified > .bmag-item img,
.bmag-tabs .bmag.bmag-justified > .bmag-item img {
  width:100%;height:var(--bmag-row-height,auto);max-width:100%;max-height:none;
  object-fit:contain;object-position:center;
}
.bmag.bmag-listing.bmag-justified {column-gap:12px;row-gap:20px;align-items:stretch}
.bmag.bmag-listing.bmag-justified > .bmag-listing-card {
  box-shadow:0 2px 5px rgba(0,0,0,.14);
}
.bmag.bmag-listing.bmag-justified .bmag-listing-card > .bmag-item img {
  width:100%;height:var(--bmag-row-height,auto);object-fit:contain;
}
@media(max-width:640px){.bmag.bmag-justified,.bmag-tabs .bmag.bmag-justified{column-gap:5px;row-gap:6px}.bmag.bmag-listing.bmag-justified{column-gap:8px;row-gap:12px}}
