/*
 * PRANATARA Relic full-reference frame v006 — chat-166.
 *
 * The builder supplies one non-interactive .relic-literal-frame-layer for
 * each Relic rendering context. Its inline SVG uses the proven source-frame
 * viewBox (11 5 355 440), while this stylesheet preserves that exact 71:88
 * ratio without stretching. Each host uses the axis that fits before either\n * max constraint can clamp a single dimension. The SVG owns clipping; CSS
 * neither redraws, recolours, filters, nor animates those source pixels.
 *
 * The canonical C-ID is a separate text child because the flattened source
 * contains M001. Its plaque follows the measured source plaque exactly:
 * x=24..100, y=17..53 relative to the frame viewBox. Old synthetic number
 * badges are suppressed so every context exposes one identity only.
 */

/* Shared, immutable contain shell: frame z=6, canonical plaque z=8. */
body[data-relic-literal-frame="full-frame-v006"]
  #grid
  > article.holo-card[data-rarity="Relic"]
  > .relic-literal-frame-layer,
body[data-relic-literal-frame="full-frame-v006"]
  .reference-feature-card[data-rarity="Relic"]
  > .relic-literal-frame-layer,
body[data-relic-literal-frame="full-frame-v006"]
  #cardDialog
  .collectible-card.holo-card[data-rarity="Relic"]
  > .collectible-art
  > .relic-literal-frame-layer,
body[data-relic-literal-frame="full-frame-v006"]
  > article.card.holo-card[data-rarity="Relic"]
  > .relic-literal-frame-layer {
  position: absolute !important;
  z-index: 6 !important;
  display: block !important;
  box-sizing: border-box !important;
  aspect-ratio: 71 / 88 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: none !important;
  pointer-events: none !important;
  user-select: none !important;
  animation: none !important;
  transition: none !important;
  container-type: size;
  forced-color-adjust: none;
}

/* Gallery and feature cards retain their accepted dimensions. The exact-ratio
 * portrait shell is contained by height and optically centred. */
body[data-relic-literal-frame="full-frame-v006"]
  #grid
  > article.holo-card[data-rarity="Relic"]
  > .relic-literal-frame-layer,
body[data-relic-literal-frame="full-frame-v006"]
  .reference-feature-card[data-rarity="Relic"]
  > .relic-literal-frame-layer {
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  left: 50% !important;
  width: auto !important;
  height: 100% !important;
  transform: translate(-50%, -50%) !important;
}

/* Modal artwork is slightly wider than 71:88. Contain by height so neither
 * max constraint can clamp only one axis and distort the source ratio. */
body[data-relic-literal-frame="full-frame-v006"]
  #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: auto !important;
  height: 100% !important;
  transform: translate(-50%, -50%) !important;
}

/* The standalone 4:5 host is marginally narrower than 71:88. Contain by
 * width; the derived height remains below the host height and stays exact. */
body[data-relic-literal-frame="full-frame-v006"]
  > 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;
}

/* SVG geometry and pixel sampling are supplied by the builder. */
body[data-relic-literal-frame="full-frame-v006"]
  .relic-literal-frame-layer
  > .relic-literal-frame-svg {
  position: absolute !important;
  z-index: 6 !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: 71 / 88 !important;
  overflow: hidden !important;
  border: 0 !important;
  background: none !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: none !important;
  transform: none !important;
  pointer-events: none !important;
  animation: none !important;
  transition: none !important;
  shape-rendering: geometricPrecision;
}

body[data-relic-literal-frame="full-frame-v006"]
  .relic-literal-frame-svg
  image {
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: none !important;
  transform: none !important;
  pointer-events: none !important;
  animation: none !important;
  transition: none !important;
  image-rendering: auto;
}

/* Measured lasso-plaque box within viewBox 11 5 355 440:
 * left=(24-11)/355; top=(17-5)/440; width=77/355; height=37/440.
 * The plaque material itself remains reference pixels in the SVG. */
body[data-relic-literal-frame="full-frame-v006"]
  .relic-literal-frame-layer
  > .relic-reference-number-plaque {
  position: absolute !important;
  z-index: 8 !important;
  top: 2.7272727% !important;
  right: auto !important;
  bottom: auto !important;
  left: 3.6619718% !important;
  display: grid !important;
  place-items: center !important;
  box-sizing: border-box !important;
  width: 21.6901408% !important;
  height: 8.4090909% !important;
  margin: 0 !important;
  padding: 0 1.1267606% !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #d3c28f !important;
  font-family: "Cinzel", "Palatino Linotype", Palatino, Georgia, serif !important;
  font-size: clamp(0.42rem, 3.1818182cqh, 1.05rem) !important;
  font-style: normal !important;
  font-weight: 700 !important;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1 !important;
  letter-spacing: 0.015em !important;
  text-align: center !important;
  text-indent: 0 !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  text-shadow: 0 1px 0 #17130e;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: none !important;
  transform: none !important;
  pointer-events: none !important;
  user-select: none !important;
  animation: none !important;
  transition: none !important;
}

