/* ─────────────────────────────────────────────────────────────
   cl-global-loader.css — universal brand loading overlay.

   A single full-viewport scrim shown during slow HTMX request cycles and
   full-page form submits (see static/js/cl-global-loader.js). Every colour
   + font reads a design token, so it themes natively in both theatres:
   forest-green in Operations, gold in the Student shell (via the
   operations-palette bridge in student_base.html). The hard-coded fallbacks
   keep it on-brand on token-less standalone pages (e.g. the login screen,
   which loads cl-brand-utilities.css but not the full design system).
   ───────────────────────────────────────────────────────────── */

.cl-loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;                 /* above app chrome, modals (10090) + FABs */
  display: flex;
  align-items: center;
  justify-content: center;

  /* Slightly translucent background token + frosted backdrop. color-mix is
     the codebase idiom for token-derived alpha (no --cream-2-rgb needed). */
  background: color-mix(in srgb, var(--cream-2, #f3ede2) 85%, transparent);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  /* Fade the scrim; defer the visibility flip to the end of the fade-out so
     it can't swallow clicks mid-transition. Instant on the way in. */
  transition: opacity 0.2s ease-in-out, visibility 0s linear 0.2s;
}

.cl-loader-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.2s ease-in-out, visibility 0s;
}

.cl-loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  /* Gentle rise-in so the splash settles rather than snapping in. */
  animation: cl-loader-rise 0.28s ease both;
}

/* Brand mark: a spinning ring orbiting the school logo chip. */
.cl-loader-badge {
  position: relative;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
}

.cl-loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--brand-primary, #1b4332) 16%, transparent);
  border-top-color: var(--brand-primary, #1b4332);
  animation: cl-loader-spin 0.8s linear infinite;
}

.cl-loader-logo {
  position: relative;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--paper, #ffffff);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

/* Initials fallback, shown when the logo image is absent/removed. */
.cl-loader-mono {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--display, 'Inter', system-ui, sans-serif);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--brand-primary, #1b4332);
}

.cl-loader-logo img {
  position: relative;
  width: 74%;
  height: 74%;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}

.cl-loader-title {
  margin: 0;
  max-width: 340px;
  font-family: var(--display, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--ink, #2d3142);
}

.cl-loader-text {
  margin: 0;
  font-family: var(--body, var(--display, 'Inter', system-ui, sans-serif));
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-dim, #6c7080);
}

@keyframes cl-loader-spin { to { transform: rotate(360deg); } }
@keyframes cl-loader-rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Respect reduced-motion: keep the scrim, calm the spin, drop the movement. */
@media (prefers-reduced-motion: reduce) {
  .cl-loader-overlay { transition: opacity 0.01s linear, visibility 0s; }
  .cl-loader-content { animation: none; }
  .cl-loader-ring { animation-duration: 1.6s; }
}
