/*
  The motion layer. Three places move and nothing else:
  1. the hero's entrance, once on load;  2. the dealt moment in its own section (assets/moments);
  3. the hover and press layer below, plus the loops inside the product's own visuals.
  Transform, scale and opacity only (a hover also changes colours).
*/

/* ---------------------------------------------------------------- hover and press */
.btn { transition: background-color var(--m-out) var(--ease), border-color var(--m-out) var(--ease), color var(--m-out) var(--ease), transform var(--m-out) var(--ease); }
.m-arrow { transition: transform var(--m-out) var(--ease); }
.btn:active { transform: translateY(1px) scale(.985); transition-duration: var(--m-press); }
.btn--secondary:active { transform: scale(.985); }

/* links: a faint hairline at rest, an ink line draws from the left and leaves to the right */
.link {
  background-image: linear-gradient(currentColor, currentColor), linear-gradient(var(--line-2), var(--line-2));
  background-repeat: no-repeat;
  background-size: 0 1px, 100% 1px;
  background-position: 100% 100%, 0 100%;
  transition: background-size var(--m-out) var(--ease);
}

/* nav and footer words: bare at rest, a 1px line draws 4px under the word */
.nav__link::after, .footer__col a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 9px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: 100% 50%; transition: transform var(--m-out) var(--ease); }
.footer__col a::after { bottom: 3px; }
.nav__link { transition: color var(--m-out) var(--ease); }
.chev { transition: transform var(--m-panel) var(--ease); }
.nav__item.is-open .chev { transform: rotate(180deg); }
.nav__menu { transform: translateY(-6px); transition: opacity var(--m-close) var(--ease), transform var(--m-close) var(--ease), visibility 0s linear var(--m-close); }
.nav__item.is-open > .nav__menu { transform: none; transition: opacity var(--m-panel) var(--ease), transform var(--m-panel) var(--ease), visibility 0s; }
.menu-link__name { background-image: linear-gradient(currentColor, currentColor); background-repeat: no-repeat; background-size: 0 1px; background-position: 100% 100%; transition: background-size var(--m-out) var(--ease); align-self: flex-start; padding-bottom: 1px; }
.menu-card { transition: transform 120ms var(--ease), border-color 120ms var(--ease), box-shadow 120ms var(--ease); }
.nav__toggle path { transition: transform var(--m-panel) var(--ease); }
.nav__toggle { transition: border-color var(--m-out) var(--ease), background-color var(--m-out) var(--ease); }
.field input { transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease), background-color 140ms var(--ease); }
.field input:focus { outline: none; border-color: var(--lit-ink); box-shadow: 0 0 0 3px rgba(38, 45, 36, .18); background: rgba(255, 255, 255, .78); }
.field input[aria-invalid="true"] { border-color: #8f1d2c; }
.meal { transition: background-color var(--m-out) var(--ease); }
.meals__ind { transition: transform var(--m-slide) var(--m-ease-io); }
.items > li, .items__n, .box, .box > i { transition: background-color var(--m-out) var(--ease), border-color var(--m-out) var(--ease), box-shadow var(--m-out) var(--ease), color var(--m-out) var(--ease); }
.loop-pause { transition: transform var(--m-out) var(--ease), background-color var(--m-out) var(--ease); }
.loop-pause:active { transform: scale(.94); }

@media (hover: hover) and (pointer: fine) {
  .btn:hover, .m-arrow { transition-duration: var(--m-in); }
  .btn--primary:hover { background: color-mix(in srgb, var(--action) 86%, var(--ink)); transform: translateY(-1px); }
  .btn--primary:hover:active { transform: translateY(1px) scale(.985); }
  .btn:hover .m-arrow { transform: translateX(3px); }
  .btn--secondary:hover { text-decoration-color: currentColor; }
  .link:hover { background-size: 100% 1px, 100% 1px; background-position: 0 100%, 0 100%; transition-duration: var(--m-in); }
  .nav__link:hover { color: var(--ink); }
  .nav__link:hover::after, .footer__col a:hover::after { transform: scaleX(1); transform-origin: 0 50%; transition-duration: var(--m-in); }
  .menu-link:hover .menu-link__name { background-size: 100% 1px; background-position: 0 100%; transition-duration: var(--m-in); }
  .menu-card:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: 0 12px 24px -12px rgba(0, 0, 0, .5); transition-duration: 180ms; }
  .nav__toggle:hover { border-color: var(--ink); background: rgba(255, 255, 255, .06); }
  .meal:hover { background: rgba(255, 255, 255, .05); }
  .meal[aria-selected="true"]:hover { background: rgba(255, 255, 255, .08); }
  .meals.has-ind .meal[aria-selected="true"]:hover { background: none; }
  .footer__legal a:hover { text-decoration-color: currentColor; }
  .loop-pause:hover { transform: scale(1.06); }
  .loop-pause:hover:active { transform: scale(.94); }
}
.nav__link:focus-visible::after { transform: scaleX(1); }

