/* Data-loading wave.
   The Add Cards XP figures hide a not-yet-known number behind a bar, and a
   highlight sweeps across that bar until the server answers. This is that
   sweep for every other value, list, and card that is waiting on the server.

   The sweep is a transform on ::after. An infinite animation may change
   transform and opacity only (AGENTS.md heat budget). Do not move this
   wave onto background-position.

   Remove the class, or replace the placeholder node, when the data arrives.
   prefers-reduced-motion leaves the dim bar and drops the sweep. */

@-webkit-keyframes ah-shimmer-wave {
  from { -webkit-transform: translateX(-130%); transform: translateX(-130%); }
  to { -webkit-transform: translateX(240%); transform: translateX(240%); }
}
@keyframes ah-shimmer-wave {
  from { -webkit-transform: translateX(-130%); transform: translateX(-130%); }
  to { -webkit-transform: translateX(240%); transform: translateX(240%); }
}

.ah-shimmer,
.ah-shimmer-bar,
.ah-shimmer-fill,
.ah-shimmer-card,
.ah-shimmer-stack,
.loading-circle,
.loading-circle-small,
.loading-circle-large {
  position: relative;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.10);
}

/* A number or short label. The text stays in the box so the width matches
   the value, but it is invisible until the class comes off. */
.ah-shimmer {
  display: inline-block;
  min-width: 1.7em;
  min-height: 0.85em;
  border-radius: 4px;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  vertical-align: middle;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}
.ah-shimmer:empty { min-width: 2.2em; }
.ah-shimmer--num { min-width: 2em; min-height: 1em; }
.ah-shimmer--meta { min-width: 6.5em; min-height: 0.9em; }
.ah-shimmer--title { min-width: 8em; max-width: 100%; min-height: 1.05em; }
.ah-shimmer--line {
  display: block;
  width: 100%;
  max-width: 280px;
  height: 12px;
  min-height: 12px;
}
@supports (width: min(1px, 2px)) {
  .ah-shimmer--title { min-width: min(8em, 100%); }
}

.xp-counter > .ah-shimmer { -webkit-align-self: center; -ms-flex-item-align: center; align-self: center; }
/* The heart and brain numbers are already absolutely centered. */
.ah-vital-num.ah-shimmer {
  position: absolute;
  min-width: 1.1em;
  min-height: 0.9em;
}

.ah-shimmer-bar {
  display: block;
  height: 12px;
  width: 100%;
  max-width: 100%;
  border-radius: 6px;
  box-sizing: border-box;
}
.ah-shimmer-bar--title { height: 14px; width: 72%; }
.ah-shimmer-bar--media { height: 72px; border-radius: 8px; }

.ah-shimmer-stack,
.ah-shimmer-list,
.ah-shimmer-grid {
  position: relative;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  pointer-events: none;
  background-color: transparent;
}
.ah-shimmer-bar { background-color: rgba(255, 255, 255, 0.16); }
.ah-shimmer-stack {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}
.ah-shimmer-stack > .ah-shimmer-bar:nth-child(2) { width: 96%; }
.ah-shimmer-stack > .ah-shimmer-bar:nth-child(3) { width: 78%; }
.ah-shimmer-stack > .ah-shimmer-bar:nth-child(4) { width: 90%; }
.ah-shimmer-stack > .ah-shimmer-bar:nth-child(5) { width: 66%; }
.ah-shimmer-stack > .ah-shimmer-bar:nth-child(6) { width: 84%; }

