/* ST. ALi visual menu prototype v2.
   Layout: fixed header, a fixed stage holding a single centred rail, native scroll drives card scale.
   Colours and bag settings are in CONFIG at the top of the script. */
:root{
  --ground:#7E521B; --cream:#F7F2EA; --ink:#000; --white:#fff;
  --sans:"Helvetica Neue","HelveticaNeue",Helvetica,Arial,sans-serif;
  --col:430px; --tabs-h:38px; --acts-h:48px;
  color-scheme:light;
}
*{box-sizing:border-box}
html,body{height:100%}
/* No sideways scroll, and no pull-to-refresh or bounce at the ends of the rail. */
html{overflow-x:hidden;overscroll-behavior:none}
body{margin:0;background:var(--ground);color:var(--ink);font-family:var(--sans);font-weight:700;-webkit-font-smoothing:antialiased;transition:background-color .45s ease;-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer}
button:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
#spacer{width:1px}
#stage{position:fixed;inset:0;overflow:hidden;pointer-events:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
#stage .slot{position:absolute;left:0;top:0;transform-origin:0 0;will-change:transform;pointer-events:auto}

/* header */
#bar{position:fixed;left:0;right:0;top:0;z-index:5;padding-top:env(safe-area-inset-top,0px);background:var(--ground);transition:background-color .45s ease}
#bar .in{width:100%}
#tabs{display:flex;height:39px}
#tabs button{flex:1 0 auto;padding:0 6px;font-size:clamp(14px,5.3vw,20px);line-height:39px;letter-spacing:-.02em;text-align:left;white-space:nowrap;transition:flex-grow .4s ease}
#tabs button.on{flex-grow:4}
#acts{display:flex;justify-content:space-between;align-items:center;height:var(--acts-h);padding:5px}
#acts .grp{display:flex;gap:10px}
/* scrolling note under the tabs: the text is repeated, and the track slides left by half its width, so the loop has no seam */
#tick{overflow:hidden;white-space:nowrap;height:22px;background:var(--white);font-size:12px;line-height:22px;letter-spacing:-.02em}
#tick .tr{display:inline-block;animation:tick 42s linear infinite;will-change:transform}
#tick span{display:inline-block;padding-right:2.6em}
@keyframes tick{to{transform:translate3d(-50%,0,0)}}
.ic{width:38px;height:38px;display:grid;place-items:center;position:relative;touch-action:manipulation}
.ic svg{width:28px;height:28px;display:block;overflow:visible}
.ic svg path{fill:none;stroke:var(--ink);stroke-width:1.8;stroke-linejoin:round;stroke-linecap:round;transition:fill .15s ease}
.ic.heart[aria-pressed="true"] svg path{fill:var(--ink)}
.ic.heart.pop svg{animation:pop .35s cubic-bezier(.3,1.6,.5,1)}
@keyframes pop{0%{transform:scale(1)}40%{transform:scale(1.3)}100%{transform:scale(1)}}
#navHeart .n{position:absolute;right:-2px;top:2px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:var(--ink);color:var(--white);font-size:10px;line-height:16px;text-align:center}
#navHeart .n:empty{display:none}

