/**
 * OSHAwards public site: visibility and contrast layer.
 * Loaded LAST by both public layouts (layouts/public-modern.blade.php and
 * layouts/public.blade.php).
 *
 * Why this file exists
 * --------------------
 * The public site is built from two component families that were restyled at
 * different times: the modern .osh-* components and the legacy .pub-*
 * components. A rendered audit of 64 public pages (every text element checked
 * against the colour actually behind it) found 648 elements below WCAG AA and
 * 34 that were invisible. Almost all came from four causes:
 *
 *  1. Pages on the MODERN layout that use legacy .pub-* components never
 *     loaded the --pub-* colour tokens. Banner and call-to-action backgrounds
 *     are defined with those tokens, so the dark backgrounds silently
 *     disappeared while the white text on top of them stayed: white on paper.
 *  2. The legacy retune repointed --pub-blue to forest green for links, which
 *     is right on paper but unreadable on the dark banners that also use it.
 *  3. Gold was used both as text on paper and as a fill behind dark text; no
 *     single value passes in both roles.
 *  4. Leftover cyan and navy literals from the previous identity.
 *
 * Section 1 gives both layouts one complete, corrected token set.
 * Section 2 fixes text that sits on dark bands.
 * Section 3 fixes the shared modern footer and seals.
 * Section 4 holds the remaining component-level corrections.
 */

/* ==========================================================================
   1. One token set for both layouts
   ========================================================================== */
