/* The hero scene: iCloud Photos, a Mac running PhotoCargo and an SSD on a cable, drawn in a
   1080 × 680 space and scaled to its box. The story accumulates by stage:
   0 choose · 1 download · 2 copy and verify · 3 ready to keep. */
.cargo-demo { margin: 0; min-width: 0; }
.pc-stage { position: relative; width: 100%; aspect-ratio: 1080 / 680; --s: .56; contain: layout; }
.pc-stage__inner { position: absolute; left: 0; top: 0; width: 1080px; height: 680px; transform: scale(var(--s)); transform-origin: 0 0; font-family: var(--font); color: var(--fg); }
.pc-mono { font-family: var(--mono); letter-spacing: .04em; }

/* Photo tiles: fictional landscapes drawn with gradients */
.pc-tile--0 { background: linear-gradient(#f6c9b7 0 42%, #8ab6d9 42% 58%, #4b7ea6 58%), #8ab6d9; }
.pc-tile--1 { background: radial-gradient(circle at 70% 30%, #ffe6b0 0 10%, transparent 11%), linear-gradient(#fbd6a7 0 48%, #d98a4f 48% 72%, #a85f2e 72%); }
.pc-tile--2 { background: linear-gradient(160deg, #1f4d3b 0 30%, #2f7a56 30% 65%, #cfe7d8 65% 72%, #27604a 72%); }
.pc-tile--3 { background: linear-gradient(#bfe3ff 0 45%, #2f8fd8 45% 70%, #f3ece2 70%); }
.pc-tile--4 { background: radial-gradient(circle at 35% 55%, #ff9a3c 0 16%, transparent 17%), radial-gradient(circle at 70% 40%, #ffb04f 0 12%, transparent 13%), linear-gradient(#5a7d3a, #2f4d22); }
.pc-tile--5 { background: linear-gradient(#1b2f6b 0 40%, #f4f7fb 40% 46%, #c9d6e6 46% 64%, #1b2f6b 64%); }
.pc-tile--5::after, .pc-tile--0::after { content: ""; position: absolute; left: 30%; top: 44%; width: 40%; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .55); }

/* iCloud Photos */
.pc-cloud { position: absolute; left: 24px; top: 120px; width: 272px; padding: 16px 18px 14px; border-radius: 22px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pc-cloud-head { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.pc-cloud-head svg { width: 24px; height: 24px; color: var(--sky); }
.pc-cloud-grid { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; }
.pc-tile { position: relative; display: block; width: 72px; height: 56px; border-radius: 9px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); transition: box-shadow .35s, transform .35s var(--ease); }
.pc-tick { position: absolute; right: 5px; top: 5px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--sky); color: #fff; opacity: 0; transform: scale(.4); transition: opacity .3s, transform .35s cubic-bezier(.3, 1.5, .5, 1); }
.pc-tick svg { width: 11px; height: 11px; stroke-width: 3; }
.pc-tile.is-picked { box-shadow: 0 0 0 2.5px var(--sky), inset 0 0 0 1px rgba(255, 255, 255, .25); transform: scale(1.03); }
.pc-tile.is-picked .pc-tick { opacity: 1; transform: none; }
.pc-cloud-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 12.5px; color: var(--fg-3); }
.pc-cloud-foot .pc-mono { font-size: 10.5px; }

/* The Mac */
.pc-mac { position: absolute; left: 324px; top: 40px; width: 560px; }
.pc-lid { width: 560px; height: 386px; border-radius: 20px 20px 6px 6px; background: linear-gradient(#20242c, #0c0e12); padding: 12px; position: relative; box-shadow: 0 0 0 1.5px #3a404c, 0 30px 70px rgba(0, 0, 0, .45); }
.pc-lid::before { content: ""; position: absolute; left: 50%; top: 4px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: #1b2028; box-shadow: inset 0 0 0 1.5px #2c3340; }
.pc-screen { position: relative; width: 536px; height: 362px; border-radius: 9px; overflow: hidden; background: #0b1120; }
.pc-wall { position: absolute; inset: 0; background: radial-gradient(120% 90% at 85% 10%, #0e6b76 0%, transparent 55%), radial-gradient(90% 80% at 10% 100%, #0f3d5c 0%, transparent 60%), radial-gradient(80% 70% at 60% 80%, #1c4f6e 0%, transparent 60%), #0b1522; }
.pc-base { position: absolute; left: -30px; top: 386px; width: 620px; height: 18px; border-radius: 2px 2px 12px 12px; background: linear-gradient(#5b6270, #2c3038 55%, #1a1d22); box-shadow: 0 18px 40px rgba(0, 0, 0, .45); }
.pc-base span { position: absolute; left: 50%; top: 0; width: 110px; height: 6px; margin-left: -55px; border-radius: 0 0 8px 8px; background: #1f232a; }

/* The PhotoCargo window on the screen */
.pc-win { position: absolute; left: 22px; top: 26px; width: 492px; height: 312px; border-radius: 12px; background: #1c1d21; color: #e8ebf1; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 18px 40px rgba(0, 0, 0, .55); overflow: hidden; display: flex; flex-direction: column; font-size: 11.5px; }
.pc-win-bar { height: 34px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 12px; background: #26272b; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.pc-lights { display: flex; gap: 7px; }
.pc-lights i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.pc-lights i:nth-child(2) { background: #febc2e; } .pc-lights i:nth-child(3) { background: #28c840; }
.pc-win-title { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 12.5px; }
.pc-win-title img { width: 14px; height: 14px; border-radius: 4px; }
.pc-win-body { flex: 1; display: flex; min-height: 0; }
.pc-side { width: 44px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; background: #232428; border-right: 1px solid rgba(255, 255, 255, .05); }
.pc-side-item { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #9aa1ad; }
.pc-side-item:first-child { background: rgba(63, 208, 200, .18); color: #7fe3dd; }
.pc-side-item svg { width: 15px; height: 15px; }
.pc-side-bottom { margin-top: auto; }
.pc-main { position: relative; flex: 1; padding: 12px 14px 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pc-segs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border-radius: 9px; background: rgba(255, 255, 255, .07); font-size: 10.5px; font-weight: 600; color: #c6ccd6; }
.pc-seg { padding: 5px 4px; border-radius: 7px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .35s, color .35s; }
.cargo-demo[data-mode="0"] [data-seg="0"], .cargo-demo[data-mode="1"] [data-seg="1"], .cargo-demo[data-mode="2"] [data-seg="2"] { background: #3fd0c8; color: #04161a; }
.pc-rows { display: grid; gap: 5px; }
.pc-row { display: grid; grid-template-columns: 1fr 110px 16px; align-items: center; gap: 10px; height: 24px; padding: 0 9px; border-radius: 7px; background: rgba(255, 255, 255, .05); font-family: var(--mono); font-size: 9.5px; color: #c6ccd6; opacity: .35; transform: translateX(-6px); transition: opacity .4s, transform .4s var(--ease); transition-delay: calc(var(--k) * 120ms); }
.cargo-demo[data-rows="3"] .pc-row:nth-child(n + 4), .cargo-demo[data-rows="4"] .pc-row:nth-child(n + 5) { display: none; }
.pc-row-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-row-bar { height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.pc-row-bar i { display: block; height: 100%; width: calc(clamp(0, (var(--copy-progress) - var(--k) / var(--n, 6)) * var(--n, 6) * 1.15, 1) * 100%); background: linear-gradient(90deg, #22b2ab, #4aa8f0); border-radius: inherit; }
.cargo-demo[data-rows="3"] .pc-row { --n: 3; } .cargo-demo[data-rows="4"] .pc-row { --n: 4; } .cargo-demo[data-rows="6"] .pc-row { --n: 6; }
.pc-row-ok { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: #3cc58f; color: #04161a; opacity: clamp(0, (var(--copy-progress) - (var(--k) + .85) / var(--n, 6)) * var(--n, 6) * 6, 1); transform: scale(calc(.5 + .5 * clamp(0, (var(--copy-progress) - (var(--k) + .85) / var(--n, 6)) * var(--n, 6) * 6, 1))); }
.pc-row-ok svg { width: 10px; height: 10px; stroke-width: 3; }
.pc-hud { margin-top: auto; margin-bottom: 12px; display: grid; grid-template-columns: 22px 1fr; gap: 3px 9px; align-items: center; padding: 8px 10px; border-radius: 9px; background: rgba(255, 255, 255, .07); }
.pc-hud-icon { grid-row: span 2; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: rgba(63, 208, 200, .18); color: #7fe3dd; }
.pc-hud-icon svg { width: 13px; height: 13px; grid-area: 1 / 1; }
.pc-hud-text { font-weight: 600; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-hud-bar { display: block; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.pc-hud-bar i { display: block; height: 100%; width: calc(var(--copy-progress) * 100%); background: linear-gradient(90deg, #22b2ab, #4aa8f0); }
.pc-hud-verify, .pc-hud-done { display: none; }

/* The cable and the drive */
.pc-wire { position: absolute; inset: 0; width: 1080px; height: 680px; overflow: visible; pointer-events: none; }
.pc-cable { fill: none; stroke: #6b7385; stroke-width: 7; stroke-linecap: round; }
.pc-cable-flow { fill: none; stroke: url(#pc-flow); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 3 11; opacity: 0; transition: opacity .5s; }
.pc-plug { fill: #a7aebb; stroke: #6b7385; stroke-width: 1; }
.pc-bit { position: absolute; left: 0; top: 0; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px 3px rgba(34, 178, 171, .8), 0 0 22px 6px rgba(74, 168, 240, .45); opacity: 0;
  offset-path: path("M884 428 C 900 428, 906 404, 918 396 C 926 390, 936 390, 946 390"); offset-rotate: 0deg; }
.pc-ssd { position: absolute; left: 944px; top: 358px; width: 118px; height: 66px; border-radius: 12px; background: linear-gradient(160deg, #3b414c, #15181d 45%, #2a2f38); box-shadow: 0 0 0 1px #4b5260, 0 18px 40px rgba(0, 0, 0, .4); }
.pc-ssd-ribs { position: absolute; inset: 10px 12px; border-radius: 7px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 2px, transparent 2px 7px); }
.pc-ssd-led { position: absolute; right: 10px; bottom: 9px; width: 6px; height: 6px; border-radius: 50%; background: #3cc58f; box-shadow: 0 0 6px #3cc58f; opacity: .35; }
.pc-ssd-stack { position: absolute; left: 14px; top: -22px; width: 54px; height: 40px; opacity: 0; transition: opacity .4s .9s; }
.pc-ssd-stack i { position: absolute; left: 0; top: 0; width: 44px; height: 32px; border-radius: 6px; box-shadow: 0 6px 16px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .3); }
.pc-ssd-stack i:nth-child(2) { transform: translate(8px, -6px) rotate(6deg); } .pc-ssd-stack i:nth-child(3) { transform: translate(16px, -12px) rotate(12deg); }

/* Photos in flight: from the cloud card to the window, then to the drive */
.pc-ghosts { position: absolute; inset: 0; pointer-events: none; }
.pc-ghost { position: absolute; left: 0; top: 0; width: 72px; height: 56px; border-radius: 9px; opacity: 0; box-shadow: 0 0 0 2px #4aa8f0, 0 10px 24px rgba(0, 0, 0, .35);
  transform: translate(var(--x0), var(--y0)); transition: transform .9s cubic-bezier(.5, 0, .2, 1) var(--d, 0ms), opacity .3s var(--d, 0ms), width .9s var(--d, 0ms), height .9s var(--d, 0ms); }

/* Captions under the devices */
.pc-cap { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.pc-cap b { font-family: var(--mono); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); font-weight: 500; }
:lang(ja) .pc-cap b, :lang(zh-Hans) .pc-cap b { font-family: var(--font); letter-spacing: 0; font-size: 15px; font-weight: 600; }
.pc-cap span { font-size: 17px; color: var(--fg-2); }
.pc-cap--cloud { left: 24px; width: 272px; top: 500px; }
.pc-cap--mac { left: 294px; width: 620px; top: 536px; }
.pc-cap--drive { left: 904px; width: 198px; top: 446px; }
.pc-verified { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 6px; border-radius: 999px; font-size: 13px !important; font-weight: 600; color: var(--ok) !important; background: color-mix(in srgb, var(--ok) 14%, var(--bg-2)); border: 1px solid color-mix(in srgb, var(--ok) 40%, var(--line)); opacity: 0; transform: translateY(6px); transition: opacity .4s .6s, transform .4s .6s var(--ease); }
.pc-verified svg { width: 14px; height: 14px; stroke-width: 2.6; }

/* The story, by stage (attributes accumulate: 1 includes 0, and so on) */
.cargo-demo:is([data-stage="1"], [data-stage="2"], [data-stage="3"]) .pc-row { opacity: 1; transform: none; }
.cargo-demo:is([data-stage="1"], [data-stage="2"], [data-stage="3"]) .pc-ghost { opacity: 1; transform: translate(var(--x1), var(--y1)) scale(.42); }
.cargo-demo:is([data-stage="2"], [data-stage="3"]) .pc-ghost { opacity: 0; transition-delay: 0ms; }
.cargo-demo[data-stage="2"] .pc-cable-flow { opacity: 1; animation: pc-flow .6s linear infinite; }
.cargo-demo[data-stage="2"] .pc-bit { animation: pc-bit 1.1s linear infinite; }
.cargo-demo[data-stage="2"] .pc-bit:nth-of-type(2) { animation-delay: .27s; } .cargo-demo[data-stage="2"] .pc-bit:nth-of-type(3) { animation-delay: .55s; } .cargo-demo[data-stage="2"] .pc-bit:nth-of-type(4) { animation-delay: .82s; }
.cargo-demo[data-stage="2"] .pc-ssd-led { animation: pc-led .5s steps(2) infinite; }
.cargo-demo[data-stage="2"] .pc-hud-download, .cargo-demo[data-stage="3"] .pc-hud-download { display: none; }
.cargo-demo[data-stage="2"] .pc-hud-verify { display: block; }
.cargo-demo[data-stage="3"] .pc-hud-done { display: block; }
.cargo-demo[data-stage="3"] .pc-hud-icon { background: rgba(60, 197, 143, .22); color: #3cc58f; }
.cargo-demo[data-stage="3"] .pc-ssd-led { opacity: 1; }
.cargo-demo[data-stage="3"] .pc-ssd-stack, .cargo-demo[data-stage="3"] .pc-verified { opacity: 1; transform: none; }
.cargo-demo[data-stage="0"] .pc-row-ok, .cargo-demo[data-stage="1"] .pc-row-ok { opacity: 0; }
@keyframes pc-flow { to { stroke-dashoffset: -28; } }
@keyframes pc-bit { 0% { offset-distance: 0%; opacity: 0 } 12% { opacity: 1 } 88% { opacity: 1 } 100% { offset-distance: 100%; opacity: 0 } }
@keyframes pc-led { 50% { opacity: .35; } }

/* Under the scene: what it shows, the three modes, the four steps and playback */
.demo-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-top: 1.1rem; font-size: .92rem; font-weight: 600; color: var(--fg); }
.demo-kind { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); font-weight: 500; white-space: nowrap; }
:lang(ja) .demo-kind, :lang(zh-Hans) .demo-kind { font-family: var(--font); letter-spacing: 0; font-size: .78rem; }
.demo-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.demo-controls button { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .9rem .45rem .7rem; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg-2); font-size: .86rem; font-weight: 600; cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.demo-controls button svg { width: 16px; height: 16px; }
.demo-controls button:hover { color: var(--fg); }
.demo-controls button[aria-pressed="true"] { background: linear-gradient(135deg, var(--g1), var(--g2)); color: var(--on-accent); border-color: transparent; }
.demo-timeline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .9rem; }
.demo-timeline ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; }
.demo-timeline li { display: inline-flex; align-items: center; gap: .45rem; font-size: .84rem; color: var(--fg-3); transition: color .3s; }
.demo-timeline li .step-dot { font-family: var(--mono); font-size: .68rem; letter-spacing: .04em; color: var(--fg-3); }
.demo-timeline li[aria-current="step"] { color: var(--fg); font-weight: 600; }
.demo-timeline li[aria-current="step"] .step-dot, .demo-timeline li[data-complete="true"] .step-dot { color: var(--teal); }
.demo-playback { display: flex; gap: .25rem; flex: none; }
.demo-playback .icon-button { width: 36px; height: 36px; border-color: var(--line-2); }
.demo-playback .icon-button svg { width: 16px; height: 16px; }
.demo-pause-icon { display: none; }
.cargo-demo[data-running="true"] .demo-play-icon { display: none; }
.cargo-demo[data-running="true"] .demo-pause-icon { display: block; }
.demo-description { margin: .6rem 0 0; min-height: 1.6em; }
.demo-description p { margin: 0; font-size: .92rem; color: var(--fg-2); }
html:not(.js) .demo-controls, html:not(.js) .demo-playback { display: none; }

@media (max-width: 1060px) { .pc-stage { --s: .62; } }
@media (max-width: 760px) {
  .demo-timeline { flex-direction: column; align-items: flex-start; }
  .demo-heading { flex-direction: column; gap: .2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pc-stage *, .pc-stage *::before, .pc-stage *::after { transition: none !important; animation: none !important; }
  .cargo-demo .pc-ghost { display: none; }
}
