/* Truco Showdown - effects: the press of every button, the loops (few, small, only transform / opacity) and the pieces that
   only exist while something moves. The times come from FEEL.css (src/config.js) as --f-<name>.
   Less motion: entries last 1 ms (never `none`: turning the option off would replay them). The loops stand still where
   they are (paused), so turning the option on or off never makes anything jump. */
:root {
  --spring: cubic-bezier(0.3, 1.9, 0.5, 1);
}
.screen[data-leaving] {
  display: block;
  z-index: 3;
  pointer-events: none;
}
#app[data-boot] :is(#scene, .stage, .corner) {
  visibility: hidden;
}
.screen[data-hold] {
  visibility: hidden;
} /* its pieces come in together with the picture behind them */

/* ---------- press: down at once, up with a spring. `translate` / `scale` only, so it adds to any entry ---------- */
.pill,
.icon-btn,
.tbtn,
.seg button,
.tile,
.q-rules {
  transition:
    translate var(--f-press-out) var(--spring),
    scale var(--f-press-out) var(--spring);
}
:is(.pill, .icon-btn, .tbtn, .seg button, .tile, .q-rules)[data-down] {
  transition-duration: var(--f-press-in);
  transition-timing-function: ease-out;
  filter: brightness(0.88);
}
.pill[data-down] {
  translate: 0 calc(var(--h) * 0.09);
  scale: 0.95 0.91;
}
.seg button[data-down] {
  translate: 0 calc(var(--h) * 0.07);
  scale: 0.94 0.9;
}
:is(.icon-btn, .tbtn)[data-down] {
  scale: 0.86;
}
.tile[data-down] {
  translate: 0 calc(var(--u) * 6);
  scale: 0.93 0.9;
}
.q-rules[data-down] {
  translate: 0 calc(var(--u) * 4);
  scale: 0.97 0.93;
}
.opt > span,
.opt .arr {
  transition: translate var(--f-press-out) var(--spring);
}
.opt[data-down] > span,
.opt[data-down] .arr {
  translate: calc(var(--pu) * 8) 0;
  transition-duration: var(--f-press-in);
}
.opt[data-down] .switch::after {
  scale: 1.1 0.92;
}
@media (hover: hover) {
  .pill:not(:disabled, [data-down]):hover,
  .tile:not([data-down]):hover {
    translate: 0 -4%;
  }
  .icon-btn:not([data-down]):hover {
    scale: 1.06;
  }
}
.slider .kn {
  transition: scale var(--f-press-out) var(--spring);
}
.slider:has(.range:active) .kn {
  scale: 1.24;
  transition-duration: var(--f-press-in);
}
.slider:has(.range:active) .fil {
  filter: brightness(1.12);
}
.vol .ic {
  transition: scale var(--f-press-out) var(--spring);
}
.vol:has(.range:active) .ic {
  scale: 1.14;
}

/* Loops. Measured on WebKit (1854x1285): string lights + breathing repainting at every frame took the table from
   62 to 17 fps. So each slow loop moves in small steps (`steps`, less than a pixel or 5% of light each: the eye sees it
   smooth) and the soft start and end come from the keyframes (five points of a sine). Same look, 60 fps.
   On the title, the menu and the circuit ALL of them step on the same clock, 0.1 s (time of a loop / its parts
   / its steps = 0.1 s, every delay a multiple of 0.1 s), so the window is painted again 10 times a second, not once for
   each loop (circuit 41 -> 53 fps). Not on the table: its few small loops are cheaper apart (64 fps; together 45). */
@keyframes breath {
  12.5%,
  87.5% {
    transform: scale(1.002, 1.0053);
  }
  25%,
  75% {
    transform: scale(1.007, 1.018);
  }
  37.5%,
  62.5% {
    transform: scale(1.012, 1.0307);
  }
  50% {
    transform: scale(1.014, 1.036);
  }
}
@keyframes bulb {
  12.5%,
  87.5% {
    opacity: 0.2522;
    transform: scale(1.0321);
  }
  25%,
  75% {
    opacity: 0.5;
    transform: scale(1.11);
  }
  37.5%,
  62.5% {
    opacity: 0.7478;
    transform: scale(1.1879);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.22);
  }
}
@keyframes light {
  12.5%,
  87.5% {
    opacity: 0.4449;
  }
  25%,
  75% {
    opacity: 0.675;
  }
  37.5%,
  62.5% {
    opacity: 0.9051;
  }
  50% {
    opacity: 1;
  }
}
@keyframes tile-light {
  12.5%,
  87.5% {
    opacity: 0.06;
  }
  25%,
  75% {
    opacity: 0.2;
  }
  37.5%,
  62.5% {
    opacity: 0.34;
  }
  50% {
    opacity: 0.4;
  }
} /* never washed out: it stays yellow */
@keyframes logo-breath {
  12.5%,
  87.5% {
    scale: 1.0032;
    rotate: 0.1022deg;
  }
  25%,
  75% {
    scale: 1.011;
    rotate: 0.35deg;
  }
  37.5%,
  62.5% {
    scale: 1.0188;
    rotate: 0.5978deg;
  }
  50% {
    scale: 1.022;
    rotate: 0.7deg;
  }
}
@keyframes beat {
  12.5%,
  87.5% {
    transform: scale(1.0204);
  }
  25%,
  75% {
    transform: scale(1.07);
  }
  37.5%,
  62.5% {
    transform: scale(1.1196);
  }
  50% {
    transform: scale(1.14);
  }
}

