/* Marquee: keep a gentle drift even under reduced motion (brand requirement) */
@media (prefers-reduced-motion: reduce) {
  .marquee-track {
    animation: marquee 140s linear infinite !important;
  }
}

/* ═══════════════════════════════════════════════
   ACCESSIBILITY & KEYBOARD NAVIGATION
   Focus states, reduced motion, semantic improvements
═══════════════════════════════════════════════ */

/* ── Focus Visible States ─────────────────────── */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Skip to Main Content Link ──────────────── */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: var(--primary-fg);
  padding: 8px 16px;
  border-radius: var(--r-md);
  text-decoration: none;
  z-index: 999;
  font-weight: var(--fw-semibold);
  font-size: var(--text-sm);
}

.skip-to-main:focus {
  top: 10px;
  outline: none;
}

/* ── Ensure buttons and links have min touch size ── */
button,
a,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Override for inline links (may not need 44px) */
a[href^="#"]:not(.btn-primary):not(.btn-ghost):not(.nav-link) {
  min-height: auto;
  min-width: auto;
  padding: 4px 0;
}

/* ── Reduced Motion Enhancements ─────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0 !important;
  }

  /* Disable scroll behavior */
  html {
    scroll-behavior: auto !important;
  }
}

/* ── High Contrast Mode Support ──────────────── */
@media (prefers-contrast: more) {
  :root {
    --border: rgba(255, 255, 255, 0.2);
    --border-2: rgba(255, 255, 255, 0.15);
  }

  [data-theme="light"] {
    --border: rgba(0, 0, 0, 0.15);
    --border-2: rgba(0, 0, 0, 0.1);
  }
}

/* ── Dark Mode Brightness for Images ────────── */
[data-theme="dark"] img:not([alt*="logo"]):not([alt*="icon"]) {
  opacity: 0.95;
  filter: brightness(1.05);
}

/* ── Color Blindness Friendly Indicators ────── */
.status-badge,
.indicator {
  /* Add patterns/icons in addition to color */
  position: relative;
}

/* ── Motion-Safe Animations ──────────────────– */
@media (prefers-reduced-motion: no-preference) {
  /* Only animate if motion is acceptable */
  .hero-glow,
  .hero-halo,
  .sia2-panel,
  .fb-card {
    animation: float-gentle 6s ease-in-out infinite;
  }
}

@keyframes float-gentle {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(4px); }
}

/* ── Screen Reader Only Text ────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ── Aria-Live Announcements ────────────────– */
[aria-live] {
  position: relative;
}

/* ── Form Accessibility ────────────────────── */
label {
  display: block;
  margin-bottom: var(--sp-2);
  font-weight: var(--fw-medium);
  color: var(--foreground);
}

input,
textarea,
select {
  min-height: 40px;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--foreground);
  font-size: var(--text-base);
  transition: border-color var(--duration) var(--ease),
              background var(--duration) var(--ease);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--card-2);
}

input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Error & Success States ────────────────── */
input.error,
textarea.error,
select.error {
  border-color: var(--destructive);
}

input.success,
textarea.success,
select.success {
  border-color: var(--success);
}

.error-message {
  color: var(--destructive);
  font-size: var(--text-sm);
  margin-top: var(--sp-2);
  display: block;
}

.success-message {
  color: var(--success);
  font-size: var(--text-sm);
  margin-top: var(--sp-2);
  display: block;
}

/* ── Required Field Indicator ───────────────– */
[required]::after {
  content: " *";
  color: var(--destructive);
}

label[aria-required="true"]::after {
  content: " *";
  color: var(--destructive);
}
