/* =============================================================
   Card shimmer — a soft light sweep across dashboard widgets on hover.

   When the pointer enters a widget, a faint diagonal band of light crosses
   it once from left to right (1.1s, the same easing as the button sweep)
   and fades out when the pointer leaves. The band colour is the
   --app-card-shimmer token in app/themes/themes.css: a faint brand-blue
   sheen in light themes, a faint light sheen in dark.

   It is the widget's ::after, laid over the widget inside its own rounded
   corners: nothing is clipped, so menus and dropdowns inside still open
   past the edge, and it never takes clicks.

   Covered: dashboard widgets only, that is the cards on the home dashboard
   (.fg-dashboard-card, inside each .fg-dashboard-tile) and the widgets on
   the unified Dashboard module ([data-widget-id] inside .fg-dash). Other
   tiles and cards across the app stay still on hover.
   ============================================================= */

/* Zero specificity, so a page that positions a widget itself still wins. */
:where(.fg-dashboard-card, .fg-dash [data-widget-id]) {
    position: relative;
}

:is(.fg-dashboard-card, .fg-dash [data-widget-id])::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    pointer-events: none;
    background-image: linear-gradient(
        110deg,
        transparent 0 38%,
        var(--app-card-shimmer, rgba(59, 130, 246, .10)) 50%,
        transparent 62% 100%);
    background-size: 250% 100%;
    background-repeat: no-repeat;
    background-position: 130% 0;
    opacity: 0;
    transition: opacity .35s ease;
}

:is(.fg-dashboard-card, .fg-dash [data-widget-id]):hover::after {
    opacity: 1;
    animation: card-shimmer-sweep 1.1s cubic-bezier(.4, 0, .2, 1) both;
}

@keyframes card-shimmer-sweep {
    from { background-position: 130% 0; }
    to { background-position: -30% 0; }
}

/* Reduced motion: the OS setting or the in-app preference. */
@media (prefers-reduced-motion: reduce) {
    :is(.fg-dashboard-card, .fg-dash [data-widget-id])::after {
        animation: none !important;
        opacity: 0 !important;
    }
}

:is([data-reduce-animations="true"], .reduce-motion) :is(.fg-dashboard-card, .fg-dash [data-widget-id])::after {
    animation: none !important;
    opacity: 0 !important;
}
