/**
 * Accessibility — visible keyboard focus indicator (WCAG 2.4.7, Level AA)
 *
 * The theme resets `outline` on many controls (links, buttons, inputs), which
 * removes the keyboard focus ring and leaves keyboard users unable to see where
 * they are. This restores a visible ring for KEYBOARD focus only (:focus-visible),
 * so mouse interaction and the visual design are unchanged.
 *
 * Loaded last (see custom_style_enqueue) + !important so it overrides the theme's
 * existing `outline:none` / `outline:0` resets. No JS/behaviour depends on this.
 */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[role="link"]:focus-visible,
[role="tab"]:focus-visible,
[role="menuitem"]:focus-visible,
[role="checkbox"]:focus-visible,
[role="radio"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
  outline: 3px solid var(--color-secondary, #f9ac1b) !important;
  outline-offset: 2px !important;
}

/* Skip-to-content link must be clearly visible when it receives focus. */
.skip-link:focus,
.skip-link:focus-visible {
  outline: 3px solid var(--color-secondary, #f9ac1b) !important;
  outline-offset: 2px !important;
}

/**
 * Screen-reader-only text must reach screen readers (WCAG 1.3.1 / 2.4.1 / 4.1.2, Level A).
 *
 * header-search.css sets `.screen-reader-text { display:none }`, which overrides the
 * correct visually-hidden pattern in style.css and removes EVERY .screen-reader-text from
 * the accessibility tree, site-wide. Effects: the skip link (header.php) cannot receive
 * focus, and controls that rely on it for their name (History timeline tabs, FAQ, search,
 * calendar, program cards…) are announced with no name.
 *
 * style.css already keeps these elements invisible (position:absolute !important + clip,
 * 1x1px), so undoing `display:none` shows nothing on screen — verified: no layout change.
 * `:not(:focus)` leaves style.css's own `.screen-reader-text:focus` rule free to reveal the
 * skip link when a keyboard user tabs to it.
 */
.screen-reader-text:not(:focus) {
  display: inline !important;
}

/**
 * Sticky header must not cover focused / scrolled-to content (WCAG 2.4.11; technique C43).
 *
 * `scroll-padding-top` on <html> makes the browser stop every focus-scroll, #anchor jump and
 * scrollIntoView() below the sticky header instead of underneath it. (assets/js/a11y.js also
 * reveals focus hidden under the sticky page bars; scanners only check for this CSS.)
 *
 * The offset uses the SAME values the theme already used for its own anchor targets
 * (#primary-content: 110px, and 80px at <=1200px - header.css). Elements that already had a
 * scroll-margin-top keep their exact landing position: their margin becomes
 * (original - offset), because the browser adds scroll-margin to scroll-padding.
 *   #primary-content          110 / 80  ->  0
 *   .pdop_schedule             110       ->  110 - offset   (calendar.css)
 *   .search-category-section   100       ->  100 - offset   (inline style in search.php)
 * Scroll targets with no margin of their own (mega-menu anchors, rainout grid, schedule
 * anchor, #primary skip link) now stop below the header rather than hidden under it.
 * Scripts that scroll with explicit coordinates (window.scrollTo / jQuery animate, e.g. the
 * accordion and TOC scrolling) are not affected by scroll-padding.
 */
/* Offset clears the tallest sticky header measured (111px incl. top bar) + 16px breathing room;
   assets/js/a11y.js raises it further if the real header is ever taller (never lowers it). */
:root {
  --pdop-scroll-offset: 128px;
}
@media (max-width: 1200px) {
  :root {
    --pdop-scroll-offset: 88px;
  }
}
html {
  scroll-padding-top: var(--pdop-scroll-offset);
}
/* Theme's own landing points kept exact: margin = original - offset (header.css 110 / 80). */
#primary-content {
  scroll-margin-top: calc(110px - var(--pdop-scroll-offset)) !important;
}
@media (max-width: 1200px) {
  #primary-content {
    scroll-margin-top: calc(80px - var(--pdop-scroll-offset)) !important;
  }
}
.pdop_schedule {
  scroll-margin-top: calc(110px - var(--pdop-scroll-offset)) !important;
}
.search-category-section {
  scroll-margin-top: calc(100px - var(--pdop-scroll-offset)) !important;
}