/* One canonical C-ID only: retire inherited gallery, modal, standalone, and
 * feature badges after the measured plaque child is present. */
body[data-relic-literal-frame="full-frame-v006"]
  #grid
  > article.holo-card[data-rarity="Relic"]
  .heirloom-top-number,
body[data-relic-literal-frame="full-frame-v006"]
  #cardDialog
  .collectible-card.holo-card[data-rarity="Relic"]
  .heirloom-top-number,
body[data-relic-literal-frame="full-frame-v006"]
  > article.card.holo-card[data-rarity="Relic"]
  .heirloom-top-number,
body[data-relic-literal-frame="full-frame-v006"]
  .reference-feature-card[data-rarity="Relic"]
  > .museum-feature-token {
  display: none !important;
  visibility: hidden !important;
}

/* Relic identity remains above the frame and plaque. */
body[data-relic-literal-frame="full-frame-v006"]
  #grid
  > article.holo-card[data-rarity="Relic"]
  > .reference-rarity-pennant,
body[data-relic-literal-frame="full-frame-v006"]
  .reference-feature-card[data-rarity="Relic"]
  > .reference-rarity-pennant,
body[data-relic-literal-frame="full-frame-v006"]
  #cardDialog
  .collectible-card.holo-card[data-rarity="Relic"]
  > .reference-rarity-pennant,
body[data-relic-literal-frame="full-frame-v006"]
  > article.card.holo-card[data-rarity="Relic"]
  > .reference-rarity-pennant {
  z-index: 9 !important;
}

/* Long-form card copy and controls remain readable/clickable above the visual
 * frame layer. No transform or animation is introduced. */
body[data-relic-literal-frame="full-frame-v006"]
  #grid
  > article.holo-card[data-rarity="Relic"]
  > :is(.frame-signature, .body),
body[data-relic-literal-frame="full-frame-v006"]
  > article.card.holo-card[data-rarity="Relic"]
  > :is(.frame-signature, .body, .copy),
body[data-relic-literal-frame="full-frame-v006"]
  #cardDialog
  .collectible-card.holo-card[data-rarity="Relic"]
  > :is(
    .collectible-topline,
    .collectible-brand,
    .frame-signature,
    .collectible-info,
    .collectible-footer
  ) {
  position: relative;
  z-index: 7 !important;
}

/* Keep every inherited top caption clear of the measured number plaque. */
body[data-relic-literal-frame="full-frame-v006"]
  .reference-feature-card[data-rarity="Relic"]
  > .museum-feature-watermark {
  left: max(84px, calc(25.908809% + 8px)) !important;
}

body[data-relic-literal-frame="full-frame-v006"]
  #grid
  > article.holo-card[data-rarity="Relic"]
  > .protected-media
  > .preview-mark {
  left: max(84px, calc(27% + 2px)) !important;
}

