/*! PUBG theme — accessibility layer (EPIC-15).
 *
 * Two concerns, both deliberately scoped:
 *
 * 1) Touch target size (TSK-1501). WCAG 2.2 SC 2.5.8 asks for 24x24 CSS px
 *    minimum and the project spec asks for 44x44. It also *exempts* links inside
 *    a block of text — inflating every inline link and every table-cell link to
 *    44px would wreck the dense telemetry layouts this design is built around.
 *    So the rules below target controls (buttons, chips, tabs, pagination, icon
 *    buttons, CTAs) and are wrapped in `@media (pointer: coarse)` so the desktop
 *    composition stays exactly as designed while touch devices get real targets.
 *
 * 2) Keyboard focus (TSK-1502). A visible 2px amber ring on every interactive
 *    element, plus a working skip-to-content link.
 *
 * Loaded after density.css so it wins on size-related properties.
 */

/* ------------------------------------------------------------------ Focus */

/* :focus-visible only — a mouse click should not leave a ring behind. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--primary, #F2A900);
  outline-offset: 2px;
  /* The site is near-black; a dark halo keeps the ring readable on amber fills. */
  box-shadow: 0 0 0 4px rgba(8, 8, 8, 0.85);
}

/* Some controls sit inside overflow:hidden clip-path containers where an outline
   would be cropped; fall back to an inset ring for those. */
.clip-corner:focus-visible,
.clip-corner-sm:focus-visible,
.clip-tag:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--primary, #F2A900);
}

/* Skip link. Clipped to a 1px box rather than pushed to left:-9999px — a huge
   negative offset still counts as page geometry and shows up as an element
   outside the viewport in layout audits. */
.pubg-skip-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  z-index: 100;
}
.pubg-skip-link:focus {
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  left: 1rem;
  top: 1rem;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  color: var(--primary-foreground, #0A0A0A);
  background: var(--primary, #F2A900);
  font-family: var(--font-display, "Oswald", "Oswald Fallback", sans-serif);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------- Touch targets */

@media (pointer: coarse) {
  /* Buttons and CTAs. min-height (not height) so multi-line labels still grow. */
  button,
  [role="button"],
  input[type="button"],
  input[type="submit"],
  .btn-primary,
  .btn-ghost,
  .btn-tactical,
  .pubg-chip,
  .pubg-pagination a,
  .pubg-pagination span,
  .pubg-mobile-link {
    min-height: 44px;
  }

  /* Chips and pagination are inline-flex at h-9 (36px) — centre the label in the
     taller box instead of letting the extra height fall below the text. */
  .pubg-chip,
  .pubg-pagination a,
  .pubg-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
  }

  /* Icon-only controls: hero arrows, slider arrows, social buttons, close/menu.
     They are square by design, so both axes need the floor. */
  .pubg-icon-btn,
  [data-hero-prev],
  [data-hero-next],
  [aria-label]:is(button, a):not(:has(> :not(svg))) {
    min-width: 44px;
    min-height: 44px;
  }

  /* Section tab strips (live match center, rankings regions, arsenal categories,
     guide tiers) are authored in the per-section stylesheets at 40-42px. */
  .live-match-center__tabs button,
  .team-power-rankings__tabs button,
  .ars-tabs button,
  .ars-tab,
  .lmc-overview-tabs button,
  .season-tabs button {
    min-height: 44px;
  }

  /* Map hot-drop pins are narrow by design (a number badge on the terrain), so
     they need the floor on the horizontal axis too. */
  .tactical-map__marker {
    min-width: 44px;
    min-height: 44px;
  }

  /* Footer / CTA social buttons are authored at w-9 h-9 (36px, 32px after the
     density scale). */
  .pubg-social-btn,
  .pubg-shell footer a[aria-label],
  .pubg-shell footer .flex.gap-2 > a {
    min-width: 44px;
    min-height: 44px;
  }

  /* Header logo link wraps a 28px-tall image; pad the hit area out. */
  #pubg-header a:has(> img),
  #pubg-mobile-menu > div > img + button {
    min-height: 44px;
  }

  /* Bordered box links used as standalone controls across the portal templates:
     "BACK TO TOP", "VIEW TEAM", social/connect rows, team and taxonomy chips.
     They are authored with a border + inline-flex and no explicit height, so they
     collapse to their line-height. Scoped to elements NOT sitting inside running
     text — WCAG 2.5.8 exempts inline links, and inflating those would break the
     prose and the dense telemetry tables this design depends on. */
  :is(a, button).inline-flex[class*="border"],
  :is(a, button).flex[class*="border"] {
    min-height: 44px;
  }

  /* Taxonomy badges rendered as links (clip-tag chips on single templates).
     :not(.hidden) matters — without it this rule's display:inline-flex overrides
     Tailwind's `hidden` utility and elements meant to be desktop-only (the header
     search field) reappear on mobile. */
  a.clip-tag:not(.hidden),
  a.clip-corner-sm:not(.hidden) {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  /* Footer column link lists. These sit in <li> so the inline-text exemption
     would technically cover them, but they are site navigation, not prose — at a
     15px line box they are genuinely hard to hit. Give them a real row height
     (the surrounding space-y-3 already separates them visually). */
  .pubg-shell footer li > a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  /* Anything that opted in explicitly stays authoritative. */
  .min-h-\[44px\] {
    min-height: 44px;
  }
}
