/* ==========================================================================
   Aivanta base: font loading, Bootstrap variable mapping, typography,
   focus styles and accessibility helpers.
   ========================================================================== */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../vendor/inter/inter-latin-wght-normal.woff2") format("woff2-variations");
}

/* Map Bootstrap 5.3 variables onto Aivanta tokens (both themes) */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-body-font-family: var(--av-font-sans);
  --bs-body-font-size: var(--av-text-base);
  --bs-body-line-height: var(--av-leading);
  --bs-body-color: var(--av-text);
  --bs-body-bg: var(--av-bg);
  --bs-secondary-color: var(--av-text-muted);
  --bs-tertiary-color: var(--av-text-subtle);
  --bs-border-color: var(--av-border);
  --bs-border-radius: var(--av-radius);
  --bs-border-radius-sm: var(--av-radius-sm);
  --bs-border-radius-lg: var(--av-radius-lg);
  --bs-link-color: var(--av-accent-text);
  --bs-link-hover-color: var(--av-accent-hover);
  --bs-link-color-rgb: unset;
  --bs-emphasis-color: var(--av-text);
  --bs-heading-color: var(--av-text);
  --bs-secondary-bg: var(--av-surface-2);
  --bs-tertiary-bg: var(--av-surface-2);
  --bs-primary: var(--av-accent);
  --bs-focus-ring-color: color-mix(in srgb, var(--av-focus-ring) 35%, transparent);
}

html {
  scroll-padding-top: calc(var(--av-topbar-height) + 16px);
}

body {
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: var(--av-bg);
  color: var(--av-text);
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: var(--av-leading-tight);
  color: var(--av-text);
}
h1, .h1 { font-size: var(--av-text-2xl); }
h2, .h2 { font-size: var(--av-text-xl); }
h3, .h3 { font-size: var(--av-text-lg); }
h4, .h4 { font-size: var(--av-text-md); }
h5, .h5 { font-size: var(--av-text-base); }
h6, .h6 { font-size: var(--av-text-sm); }

a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:not(.btn):not(.nav-link):not(.dropdown-item):not(.av-nav-link) { color: var(--av-accent-text); }

.text-muted, .text-body-secondary { color: var(--av-text-muted) !important; }
.text-subtle { color: var(--av-text-subtle); }
.tabular, .av-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.av-mono { font-family: var(--av-font-mono); font-size: 0.92em; }
.av-measure { max-width: 68ch; }

/* Focus: always visible for keyboard users */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--av-focus-ring);
  outline-offset: 2px;
  border-radius: var(--av-radius-sm);
}
.form-control:focus-visible,
.form-select:focus-visible { outline-offset: 0; }

/* Accessibility helpers */
.av-skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: calc(var(--av-z-palette) + 10);
  padding: 8px 14px;
  background: var(--av-accent);
  color: var(--av-accent-contrast) !important;
  border-radius: var(--av-radius);
  font-weight: 600;
  transform: translateY(-160%);
}
.av-skip-link:focus { transform: translateY(0); }

::selection { background: color-mix(in srgb, var(--av-accent) 28%, transparent); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--av-border-strong) transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
