/**
 * Ministry of Board Games — Library / Theme Bridge v1.1.0
 * Theme owns layouts; plugin owns dynamic contents of the documented slots.
 * Values refer to theme.json tokens, so Site Editor colour changes propagate.
 */
:root {
  --bgml-navy: var(--wp--preset--color--navy, #031441);
  --bgml-ink: var(--wp--preset--color--ink, #141B33);
  --bgml-muted: var(--wp--preset--color--muted, #4A5372);
  --bgml-line: var(--wp--preset--color--line, #D8D3C4);
  --bgml-paper: var(--wp--preset--color--paper, #FFFDF8);
  --bgml-parchment: var(--wp--preset--color--parchment, #F7F3EA);
  --bgml-thistle: var(--wp--preset--color--thistle, #6B3FA0);
  --bgml-thistle-tint: var(--wp--preset--color--thistle-50, #F2ECF9);
  --bgml-cone: var(--wp--preset--color--cone, #C2410C);
  --bgml-tartan: var(--wp--preset--color--tartan, #17694D);
  --bgml-font-heading: var(--wp--preset--font-family--heading, Tagesschrift, Georgia, serif);
  --bgml-font-body: var(--wp--preset--font-family--body, Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif);
  --bgml-font-ui: var(--wp--preset--font-family--ui, Inter, system-ui, sans-serif);
  --bgml-ease: var(--wp--custom--transition, 180ms cubic-bezier(.2,.7,.3,1));
}
/* Cards: same frame and layout as the theme; keep text on every card legible. */
.mobg-card--game .mobg-card__frame {
  background: var(--bgml-thistle-tint);
}
.mobg-card--game .mobg-card__frame .wp-block-post-featured-image img,
.bgml-theme-card__image {
  object-fit: contain !important;
  object-position: center;
}
.mobg-card--game .mobg-card__frame .wp-block-post-featured-image:has(img) {
  background: var(--bgml-thistle-tint);
}
.mobg-card--game .mobg-card__frame .wp-block-post-featured-image img {
  padding: .65rem;
}
.bgml-theme-card__meta {
  display: flex;
  align-items: center;
  gap: .35rem .8rem;
  flex-wrap: wrap;
  color: var(--bgml-muted);
  font: 650 .78rem/1.5 var(--bgml-font-ui);
}
.bgml-theme-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.bgml-theme-card__meta span + span::before {
  content: '';
  display: inline-block;
  width: .34em;
  height: .34em;
  background: var(--bgml-thistle);
  margin-right: .3rem;
}
.bgml-theme-card__category,
.bgml-theme-card__rating {
  color: var(--bgml-thistle);
}
.bgml-theme-card__cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.bgml-theme-card__cover:focus-visible {
  outline: 3px solid var(--bgml-navy);
  outline-offset: -5px;
}
.bgml-theme-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: .8rem;
}
.bgml-theme-card .mobg-card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.bgml-theme-card .mobg-card__link {
  margin-top: auto !important;
}
/* Single: preserve printed covers even at narrow viewports. */
.mobg-single--game .mobg-single__media,
.mobg-single--game .mobg-card__frame {
  background: var(--bgml-thistle-tint);
}
.mobg-single--game .mobg-single__media .wp-block-post-featured-image img {
  width: 100%;
  height: 100% !important;
  object-fit: contain !important;
  padding: clamp(.75rem, 2vw, 1.7rem);
}
/* Heading font is Tagesschrift; body and controls are Inter Medium. */
.bgml-theme-section,
.bgml-theme-discover,
.bgml-theme-details,
.bgml-theme-file,
.bgml-theme-account,
.bgml-theme-interest {
  color: var(--bgml-ink);
  font-family: var(--bgml-font-body);
}
.bgml-theme-section h2,
.bgml-theme-discover h2,
.bgml-theme-details h3,
.bgml-theme-file h3,
.bgml-auth-dialog h2 {
  margin-top: 0;
  color: var(--bgml-navy);
  font-family: var(--bgml-font-heading);
  font-weight: 400;
  line-height: 1.18;
}
.bgml-theme-section h2 { font-size: clamp(1.9rem, 2.6vw, 2.75rem); }
.bgml-theme-details h3,
.bgml-theme-file h3 { font-size: clamp(1.3rem, 2vw, 1.7rem); }
.bgml-theme-eyebrow {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0 0 .8rem;
  font: 750 .76rem/1.45 var(--bgml-font-ui);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--bgml-thistle);
}
.bgml-theme-edition {
  margin: .4rem 0 1rem;
  color: var(--bgml-muted);
  font: 600 .85rem var(--bgml-font-ui);
}
/* Factual panels and BGG metrics: restrained, editorial and clearly sourced. */
.mobg-slot .bgml-facts,
.mobg-slot .bgml-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
  margin: 1rem 0;
  padding: 0;
}
.mobg-slot .bgml-facts > div {
  padding: 1rem;
  border: 1px solid var(--bgml-line);
  border-radius: 0;
  background: var(--bgml-paper);
}
.mobg-slot .bgml-facts dt,
.mobg-slot .bgml-metric__label,
.mobg-slot .bgml-metric__detail,
.mobg-slot .bgml-provenance {
  display: block;
  margin-bottom: .25rem;
  color: var(--bgml-muted);
  font: 650 .76rem/1.5 var(--bgml-font-ui);
}
.mobg-slot .bgml-facts dt .bgml-icon { width: 16px; height: 16px; }
.mobg-slot .bgml-facts dd {
  margin: 0;
  color: var(--bgml-navy);
  font: 750 clamp(1rem, 1.4vw, 1.12rem)/1.35 var(--bgml-font-ui);
}
.mobg-slot .bgml-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mobg-slot .bgml-metric {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  border: 1px solid var(--bgml-line);
  border-top: 3px solid var(--bgml-thistle);
  padding: 1rem;
  border-radius: 0;
  background: var(--bgml-thistle-tint);
}
.mobg-slot .bgml-metric > div { min-width: 0; }
.mobg-slot .bgml-metric strong {
  display: block;
  color: var(--bgml-navy);
  font: 750 clamp(1.3rem, 2.3vw, 1.75rem)/1.3 var(--bgml-font-ui);
}
.mobg-slot .bgml-metric strong small { font-size: .65em; font-weight: 500; }
.mobg-slot .bgml-metric a,
.mobg-slot .bgml-theme-details a {
  color: var(--bgml-thistle);
  font: 700 .79rem/1.4 var(--bgml-font-ui);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.mobg-slot .bgml-metric > .bgml-icon,
.mobg-slot .bgml-difficulty-icon { width: 38px; height: 38px; object-fit: contain; flex: 0 0 auto; }
/* Primary CTA: cone is reserved for actions; square, minimum 44px. */
.mobg-slot .bgml-button,
.bgml-auth-dialog .bgml-button,
.bgml-theme-account .bgml-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 48px;
  border: 2px solid var(--bgml-navy);
  border-radius: 0 !important;
  padding: .75rem 1.4rem;
  font: 750 .92rem/1.4 var(--bgml-font-ui);
  color: #fff !important;
  background: var(--bgml-navy);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}
.mobg-slot .bgml-button:hover,
.bgml-auth-dialog .bgml-button:hover { background: var(--wp--preset--color--navy-700, #1B2B5E); transform: translateY(-2px); }
.mobg-slot .bgml-button--outline,
.bgml-auth-dialog .bgml-button--outline {
  color: var(--bgml-navy) !important;
  border-color: var(--bgml-navy);
  background: transparent;
}
.mobg-slot .bgml-button--outline:hover,
.bgml-auth-dialog .bgml-button--outline:hover { background: var(--bgml-thistle-tint); }
.mobg-slot--game-interest,
.mobg-slot--game-interest .bgml-theme-interest { width: 100%; max-width: 410px; }
.mobg-slot--game-interest { margin: .5rem 0 !important; }
.bgml-theme-interest .bgml-interest-btn {
  width: 100%;
  min-height: 56px;
  background: var(--bgml-cone);
  border-color: var(--bgml-cone);
}
.bgml-theme-interest .bgml-interest-btn:hover { background: #9C320B; border-color: #9C320B; }
.bgml-theme-interest .bgml-interest-btn[aria-pressed='true'] {
  background: var(--bgml-tartan);
  border-color: var(--bgml-tartan);
  color: #fff !important;
}
.bgml-theme-interest .bgml-interest-count {
  margin: .55rem 0 0;
  text-align: left;
  font: 600 .75rem var(--bgml-font-ui);
  color: var(--bgml-muted);
}
.mobg-slot .bgml-provenance { margin: .7rem 0 0; }
/* Editorial sections are laid out by the theme's 64/36 split. */
.bgml-theme-section {
  padding: clamp(1.5rem, 3vw, 2.6rem) 0;
  border-bottom: 1px solid var(--bgml-line);
}
.bgml-theme-section:first-child { padding-top: 0; }
.bgml-theme-section p,
.bgml-theme-section li {
  color: var(--bgml-ink);
  font-family: var(--bgml-font-body);
  font-size: clamp(1.0625rem, 1.2vw, 1.125rem);
  line-height: 1.72;
}
.bgml-theme-section p:last-child { margin-bottom: 0; }
.bgml-theme-reading { max-width: 760px; }
.bgml-theme-official h2::after,
.bgml-theme-verdict h2::after {
  content: '';
  display: block;
  width: 64px;
  height: 3px;
  margin-top: 1rem;
  background: var(--bgml-thistle);
}
.bgml-theme-verdict {
  padding: clamp(1.5rem, 3vw, 2rem);
  margin: 1.3rem 0;
  background: var(--bgml-thistle-tint);
  border-left: 5px solid var(--bgml-thistle);
  border-bottom: 0;
  border-radius: 0;
}
.bgml-theme-rules {
  margin: 1.5rem 0;
  padding: clamp(1.25rem, 2.6vw, 2rem);
  border: 2px solid var(--bgml-navy);
  border-radius: 0;
  background: var(--bgml-paper);
  box-shadow: var(--wp--preset--shadow--stamp, 6px 6px 0 #031441);
}
.bgml-theme-rules .bgml-button { margin-top: .5rem; }
.bgml-theme-file,
.bgml-theme-details { width: 100%; }
.bgml-theme-file h3,
.bgml-theme-details h3 { margin-bottom: 1rem; }
.bgml-theme-file p { margin: .45rem 0; }
.bgml-theme-file .bgml-caption {
  color: var(--bgml-muted);
  font: 500 .78rem/1.6 var(--bgml-font-ui);
}
.bgml-theme-file .bgml-views {
  margin-top: 1rem;
  padding-top: .8rem;
  border-top: 1px dashed var(--bgml-line);
  font: 650 .78rem/1.7 var(--bgml-font-ui);
  color: var(--bgml-muted);
}
.bgml-theme-details dl { margin: 0; }
.bgml-theme-details dl > div { padding: .6rem 0; border-bottom: 1px solid var(--bgml-line); }
.bgml-theme-details dt {
  margin-bottom: .2rem;
  color: var(--bgml-muted);
  font: 700 .74rem var(--bgml-font-ui);
  text-transform: uppercase;
  letter-spacing: .065em;
}
.bgml-theme-details dd { margin: 0; color: var(--bgml-ink); line-height: 1.5; overflow-wrap: anywhere; }
/* Video click-to-load and locally hosted gallery photos. */
.bgml-video { position: relative; width: 100%; aspect-ratio: 16/9; overflow: hidden; background: var(--bgml-navy); border-radius: 0; }
.bgml-video iframe { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; }
.bgml-video-load {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; gap: 1.2rem;
  padding: 1.5rem; background: linear-gradient(135deg,#031441,#1B2B5E); color: #fff; border: 0;
  text-align: center; cursor: pointer; font: 750 .96rem var(--bgml-font-ui);
}
.bgml-video-load span { font-size: 2rem; }
.bgml-caption { color: var(--bgml-muted); font: 600 .8rem var(--bgml-font-ui); }
.bgml-gallery { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .75rem; }
.bgml-gallery-item { display: block; aspect-ratio: 4/3; overflow: hidden; border-radius: 0; background: var(--bgml-thistle-tint); }
.bgml-gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 180ms ease; }
.bgml-gallery-item:hover img { transform: scale(1.04); }
.bgml-theme-related { margin-top: 3rem; }
.bgml-theme-related__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; margin-top: 1.25rem; }
.bgml-theme-related__grid .mobg-card { height: 100%; }
.bgml-event-links { display: flex; gap: .6rem; flex-wrap: wrap; }
.bgml-event-links a { display: inline-flex; padding: .75rem 1rem; border: 1px solid var(--bgml-line); color: var(--bgml-navy); text-decoration: none; font: 700 .85rem var(--bgml-font-ui); }
.bgml-event-links a:hover { border-color: var(--bgml-cone); }
/* Archive filter is an actual theme integration slot, never a second page wrapper. */
.bgml-theme-discover { margin-bottom: 2.5rem; }
.bgml-theme-discover__heading {
  display: flex; align-items: end; justify-content: space-between; gap: 1rem 2rem;
  flex-wrap: wrap; margin-bottom: 1.5rem;
}
.bgml-theme-discover__heading h2 { margin-bottom: 0; font-size: clamp(2rem,3vw,2.75rem); }
.bgml-theme-discover__heading > p { max-width: 30ch; margin: 0; color: var(--bgml-muted); }
.bgml-search-form { padding: clamp(1.2rem, 3vw, 2rem); border-radius: 0; border: 1px solid var(--bgml-line); background: var(--bgml-parchment); }
.bgml-search-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .8rem; align-items: end; }
.bgml-search-main { display: block; }
.bgml-search-form label,
.bgml-theme-more-filters summary,
.bgml-theme-account button { font: 700 .83rem/1.45 var(--bgml-font-ui); color: var(--bgml-navy); }
.bgml-search-main span { display: block; margin-bottom: .45rem; }
.bgml-search-form input[type='search'],
.bgml-search-form select {
  display: block; width: 100%; min-height: 48px; background: #fff; color: var(--bgml-ink);
  border: 1px solid #A5A7B6; border-radius: 0; padding: .75rem .8rem;
  font: 500 .91rem var(--bgml-font-ui);
}
.bgml-search-form input[type='search']::placeholder { color: var(--bgml-muted); }
.bgml-theme-more-filters { margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--bgml-line); }
.bgml-theme-more-filters summary { cursor: pointer; list-style: none; width: fit-content; padding: .5rem 0; }
.bgml-theme-more-filters summary::-webkit-details-marker { display: none; }
.bgml-theme-more-filters summary span { display: inline-block; transition: transform 180ms ease; padding-left: .4rem; }
.bgml-theme-more-filters[open] summary span { transform: rotate(180deg); }
.bgml-filters { margin-top: .9rem; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1rem; }
.bgml-filters label:not(.bgml-check-filter) select { margin-top: .4rem; }
.bgml-check-filter { display: flex; grid-column: 1/-1; gap: .65rem; align-items: center; }
.bgml-check-filter input { width: 18px; height: 18px; accent-color: var(--bgml-thistle); }
.bgml-filter-footer { display: flex; align-items: center; justify-content: flex-end; gap: 1.2rem; margin-top: 1.4rem; }
.bgml-filter-footer a { font: 700 .85rem var(--bgml-font-ui); color: var(--bgml-navy); }
/* Dialogs live in native top-layer; not tied to the post-content stacking context. */
.bgml-auth-dialog,
.bgml-lightbox {
  border: 1px solid var(--bgml-line);
  border-radius: 0;
  max-width: min(94vw, 520px);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  background: var(--bgml-paper);
  color: var(--bgml-ink);
  font-family: var(--bgml-font-body);
  box-shadow: 0 22px 70px rgba(3,20,65,.24);
}
.bgml-auth-dialog::backdrop,
.bgml-lightbox::backdrop { background: rgba(3,20,65,.76); }
.bgml-auth-dialog h2 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.bgml-auth-dialog > a { display: flex; margin-top: .75rem; }
.bgml-auth-dialog > a:not(.bgml-button) { font: 700 .88rem var(--bgml-font-ui); }
.bgml-dialog-close { float: right; border: 0; background: transparent; color: var(--bgml-navy); font-size: 2rem; cursor: pointer; }
.bgml-lightbox { max-width: 96vw; max-height: 95vh; padding: 1rem; background: var(--bgml-navy); color: #fff; }
.bgml-lightbox img { display: block; max-width: min(88vw, 1350px); max-height: 85vh; object-fit: contain; margin: auto; }
.bgml-lightbox button { color: #fff; border: 0; background: rgba(255,255,255,.18); border-radius: 0; cursor: pointer; font-size: 2rem; }
.bgml-lightbox-close { position: absolute; right: 1rem; top: .5rem; }
.bgml-lightbox-prev { position: absolute; top: 50%; left: 1rem; }
.bgml-lightbox-next { position: absolute; top: 50%; right: 1rem; }
/* My account's Interested Games area also follows the theme's card language. */
.bgml-theme-account .bgml-shortcode { padding: 0; }
.bgml-theme-account .bgml-shortcode h2 { font-family: var(--bgml-font-heading); color: var(--bgml-navy); }
.bgml-theme-account .bgml-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; }
.bgml-collection-card { display: flex; flex-direction: column; gap: .5rem; }
.bgml-collection-card form { text-align: left; }
.bgml-collection-remove {
  min-height: 44px; padding: .5rem .75rem; border: 1px solid var(--bgml-line); border-radius: 0; background: var(--bgml-paper); color: var(--bgml-navy);
  font: 700 .8rem var(--bgml-font-ui); cursor: pointer;
}
/* Keyboard, responsive and reduced-motion behaviours mirror the theme. */
.mobg-slot :is(a,button,input,select,summary):focus-visible,
.bgml-auth-dialog :is(a,button):focus-visible,
.bgml-lightbox button:focus-visible {
  outline: 3px solid var(--bgml-navy);
  outline-offset: 3px;
}
@media(max-width: 1080px) {
  .bgml-filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .bgml-theme-related__grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width: 782px) {
  .mobg-slot .bgml-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mobg-slot .bgml-metrics { grid-template-columns: 1fr; }
  .bgml-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .bgml-theme-account .bgml-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width: 600px) {
  .bgml-search-row { grid-template-columns: 1fr; }
  .bgml-search-row .bgml-button { width: 100%; }
  .bgml-filters { grid-template-columns: 1fr; }
  .bgml-filter-footer { flex-wrap: wrap; justify-content: space-between; }
  .bgml-gallery { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .bgml-theme-related__grid, .bgml-theme-account .bgml-cards { grid-template-columns: 1fr; }
  .mobg-slot--game-interest,
  .mobg-slot--game-interest .bgml-theme-interest { width: 100%; max-width: none; }
  .mobg-slot .bgml-facts > div { padding: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .bgml-theme-card *, .bgml-gallery-item img, .bgml-theme-more-filters summary span,
  .mobg-slot .bgml-button { transition: none !important; transform: none !important; }
}

/* Unified with the Ministry design system */
.bgml-hub .bgml-cards { margin-bottom: 0; }
.bgml-theme-eyebrow { display: block; }
.bgml, .bgml * { font-weight: 500; }
.bgml strong, .bgml b { font-weight: 700; }
.bgml h1, .bgml h2, .bgml h3, .bgml h4 { font-weight: 400; }