/**
 * Rentals & Permits Gravity Forms — expose hidden field labels to assistive tech
 * (WCAG 1.3.1 / 4.1.2, Level A).
 *
 * The theme hides the form labels with `.rp-form-section .gfield_label { display:none }`
 * (components.css + rentals-permits.css). `display:none` also removes them from the
 * accessibility tree, so screen-reader users get no field name — the <select> controls
 * ("Select the category of your event", "Choose Topic") end up with NO accessible name
 * at all, and the text inputs fall back to their placeholder only.
 *
 * Swap `display:none` for the visually-hidden clip pattern: the label stays invisible
 * and takes no layout space (position:absolute), so the design is unchanged, but the
 * real label text is now announced. Same selector + !important + loaded last, so it
 * wins over the theme's `display:none !important`. The nested `.gfield_required`
 * keeps its own `display:none` (aria-required already conveys required state).
 */
.rp-form-section .gfield_label {
  display: block !important;
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/**
 * ============================================================================
 * CONTRAST COLOUR TOKENS — change a colour here and it updates everywhere below.
 * Every value is verified >= 4.5:1 (WCAG 1.4.3 AA) against the background it is
 * used with; re-check the ratio if you change one.
 * ============================================================================
 */
:root {
  --a11y-sky-text: #006f88; /* was #009ad0 / #0079a4 / #0082b3 text. white 5.79, #e2f8ff 5.26 */
  --a11y-sky-bg: #0079a4; /* was #009ad0 background under white text. white text 4.92 */
  --a11y-gray-text: #6e6e6e; /* was #989898 text. white 5.10 */
  --a11y-gray-on-tint: #666666; /* gray text on light tints. #efefef 4.99, #f4f0ff 5.13, white 5.74 */
  --a11y-status-green-bg: #15803d; /* was #1ec94e "Completed" chip under white text. white text 5.02 */
  --a11y-status-blue-bg: #0079a4; /* was #00aef0 "In Progress" chip under white text. white text 4.92 */
  --a11y-badge-green-text: #157c21; /* was #188f26 on #c5ffc0 badge. 4.68 */
  --a11y-badge-orange-text: #8f5210; /* was #bf6d15 on #ffd8af badge. 4.64 */
}

/**
 * Color contrast (WCAG 1.4.3 AA) — deepen brand sky-blue TEXT that falls below 4.5:1.
 *
 * The brand sky tones (#009ad0 / #0079a4 / #0082b3) sit on white or the light-blue
 * tints (#e2f8ff / #e6f6fc) as small bold labels/headings and land at 2.9-4.47:1.
 * Approved 2026-09-22: unify these TEXT uses to #006f88 (verified >= 4.5:1 on every
 * background in use; white 5.79, #e2f8ff 5.26, #e6f6fc 5.22). Text colour only — the
 * element/tag, layout and every other sky-blue use (backgrounds, icons, passing large
 * text) are untouched. Targeted to the exact failing selectors, loaded last + !important.
 */
.pdop-more-info-label,
.pointer-title,
.pdop_program_detail_data_section .program_highlight_section > h6,
.ra-section-header,
.rp-facility-info-label,
.rp-passes-alert-bar,
.rp-occupancy-alert-bar,
.ra-datetime-row__label,
.folder-tag-bg-heading h4,
.did-you-know-desc a {
  color: var(--a11y-sky-text) !important;
}

/**
 * Color contrast (WCAG 1.4.3 AA) — sky-blue BACKGROUNDS with white text, plus SmartRec
 * (srec_*) elements that the THEME skins (rules live in program.css / program-activity.css,
 * so the fix belongs here, not in the plugin). Approved 2026-09-22.
 *
 * #009ad0 backgrounds with white text sit at 3.21:1; deepen to #0079a4 (white -> 4.92).
 * The `.impinfo` category header is re-asserted so its cream variant is preserved.
 * The pricing "Buy Now" link is sky TEXT on white (3.21) -> #006f88; left WITHOUT
 * !important so the featured (white-on-sky) pricing column keeps its own more-specific
 * colour (a11y.css loads after program.css / program-activity.css).
 */
.srec_pc_wrap.pdop_program_category_wrapper {
  background-color: var(--a11y-sky-bg) !important;
}
.program-activity .srec_act_cat_hdr {
  background-color: var(--a11y-sky-bg) !important;
}
.program-activity .impinfo .srec_act_cat_hdr {
  background-color: #fff5e2 !important;
}
.program-activity .srec_filter_group select {
  color: var(--a11y-gray-text) !important;
}
.pdop_membership_cell a,
.pdop_punch_cell a {
  color: var(--a11y-sky-text);
}

/**
 * Color contrast (WCAG 1.4.3 AA) — homepage blue panels + project status badges.
 * Approved 2026-09-23. Found at desktop width (1440px).
 *
 * - "Top Locations" panel and "Community welcome" card: white text (search box,
 *   filter dropdown labels, welcome tagline + description) on #009ad0 = 3.21:1.
 *   The white text sits on the panel background, so the panel gets the approved sky bg.
 * - Homepage project chips: white text on "Completed" #1ec94e (2.21) and
 *   "In Progress" #00aef0 (2.53). Planning (#ffb800 + black) already passes.
 * - Park Planning page badges (ppp-styles.css): coloured text on pale tints,
 *   Completed 3.69 and In Progress 2.90. The text, icon stroke and dot share one
 *   colour in the design, so all three are deepened together to keep them matched.
 *   No-status gray (4.74) already passes.
 */
.pdop_top_locations_inner,
.pdop_community_welcome {
  background-color: var(--a11y-sky-bg) !important;
}
.pdop_top_locations_card_chip.ppp-badge--completed {
  background: var(--a11y-status-green-bg) !important;
}
.pdop_top_locations_card_chip.ppp-badge--in-progress {
  background: var(--a11y-status-blue-bg) !important;
}
.ppp-badge--completed:not(.pdop_top_locations_card_chip) {
  color: var(--a11y-badge-green-text) !important;
}
.ppp-badge--completed:not(.pdop_top_locations_card_chip) svg {
  stroke: var(--a11y-badge-green-text) !important;
}
.ppp-badge--completed:not(.pdop_top_locations_card_chip) .ppp-badge__dot {
  background: var(--a11y-badge-green-text) !important;
}
.ppp-badge--in_progress:not(.pdop_top_locations_card_chip) {
  color: var(--a11y-badge-orange-text) !important;
}
.ppp-badge--in_progress:not(.pdop_top_locations_card_chip) svg {
  stroke: var(--a11y-badge-orange-text) !important;
}
.ppp-badge--in_progress:not(.pdop_top_locations_card_chip) .ppp-badge__dot {
  background: var(--a11y-badge-orange-text) !important;
}

/**
 * Color contrast (WCAG 1.4.3 AA) — Schedules (The Events Calendar). Found at desktop width.
 * - "+ N more" link in PAST month-grid days: TEC dims it with opacity .5, so the theme's
 *   #333 renders as #919191 on the #efefef cell = 2.74:1. It is still a working link.
 *   Keep it visibly lighter than current days, but readable: full opacity + gray-on-tint.
 * - Calendar search input text + placeholder: #898989 on white = 3.49:1 (calendar.css).
 */
.tribe-events-calendar-month__day--past
  .tribe-events-calendar-month__more-events-link {
  opacity: 1 !important;
  color: var(--a11y-gray-on-tint) !important;
}
.tribe-events .tribe-events-c-events-bar .tribe-common-form-control-text__input,
.tribe-events
  .tribe-events-c-events-bar
  .tribe-common-form-control-text__input::placeholder {
  color: var(--a11y-gray-text) !important;
}

/**
 * Color contrast (WCAG 1.4.3 AA) — Parks & Facilities (Directories Pro) "per page" toggle.
 * Bootstrap outline-secondary text #6c757d on the lilac #f4f0ff button = 4.18:1.
 * Re-rendered by Directories Pro AJAX; CSS still applies.
 */
.drts-view-entities-perpage {
  color: var(--a11y-gray-on-tint) !important;
}
