/* Faction officers: each faction panel brings its painted officer, lit at the officer's own light source. */
[data-faction-panel="xyros"], [data-faction-tab="xyros"], [data-officer="xyros"] { --faction-rgb: 255 59 47; --officer-ratio: 658 / 720; --officer-light-x: .2; --officer-light-y: .66; --officer-window: .74; --officer-crop-top: 0; }
[data-faction-panel="fenor"], [data-faction-tab="fenor"], [data-officer="fenor"] { --faction-rgb: 95 182 255; --officer-ratio: 686 / 720; --officer-light-x: .8; --officer-light-y: .42; --officer-window: .6; --officer-crop-top: .02; }
[data-faction-panel="zethos"], [data-faction-tab="zethos"], [data-officer="zethos"] { --faction-rgb: 79 212 122; --officer-ratio: 480 / 720; --officer-light-x: .2; --officer-light-y: .2; --officer-window: .56; --officer-crop-top: 0; }
[data-faction-panel="solis"], [data-faction-tab="solis"], [data-officer="solis"] { --faction-rgb: 255 207 90; --officer-ratio: 480 / 720; --officer-light-x: .62; --officer-light-y: .17; --officer-window: .56; --officer-crop-top: 0; }

.fate-acquisition .faction-tab { transition: border-color 240ms cubic-bezier(.2,.8,.2,1), box-shadow 240ms cubic-bezier(.2,.8,.2,1); }
.fate-acquisition .faction-tab[aria-selected="true"] { border-color: rgb(var(--faction-rgb) / .5); box-shadow: 0 0 24px -8px rgb(var(--faction-rgb) / .6); }

.faction-explorer:not(.is-enhanced) .faction-panels { grid-template-columns: minmax(0,1fr); }
.faction-panel { --faction-glow-at: 24% 66%; position: relative; overflow: hidden; isolation: isolate; border-color: rgb(var(--faction-rgb) / .28); background: radial-gradient(46% 72% at var(--faction-glow-at), rgb(var(--faction-rgb) / .2), transparent 72%), linear-gradient(145deg, rgba(255,255,255,.035), transparent), rgba(13,17,23,.84); box-shadow: inset 0 1px rgb(var(--faction-rgb) / .18), 0 32px 70px -48px rgb(var(--faction-rgb) / .75); }
.faction-panel:not([hidden]) { display: grid; grid-template-columns: minmax(0,5fr) minmax(0,6fr); align-items: center; gap: clamp(1rem,3vw,2.75rem); padding: 1.25rem clamp(1.25rem,4vw,2.75rem) 0 1.25rem; }
.faction-panel-copy { min-width: 0; padding: 1.5rem 0 2rem; }

.faction-officer { position: relative; display: grid; place-items: end center; align-self: end; aspect-ratio: 1; container-type: size; }
.faction-officer::before { content: ''; position: absolute; left: 14%; right: 14%; bottom: -3%; height: 14%; border-radius: 50%; background: radial-gradient(closest-side, rgb(var(--faction-rgb) / .36), transparent); }
.faction-officer > * { grid-area: 1 / 1; }
.faction-officer-art { position: relative; aspect-ratio: var(--officer-ratio); width: 100%; width: min(100cqw, 100cqh * (var(--officer-ratio))); }
.faction-officer-art img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 18px 22px rgba(0,0,0,.5)); }
.faction-officer-art.is-leaving { pointer-events: none; }

/* Living light: a screen-blended glow breathing at the officer's light source. */
.faction-officer-light { position: absolute; left: calc(var(--officer-light-x) * 100%); top: calc(var(--officer-light-y) * 100%); height: 36%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: radial-gradient(closest-side, rgb(255 255 255 / .42), rgb(var(--faction-rgb) / .55) 30%, rgb(var(--faction-rgb) / .16) 64%, transparent); mix-blend-mode: screen; pointer-events: none; animation: faction-light-breathe 1.8s cubic-bezier(.45,.05,.55,.95) infinite; }
@keyframes faction-light-breathe { 0%, 100% { opacity: .56; transform: scale(.985); } 50% { opacity: 1; transform: scale(1.015); } }

