.bm-gallery,
.bm-gallery-viewer {
  --gallery-accent: var(--brand-lilac, #d7b8ff);
  --gallery-cream: #f5f2ed;
  --gallery-muted: #adaba8;
  --gallery-type: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  color: var(--gallery-cream);
}

.bm-gallery {
  padding: clamp(3.35rem, 3.9vw, 4.6rem) 0 clamp(4rem, 6vw, 6.5rem);
  background: #0d0d0e;
  scroll-margin-top: 0;
}

.bm-gallery *,
.bm-gallery-viewer * {
  box-sizing: border-box;
}

.bm-gallery-wrap {
  width: min(calc(100% - var(--gutter) * 2), var(--content));
  margin: 0 auto;
}

.bm-gallery-kicker {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: var(--gallery-accent);
  font: 600 .72rem/1.3 "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: .13em;
}

.bm-gallery-kicker::before {
  content: "";
  width: 1.55rem;
  height: 2px;
  background: var(--gallery-accent);
}

.bm-gallery-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  margin: .65rem 0 1.9rem;
}

.bm-gallery-heading h2,
.bm-gallery-view-content h2 {
  margin: 0;
  color: var(--gallery-cream);
  font: 800 clamp(2.55rem, 4.3vw, 4.4rem)/.96 var(--gallery-type);
  letter-spacing: -.025em;
}

.bm-gallery-heading h2 span,
.bm-gallery-view-content h2 span {
  color: var(--gallery-accent);
}

.bm-gallery-hint,
.bm-gallery-flip {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--gallery-muted);
  font-size: .875rem;
}

.bm-gallery-hint {
  padding-bottom: .2rem;
}

.bm-gallery-hint svg,
.bm-gallery-flip svg {
  width: 1.3rem;
  height: 1.3rem;
  color: var(--gallery-accent);
}

.bm-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(.8rem, 1.6vw, 1.4rem);
}

.bm-gallery-item,
.bm-gallery-viewer {
  --stage-tint: 125, 134, 147;
  --stage-base: #191a1c;
  --card-edge: #7c8187;
}

.bm-gallery-item[data-finish="purple"],
.bm-gallery-viewer[data-finish="purple"] {
  --stage-tint: 151, 102, 197;
  --stage-base: #221b2b;
  --card-edge: #957bae;
}

.bm-gallery-item[data-finish="black"],
.bm-gallery-viewer[data-finish="black"] {
  --stage-tint: 92, 99, 111;
  --stage-base: #1a1b1d;
  --card-edge: #575b61;
}

.bm-gallery-item[data-finish="gold"],
.bm-gallery-viewer[data-finish="gold"] {
  --stage-tint: 191, 159, 87;
  --stage-base: #26221a;
  --card-edge: #b49c61;
}

.bm-gallery-item {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #343333;
  border-radius: .9rem;
  background: #151515;
  transition: border-color .25s ease;
}

.bm-gallery-item:focus-within {
  border-color: #876b9e;
}

.bm-gallery-stage,
.bm-gallery-view-stage {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.bm-gallery-stage {
  aspect-ratio: 1.52;
  padding: 1.4rem 0;
  border-bottom: 1px solid #ffffff0a;
  background:
    radial-gradient(ellipse at 34% 10%, rgba(var(--stage-tint), .15), transparent 72%),
    linear-gradient(145deg, var(--stage-base) 0%, #151515 100%);
}

.bm-gallery-expand,
.bm-gallery-icon-button {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: .55rem;
  border: 1px solid #ffffff22;
  background: #181819cd;
  border-radius: 50%;
  color: #e3e1df;
  cursor: pointer;
}

.bm-gallery-expand {
  position: absolute;
  right: .6rem;
  top: .6rem;
  z-index: 1;
  width: 1.85rem;
  height: 1.85rem;
  padding: .36rem;
}

.bm-gallery-card {
  position: relative;
  display: block;
  width: 81%;
  aspect-ratio: 1.586;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: .7rem;
  background: transparent;
  color: #fff;
  font: inherit;
  text-align: left;
  perspective: 1400px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
  container-type: inline-size;
}

.bm-gallery-card::before {
  content: "";
  position: absolute;
  inset: 15% 4% -3%;
  border-radius: 14%;
  background: #0009;
  transform: translate(1%, 6%) rotate(-4deg);
  filter: blur(.65rem);
  pointer-events: none;
}

.bm-gallery-card.is-dragging {
  cursor: grabbing;
}

.bm-gallery-rotor,
.bm-gallery-face {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 4.25% / 6.75%;
}

.bm-gallery-rotor {
  --half-thickness: clamp(1px, .44cqw, 2.55px);
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.16,.79,.27,1);
  pointer-events: none;
}

.bm-gallery-card.is-dragging .bm-gallery-rotor {
  transition: none;
}

.bm-gallery-face {
  --bm-laser-ink: #e9e6df;
  --bm-laser-shadow: 0 -.4px .38px #18151c91, 0 .35px .32px #fff3;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid #ffffff57;
}

.bm-gallery-front {
  --gallery-type: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  box-sizing: border-box;
  container-type: inline-size;
  text-align: left;
  color: #fcfaf5;
  letter-spacing: normal;
  line-height: 1;
  transform: translateZ(var(--half-thickness, 0px));
}

.bm-gallery-edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--card-edge);
  transform-style: preserve-3d;
}

