/* The drop-a-file demo of Astrape Companion: a file dragged onto the Mac window plays on the TV.
   Pure CSS, no script. Used by the homepage (#companion) and /mac-companion/; markup in both pages.
   Colours come from the page's own variables (--line, --bolt, --ink, --ink-3, --night-2, --mono). */
/* ── the scene ─────────────────────────────────────────────────────────────
   One 16:10 stage, everything placed in % of it; text inside sized in cqw.
   One 10.5 s timeline for every part (animation-delay 0), so they stay in step. */
.cdemo{--T:10.5s;position:relative;aspect-ratio:16/10;container-type:inline-size;border-radius:24px;overflow:hidden;
  background:radial-gradient(60% 70% at 70% 45%,rgba(47,127,217,.18),transparent 70%),linear-gradient(180deg,#0a1024,#070b18);
  box-shadow:inset 0 0 0 1px var(--line)}
.cdemo *{box-sizing:border-box}
.cdemo .win{position:absolute;left:1%;top:8%;width:64%}
.cdemo .win img{display:block;width:100%;height:auto}
/* regions of the screenshot, in % of the image (1864 × 1494 at source) */
.cdemo .zone{position:absolute;left:31.6%;top:52.6%;width:57.4%;height:31.9%;border-radius:2.2cqw;
  box-shadow:inset 0 0 0 .25cqw var(--bolt),0 0 3cqw rgba(124,194,255,.45);background:rgba(124,194,255,.12);opacity:0;animation:cd-zone var(--T) infinite}
.cdemo .card{position:absolute;left:31.9%;top:34.3%;width:18.7%;height:13.8%;border-radius:1.4cqw;opacity:0;
  box-shadow:0 0 0 .2cqw rgba(124,194,255,.9),0 0 3.5cqw rgba(124,194,255,.8);animation:cd-card var(--T) infinite}
/* the dragged file (a video document, as the Finder draws one) and the pointer that holds it */
.cdemo .file{position:absolute;width:8%;left:4%;top:77%;display:grid;justify-items:center;gap:.4cqw;animation:cd-file var(--T) linear infinite;z-index:3}
.cdemo .doc{display:block;width:62%;height:auto;filter:drop-shadow(0 .6cqw .9cqw rgba(0,0,0,.55))}
.cdemo .fname{font:500 .95cqw/1.25 -apple-system,"Helvetica Neue",Arial,sans-serif;color:#fff;text-align:center;background:#2f6fd0;padding:.15cqw .5cqw;border-radius:.4cqw;white-space:nowrap}
.cdemo .ptr{position:absolute;left:58%;top:42%;width:2.1cqw;filter:drop-shadow(0 .2cqw .3cqw rgba(0,0,0,.6));animation:cd-ptr var(--T) infinite}
/* the bolt from the TV's card to the TV: a jagged channel with three forks, drawn as a white core inside two blurred
   blue copies of itself. It strikes left to right in a quarter of a second (a wipe), flickers twice and is gone. */
.cdemo .bolt{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:2;overflow:visible;opacity:0;animation:cd-bolt var(--T) linear infinite}
.cdemo .bolt path{fill:none;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:3}
.cdemo .b-glow{stroke:#2f7fd9;stroke-width:30;opacity:.6}
.cdemo .b-halo{stroke:#8cc8ff;stroke-width:10;opacity:.9}
.cdemo .b-fhalo{stroke:#5aa5ee;stroke-width:6;opacity:.7}
.cdemo .b-fork{stroke:#d6eaff;stroke-width:2.4}
.cdemo .b-core{stroke:#fff;stroke-width:4.2}
@container (max-width:620px){.cdemo .b-core{stroke-width:7}.cdemo .b-fork{stroke-width:4}.cdemo .b-halo{stroke-width:15}.cdemo .b-fhalo{stroke-width:9}}
/* the TV: the picture in a thin bezel on a foot, and a blurred copy of the picture behind it as the light it throws */
.cdemo .tv{position:absolute;right:2%;top:33%;width:32%}
.cdemo .tv-spill{position:absolute;left:-6%;right:-6%;top:-8%;aspect-ratio:16/9;background:url("/assets/martian-1.webp") center/cover;filter:blur(3.2cqw) saturate(1.5);opacity:0;animation:cd-spill var(--T) infinite}
.cdemo .tv-body{position:relative;padding:.45cqw;border-radius:.95cqw;background:#0d0f14;box-shadow:0 0 0 1px rgba(255,255,255,.1),0 3cqw 5cqw -2cqw rgba(0,0,0,.85)}
.cdemo .scr{position:relative;aspect-ratio:16/9;border-radius:.55cqw;overflow:hidden;background:#04060c;box-shadow:0 0 0 1px rgba(255,255,255,.06)}
.cdemo .stand{position:relative;width:24%;height:1.5cqw;margin:0 auto;background:linear-gradient(90deg,transparent 41%,#161a24 41%,#232836 50%,#161a24 59%,transparent 59%)}
.cdemo .stand::after{content:"";position:absolute;left:0;right:0;bottom:0;height:.32cqw;border-radius:.3cqw;background:linear-gradient(#333a4b,#191d29)}
.cdemo .tvname{position:relative;margin:1cqw 0 0;text-align:center;font:500 1.2cqw/1.2 -apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue",Arial,sans-serif;color:var(--ink-3)}
.cdemo .idle{position:absolute;inset:0;display:grid;place-items:center;animation:cd-idle var(--T) infinite}
.cdemo .idle img{width:42%;border-radius:.8cqw;opacity:.85;box-shadow:0 0 3cqw rgba(47,127,217,.35)}
.cdemo .movie{position:absolute;inset:0;background:url("/assets/martian-1.webp") center/cover;opacity:0;animation:cd-movie var(--T) infinite}
.cdemo .flash{position:absolute;inset:0;background:radial-gradient(130% 150% at 0 50%,#fff,rgba(160,210,255,.75) 32%,rgba(47,127,217,0) 72%);opacity:0;mix-blend-mode:screen;animation:cd-flash var(--T) infinite}
.cdemo .osd{position:absolute;left:0;right:0;bottom:0;padding:2.4cqw 2.2cqw 1.6cqw;background:linear-gradient(transparent,rgba(0,0,0,.75));opacity:0;animation:cd-osd var(--T) infinite;
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue",Arial,sans-serif}
.cdemo .osd h4{margin:0;font-size:1.9cqw;font-weight:700;line-height:1.1}
.cdemo .osd p{margin:.4cqw 0 .9cqw;font-size:.95cqw;color:rgba(255,255,255,.75)}
.cdemo .osd .dv{color:#e7d3a1}
.cdemo .bar{height:.35cqw;border-radius:.2cqw;background:rgba(255,255,255,.25);overflow:hidden}
.cdemo .bar i{display:block;height:100%;width:0;background:#fff;animation:cd-bar var(--T) infinite}
/* the three steps under the scene */
.cd-steps{list-style:none;margin:18px 0 0;padding:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;counter-reset:s}
.cd-steps li{counter-increment:s;padding:14px 16px;border-radius:14px;background:var(--night-2);box-shadow:inset 0 0 0 1px var(--line);color:var(--ink-3);font-size:16px;line-height:1.35}
.cd-steps li::before{content:counter(s);display:block;font:500 13px/1 var(--mono);color:var(--bolt);margin-bottom:8px}
.cd-steps li:nth-child(1){animation:cd-s1 10.5s infinite}
.cd-steps li:nth-child(2){animation:cd-s2 10.5s infinite}
.cd-steps li:nth-child(3){animation:cd-s3 10.5s infinite}
@media (max-width:640px){.cd-steps{grid-template-columns:1fr}.cdemo{border-radius:16px}}

/* ── the timeline (10.5 s) ──
   0–3 % rest · 3–18 % drag, one even move · 18–22 % drop · 22–24 % the TV's card lights · 24–26.4 % the bolt strikes ·
   26.4–31 % it flickers out while the TV comes on, the way the homepage's first screen does · 31–90 % playing · 90–100 % back to rest */
@keyframes cd-file{
  0%,2.9%{left:4%;top:77%;opacity:1;transform:scale(1)}
  8%{left:14%;top:72%}
  13%{left:25%;top:65%}
  18.1%{left:35.6%;top:59%;opacity:1;transform:scale(1)}
  21.9%{left:36%;top:60%;opacity:0;transform:scale(.4)}
  92%{left:36%;top:60%;opacity:0;transform:scale(.4)}
  93%{left:4%;top:77%;opacity:0;transform:scale(1)}
  100%{left:4%;top:77%;opacity:1;transform:scale(1)}}
@keyframes cd-ptr{0%,2%{transform:scale(1)}2.9%,18.1%{transform:scale(.92)}20%,100%{transform:scale(1)}}
@keyframes cd-zone{0%,10%{opacity:0}14%,18.1%{opacity:1}20%{opacity:1;background:rgba(124,194,255,.3)}26%,100%{opacity:0}}
@keyframes cd-card{0%,21.9%{opacity:0}24%{opacity:1}28%{opacity:.85}33%,100%{opacity:0}}
@keyframes cd-bolt{
  0%,23.9%{opacity:0;clip-path:inset(0 67% 0 0)}
  24%{opacity:1;clip-path:inset(0 66% 0 0)}
  26.4%{opacity:1;clip-path:inset(0 31% 0 0)}
  26.5%{opacity:1;clip-path:inset(0 0 0 0)}
  27.3%{opacity:.3}
  28.1%{opacity:.95}
  29%{opacity:.45}
  32%,100%{opacity:0;clip-path:inset(0 0 0 0)}}
@keyframes cd-idle{0%,26.3%{opacity:1}26.7%,93%{opacity:0}100%{opacity:1}}
@keyframes cd-flash{0%,26.2%{opacity:0}26.6%{opacity:1}28.6%,100%{opacity:0}}
@keyframes cd-movie{
  0%,26.4%{opacity:0;filter:brightness(.05);transform:scale(1.08)}
  26.9%{opacity:1;filter:brightness(1.9)}
  27.6%{opacity:1;filter:brightness(.35)}
  28.5%{opacity:1;filter:brightness(1.45)}
  30.5%{opacity:1;filter:brightness(1)}
  90%{opacity:1;filter:brightness(1);transform:scale(1)}
  94%,100%{opacity:0;filter:brightness(1);transform:scale(1)}}
@keyframes cd-spill{0%,26.4%{opacity:0}26.9%{opacity:.9}27.6%{opacity:.15}28.5%{opacity:.75}30.5%,90%{opacity:.5}94%,100%{opacity:0}}
@keyframes cd-osd{0%,32%{opacity:0}36%,64%{opacity:1}71%,100%{opacity:0}}
@keyframes cd-bar{0%,31%{width:0}90%,100%{width:9%}}
@keyframes cd-s1{0%,21.9%{color:var(--ink);box-shadow:inset 0 0 0 1px rgba(124,194,255,.6)}24%,100%{color:var(--ink-3);box-shadow:inset 0 0 0 1px var(--line)}}
@keyframes cd-s2{0%,21.9%{color:var(--ink-3);box-shadow:inset 0 0 0 1px var(--line)}24%,29%{color:var(--ink);box-shadow:inset 0 0 0 1px rgba(124,194,255,.6)}31%,100%{color:var(--ink-3);box-shadow:inset 0 0 0 1px var(--line)}}
@keyframes cd-s3{0%,29%{color:var(--ink-3);box-shadow:inset 0 0 0 1px var(--line)}31%,92%{color:var(--ink);box-shadow:inset 0 0 0 1px rgba(124,194,255,.6)}96%,100%{color:var(--ink-3);box-shadow:inset 0 0 0 1px var(--line)}}
@media (prefers-reduced-motion:reduce){
  .cdemo *,.cd-steps li{animation:none!important}
  .cdemo .file,.cdemo .idle,.cdemo .zone,.cdemo .card{opacity:0}
  .cdemo .movie,.cdemo .osd{opacity:1}
  .cdemo .tv-spill{opacity:.5}
  .cdemo .bar i{width:4%}}
