/* Shared design tokens, readability and accessibility. */

:root {
  /* palette */
  --wa-bg: #0f1115;
  --wa-bg-deep: #0b0f19;
  --wa-surface: #0f1117;
  --wa-surface-2: #1e293b;
  --wa-border: rgba(255, 255, 255, 0.08);
  --wa-border-accent: rgba(56, 189, 248, 0.35);
  --wa-text: #e2e8f0;
  --wa-text-muted: #94a3b8;
  --wa-text-faint: #64748b;
  --wa-accent: #38bdf8;
  --wa-accent-soft: #7dd3fc;
  --wa-gold: #fbbf24;
  --wa-danger: #f87171;
  --wa-success: #4ade80;
  /* shape + depth */
  --wa-radius-sm: 9px;
  --wa-radius: 12px;
  --wa-radius-lg: 16px;
  --wa-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  --wa-ring: 2px solid var(--wa-accent);
}

/* Keyboard focus is always visible; mouse clicks stay clean. */
:focus:not(:focus-visible) {
  outline: none;
}

html body :focus-visible,
html[data-theme] body :is(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: var(--wa-ring) !important;
  outline-offset: 2px !important;
  border-radius: 4px;
}

/* Respect users who opt out of motion. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Skip link: first tab stop on the big pages, invisible until focused. */
.wa-skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  z-index: 100000;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 0 0 10px 10px;
  background: var(--wa-accent);
  color: #06283d;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: top 0.15s ease;
}

.wa-skip-link:focus-visible {
  top: 0;
}

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

/* Important overrides outrank utility classes and dynamically loaded themes. */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Muted text, still clearly secondary but above WCAG AA (4.5:1). */
.text-slate-700,
.text-slate-600 { color: #94a3b8 !important; }
.text-slate-500 { color: #9fb0c4 !important; }
.text-slate-400 { color: #aab9cb !important; }
/* Keep the close-button hover cue that the line above would otherwise flatten. */
.hover\:text-white:hover { color: #ffffff !important; }

/* Micro labels: raise the floor without touching the rest of the type scale.
   The html prefix outranks the utility class it is overriding. */
html [class*="text-[7px]"],
html [class*="text-[8px]"],
html [class*="text-[9px]"],
html [class*="text-[10px]"] { font-size: 11px !important; }

/* Named component labels that use their own class instead of a utility. */
html .gc-badge,
html .wa-atari-tag,
html .wa-atari-play,
html .wa-atari-meta,
html .wa-field-label,
html .wa-auth-foot,
html #auth-divider-text,
html #home-reward-badge { font-size: 11px !important; }

/* The always-on Titan Clash strip was the smallest text on every screen. */
.wa-clash-live-strip { font-size: 11.5px; }
.wa-clash-live-strip .wa-clash-house b { font-size: 12.5px; }
.wa-clash-live-strip .wa-clash-sep { color: #94a3b8; }

/* Long prose: looser leading and balanced lines. */
p,
li {
  line-height: 1.65;
  text-wrap: pretty;
}

/* Thumb-sized hit areas on touch screens only. */
@media (pointer: coarse) {
  .rail-btn,
  .gc-fav {
    min-width: 44px !important;
    min-height: 44px !important;
  }
  button[aria-label],
  a[aria-label],
  [role="button"][aria-label] {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  /* WCAG 2.5.5 (AAA): every real control gets a 44px box. min-height beats the
     Tailwind h-9/h-10 utility heights without !important; prose links keep
     their text box (WCAG's inline exception). */
  html body button,
  html body [role="button"],
  html body summary,
  html body select,
  html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]) {
    min-height: 44px;
  }
  html body button,
  html body [role="button"],
  html body select {
    min-width: 44px;
  }

  /* Control-shaped links and the site's own compact button classes. */
  html body .back-btn,
  html body .icon-btn,
  html body .wa-ctrl-btn,
  html body .wa-vote-btn,
  html body .suggested-browse-link,
  html body .gc-fav,
  html body .wa-col-add,
  html body .tab-btn,
  html body .wa-consent-btn,
  html body .wa-consent-close,
  html body .wa-anchor-close,
  html body .banner-btn,
  html body .banner-close {
    min-width: 44px;
    min-height: 44px;
  }

  /* Static landing pages: brand and top navigation. */
  header.site .brand,
  header.site nav.top a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  header.site .wrap {
    min-height: 44px;
  }

  /* Controls that must stay visually small to fit the poster or header keep
     their drawn size but get a 44px hit area, so nothing shifts. */
  header[class*="sticky"] #weekly-leaderboard-btn,
  #browser-games-grid > .game-card .gc-fav {
    position: relative;
  }
  header[class*="sticky"] #weekly-leaderboard-btn::after,
  #browser-games-grid > .game-card .gc-fav::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
    border-radius: 999px;
  }

  /* Chip-styled links that act as buttons (See all / Home). */
  .wa-tap-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
  }

  /* Breadcrumb rows: each crumb is a real destination, so give it a row-sized
     box instead of a 16px text line. */
  .crumbs a,
  nav[aria-label="Breadcrumb"] a,
  .wa-atari-crumbs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
  }

  /* The "Game details" pill on the player is a link to the game's own page. */
  .game-info-landing {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
  }
}

::selection {
  background: rgba(56, 189, 248, 0.35);
  color: #ffffff;
}