.ah-shimmer-list {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  gap: 12px;
}
.ah-shimmer-grid {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
}
.ah-shimmer-grid > .ah-shimmer-card {
  -webkit-box-flex: 1;
  -ms-flex: 1 1 220px;
  flex: 1 1 220px;
}
@supports (display: grid) {
  .ah-shimmer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }
}
@supports (width: min(1px, 2px)) {
  .ah-shimmer-grid { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
}

.ah-shimmer-card {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 148px;
  padding: 12px;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background-color: rgba(21, 23, 24, 0.45);
  pointer-events: none;
}
.ah-shimmer-card--row {
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -ms-flex-direction: row;
  flex-direction: row;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  min-height: 88px;
}
.ah-shimmer-card--row .ah-shimmer-bar--media {
  width: 64px;
  height: 64px;
  -webkit-box-flex: 0;
  -ms-flex: 0 0 64px;
  flex: 0 0 64px;
}
.ah-shimmer-copy {
  -webkit-box-flex: 1;
  -ms-flex: 1 1 140px;
  flex: 1 1 140px;
  min-width: 0;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  gap: 8px;
}

.ah-shimmer::after,
.ah-shimmer-fill::after,
.ah-shimmer-card::after,
.ah-shimmer-stack::after,
.loading-circle::after,
.loading-circle-small::after,
.loading-circle-large::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 46%;
  background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
  -webkit-transform: translateX(-130%);
  transform: translateX(-130%);
  -webkit-animation: ah-shimmer-wave 1.15s ease-in-out infinite;
  animation: ah-shimmer-wave 1.15s ease-in-out infinite;
  pointer-events: none;
}
.ah-shimmer-stack > .ah-shimmer-bar:nth-child(3)::after,
.ah-shimmer-card:nth-child(3)::after,
.ah-shimmer-fill:nth-child(3)::after { -webkit-animation-delay: 0.12s; animation-delay: 0.12s; }
.ah-shimmer-stack > .ah-shimmer-bar:nth-child(4)::after,
.ah-shimmer-card:nth-child(4)::after,
.ah-shimmer-fill:nth-child(4)::after { -webkit-animation-delay: 0.24s; animation-delay: 0.24s; }
.ah-shimmer-card:nth-child(5)::after,
.ah-shimmer-fill:nth-child(5)::after { -webkit-animation-delay: 0.36s; animation-delay: 0.36s; }
.ah-shimmer-card:nth-child(6)::after,
.ah-shimmer-fill:nth-child(6)::after { -webkit-animation-delay: 0.48s; animation-delay: 0.48s; }

/* Bars inside a sweeping card or stack stay flat. One wave per placeholder. */
.ah-shimmer-card > .ah-shimmer-bar::after,
.ah-shimmer-card .ah-shimmer-bar::after,
.ah-shimmer-stack > .ah-shimmer-bar::after {
  content: none;
  -webkit-animation: none;
  animation: none;
}

.ah-shimmer-fill {
  background-color: rgba(255, 255, 255, 0.07);
}

.ah-shimmer-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Leftover spinners that mean "this data is not here yet" become the same bar.
   The full-page covers (.page-loading-spinner, #ahPageLoader) are not these. */
.loading-circle,
.loading-circle-small,
.loading-circle-large {
  display: inline-block;
  position: relative !important;
  overflow: hidden !important;
  width: 7.5em !important;
  height: 0.72em !important;
  min-height: 0.72em !important;
  margin: 0;
  border: 0 !important;
  border-radius: 4px !important;
  background-color: rgba(255, 255, 255, 0.10) !important;
  background-image: none !important;
  -webkit-animation: none !important;
  animation: none !important;
  vertical-align: middle;
}
.loading-circle-small {
  width: 4.5em !important;
  height: 0.65em !important;
  min-height: 0.65em !important;
}
.loading-container > .loading-circle,
.loading-container > .loading-circle-small,
.loading-container > .loading-circle-large,
.loading > .loading-circle,
.add-friend-loading > .loading-circle {
  display: block !important;
  width: 240px !important;
  max-width: 100% !important;
  height: 12px !important;
  min-height: 12px !important;
  margin-left: auto;
  margin-right: auto;
}

.loading-container > .ah-shimmer-stack,
.loading-container > .ah-shimmer-list,
.loading-container > .ah-shimmer-grid,
.loading > .ah-shimmer-stack,
[data-ah-shimmer-ready] > .ah-shimmer-stack {
  width: 100%;
  -webkit-align-self: stretch;
  -ms-flex-item-align: stretch;
  align-self: stretch;
}
.loading:not(body)[data-ah-shimmer-ready] {
  opacity: 1;
  color: transparent;
}
.loading:not(body)[data-ah-shimmer-ready]::after {
  content: none !important;
  display: none !important;
  border: 0 !important;
  -webkit-animation: none !important;
  animation: none !important;
}

#grid > .ah-shimmer-card { min-height: 220px; }
#ccExternalGrid:not([data-cc-loading]) > .ah-shimmer-card { display: none; }

@media (max-width: 932px) {
  .ah-shimmer-grid > .ah-shimmer-card:nth-of-type(n + 4),
  #grid > .ah-shimmer-card:nth-of-type(n + 4),
  #ccExternalGrid > .ah-shimmer-card:nth-of-type(n + 4),
  #investigatorsContainer .ah-shimmer-card:nth-of-type(n + 4) {
    display: none;
  }
  #grid > .ah-shimmer-card { min-height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  .ah-shimmer::after,
  .ah-shimmer-fill::after,
  .ah-shimmer-card::after,
  .ah-shimmer-stack::after,
  .loading-circle::after,
  .loading-circle-small::after,
  .loading-circle-large::after {
    -webkit-animation: none;
    animation: none;
    opacity: 0;
  }
}