:root {
  --pub-navy: #0A1F44;
  --pub-navy-light: #0F2C5C;
  --pub-navy-dark: #06142E;
  --pub-blue: #0A2756;
  --pub-blue-light: #0A5DA6;
  --pub-blue-dark: #0F3C7A;
  --pub-teal: #0A6CBF;
  --pub-teal-light: #5DB2E8;
  --pub-teal-dark: #0A4F8F;
  --pub-white: #F8FAFD;
  --pub-bg: #F4F7FB;
  --pub-bg-alt: #F8FAFD;
  --pub-border: #D7DEEA;
  --pub-text: #2A3550;
  --pub-text-light: #3E4A63;
  --pub-text-lighter: #525D75;
  --pub-dark: #0A1F44;
  --pub-success: #067647;
  --pub-warning: #B54708;
  --pub-danger: #B42318;
  --pub-info: #0A5DA6;
  --pub-font-heading: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --pub-font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pub-space-xs: 4px;
  --pub-space-sm: 8px;
  --pub-space-md: 16px;
  --pub-space-lg: 24px;
  --pub-space-xl: 32px;
  --pub-space-2xl: 48px;
  --pub-space-3xl: 64px;
  --pub-space-4xl: 96px;
  --pub-container: 1280px;
  --pub-container-lg: 1400px;
  --pub-radius: 5px;
  --pub-radius-lg: 8px;
  --pub-radius-xl: 12px;
  --pub-shadow-sm: 0 1px 2px rgba(10,31,68,.05);
  --pub-shadow-md: 0 8px 24px -12px rgba(10,31,68,.18);
  --pub-shadow-lg: 0 20px 48px -20px rgba(10,31,68,.24);
  --pub-shadow-xl: 0 32px 64px -28px rgba(10,31,68,.30);
  --pub-transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, transform .3s ease, opacity .3s ease;
  --pub-transition-fast: color .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease, opacity .15s ease;
  --pub-gradient-navy: linear-gradient(180deg, #0A1F44 0%, #06142E 100%);
  --pub-gradient-blue: linear-gradient(180deg, #0A2756 0%, #0F3C7A 100%);
  --pub-gradient-hero: linear-gradient(180deg, #0A1F44 0%, #0A2756 100%);
  --pub-gradient-overlay: linear-gradient(to bottom, rgba(10,31,68,.88), rgba(10,39,86,.72));
  --pub-header-height: 80px;
  --pub-utility-height: 40px;
  --pub-mega-menu-bg: #F8FAFD;
  --pub-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --pub-on-dark: #F8FAFD;
  --pub-on-dark-muted: #B8C6DE;
  --pub-gold-bright: #5DB2E8;
  --osh-c-gold-bright: #5DB2E8;
}

/* ==========================================================================
   2. Text on dark bands (legacy .pub-* components, either layout)
   ========================================================================== */

.pub-page-banner,
.pub-cta-strip,
.pub-trust-bar {
  color: var(--pub-on-dark);
}

/* A band that is meant to be dark must actually be dark, even if a page
   omitted the background. Text below is styled on that assumption. */
.pub-page-banner { background: var(--pub-gradient-navy); }
.pub-trust-bar   { background: var(--pub-gradient-navy); }
.pub-cta-strip   { background: linear-gradient(135deg, #0A1F44 0%, #0A2756 100%) !important; }

.pub-page-banner h1,
.pub-page-banner h2,
.pub-page-banner .pub-page-title,
.pub-cta-strip h2,
.pub-cta-strip h3,
.pub-trust-bar .pub-stat-number,
.pub-trust-bar [data-count] {
  color: var(--pub-on-dark) !important;
}

.pub-page-banner p,
.pub-cta-strip p,
.pub-trust-bar .pub-stat-label {
  color: rgba(248, 250, 253, 0.86) !important;
}

/* Breadcrumbs live inside the dark page banner. */
.pub-page-banner .pub-breadcrumb,
.pub-page-banner .pub-breadcrumb a {
  color: var(--pub-on-dark-muted) !important;
}
.pub-page-banner .pub-breadcrumb a:hover { color: var(--pub-gold-bright) !important; }
.pub-page-banner .pub-breadcrumb .current,
.pub-page-banner .pub-breadcrumb span { color: var(--pub-on-dark) !important; }

.pub-cta-eyebrow,
.pub-cta-eyebrow span,
.pub-cta-eyebrow i,
.pub-cta-trust span i {
  color: var(--pub-gold-bright) !important;
}
.pub-cta-trust span { color: rgba(248, 250, 253, 0.8) !important; }

/* Utility bar and footer base are near-black. */
.pub-utility-bar a,
.pub-utility-bar a.pub-utility-login { color: var(--pub-on-dark-muted) !important; }
.pub-utility-bar a:hover { color: var(--pub-gold-bright) !important; }
.pub-footer-bottom,
.pub-footer-bottom p,
.pub-footer-bottom-text,
.pub-footer-bottom a { color: #A3ADC2 !important; }
.pub-footer-bottom a:hover { color: var(--pub-on-dark) !important; }

/* ==========================================================================
   3. Shared modern footer and seals (.osh-*)
   ========================================================================== */

/* The newsletter strip was a cyan gradient from the previous identity with
   white text at 2.97:1. Now a forest band. */
.osh-footer-cta { background: #0A2756 !important; }
.osh-footer-cta h3 { color: #F8FAFD !important; }
.osh-footer-cta p,
.osh-footer-cta .osh-container > span { color: rgba(248, 250, 253, 0.86) !important; }

/* Subscribe button: was cyan text on a forest fill (2.69:1). */
.osh-footer-newsletter button {
  background: #F8FAFD !important;
  color: #0A1F44 !important;
}
.osh-footer-newsletter button:hover { background: #E6EEF8 !important; }

.osh-footer-bottom-row,
.osh-footer-bottom-row .osh-container > div { color: #A3ADC2 !important; }

/* Seals carry dark lettering, so they sit on bright gold leaf, not the
   darker gold used for text. */
.osh-footer-seal,
.osh-seal-mark {
  background: var(--osh-c-gold-bright, #5DB2E8) !important;
  color: #0A1F44 !important;
}

/* On the noir sections, gold accents need the bright value and the
   call-to-action needs a fill that its label can be read against. */
.osh-section-noir .osh-eyebrow,
.osh-section-noir .osh-section-head .osh-eyebrow { color: var(--osh-c-gold-bright, #5DB2E8) !important; }
.osh-section-noir .osh-btn-cta,
.osh-cta-band .osh-btn-cta {
  background: #F8FAFD !important;
  color: #0A1F44 !important;
  border-color: #F8FAFD !important;
}
.osh-section-noir .osh-btn-cta:hover,
.osh-cta-band .osh-btn-cta:hover { background: #E6EEF8 !important; border-color: #E6EEF8 !important; }

/* "Recognised by" monograms: five unrelated brand colours with dark letters
   on top (1.08:1 at worst). One ink chip, light letters. */
.osh-trust-pro-monogram {
  background: #0A1F44 !important;
  color: #F8FAFD !important;
}

/* ==========================================================================
   4. Component corrections
   ========================================================================== */

/* Gold button: light label on the darker gold (5.5:1), not the mid gold (3.76:1). */
.pub-btn-teal {
  background: #0A5DA6 !important;
  border-color: #0A5DA6 !important;
  color: #F8FAFD !important;
}
.pub-btn-teal:hover { background: #0A4F8F !important; border-color: #0A4F8F !important; }

.pub-verification-tab.is-active,
.pub-timeline-item-date { color: #0A5DA6 !important; }

/* Team initials sat on a navy chip with grey letters. */
.pub-card-team-photo > div {
  background: #0A2756 !important;
  color: #F8FAFD !important;
}

/* Primary buttons are a dark fill; the label inherited the body text colour
   once the fill resolved, leaving dark grey on near-black (1.63:1). */
.pub-btn-primary,
a.pub-btn-primary { color: #F8FAFD !important; }

/* Inline code used Bootstrap's pink (3.6:1 on paper). */
.pub-card code,
.pub-card-body code { color: #8A2540 !important; }

/* ==========================================================================
   5. Second audit pass
   ========================================================================== */

.osh-footer-print-notice,
.osh-footer-print-notice .osh-container { color: #A3ADC2 !important; }

/* Headings inherit the colour of a band that declares light text.
   The global heading rule sets ink on every h1-h4, so a heading inside a dark
   band that only set `color: #fff` on the band itself came out dark on dark
   (Events 1.21:1, Complaints 1.20:1). */
:is([style*="color:#fff"], [style*="color: #fff"], [style*="color:white"], [style*="color: white"]) :is(h1, h2, h3, h4) {
  color: inherit;
}
.events-hero :is(h1, h2, p) { color: #F8FAFD !important; }

/* Homepage service tiles: labels sat directly on a mid-tone image (3.0:1).
   A dark chip behind each label makes them independent of the picture. */
.osh-service-pro-tag,
.osh-service-pro-num {
  background: rgba(10, 31, 68, 0.78) !important;
  color: #F8FAFD !important;
  padding: 2px 8px;
  border-radius: 3px;
}

/* Certification cards are dark: accents need the bright gold, not the
   text gold (2.3:1) or forest (1.69:1). */
.osh-cert-card-tag,
.osh-cert-card-cta { color: #5DB2E8 !important; }
section:has(.osh-cert-card) .osh-section-head .osh-eyebrow { color: #5DB2E8 !important; }

.osh-trio-card-rank { color: #525D75 !important; opacity: 1 !important; }
.osh-quote-avatar { color: #0A1F44 !important; }

/* Form help text was #888 on white (3.54:1). */
form small,
.form-text { color: #525D75 !important; }
.osh-trio-card.is-featured .osh-trio-card-rank { color: #B8C6DE !important; }

/* ==========================================================================
   6. Mobile layout (phones, up to 640px)
   A rendered audit at 375px found 25 of 59 public pages scrolling sideways.
   The causes were few and shared:
     - the legacy footer bar pulls itself out with negative margins equal to
       the desktop container padding, which is wider than the phone padding;
     - many sections lay out with INLINE styles such as
       `grid-template-columns: 1fr 2fr 200px` or a non-wrapping flex row, and
       an inline style cannot carry a media query, so they never collapsed;
     - long code samples and wide tables had nowhere to scroll.
   Small tap targets and 11.5px text in the utility bar and breadcrumbs are
   also enlarged here.
   ========================================================================== */

@media (max-width: 640px) {
  /* Legacy footer bar */
  .pub-footer-bottom { margin-left: 0 !important; margin-right: 0 !important; }

  /* Inline multi-column grids collapse to one column on phones. */
  main [style*="grid-template-columns"],
  .pub-section [style*="grid-template-columns"],
  .osh-section [style*="grid-template-columns"],
  section [style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* Inline flex rows may wrap, and their children may shrink. */
  main [style*="display:flex"],
  main [style*="display: flex"],
  section [style*="display:flex"],
  section [style*="display: flex"] {
    flex-wrap: wrap;
  }
  main [style*="display:flex"] > *,
  main [style*="display: flex"] > *,
  section [style*="display:flex"] > *,
  section [style*="display: flex"] > * {
    min-width: 0;
  }

  /* Nothing inside the page container may be wider than the screen. */
  .osh-container > *,
  .pub-container > *,
  .container > * { max-width: 100%; }
  img, video, iframe, svg, canvas { max-width: 100%; height: auto; }

  /* Code samples and tables scroll inside themselves instead of widening the page. */
  pre, code { white-space: pre-wrap; word-break: break-word; }
  pre { overflow-x: auto; }
  table { display: block; max-width: 100%; overflow-x: auto; }

  /* Long words, URLs and e-mail addresses wrap. */
  h1, h2, h3, p, li, a, td, dd { overflow-wrap: anywhere; }

  /* Tap targets: at least 24x24 CSS px (WCAG 2.2 AA). */
  .osh-utility-right a,
  .osh-utility-locale a,
  .pub-breadcrumb a,
  .osh-breadcrumbs a,
  .auth-form-options a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    min-width: 24px;
    padding: 2px 4px;
  }
  input[type="checkbox"],
  input[type="radio"] { width: 20px; height: 20px; }
  button,
  .osh-btn,
  .pub-btn,
  .btn { min-height: 36px; }

  /* Small print: nothing below 12px. */
  .osh-utility-left span,
  .osh-utility-right,
  .pub-breadcrumb,
  .pub-breadcrumb a,
  .osh-breadcrumbs { font-size: 12px !important; }
}

@media (max-width: 640px) {
  /* Homepage "about" visual: a decorative background and seal poked 3-4px
     past the screen edge. They are decoration, so the visual clips them. */
  .osh-about-pro-visual { overflow: hidden; }

  /* Checkboxes and radios reach the 24px target size. */
  input[type="checkbox"],
  input[type="radio"] { width: 24px; height: 24px; }

  /* Eyebrows, pills, badges and seals were 10-11px uppercase. */
  .osh-eyebrow,
  .osh-pill,
  .pub-cta-eyebrow,
  .pub-cta-eyebrow span,
  .pub-badge,
  .pub-card-level,
  .pub-wizard-step span,
  .osh-footer-seal,
  .osh-seal-mark { font-size: 12px !important; }

  .osh-course-enrol,
  a.osh-btn { min-height: 36px; display: inline-flex; align-items: center; }
}

@media (max-width: 640px) {
  /* Utility strip: on a phone it wrapped into three rows (about 130px of
     screen) with dangling separators. Keep one row: language, Verify a
     Certificate and Sign in. Status text, Policies and Support remain in the
     footer and the menu. */
  .osh-utility-left,
  .osh-utility-divider,
  .osh-utility-right > a:nth-of-type(2),
  .osh-utility-right > a:nth-of-type(3) { display: none !important; }
  .osh-utility-strip .osh-container { justify-content: flex-end; }
  .osh-utility-right {
    flex-wrap: nowrap;
    gap: 12px;
    white-space: nowrap;
  }
}

/* ==========================================================================
   7. Text over photographs (legacy page banners)
   Contrast over a photo cannot be guaranteed by colour choice alone, so every
   photo banner gets a scrim: ink at 65% between the image and the text. Even
   over a pure white photo the white title then sits on about #6B6C6C, roughly
   5:1. The legacy script that painted data-bg-img banners is no longer loaded,
   in which case the banner falls back to the ink ground.
   ========================================================================== */
.inner-header,
.breadcrumb-area,
.page-banner-photo {
  position: relative;
  background-color: #0A1F44;
  background-size: cover;
  background-position: center;
  isolation: isolate;
}
.inner-header::before,
.breadcrumb-area::before,
.page-banner-photo::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 31, 68, 0.65);
  z-index: -1;
  pointer-events: none;
}
.inner-header :is(h1, h2, h3, p, li, a, .title),
.breadcrumb-area :is(h1, h2, h3, p, li, a) { color: #F8FAFD !important; }

/* Reduced motion: the older page styles animate reveals, cards and buttons. */
@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;
  }
}
