/* Shared atmosphere and persistent color selection. */
:root[data-palette="aurora"] {
  --space-base: #0c1021;
  --space-panel: #141b30;
  --space-deep: #101526;
  --glow-one: 75 106 245;
  --glow-two: 154 75 219;
  --glow-line: 109 192 224;
}
:root[data-palette="gold"] {
  --space-base: #161310;
  --space-panel: #26221c;
  --space-deep: #191712;
  --glow-one: 192 128 32;
  --glow-two: 153 83 28;
  --glow-line: 205 180 105;
}
:root[data-palette="cyan"] {
  --space-base: #081a24;
  --space-panel: #102a36;
  --space-deep: #0b202b;
  --glow-one: 12 182 209;
  --glow-two: 91 87 212;
  --glow-line: 71 217 230;
}
:root, :root[data-palette="black"] {
  --space-base: #090a0c;
  --space-panel: #161719;
  --space-deep: #101113;
  --glow-one: 74 77 83;
  --glow-two: 48 50 54;
  --glow-line: 124 127 132;
}
html { background: var(--space-base); }
.palette-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid rgb(var(--glow-line) / .4);
  border-radius: 50%;
  background: var(--space-deep);
  box-shadow: none;
  color: #dce2ef;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  transition: border-color .2s, box-shadow .2s;
}
.palette-toggle[hidden] { display: none; }
.palette-toggle:hover { border-color: rgb(var(--glow-line) / .85); }
.palette-toggle:focus-visible { outline: 2px solid #f9ce16; outline-offset: 4px; }
.palette-swatch {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: conic-gradient(rgb(var(--glow-one)), rgb(var(--glow-two)), rgb(var(--glow-line)), rgb(var(--glow-one)));
  border: 1px solid #ffffff45;
}
@media (max-width: 767px) {
  .palette-toggle { top: 10px; right: 10px; }
}
body {
  background: var(--space-base);
  isolation: isolate;
  --atmosphere-strength: .48;
}
body:has(#home-carousel) { --atmosphere-strength: 1; }
body::before, body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
}
body::before {
  inset: -8%;
  background:
    radial-gradient(ellipse at 4% 26%, rgb(var(--glow-one) / .33), transparent 48%),
    radial-gradient(ellipse at 97% 65%, rgb(var(--glow-two) / .29), transparent 47%),
    radial-gradient(ellipse at 65% 0%, rgb(var(--glow-line) / .09), transparent 45%);
  opacity: var(--atmosphere-strength);
}
body::after {
  inset: 0;
  background-image: linear-gradient(rgb(var(--glow-line) / .065) 1px, transparent 1px), linear-gradient(90deg, rgb(var(--glow-line) / .065) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(90deg, #000, #0002 38%, #0002 62%, #000);
  opacity: var(--atmosphere-strength);
}
html[data-background-motion="running"] body:has(#home-carousel)::before {
  animation: atmosphere-drift 30s ease-in-out infinite alternate;
}
html[data-background-motion="paused"] body:has(#home-carousel)::before {
  animation: atmosphere-drift 30s ease-in-out infinite alternate;
  animation-play-state: paused;
}
body .column, body footer.footer { background: transparent; }
body .post-block { background: transparent; }
body .dropdown .dropdown-content {
  background: var(--space-deep);
  border: 1px solid rgb(var(--glow-line) / .2);
  border-radius: 2px;
  box-shadow: none;
}
body .category.posts-collapse .collection-title {
  background: var(--space-panel);
  border-color: rgb(var(--glow-line) / .25);
}
body .category.posts-collapse article .post-header,
body .post-nav .post-nav-item a {
  background: var(--space-panel);
  border-color: rgb(var(--glow-line) / .18);
}
body .post-resource-links .activity-resource, body nav.pagination a { background: var(--space-panel); }
body .post-resource-links .activity-resource:hover, body nav.pagination a:hover { background: var(--space-deep); }
.post-body #department-introduction > .nav-tabs {
  background: transparent;
  border-color: rgb(var(--glow-line) / .25);
}
.post-body #department-introduction .achievement-card {
  background: var(--space-panel);
  border-color: rgb(var(--glow-line) / .3);
  box-shadow: none;
}
.post-body #department-introduction .achievement-visual {
  background: var(--space-deep);
  border-color: rgb(var(--glow-line) / .2);
}
.post-body #department-introduction .duty-grid section {
  background: transparent;
  border-color: rgb(var(--glow-line) / .2);
}
.post-body #department-introduction .duty-grid section:hover { border-color: rgb(var(--glow-line) / .65); }
.department-heading { position: relative; padding-right: 150px; }
.department-heading h1 { scroll-margin-top: 70px; }
.department-heading .background-motion {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 6px 12px;
  border: 1px solid rgb(var(--glow-line) / .26);
  border-radius: 2px;
  background: var(--space-deep);
  color: #bcc4d5;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.background-motion[hidden] { display: none; }
.background-motion:disabled { cursor: default; opacity: .75; }
.background-motion:focus-visible { outline: 2px solid #f9ce16; outline-offset: 4px; }
@keyframes atmosphere-drift {
  from { transform: translate3d(-1%, -1%, 0); opacity: .76; }
  to { transform: translate3d(3%, 2%, 0); opacity: 1; }
}
@media (max-width: 767px) {
  body::before { background: radial-gradient(ellipse at 0 20%, rgb(var(--glow-one) / .26), transparent 65%), radial-gradient(ellipse at 100% 75%, rgb(var(--glow-two) / .22), transparent 60%); }
  body::after { background-size: 48px 48px; opacity: .4; }
  .department-heading { padding-right: 0; }
  .department-heading .background-motion { position: static; margin-top: 16px; }
  @keyframes atmosphere-drift {
    from { transform: translate3d(0, -1%, 0); opacity: .8; }
    to { transform: translate3d(1%, 1%, 0); opacity: 1; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .palette-toggle { transition: none; }
  html[data-background-motion] body:has(#home-carousel)::before { animation: none; transform: none; }
}
