/* =====================================================================
   UCB Accessibility overrides
   Loaded sitewide via the ucb module's ucb_accessibility library.
   Targets WCAG 1.4.3 Contrast (Minimum) issues in the Triph theme.
   ===================================================================== */

/* =====================================================================
   Issue 7 - Skip-to-main-content link visibility on focus.
   The theme's html.html.twig already includes a skip link with classes
   ".visually-hidden focusable" pointing to #main-content. These rules
   make sure it is hidden by default and clearly visible (and unhidden)
   the moment it receives keyboard focus, regardless of theme overrides.
   ===================================================================== */
a.visually-hidden.focusable,
a[href="#main-content"].visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a.visually-hidden.focusable:focus,
a.visually-hidden.focusable:active,
a[href="#main-content"]:focus,
a[href="#main-content"]:active {
  position: fixed !important;
  top: 8px !important;
  left: 8px !important;
  z-index: 100000 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 12px 18px !important;
  clip: auto !important;
  overflow: visible !important;
  white-space: normal !important;

  background: #003262 !important;  /* UC Berkeley Blue */
  color: #ffffff !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  text-decoration: underline !important;
  border: 3px solid #fdb515 !important;  /* California Gold focus ring */
  border-radius: 4px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
  outline: none !important;
}


/* Body text: was #777 (4.49:1 - borderline fail). Default text now passes 7:1 on white.
   Specific dark-background overrides in the theme still take precedence. */
body {
  color: #595959;
}

/* Default link color: was #fa9928 (~2.19:1 fail). Same specificity as the
   theme rule, so element-specific rules (.main-menu a, .theme-btn,
   .read-more, etc.) keep their existing color. */
a,
a:visited {
  color: #995808;
}
a:hover,
a:focus {
  color: #6d3f06;
}

/* =====================================================================
   Accessibility: WCAG 1.4.1 Use of Color (Issue 6)
   "Links are not clearly identifiable" - links must not rely on color
   alone. Underline every link inside <main>, then opt out for elements
   that are obviously buttons/nav/icons (the visual styling makes them
   identifiable as interactive without an underline).
   ===================================================================== */

main a,
main a:visited,
main a:hover,
main a:focus {
  text-decoration: underline;
}

main .theme-btn,
main .theme-btn:hover,
main .theme-btn:focus,
main .theme-btn:visited,
main .btn,
main .btn:hover,
main .btn:focus,
main .btn:visited,
main .read-more,
main .read-more:hover,
main .read-more:focus,
main .read-more:visited,
main .brochure,
main .brochure:hover,
main .brochure:focus,
main .brochure:visited,
main .bread-crumb a,
main .bread-crumb a:hover,
main .bread-crumb a:focus,
main .bread-crumb a:visited,
main .post-share-options a,
main .post-share-options a:hover,
main .post-share-options a:focus,
main .post-share-options a:visited,
main .nav-tabs a,
main .nav-tabs a:hover,
main .nav-tabs a:focus,
main .nav-tabs a:visited,
main .pagination a,
main .pagination a:hover,
main .pagination a:focus,
main .pagination a:visited,
main .styled-pagination a,
main .styled-pagination a:hover,
main .styled-pagination a:focus,
main .styled-pagination a:visited,
main .image a,
main .image a:hover,
main .image a:focus,
main .image a:visited,
main figure a,
main figure a:hover,
main figure a:focus,
main figure a:visited,
main .image-box a,
main .image-box a:hover,
main .image-box a:focus,
main .image-box a:visited,
main .icon-link,
main .icon-link:hover,
main .icon-link:focus,
main .icon-link:visited,
main a.theme-btn,
main a.btn,
main a.read-more,
main a.brochure,
main a[role="button"],
main a[role="button"]:hover,
main a[role="button"]:focus,
main a[role="button"]:visited {
  text-decoration: none;
}

/* Breadcrumb (page-info) sits on #616161 dark gray. Use white for 6.45:1. */
.page-info,
.page-info a,
.page-info a:visited,
.page-info .bread-crumb,
.page-info .bread-crumb li,
.page-info .bread-crumb li a {
  color: #ffffff;
}
.page-info .bread-crumb li:after {
  color: #ffffff;
}
.page-info a:hover,
.page-info a:focus,
.page-info .bread-crumb li a:hover,
.page-info .bread-crumb li a:focus {
  color: #ffd9a8;
}

/* Light gray text classes used in light-bg sections */
.text,
.lower-content .text,
small,
.small,
.muted,
.text-muted,
.help-block,
.description,
.field--description,
.form-item .description {
  color: #595959;
}

