/* ==========================================================================
   quality.css — Wave 7 front-end quality layer (a11y / mobile / PWA / contrast)
   Loaded AFTER the page stylesheet so these rules can override conservatively.
   Brand palette: navy #053685, gold #C9A227.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Skip link (#43 a11y) — visually hidden until focused, then visible.
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100000;
  padding: 12px 20px;
  background: #053685;
  color: #fff;
  font-weight: 700;
  font-family: inherit;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 0 0 8px 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.skip-link:focus,
.skip-link:focus-visible {
  left: env(safe-area-inset-left, 0);
  top: env(safe-area-inset-top, 0);
  outline: 3px solid #C9A227;
  outline-offset: 2px;
}

/* Generic visually-hidden utility (available for any icon-only labels). */
.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;
}

/* --------------------------------------------------------------------------
   2. Focus-visible styles (#43 a11y) — keyboard users get a clear ring,
      mouse users are not disturbed (focus-visible only).
   -------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="link"]:focus-visible {
  outline: 3px solid #C9A227;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Make programmatic focus targets (e.g. #main) not show a stray ring. */
[tabindex="-1"]:focus {
  outline: none;
}

/* --------------------------------------------------------------------------
   3. Reduced motion (#43 a11y) — honor the user preference.
   -------------------------------------------------------------------------- */
@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;
  }
}

/* --------------------------------------------------------------------------
   4. Mobile / safe-area (#44) — notch & rounded-corner support.
      viewport-fit=cover is set on each page; these consume the insets.
   -------------------------------------------------------------------------- */

/* Anchor jump offset so hash links / skip link don't hide under fixed
   headers. Header heights observed: LMS app ~64px, marketing pages vary; a
   generous value works for all and only affects scroll landing position. */
html {
  scroll-padding-top: 72px;
}

/* Pad the body's bottom for devices with a home indicator. */
body {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Fixed / sticky page headers must clear the notch on landscape phones. */
.lms-header,
header.header,
section.header,
.top {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* Fixed bottom banners (RGPD cookie bar) must clear the home indicator. */
#rgpdBanner {
  padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
}

/* --------------------------------------------------------------------------
   5. Touch targets (#44) — ensure interactive controls are >= 44x44px
      where reasonable. Inline-text links inside paragraphs are exempted so
      we don't blow up body copy line spacing.
   -------------------------------------------------------------------------- */
button,
a.btn,
.btn,
input[type="button"],
input[type="submit"],
input[type="reset"],
[role="button"],
.lms-theme-toggle,
#themeToggle,
#themeBtn {
  min-height: 44px;
  min-width: 44px;
}

/* Keep icon-only toggle buttons centered once they get a min size. */
.lms-theme-toggle,
#themeToggle,
#themeBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   6. Contrast nudges (#45) — only lift clearly-too-light greys toward the
      ~4.5:1 WCAG AA threshold. Brand navy/gold are left untouched.
      Common too-light greys in the codebase: #94a3b8, #718096, #A0AEC0.
   -------------------------------------------------------------------------- */

/* Light backgrounds: nudge muted greys darker for body-size text. */
.trust-bar p,
.stat .label,
.course-card p,
.preview-card p,
.test-card .role,
.price-note,
.pricing-box .sub {
  color: #5b6675; /* ~5.3:1 on white, was #94a3b8 (~2.6:1) */
}

/* Footer muted copyright line on very dark footer — lift for legibility. */
footer p {
  color: rgba(255, 255, 255, 0.62);
}

/* Dark theme: muted greys (#718096 ~ borderline) lifted slightly. */
[data-theme="dark"] .trust-bar p,
[data-theme="dark"] .stat .label,
[data-theme="dark"] .test-card .role,
[data-theme="dark"] .price-note {
  color: #9aa6b8;
}