/* rail objects */
.card{width:var(--cw);border-radius:15px;padding:13px;background:var(--cream);display:flex;flex-direction:column;gap:7px;touch-action:manipulation}
.card .row{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;font-size:24px;line-height:1.15;letter-spacing:-.01em}
.card h2{font:inherit;margin:0;min-width:0}
.card .ph{position:relative;width:100%;aspect-ratio:346/456;overflow:hidden;background:#e8e2da}
.card .ph img{width:100%;height:100%;object-fit:cover;display:block;-webkit-user-drag:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.card .burst{position:absolute;left:50%;top:50%;width:38%;margin:-19% 0 0 -19%;opacity:0;pointer-events:none;filter:drop-shadow(0 2px 12px rgba(0,0,0,.25))}
.card .burst path{fill:var(--white)}
.card .burst.go{animation:burst .8s ease-out forwards}
@keyframes burst{0%{opacity:0;transform:scale(.2)}15%{opacity:1;transform:scale(1.15)}30%{transform:scale(.95)}45%{transform:scale(1)}80%{opacity:1}100%{opacity:0;transform:scale(1)}}
.card .desc,.card .adds,.card .diet{font-weight:400;font-size:12px;line-height:1.2}
.card .adds{display:grid;grid-template-columns:1fr auto;column-gap:10px}
.card .acts{display:flex;justify-content:space-between;margin:0 -5px -5px}

.mast{width:var(--cw);min-height:calc(var(--cw) * 1.1);display:flex;flex-direction:column;justify-content:center;align-items:center;gap:7px;text-align:center}
.mast .t,.quote .t,.foot .t{font-size:calc(var(--cw) * .145);line-height:1;letter-spacing:-.02em;margin:0}
.mast .s,.quote .s,.foot .s{font-size:12px;line-height:1;letter-spacing:-.02em;margin:0}
.mast .a{font-weight:400;line-height:1.25;white-space:pre-line;margin-top:2px}
.quote{width:var(--cw);display:flex;flex-direction:column;gap:7px;text-align:center;padding:10px 0}
.quote .s,.foot .s{font-weight:400}
.bag{width:var(--cw);display:flex;justify-content:center}
.bag .bx{position:relative;width:88%;aspect-ratio:1/1}
.bag canvas{position:absolute;display:block}
.foot{width:var(--colw);display:flex;flex-direction:column;gap:7px;text-align:center;padding:20px 0 calc(40px + env(safe-area-inset-bottom,0px))}
.foot .t{font-size:54px}
/* studio credit under the foot: small, one line */
.footw{width:var(--colw);display:flex;flex-direction:column;align-items:center}
.footw.has-cr .foot{padding-bottom:26px}
.cr{display:inline-flex;align-items:center;gap:6px;padding:8px 12px calc(26px + env(safe-area-inset-bottom,0px));font-weight:400;font-size:10px;line-height:1;letter-spacing:.02em;color:var(--ink);text-decoration:none}
.cr img{width:18px;height:18px;border-radius:50%;display:block}

/* list sheet */
#sheet{position:fixed;inset:0;z-index:20;touch-action:none;display:flex;justify-content:center;align-items:flex-end;background:rgba(0,0,0,.25);opacity:0;pointer-events:none;transition:opacity .25s ease}
#sheet.open{opacity:1;pointer-events:auto}
#sheet .panel{width:100%;max-width:var(--col);max-height:88%;display:flex;flex-direction:column;background:var(--cream);border-radius:15px 15px 0 0;transform:translateY(100%);transition:transform .35s cubic-bezier(.2,.8,.2,1);padding-bottom:env(safe-area-inset-bottom,0px)}
#sheet.open .panel{transform:none}
#sheet .hd{display:flex;justify-content:space-between;align-items:center;padding:13px 13px 6px;font-size:24px;letter-spacing:-.01em}
#sheet .hd button{font-size:12px}
#sheet ul{list-style:none;margin:0;padding:0 13px;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;flex:1;display:grid;grid-template-columns:repeat(3,1fr);gap:3px;align-content:start}
#sheet li{aspect-ratio:1/1}
#sheet li button{display:block;width:100%;height:100%}
#sheet li img{width:100%;height:100%;object-fit:cover;display:block;-webkit-touch-callout:none}
#sheet .note{padding:4px 13px 0;font-size:14px;line-height:1.2;letter-spacing:-.01em}
#sheet .empty{grid-column:1/-1;aspect-ratio:auto!important;padding:24px 0 40px;font-weight:400;font-size:14px;line-height:1.3}
#sheet .ft{display:flex;gap:10px;padding:13px}
#sheet .ft button{flex:1;height:48px;border-radius:24px;background:var(--ink);color:var(--white);font-size:14px}
#sheet .ft button.alt{background:none;color:var(--ink);box-shadow:inset 0 0 0 2px var(--ink)}

#toast{position:fixed;left:50%;bottom:calc(24px + env(safe-area-inset-bottom,0px));z-index:30;transform:translate(-50%,20px);opacity:0;padding:10px 16px;border-radius:20px;background:var(--ink);color:var(--white);font-size:13px;transition:opacity .2s ease,transform .2s ease;pointer-events:none}
#toast.on{opacity:1;transform:translate(-50%,0)}

/* desktop cover */
#cover{position:fixed;inset:0;z-index:40;display:none;align-items:center;justify-content:center;background:var(--ground);padding:40px;text-align:center}
#cover.on{display:flex}
#cover .in{display:flex;flex-direction:column;align-items:center;gap:22px;max-width:900px}
#cover .t{font-size:clamp(54px,9vw,150px);line-height:1;letter-spacing:-.03em;margin:0}
#cover .m{font-size:clamp(20px,2.2vw,32px);line-height:1.05;letter-spacing:-.02em;margin:0;max-width:26ch}
#qr{width:168px;height:168px;padding:12px;background:var(--cream);border-radius:15px}
#qr img,#qr canvas{width:144px!important;height:144px!important;display:block}
#cover .u{font-weight:400;font-size:12px}
#cover button{font-size:12px;text-decoration:underline;text-underline-offset:3px}

@media (prefers-reduced-motion: reduce){
  body,#bar,#sheet,#sheet .panel,#toast{transition:none}
  .ic.heart.pop svg,.card .burst.go{animation:none}
  #tick{text-align:center}
  #tick .tr{animation:none}
  #tick span{padding:0}
  #tick span+span{display:none}
}