.bm-gallery-edge::before,
.bm-gallery-edge::after {
  content: "";
  position: absolute;
  top: 6.65%;
  bottom: 6.65%;
  width: calc(var(--half-thickness) * 2);
  transform: rotateY(90deg);
  background: linear-gradient(90deg, #181817, var(--card-edge) 36%, #d3c9b8 66%, var(--card-edge));
}

.bm-gallery-edge::before { left: calc(var(--half-thickness) * -1); }
.bm-gallery-edge::after { right: calc(var(--half-thickness) * -1); }

.bm-gallery-brand {
  position: absolute;
  top: 12%;
  left: 7%;
  display: flex;
  align-items: center;
  gap: 1.05cqw;
}

.bm-face-mark {
  display: block;
  width: 5.6cqw;
  height: 5.6cqw;
}

.bm-gallery-brand b {
  font: italic 700 5.35cqw/.95 var(--sans, Arial, sans-serif);
  letter-spacing: -.065em;
  text-transform: none;
}

.bm-gallery-contact {
  position: absolute;
  right: 7%;
  top: 14%;
  width: 6.5%;
  opacity: .87;
}

.bm-gallery-contact svg,
.bm-gallery-expand svg,
.bm-gallery-icon-button svg {
  display: block;
  width: 100%;
  height: 100%;
}

.bm-gallery-chip {
  position: absolute;
  top: 45%;
  left: 7.35%;
  width: 14.8%;
  border-radius: 11.3% / 15%;
  box-shadow: 0 -.45px .55px #171310b0, 0 .7px .65px #fffae89e;
}

.bm-gallery-chip img {
  display: block;
  width: 100%;
  height: auto;
}

.bm-face-holder,
.bm-gallery-credit,
.bm-gallery-rear-tier,
.bm-gallery-rear-label {
  position: absolute;
  color: var(--bm-laser-ink);
  text-shadow: var(--bm-laser-shadow);
}

.bm-face-holder {
  left: 7.4%;
  bottom: 10.5%;
  max-width: 68%;
  display: grid;
  gap: 1.05cqw;
}

.bm-face-holder-label {
  font: 600 1.85cqw/1 var(--sans, Arial, sans-serif);
  letter-spacing: .18em;
  opacity: .81;
}

.bm-face-holder-name {
  font: 500 var(--bm-holder-size, 4.2cqw)/1.12 Consolas, 'SFMono-Regular', 'Liberation Mono', monospace;
  letter-spacing: .08em;
  white-space: nowrap;
}

.bm-gallery-credit {
  right: 7.2%;
  bottom: 10%;
  display: grid;
  justify-items: end;
  gap: .9cqw;
  font: 650 1.7cqw/1 var(--sans, Arial, sans-serif);
  text-transform: uppercase;
  letter-spacing: .09em;
}
.bm-gallery-credit svg { display: block; width: 15cqw; height: 5cqw; }

.bm-gallery-back {
  container-type: inline-size;
  text-align: left;
  letter-spacing: normal;
  transform: rotateY(180deg) translateZ(var(--half-thickness, 1px));
}

.bm-gallery-stripe {
  position: absolute;
  left: 0;
  right: 0;
  top: 16%;
  height: 21%;
  background:
    repeating-linear-gradient(0deg, transparent 0 1.4px, #c2c1bc09 1.5px 1.9px),
    linear-gradient(105deg, #101012 8%, #302f31 42%, #171719 75%);
  box-shadow: inset 0 1px #4948494d, 0 .4px #ffffff60;
}

.bm-gallery-rear-tier,
.bm-gallery-rear-label {
  font: 550 2.5cqw/1 Consolas, "SFMono-Regular", monospace;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.bm-gallery-rear-tier { top: 5%; left: 7.2%; }
.bm-gallery-rear-label { right: 7.2%; bottom: 11%; font: italic 850 4.7cqw/1 var(--sans, Arial, sans-serif); letter-spacing: -.055em; }

.bm-gallery-rear-tier b {
  font: italic 700 3.15cqw/1 var(--sans, Arial, sans-serif);
  letter-spacing: -.055em;
  text-transform: none;
}

.bm-gallery-back-fields {
  position: absolute;
  top: 43%;
  left: 7.2%;
  right: 7.2%;
  display: grid;
  gap: 3.9cqw;
  color: var(--bm-laser-ink);
  text-shadow: var(--bm-laser-shadow);
}
.bm-gallery-back-fields small {
  display: block;
  margin-bottom: .95cqw;
  font: 650 2.45cqw/1 var(--sans, Arial, sans-serif);
  text-transform: uppercase;
  letter-spacing: .1em;
}
.bm-gallery-back-fields strong {
  display: block;
  white-space: pre;
  font: 550 4.1cqw/1 Consolas, "SFMono-Regular", "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: .06em;
}
.bm-gallery-pan strong {font-size:5.9cqw; word-spacing:.29em; letter-spacing:.045em;}
.bm-gallery-back-meta {display:flex; align-items:start; gap:9.5cqw;}

.bm-gallery-back-mark {
  position: absolute;
  right: 7.2%;
  top: 3.9%;
  width: 4.4%;
}

.bm-gallery-back-mark .bm-face-mark {
  width: 100%;
  height: auto;
  aspect-ratio: 62 / 56;
}

.bm-gallery-face:is([data-finish="gold"], [data-finish="silver"]) {
  --bm-laser-ink: #302e2a;
  --bm-laser-shadow: 0 .45px .35px #fff8, 0 -.25px .25px #0002;
}

.bm-gallery-face .bm-gallery-contact { color: var(--bm-laser-ink); }

.bm-gallery-details {
  padding: 1.1rem clamp(1rem, 2vw, 1.65rem) 1.4rem;
}

.bm-gallery-details h3 {
  margin: 0;
  color: var(--gallery-cream);
  font: 700 2rem/1 var(--gallery-type);
  letter-spacing: .005em;
  text-transform: uppercase;
}

.bm-gallery-rank {
  margin: .5rem 0 .85rem;
  padding-bottom: .9rem;
  border-bottom: 1px solid #ffffff16;
  color: #c5c2bc;
  font: 500 .84rem/1.4 var(--sans, Arial, sans-serif);
}

.bm-gallery-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin: 0;
}

.bm-gallery-stats div + div {
  padding-left: .85rem;
  border-left: 1px solid #ffffff1c;
}

.bm-gallery-stats dt {
  margin-bottom: .36rem;
  color: var(--gallery-muted);
  font-size: .78rem;
  line-height: 1.4;
}

.bm-gallery-stats dd {
  margin: 0;
  color: var(--gallery-cream);
  font: 600 1.07rem/1.2 "Inter", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.045em;
}

.bm-gallery-choose {
  display: block;
  width: 100%;
  margin-top: 1.4rem;
  padding: .7rem .9rem;
  border: 1px solid #474541;
  border-radius: .4rem;
  background: transparent;
  color: var(--gallery-cream);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}

.bm-gallery button:focus-visible,
.bm-gallery-viewer button:focus-visible {
  outline: 2px solid var(--gallery-accent);
  outline-offset: 3px;
}

body:has(.bm-gallery-viewer[open]) {
  overflow: hidden;
}

.bm-gallery-viewer {
  position: fixed;
  inset: 0;
  width: min(95vw, 63rem);
  max-width: 95vw;
  max-height: 92dvh;
  margin: auto;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #55504e;
  border-radius: 1.1rem;
  background: #141414;
}

.bm-gallery-viewer:not([open]) { display: none; }

.bm-gallery-viewer::backdrop {
  background: #070707cf;
  backdrop-filter: blur(7px);
}

.bm-gallery-view-surface {
  padding: clamp(1.15rem, 4vw, 2rem);
  background: radial-gradient(ellipse at 72% 23%, rgba(var(--stage-tint),.14), transparent 56%), #141414;
}

.bm-gallery-view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bm-gallery-view-content h2 {
  margin-top: .15rem;
  font-size: clamp(2.9rem, 5vw, 4rem);
  text-transform: uppercase;
}

.bm-gallery-view-stage {
  width: 100%;
  margin-top: .85rem;
  aspect-ratio: 1.6;
  border-radius: .75rem;
  background: radial-gradient(ellipse at 50% 40%, rgba(var(--stage-tint),.09), transparent 75%), #111112;
}

.bm-gallery-view-stage .bm-gallery-card {
  width: 84%;
}

.bm-gallery-macro {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #ffffff21;
  border-radius: inherit;
  background: #0e0e0e;
}

.bm-gallery-macro .bm-gallery-macro-sheet {
  position: absolute;
  top: 50%;
  left: -3%;
  width: 304%;
  aspect-ratio: 1.586;
  transform: translateY(-54%) rotate(-6deg);
  transform-origin: 15% 54%;
}

.bm-gallery-macro:not([hidden]) .bm-gallery-macro-sheet {
  animation: bm-gallery-reveal-detail .38s cubic-bezier(.2,.72,.28,1) both;
}

@keyframes bm-gallery-reveal-detail {
  from { opacity: .3; transform: translateY(-54%) rotate(-5deg) scale(.96); }
  to { opacity: 1; transform: translateY(-54%) rotate(-6deg) scale(1); }
}

.bm-gallery-view-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .8rem 0 1.3rem;
}

.bm-gallery-flip,
.bm-gallery-zoom {
  padding: .4rem .65rem;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  width: fit-content;
  min-height: 2.5rem;
  border: 1px solid #ffffff21;
  border-radius: .4rem;
  background: transparent;
  color: var(--gallery-cream);
  cursor: pointer;
  font: 550 .84rem/1.2 var(--sans, Arial, sans-serif);
}

.bm-gallery-zoom svg {
  width: 1.2rem;
  height: 1.2rem;
  color: var(--gallery-accent);
}

.bm-gallery-zoom[aria-expanded="true"] .bm-gallery-zoom-plus { visibility: hidden; }

.bm-gallery-view-content .bm-gallery-stats {
  padding: .1rem 0 0;
}

.bm-preview-name {
  display: grid;
  gap: .35rem;
  margin: 0 0 1rem;
  font-size: .82rem;
  color: var(--gallery-muted);
}

.bm-preview-name input {
  min-width: 0;
  width: 100%;
  padding: .62rem .72rem;
  color: var(--gallery-cream);
  background: #ffffff05;
  border: 1px solid #ffffff29;
  border-radius: .4rem;
  font: 500 1rem/1.25 var(--sans, Arial, sans-serif);
}
.bm-preview-name input::placeholder { color: #9c9a96; }
.bm-preview-name input:focus-visible { outline: 2px solid var(--gallery-accent); outline-offset: 2px; }

.bm-gallery-view-content .bm-gallery-choose {
  background: var(--brand-action, #7943b7);
  color: #fff;
  border-color: var(--brand-purple, #975ae0);
}

.bm-gallery-models {
  min-width: 0;
  padding: 0;
  margin: 0 0 .7rem;
  border: 0;
}

.bm-gallery-models legend {
  margin-bottom: .5rem;
  padding: 0;
  color: var(--gallery-muted);
  font-size: .83rem;
}

.bm-gallery-samples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .38rem;
}

.bm-gallery-samples label {
  position: relative;
  display: block;
  cursor: pointer;
}

.bm-gallery-samples input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.bm-gallery-samples label > span {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-height: 2.55rem;
  padding: .45rem .65rem;
  border: 1px solid #ffffff21;
  border-radius: .4rem;
  background: #ffffff03;
  color: var(--gallery-muted);
  font: 550 .9rem/1.2 var(--sans, Arial, sans-serif);
}

.bm-gallery-samples i {
  display: block;
  flex: 0 0 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid #ffffff52;
  background: linear-gradient(135deg, #fff5, transparent 51%, #0002), var(--chip-color);
}

.bm-gallery-samples input:checked + span {
  color: var(--gallery-cream);
  border-color: #c4c0b6;
  background: #ffffff09;
}

.bm-gallery-samples input:focus-visible + span {
  outline: 2px solid var(--gallery-accent);
  outline-offset: 2px;
}

.bm-gallery-view-content h2 b { font: inherit; }

@media (hover: hover) {
  .bm-gallery-samples label:hover > span { color: var(--gallery-cream); background: #ffffff0b; }
  .bm-gallery-item:hover { border-color: #65546f; }
  .bm-gallery-expand:hover,
  .bm-gallery-icon-button:hover { background: #35293d; }
  .bm-gallery-choose:hover { border-color: var(--gallery-accent); color: var(--gallery-accent); }
  .bm-gallery-view-content .bm-gallery-choose:hover { background: var(--brand-action-hover, #6e36a9); color: #fff; }
  .bm-gallery-flip:hover,
  .bm-gallery-zoom:hover { color: #fff; border-color: #ffffff56; }
}

@media (min-width: 800px) {
  .bm-gallery-view-content {
    display: grid;
    grid-template-columns: minmax(0, 1.95fr) minmax(13.2rem, .85fr);
    grid-template-areas: "title title" "piece info" "tools info";
    column-gap: clamp(1rem, 2.7vw, 2.2rem);
  }
  .bm-gallery-view-content h2 { grid-area: title; }
  .bm-gallery-view-stage { grid-area: piece; }
  .bm-gallery-view-tools { grid-area: tools; margin-bottom: 0; }
  .bm-gallery-view-info { grid-area: info; align-self: center; }
}

@media (min-width: 701px) and (max-width: 799px) {
  .bm-gallery-viewer { width: min(92vw, 38rem); }
}

@media (min-width: 701px) and (max-width: 1120px) {
  .bm-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .bm-gallery-wrap { width: calc(100% - var(--gutter) * 2); }
  .bm-gallery-grid { gap: .65rem; }
  .bm-gallery-stats dt { font-size: .73rem; }
  .bm-gallery-details { padding: 1rem .85rem; }
}

@media (max-width: 700px) {
  .bm-gallery { padding: 3.6rem 0; }
  .bm-gallery-heading { flex-direction: column; align-items: flex-start; gap: .85rem; margin-bottom: 1.4rem; }
  .bm-gallery-grid { grid-template-columns: 1fr; gap: 1rem; }
  .bm-gallery-wrap { width: min(calc(100% - 2.5rem), 34rem); }
  .bm-gallery-stage { aspect-ratio: 1.62; }
  .bm-gallery-card { width: 79%; }
  .bm-gallery-expand { width: 2.35rem; height: 2.35rem; padding: .55rem; }
  .bm-gallery-samples label > span { min-height: 2.75rem; }
  .bm-gallery-details { padding: 1.25rem; }
  .bm-gallery-hint { font-size: .83rem; }
  .bm-gallery-stats dt { font-size: .85rem; }
  .bm-gallery-choose { min-height: 2.8rem; }
  .bm-gallery-viewer { border-radius: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bm-gallery-macro:not([hidden]) .bm-gallery-macro-sheet { animation: none; }
  .bm-gallery-rotor,
  .bm-gallery-item,
  .bm-gallery-choose { transition: none; }
}

.bm-gallery-perks{list-style:none;margin:14px 0 18px;padding:14px 0 0;border-top:1px solid rgba(255,255,255,.08);display:grid;gap:8px;font-size:13px;line-height:1.45;color:rgba(244,244,246,.82)}
.bm-gallery-perks li{position:relative;padding-left:16px}
.bm-gallery-perks li::before{content:"";position:absolute;left:0;top:.52em;width:5px;height:5px;border-radius:999px;background:rgba(255,255,255,.45)}
