/* Athena living-companion performance · 2.5D image performance around the existing
   portrait. Namespaced under .companion via data-performance (set by AthenaPerformance).
   Decorative layers are pointer-events:none and never cover the face; mood is always
   carried by real text in .athena-presence, never by color alone.
   Palette: gold/ivory/indigo Greek with one tiny cyan accent on the defend rim. */

/* Registered so pose and light interpolate between beats; without @property support
   the values simply snap, which is an acceptable fallback. */
@property --ath-guard{syntax:'<number>';inherits:true;initial-value:0}
@property --ath-pose-y{syntax:'<length>';inherits:true;initial-value:0px}
@property --ath-pose-scale{syntax:'<number>';inherits:true;initial-value:1.12}
@property --ath-bright{syntax:'<number>';inherits:true;initial-value:1}
@property --ath-sat{syntax:'<number>';inherits:true;initial-value:1}
@property --ath-veil-y{syntax:'<length>';inherits:true;initial-value:0px}
@property --ath-veil-light{syntax:'<number>';inherits:true;initial-value:1}

.companion[data-performance]{
  --ath-guard:0;--ath-pose-y:0px;--ath-pose-scale:1.12;--ath-bright:1;--ath-sat:1;--ath-breath:6.4s;--ath-veil-y:0px;--ath-veil-light:1;
  transition:--ath-pose-y .9s cubic-bezier(.22,.8,.3,1),--ath-pose-scale .9s cubic-bezier(.22,.8,.3,1),--ath-bright 1.1s ease,--ath-sat 1.1s ease,--ath-guard .45s ease,--ath-veil-y .9s cubic-bezier(.22,.8,.3,1),--ath-veil-light .65s ease;
}

/* Deliberate readable pose language per mood: rising attention, braced defense,
   lifted victory, lowered recovery. Whole-image only — anatomy is never warped. */
.companion[data-performance=idle]{--ath-pose-y:0px;--ath-pose-scale:1.12;--ath-veil-y:0px;--ath-veil-light:.88}
.companion[data-performance=attentive]{--ath-pose-y:-2px;--ath-pose-scale:1.126;--ath-bright:1.03;--ath-veil-y:2px;--ath-veil-light:1.02}
.companion[data-performance=spin_watch]{--ath-pose-y:-1px;--ath-pose-scale:1.124;--ath-bright:1.035;--ath-veil-y:1.5px;--ath-veil-light:1.06}
.companion[data-performance=defend]{--ath-pose-y:1.5px;--ath-pose-scale:1.136;--ath-bright:1.06;--ath-sat:1.05;--ath-veil-y:-1.5px;--ath-veil-light:1.16}
.companion[data-performance=celebrate]{--ath-pose-y:-2.5px;--ath-pose-scale:1.123;--ath-bright:1.05;--ath-sat:1.03;--ath-veil-y:2px;--ath-veil-light:1.08}
.companion[data-performance=victory]{--ath-pose-y:-3px;--ath-pose-scale:1.127;--ath-bright:1.08;--ath-sat:1.06;--ath-veil-y:2.5px;--ath-veil-light:1.14}
.companion[data-performance=recover]{--ath-pose-y:1px;--ath-pose-scale:1.118;--ath-bright:.97;--ath-sat:.95;--ath-veil-y:-1px;--ath-veil-light:.82}
.companion[data-performance=concerned]{--ath-pose-y:1.5px;--ath-pose-scale:1.116;--ath-bright:.94;--ath-sat:.9;--ath-veil-y:-1.5px;--ath-veil-light:.74}

/* Subtle breathing on the portrait itself; keyframes resolve the pose variables
   each frame, so beat changes glide through without restarting the breath. */
