/* Phoenix main logo ("Letters rise" reveal) and the app name lockups. Needs tokens.css.
   Source: board/logos.css + logos.js (buildMain, PLAY.main: crest fades up, whole logo glides left, letters rise)
   and board/rules.css (.lk, .lkt). Markup: logo-main.html (logo) and brand-sprite.html (crest used by the lockup).

   Colour: the logo is currentColor. Ink on white, white on black. Put data-theme="dark" on an ancestor
   (or on the logo itself) and it turns to --on-dark.

   Reveal: add data-reveal to the .phx-logo wrapper.
     data-reveal            plays once when the page loads (pure CSS, no script needed)
     data-reveal="view"     plays when it scrolls into view (needs logo.js; without it, it plays on load)
   No data-reveal = a still logo. prefers-reduced-motion: reduce = a still logo, always. */

/* ---------- the main logo ---------- */
.phx-logo {
  --phx-h: 40px;                                   /* height of the crest = height of the whole logo */
  --phx-ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --phx-ease-glide: cubic-bezier(0.65, 0, 0.25, 1);
  display: inline-block; vertical-align: middle; line-height: 0;
  color: var(--ink); text-decoration: none;
}
[data-theme="dark"] .phx-logo, .phx-logo[data-theme="dark"] { color: var(--on-dark); }
.phx-logo .phx-svg { display: block; overflow: visible; height: var(--phx-h); width: auto; }
.phx-logo .phx-tb { transform-box: fill-box; transform-origin: 50% 50%; }
.phx-logo:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: var(--r-14, 14px); }

@media (prefers-reduced-motion: no-preference) {
  /* 1. the crest fades up in the centre   2. the whole logo glides left   3. the letters rise one by one */
  .phx-logo[data-reveal] .phx-crest { animation: phx-crest-in 750ms var(--phx-ease-soft) 100ms both; }
  .phx-logo[data-reveal] .phx-all   { animation: phx-glide 1150ms var(--phx-ease-glide) 900ms both; }
  .phx-logo[data-reveal] .phx-l     { animation: phx-rise 700ms var(--phx-ease-soft) calc(1160ms + var(--i, 0) * 55ms) both; }
}
@keyframes phx-crest-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
@keyframes phx-glide { from { transform: translateX(var(--phx-shift, 0px)); } to { transform: translateX(0); } }
@keyframes phx-rise { from { opacity: 0; transform: translateY(550px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- script hooks (logo.js): scroll-triggered start and replay; harmless for every phx logo ---------- */
[data-reveal].is-armed:not(.is-playing) *, [data-reveal].is-armed:not(.is-playing) { animation-play-state: paused !important; }
[data-reveal].is-reset, [data-reveal].is-reset * { animation: none !important; }

/* ---------- the name lockup: "Phoenix" + the app word in its colour ---------- */
/* <span class="phx-lockup" data-app="reach"><span class="phx-lockup__name"><span class="phx-lockup__p">Phoenix</span> <span class="phx-lockup__w">Reach</span></span></span>
   Size it with font-size. Weight 500, letter-spacing 0. "Phoenix" is black on white and white on black; the app word is
   the -light colour of its kind on white and the -dark colour on black. Optional crest in front (1.33 x cap height). */
.phx-lockup {
  --w-l: var(--mk-mkt-light); --w-d: var(--mk-mkt-dark);       /* Reach: Marketing green */
  --phx-p: var(--black); --phx-w: var(--w-l);
  display: inline-flex; align-items: center; gap: 0.29em;
  font-family: var(--font-display); font-weight: var(--logo-weight); letter-spacing: 0;
  line-height: 1; white-space: nowrap;
}
.phx-lockup[data-app="post"]  { --w-l: var(--mk-mkt-2-light); --w-d: var(--mk-mkt-2-dark); }   /* darker green */
.phx-lockup[data-app="score"] { --w-l: var(--mk-int-light);   --w-d: var(--mk-int-dark); }     /* Team red */
[data-theme="dark"] .phx-lockup, .phx-lockup[data-theme="dark"] { --phx-p: #fff; --phx-w: var(--w-d); }
.phx-lockup__name { white-space: nowrap; }
.phx-lockup__p { color: var(--phx-p); }
.phx-lockup__w { color: var(--phx-w); }
.phx-lockup__crest { display: block; flex: none; width: 0.958em; height: 0.958em; color: var(--phx-p); }
