/* Chat-150 — whole-page Concept A reconciliation, final audited pass.
   This final cascade layer repairs component-to-page geometry and viewport
   overflow while preserving the verified portrait card, rarity-emblem, CTA,
   canon, and motion systems. */

/* The approved 1536×1024 composition uses one compact 60px desktop header. */
@media (min-width: 901px) {
  html:has(body[data-concept-a-integration="comprehensive-v005"]) {
    scroll-padding-top: 68px;
  }

  body[data-concept-a-integration="comprehensive-v005"] .museum-header {
    --reference-nav-brand-row: 57px;
    --reference-nav-band-row: 57px;
    height: 60px;
    min-height: 60px;
    padding: 0 42px;
    border-top: 2px solid rgba(133, 101, 57, .72);
    border-bottom: 1px solid rgba(154, 116, 65, .74);
  }

  body[data-concept-a-integration="comprehensive-v005"] .museum-header-inner {
    grid-template-columns: 292px minmax(0, 1fr) 92px;
    grid-template-rows: 57px;
    align-items: center;
    gap: 0 24px;
    height: 57px;
    min-height: 57px;
  }

  body[data-concept-a-integration="comprehensive-v005"] .museum-header-inner::before,
  body[data-concept-a-integration="comprehensive-v005"] .museum-header-inner::after {
    content: none !important;
    display: none !important;
  }

  body[data-concept-a-integration="comprehensive-v005"] .museum-header .brand,
  body[data-concept-a-integration="comprehensive-v005"] .museum-header-meta {
    grid-row: 1;
  }

  body[data-concept-a-integration="comprehensive-v005"] .reference-navigation-band {
    position: relative;
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    width: 100%;
    height: 57px;
    margin: 0;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  body[data-concept-a-integration="comprehensive-v005"] .reference-navigation-band::before {
    content: none;
    display: none;
  }

  body[data-concept-a-integration="comprehensive-v005"] .reference-navigation-band .museum-primary-nav {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: clamp(38px, 4.8vw, 73px);
    width: 100%;
    height: 57px;
    min-height: 57px;
    padding: 0;
  }

  body[data-concept-a-integration="comprehensive-v005"] .reference-navigation-band .museum-primary-nav a {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    color: #d0b98d;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: .025em;
  }

  body[data-concept-a-integration="comprehensive-v005"] .reference-navigation-divider {
    position: fixed;
    top: 54px;
    right: 0;
    left: 0;
    width: 100vw;
    height: 42px;
    transform: none;
  }

  body[data-concept-a-integration="comprehensive-v005"] .reference-navigation-ornament {
    top: -14px;
    left: 50%;
    width: 184px;
    height: 42px;
    transform: translateX(-50%);
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  body[data-concept-a-integration="comprehensive-v005"] .museum-header {
    padding-inline: 26px;
  }

  body[data-concept-a-integration="comprehensive-v005"] .museum-header-inner {
    grid-template-columns: 224px minmax(0, 1fr) 82px;
    gap-inline: 12px;
  }

  body[data-concept-a-integration="comprehensive-v005"] .reference-navigation-band .museum-primary-nav {
    justify-content: space-evenly;
    gap: clamp(8px, 2.2vw, 26px);
  }

  body[data-concept-a-integration="comprehensive-v005"] .reference-navigation-band .museum-primary-nav a {
    font-size: clamp(13px, 1.5vw, 16px);
  }
}

/* Restore the exact proportional desktop toolbar instead of fixed crop widths. */
@media (min-width: 1101px) {
  body[data-concept-a-integration="comprehensive-v005"] .museum-filter-deck {
    height: 114px !important;
    min-height: 114px !important;
    padding: 0 !important;
  }

  body[data-concept-a-integration="comprehensive-v005"] .museum-filter-deck .tools {
    display: grid;
    grid-template-columns: 1.6fr .98fr .98fr 1.08fr 1fr;
    align-items: center;
    gap: 38px;
    width: 100%;
    height: 62px;
    padding: 10px 47px 8px;
  }

  body[data-concept-a-integration="comprehensive-v005"] .museum-filter-deck .tools > #q {
    width: 100%;
    min-width: 0;
    margin: 0;
  }

  body[data-concept-a-integration="comprehensive-v005"] .reference-select-shell,
  body[data-concept-a-integration="comprehensive-v005"] .reference-select-shell[data-reference-control] {
    --reference-control-width: auto;
    width: 100%;
    min-width: 0;
    margin: 0;
    flex: none;
  }

  body[data-concept-a-integration="comprehensive-v005"] .museum-rarity-nav {
    grid-template-columns: 254fr 264fr 238fr 247fr 260fr 220fr;
    gap: clamp(18px, 2.09vw, 35px);
    width: min(calc(100vw - 8px), 1659px);
    height: 52px;
    margin: 0 auto;
    padding: 4px;
  }
}

/* Pagination now belongs to the same antique relief family as the CTA and cards. */
body[data-concept-a-integration="comprehensive-v005"] .gallery-pagination {
  position: relative;
  isolation: isolate;
  width: min(780px, 100%);
  min-height: 84px;
  padding: 14px 16px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
  background:
    linear-gradient(135deg, transparent 0 10px, rgba(173, 135, 76, .82) 10px 11px, transparent 11px) top left / 50% 50% no-repeat,
    linear-gradient(225deg, transparent 0 10px, rgba(173, 135, 76, .82) 10px 11px, transparent 11px) top right / 50% 50% no-repeat,
    linear-gradient(45deg, transparent 0 10px, rgba(173, 135, 76, .62) 10px 11px, transparent 11px) bottom left / 50% 50% no-repeat,
    linear-gradient(315deg, transparent 0 10px, rgba(173, 135, 76, .62) 10px 11px, transparent 11px) bottom right / 50% 50% no-repeat,
    repeating-linear-gradient(3deg, rgba(255,255,255,.01) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #201b17 0, #11151a 24%, #0c1117 74%, #191712 100%);
  box-shadow:
    0 0 0 1px #21180e,
    0 0 0 2px rgba(126, 93, 49, .86),
    0 0 0 4px rgba(34, 25, 16, .96),
    0 16px 32px rgba(0, 0, 0, .38),
    inset 0 1px rgba(239, 211, 154, .13),
    inset 0 -1px rgba(0, 0, 0, .88);
}

body[data-concept-a-integration="comprehensive-v005"] .gallery-pagination::before {
  content: "";
  position: absolute;
  inset: 5px;
  z-index: 0;
  pointer-events: none;
  border: 1px solid rgba(173, 135, 76, .48);
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .58), inset 0 0 12px rgba(0, 0, 0, .45);
}

body[data-concept-a-integration="comprehensive-v005"] .gallery-pagination::after {
  content: "◇";
  position: absolute;
  top: -11px;
  left: 50%;
  z-index: 2;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid #8e6d3d;
  background: #13151a;
  color: #c3a36d;
  box-shadow: inset 0 0 0 3px #1d1812, 0 3px 7px rgba(0,0,0,.6);
  font: 14px/1 Georgia, serif;
  transform: translateX(-50%) rotate(45deg);
}

body[data-concept-a-integration="comprehensive-v005"] .gallery-pagination > * {
  position: relative;
  z-index: 1;
}

body[data-concept-a-integration="comprehensive-v005"] .gallery-page-button {
  min-height: 48px;
  padding: 9px 18px;
  border: 1px solid #8f7447;
  border-radius: 0;
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
  background:
    linear-gradient(180deg, rgba(231, 199, 132, .11), transparent 34%),
    linear-gradient(180deg, #2b241a, #151719);
  color: #e9cf93;
  box-shadow: inset 0 0 0 2px rgba(14, 12, 9, .78), inset 0 1px rgba(255, 239, 197, .14), 0 4px 12px rgba(0, 0, 0, .3);
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: .075em;
}

body[data-concept-a-integration="comprehensive-v005"] .gallery-page-status {
  color: #e2cfaa;
  text-shadow: 0 1px #000;
}

/* Every modal action keeps a real 44px pointer and keyboard target. */
body[data-concept-a-integration="comprehensive-v005"] #cardLangId,
body[data-concept-a-integration="comprehensive-v005"] #cardLangEn,
body[data-concept-a-integration="comprehensive-v005"] #cardClose,
body[data-concept-a-integration="comprehensive-v005"] #cardPrevious,
body[data-concept-a-integration="comprehensive-v005"] #cardNext {
  min-width: 44px !important;
  min-height: 44px !important;
}

/* Switch pagination to a two-row relief before its three-column minimum can
   exceed the gallery inset (the 621px boundary exposed a 2px overflow). */
@media (max-width: 700px) {
  body[data-concept-a-integration="comprehensive-v005"] .gallery-pagination {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    width: min(100%, 520px);
    min-height: 124px;
    padding: 14px 10px 10px;
  }

  body[data-concept-a-integration="comprehensive-v005"] .gallery-page-status {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    padding: 3px 4px 5px;
  }

  body[data-concept-a-integration="comprehensive-v005"] #galleryPrevious,
  body[data-concept-a-integration="comprehensive-v005"] #galleryNext {
    grid-row: 2;
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-concept-a-integration="comprehensive-v005"] .gallery-pagination,
  body[data-concept-a-integration="comprehensive-v005"] .gallery-page-button {
    transition: none !important;
  }
}

/* Centre the stacked featured card without a transform, so reduced-motion
   preferences cannot accidentally disable a layout-critical operation. */
@media (max-width: 900px) {
  body[data-concept-a-integration="comprehensive-v005"] .museum-feature {
    right: 0 !important;
    left: 0 !important;
    margin-inline: auto !important;
    transform: none !important;
  }
}

@media (forced-colors: active) {
  body[data-concept-a-integration="comprehensive-v005"] .gallery-pagination,
  body[data-concept-a-integration="comprehensive-v005"] .gallery-page-button {
    border: 1px solid CanvasText;
    clip-path: none;
    background: Canvas;
    color: CanvasText;
    box-shadow: none;
  }

  body[data-concept-a-integration="comprehensive-v005"] .gallery-pagination::before,
  body[data-concept-a-integration="comprehensive-v005"] .gallery-pagination::after {
    display: none;
  }
}
