/* Shared interaction rules. Keep the copy in both services identical.
   Load after page styles; :root gives these rules priority over legacy components.
   Reset controls and semantic danger/restore/cache colors retain their own styles. */
:root {
    --brand: #434660;
    --brand-deep: #34364f;
}

/* An operation, modal, new tab, download, or in-page selection stays in place. */
:root button:not(.reset-files):hover,
:root :is(.upload-button, .report-link, .artifact-button, .results-download, .viewer-action):hover {
    transform: none;
}

/* Primary actions, including print/download and the selected viewer tab. */
:root :is(
    .project-primary, .primary-action, .change-files, .artifact-button--download,
    .upload-button.primary, .analyze-button, .report-link:not(.secondary),
    .print, .modeling-callout a, .modeling-result-link,
    .analysis-nav-dialog__confirm, .analysis-nav__links a[aria-current="page"], .flight-mosaic-page .primary,
    .viewer-action-download, .view-tabs button.active, .results-download
):not(:disabled):not([aria-disabled="true"]) {
    color: #fff;
    border: 1px solid var(--brand);
    background: var(--brand);
    box-shadow: none;
}
:root :is(
    .project-primary, .primary-action, .change-files, .artifact-button--download,
    .upload-button.primary, .analyze-button, .report-link:not(.secondary),
    .print, .modeling-callout a, .modeling-result-link,
    .analysis-nav-dialog__confirm, .analysis-nav__links a[aria-current="page"], .flight-mosaic-page .primary,
    .viewer-action-download, .view-tabs button.active, .results-download
):not(:disabled):not([aria-disabled="true"]):hover {
    border-color: var(--brand-deep);
    background: var(--brand-deep);
    box-shadow: none;
    opacity: 1;
}

/* White controls preserve their existing label colors, including danger labels. */
:root :is(
    .project-hero .project-primary, .subtle-button, .complete-button,
    .rail-head button, .select-all-button, .restore-action, .purge-action, .trash-action,
    .artifact-button--view, .upload-button.secondary, .analysis-nav-dialog__cancel, .report-retry-button,
    .file-guide-trigger, .view-tabs button:not(.active),
     .job-button,
    .viewer-action:not(.viewer-action-download):not(.viewer-action-external):not([aria-pressed="true"])
):not(:disabled):not([aria-disabled="true"]) {
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: none;
}
:root .project-hero .project-primary:not(:disabled):not([aria-disabled="true"]) { color: var(--brand); }
:root :is(
    .project-hero .project-primary, .subtle-button, .complete-button,
    .rail-head button, .select-all-button, .restore-action, .purge-action, .trash-action,
    .artifact-button--view, .upload-button.secondary, .analysis-nav-dialog__cancel, .report-retry-button,
    .file-guide-trigger, .view-tabs button:not(.active),
    .group-row, .job-button, .drawer-job-toggle:not([aria-expanded="true"]), .candidate-list button:not(.active),
    .viewer-action:not(.viewer-action-download):not(.viewer-action-external):not([aria-pressed="true"])
):not(:disabled):not([aria-disabled="true"]):hover {
    border-color: var(--line);
    background: #f7f7fb;
    box-shadow: none;
    opacity: 1;
}

/* Navigation cards use the same fills as buttons. */
:root .project-tool:not(.featured) { border: 1px solid var(--line); background: #fff; box-shadow: none; }
:root .project-tool:not(.featured):not(.locked):hover { background: #f7f7fb; }
:root .project-tool.featured { border: 1px solid var(--brand); background: var(--brand); box-shadow: none; }
:root .project-tool.featured:not(.locked):hover { border-color: var(--brand-deep); background: var(--brand-deep); }
:root .project-tool.locked:hover { transform: none; }

/* Row lists use the button border while preserving selected-state indicators. */
:root .work-card { border: 1px solid var(--line); box-shadow: none; }

:root :is(.group-row, .job-button, .work-card):hover { background: #f7f7fb; box-shadow: none; }
:root .drawer-job-toggle:not([aria-expanded="true"]):hover { background: #f7f7fb; }
:root .project-item:not(.active):hover{ background: #fff; }
:root .sample-nav-item:not(.active):hover { background: #f7f7fb; }

/* Close controls are independent of generic white button rules. */
:root .close-icon-button {
    color: var(--muted);
    background: transparent;
    border: 0;
    box-shadow: none;
}
:root .close-icon-button:hover {
    color: var(--brand);
    background: var(--paper);
    box-shadow: none;
    transform: none;
}

.modeling-result-link {
    display: inline-block;
    margin-top: 8px;
    padding: 9px 13px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
}
.report-retry-button { padding: 9px 14px; border-radius: 9px; color: var(--brand); cursor: pointer; }
:root :is(.yield-table a.ui-navigate, .analysis-nav__notice a.ui-navigate) { display: inline-block; }

/* Opt in only when the action changes the current page. */
:root :is(.ui-navigate, .print, .modeling-result-link, .file-guide-trigger) {
    transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .18s ease;
}

@media (prefers-reduced-motion: reduce) {
    :root .ui-navigate:not(.locked):not(:disabled):not([aria-disabled="true"]):hover { transform: none; }
    :root :is(.ui-navigate, .print, .modeling-result-link, .file-guide-trigger) { transition: none; }
}