.companion[data-performance] .portrait img{
  transform:translateY(var(--ath-pose-y,0px)) scale(var(--ath-pose-scale,1.12));
  transform-origin:50% 62%;
  filter:brightness(var(--ath-bright,1)) saturate(var(--ath-sat,1));
  animation:ath-breathe var(--ath-breath,6.4s) ease-in-out infinite;
  will-change:transform;
}
@keyframes ath-breathe{
  0%,100%{transform:translateY(var(--ath-pose-y,0px)) scale(var(--ath-pose-scale,1.12))}
  50%{transform:translateY(calc(var(--ath-pose-y,0px) - 1.6px)) scale(calc(var(--ath-pose-scale,1.12) + .008))}
}

/* Decorative layers inside .portrait. They sit beneath the existing name plate
   and bottom gradient and are masked away from the upper face region. */
.companion .athena-veil,.companion .athena-aegis{position:absolute;inset:0;pointer-events:none;z-index:0}
.companion .athena-beat-light{
  position:absolute;inset:0;z-index:0;pointer-events:none;opacity:0;mix-blend-mode:screen;
  background:radial-gradient(ellipse at 20% 84%,var(--ath-beat-color,rgba(241,210,141,.3)) 0,transparent 64%),
    linear-gradient(100deg,transparent 24%,var(--ath-beat-color,rgba(241,210,141,.3)) 46%,transparent 70%);
  -webkit-mask-image:linear-gradient(180deg,transparent 0 34%,#000 62%);
  mask-image:linear-gradient(180deg,transparent 0 34%,#000 62%);
}

/* Cloth-light suggestion: slow ivory/indigo sheen drifting across drapery. */
.companion .athena-veil{
  background:linear-gradient(115deg,transparent 30%,#f6ead81a 44%,transparent 58%,#2c3a6b17 76%,transparent 92%);
  background-size:280% 280%;
  mix-blend-mode:soft-light;opacity:.85;filter:brightness(var(--ath-veil-light,1));
  transform:translateY(var(--ath-veil-y,0px));
  transition:transform .9s cubic-bezier(.22,.8,.3,1),filter .65s ease;
  -webkit-mask-image:linear-gradient(180deg,transparent 0 34%,#000 62%);
  mask-image:linear-gradient(180deg,transparent 0 34%,#000 62%);
  animation:ath-drift 11s ease-in-out infinite alternate;
}
@keyframes ath-drift{from{background-position:12% 20%}to{background-position:84% 76%}}

/* Shield-gold illumination, low and to her shield side; intensity is --ath-guard
   (ramped by JS through telegraph, full during the defense window). */
.companion .athena-aegis{
  opacity:0;
  background:
    radial-gradient(90% 75% at 18% 88%,#f0c97a59 0,#e9b85c30 34%,transparent 62%),
    radial-gradient(120% 60% at 50% 104%,#caa05526 0,transparent 55%);
  mix-blend-mode:screen;
  -webkit-mask-image:linear-gradient(180deg,transparent 0 34%,#000 62%);
  mask-image:linear-gradient(180deg,transparent 0 34%,#000 62%);
}
.companion[data-performance=defend] .athena-aegis{opacity:var(--ath-guard,0)}
.companion .athena-aegis::after{
  content:'';position:absolute;inset:6px;border-radius:12px;
  box-shadow:inset 0 0 0 1px #f2d79a4d,inset 0 -18px 30px #e9bb6224;
}
/* The one tiny cyan accent: a hairline on the raised aegis rim while defending. */
.companion[data-performance=defend] .athena-aegis::after{
  box-shadow:inset 0 0 0 1px #9fe6ee40,inset 0 -20px 34px #ecc78133;
}
/* Setbacks cool the light toward indigo instead of brightening it. */
.companion[data-performance=concerned] .athena-aegis,
.companion[data-performance=recover] .athena-aegis{
  background:radial-gradient(100% 80% at 30% 92%,#2c3a6b59 0,#1b234033 40%,transparent 62%);
  mix-blend-mode:soft-light;
}

/* Quiet phase status beside the quote; label text names the mood outright. */
.companion .athena-presence{
  display:flex;flex-direction:column;gap:3px;margin:14px 0 4px;padding:10px 12px;
  border:1px solid #ecc78133;border-left:3px solid var(--gold,#ecc781);border-radius:8px;
  background:#10222e;font-size:12px;line-height:1.55;color:#d8e2e2;
}
.companion .athena-presence-label{font:10px/1.4 system-ui,sans-serif;letter-spacing:1px;color:var(--gold,#ecc781)}
.companion[data-performance=concerned] .athena-presence,
.companion[data-performance=recover] .athena-presence{border-left-color:#8191cb}

/* Frozen snapshot: reduced motion, interruption, or a hidden tab stops every
   decorative animation and transition; the authored static pose, light and current text remain. */
.companion[data-performance-frozen=true],
.companion[data-performance-frozen=true] .portrait img,
.companion[data-performance-frozen=true] .athena-presence-film,
.companion[data-performance-frozen=true] .athena-veil,
.companion[data-performance-frozen=true] .athena-aegis,
.companion[data-performance-frozen=true] .athena-beat-light{animation:none!important;transition:none!important}
.companion[data-performance-frozen=true] .athena-beat-light{opacity:0!important}
@media(prefers-reduced-motion:reduce){
  .companion[data-performance],
  .companion[data-performance] .portrait img,
  .companion .athena-presence-film,
  .companion .athena-veil,
  .companion .athena-aegis,
  .companion .athena-beat-light{animation:none!important;transition:none!important}
  .companion .athena-beat-light{opacity:0!important}
}

@media(forced-colors:active){.companion .athena-beat-light{display:none}}

@media(max-width:760px){
  .companion .athena-presence{margin:12px 0 2px;padding:8px 10px;font-size:11px}
  .companion .athena-veil{opacity:.6}
  .companion .athena-aegis::after{inset:4px;border-radius:8px}
}
@media(max-width:380px){
  .companion .athena-presence-label{letter-spacing:1.5px}
  .companion[data-performance] .portrait img{will-change:auto}
}

/* Keep Athena's face intact on phones. The old full-height side strip enlarged
   and cropped the portrait according to the settings panel's variable height. */
@media(max-width:760px){
  .companion[data-performance]{display:block}
  .companion[data-performance] .portrait{height:210px;min-height:0}
  .companion[data-performance] .portrait img{object-position:74% 32%}
  .companion[data-performance] .companion-body{padding:10px 16px 18px}
}

/* Optional reviewed neutral CGI. It supplies real captured movement only while
   resting/attentive; the original still remains the error/offline/motion fallback. */
.companion .athena-presence-film{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:78% 30%;transform:translateY(var(--ath-pose-y,0px)) scale(var(--ath-pose-scale,1.12));transform-origin:50% 62%;opacity:0;pointer-events:none;z-index:0;transition:opacity .35s ease}
.companion .portrait:is([data-portrait-film=playing],[data-portrait-film=held]) .athena-presence-film{opacity:1}
.companion .portrait:is([data-portrait-film=playing],[data-portrait-film=held]) img{animation:none}
.companion .portrait[data-portrait-film=held] .athena-presence-film{animation:ath-breathe var(--ath-breath,6.4s) ease-in-out infinite}
.companion[data-performance-frozen=true] .athena-presence-film{opacity:0;transition:none}
@media(max-width:760px){.companion .athena-presence-film{object-position:74% 32%}}
@media(prefers-reduced-motion:reduce){.companion .athena-presence-film{display:none}}

.companion .portrait[data-presence-film] img{object-position:78% 30%}
@media(max-width:760px){.companion .portrait[data-presence-film] img{object-position:74% 32%}}

.companion .portrait[data-presence-film]::after{z-index:1;pointer-events:none}
.companion .portrait[data-presence-film] .nameplate,.companion .portrait[data-presence-film]>span{z-index:2}
