/*
 * Future Frontier accessibility layer
 * Shared by generated English and Chinese pages.
 * Targets WCAG 2.2 AA without changing the approved editorial layout.
 */

:root {
  /* These variants keep normal-size text above 4.5:1 on the site paper tones. */
  --green: #116b43;
  --amber: #7a4b00;
  --ff-focus: #005fcc;
  --ff-focus-inner: #fff;
}

html {
  scroll-padding-top: 6rem;
}

body {
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  height: auto;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border: 2px solid #0b0b0b;
  border-radius: 0.35rem;
  background: #fffdf8;
  color: #0b0b0b;
  font-weight: 850;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform 120ms ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  color: #0b0b0b;
  transform: translateY(0);
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus {
  outline: none;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--ff-focus);
  outline-offset: 4px;
  box-shadow:
    0 0 0 2px var(--ff-focus-inner),
    0 0 0 6px var(--ff-focus);
  border-radius: 0.25rem;
}

:where(.button, .icon-link, .social, .news-arrow, .read-link) {
  touch-action: manipulation;
}

:where(.button, .icon-link, .social) {
  min-width: 44px;
  min-height: 44px;
}

main p a,
.item-meta a,
.source-line a,
.read-link {
  text-decoration: underline;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.18em;
}

[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.3em;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --muted: #4f4a43;
    --line: #8f887d;
  }

  .button,
  .chip,
  .pill,
  .status {
    border-color: currentColor;
  }
}

@media (forced-colors: active) {
  :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }

  .skip-link,
  .button,
  .chip,
  .pill,
  .status {
    border: 1px solid ButtonText;
  }
}