/* Faction particles, eight per officer: embers, water motes, drifting leaves and coin glints. */
.faction-officer-motes { position: absolute; left: calc(var(--officer-light-x) * 100%); top: calc(var(--officer-light-y) * 100%); pointer-events: none; }
.faction-officer-motes > span { position: absolute; left: var(--mote-x); top: var(--mote-y); width: 4px; height: 4px; border-radius: 50%; opacity: 0; animation: faction-ember calc(2.2s + var(--mote-t) * 1.4s) linear var(--mote-delay) infinite; }
.faction-officer-motes > span:nth-child(1) { --mote-x: -30px; --mote-y: 4px; --mote-t: .2; --mote-delay: 0s; --mote-drift: 8px; }
.faction-officer-motes > span:nth-child(2) { --mote-x: 22px; --mote-y: -10px; --mote-t: .7; --mote-delay: -.6s; --mote-drift: -10px; }
.faction-officer-motes > span:nth-child(3) { --mote-x: -8px; --mote-y: 18px; --mote-t: .45; --mote-delay: -1.3s; --mote-drift: 14px; }
.faction-officer-motes > span:nth-child(4) { --mote-x: 36px; --mote-y: 12px; --mote-t: .9; --mote-delay: -2.1s; --mote-drift: -6px; }
.faction-officer-motes > span:nth-child(5) { --mote-x: -44px; --mote-y: -16px; --mote-t: .3; --mote-delay: -.9s; --mote-drift: 12px; }
.faction-officer-motes > span:nth-child(6) { --mote-x: 10px; --mote-y: -28px; --mote-t: .6; --mote-delay: -1.7s; --mote-drift: -14px; }
.faction-officer-motes > span:nth-child(7) { --mote-x: -18px; --mote-y: -6px; --mote-t: .8; --mote-delay: -2.6s; --mote-drift: 6px; }
.faction-officer-motes > span:nth-child(8) { --mote-x: 46px; --mote-y: -24px; --mote-t: .1; --mote-delay: -.3s; --mote-drift: -8px; }
[data-officer="xyros"] .faction-officer-motes > span { width: 3px; height: 3px; background: #ffc27a; box-shadow: 0 0 6px 1px rgb(255 59 47 / .9); }
[data-officer="fenor"] .faction-officer-motes > span { width: 6px; height: 6px; border: 1px solid rgb(205 236 255 / .85); background: rgb(95 182 255 / .28); box-shadow: 0 0 7px rgb(95 182 255 / .7); animation-name: faction-water-mote; animation-duration: calc(4s + var(--mote-t) * 2s); }
[data-officer="zethos"] .faction-officer-motes > span { width: 9px; height: 5px; border-radius: 0 100%; background: linear-gradient(135deg, #9df2b0, #2f9a55); box-shadow: 0 0 6px rgb(79 212 122 / .55); animation-name: faction-leaf; animation-duration: calc(4.6s + var(--mote-t) * 2.4s); }
[data-officer="solis"] .faction-officer-motes > span { left: calc(var(--mote-x) * 2.2); top: calc(var(--mote-y) * 2.2); width: 11px; height: 11px; border-radius: 0; background: radial-gradient(closest-side, #fffbe8, #ffd96a 55%, rgb(255 207 90 / 0)); clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%); animation-name: faction-glint; animation-duration: calc(1.8s + var(--mote-t) * .8s); animation-timing-function: cubic-bezier(.45,.05,.55,.95); }
@keyframes faction-ember { 0% { opacity: 0; transform: translate(0,0) scale(1); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--mote-drift), -120px) scale(.4); } }
@keyframes faction-water-mote { 0% { opacity: 0; transform: translate(0,0); } 20% { opacity: .9; } 50% { transform: translate(var(--mote-drift), -36px); } 100% { opacity: 0; transform: translate(calc(var(--mote-drift) * -.6), -76px); } }
@keyframes faction-leaf { 0% { opacity: 0; transform: translate(0,0) rotate(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(var(--mote-drift) * 4), 110px) rotate(260deg); } }
@keyframes faction-glint { 0%, 100% { opacity: 0; transform: scale(.2) rotate(0); } 45% { opacity: 1; transform: scale(1) rotate(45deg); } 70% { opacity: 0; transform: scale(.3) rotate(80deg); } }
.faction-explorer.has-officer-motion:not(.is-live) :is(.faction-officer-light, .faction-officer-motes > span) { animation-play-state: paused; }

@media (max-width: 700px) {
    .faction-panel { --faction-glow-at: 50% 24%; }
    .faction-panel:not([hidden]) { display: block; padding: 0; }
    .faction-panel-copy { padding: 1.1rem 1.25rem 1.4rem; }
    .faction-officer { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-bottom: 1px solid rgb(var(--faction-rgb) / .2); }
    .faction-officer::before { display: none; }
    .faction-officer-art { position: absolute; left: 50%; top: 0; width: auto; height: calc(100cqh / var(--officer-window)); translate: -50% calc(var(--officer-crop-top) * -100%); }
}
@media (max-width: 520px) {
    .fate-acquisition .faction-tabs { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .fate-acquisition .faction-tab { min-height: 52px; padding: .5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .fate-acquisition .faction-tab { transition: none; }
    .faction-officer-light { animation: none; opacity: .78; }
    .faction-officer-motes { display: none; }
}