/* Form inputs: typed text and placeholder contrast */
input,
textarea,
select {
  color: #333333;
}
input::placeholder,
textarea::placeholder {
  color: #595959;
  opacity: 1;
}
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
  color: #595959;
}
input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
  color: #595959;
}
input::-moz-placeholder,
textarea::-moz-placeholder {
  color: #595959;
  opacity: 1;
}

/* Footer is on dark blue (#131d33). Keep links readable there. */
.main-footer a,
.main-footer a:visited {
  color: #ffd9a8;
}
.main-footer a:hover,
.main-footer a:focus {
  color: #ffffff;
}

/* =====================================================================
   Issue 11 - Empty headings (CSS fallback for when JS is disabled).
   The JS in ucb-accessibility.js removes empty headings from the DOM;
   this rule hides headings whose only content is whitespace or which
   are completely empty (CSS :empty matches elements with no children).
   ===================================================================== */
main h1:empty,
main h2:empty,
main h3:empty,
main h4:empty,
main h5:empty,
main h6:empty {
  display: none;
}

/* =====================================================================
   Issue 12 - Form field labels.
   .visually-hidden hides a label visually but keeps it announced by
   screen readers. Drupal core normally provides this rule via the
   stable theme; we declare it here so module-level template overrides
   are not dependent on theme-level CSS.
   ===================================================================== */
.visually-hidden {
  position: absolute !important;
  clip: rect(1px, 1px, 1px, 1px);
  overflow: hidden;
  height: 1px;
  width: 1px;
  word-wrap: normal;
}

/* =====================================================================
   Pin the Skynet Technologies "All in One Accessibility" widget icon
   to the bottom-left corner so it does not overlap with the theme's
   scroll-to-top button at the bottom-right.
   ===================================================================== */
#accessibility_settings_toggle_icon,
#accessibility_settings_toggle {
  left: 15px !important;
  right: auto !important;
  bottom: 15px !important;
}

/* =====================================================================
   Issue 15 - WCAG 1.4.4 Resize text.
   Prevent text from being clipped when users zoom or scale text up to
   200%. Card-style containers in the theme use fixed pixel heights and
   overflow:hidden, which clips growing text. We force these containers
   to use min-height (so they can grow vertically) and allow overflow.
   ===================================================================== */

/* Card / block containers - allow vertical growth */
.team-block .inner-box,
.team-block .lower-content,
.news-block-three .inner-box,
.news-block-three .lower-content,
.news-block-two .inner-box,
.news-block-two .lower-content,
.gallery-block .inner-box,
.gallery-block .lower-box,
.service-block-two .inner-box,
.service-block-two .content,
.history-block .inner-box,
.history-block .lower-content,
.author-box .inner-box {
  height: auto !important;
  overflow: visible !important;
}

/* Inline style overrides - templates set fixed min-height that, while
   technically allowing growth, can interact badly with absolute layouts.
   Force the boxes to use min-height (already in the inline style) but
   guarantee height auto for the wrapping content too. */
.team-block .inner-box[style*="min-height"],
.news-block-three .inner-box[style*="min-height"] {
  height: auto !important;
}

/* Designation / metadata text - never truncate when scaled up */
.team-block .designation,
.team-block ul,
.team-block .alumni-meta,
.news-block-three .post-meta,
.news-block-two .post-meta,
.lower-content .text {
  overflow: visible !important;
  text-overflow: clip;
  white-space: normal;
}

/* Cards must allow content to wrap rather than spill outside the box */
.team-block,
.news-block-three,
.news-block-two,
.gallery-block,
.service-block-two,
.history-block {
  overflow: visible;
}

/* When the user has bumped text up significantly, drop fixed heights
   on hero / banner / page-info bars so headings inside can wrap. */
@media (max-width: 1200px) {
  .page-info,
  .page-title-bar,
  .header-upper,
  .header-lower {
    height: auto !important;
    min-height: 0;
  }
}


/* =====================================================================
   Accessibility: WCAG heading hierarchy (Issue 5)
   The site name in the header was previously an <h3>; converting it to
   a <p class="site-name"> avoids an h3-before-h1 hierarchy violation
   while keeping its previous visual appearance.
   ===================================================================== */
.main-header .header-upper .upper-right .site-name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4em;
  margin: 0 0 12px 0;
  display: block;
}

/* Alumni metadata previously rendered as <h6>; now <p class="alumni-meta">. */
.team-block .alumni-meta {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 4px 0;
  color: #595959;
}
