/* Magic UI-style effects (see magic.js). Off when Settings → Appearance is "Still" or the system asks for reduced motion. */
@property --beam { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

/* Number ticker: steady digits while counting. */
.ticking { font-variant-numeric: tabular-nums; display: inline-block; text-align: left; }

/* Hero tile needs a positioned box for the border beam. */
:is(.kpis > .kpi.hero, .stats-row > .stat.main) { position: relative; isolation: isolate; }

/* Border beam: a short light travelling round the edge of the one hero tile per row. */
html:not([data-depth="off"]) :is(.kpis > .kpi.hero, .stats-row > .stat.main)::after {
  display: block; content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none; border: 0; opacity: 1; transform: none; width: auto; height: auto;
  background: conic-gradient(from var(--beam), transparent 0 72%, rgba(255, 255, 255, .25) 84%, #fff 92%, transparent 96%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: beam 7s linear infinite;
}
@keyframes beam { to { --beam: 360deg; } }

/* Shimmer: a spark circling the Ask a question button, brighter on hover. */
.top .pill.ask { position: relative; isolation: isolate; overflow: hidden; }
html:not([data-depth="off"]) .top .pill.ask::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--beam), transparent 0 70%, color-mix(in srgb, var(--accent) 60%, transparent) 85%, #FBD3B0 93%, transparent 97%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: beam 4s linear infinite;
}
.top .pill.ask::after { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; box-shadow: inset 0 -8px 12px color-mix(in srgb, var(--accent) 10%, transparent); transition: box-shadow .3s; }
.top .pill.ask:hover::after { box-shadow: inset 0 -6px 14px color-mix(in srgb, var(--accent) 24%, transparent); }
.top .pill.ask:active::after { box-shadow: inset 0 -10px 12px color-mix(in srgb, var(--accent) 30%, transparent); }

html.calm .top .pill.ask::before, html.calm :is(.kpis > .kpi.hero, .stats-row > .stat.main)::after { animation: none; display: none; } /* html.calm: public/depth.js */
@media print { .top .pill.ask::before, .kpi::before, .kpi::after, .stat::before, .stat::after { display: none !important; } }

/* Blur fade: cards rise in when you arrive on a page (opacity + a short lift; no blur filter, it is slow on big cards). */
.mg-in { animation: mg-in .5s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes mg-in { from { opacity: 0; transform: translateY(10px); } }
/* Animated list: "Needs attention" items arrive one after another. */
.mg-list { animation: mg-list .45s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(200ms + var(--i, 0) * 70ms); }
@keyframes mg-list { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* Ripple on press. */
.mg-ripple { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 0; }
.mg-ripple i { position: absolute; border-radius: 50%; background: currentColor; opacity: .18; transform: scale(0); animation: mg-ripple .6s ease-out forwards; }
@keyframes mg-ripple { to { transform: scale(1); opacity: 0; } }

/* Theme switch circle reveal. */
.mg-vt::view-transition-old(root), .mg-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* Scroll progress line along the top edge. */
.mg-progress { position: fixed; inset: 0 0 auto; z-index: 90; height: 2px; transform: scaleX(0); transform-origin: left; pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 40%, transparent), var(--accent)); }
body.presenting .mg-progress, body.audience .mg-progress { display: none; }

/* Shiny text while the smart answer is thinking. */
.smart-wait { background: linear-gradient(90deg, var(--muted) 0, var(--muted) 40%, var(--ink) 50%, var(--muted) 60%, var(--muted) 100%) 0 0 / 250% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: mg-shine 2.4s linear infinite; }
.smart-wait .dots { -webkit-text-fill-color: initial; }
@keyframes mg-shine { from { background-position: 100% 0; } to { background-position: -150% 0; } }

/* Dock magnification (transform set from magic.js). */
.rail .nav .i { transform-origin: center; transition: transform .12s ease-out, color .15s; }

html[data-depth="off"] :is(.mg-in, .mg-list) { animation: none; }
html.calm :is(.mg-in, .mg-list, .smart-wait) { animation: none; } html.calm .mg-ripple { display: none; }

/* Text animate: a new answer settles in word by word. */
.mg-w { animation: mg-word .5s ease-out both; animation-delay: calc(var(--i, 0) * 16ms); }
@keyframes mg-word { from { opacity: 0; filter: blur(4px); } }

