/* Motion on the home screens (Theo, 23 Nov 2026: "a simple, epic intro fade in animation to the Home Screen that gives
   it weight and real feel", then "push forward on general animations and effects"). homefx.js switches the classes.
   Everything here is decoration: with it switched off, or for people who ask their device for less motion, every
   screen is complete and still. */

/* ---------------------------------------------------------------- the sound button in the bar (sfx.js fills it) */
.barend { align-self: center; display: flex; align-items: center; gap: clamp(8px, 1.2vw, 18px); }
.sfxhome { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); box-shadow: 0 0 0 1px rgba(241, 230, 208, .14); cursor: pointer; transition: color .2s, box-shadow .2s; }
/* A signed-in player's picture (.me-av, underlay.css) hangs to the left of the name, 36px wide and 12px off. That is
   where this button sat, so the picture covered it and its ring showed round the edge (Theo, 24 Nov 2026). The button
   now stands clear of the picture whenever one is shown. */
@media (min-width: 861px) { .barend:has(.me-av:not([hidden])) .sfxhome { margin-right: 50px; } }
.sfxhome:hover { color: var(--ink); box-shadow: 0 0 0 1px rgba(241, 230, 208, .4); }
.sfxhome:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.sfxhome[aria-pressed="true"] { color: var(--danger); }

/* ---------------------------------------------------------------- the Play screen at rest */
/* the brand's horizon, under the welcome: four stripes, the same ones the tabs stand on */
.lead-text .horizon { display: block; width: clamp(150px, 17vw, 300px); height: 14px; margin-top: clamp(12px, 1.8vh, 20px); transform-origin: 0 50%; background:
  linear-gradient(var(--amber), var(--amber)) 0 0 / 100% 4px no-repeat, linear-gradient(var(--peach), var(--peach)) 0 6px / 82% 3px no-repeat,
  linear-gradient(var(--danger), var(--danger)) 0 10px / 58% 2px no-repeat, linear-gradient(var(--plum), var(--plum)) 0 13px / 34% 1px no-repeat; }
/* the painting is never quite still */
.panel.lead > .art { animation: hx-drift 52s ease-in-out infinite alternate; }
@keyframes hx-drift { from { transform: scale(1.04); } to { transform: scale(1.12) translate(-1.4%, -1%); } }
/* a play button catches the light as the pointer reaches it */
.pl, .plo { position: relative; overflow: hidden; }
.pl::before, .plo::before { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 46%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent); transform: skewX(-18deg); opacity: 0; pointer-events: none; }
.pl:hover:not(:disabled)::before, .plo:hover:not(:disabled)::before { animation: hx-sheen .8s cubic-bezier(.16, 1, .3, 1); }
@keyframes hx-sheen { 0% { left: -60%; opacity: 0; } 20% { opacity: 1; } 100% { left: 120%; opacity: 0; } }

/* ---------------------------------------------------------------- the opening: once per visit
   Out of black the painting comes up and pushes in under cinema bars; the welcome tracks in and the horizon draws
   under it; the bars lift; then the ways to play rise one after another and the side column slides in.
   About three seconds. Nothing is covered: every button works from the first frame. */
body.homeintro .panel.lead > .art { animation: hx-open 3.4s cubic-bezier(.2, .7, .2, 1) both, hx-drift 52s ease-in-out 3.4s infinite alternate; }
/* The opening takes the whole screen (Theo, 24 Nov 2026: "the top navigation bar on desktop isn't included in it which
   makes it seem glitched, on mobile it also doesn't cover the whole screen and looks broken"). It used to happen inside
   the stage only, so the navigation bar sat outside it and a phone's tabs showed round its edges. Now the whole page
   comes up out of black, and the cinema bars are the screen's own top and bottom, over the navigation and the tabs. */
