/**
 * LineAlgo shared responsive + accessibility shell
 * ------------------------------------------------
 * Added 2026-08-03 after a site audit found:
 *   · 41 of 55 pages had ZERO @media queries
 *   · only 1 page had any mobile nav affordance (nav rows of up to 15 links
 *     simply overflowed at 375px)
 *   · wide tables declared min-width with no scroll container, so the page
 *     body scrolled sideways instead of the table
 *   · only 2 pages defined :focus-visible — on the rest, keyboard focus was
 *     invisible because custom button styles suppress the UA default
 *
 * Deliberately additive and mobile-first-scoped: desktop rendering is
 * untouched except for the focus ring, which is a pure addition. Nothing here
 * changes layout above 720px.
 */

/* ── keyboard focus: visible everywhere, on every interactive element ─────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #7fd1ff;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── skip link: present but out of the way until focused ─────────────────── */
.la-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 10px 16px;
  background: #0a1628;
  color: #eaf2ff;
  border: 1px solid #7fd1ff;
  border-radius: 0 0 8px 0;
  font-weight: 700;
}
.la-skip-link:focus {
  left: 0;
}

/* ── wide tables scroll themselves, never the page ───────────────────────── */
.la-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

@media (max-width: 720px) {
  /* The page body must never scroll sideways. */
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Nav rows: wrap and stay reachable instead of overflowing off-screen.
     Applies to the several nav class names in use across the site. */
  .dz-nav-links,
  .la-nav-links,
  .nav-links,
  nav[aria-label="Site navigation"],
  nav[aria-label="Main navigation"] {
    display: flex !important;
    flex-wrap: wrap;
    gap: 10px 14px !important;
    row-gap: 8px;
    max-width: 100%;
  }
  .dz-nav-links > a,
  .la-nav-links > a,
  .nav-links > a,
  nav[aria-label="Site navigation"] > a {
    padding: 4px 0;
    white-space: nowrap;
  }

  /* Any table wide enough to need it scrolls inside its own box. */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* Multi-column grids collapse to a single readable column. */
  .dz-grid-3,
  .dz-grid-4,
  .dz-kpis,
  .dz-g4,
  .la-grid-3,
  .la-grid-4 {
    grid-template-columns: 1fr !important;
  }

  /* Media and embeds never exceed the viewport. */
  img,
  svg,
  video,
  iframe,
  canvas {
    max-width: 100%;
    height: auto;
  }

  /* Long unbroken strings (IDs, URLs, hashes) wrap instead of stretching. */
  pre,
  code,
  .mono {
    white-space: pre-wrap;
    word-break: break-word;
  }
}

/* ── respect reduced-motion for the decorative loops ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .dz-pulse,
  .dz-scan,
  .la-pulse {
    animation: none !important;
  }
  * {
    scroll-behavior: auto !important;
  }
}
