/* ============================================================
   EduShieldID — components/utilities.css
   Small single-purpose helper classes (visibility, spacing,
   flex, text) plus the generated 1%-step width utilities used
   for server-computed progress/usage bars.
   ============================================================ */

/* ── Utilities ──────────────────────────────────────────────── */
/* Matches .visually-hidden in core-ui.css. The -1px margin belonged to the
   legacy `clip: rect()` hack, which needed the element pulled off its own
   1px box; clip-path does not. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Skip link — first focusable element on every page (layouts/base.html).
   WCAG 2.1 AA 2.4.1.

   Deliberately NOT .sr-only plus a focus override: an element hidden with
   clip-path is still in the layout, and browsers have historically differed
   on whether such a link is reachable by keyboard at all. Positioning it off
   the top edge and sliding it back on focus keeps it a real, focusable,
   paintable element the whole time — the point is that it works, not that it
   is hidden cleverly.

   The transition is suppressed under prefers-reduced-motion by the global
   rule in tokens.css. */
.skip-link {
  position: absolute;
  top: 0; left: var(--sp-4);
  z-index: 999;
  transform: translateY(-120%);
  padding: var(--sp-3) var(--sp-4);
  background: var(--clr-surface);
  color: var(--clr-text);
  border: 1px solid var(--clr-border-strong);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: transform 120ms ease-in-out;
}

.skip-link:focus {
  transform: translateY(0);
  /* Its own visible focus ring: it lands on an otherwise empty strip of
     page, so the default outline is the only thing marking where focus
     went. */
  outline: 2px solid var(--clr-primary);
  outline-offset: 2px;
}
.text-muted  { color: var(--clr-text-muted); }
.text-danger { color: var(--clr-danger); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.fw-600      { font-weight: var(--weight-semibold); }
.mt-1        { margin-top: var(--sp-1); }
.mt-3        { margin-top: var(--sp-3); }
.mt-4        { margin-top: var(--sp-4); }
.mt-8        { margin-top: var(--sp-8); }
.mb-1        { margin-bottom: var(--sp-1); }
.mb-3        { margin-bottom: var(--sp-3); }
.mb-4        { margin-bottom: var(--sp-4); }
.mb-5        { margin-bottom: var(--sp-5); }
.mb-8        { margin-bottom: var(--sp-8); }
.m-0         { margin: 0; }
.p-4         { padding: var(--sp-4); }
.d-inline    { display: inline; }
.d-none      { display: none; }
.file-input-hidden { display: none; }
.gap-4       { gap: var(--sp-4); }
.flex        { display: flex; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }

/* Font-size modifiers for .kpi-value (default is --text-3xl) */
.kpi-value-lg { font-size: var(--text-xl); }
.kpi-value-md { font-size: var(--text-lg); }

/* Taller variant of .fraud-score-bar for subscription usage meters */
.fraud-score-bar-lg { height: 14px; }

/* ── Width-percent utilities ────────────────────────────────────
   For any element whose width is a server-computed percentage
   (progress bars, usage meters) — e.g. class="fraud-score-fill w-pct-{{ pct|floatformat:0 }}".
   Generated in 1% steps so no inline `style="width:...%"` is ever needed
   (this app's CSP blocks the style attribute entirely). */

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .alert-stack { left: var(--sp-4); right: var(--sp-4); max-width: 100%; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

.w-pct-0 { width: 0%; }
.w-pct-1 { width: 1%; }
.w-pct-2 { width: 2%; }
.w-pct-3 { width: 3%; }
.w-pct-4 { width: 4%; }
.w-pct-5 { width: 5%; }
.w-pct-6 { width: 6%; }
.w-pct-7 { width: 7%; }
.w-pct-8 { width: 8%; }
.w-pct-9 { width: 9%; }
.w-pct-10 { width: 10%; }
.w-pct-11 { width: 11%; }
.w-pct-12 { width: 12%; }
.w-pct-13 { width: 13%; }
.w-pct-14 { width: 14%; }
.w-pct-15 { width: 15%; }
.w-pct-16 { width: 16%; }
.w-pct-17 { width: 17%; }
.w-pct-18 { width: 18%; }
.w-pct-19 { width: 19%; }
.w-pct-20 { width: 20%; }
.w-pct-21 { width: 21%; }
.w-pct-22 { width: 22%; }
.w-pct-23 { width: 23%; }
.w-pct-24 { width: 24%; }
.w-pct-25 { width: 25%; }
.w-pct-26 { width: 26%; }
.w-pct-27 { width: 27%; }
.w-pct-28 { width: 28%; }
.w-pct-29 { width: 29%; }
.w-pct-30 { width: 30%; }
.w-pct-31 { width: 31%; }
.w-pct-32 { width: 32%; }
.w-pct-33 { width: 33%; }
.w-pct-34 { width: 34%; }
.w-pct-35 { width: 35%; }
.w-pct-36 { width: 36%; }
.w-pct-37 { width: 37%; }
.w-pct-38 { width: 38%; }
.w-pct-39 { width: 39%; }
.w-pct-40 { width: 40%; }
.w-pct-41 { width: 41%; }
.w-pct-42 { width: 42%; }
.w-pct-43 { width: 43%; }
.w-pct-44 { width: 44%; }
.w-pct-45 { width: 45%; }
.w-pct-46 { width: 46%; }
.w-pct-47 { width: 47%; }
.w-pct-48 { width: 48%; }
.w-pct-49 { width: 49%; }
.w-pct-50 { width: 50%; }
.w-pct-51 { width: 51%; }
.w-pct-52 { width: 52%; }
.w-pct-53 { width: 53%; }
.w-pct-54 { width: 54%; }
.w-pct-55 { width: 55%; }
.w-pct-56 { width: 56%; }
.w-pct-57 { width: 57%; }
.w-pct-58 { width: 58%; }
.w-pct-59 { width: 59%; }
.w-pct-60 { width: 60%; }
.w-pct-61 { width: 61%; }
.w-pct-62 { width: 62%; }
.w-pct-63 { width: 63%; }
.w-pct-64 { width: 64%; }
.w-pct-65 { width: 65%; }
.w-pct-66 { width: 66%; }
.w-pct-67 { width: 67%; }
.w-pct-68 { width: 68%; }
.w-pct-69 { width: 69%; }
.w-pct-70 { width: 70%; }
.w-pct-71 { width: 71%; }
.w-pct-72 { width: 72%; }
.w-pct-73 { width: 73%; }
.w-pct-74 { width: 74%; }
.w-pct-75 { width: 75%; }
.w-pct-76 { width: 76%; }
.w-pct-77 { width: 77%; }
.w-pct-78 { width: 78%; }
.w-pct-79 { width: 79%; }
.w-pct-80 { width: 80%; }
.w-pct-81 { width: 81%; }
.w-pct-82 { width: 82%; }
.w-pct-83 { width: 83%; }
.w-pct-84 { width: 84%; }
.w-pct-85 { width: 85%; }
.w-pct-86 { width: 86%; }
.w-pct-87 { width: 87%; }
.w-pct-88 { width: 88%; }
.w-pct-89 { width: 89%; }
.w-pct-90 { width: 90%; }
.w-pct-91 { width: 91%; }
.w-pct-92 { width: 92%; }
.w-pct-93 { width: 93%; }
.w-pct-94 { width: 94%; }
.w-pct-95 { width: 95%; }
.w-pct-96 { width: 96%; }
.w-pct-97 { width: 97%; }
.w-pct-98 { width: 98%; }
.w-pct-99 { width: 99%; }
.w-pct-100 { width: 100%; }
