/*
 * JNews bridge: re-colours the JNews components that fail WCAG 2.2 AA with the measured design tokens.
 * Every colour here comes from tokens.css and is covered by scripts/contrast_matrix.py.
 * !important is used only where JNews prints module-specific inline CSS (e.g. .jnews_module_167_1_...)
 * that outranks any selector we could write; each use is limited to a colour or a minimum size.
 */

/* Global link fallback: JNews defaults to bright red (#f70d28, 4.16:1). Low specificity on purpose,
   so component rules that set their own colour keep working. */
html body a {
  color: var(--kb-pine);
}
html body a:hover {
  color: var(--kb-fruit);
}
html body a strong,
html body a b {
  color: inherit;
}

/* Running text links are underlined (never colour-only). */
html body .content-inner a,
html body .entry-content a {
  color: var(--kb-pine);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
html body .content-inner a:hover,
html body .entry-content a:hover {
  color: var(--kb-fruit);
}

/* Post meta: date, author label, counters were #a0a0a0 (2.4-2.6:1). */
html body .jeg_post_meta,
html body .jeg_post_meta .by,
html body .jeg_post_meta .fa,
html body .jeg_post_meta .jeg_meta_date a,
html body .jeg_post_meta .jeg_meta_comment a,
html body .jeg_post_meta .jeg_meta_views a,
html body .jeg_meta_container .jeg_post_meta {
  color: var(--kb-text-muted) !important;
}
html body .jeg_post_meta .jeg_meta_author a {
  color: var(--kb-fruit) !important;
}

/* Category badges over thumbnails: white on fruit, and a 24 px minimum target (WCAG 2.5.8). */
html body .jeg_post_category a {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  background-color: var(--kb-fruit) !important;
  color: var(--kb-on-fruit) !important;
}

/* Vendor attribution link in the footer (green #01b636, 2.7:1). */
html body .jeg_footer .copyright a,
html body .jeg_footer_bottom a,
html body .jeg_footer_secondary a {
  color: var(--kb-pine) !important;
  text-decoration: underline;
}

/* Placeholder text and captions. */
html body input::placeholder,
html body textarea::placeholder,
html body .jeg_search_input::placeholder,
html body .jeg_search_input::-webkit-input-placeholder {
  color: var(--kb-text-muted);
  opacity: 1;
}
html body figcaption,
html body .wp-caption-text {
  color: var(--kb-text-muted);
}

/* Meaningful boundaries for form fields (non-text contrast, WCAG 1.4.11). */
html body input[type="text"],
html body input[type="search"],
html body input[type="email"],
html body input[type="url"],
html body input[type="tel"],
html body input[type="password"],
html body textarea,
html body select {
  border-color: var(--kb-border-strong);
}

/* Carousel controls added by carousel-a11y.js need a real target. */
html body .tns-controls button {
  min-width: var(--kb-target);
  min-height: var(--kb-target);
}

/* Remaining JNews greys and accents found by the axe run. */
html body .share_count,
html body .jeg_socialshare .share_count,
html body .breadcrumb_last_link a,
html body .jeg_breadcrumbs .breadcrumb_last_link a {
  color: var(--kb-text-muted) !important;
}
html body .jeg_block_heading_6 .jeg_block_title span,
html body .jeg_block_heading_6 .jeg_block_title strong {
  color: var(--kb-fruit) !important;
}
html body .autohelp {
  color: var(--kb-pine) !important;
}

/* Title links in post lists: give them a real 24 px hit area (WCAG 2.5.8). */
html body .jeg_post_title a {
  display: inline-block;
  min-height: 1.5rem;
}

/* Icon-only toggles in the header. */
html body .jeg_mobile_toggle,
html body .jeg_menu_close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--kb-target);
  min-height: var(--kb-target);
}

/* JNews leftovers that the new templates never use. With JNews' own stylesheet dequeued on template pages they
   would otherwise render as visible, unlabelled form popups (login, playlist) and floating widgets. */
html body .jeg_popup,
html body #jeg_off_canvas,
html body #notification_action_renderer,
html body #selectShareContainer,
html body .jeg_read_progress_wrapper,
html body .jscroll-to-top,
html body #amp-mobile-version-switcher,
html body .jnews_mobile_sticky_ads {
  display: none !important;
}
