/* Immersive layer for both dashboards: a slow ambient glow in the server's (or department's) colour,
   fine grain, glass headers, a light that follows the pointer over cards, and gentle entrances.
   --brand is the server colour on the admin dashboard and the department's colour on the department
   dashboard. Reduced motion keeps the look and drops the movement. */
.im-amb { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.im-amb i { position: absolute; border-radius: 50%; opacity: .16; --c: var(--im1, #3B5BDB); background: radial-gradient(closest-side, var(--c), color-mix(in srgb, var(--c) 45%, transparent) 45%, transparent); }
/* Still, not drifting: a moving glow made the browser redraw the blurred top bar on every frame. */
.im-amb i:nth-child(1) { width: 80vmax; height: 80vmax; left: -30vmax; top: -38vmax; }
.im-amb i:nth-child(2) { width: 62vmax; height: 62vmax; right: -26vmax; top: 8vh; opacity: .09; }
.im-amb i:nth-child(3) { width: 70vmax; height: 70vmax; left: 22vw; bottom: -46vmax; opacity: .07; }
.im-amb::after { content: ''; position: absolute; inset: 0; opacity: .025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
@keyframes im-a { to { transform: translate(9vmax, 7vmax) scale(1.12); } }
@keyframes im-b { to { transform: translate(-8vmax, 10vmax) scale(.92); } }
/* Holiday themes tint the glow with the holiday's colours. */
html[data-holiday] .im-amb i:nth-child(1) { --c: var(--hol1); opacity: .13; }
html[data-holiday] .im-amb i:nth-child(2) { --c: var(--hol2); }
html[data-holiday] .im-amb i:nth-child(3) { --c: var(--hol3); }

/* Pages slide in when you open them */
.view:not(.hidden) { animation: im-view .42s cubic-bezier(.2,.7,.2,1) backwards; /* not "both": a kept transform would trap fixed drawers inside the view */ }
.dd-main > * { animation: im-view .45s cubic-bezier(.2,.7,.2,1) backwards; }
.dd-main > *:nth-child(2) { animation-delay: .05s; } .dd-main > *:nth-child(3) { animation-delay: .1s; } .dd-main > *:nth-child(4) { animation-delay: .15s; } .dd-main > *:nth-child(n+5) { animation-delay: .2s; }
@keyframes im-view { from { opacity: 0; transform: translateY(8px); } }

/* Headings with a little depth */
.page-head h2, .dd-pick-head h1, .dd-login h1 { background: linear-gradient(180deg, #FFFFFF 30%, #B8BAC6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cmd-eyebrow, .dd-eyebrow { text-shadow: 0 0 18px color-mix(in srgb, var(--im1, #3B5BDB) 60%, transparent); }

/* Glass top bars */
.topbar, .dd-top { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* A light that follows the pointer over cards (immersive.js sets --mx and --my) */
.im-spot { background-image: radial-gradient(420px circle at var(--mx, -999px) var(--my, -999px), rgb(255 255 255 / .055), transparent 45%); }
.dcard.im-spot { background-image: radial-gradient(420px circle at var(--mx, -999px) var(--my, -999px), color-mix(in srgb, var(--dc) 18%, transparent), transparent 50%); }
.dd-pickcard.im-spot { background-image: radial-gradient(380px circle at var(--mx, -999px) var(--my, -999px), color-mix(in srgb, var(--dc) 20%, transparent), transparent 50%); }

/* Department cards lift and glow in their colour */
.dcard, .dd-pickcard, .cc-tile, .dd-tile { transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .25s, border-color .2s; }
.dcard:hover { transform: translateY(-3px); box-shadow: 0 18px 44px -20px var(--dc); }
.dd-pickcard:hover { transform: translateY(-3px); box-shadow: 0 18px 44px -20px var(--dc, #3B5BDB); }
.cc-tile:hover, .dd-tile:hover { transform: translateY(-2px); }

/* Active sidebar item glows */
.nav button.active::before { box-shadow: 0 0 14px 1px color-mix(in srgb, var(--im1, #fff) 70%, transparent); }

/* Primary buttons get a sheen on hover */
.btn-white, .btn-primary { position: relative; overflow: hidden; }
.btn-white::after, .btn-primary::after { content: ''; position: absolute; inset: 0; transform: translateX(-120%); background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / .35) 50%, transparent 70%); pointer-events: none; }
.btn-white:hover::after, .btn-primary:hover::after { transform: translateX(120%); transition: transform .7s ease; }

/* Numbers count up the first time a page shows them (immersive.js) */
.im-count { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .im-amb i, .view:not(.hidden), .dd-main > * { animation: none !important; }
  .dcard:hover, .dd-pickcard:hover, .cc-tile:hover, .dd-tile:hover { transform: none; }
  .btn-white:hover::after, .btn-primary:hover::after { transition: none; }
}

/* ---------- Lite mode (perf.js) and cheaper effects ---------- */
html.lite .im-amb, html.lite .hol-fx { display: none !important; }
html.lite .topbar, html.lite .dd-top, html.lite .cv-top, html.lite .hol-ribbon, html.lite .k-pal, html.lite .cv-login, html.lite .ap-card { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
html.lite .topbar, html.lite .dd-top, html.lite .cv-top { background: var(--ground, #0A0A0B) !important; }
html.lite *, html.lite *::before, html.lite *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; }
html.lite .im-spot { background-image: none !important; }
html.lite .dcard:hover, html.lite .dd-pickcard:hover, html.lite .cc-tile:hover, html.lite .dd-tile:hover { transform: none; box-shadow: none; }
html.lite .ap-ambient { display: none; }
.perf-note { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 320; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  padding: 8px 8px 8px 14px; border-radius: 12px; background: #17171A; border: 1px solid #2E2E34; color: #EDEDF0; font: 500 13px/1.35 Archivo, system-ui, sans-serif; box-shadow: 0 12px 30px -12px rgb(0 0 0 / .6); }
.perf-note button { border: 0; background: rgb(255 255 255 / .09); color: #fff; font: 600 12px/1 Archivo, system-ui, sans-serif; padding: 7px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.perf-note button:hover { background: rgb(255 255 255 / .16); }