/* ---------- scene: a still picture; petals, and on the table the string lights ---------- */
.scene .bulb {
  position: absolute;
  opacity: 0.15;
  pointer-events: none;
  animation: bulb var(--f-bulb) calc(var(--n) * 0.47s) steps(4) infinite;
}
.scene .bulb:nth-child(odd) {
  animation-duration: calc(var(--f-bulb) * 1.3);
}
.scene .petal {
  position: absolute;
  opacity: 0;
  background: url(../assets/img/vida/petalas.webp) calc(var(--n) * 50%) 0 / 300% 100% no-repeat;
  pointer-events: none;
  animation: petal calc(var(--f-petal) + var(--n) * 2.3s) calc(var(--n) * 2.6s + 0.6s) linear infinite;
}
.scene .petal.leaf {
  background-image: url(../assets/img/vida/folhas.webp);
} /* places without bougainvillea */
@keyframes petal {
  6% {
    opacity: 1;
  }
  22% {
    transform: translate(340%, 260%) rotate(150deg) rotateY(60deg);
  }
  40% {
    transform: translate(760%, 330%) rotate(230deg) rotateY(160deg);
  }
  58% {
    transform: translate(1120%, 600%) rotate(390deg) rotateY(230deg);
  }
  76% {
    opacity: 1;
    transform: translate(1560%, 700%) rotate(480deg) rotateY(330deg);
  }
  90%,
  100% {
    opacity: 0;
    transform: translate(1850%, 960%) rotate(600deg) rotateY(400deg);
  }
}
@media (orientation: portrait) {
  .scene .petal {
    animation-name: petal-p;
  }
}
@keyframes petal-p {
  6% {
    opacity: 1;
  }
  26% {
    transform: translate(260%, 240%) rotate(150deg) rotateY(60deg);
  }
  48% {
    transform: translate(520%, 320%) rotate(230deg) rotateY(160deg);
  }
  72% {
    opacity: 1;
    transform: translate(860%, 620%) rotate(390deg) rotateY(230deg);
  }
  90%,
  100% {
    opacity: 0;
    transform: translate(1100%, 860%) rotate(520deg) rotateY(330deg);
  }
}

/* ---------- title and menu ---------- */
.logo {
  animation: logo-breath var(--f-logo-breath) 1.2s steps(6) infinite;
  transform-origin: 50% 60%;
}

/* ---------- circuit: the current match breathes by light, its number beats softly ---------- */
.tile b,
.tile .stars,
.tile .lock {
  position: relative;
  z-index: 1;
}
.tile.next::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url(../assets/img/vida/tile-light.webp) center / 100% 100% no-repeat;
  opacity: 0;
  animation: tile-light var(--f-light) steps(3) infinite;
}
.tile.next b {
  animation: beat var(--f-light) steps(3) infinite;
}

/* the rivals of the table breathe and change their faces (screens.js); the current match breathes as a whole */
.c-rivals .av .bust {
  position: absolute;
  inset: 0;
  transform-origin: 50% 100%;
  animation: breath var(--f-breath-a) steps(4) infinite;
}
.c-rivals .av:last-child .bust {
  animation-duration: calc(var(--f-breath-a) * 1.25);
  animation-timing-function: steps(5);
  animation-delay: -1.4s;
}
.c-rivals .bust img {
  opacity: 0;
}
.c-rivals .bust img[data-on] {
  opacity: 1;
}
.tile.next {
  animation: tile-next var(--f-light) steps(3) infinite;
}
@keyframes tile-next {
  12.5%,
  87.5% {
    transform: scale(1.007);
  }
  25%,
  75% {
    transform: scale(1.025);
  }
  37.5%,
  62.5% {
    transform: scale(1.043);
  }
  50% {
    transform: scale(1.05);
  }
}