body.homeintro::before { content: ""; position: fixed; inset: 0; z-index: 69; background: #000; pointer-events: none; animation: hx-veil 1.25s ease-out both; }
body.homeintro #stage::before, body.homeintro #stage::after { content: ""; position: fixed; left: 0; right: 0; z-index: 70; height: max(12vh, 78px); background: #000; pointer-events: none; animation: hx-bar 1s cubic-bezier(.7, 0, .2, 1) 1.9s both; }
body.homeintro #stage::before { top: 0; transform-origin: 50% 0; }
body.homeintro #stage::after { bottom: 0; transform-origin: 50% 100%; }
body.homeintro #bar { animation: hx-fade 1.2s ease-out 1.5s both; }
body.homeintro .lead-text h1 { animation: hx-title 1.7s cubic-bezier(.16, 1, .3, 1) .7s both; }
body.homeintro .lead-text .horizon { animation: hx-rule 1.2s cubic-bezier(.16, 1, .3, 1) 1.5s both; }
body.homeintro .lead-text .resume, body.homeintro .lead-text .plrow, body.homeintro .lead-text .lead-note, body.homeintro .lead-text .a2hs { animation: hx-rise .9s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(2s + var(--n, 4) * 110ms); }
body.homeintro .lead-text .plrow:nth-child(1) { --n: 0; } body.homeintro .lead-text .plrow:nth-child(2) { --n: 1; }
body.homeintro .lead-text .plrow:nth-child(3) { --n: 2; } body.homeintro .lead-text .plrow:nth-child(4) { --n: 3; }
body.homeintro .lead-text .resume { --n: 0; }
body.homeintro #p-home .side { animation: hx-side 1.1s cubic-bezier(.16, 1, .3, 1) 2.2s both; }
@keyframes hx-open { from { transform: scale(1.2); filter: brightness(0) saturate(.3); } 38% { filter: brightness(1) saturate(1); } to { transform: scale(1.04); filter: brightness(1) saturate(1); } }
@keyframes hx-bar { to { transform: scaleY(0); } }
@keyframes hx-veil { from { opacity: 1; } to { opacity: 0; } }
@keyframes hx-fade { from { opacity: 0; } }
@keyframes hx-title { from { opacity: 0; letter-spacing: .3em; filter: blur(12px); transform: translateY(10px); } }
@keyframes hx-rule { from { opacity: 0; transform: scaleX(0); } }
@keyframes hx-rise { from { opacity: 0; transform: translateY(22px); } }
@keyframes hx-side { from { opacity: 0; transform: translateX(34px); } }

/* ---------------------------------------------------------------- Decks: plates and cards arrive in turn */
.fplates .plate2, .dplates .plate2 { animation: hx-plate .8s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--n, 0) * 70ms); }
.plate2:nth-child(2) { --n: 1; } .plate2:nth-child(3) { --n: 2; } .plate2:nth-child(4) { --n: 3; } .plate2:nth-child(5) { --n: 4; } .plate2:nth-child(6) { --n: 5; }
.fachead { animation: hx-rise .8s cubic-bezier(.16, 1, .3, 1) both; }
.cgrid .cd { animation: hx-card .55s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--n, 12) * 28ms); }
.cgrid .cd:nth-child(1) { --n: 0; } .cgrid .cd:nth-child(2) { --n: 1; } .cgrid .cd:nth-child(3) { --n: 2; } .cgrid .cd:nth-child(4) { --n: 3; }
.cgrid .cd:nth-child(5) { --n: 4; } .cgrid .cd:nth-child(6) { --n: 5; } .cgrid .cd:nth-child(7) { --n: 6; } .cgrid .cd:nth-child(8) { --n: 7; }
.cgrid .cd:nth-child(9) { --n: 8; } .cgrid .cd:nth-child(10) { --n: 9; } .cgrid .cd:nth-child(11) { --n: 10; } .cgrid .cd:nth-child(12) { --n: 11; }
@keyframes hx-plate { from { opacity: 0; transform: translateY(26px) scale(.97); } }
@keyframes hx-card { from { opacity: 0; transform: translateY(14px) rotateX(18deg); } }

/* a card leans toward the pointer and light slides across its face (homefx.js sets --rx, --ry, --gx, --gy) */
.cgrid { perspective: 1100px; }
.cd.tilt { transform: translateY(-6px) rotateX(calc(var(--rx, 0) * 1deg)) rotateY(calc(var(--ry, 0) * 1deg)) scale(1.04); transition: transform .12s linear, box-shadow .25s; z-index: 1; }
.cd::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at calc(var(--gx, 50) * 1%) calc(var(--gy, 50) * 1%), rgba(255, 255, 255, .34), transparent 46%); mix-blend-mode: overlay; opacity: 0; transition: opacity .25s; pointer-events: none; }
.cd.tilt::after { opacity: 1; }

/* the card you open turns to face you */
.cardview2[open] { animation: hx-cv .5s cubic-bezier(.16, 1, .3, 1); }
.cardview2[open]::backdrop { animation: hx-fade .4s ease-out; }
.cardview2[open] img { animation: hx-cvimg .7s cubic-bezier(.16, 1, .3, 1); transform-origin: 0 50%; }
.cardview2[open] .cvtext > * { animation: hx-rise .6s cubic-bezier(.16, 1, .3, 1) .12s both; }
@keyframes hx-cv { from { opacity: 0; transform: scale(.95); } }
@keyframes hx-cvimg { from { transform: perspective(900px) rotateY(-22deg); filter: brightness(1.5); } }

/* ---------------------------------------------------------------- Progress and Profile: the numbers fill, the art breathes */
#p-progress > .art, #p-profile > .art { animation: hx-drift 60s ease-in-out infinite alternate; }
.facp { transition: transform .35s cubic-bezier(.16, 1, .3, 1), box-shadow .25s; }
.facp:hover, .facp:focus-visible { transform: translateY(-4px); }

@media (max-width: 860px) {
  .sfxhome { width: 34px; height: 34px; }
  body.homeintro #stage::before, body.homeintro #stage::after { height: 6vh; }
  body.homeintro #tabs { animation: hx-fade 1.2s ease-out 1.8s both; }
}
@media (prefers-reduced-motion: reduce) {
  .panel.lead > .art, #p-progress > .art, #p-profile > .art, .fplates .plate2, .dplates .plate2, .fachead, .cgrid .cd, .cardview2[open], .cardview2[open] img, .cardview2[open] .cvtext > * { animation: none !important; }
  .pl::before, .plo::before, .cd::after { display: none; }
  .cd.tilt { transform: none; }
}

/* Into a game: the screen goes to the dark the game page starts from (home.js, toGame). */
body.leaving::after { content: ""; position: fixed; inset: 0; z-index: 200; background: #0E0A1C; animation: hx-leave .28s ease-in both; }
@keyframes hx-leave { from { opacity: 0; } }
