/* DC Blueprints: Motion principles page and its live demos.
   Demos animate only transform, opacity and clip-path, per our own motion rules. */

.mp-sources { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); margin-bottom: var(--s-2); }
.mp-sources div { display: grid; gap: 2px; padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); background: var(--card); }
.mp-sources b { font-size: 15px; }
.mp-sources span { font-size: 14px; color: var(--muted-foreground); }
.mp-list { display: grid; gap: var(--s-3); margin: var(--s-3) 0 0; padding: 0; list-style: none; font-size: 15px; color: var(--muted-foreground); }
.mp-list strong { color: var(--foreground); }
.mp-p { max-width: 72ch; font-size: 16px; color: var(--muted-foreground); }
.mp-p + .mp-p { margin-top: var(--s-3); }
.mp-p strong { color: var(--foreground); }
.mp-src { margin-top: var(--s-3); font-size: 13px; color: var(--muted-foreground); }
.mp-pillars { display: grid; gap: var(--s-3); margin: var(--s-3) 0 0; }
.mp-pillars div { display: grid; grid-template-columns: 110px 1fr; gap: var(--s-3); }
.mp-pillars dt { font-weight: 700; }
.mp-pillars dd { margin: 0; font-size: 15px; color: var(--muted-foreground); }
.mp-ladder { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-2); margin-top: var(--s-4); }
.mp-ladder div { display: grid; gap: 2px; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--background); }
.mp-ladder b { font-size: 15px; }
.mp-ladder span { font-size: 13px; color: var(--muted-foreground); }
.mp-ladder em { font: 500 13px var(--mono); font-style: normal; color: var(--accent-text); }

.mp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s-4); }
.mp-card { display: grid; grid-template-rows: auto 1fr; overflow: hidden; border-radius: var(--r-xl); background: var(--card); }
.mp-stage { position: relative; display: grid; place-items: center; height: 170px; margin: var(--s-2) var(--s-2) 0; overflow: hidden; border-radius: calc(var(--r-xl) - 6px); background: var(--background); }
.mp-body { display: grid; align-content: start; gap: var(--s-2); padding: var(--s-4) var(--s-5) var(--s-5); }
.mp-body h4 { display: flex; align-items: center; gap: var(--s-2); font-size: 18px; }
.mp-body h4 span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--primary-foreground); font-size: 12px; }
.mp-body p { font-size: 15px; color: var(--muted-foreground); }
.mp-body p b { display: inline-block; min-width: 40px; margin-right: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--foreground); }
.mp-body .mp-play { justify-self: start; margin-top: var(--s-2); }
.mp-stage.reset,
.mp-stage.reset * { transition: none !important; }

/* 1 Easing */
.mp-stage[data-demo="easing"] { align-content: center; gap: var(--s-6); padding-top: var(--s-3); }
.mp-track { position: relative; width: 82%; height: 36px; border-radius: 999px; background: var(--card); container-type: inline-size; }
.mp-track span { position: absolute; left: 6px; bottom: calc(100% + 4px); font: 500 11px var(--mono); color: var(--muted-foreground); }
.mp-track .b { position: absolute; left: 4px; top: 4px; width: 28px; height: 28px; border-radius: 50%; background: var(--chart-4); transition: transform 900ms linear; }
.mp-track .b.ease { background: var(--accent-line); transition-timing-function: var(--ease-out); }
.play .mp-track .b { transform: translateX(calc(100cqw - 36px)); }

/* 2 Offset & delay (replays from hidden) */
.mp-stack { display: grid; gap: 8px; width: 60%; }
.mp-stack i { height: 18px; border-radius: 6px; background: var(--surface-2); transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out); transition-delay: calc(var(--d) * 160ms); }
.mp-stack i:nth-child(2) { width: 70%; }
.mp-stack i.sep { width: 45%; height: 32px; margin-top: 6px; border-radius: 999px; background: var(--primary); }
.mp-stage.hide .mp-stack i { opacity: 0; transform: translateY(14px); }

/* 3 Parenting (realtime) */
.mp-slider { position: relative; width: 78%; padding-top: 40px; --v: 50; }
.mp-slider input { width: 100%; height: 44px; accent-color: var(--accent-line); cursor: pointer; }
.mp-slider .bubble { position: absolute; top: 0; left: calc(var(--v) * 1%); translate: -50% 0; transform: scale(calc(0.85 + var(--v) / 400)); padding: 4px 10px; border-radius: 8px; background: var(--primary); color: var(--primary-foreground); font: 700 13px var(--font); font-variant-numeric: tabular-nums; }

/* 4 Transformation */
.mp-morph { position: relative; display: grid; place-items: center; width: 160px; height: 48px; border-radius: 999px; background: var(--primary); color: var(--primary-foreground); font-weight: 700; clip-path: inset(0 0 round 24px); transition: clip-path 300ms var(--ease-in-out), background-color 200ms; }
.mp-morph > span { position: absolute; transition: opacity 150ms var(--ease-out); }
.mp-morph .spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; opacity: 0; animation: spin 700ms linear infinite; }
.mp-morph .ok { opacity: 0; font-size: 20px; }
.mp-morph.s2,
.mp-morph.s3 { clip-path: inset(0 56px round 24px); }
.mp-morph.s2 .lbl,
.mp-morph.s3 .lbl { opacity: 0; }
.mp-morph.s2 .spin { opacity: 1; }
.mp-morph.s3 { background: var(--success); color: var(--background); }
.mp-morph.s3 .ok { opacity: 1; }

