/* SOPH — design fixes from the 2026-08-15 technical audit.
 *
 * Loaded by soph-oxygen-support.php after Oxygen's own stylesheets so these
 * override the builder defaults without editing the design system (which Oxygen
 * regenerates). Every value here is derived from the SOPH palette or measured;
 * none is invented.
 *
 * Palette in use, taken from the converted design system:
 *   #0095eb bright blue · #75bee9 light blue · #10223e navy · #0a185c deep navy
 *   surfaces: #ffffff #f4f4f4 #efefef #e6f3ff #e0f0ff #d8f0ff
 */

/* ---------------------------------------------------------------------------
 * 1. Brand colour — WCAG AA contrast
 *
 * Oxygen shipped `--bde-brand-primary-color: var(--blue-500)` and `--blue-500`
 * is its stock #3b82f6. That default was rendering the site's links and CTAs:
 * "LATEST NEWS" 3.34:1, "READ NOW" 3.23:1, "FIND OUT MORE" 2.09:1 — all below
 * the 4.5:1 floor. Production contains no #3b82f6 at all, so this arrived with
 * the conversion.
 *
 * #0070b0 is the brand blue #0095eb darkened 25%: same hue, and it clears 4.5:1
 * on every surface above (5.32:1 on white, 4.52:1 on the lightest tint).
 * Computed by tools/pick-link-colour.mjs, not picked by eye.
 * ------------------------------------------------------------------------- */
/* `html:root` (0,1,1) rather than `:root` (0,1,0) deliberately.
 * Oxygen's global-settings.css declares these on `:root` and is enqueued AFTER
 * this file, so at equal specificity it would win on load order. Raising
 * specificity by one element wins regardless of order — and without !important,
 * so a later deliberate override is still possible. */
html:root {
  --blue-500: #0070b0;
  --bde-brand-primary-color: #0070b0;

  --soph-link: #0070b0;
  --soph-link-hover: #005c90;   /* 6.08:1 — stays distinguishable and still passes */
  --soph-navy: #10223e;
  --soph-focus: #0a185c;
}

/* CTA buttons: white on #0070b0 is 5.32:1; white on the incumbent #0095eb
 * (READ NOW) and #5bc0de (FIND OUT MORE hero) fail at 3.23:1 and 2.09:1.
 *
 * Each of these classes carried its OWN painted background (originally from a
 * converted WPBakery `vcx-*` class, since renamed/removed), so setting only
 * `.uwcs-btn-primary` lost on specificity and the span variants never painted
 * at all. `:where()` keeps this at zero specificity for the selector list while
 * the doubled class on the element (`.uwcs-news-card-more.uwcs-news-card-more`)
 * raises it to (0,2,0) — enough to beat the generated per-element rule without
 * !important. The nested text (a link inside
 * the card-more span rendered #1e73be) is forced to inherit so it cannot fail
 * against its own button. */
.uwcs-btn-primary.uwcs-btn-primary,
.uwcs-news-card-more.uwcs-news-card-more,
.uwcs-staff-card-more.uwcs-staff-card-more,
.uwcs-hero-slide-more.uwcs-hero-slide-more,
.project-card-more.project-card-more {
  background-color: var(--soph-link);
  color: #fff;
}
.uwcs-btn-primary.uwcs-btn-primary *,
.uwcs-news-card-more.uwcs-news-card-more *,
.uwcs-staff-card-more.uwcs-staff-card-more *,
.uwcs-hero-slide-more.uwcs-hero-slide-more *,
.project-card-more.project-card-more * {
  color: inherit;
}
.uwcs-btn-primary.uwcs-btn-primary:hover,
.uwcs-news-card-more.uwcs-news-card-more:hover,
.uwcs-staff-card-more.uwcs-staff-card-more:hover,
.uwcs-hero-slide-more.uwcs-hero-slide-more:hover,
.project-card-more.project-card-more:hover {
  background-color: var(--soph-link-hover);
}

/* ---------------------------------------------------------------------------
 * 2. Touch targets
 *
 * Measured at 375px: the mobile menu toggle rendered 32x32 and the slider arrows
 * 20x20. The toggle is the only way to navigate on a phone. The icon keeps its
 * drawn size; only the hit area grows, so nothing moves visually.
 * ------------------------------------------------------------------------- */
/* `button.` raises specificity to (0,1,1) so this beats Oxygen's own
 * `.breakdance-menu-toggle { min-height: var(--toggle-layer-width) }`, which is
 * enqueued later.
 *
 * Deliberately sets ONLY the hit area. Oxygen uses `display:none` on this same
 * class to hide the hamburger above the mobile breakpoint — declaring `display`
 * here would win at the raised specificity and show it at every width. The
 * element already carries `align-items:center`, so centring is not needed
 * either. Touch the one property that is wrong, nothing else. */
button.breakdance-menu-toggle {
  min-width: 44px;
  min-height: 44px;
}

.swiper-button-prev,
.swiper-button-next {
  min-width: 44px;
  min-height: 44px;
}
/* Keep the drawn arrow at its original size inside the larger hit area. */
.swiper-button-prev::after,
.swiper-button-next::after {
  font-size: 20px;
}

