/* Hero demo: a simplified MealSage screen that plays plan, today, groceries, pantry, then recipes.
   The markup is the finished state. The script adds .anim (never with reduced motion) to hide
   parts and bring them back in order, so without JS or with reduced motion every step is complete.
   Shared by index.html and mealime.html; the markup is repeated in both. */
.demo{margin:0;min-width:0;width:100%;max-width:460px}
.d-cap{margin-top:14px;font-size:.86rem;color:var(--muted)}
.d-frame{background:var(--card);border:1px solid var(--line);border-radius:26px;box-shadow:0 0 0 7px var(--acc-soft);overflow:hidden;display:flex;flex-direction:column}
.d-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px 8px 16px;border-bottom:1px solid var(--line)}
.d-brand{display:flex;align-items:center;gap:8px;font:700 .95rem var(--display)}
.d-brand svg{width:22px;height:22px}
.d-pause{font:700 .82rem var(--body);color:var(--fg);background:transparent;border:1px solid var(--line);border-radius:999px;padding:4px 14px;min-height:32px;cursor:pointer}
.d-pause:hover{border-color:var(--muted)}
/* touch screens: a 44px-tall hit area around the 32px button */
@media (pointer:coarse){.d-pause{position:relative}.d-pause::before{content:"";position:absolute;left:0;right:0;top:-6px;bottom:-6px}}
.d-pause[hidden]{display:inline-block;visibility:hidden}
.d-stage{position:relative;height:25rem}
.d-scene{position:absolute;inset:0;overflow:hidden;padding:14px 16px;display:flex;flex-direction:column;gap:10px;opacity:0;visibility:hidden}
.d-scene.is-on{opacity:1;visibility:visible}
.d-title{font:800 1.3rem/1.2 var(--display);letter-spacing:-.01em}
.d-title span{font:400 .86rem var(--body);color:var(--muted);letter-spacing:0;margin-left:6px;white-space:nowrap}
.d-foot{margin-top:auto;display:flex;align-items:center;justify-content:space-between;gap:14px;background:var(--acc-soft);border-radius:14px;padding:10px 14px;min-width:0}
.d-foot small{display:block;font-size:.82rem;line-height:1.35;color:var(--muted)}
.d-foot>div>small{white-space:nowrap}
.d-foot.col{flex-direction:column;align-items:flex-start;gap:2px}
.d-big{display:block;font:800 1.35rem/1.15 var(--display);font-variant-numeric:tabular-nums;white-space:nowrap}

/* step 1: the week */
.d-week{list-style:none;margin:0;padding:0}
.d-week li{position:relative;display:grid;grid-template-columns:2.3rem minmax(0,1fr);gap:8px;padding:6px 0;border-bottom:1px dashed var(--line)}
.d-week li:last-child{border-bottom:0}
.d-day{font:700 .86rem/1.5 var(--display);color:var(--muted)}
.d-dish b{display:block;font:600 1rem/1.3 var(--display)}
.d-dish small{display:block;font-size:.82rem;line-height:1.35;color:var(--muted);font-variant-numeric:tabular-nums}
.d-skel{position:absolute;left:calc(2.3rem + 8px);top:13px;width:58%;height:9px;border-radius:5px;background:var(--line);opacity:0}
.d-skel::after{content:"";position:absolute;left:0;top:18px;width:40%;height:7px;border-radius:4px;background:var(--line)}
.d-meters{display:flex;flex-direction:column;gap:3px;flex:0 1 10.5rem;min-width:0}
.d-m{display:grid;grid-template-columns:3.9rem minmax(0,1fr);align-items:center;gap:6px;font-size:.8rem;line-height:1.3;color:var(--muted)}
.d-m i{display:block;height:7px;border-radius:4px;background:var(--card);overflow:hidden}
.d-m i b{display:block;height:100%;background:var(--acc);border-radius:4px;transform-origin:left}
.d-ok{font-size:.8rem;line-height:1.3;font-weight:700}

