/*
 * PRANATARA Relic source-canvas boundary v007 — chat-177.
 *
 * v006 correctly exposed literal frame pixels, but its 355x440 cropped
 * coordinate plane discarded the source PNG's own perimeter clearances and
 * enlarged the frame to the host edges. This successor restores the complete
 * 382x457 source canvas. The existing luminance mask and raster remain
 * unchanged; only containment and live C-ID plaque coordinates are rebased.
 */

body[data-relic-literal-frame="full-frame-v006"][data-relic-frame-boundary="source-canvas-v001"]
  :is(
    #grid > article.holo-card[data-rarity="Relic"] > .relic-literal-frame-layer,
    .reference-feature-card[data-rarity="Relic"] > .relic-literal-frame-layer,
    #cardDialog .collectible-card.holo-card[data-rarity="Relic"] > .collectible-art > .relic-literal-frame-layer,
    article.card.holo-card[data-rarity="Relic"] > .relic-literal-frame-layer
  ) {
  aspect-ratio: 382 / 457 !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

/* Gallery, featured, and standalone cards are narrower than the reference
 * canvas. Width containment preserves the full canvas and centres the small
 * vertical letterbox instead of cropping the top and bottom source margins. */
body[data-relic-literal-frame="full-frame-v006"][data-relic-frame-boundary="source-canvas-v001"]
  :is(
    #grid > article.holo-card[data-rarity="Relic"] > .relic-literal-frame-layer,
    .reference-feature-card[data-rarity="Relic"] > .relic-literal-frame-layer,
    article.card.holo-card[data-rarity="Relic"] > .relic-literal-frame-layer
  ) {
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  left: 50% !important;
  width: 100% !important;
  height: auto !important;
  transform: translate(-50%, -50%) !important;
}

/* The detail artwork host is 4:5 and therefore narrower than the restored
 * 382:457 source plane. Width containment keeps both axes proportional and
 * leaves the small, intentional vertical clearance. */
body[data-relic-literal-frame="full-frame-v006"][data-relic-frame-boundary="source-canvas-v001"]
  #cardDialog
  .collectible-card.holo-card[data-rarity="Relic"]
  > .collectible-art
  > .relic-literal-frame-layer {
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  left: 50% !important;
  width: 100% !important;
  height: auto !important;
  transform: translate(-50%, -50%) !important;
}

body[data-relic-literal-frame="full-frame-v006"][data-relic-frame-boundary="source-canvas-v001"]
  .relic-literal-frame-layer
  > .relic-literal-frame-svg {
  aspect-ratio: 382 / 457 !important;
}

/* Source-canvas plaque: x=24..101, y=17..54 on 382x457. */
body[data-relic-literal-frame="full-frame-v006"][data-relic-frame-boundary="source-canvas-v001"]
  .relic-literal-frame-layer
  > .relic-reference-number-plaque {
  top: 3.7199125% !important;
  left: 6.2827225% !important;
  width: 20.1570681% !important;
  height: 8.0962801% !important;
  padding-right: 1.0471204% !important;
  padding-left: 1.0471204% !important;
  font-size: clamp(0.42rem, 3.0634573cqh, 1.05rem) !important;
}

/* Caption clearances now use the full source-canvas coordinates. */
body[data-relic-literal-frame="full-frame-v006"][data-relic-frame-boundary="source-canvas-v001"]
  .reference-feature-card[data-rarity="Relic"]
  > .museum-feature-watermark,
body[data-relic-literal-frame="full-frame-v006"][data-relic-frame-boundary="source-canvas-v001"]
  #grid
  > article.holo-card[data-rarity="Relic"]
  > .protected-media
  > .preview-mark {
  left: max(84px, calc(26.4397906% + 8px)) !important;
}

body[data-relic-literal-frame="full-frame-v006"][data-relic-frame-boundary="source-canvas-v001"]
  #cardDialog
  .collectible-card.holo-card[data-rarity="Relic"]
  > .collectible-art
  > .collectible-faction {
  right: calc(23.8219895% + 8px) !important;
  left: calc(26.4397906% + 8px) !important;
}

@media (prefers-reduced-motion: reduce) {
  body[data-relic-frame-boundary="source-canvas-v001"]
    :is(.relic-literal-frame-layer, .relic-literal-frame-svg, .relic-reference-number-plaque) {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  body[data-relic-frame-boundary="source-canvas-v001"]
    .relic-literal-frame-layer {
    forced-color-adjust: auto;
  }
}
