/* The home page demo (components/site/demo_stage/home/stage.html): four chips, one stage each. Shared pieces here;
   each scene's own pieces follow in its section. Everything is scoped to .demo-stage. The stage is drawn on a
   1180 px canvas that zooms down to fit from 1024 px; below that one pane shows at a time (data-pane, .on). */
.demo-stage {
  --ds-panel: #ECE9E3;
  --ds-screen: #F7F6F3;
  --ds-bezel: #1c1917;
  --ds-good: #1a7f55;
  --ds-good-bg: #e3f5ec;
  --ds-warn: #8a5a00;
  --ds-warn-bg: #fdf1dc;
  --ds-ease: cubic-bezier(.22, 1, .36, 1);
  max-width: 1244px; margin-inline: auto; padding: 0 16px 40px; text-align: left;

  .chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding-bottom: 24px; }
  .chip { border: 0; transition: background-color .25s, color .25s, box-shadow .25s; }
  .chip.is-active { background: var(--brand); color: var(--brand-foreground); }

  .panel { background: var(--ds-panel); border-radius: 28px; padding: 16px 12px 12px; display: grid; }
  .labels { font-size: 13px; color: var(--site-wash-muted); margin: 0 4px 12px; text-align: center; }
  .labels span:not(.on) { display: none; }
  /* One pane at a time: the old one fades out first, then the new one fades in and rises a little. */
  [data-pane] { grid-area: 2 / 1; min-width: 0; height: 600px; transition: opacity .32s ease .2s, transform .42s var(--ds-ease) .2s, visibility 0s .2s; }
  [data-pane]:not(.on) { opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .18s ease, transform 0s .2s, visibility 0s .2s; }
  [data-demo-scene].enter { animation: ds-enter .45s var(--ds-ease) both; }
  .panel:not(.still) > :not(.labels, [data-pane]) { display: contents; }

  .box { background: var(--card); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 18px 40px -26px rgb(0 0 0 / .35); padding: 18px; overflow: hidden; }
  .phone { justify-self: center; width: min(334px, 100%); border-radius: 42px; border: 7px solid var(--ds-bezel); background: var(--ds-screen); overflow: hidden; position: relative; box-shadow: 0 30px 60px -24px rgb(0 0 0 / .45); }

  /* One reveal for everything that appears: a .grow holds exactly one child and opens when it gets .on. */
  .grow { flex: none; display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .36s var(--ds-ease), opacity .28s ease .06s; }
  .grow > * { min-height: 0; overflow: hidden; }
  .grow:not(.on) > * { padding-block: 0 !important; margin-block: 0 !important; border-block-width: 0 !important; }
  .grow.on { grid-template-rows: 1fr; opacity: 1; }
  .swap { transition: opacity .16s ease; }
  .swap.out { opacity: 0; }

  .ticket { display: flex; flex-direction: column; padding: 0; }
  .ticket header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
  .ticket header b { display: block; font-size: 16px; font-weight: 600; }
  .ticket header .from { display: block; font-size: 12.5px; color: var(--muted-foreground); margin-top: 1px; }
  .state { margin-left: auto; flex: none; border-radius: 99px; padding: 3px 12px; font-size: 12.5px; font-weight: 500; background: var(--ds-warn-bg); color: var(--ds-warn); transition: background-color .25s, color .25s; }
  .state.solved { background: var(--ds-good-bg); color: var(--ds-good); }
  .thread { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px 18px 8px; min-height: 0; overflow: hidden; }
  .msg { max-width: 84%; width: fit-content; border-radius: 16px; padding: 9px 13px; font-size: 13.5px; line-height: 1.4; }
  .msg.customer { background: var(--muted); border-bottom-left-radius: 5px; }
  .msg.agent { margin-left: auto; background: color-mix(in oklab, var(--brand) 9%, var(--card)); border: 1px solid color-mix(in oklab, var(--brand) 16%, transparent); border-bottom-right-radius: 5px; }
  .meta { font-size: 12px; color: var(--muted-foreground); margin: 4px 2px 10px; }
  .meta.right { text-align: right; }
  .composer-row { margin: 0 18px 16px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; font-size: 13px; color: var(--muted-foreground); }
  .composer-row em { font-style: normal; margin-left: auto; font-size: 12px; color: var(--brand); font-weight: 500; }

  /* What Zellwo is doing, where a typing indicator would be: a title, then the lines it found; .done folds the body. */
  .work { background: var(--muted); border-radius: 12px; padding: 11px 13px; font-size: 13px; margin-bottom: 10px; }
  .work .head { display: flex; align-items: center; gap: 8px; font-weight: 500; }
  .work .head svg { width: 15px; height: 15px; flex: none; }
  .work .head .busy { display: flex; animation: ds-breathe 1.2s ease-in-out infinite; }
  .work .head .ok { display: none; color: var(--ds-good); }
  .work.done .head .busy { display: none; }
  .work.done .head .ok { display: flex; }
  .work .body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .3s var(--ds-ease), opacity .2s; }
  .work .body > * { min-height: 0; overflow: hidden; }
  .work.done .body { grid-template-rows: 0fr; opacity: 0; }
  .line { display: flex; align-items: center; gap: 7px; font-size: 12.5px; line-height: 22px; color: var(--muted-foreground); }
  .line svg { width: 13px; height: 13px; flex: none; color: var(--foreground); }
  .thumbs { display: flex; gap: 6px; margin: 9px 0 2px; }
  .thumbs img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; background: var(--card); border: 2px solid transparent; transition: opacity .3s, border-color .2s, transform .2s; }
  .thumbs img.scan { border-color: var(--brand); transform: translateY(-2px); }
  .thumbs img.fit { border-color: var(--brand); }
  .thumbs img.miss { opacity: .28; }
  .thumbs span { align-self: center; margin-left: 4px; font-size: 12px; color: var(--muted-foreground); }

  /* The customer's record: who, two totals, the timeline. */
  .person { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
  .person .face { width: 44px; height: 44px; border-radius: 99px; background: color-mix(in oklab, var(--brand) 14%, transparent); color: var(--brand); display: grid; place-items: center; font-weight: 600; font-size: 15px; flex: none; }
  .person b { display: block; font-size: 17px; font-weight: 600; line-height: 1.2; }
  .person small { font-size: 12.5px; color: var(--muted-foreground); }
  .stage-chip { margin: -4px 0 0 56px; background: var(--muted); border-radius: 99px; padding: 4px 12px; font-size: 12.5px; font-weight: 500; transition: background-color .25s, color .25s; }
  .stage-chip.won { background: var(--brand); color: var(--brand-foreground); }
  .facts { display: grid; grid-template-columns: 1fr 1fr; border-block: 1px solid var(--border); padding: 10px 0; margin-bottom: 16px; }
  .facts div + div { border-left: 1px solid var(--border); padding-left: 14px; }
  .facts small { display: block; font-size: 12px; color: var(--muted-foreground); }
  .facts b { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .events { position: relative; }
  .events::before { content: ''; position: absolute; left: 12px; top: 8px; bottom: 8px; width: 1px; background: var(--border); }
  .event { position: relative; display: flex; gap: 12px; align-items: flex-start; padding-bottom: 12px; }
  .event .dot { width: 25px; height: 25px; border-radius: 99px; background: var(--card); display: grid; place-items: center; flex: none; margin-top: 2px; }
  .event .dot svg { width: 15px; height: 15px; }
  .event.money .dot { background: var(--brand); color: var(--brand-foreground); }
  .event b { display: block; font-size: 13px; font-weight: 500; line-height: 1.25; margin-top: 1px; }
  .event small { font-size: 12px; color: var(--muted-foreground); }

  .sheet { position: absolute; left: 12px; right: 12px; bottom: 12px; border-radius: 22px; background: var(--ds-bezel); color: #fff; padding: 16px 18px; display: flex; align-items: center; gap: 12px; font-size: 13px; opacity: 0; transform: translateY(16px); transition: opacity .28s var(--ds-ease), transform .28s var(--ds-ease); }
  .sheet.on { opacity: 1; transform: none; }
  .sheet span { width: 34px; height: 34px; border-radius: 99px; background: #fff; color: var(--ds-bezel); display: grid; place-items: center; flex: none; }
  .sheet b { display: block; font-size: 15px; }

  /* Five captions: on a phone the five bars and the current line only, above the panel so they title what plays. */
  .canvas { display: flex; flex-direction: column; }
  .captions { order: -1; counter-reset: beat; margin: 0 0 14px; display: grid; grid-template-columns: repeat(5, 1fr); column-gap: 6px; font-size: 14px; line-height: 1.35; }
  .captions li { display: contents; color: color-mix(in oklab, var(--foreground) 62%, transparent); }
  .captions li::before { content: ''; grid-row: 1; height: 2px; background: color-mix(in oklab, var(--foreground) 12%, transparent); transition: background-color .25s; }
  .captions li.past::before { background: color-mix(in oklab, var(--foreground) 40%, transparent); }
  .captions li.on::before { background: var(--foreground); }
  .captions li span { grid-area: 2 / 1 / 3 / -1; padding-top: 10px; min-height: 3.2em; text-align: center; opacity: 0; }
  .captions li.on span { opacity: 1; color: var(--foreground); transition: opacity .35s ease .15s; }
  .footnote { margin-top: 14px; text-align: center; font-size: 14px; color: var(--site-wash-muted); }

  /* Inside a page section: no chips, no outer spacing. A `.panel.still` is a plain framed panel whose boxes the page lays out itself. */
  &.is-inline { max-width: none; padding: 0; }
  .panel.still { gap: 16px; padding: 20px; }
  .panel.still .phone { height: 560px; }

  &.is-still * { transition: none !important; animation: none !important; }
}
.dark .demo-stage {
  --ds-panel: color-mix(in oklab, var(--foreground) 7%, var(--background));
  --ds-screen: var(--background);
  --ds-bezel: #0c0a09;
  --ds-good: #6fd3a5;
  --ds-good-bg: color-mix(in oklab, #22a06b 22%, transparent);
  --ds-warn: #f3c26b;
  --ds-warn-bg: color-mix(in oklab, #f5a623 20%, transparent);
  .phone { outline: 1px solid color-mix(in oklab, var(--foreground) 22%, transparent); }
}
@keyframes ds-breathe { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes ds-enter { from { opacity: 0; transform: translateY(8px); } }

@media (min-width: 1024px) {
  .demo-stage {
    padding-inline: 32px;
    .canvas { display: block; width: 1180px; zoom: var(--ds-zoom, 1); }
    .panel:not(.still) { display: block; position: relative; padding: 24px 28px 28px; }
    .panel:not(.still) > :not(.labels, [data-pane]) { display: grid; }
    .labels { display: flex; justify-content: space-between; margin: 0 4px 14px; }
    .labels span:not(.on) { display: inline; }
    [data-pane] { grid-area: auto; transition: opacity .3s; }
    [data-pane]:not(.on) { opacity: 1; visibility: visible; transform: none; transition: opacity .3s; }
    .canvas .phone { position: absolute; left: 28px; bottom: 28px; width: 334px; z-index: 2; }
    .behind { margin-left: 362px; height: 600px; grid-template-columns: minmax(0, 1fr) 292px; gap: 16px; align-items: start; }
    .behind > .user { height: auto; }
    .captions { order: 0; margin: 22px 0 0; column-gap: 20px; }
    .captions li { display: block; border-top: 2px solid color-mix(in oklab, var(--foreground) 12%, transparent); padding-top: 12px; transition: color .25s, border-color .25s; }
    .captions li::before { content: none; }
    .captions li.past { border-color: color-mix(in oklab, var(--foreground) 40%, transparent); }
    .captions li.on { color: var(--foreground); border-color: var(--foreground); }
    .captions li { counter-increment: beat; }
    .captions li span { display: block; padding: 0; min-height: 0; text-align: left; opacity: 1; }
    .captions li span::before { content: counter(beat); display: block; font-size: 12px; font-weight: 600; margin-bottom: 3px; }
  }
}