/* step 2: today. The bar's full width is the day's target with the run added (2,330 kcal);
   2,000 kcal is 85.84% of that, 500 kcal eaten is 21.46%. */
.d-sum{display:flex;flex-direction:column;gap:6px;background:var(--acc-soft);border-radius:14px;padding:9px 14px 10px}
.d-sum-h{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.d-sum-h small{font-size:.82rem;color:var(--muted)}
.d-sum-h .d-big{font-size:1.25rem}
.d-sw{display:inline-grid;justify-items:end}
.d-sw>*{grid-area:1/1}
.d-sw .o{visibility:hidden}
.d-cal{position:relative;height:12px;margin-block:2px}
.d-cal i{position:absolute;top:0;bottom:0;left:0;display:block;border-radius:6px}
.d-cal .trk{width:100%;background:var(--card)}
.d-cal .ex,.d-key .ex{background:repeating-linear-gradient(-45deg,var(--tomato) 0 2.5px,transparent 2.5px 5px)}
.d-cal .ex{left:calc(85.84% - 6px);width:calc(14.16% + 6px);border-radius:0 6px 6px 0}
.d-cal .pl,.d-key .pl{background:var(--line);background:color-mix(in srgb,var(--acc) 38%,var(--card))}
.d-cal .pl{width:85.84%}
.d-cal .ea,.d-key .ea{background:var(--acc)}
.d-cal .ea{width:21.46%}
.d-cal .tk{left:100%;top:-4px;bottom:-4px;width:2px;margin-left:-2px;border-radius:1px;background:var(--fg)}
.d-key{display:flex;flex-wrap:wrap;gap:1px 12px;font-size:.8rem;line-height:1.35;color:var(--muted)}
.d-key>span{display:inline-flex;align-items:center;gap:5px;white-space:nowrap}
.d-key i{flex:none;width:10px;height:10px;border-radius:3px}
.d-meals{list-style:none;margin:0;padding:0}
.d-meals li,.d-wk{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;padding:3px 0;border-bottom:1px dashed var(--line)}
.d-ml small{display:block;font-size:.76rem;line-height:1.25;color:var(--muted)}
.d-ml b{display:block;font:600 .98rem/1.25 var(--display)}
.d-ate{display:inline-flex;align-items:center;justify-content:center;gap:3px;min-width:4.9rem;font:700 .78rem/1.2 var(--body);color:var(--fg);border:1.5px solid var(--line);border-radius:999px;padding:4px 8px;white-space:nowrap}
.d-ate svg{display:none;width:13px;height:13px}
.d-ate.yes{background:var(--acc);border-color:var(--acc);color:var(--acc-ink)}
.d-ate.yes svg{display:block}
.d-wk{grid-template-columns:24px minmax(0,1fr) auto;border-bottom:0}
.d-wk svg{width:22px;height:22px;color:var(--tomato)}
.d-plus{font:800 1rem var(--display);font-variant-numeric:tabular-nums;white-space:nowrap}
.d-chips{display:flex;align-items:center;gap:6px;margin-top:auto;min-width:0}
.d-chips small{font-size:.8rem;color:var(--muted);margin-right:2px;white-space:nowrap}
.d-chip{font:700 .78rem/1.2 var(--body);border:1.5px solid var(--line);border-radius:999px;padding:3px 9px;white-space:nowrap}

/* step 3: one grocery list */
.d-list{display:flex;flex-direction:column}
.d-gi{display:grid;grid-template-columns:5.6rem minmax(0,1fr);gap:8px;align-items:baseline;padding:3px 0;font-size:.95rem;line-height:1.35}
.d-gi.grp{border-top:1px solid var(--line);margin-top:3px;padding-top:6px}
.d-aisle{font-size:.8rem;color:var(--muted)}
.d-it{display:flex;align-items:baseline;gap:8px;min-width:0}
.d-it::before{content:"";flex:none;width:12px;height:12px;border:1.5px solid var(--muted);border-radius:4px;transform:translateY(1px)}
.d-nm{position:relative}
.d-qty{margin-left:auto;font-size:.8rem;color:var(--muted);white-space:nowrap}
.d-gi.have .d-nm{color:var(--muted)}
.d-gi.have .d-nm::after{content:"";position:absolute;left:-3px;right:-3px;top:52%;height:2px;border-radius:1px;background:var(--tomato);transform-origin:left}
.d-gi.have .d-qty{color:var(--acc);font-weight:700}

/* step 4: pantry */
.d-pi{display:grid;grid-template-columns:4.6rem minmax(0,1fr) auto;gap:8px;align-items:center;padding:3px 0}
.d-pi.grp{border-top:1px solid var(--line);margin-top:3px;padding-top:6px}
.d-pi .d-aisle{align-self:start;line-height:1.6}
.d-pit b{display:block;font:600 .98rem/1.25 var(--display)}
.d-pit small{display:block;font-size:.8rem;line-height:1.3;color:var(--muted)}
.d-soon{display:inline-flex;align-items:center;gap:5px;font:700 .76rem/1.2 var(--body);border:1.5px solid var(--tomato);border-radius:999px;padding:2px 8px;white-space:nowrap}
.d-soon::before{content:"";width:7px;height:7px;border-radius:50%;background:var(--tomato)}
.d-cook{gap:4px}
.d-cn{display:grid;grid-template-columns:22px minmax(0,1fr);gap:10px;align-items:start}
.d-cn svg{width:20px;height:20px;margin-top:2px;color:var(--acc)}
.d-cn b{display:block;font:700 1.1rem/1.25 var(--display)}
.d-foot .d-cn small{white-space:normal}

/* step 5: recipes from links */
.d-paste{position:relative;border:1.5px dashed var(--acc);border-radius:12px;background:var(--bg);padding:6px 12px;min-height:5.3rem;font-size:.84rem;line-height:1.6}
.d-ph{position:absolute;left:12px;top:6px;color:var(--muted);opacity:0}
.d-links{display:flex;flex-direction:column}
.d-ln{display:flex;align-items:center;gap:6px;min-width:0}
.d-url{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.d-url i{font-style:normal;color:var(--muted)}
.d-ln svg{flex:none;width:15px;height:15px;color:var(--acc)}
.d-recs{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:7px}
.d-recs li{display:grid;grid-template-columns:22px minmax(0,1fr);gap:10px;align-items:start}
.d-recs svg{width:20px;height:20px;margin-top:2px;color:var(--acc)}
.d-recs b{display:block;font:600 1rem/1.3 var(--display)}
.d-recs small{display:block;font-size:.8rem;line-height:1.3;color:var(--muted)}

/* bottom tabs, which are also the step indicator */
.d-nav{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:2px;padding:6px 6px 8px;border-top:1px solid var(--line)}
.d-nav button{position:relative;display:flex;flex-direction:column;align-items:center;gap:2px;min-width:0;font:700 .76rem var(--body);color:var(--muted);background:transparent;border:0;border-radius:12px;padding:7px 0 9px;cursor:pointer}
.d-nav span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.d-nav svg{width:20px;height:20px}
.d-nav button:hover{color:var(--fg)}
.d-nav button[aria-current="step"]{background:var(--acc-soft);color:var(--fg)}
.d-prog{position:absolute;left:22%;right:22%;bottom:4px;height:2px;border-radius:2px;background:var(--acc);transform:scaleX(0);transform-origin:left}
.d-nav button:not([aria-current]) .d-prog,.demo:not(.anim) .d-prog{visibility:hidden}

/* the in-between states, only while .anim is on */
.demo.anim .d-scene{transition:opacity .35s ease,visibility 0s linear .35s}
.demo.anim .d-scene.is-on{transition:opacity .35s ease .12s,visibility 0s}
.demo.anim [data-at]{transition:opacity .4s ease,transform .4s ease}
.demo.anim [data-at]:not(.on){opacity:0;transform:translateY(4px)}
/* week rows stay put; a placeholder line gives way to the dish */
.demo.anim .d-week li[data-at]:not(.on){opacity:1;transform:none}
.demo.anim .d-dish{transition:opacity .4s ease,transform .4s ease}
.demo.anim .d-week li:not(.on) .d-dish{opacity:0;transform:translateX(-6px)}
.demo.anim .d-skel{transition:opacity .25s ease}
.demo.anim .d-week li:not(.on) .d-skel{opacity:1}
/* meters fill, then "on target" shows */
.demo.anim .d-meters[data-at]:not(.on){opacity:1;transform:none}
.demo.anim .d-m i b{transition:transform .9s cubic-bezier(.3,.7,.3,1)}
.demo.anim .d-meters:not(.on) .d-m i b{transform:scaleX(0)}
.demo.anim .d-ok{transition:opacity .35s ease .8s}
.demo.anim .d-meters:not(.on) .d-ok{opacity:0;transition-delay:0s}
/* what you already have gets crossed off */
.demo.anim .d-gi.have .d-nm,.demo.anim .d-gi.have .d-qty{transition:color .35s ease}
.demo.anim .d-gi.have .d-nm::after{transition:transform .45s ease}
.demo.anim .d-gi.have:not(.x) .d-nm{color:var(--fg)}
.demo.anim .d-gi.have:not(.x) .d-qty{color:transparent}
.demo.anim .d-gi.have:not(.x) .d-nm::after{transform:scaleX(0)}
/* the links arrive together (a paste), then each one is read */
.demo.anim .d-paste[data-at]:not(.on){opacity:1;transform:none;border-color:var(--line)}
.demo.anim .d-paste{transition:border-color .3s ease}
.demo.anim .d-ph,.demo.anim .d-links{transition:opacity .2s ease}
.demo.anim .d-paste:not(.on) .d-ph{opacity:1}
.demo.anim .d-paste:not(.on) .d-links{opacity:0}
.demo.anim .d-ln svg{transition:opacity .3s ease}
.demo.anim .d-ln:not(.x) svg{opacity:0}
/* a number that changes: the old value shows until the step reaches it */
.demo.anim .d-sw:not(.x) .o{visibility:visible}
.demo.anim .d-sw:not(.x) .n{visibility:hidden}
.demo.anim .d-sw.x .n{animation:d-pop .6s ease}
@keyframes d-pop{0%{color:var(--acc);transform:scale(1.12)}100%{transform:none}}
/* today: breakfast is ticked, the eaten part grows; then the run adds room to the day's target */
.demo.anim .d-ate{transition:background-color .25s ease,border-color .25s ease,color .25s ease}
.demo.anim .d-ate.yes:not(.x){background:transparent;border-color:var(--line);color:var(--fg)}
.demo.anim .d-ate.yes:not(.x) svg{display:none}
.demo.anim .d-ate.yes.x{animation:d-tap .35s ease}
@keyframes d-tap{40%{transform:scale(.92)}}
.demo.anim .d-cal i{transition:width .7s cubic-bezier(.3,.7,.3,1),left .7s cubic-bezier(.3,.7,.3,1)}
.demo.anim .d-cal .ea:not(.x){width:0}
.demo.anim .d-cal:not(.x) .trk{width:85.84%}
.demo.anim .d-cal:not(.x) .ex{width:0}
.demo.anim .d-cal:not(.x) .tk{left:85.84%}
/* pantry: the spinach is flagged, then a recipe to cook now */
.demo.anim .d-soon{transition:opacity .3s ease,transform .3s ease}
.demo.anim .d-soon:not(.x){opacity:0;transform:scale(.85)}
/* while a step is put back to its start, so nothing visibly runs backwards */
.demo.anim .d-reset,.demo.anim .d-reset *,.demo.anim .d-reset *::before,.demo.anim .d-reset *::after{transition:none!important}

@media (max-width:380px){
  .d-scene{padding-inline:14px}
  .d-gi{grid-template-columns:4.9rem minmax(0,1fr)}
}