/* 5 Value change */
.mp-kpi { display: grid; gap: 4px; text-align: center; }
.mp-kpi span { font-size: 13px; color: var(--muted-foreground); }
.mp-kpi strong { font-size: 40px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

/* 6 Masking */
.mp-mask { display: grid; place-items: center; width: 80%; height: 120px; }
.mp-mask .art { width: 100%; height: 100%; background: radial-gradient(60% 80% at 30% 30%, var(--accent-line), transparent 70%), radial-gradient(60% 80% at 80% 70%, var(--chart-2), transparent 70%), var(--surface-2); clip-path: inset(30px 0 30px 0 round 12px); transition: clip-path 420ms var(--ease-in-out); }
.play .mp-mask .art { clip-path: inset(0 calc(50% - 60px) 0 calc(50% - 60px) round 16px); }

/* 7 Overlay */
.mp-overlay { position: relative; width: 82%; height: 56px; }
.mp-overlay .back { position: absolute; inset: 0; display: flex; justify-content: flex-end; gap: 4px; padding: 6px; border-radius: 12px; background: var(--surface-2); }
.mp-overlay .back span { display: grid; place-items: center; padding: 0 10px; border-radius: 8px; background: var(--card); font-size: 12px; font-weight: 700; }
.mp-overlay .back span:last-child { background: var(--destructive); color: var(--background); }
.mp-overlay .front { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 var(--s-4); border-radius: 12px; background: var(--popover); box-shadow: var(--edge); font-size: 14px; font-weight: 600; transition: transform 300ms var(--ease-out); }
.play .mp-overlay .front { transform: translateX(-52%); }

/* 8 Cloning */
.mp-clone { display: flex; align-items: center; gap: var(--s-3); }
.mp-clone span { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.mp-clone .src { background: var(--primary); color: var(--primary-foreground); }
.mp-clone .new { background: var(--surface-2); opacity: 0; transform: translateX(-100px) scale(0.4); transition: transform 320ms var(--ease-out), opacity 200ms var(--ease-out); }
.play .mp-clone .new { opacity: 1; transform: none; }

/* 9 Obscuration: fade a static frosted overlay, never animate the blur */
.mp-obsc { position: absolute; inset: 0; }
.mp-obsc .page { display: grid; gap: 10px; padding: 20px; }
.mp-obsc .page i { height: 14px; border-radius: 6px; background: var(--chart-4); }
.mp-obsc .page i:nth-child(2) { width: 70%; background: var(--accent-line); }
.mp-obsc .glass { position: absolute; inset: 0; display: grid; align-items: end; background: color-mix(in srgb, var(--background) 40%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity 260ms var(--ease-out); }
.mp-obsc .sheet { margin: 0 12px; padding: 14px; border-radius: 14px 14px 0 0; background: var(--popover); box-shadow: var(--edge); font-weight: 700; transform: translateY(100%); transition: transform 300ms var(--ease-out); }
.play .mp-obsc .glass { opacity: 1; }
.play .mp-obsc .sheet { transform: none; }

/* 10 Parallax (realtime, driven by scroll) */
.mp-parallax { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; }
.mp-parallax .far { position: absolute; inset: 0 0 -200px; background: radial-gradient(30px 30px at 20% 20%, var(--accent-line), transparent), radial-gradient(40px 40px at 80% 45%, var(--chart-4), transparent), radial-gradient(26px 26px at 35% 75%, var(--accent-line), transparent), radial-gradient(34px 34px at 70% 95%, var(--chart-4), transparent); opacity: 0.6; }
.mp-parallax .near { position: relative; display: grid; gap: 40px; padding: 20px 24px 120px; font-size: 14px; font-weight: 600; }

/* 11 Dimensionality */
.mp-flip { perspective: 700px; }
.mp-flip .card { position: relative; width: 190px; height: 100px; transform-style: preserve-3d; transition: transform 500ms var(--ease-in-out); }
.mp-flip .f,
.mp-flip .b { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 14px; font-weight: 700; backface-visibility: hidden; box-shadow: var(--edge); }
.mp-flip .f { background: var(--popover); }
.mp-flip .b { background: var(--primary); color: var(--primary-foreground); transform: rotateY(180deg); }
.play .mp-flip .card { transform: rotateY(180deg); }

/* 12 Dolly & zoom */
.mp-zoom { display: grid; grid-template-columns: repeat(2, 64px); gap: 10px; }
.mp-zoom i { height: 50px; border-radius: 10px; background: var(--surface-2); transition: opacity 200ms var(--ease-out); }
.mp-zoom .t { background: var(--accent-line); transition: transform 380ms var(--ease-in-out); }
.play .mp-zoom i:not(.t) { opacity: 0; }
/* The target tile sits top-right: move it to the centre of the grid, then scale it up. */
.play .mp-zoom .t { transform: translate(-37px, 30px) scale(3.4, 2.9); }

.mp-disney td { vertical-align: top; }

@media (max-width: 760px) {
  .mp-sources,
  .mp-ladder,
  .mp-grid { grid-template-columns: minmax(0, 1fr); }
}