/* Footer links sit on the dark footer (#292b33), where the brand blue #0095eb
 * is 4.37:1 — just under. The palette's own light blue #75bee9 is 6.92:1 there,
 * so links get the lighter brand tone on dark rather than the darker one that
 * works on white. */
.uwcs-footer-link,
.uwcs-footer-copy-text a,
.uwcs-site-footer a {
  color: #75bee9;
}
.uwcs-footer-link:hover,
.uwcs-site-footer a:hover {
  color: #a6d6f2;
}

/* ---------------------------------------------------------------------------
 * 2b. Desktop navigation
 *
 * The header menu element was set to `mobile_menu.show_at = breakpoint_base`,
 * i.e. the hamburger at EVERY width, with all 29 links in a position:fixed
 * off-canvas panel. That is now `breakpoint_tablet_landscape` (see
 * tools/fix-desktop-menu.php), so the real menu shows from 1120px up.
 *
 * It does not fit on one row: the logo lockup is 490px and the seven top-level
 * items measure 1055px, against a 1265px header. That is exactly why production
 * still collapses to a hamburger at 1280 and only shows links at ~1781.
 *
 * So the nav takes its own row rather than being squeezed or truncated. These
 * are our own design-system classes, not Oxygen element internals, so this is
 * a safe place to change layout.
 * ------------------------------------------------------------------------- */
@media (min-width: 1120px) {
  /* One row: logo left, menu right. The item spacing that makes this fit is set
   * on the element's own native properties (tools/fix-menu-spacing.php):
   * 20px gaps -> 6px, 20px left padding -> 2px each side, dropdown arrows off.
   * Text is 703px, so 703 + 36 + 28 = 767px inside the 775px available. */
  /* The conversion carried the original WPBakery column split through as fixed
   * flex bases — logo `0 0 65.25%` (816px) and nav `0 0 34.75%` (434px). The
   * nav therefore stayed 434px wide no matter how much menu it held, and 730px
   * of items spilled 302px off the page.
   *
   * Child selectors (0,2,0) beat Oxygen's generated per-element classes (0,1,0)
   * without !important. The logo takes its intrinsic width; the nav takes the
   * remainder. */
  .uwcs-site-header-inner > a {
    flex: 0 0 auto;
  }
  .uwcs-site-header-inner > .uwcs-site-nav {
    flex: 1 1 auto;
    justify-content: flex-end;
    min-width: 0;
  }
  /* No logo cap is needed: once the nav is no longer pinned to 34.75%, the
   * lockup keeps its natural 490px and the menu's 730px still fits the 1265px
   * header. Shrinking the logos would have been a parity change for nothing. */
  /* The off-canvas "Close" item is markup for the collapsed menu only. */
  .uwcs-site-nav .breakdance-menu-topbar {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
 * 3. Browser surfaces
 *
 * The parts nobody draws still carry the design: selection, focus ring, and
 * underline offset all shipped as browser defaults. Themed from the palette.
 * ------------------------------------------------------------------------- */
::selection {
  background: #d8f0ff;
  color: var(--soph-navy);
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--soph-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Descenders shouldn't be sliced by the underline. */
a {
  text-underline-offset: 0.15em;
}

/* ---------------------------------------------------------------------------
 * 4. Reduced motion
 *
 * No first-party stylesheet honoured prefers-reduced-motion; the hero slider
 * auto-advances regardless. This stops the auto-advance and shortens
 * transitions WITHOUT the usual global 0.01ms kill — state changes stay
 * legible, they just stop travelling.
 * ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 120ms !important;   /* still perceptible, not a jump-cut */
    scroll-behavior: auto !important;
  }

  /* Swiper drives autoplay in JS; freezing the wrapper stops the travel. */
  .swiper-wrapper {
    transition-duration: 0ms !important;
    transform: none !important;
  }

  /* Parallax and looping decoration have no informational role. */
  [data-parallax],
  .bde-slider-autoplay {
    animation: none !important;
  }
}

/* Accordion chevron: the rotate is state feedback (open/closed), so it collapses
 * to an instant swap under reduced motion. Oxygen's stylesheet importer only accepts
 * registered breakpoint media queries, so this one rule lives here. */
@media (prefers-reduced-motion: reduce) {
  .bde-accordion__button::after { transition: none; }
}

/* ---------------------------------------------------------------------------
 * 5. Filter chip counts
 *
 * The curated chip bars on News, Projects and Publications are deliberately a
 * short, readable subset of the taxonomy rather than one chip per term. That
 * makes them scannable but it also makes them look exhaustive, which they are
 * not. soph-filter.js writes the real number of matching cards into each chip
 * so the subset reads as a subset. Muted, tabular and a size down, because the
 * number is a qualifier on the label, not a second label.
 * ------------------------------------------------------------------------- */
.uwcs-filter-count {
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
  opacity: 0.62;
  margin-inline-start: 0.15em;
}

.uwcs-filter-chip.is-active .uwcs-filter-count {
  opacity: 0.8;
}

/* A chip whose group can match nothing is withdrawn by the script; the bar is a
 * flex row, so it needs telling. */
.uwcs-filter-chip[hidden] {
  display: none;
}
