/* Motion for the live portal. Keep controls stationary and draw feedback inside them. */
@media screen {
    body.portal-body.ejmc-visual-refresh {
        --work-blue: var(--primary);
        --work-focus: var(--primary);
        --desk-accent: var(--primary);
        --desk-wash: color-mix(in srgb, var(--primary) 8%, var(--surface));
    }
    body.portal-body.ejmc-visual-refresh #tourDialog .tour-card {
        display: flex; flex-direction: column; overflow: hidden;
    }
    #tourDialog .tour-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
    #tourCopy { color: var(--text-soft); font-size: .9rem; line-height: 1.55; margin: 0 0 .8rem; }
    #tourDialog .tour-jump { flex: none; min-width: 0; margin: 0; padding-top: .55rem; }
    #tourDialog .tour-actions { flex: none; position: static; padding-top: .65rem; }
    #tourDialog #tourNotice:not([hidden]) { margin: .4rem 0 0; font-size: .85rem; line-height: 1.35; }
    .view :is(.academic-tabs,.academic-course-tabs,.schedule-tabs,.teaching-tabs,.planning-tabs,.standardized-tabs,.support-tabs,.v4-tabs,.communication-tabs,.r47-personality-tabs) > button { position: relative; }
    .view :is(.academic-tabs,.academic-course-tabs,.schedule-tabs,.teaching-tabs,.planning-tabs,.standardized-tabs,.support-tabs,.v4-tabs,.communication-tabs,.r47-personality-tabs) > button[data-tab-travel]::after {
        content: ""; position: absolute; inset: auto 8px 0; height: 2px; pointer-events: none;
        background-color: currentColor; transform-origin: left;
    }
}
@media screen and (prefers-reduced-motion: no-preference) {
    .view :is(.academic-tabs,.academic-course-tabs,.schedule-tabs,.teaching-tabs,.planning-tabs,.standardized-tabs,.support-tabs,.v4-tabs,.communication-tabs,.r47-personality-tabs) > button::after {
        transition: transform 165ms cubic-bezier(.22,.8,.25,1);
    }
    .view :is(#replacementUpcomingDetails,.standardized-oa,.planning-activity-detail,.planning-unit-proposal-details) > summary::before {
        transition: transform 140ms cubic-bezier(.22,.8,.25,1);
    }
    /* The title and selected tab carry the transition. Tables, editors and their hit targets stay still. */
    body.portal-body.ejmc-visual-refresh .view.active { animation: none; }
    body.portal-body.ejmc-visual-refresh .view button[data-tab-travel]:is(.active,[aria-selected=true],[aria-pressed=true],[aria-current=page])::after {
        animation: ejmc-tab-travel 190ms var(--motion-ease);
    }
    @keyframes ejmc-tab-travel {
        from { transform: translateX(var(--tab-offset)) scaleX(var(--tab-scale)); }
        to { transform: translateX(0) scaleX(1); }
    }
    body.portal-body.ejmc-visual-refresh #sidebar .nav-item.active .nav-icon,
    body.portal-body.ejmc-visual-refresh .mobile-bottom-nav button[aria-current=page] svg {
        animation: ejmc-nav-selected 160ms var(--motion-ease);
    }
    @keyframes ejmc-nav-selected {
        from { scale: .88; opacity: .72; }
        to { scale: 1; opacity: 1; }
    }
    body.portal-body.ejmc-visual-refresh :is(dialog[open], [role=dialog]:not(#sidebar), #notificationPopover, #userMenu, #globalSearchResults):not([hidden]) {
        animation: ejmc-panel-open 145ms var(--motion-ease);
    }

    body.portal-body.ejmc-visual-refresh .view :is(.quick-action,.quick-module-open,.directory-open,.admin-tool-card,.r45-record-student,.enrollment-course-card,.planning-subject),
    body.portal-body.ejmc-visual-refresh :is(.view,dialog,[role=dialog]) :is(input:not([type=checkbox],[type=radio]),textarea,select) {
        transition: background-color 130ms ease-out, border-color 130ms ease-out, color 130ms ease-out;
    }
    body.portal-body.ejmc-visual-refresh :is(.quick-action > span,.quick-module-icon,.directory-icon) svg {
        transition: translate 150ms var(--motion-ease);
    }
    body.portal-body.ejmc-visual-refresh :is(.view,dialog,[role=dialog]) :is(.primary-button,.button-light,.planning-primary,.experience-primary,.teaching-primary):enabled {
        transition: background-color 130ms ease-out, border-color 130ms ease-out, filter 100ms ease-out;
    }
}
@media screen {
    body.portal-body.ejmc-visual-refresh :is(.view,dialog,[role=dialog]) :is(input:not([type=checkbox],[type=radio],[type=file]),textarea,select):focus-visible {
        border-color: var(--desk-accent, var(--work-focus));
    }
    body.portal-body.ejmc-visual-refresh :is(.view,dialog,[role=dialog]) label:focus-within > span:first-child:not(:only-child) {
        color: var(--desk-accent, var(--work-focus));
    }
    body.portal-body.ejmc-visual-refresh .view :is(.directory-open,.r45-record-student,.enrollment-course-card,.planning-subject):focus-visible {
        outline-offset: -2px;
    }
    body.portal-body.ejmc-visual-refresh :is(.view,dialog,[role=dialog]) :is(.primary-button,.button-light,.planning-primary,.experience-primary,.teaching-primary):enabled:active {
        filter: brightness(.92);
    }
}
@media screen and (hover: hover) and (pointer: fine) {
    body.portal-body.ejmc-visual-refresh #viewHome #miniCalendar .calendar-cell:enabled:hover {
        outline: 1px solid var(--work-blue); outline-offset: -2px;
    }
    body.portal-body.ejmc-visual-refresh .view :is(.directory-open,.r45-record-student,.enrollment-course-card,.planning-subject,.admin-tool-card):enabled:hover {
        background-color: var(--desk-wash); border-color: var(--desk-accent);
    }
    body.portal-body.ejmc-visual-refresh :is(.ap-table,.enrollment-table,.academic-table,.teaching-table,.admin-table) tbody tr:has(:is(button:enabled,a[href])):hover {
        background-color: var(--desk-wash);
    }
}
@media screen and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    body.portal-body.ejmc-visual-refresh :is(.quick-action,.quick-module-open,.directory-open):enabled:hover > span > svg {
        translate: 2px 0;
    }
}
@media screen and (prefers-reduced-motion: reduce) {
    body.portal-body.ejmc-visual-refresh :is(.view.active,dialog[open],[role=dialog],#notificationPopover,#globalSearchResults,#userMenu) {
        animation: none;
    }
}
@media (forced-colors: active) {
    .view :is(.v4-tabs,.standardized-tabs,.academic-tabs,.schedule-tabs,.teaching-tabs,.planning-tabs,.communication-tabs,.support-tabs) > button:is(.active,[aria-selected=true],[aria-pressed=true]) { outline: 2px solid Highlight; outline-offset: -2px; }
}

