/* ==========================================================================
   utilities.css — Low-level, single-purpose helpers
   Levii Portal · Design System / Phase 1
   Kept intentionally small; not a utility framework. Composition happens in
   component CSS. These cover layout primitives used across every page.
   ========================================================================== */

/* ---- Accessibility ---------------------------------------------------- */
.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translate(-50%, -140%);
  z-index: var(--z-toast);
  padding: 0.75rem 1.25rem;
  background: var(--brand-blue-500);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transition: transform var(--dur-base) var(--ease-out);
}
.skip-link:focus {
  transform: translate(-50%, 0);
}

/* ---- Container -------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide {
  max-width: var(--container-wide);
}
.container--prose {
  max-width: var(--container-prose);
}

/* ---- Section rhythm --------------------------------------------------- */
.section {
  padding-block: var(--space-3xl);
  position: relative;
}
.section--tight {
  padding-block: var(--space-2xl);
}
.section--flush-top {
  padding-top: 0;
}

.section-head {
  max-width: 46rem;
  margin-inline: auto;
  text-align: center;
  margin-bottom: var(--space-2xl);
}
.section-head .lead {
  margin-top: var(--space-sm);
}

/* ---- Fl/ Grid primitives --------------------------------------------- */
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.flex-wrap {
  flex-wrap: wrap;
}
.gap-2xs {
  gap: var(--space-2xs);
}
.gap-xs {
  gap: var(--space-xs);
}
.gap-sm {
  gap: var(--space-sm);
}
.gap-md {
  gap: var(--space-md);
}
.gap-lg {
  gap: var(--space-lg);
}

.grid {
  display: grid;
  gap: var(--space-lg);
}
.auto-grid {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

/* ---- Text alignment --------------------------------------------------- */
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.mx-auto {
  margin-inline: auto;
}

/* ---- Spacing helpers (rare, prefer component margins) ----------------- */
.mt-sm {
  margin-top: var(--space-sm);
}
.mt-md {
  margin-top: var(--space-md);
}
.mt-lg {
  margin-top: var(--space-lg);
}
.mb-0 {
  margin-bottom: 0;
}

/* ---- Surfaces & glass ------------------------------------------------- */
.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border);
}

/* Graceful fallback where backdrop-filter is unsupported. */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass {
    background: var(--surface);
  }
}

.divider {
  height: 1px;
  border: 0;
  background: var(--border);
}

/* ---- Aspect ratios ---------------------------------------------------- */
.ratio-16-9 {
  aspect-ratio: 16 / 9;
}
.ratio-1-1 {
  aspect-ratio: 1 / 1;
}
.ratio-9-16 {
  aspect-ratio: 9 / 16;
}

/* ---- Chips / badges --------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: 0.35rem 0.75rem;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.chip--brand {
  background: color-mix(in srgb, var(--brand-blue-500) 12%, transparent);
  color: var(--brand-blue-500);
  border-color: color-mix(in srgb, var(--brand-blue-500) 24%, transparent);
}

/* ---- Media helpers ---------------------------------------------------- */
.rounded {
  border-radius: var(--radius-lg);
}
.rounded-full {
  border-radius: var(--radius-pill);
}
.overflow-hidden {
  overflow: hidden;
}
.shadow-lg {
  box-shadow: var(--shadow-lg);
}

/* No-JS baseline: reveal animated elements when JS is disabled. */
.no-js [data-reveal] {
  opacity: 1 !important;
  transform: none !important;
}
