/* Shared interaction language: soft accent edges, short responsive feedback. */
body:is(.landing-page,.cabinet-page,.saas-admin) {
  --motion-ease: cubic-bezier(.2,.75,.22,1);
  --motion-time: 180ms;
  --motion-edge: #90a5ef;
  --motion-ring: #375ce91f;
  --motion-glow: 0 0 0 1px var(--motion-edge), 0 5px 16px #375ce918, 0 0 12px var(--motion-ring);
}
body.public-page { --motion-time: 220ms; }
html[data-site-theme="dark"] body:is(.landing-page,.cabinet-page,.saas-admin),
body.public-page .public-night-hero {
  --motion-edge: #8299ff;
  --motion-ring: #8299ff32;
  --motion-glow: 0 0 0 1px var(--motion-edge), 0 6px 20px #0004, 0 0 14px var(--motion-ring);
}

/* Surface effects do not change dimensions. Avoid transforming large panels,
   table wrappers, or draggable items; their own positioning remains intact. */
body:is(.landing-page,.cabinet-page,.saas-admin) :is(
  .landing-feature,.use-case-card,.how-preview,.price-card,.blog-card,.blog-featured,
  .glossary-card,.article-guide-row,.public-terms > div,.blog-aside-card,
  .landing-visual,.article-visual,.crm-preview,.seo-preview,.helpdesk-demo,.referral-visual,
  .faq-list details,.referral-step,.referral-calculator,.seo-feature,.seo-action-card,
  .seo-bottom-panel,.guide-card,.resource-card,.mcp-panel,.api-panel,.help-panel,
  .cab-metric,.saas-metric,.cab-card,.saas-card,.site-card,.benchmark-card,
  .referral-stat-grid > div,.compact-auth-panel,.lead-card,.task-kanban-card
) {
  transition: border-color var(--motion-time) ease, box-shadow var(--motion-time) ease,
    background-color var(--motion-time) ease, transform var(--motion-time) var(--motion-ease);
}
@media (hover: hover) and (pointer: fine) {
  body:is(.landing-page,.cabinet-page,.saas-admin) :is(
    .landing-feature,.use-case-card,.how-preview,.price-card,.blog-card,.blog-featured,
    .glossary-card,.article-guide-row,.public-terms > div,.blog-aside-card,
  .landing-visual,.article-visual,.crm-preview,.seo-preview,.helpdesk-demo,.referral-visual,
    .faq-list details,.referral-step,.referral-calculator,.seo-feature,.seo-action-card,
    .seo-bottom-panel,.guide-card,.resource-card,.mcp-panel,.api-panel,.help-panel,
    .cab-metric,.saas-metric,.site-card,.benchmark-card,.referral-stat-grid > div,
    .lead-card,.task-kanban-card
  ):not(.dragging,.is-dragging,[aria-grabbed="true"]):hover {
    border-color: var(--motion-edge);
    box-shadow: var(--motion-glow);
  }
  /* Larger containers get an edge, not a jump or strong halo. */
  body:is(.cabinet-page,.saas-admin) :is(.cab-card,.saas-card):hover {
    border-color: var(--motion-edge);
  }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  body:is(.landing-page,.cabinet-page,.saas-admin) :is(
    .use-case-card,.price-card,.referral-step,.seo-action-card,.cab-metric,
    .saas-metric,.benchmark-card,.referral-stat-grid > div
  ):hover { transform: translateY(-2px); }
  body:is(.cabinet-page,.saas-admin) :is(.cab-metric,.saas-metric,.referral-stat-grid > div) :is(.cab-icon,.metric-icon) {
    transition: transform var(--motion-time) var(--motion-ease);
  }
  body:is(.cabinet-page,.saas-admin) :is(.cab-metric,.saas-metric,.referral-stat-grid > div):hover :is(.cab-icon,.metric-icon) {
    transform: scale(1.05);
  }
}