/* Progressive edge fade on scrolling lists. */
.mg-fade-b { -webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent); mask-image: linear-gradient(#000 calc(100% - 28px), transparent); }
.mg-fade-t { -webkit-mask-image: linear-gradient(transparent, #000 28px); mask-image: linear-gradient(transparent, #000 28px); }
.mg-fade-t.mg-fade-b { -webkit-mask-image: linear-gradient(transparent, #000 28px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(transparent, #000 28px, #000 calc(100% - 28px), transparent); }

/* Done state on the button that was pressed. */
.mg-done { position: absolute; inset: -1px; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: inherit; pointer-events: none;
  background: var(--good); color: #fff; font-weight: 600; animation: mg-done-in .32s cubic-bezier(.2, 1.3, .4, 1) both; }
.mg-done .i { width: 15px; height: 15px; }
.mg-done.out { opacity: 0; transition: opacity .3s; }
@keyframes mg-done-in { from { opacity: 0; transform: scale(.92); } }

/* Toasts arrive with a little spring. */
.toast { transition: opacity .25s, transform .45s cubic-bezier(.2, 1.35, .4, 1); }


/* Pulsating: the alerts pill pulses three times when alerts appear; the live dot keeps its gentle pulse. */
.alerts-pill:not([hidden]) { animation: mg-pulse 1.6s ease-out 3; }
@keyframes mg-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* Animated beam: Settings → Connections. */
.beam-map { display: flex; align-items: center; gap: 0; padding: 18px 8px 22px; margin-bottom: 14px; border-radius: var(--r-4); background: var(--t-sub); }
.bm-node { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; width: 118px; text-align: center; }
.bm-node b { font-size: var(--fs-3); font-weight: 600; } .bm-node small { font-size: var(--fs-2); color: var(--muted); }
.bm-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-3); background: var(--t-card-bg, var(--card)); border: 1px solid var(--t-edge, var(--line)); box-shadow: var(--shadow); color: var(--ink-2); margin-bottom: 4px; }
.bm-ic .i { width: 22px; height: 22px; } .bm-ic img { width: 30px; height: 30px; }
.bm-node.mid .bm-ic { width: 64px; height: 64px; border-radius: var(--r-4); } .bm-node.mid .bm-ic img { width: 36px; height: 36px; }
.bm-link { flex: 1; min-width: 30px; height: 10px; overflow: visible; margin-top: -34px; }
.bm-base { stroke: var(--line); stroke-width: 2; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.bm-link.on .bm-base { stroke: color-mix(in srgb, var(--accent) 30%, transparent); stroke-dasharray: none; }
.bm-flow { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 24 200; animation: mg-flow 2.4s cubic-bezier(.45, 0, .55, 1) infinite; }
.bm-link.rev .bm-flow { animation-direction: reverse; }
@keyframes mg-flow { from { stroke-dashoffset: 24; } to { stroke-dashoffset: -100; } }
@media (max-width: 560px) { .bm-node { width: 84px; } .bm-node small { display: none; } }

html[data-depth="off"] :is(.mg-w, .mg-done, .alerts-pill, .bm-flow) { animation: none; }
html.calm :is(.mg-w, .mg-done, .alerts-pill, .bm-flow) { animation: none; }

/* Calendar key under "Every day at a glance". */
.cal-key { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 6px; font-size: var(--fs-1); color: var(--muted); }
.cal-key span { margin: 0 4px; } .cal-key i { width: 11px; height: 11px; border-radius: 3px; }

/* Highlighter: a soft marker stroke along the lower half of the key words; drawn left to right once on arrival. */
.mg-hl { background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 20%, transparent), color-mix(in srgb, var(--accent) 30%, transparent) 60%, color-mix(in srgb, var(--accent) 16%, transparent))
  no-repeat 0 92% / 100% 42%; border-radius: 3px 6px 4px 5px; padding: 0 2px; margin: 0 -2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.mg-hl-draw { animation: mg-hl .7s cubic-bezier(.3, .6, .25, 1) var(--hl-d, .35s) both; }
@keyframes mg-hl { from { background-size: 0% 42%; } }
html[data-depth="off"] .mg-hl-draw { animation: none; }
html.calm .mg-hl-draw { animation: none; }
@media print { .mg-hl { background: none; } }

/* Shimmer: placeholder blocks while the first data loads. */
.skel-page { display: grid; gap: 16px; }
.skel-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.skel-row.two { grid-template-columns: 2fr 1fr; } .skel-row:has(.mid) { grid-template-columns: repeat(3, 1fr); }
.skel { display: block; height: 112px; border-radius: var(--t-r, var(--r-5)); background: var(--t-card-bg, var(--card)); border: 1px solid var(--t-edge, var(--line)); position: relative; overflow: hidden; }
.skel.tall { height: 320px; } .skel.mid { height: 200px; }
.skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ink) 5%, transparent) 45%, color-mix(in srgb, var(--ink) 7%, transparent) 50%, transparent);
  animation: mg-skel 1.5s ease-in-out infinite; }
@keyframes mg-skel { to { transform: translateX(100%); } }
@media (max-width: 760px) { .skel-row, .skel-row.two, .skel-row:has(.mid) { grid-template-columns: 1fr 1fr; } .skel.tall { height: 220px; } }
html.calm .skel::after { animation: none; }
