/* Astral Arcana | Load after celestial.css. The card face owns data-rank.
   Add <i class="arcana-aura" aria-hidden="true"></i> after the artwork. */
.aura-card[data-rank="1"] {
  --aa-shadow: 0 0 0 1px #9d7954, 0 6px 14px #100a1480;
}

.aura-card[data-rank="2"] {
  --aa-shadow: 0 0 0 1px #e2c7ed, 0 0 0 3px #604366, 0 0 15px #b787df55;
  --aa-glint: #dec0ff;
  --aa-lap: 7.2s;
}

.aura-card[data-rank="3"] {
  --aa-shadow: 0 0 0 1px #fff0bf, 0 0 0 3px #835a39, 0 0 0 4px #ebc87c,
               0 0 14px 3px #e7ae5d60, 0 0 30px 5px #a97dba40;
  --aa-glint: #ffda88;
  --aa-lap: 8.8s;
}

/* These surfaces already position their children. Keep the 3D face absolute. */
.aura-card[data-rank]:where(:not(.f)) { position: relative; }
.aura-card[data-rank],
.bc.max .bf.aura-card[data-rank],
.c3.on .fr.aura-card[data-rank],
#unlock[data-rank] .unlock-card.aura-card[data-rank] {
  box-shadow: var(--aa-shadow);
}
.c3.t4.on .fr.aura-card[data-rank] { animation: none; }
.aura-card[data-rank] > .holo { display: none; }

.arcana-aura { display: none; }
.aura-card:is([data-rank="2"], [data-rank="3"]) > .arcana-aura {
  display: block;
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}

/* Four small corner settings keep the centre, numeral and nameplate clear.
   All four are a single static vector surface. */
.aura-card[data-rank="3"] > .arcana-aura {
  background: center / 100% 100% no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 340' preserveAspectRatio='none'%3E%3Cdefs%3E%3Cg id='a'%3E%3Cpath d='M3 39V16Q3 3 16 3H39M4 26L8 14L14 8L26 4' fill='none' stroke='%235b3a39' stroke-width='2.8'/%3E%3Cpath d='M3 39V16Q3 3 16 3H39M4 26L8 14L14 8L26 4' fill='none' stroke='%23ffde90' stroke-width='1.2'/%3E%3Cpath d='M12 3L14 10L21 12L14 14L12 22L10 14L3 12L10 10Z' fill='%23fff1c4' stroke='%23835637' stroke-width='.85'/%3E%3Ccircle cx='12' cy='12' r='1.55' fill='%23ae803e'/%3E%3C/g%3E%3C/defs%3E%3Cuse href='%23a'/%3E%3Cuse href='%23a' transform='translate(200) scale(-1 1)'/%3E%3Cuse href='%23a' transform='translate(0 340) scale(1 -1)'/%3E%3Cuse href='%23a' transform='translate(200 340) scale(-1)'/%3E%3C/svg%3E");
}

/* A narrow tail and a four-point reflection move together as one small sprite.
   The second reflection on the sacred frame stays half a lap behind. */
.aura-card[data-rank="2"] > .arcana-aura::before,
.aura-card[data-rank="3"] > .arcana-aura::before,
.aura-card[data-rank="3"] > .arcana-aura::after {
  content: "";
  position: absolute;
  width: 16%;
  height: 3.8%;
  background:
    radial-gradient(ellipse 8% 48% at 74% 50%, #fff9e8 16%, transparent 95%),
    radial-gradient(ellipse 23% 14% at 74% 50%, #fff9e8 42%, transparent),
    radial-gradient(ellipse 47% 17% at 52% 50%, var(--aa-glint) 28%, transparent),
    radial-gradient(ellipse 35% 46% at 71% 50%, var(--aa-glint), transparent);
  /* A still highlight also works on engines without a rounded-inset motion path. */
  left: 16%;
  top: 0;
}
.aura-card[data-rank="3"] > .arcana-aura::after { left: auto; top: auto; right: 16%; bottom: 0; }

@supports (offset-path: inset(1% round 5%)) {
  .aura-card[data-rank] > .arcana-aura::before,
  .aura-card[data-rank] > .arcana-aura::after {
    inset: 0 auto auto 0;
    offset-path: inset(1% 1.7% round 6% / 3.5%);
    offset-distance: 8%;
    offset-anchor: 74% 50%;
  }
  .aura-card[data-rank="3"] > .arcana-aura::after { offset-distance: 58%; }

  @media (prefers-reduced-motion: no-preference) {
    .aura-card { --aa-orbit: aa-perimeter; }
    /* Collection and reading thumbnails rest until inspected. */
    :is(.bf, .th).aura-card, .c3:not(.on) .fr.aura-card { --aa-orbit: none; }
    .bc:focus-visible .bf.aura-card, .th.aura-card:focus-visible { --aa-orbit: aa-perimeter; }
    @media (hover: hover) {
      .bc:hover .bf.aura-card, .th.aura-card:hover { --aa-orbit: aa-perimeter; }
    }
    .aura-card[data-rank] > .arcana-aura::before,
    .aura-card[data-rank] > .arcana-aura::after {
      animation: var(--aa-orbit) var(--aa-lap, 8s) linear infinite;
    }
    .aura-card[data-rank="3"] > .arcana-aura::after { animation-delay: -4.4s; }
  }
}
@keyframes aa-perimeter {
  from { offset-distance: 8%; }
  to   { offset-distance: 108%; }
}

/* Optional preview switch. System reduced motion is static without this. */
[data-aura-still] .aura-card[data-rank] > .arcana-aura::before,
[data-aura-still] .aura-card[data-rank] > .arcana-aura::after { animation: none; }