/* Links and action buttons keep their existing color palette and focus rings. */
body:is(.landing-page,.cabinet-page,.saas-admin) :is(
  a.primary,button.primary,a.outline,button.outline,.cab-button,.cab-inline-button,
  .saas-button,.workspace-filter-button,.task-secondary,a.price-action,button.price-action,
  .referral-button,.api-button,.mcp-button,input[type="submit"],button[type="submit"]
):not(:disabled,[aria-disabled="true"],.muted) {
  transition: background-color var(--motion-time) ease, color var(--motion-time) ease,
    border-color var(--motion-time) ease, box-shadow var(--motion-time) ease,
    transform var(--motion-time) var(--motion-ease), filter var(--motion-time) ease;
}
@media (hover: hover) and (pointer: fine) {
  body:is(.landing-page,.cabinet-page,.saas-admin) :is(
    a.primary,button.primary,a.outline,button.outline,.cab-button,.cab-inline-button,
    .saas-button,.workspace-filter-button,.task-secondary,a.price-action,button.price-action,
    .referral-button,.api-button,.mcp-button,input[type="submit"]
  ):not(:disabled,[aria-disabled="true"],.muted):hover {
    box-shadow: 0 0 0 1px var(--motion-edge), 0 4px 12px var(--motion-ring);
  }
}
@media (prefers-reduced-motion: no-preference) {
  body:is(.landing-page,.cabinet-page,.saas-admin) :is(
    a.primary,button.primary,a.outline,button.outline,.cab-button,.cab-inline-button,
    .saas-button,.workspace-filter-button,.task-secondary,a.price-action,button.price-action,
    .referral-button,.api-button,.mcp-button,input[type="submit"]
  ):not(:disabled,[aria-disabled="true"],.muted):active { transform: scale(.98); }
}
body:is(.landing-page,.cabinet-page,.saas-admin) :is(
  input:not([type="checkbox"],[type="radio"],[type="range"],[type="hidden"],[type="button"],[type="submit"]),
  select,textarea
) { transition: border-color var(--motion-time) ease, box-shadow var(--motion-time) ease, background-color var(--motion-time) ease; }
body:is(.landing-page,.cabinet-page,.saas-admin) :is(
  input:not([type="checkbox"],[type="radio"],[type="range"],[type="hidden"],[type="button"],[type="submit"]),
  select,textarea
):not(:disabled,[readonly]):focus { border-color: var(--motion-edge); box-shadow: 0 0 0 3px var(--motion-ring); }

/* Dense navigation and tables: color feedback without moving the rows. */
body:is(.cabinet-page,.saas-admin) :is(
  .cabinet-sidebar .side,.cab-tabs a,.admin-section-tabs a,.crm-integration-tabs a,
  .referral-tab,.notify-settings-tabs a,.account-popover a,.workspace-toolbar a
) { transition: color var(--motion-time) ease, background-color var(--motion-time) ease,
  border-color var(--motion-time) ease, box-shadow var(--motion-time) ease; }
body:is(.cabinet-page,.saas-admin) :is(
  .cab-table,.saas-table,#result_list,.payment-history-table
) tbody tr > :is(td,th) { transition: background-color var(--motion-time) ease; }
@media (hover: hover) and (pointer: fine) {
  body:is(.cabinet-page,.saas-admin) :is(.cab-table,.saas-table,#result_list,.payment-history-table)
    tbody tr:not(.selected,.is-selected,[aria-selected="true"]):hover > :is(td,th) {
    background-color: var(--ui-accent-bg,#edf2ff);
  }
  body:is(.cabinet-page,.saas-admin) .cabinet-sidebar .side:hover {
    box-shadow: inset 2px 0 0 #9eb4ff;
  }
}

/* Repeatable entrance for menus/dialogs (without overwriting their positioning). */
@media (prefers-reduced-motion: no-preference) {
  @keyframes motion-pop-in {
    from { opacity: .35; translate: 0 5px; }
    to { opacity: 1; translate: 0 0; }
  }
  body:is(.landing-page,.cabinet-page,.saas-admin) :is(
    details[open] > .account-popover,details[open] > .public-features-panel,
    dialog[open]:not(.lead-modal)
  ) { animation: motion-pop-in 180ms var(--motion-ease); }
  @keyframes motion-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  body:is(.cabinet-page,.saas-admin) dialog[open]:not(.lead-modal)::backdrop {
    animation: motion-backdrop-in 150ms ease-out;
  }
}
@media (prefers-reduced-motion: reduce) {
  body:is(.cabinet-page,.saas-admin) :is(
    .cab-card,.saas-card,.cab-metric,.saas-metric,.price-card,.benchmark-card,
    .referral-stat-grid > div,.lead-card,.task-kanban-card,.cab-icon,.metric-icon,
    a,button,input,select,textarea,dialog,.account-popover,
    .cab-table td,.saas-table td,#result_list td
  ) { transition: none !important; animation: none !important; }
}

/* Keyboard feedback uses the existing theme focus outlines as well. */
body:is(.landing-page,.cabinet-page,.saas-admin) :is(
  .cab-metric,.saas-metric,.lead-card,.task-kanban-card,.price-card,.landing-feature
):focus-visible {
  border-color: var(--motion-edge);
  box-shadow: var(--motion-glow);
}