/* ---------- table ---------- */
/* each friend breathes from the cut of the bust, at their own pace, and leans toward whoever has the turn */
.seat .bust {
  position: absolute;
  inset: 0;
  transform-origin: 50% 100%;
  rotate: var(--lean, 0deg);
  translate: var(--leanx, 0) 0;
  transition:
    rotate 0.42s cubic-bezier(0.3, 1.5, 0.5, 1),
    translate 0.42s cubic-bezier(0.3, 1.5, 0.5, 1);
  animation: breath var(--f-breath-a) calc(var(--n) * 0.5s) steps(6) infinite;
}
.seat:nth-child(2) .bust {
  animation-duration: var(--f-breath-b);
}
.seat:nth-child(3) .bust {
  animation-duration: var(--f-breath-c);
}
.seat .bust img {
  opacity: 0;
}
.seat .bust img[data-on] {
  opacity: 1;
}
.seat .fan .card {
  transition: transform 0.22s cubic-bezier(0.2, 1.4, 0.4, 1);
}
/* the back (or the face) glued over a card that will turn over */
.card .cover-back {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: url(../assets/img/ui/back.webp) center / 100% 100% no-repeat;
}
.card .veil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  transform: none;
  filter: none;
}
/* golden glow under a card on the table: it lies exactly like the card (the art has a margin of 22% of the card) */
:is(.slot, .vira) > .halo,
.slot > .shade {
  --cw: var(--lw);
  position: absolute;
  left: calc(var(--cw) * -0.22);
  top: 50%;
  width: calc(var(--cw) * 1.44);
  height: calc(var(--cw) * 1.84);
  max-width: none;
  transform: translateY(-50%) rotateX(var(--f-tilt)) rotate(var(--turn, 0deg));
  opacity: 0;
  transition: opacity 0.22s;
  pointer-events: none;
}
.slot > .shade {
  left: calc(var(--cw) * -0.35);
  width: calc(var(--cw) * 1.7);
  height: calc(var(--cw) * 2.1);
  transition: none;
}
.slot:has(.card.win) > .halo {
  scale: 1.14;
}
.trick-tag.zap {
  --nh: calc(var(--ph) * 4.6);
  z-index: 41;
  left: 112%;
  bottom: 15%;
  translate: none;
  transform-origin: 0 50%;
  border-image-source: url(../assets/img/ui/band-yellow.webp);
  color: var(--navy);
  font-size: calc(var(--nh) * 0.66);
}
.slot:is([data-side='left'], [data-side='right']) > .trick-tag.zap {
  left: 50%;
  bottom: 120%;
  translate: -50% 0;
  transform-origin: 50% 100%;
}
@media (orientation: landscape) {
  .trick-tag.zap {
    --nh: calc(var(--ph) * 7.4);
  }
}
/* loose pieces: copies that fly over everything and are removed when they arrive */
.loose {
  position: fixed !important;
  z-index: 56;
  margin: 0 !important;
  translate: none;
  pointer-events: none;
}
body:has(#overlays .ov) :is(.flying, .loose) {
  visibility: hidden;
} /* never over a panel */
.fly-pts {
  display: grid;
  place-items: center;
  height: var(--nh);
  min-width: calc(var(--nh) * 1.9);
  padding: 0 0 calc(var(--nh) * 0.12);
  border: solid transparent;
  border-width: 0 calc(var(--nh) * 0.4);
  border-image: url(../assets/img/ui/band-teal.webp) 0 30 fill;
  font-size: calc(var(--nh) * 0.62);
  line-height: 1;
  font-weight: 700;
}
.fly-pts.them {
  border-image-source: url(../assets/img/ui/band-magenta.webp);
}

/* ---------- result: the winners bounce from their feet ---------- */
.ov-result .res-faces img {
  transform-origin: 50% 100%;
}
.ov-result.won .res-faces img {
  animation: cheer var(--f-cheer) 1s cubic-bezier(0.4, 0, 0.4, 1) infinite alternate;
}
.ov-result.lost .res-faces .side,
.ov-result.lost .res-faces .hero[src*='-cheer'] {
  animation: cheer calc(var(--f-cheer) * 1.5) 1.2s cubic-bezier(0.4, 0, 0.4, 1) infinite alternate;
}
.ov-result.lost .res-faces .s1 {
  animation-delay: 1.5s;
}
@keyframes cheer {
  to {
    transform: translateY(-4.5%) scale(1.03, 1.05);
  }
}

/* ---------- less motion ---------- */
.less-motion :is(.waiting img, .bulb, .petal, .logo, .tile.next, .tile.next b, .bust, .res-faces img),
.less-motion .tile.next::after,
.less-motion .seat.waits .frame::before {
  animation-play-state: paused;
}
.less-motion :is(.pill, .icon-btn, .tbtn, .tile, .q-rules, .seg button, .bust, .kn, .ic, .opt > span, .opt .arr),
.less-motion :is(.hand, .fan, .slot) .card,
.less-motion .switch::after {
  transition-duration: 1ms;
}
/* no soft shadow on the cards in the air (dealing) nor on the small fans: 5 fps on WebKit at 1854 x 1285 */
#app[data-dealing] ~ .flying,
.seat .fan .card.back {
  box-shadow: none;
}
#app[data-dealing] :is(.bulb, .bust) {
  animation-play-state: paused;
}
/* End of css/juice.css (complete file). */