@media screen and (prefers-reduced-motion: reduce) {
    .view [data-tab-travel]::after { content: none; }
}
body.login-body.ejmc-visual-refresh .form-field:focus-within > span:first-child,
body.login-body.ejmc-visual-refresh .password-row:focus-within label { color: var(--primary); }
body.login-body.ejmc-visual-refresh .primary-button:enabled:active { filter: brightness(.92); }
@media screen and (prefers-reduced-motion: no-preference) {
    body.login-body.ejmc-visual-refresh .form-field > span:first-child { transition: color 130ms ease-out; }
    body.login-body.ejmc-visual-refresh .primary-button { transition: background-color 130ms ease-out, filter 100ms ease-out; }
}

/* Shared wayfinding, form focus and feedback for the institutional workspaces. */
@media screen {
 body.portal-body.ejmc-visual-refresh {
  --portal-row-tint: color-mix(in srgb, var(--primary) 7%, var(--surface));
  --portal-focus-halo: color-mix(in srgb, var(--primary) 23%, transparent);
 }
 body.portal-body.ejmc-visual-refresh .view h1 {
  line-height: 1.16; letter-spacing: -.025em; text-wrap: balance;
 }
 body.portal-body.ejmc-visual-refresh #viewHome .welcome-header {
  padding: clamp(.9rem, 2.5vw, 1.5rem) clamp(.85rem, 2.7vw, 1.85rem);
  border: 0; border-block-start: 2px solid var(--primary); border-block-end: 1px solid var(--border);
  border-radius: 0; background: var(--surface); gap: .75rem 1.25rem;
 }
 body.portal-body.ejmc-visual-refresh #viewHome #homeGreeting {
  font-size: clamp(1.45rem, 2.35vw, 2rem); line-height: 1.16; font-weight: 650;
 }
 body.portal-body.ejmc-visual-refresh #viewHome .summary-card strong,
 body.portal-body.ejmc-visual-refresh .view :is(td,dd,.ap-metric) { font-variant-numeric: tabular-nums; }
 #sidebar .nav-item, .mobile-bottom-nav button[data-view], #miniCalendar .calendar-cell { position: relative; }
 .portal-selection-mark { position: absolute; display: block; pointer-events: none; font-style: normal; }
 body.portal-body.ejmc-visual-refresh #sidebar .nav-item.active:has(> .portal-selection-mark) { border-left-color: transparent; }
 #sidebar .nav-item > .portal-selection-mark {
  width: 3px; height: 1.35rem; inset-inline-start: -1px; inset-block-start: calc(50% - .675rem);
  background: #9dcfe9; border-radius: 2px;
 }
 .mobile-bottom-nav button > .portal-selection-mark {
  inset-block-start: 0; inset-inline-start: calc(50% - 12px); width: 24px; height: 3px;
  background: var(--primary); border-radius: 0 0 2px 2px;
 }
 #miniCalendar .calendar-cell > .portal-selection-mark {
  inset: 1px; border: 1px solid var(--primary); border-radius: inherit;
 }
 body.portal-body.ejmc-visual-refresh .view :is(.module-card > button[data-module-code],.directory-open,.quick-module-open,.admin-tool-card) {
  text-align: start;
 }
 body.portal-body.ejmc-visual-refresh .view :is(.module-card,.directory-item,.quick-module):focus-within {
  outline: 2px solid var(--primary); outline-offset: -2px;
 }
 body.portal-body.ejmc-visual-refresh :is(.view,dialog,[role=dialog]) :is(input:not([type=checkbox],[type=radio],[type=file]),textarea,select):focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px;
 }
 body.portal-body.ejmc-visual-refresh .view table tbody tr:focus-within > :is(th,td):first-child {
  box-shadow: inset 0 -2px var(--primary);
 }
 body.portal-body.ejmc-visual-refresh .module-card [data-favorite-code].active svg,
 body.portal-body.ejmc-visual-refresh .quick-module [data-favorite-code].active svg {
  color: var(--primary); fill: color-mix(in srgb,var(--primary) 24%,transparent);
 }
 body.portal-body.ejmc-visual-refresh .view .home-priority-student:is(:hover,:focus-visible) { background-color: var(--portal-row-tint); }
 body.portal-body.ejmc-visual-refresh :is(dialog[open],[role=dialog]) :is(.modal-header,.admin-modal-header,.ap-dialog-heading) {
  border-block-end-color: var(--border);
 }
}
@media screen and (hover:hover) and (pointer:fine) {
 body.portal-body.ejmc-visual-refresh .view .module-card:has(> button[data-module-code]:hover) {
  border-color: var(--primary); background-color: var(--portal-row-tint);
 }
}
@media screen and (prefers-reduced-motion:no-preference) {
 body.portal-body.ejmc-visual-refresh :is(dialog[open],[role=dialog]:not(#sidebar)):not([hidden]) {
  animation: ejmc-panel-open 205ms cubic-bezier(.18,.78,.24,1);
 }
 @keyframes ejmc-panel-open { from { opacity:.78; translate:0 var(--dialog-travel,7px); } to { opacity:1; translate:0 0; } }
 body.portal-body.ejmc-visual-refresh :is(#userMenu,#notificationPopover,#globalSearchResults):not([hidden]) {
  animation: portal-attached-open 160ms ease-out;
 }
 @keyframes portal-attached-open { from {opacity:.72;translate:0 -5px} to {opacity:1;translate:0 0} }
 body.portal-body.ejmc-visual-refresh dialog[open]::backdrop { animation: portal-scrim-open 155ms ease-out; }
 @keyframes portal-scrim-open { from {opacity:.35} to {opacity:1} }
 body.portal-body.ejmc-visual-refresh #toastStack .toast {
  animation: portal-notice-in 190ms cubic-bezier(.18,.78,.24,1);
 }
 @keyframes portal-notice-in { from {opacity:.7;translate:0 5px} to {opacity:1;translate:0 0} }
 body.portal-body.ejmc-visual-refresh .view :is(.module-card,.quick-module,.home-priority-student) {
  transition: background-color 140ms ease-out, border-color 140ms ease-out;
 }
 body.portal-body.ejmc-visual-refresh .view .module-card [data-favorite-code].active svg,
 body.portal-body.ejmc-visual-refresh .view .quick-module [data-favorite-code].active svg {
  animation: portal-favorite-set 160ms ease-out;
 }
 @keyframes portal-favorite-set { from {scale:.8} to {scale:1} }
 body.login-body.ejmc-visual-refresh .login-form .primary-button:enabled { transition: background-color 140ms, box-shadow 140ms; }
}
@media screen and (max-width:650px) {
 body.portal-body.ejmc-visual-refresh { --dialog-travel: 10px; }
 body.portal-body.ejmc-visual-refresh #viewHome .welcome-header { padding: .9rem 1rem; }
}
@media screen and (prefers-reduced-motion:reduce) {
 body.portal-body.ejmc-visual-refresh #toastStack .toast,
 body.portal-body.ejmc-visual-refresh dialog[open]::backdrop { animation:none; }
}
@media (forced-colors:active) {
 .portal-selection-mark { background-color: Highlight; }
 #miniCalendar .portal-selection-mark { background: transparent; border-color: Highlight; }
}
@media print { .portal-selection-mark { display:none; } }
