/* ========================================
   A11Y CORE — focus, sr-only, skip-link, motion
   Loaded globally so it covers home + all inner pages
   ======================================== */

/* Brand blue, sampled from the logo A. Defined here because this sheet is the
   one loaded on every page; stages.css aliases --holo-cyan to it. */
:root { --brand-blue: #00b4f8; }

/* Screen-reader-only utility (visible to AT, hidden visually) */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip-to-content — focus visible only */
.skip-to-content {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 99999;
  background: #c9a84c;
  color: #050505;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.2s ease;
}
.skip-to-content:focus,
.skip-to-content:focus-visible {
  transform: translateY(0);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Astra's header.php prints its own skip link right after wp_body_open, i.e. after
   our header. Ours (offart_render_skip_link, priority 1) is the single first Tab stop,
   so Astra's is removed from the Tab order (site check 2026-09-23). */
a.skip-link.screen-reader-text { display: none !important; }

/* Global focus ring — keyboard only */
:focus { outline: none; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--brand-blue, #00b4f8);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ----------------------------------------------------------------------
   Astra-core mouse-focus leak suppression
   ----------------------------------------------------------------------
   Astra's main.min.css ships two rules that defeat the plain
   `:focus { outline:none }` reset above on POINTER (mouse/touch) focus:

     a:focus            { outline: thin dotted }              /* (0,1,1) beats our (0,1,0) */
     button:focus, ...  { border-color: var(--ast-border-color) }  /* a blue (#046bd2) BORDER,
                                                                       not an outline — our
                                                                       reset never touched it */

   Result: a blue frame appears around buttons/links on plain mouse click
   (Chrome fires :focus — but NOT :focus-visible — on pointer interaction).

   Fix: on pointer focus only (`:focus:not(:focus-visible)`), with a
   selector specific enough to beat Astra (0,2,1 > 0,1,1), kill the
   leaked outline AND neutralise the leaked border-color. Keyboard users
   still get the gold `:focus-visible` ring defined above — untouched. */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
select:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible) {
  outline: none;
}
button:focus:not(:focus-visible),
input[type="button"]:focus:not(:focus-visible),
input[type="submit"]:focus:not(:focus-visible),
input[type="reset"]:focus:not(:focus-visible) {
  border-color: transparent;
}

/* ---------- Pointer-active suppression ----------
   Mirror of the :focus:not(:focus-visible) block above for the brief
   :active phase (mouse-down hold / touch). Astra paints the same blue
   border-color on :active as :focus
   (`button:active,input[type=submit]:active,... { border-color: var(--ast-border-color) }`).
   Without this, the user sees a blue square flash while the click is
   held — most visible on mobile where touch extends :active.
   Specificity (0,2,1) beats Astra's (0,1,1) but loses to dock's
   #global-dock.dock-X:active (1,2,0) so the dock's gold active border
   is preserved. Keyboard activation (`:focus-visible + :active`) is
   excluded by the :not() — gold ring untouched. */
a:active:not(:focus-visible),
button:active:not(:focus-visible),
input:active:not(:focus-visible),
textarea:active:not(:focus-visible),
select:active:not(:focus-visible),
[tabindex]:active:not(:focus-visible),
[role="button"]:active:not(:focus-visible) {
  outline: none;
}
button:active:not(:focus-visible),
input[type="button"]:active:not(:focus-visible),
input[type="submit"]:active:not(:focus-visible),
input[type="reset"]:active:not(:focus-visible) {
  border-color: transparent;
}

/* ---------- Mobile tap-highlight reset ----------
   Default Safari/Chrome paints a translucent dark/blue block on every
   tap. Already set transparent on the dock and stage-os; globalise for
   the rest of the interactive surface. `:where()` adds zero specificity
   so any explicit -webkit-tap-highlight-color elsewhere still wins. */
:where(a, button, input, textarea, select, [tabindex], [role="button"]) {
  -webkit-tap-highlight-color: transparent;
}

/* Dark surfaces — bring the ring forward with a soft halo */
.dock-pill:focus-visible,
.dock-contact-btn:focus-visible,
.dock-nav-toggle:focus-visible,
.chat-action-btn:focus-visible,
.chat-input:focus-visible,
.scroll-pill:focus-visible,
.stage-dot:focus-visible,
.pact-dot:focus-visible,
.carousel-3d-card:focus-visible,
.hud-btn:focus-visible,
.hud-close:focus-visible,
.testimonial-sheet-close:focus-visible,
.chat-panel-close:focus-visible,
.timeline-clip:focus-visible,
.filmstrip-notifications-btn:focus-visible,
.mobile-icon-btn:focus-visible,
.close-menu-btn:focus-visible,
.filmstrip-logo-link:focus-visible {
  outline-color: var(--brand-blue, #00b4f8);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(0, 180, 248, 0.25);
}

/* Make sure the main landmark isn't shown as an outline target */
main:focus,
main:focus-visible {
  outline: none;
}

/* Reduced motion — disable particles/parallax, keep functional crossfades short */
@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;
  }
  .hero-particles,
  .pact-particles,
  .svc-ripple,
  .svc-core-ring,
  .carousel-3d-track,
  .hero-orb-ring,
  .hero-accent-line {
    animation: none !important;
  }
}
