/* ==========================================================================
   JMatrix360 — v7.1.0 product finish / final hardening pass
   Loaded last, after design-system.css, on every page via base.html.

   This file was referenced from base.html (with a "final-hardening" cache-
   bust query string) but never actually existed on disk — every page in
   the app was silently loading a 404 for it. Task #53's mechanical static-
   asset sweep caught it. Rather than ship an empty stub, it now carries
   real, narrowly-scoped finishing touches that design-system.css doesn't
   already cover: keyboard-focus visibility, print output, motion safety,
   and a couple of small robustness nets. Nothing here overrides existing
   component styling — only genuine gaps.
   ========================================================================== */

/* ---- 1. Keyboard focus visibility -----------------------------------
   design-system.css gives text inputs a clear focus ring (line ~200) and
   one specific component (.choice-tile) its own :focus-visible outline,
   but links, buttons, and everything else fall back to the browser
   default outline, which several of the app's own rules suppress via
   `outline:none` on hover/active states. A keyboard user tabbing through
   nav links, table row actions, or buttons needs a visible landing spot;
   :focus-visible (not plain :focus) keeps this mouse-click-silent, so it
   never appears as an unwanted ring on a click. */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--brand, #2a78d6);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- 2. Motion safety net --------------------------------------------
   home.html's scroll-reveal and landing.js's count-up animation already
   check prefers-reduced-motion themselves before animating anything, but
   this is a blanket backstop for any other transition/animation on the
   page (hover transforms, the .card.hoverable lift, etc.) for visitors
   who've asked the OS to minimize motion. */
@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;
  }
}

/* ---- 3. Print output ---------------------------------------------------
   Several pages exist specifically to be printed or saved as PDF (trial
   balance, invoices, payslips, certificates) but nothing in the app
   trims chrome for print — right now every printout includes the sticky
   header, sidebar nav, and every button on the page. This keeps only the
   content people actually want on paper. */
@media print {
  .app-header, .app-nav, .app-sidebar, .product-nav,
  .btn, button, form.context-search,
  .no-print {
    display: none !important;
  }
  body { background: #fff; }
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    break-inside: avoid;
  }
  a[href]::after { content: ""; } /* don't print raw URLs after links */
}

/* ---- 4. Image robustness ----------------------------------------------
   A safety net so an image dropped into a narrow card or a small viewport
   (the landing page's product screenshots included) can never overflow
   its container, without needing every template to remember max-width
   itself. */
img { max-width: 100%; height: auto; }

/* ---- 5. Text selection ------------------------------------------------
   Small brand touch — the default OS selection color reads as an
   unstyled page; this ties it to the same brand wash used elsewhere. */
::selection {
  background: var(--brand-wash, #eaf2fc);
  color: var(--ink-primary, #0b0b0b);
}