body[data-relic-literal-frame="full-frame-v006"]
  #cardDialog
  .collectible-card.holo-card[data-rarity="Relic"]
  > .collectible-art
  > .collectible-faction {
  right: calc(21.126761% + 8px) !important;
  left: calc(25.352113% + 8px) !important;
  width: auto !important;
  max-width: none !important;
  overflow: hidden !important;
  text-align: center !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body[data-relic-literal-frame="full-frame-v006"]
  #grid
  > article.holo-card[data-rarity="Relic"]
  .view-card-button,
body[data-relic-literal-frame="full-frame-v006"]
  .museum-feature-open,
body[data-relic-literal-frame="full-frame-v006"]
  #cardDialog
  :is(button, .card-dialog-toolbar) {
  position: relative;
  z-index: 10;
}

/* Retire the previous synthetic catalogue frame while leaving the protected
 * media and its ::before/::after hologram layers completely untouched. */
body[data-relic-literal-frame="full-frame-v006"][data-reference-portrait-card="v001"][data-reference-portrait-frame="transparent-centre-v002"][data-reference-portrait-fidelity="v003"][data-reference-portrait-optical="v004"][data-reference-feature-coordinate="v005"]
  #grid
  > article.holo-card[data-rarity="Relic"]
  > .ornamental-frame-v002.heirloom-cartouche-frame-v001,
body[data-relic-literal-frame="full-frame-v006"]
  > article.card.holo-card[data-rarity="Relic"]
  > .ornamental-frame-v002.heirloom-cartouche-frame-v001 {
  border-color: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  outline: 0 !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: none !important;
  transform: none !important;
  animation: none !important;
  transition: none !important;
  pointer-events: none !important;
}

body[data-relic-literal-frame="full-frame-v006"]
  :is(
    #grid > article.holo-card[data-rarity="Relic"],
    #cardDialog .collectible-card.holo-card[data-rarity="Relic"],
    article.card.holo-card[data-rarity="Relic"]
  )
  > .ornamental-frame-v002.heirloom-cartouche-frame-v001
  > svg.heirloom-corner,
body[data-relic-literal-frame="full-frame-v006"]
  :is(
    #grid > article.holo-card[data-rarity="Relic"],
    #cardDialog .collectible-card.holo-card[data-rarity="Relic"],
    article.card.holo-card[data-rarity="Relic"]
  )
  > .ornamental-frame-v002.heirloom-cartouche-frame-v001::before,
body[data-relic-literal-frame="full-frame-v006"]
  :is(
    #grid > article.holo-card[data-rarity="Relic"],
    #cardDialog .collectible-card.holo-card[data-rarity="Relic"],
    article.card.holo-card[data-rarity="Relic"]
  )
  > .ornamental-frame-v002.heirloom-cartouche-frame-v001::after {
  display: none !important;
  content: none !important;
}

/* Remove inherited article rails only. Hologram pseudo-elements live on
 * .protected-media/.collectible-art/.media and are intentionally not selected. */
body[data-relic-literal-frame="full-frame-v006"][data-reference-portrait-card="v001"][data-reference-portrait-frame="transparent-centre-v002"][data-reference-portrait-fidelity="v003"][data-reference-portrait-optical="v004"][data-reference-feature-coordinate="v005"]
  #grid
  > article.holo-card[data-rarity="Relic"] {
  border-color: transparent !important;
  box-shadow:
    0 0 0 1px #050403,
    0 3px 0 #332719,
    0 22px 38px -23px rgba(0, 0, 0, 0.96) !important;
}

body[data-relic-literal-frame="full-frame-v006"][data-reference-portrait-card="v001"][data-reference-portrait-frame="transparent-centre-v002"][data-reference-portrait-fidelity="v003"][data-reference-portrait-optical="v004"][data-reference-feature-coordinate="v005"]
  #grid
  > article.holo-card[data-rarity="Relic"]::before,
body[data-relic-literal-frame="full-frame-v006"]
  > article.card.holo-card[data-rarity="Relic"]::before {
  content: none !important;
  display: none !important;
}

body[data-relic-literal-frame="full-frame-v006"][data-reference-portrait-card="v001"][data-reference-portrait-frame="transparent-centre-v002"][data-reference-portrait-fidelity="v003"][data-reference-portrait-optical="v004"][data-reference-feature-coordinate="v005"]
  .reference-feature-card[data-rarity="Relic"]
  > .reference-feature-frame {
  display: none !important;
}

/* Modal compatibility removes only the inherited static frame paint. Do not
 * set content/display on collectible-art pseudo-elements: they are hologram. */
body[data-relic-literal-frame="full-frame-v006"][data-reference-portrait-card="v001"][data-reference-portrait-frame="transparent-centre-v002"][data-reference-portrait-fidelity="v003"][data-reference-portrait-optical="v004"][data-reference-feature-coordinate="v005"]
  #cardDialog
  .collectible-card.holo-card[data-rarity="Relic"]
  > .collectible-art {
  background-image: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

body[data-relic-literal-frame="full-frame-v006"]
  > article.card.holo-card[data-rarity="Relic"] {
  border-color: transparent !important;
}

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

/* The literal raster cannot be remapped faithfully in forced-colour mode.
 * Replace it with a system outline and a readable canonical-ID plaque. */
@media (forced-colors: active) {
  body[data-relic-literal-frame="full-frame-v006"]
    .relic-literal-frame-layer {
    border: 2px solid CanvasText !important;
    background: transparent !important;
    box-shadow: none !important;
    filter: none !important;
    forced-color-adjust: auto;
  }

  body[data-relic-literal-frame="full-frame-v006"]
    .relic-literal-frame-layer
    > .relic-literal-frame-svg {
    visibility: hidden !important;
  }

  body[data-relic-literal-frame="full-frame-v006"]
    .relic-literal-frame-layer
    > .relic-reference-number-plaque {
    border: 1px solid CanvasText !important;
    background: Canvas !important;
    color: CanvasText !important;
    text-shadow: none !important;
    forced-color-adjust: auto;
  }
}