/* ---------------------------------------------------------------- the hero's entrance, once on load */
html.m-enter .hero[data-enter]:not(.is-entering):not(.is-entered) :is(.ed, .hero__lead, .btn-row) { opacity: 0; }
html.m-enter.m-enter-done .hero[data-enter]:not(.is-entering):not(.is-entered) :is(.ed, .hero__lead, .btn-row) { opacity: 1; transition: opacity .4s var(--ease); }
.m-w { display: inline-block; overflow: hidden; vertical-align: top; padding: .14em .05em .16em; margin: -.14em -.05em -.16em; }
.m-wi { display: inline-block; transform: translateY(118%); }
.hero.is-entering .m-wi { animation: m-rise .7s var(--m-ease-enter) both; animation-delay: calc(var(--l, 0) * 80ms); }
.hero.is-entering .ed__pill { animation: m-pill .9s var(--m-ease-enter) both; animation-delay: calc(var(--l, 0) * 80ms + .2s); }
.hero.is-entering .ed__pill > img, .hero.is-entering .hero__band img { animation: m-settle 1.1s var(--m-ease-enter) both; }
.hero.is-entering .m-fade { animation: m-fade .52s var(--m-ease-enter) both; animation-delay: calc(var(--m-base, .5s) + var(--n, 0) * 60ms); }
@keyframes m-rise { to { transform: none; } }
@keyframes m-pill { from { clip-path: inset(0 34% round 999px); } to { clip-path: inset(0 0 round 999px); } }
@keyframes m-settle { from { transform: scale(1.06); } to { transform: none; } }
@keyframes m-fade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- the scan loop, inside the open meal (one cycle of 4 s, then again)
   0.12 s: the boxes dim. 0.12 to 0.84 s: the beam crosses the photograph. From 0.48 s each box comes back, 0.17 s apart,
   and its row answers. Then the total. The last 38% of the cycle holds the finished picture. */
[data-ui-loop] { --cycle: 4s; }
[data-ui-loop].is-live .shot__beam { animation: scan-beam var(--cycle) linear infinite; }
[data-ui-loop].is-live .sum > b { animation: scan-sum var(--cycle) var(--ease) infinite; }
[data-ui-loop].is-paused * { animation-play-state: paused !important; }
@keyframes scan-beam {
  0% { opacity: 0; transform: translateY(-100%); }
  3% { opacity: 1; transform: translateY(-100%); }
  21% { opacity: 1; transform: translateY(234%); }
  24%, 100% { opacity: 0; transform: translateY(234%); }
}
@keyframes scan-sum {
  0%, 44% { color: #ffffff; }
  51% { color: var(--accent); }
  62%, 100% { color: #ffffff; }
}
[data-ui-loop].is-live .box[data-i="1"] { animation: scan-box-1 var(--cycle) var(--ease) infinite; }
[data-ui-loop].is-live .items > li[data-i="1"] { animation: scan-row-1 var(--cycle) var(--ease) infinite; }
@keyframes scan-box-1 { 0% { opacity: 1; transform: none; } 3%, 12% { opacity: .2; transform: scale(.96); } 18%, 100% { opacity: 1; transform: none; } }
@keyframes scan-row-1 { 0%, 12% { background-color: rgba(255, 255, 255, 0); } 17% { background-color: rgba(255, 72, 139, .22); } 29%, 100% { background-color: rgba(255, 255, 255, 0); } }
[data-ui-loop].is-live .box[data-i="2"] { animation: scan-box-2 var(--cycle) var(--ease) infinite; }
[data-ui-loop].is-live .items > li[data-i="2"] { animation: scan-row-2 var(--cycle) var(--ease) infinite; }
@keyframes scan-box-2 { 0% { opacity: 1; transform: none; } 3%, 16.25% { opacity: .2; transform: scale(.96); } 22.25%, 100% { opacity: 1; transform: none; } }
@keyframes scan-row-2 { 0%, 16.25% { background-color: rgba(255, 255, 255, 0); } 21.25% { background-color: rgba(255, 72, 139, .22); } 33.25%, 100% { background-color: rgba(255, 255, 255, 0); } }
[data-ui-loop].is-live .box[data-i="3"] { animation: scan-box-3 var(--cycle) var(--ease) infinite; }
[data-ui-loop].is-live .items > li[data-i="3"] { animation: scan-row-3 var(--cycle) var(--ease) infinite; }
@keyframes scan-box-3 { 0% { opacity: 1; transform: none; } 3%, 20.5% { opacity: .2; transform: scale(.96); } 26.5%, 100% { opacity: 1; transform: none; } }
@keyframes scan-row-3 { 0%, 20.5% { background-color: rgba(255, 255, 255, 0); } 25.5% { background-color: rgba(255, 72, 139, .22); } 37.5%, 100% { background-color: rgba(255, 255, 255, 0); } }
[data-ui-loop].is-live .box[data-i="4"] { animation: scan-box-4 var(--cycle) var(--ease) infinite; }
[data-ui-loop].is-live .items > li[data-i="4"] { animation: scan-row-4 var(--cycle) var(--ease) infinite; }
@keyframes scan-box-4 { 0% { opacity: 1; transform: none; } 3%, 24.75% { opacity: .2; transform: scale(.96); } 30.75%, 100% { opacity: 1; transform: none; } }
@keyframes scan-row-4 { 0%, 24.75% { background-color: rgba(255, 255, 255, 0); } 29.75% { background-color: rgba(255, 72, 139, .22); } 41.75%, 100% { background-color: rgba(255, 255, 255, 0); } }
[data-ui-loop].is-live .box[data-i="5"] { animation: scan-box-5 var(--cycle) var(--ease) infinite; }
[data-ui-loop].is-live .items > li[data-i="5"] { animation: scan-row-5 var(--cycle) var(--ease) infinite; }
@keyframes scan-box-5 { 0% { opacity: 1; transform: none; } 3%, 29% { opacity: .2; transform: scale(.96); } 35%, 100% { opacity: 1; transform: none; } }
@keyframes scan-row-5 { 0%, 29% { background-color: rgba(255, 255, 255, 0); } 34% { background-color: rgba(255, 72, 139, .22); } 46%, 100% { background-color: rgba(255, 255, 255, 0); } }
[data-ui-loop].is-live .box[data-i="6"] { animation: scan-box-6 var(--cycle) var(--ease) infinite; }
[data-ui-loop].is-live .items > li[data-i="6"] { animation: scan-row-6 var(--cycle) var(--ease) infinite; }
@keyframes scan-box-6 { 0% { opacity: 1; transform: none; } 3%, 33.25% { opacity: .2; transform: scale(.96); } 39.25%, 100% { opacity: 1; transform: none; } }
@keyframes scan-row-6 { 0%, 33.25% { background-color: rgba(255, 255, 255, 0); } 38.25% { background-color: rgba(255, 72, 139, .22); } 50.25%, 100% { background-color: rgba(255, 255, 255, 0); } }
[data-ui-loop].is-live .box[data-i="7"] { animation: scan-box-7 var(--cycle) var(--ease) infinite; }
[data-ui-loop].is-live .items > li[data-i="7"] { animation: scan-row-7 var(--cycle) var(--ease) infinite; }
@keyframes scan-box-7 { 0% { opacity: 1; transform: none; } 3%, 37.5% { opacity: .2; transform: scale(.96); } 43.5%, 100% { opacity: 1; transform: none; } }
@keyframes scan-row-7 { 0%, 37.5% { background-color: rgba(255, 255, 255, 0); } 42.5% { background-color: rgba(255, 72, 139, .22); } 54.5%, 100% { background-color: rgba(255, 255, 255, 0); } }
[data-ui-loop].is-live .box[data-i="8"] { animation: scan-box-8 var(--cycle) var(--ease) infinite; }
[data-ui-loop].is-live .items > li[data-i="8"] { animation: scan-row-8 var(--cycle) var(--ease) infinite; }
@keyframes scan-box-8 { 0% { opacity: 1; transform: none; } 3%, 41.75% { opacity: .2; transform: scale(.96); } 47.75%, 100% { opacity: 1; transform: none; } }
@keyframes scan-row-8 { 0%, 41.75% { background-color: rgba(255, 255, 255, 0); } 46.75% { background-color: rgba(255, 72, 139, .22); } 58.75%, 100% { background-color: rgba(255, 255, 255, 0); } }

/* ---------------------------------------------------------------- the diagram's pulses: one cycle of 3.2 s */
.dg.is-live .dg__dot { animation: dg-run var(--m-cycle) linear infinite; animation-delay: calc(var(--d, 0) * 1s); }
.dg.is-live .dg__node--out { animation: dg-out var(--m-cycle) var(--ease) infinite; }
.dg.is-paused * , .dg.is-paused { animation-play-state: paused !important; }
@keyframes dg-run {
  0% { opacity: 0; transform: translate(calc(var(--x0) * 1cqw), calc(var(--y0) * 1cqh)); }
  1.5% { opacity: 1; }
  9.3% { transform: translate(calc(var(--x1) * 1cqw), calc(var(--y1) * 1cqh)); }
  18.7% { transform: translate(calc(var(--x2) * 1cqw), calc(var(--y2) * 1cqh)); }
  26.5% { opacity: 1; }
  28% { opacity: 0; transform: translate(calc(var(--x3) * 1cqw), calc(var(--y3) * 1cqh)); }
  100% { opacity: 0; transform: translate(calc(var(--x3) * 1cqw), calc(var(--y3) * 1cqh)); }
}
@keyframes dg-out {
  0%, 84% { box-shadow: 0 0 0 0 rgba(255, 72, 139, 0); background-color: #1d0f18; }
  92% { box-shadow: 0 0 0 6px rgba(255, 72, 139, .28); background-color: #4a1730; }
  100% { box-shadow: 0 0 0 0 rgba(255, 72, 139, 0); background-color: #1d0f18; }
}

/* ---------------------------------------------------------------- phones hold the finished picture; reduced motion rests */
@media (max-width: 639px) {
  [data-ui-loop] .shot__beam, [data-ui-loop] .box, [data-ui-loop] .items > li, [data-ui-loop] .sum > b, .dg .dg__dot, .dg .dg__node--out { animation: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; }
  .btn, .m-arrow, .menu-card, .loop-pause { transition-property: opacity, color, background-color, border-color !important; transform: none !important; }
  .meals__ind, .chev, .nav__toggle path { transition: none !important; }   /* they jump to their place */
  .nav__menu, .nav__item.is-open > .nav__menu { transform: none !important; transition-property: opacity, visibility !important; }
  .link, .menu-link__name { transition: none; }
  .nav__link::after, .footer__col a::after { transition: none; }
  .btn:active { filter: brightness(.9); }
  .loop-pause { display: none; }
  html.m-enter .hero[data-enter] :is(.ed, .hero__lead, .btn-row) { opacity: 1 !important; }
  .m-wi { transform: none; }
}
@media print {
  html.m-enter .hero[data-enter] :is(.ed, .hero__lead, .btn-row) { opacity: 1 !important; }
}
html[data-motion="off"] .hero[data-enter] :is(.ed, .hero__lead, .btn-row) { opacity: 1 !important; }
