/* Project-wide styles layered over Bootstrap. Served via collectstatic. */

:root {
  /* rgb triplet is the single source of truth: Bootstrap's link variables need
     the "r, g, b" form, and var(--bs-icc-blue) is derived from it below. */
  --bs-icc-blue-rgb: 3, 102, 153;
  --bs-icc-blue-hover-rgb: 3, 102, 153;
  --bs-icc-blue: rgb(var(--bs-icc-blue-rgb));
  --bs-icc-blue-hover: rgb(var(--bs-icc-blue-hover-rgb));

  /* Bare links adopt the brand blue everywhere. No !important, so an explicit
     color class (e.g. .text-danger) still wins. Both forms are set: reboot's
     `a` reads the rgb triplet, while components like .nav-link read the hex. */
  --bs-link-color: var(--bs-icc-blue);
  --bs-link-hover-color: var(--bs-icc-blue-hover);
  --bs-link-color-rgb: var(--bs-icc-blue-rgb);
  --bs-link-hover-color-rgb: var(--bs-icc-blue-hover-rgb);
}

/* Lighten the brand blue on dark backgrounds for legible text/links.
   Every consumer of var(--bs-icc-blue) picks this up automatically. */
[data-bs-theme="dark"] {
  --bs-icc-blue-rgb: 91, 173, 217;
  --bs-icc-blue-hover-rgb: 125, 197, 235;
}

/* Brand default: links have no underline at rest, underline on interaction. */
a {
  text-decoration: none;
}

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

/* Bootstrap components manage their own decoration — keep them free of the
   hover underline above (buttons, nav, dropdowns, pagination, brand). */
.btn:hover,
.btn:focus,
.nav-link:hover,
.nav-link:focus,
.dropdown-item:hover,
.dropdown-item:focus,
.page-link:hover,
.page-link:focus,
.navbar-brand:hover,
.navbar-brand:focus {
  text-decoration: none;
}

.text-icc-blue {
  color: var(--bs-icc-blue) !important;
}

/* Preserve mixed-case brand names (e.g. "iccMAX") inside uppercase menus. */
.text-transform-none {
  text-transform: none;
}

.bg-icc-blue {
  background-color: var(--bs-icc-blue) !important;
  color: rgb(255, 255, 255);
}

.btn-icc-blue {
  background-color: var(--bs-icc-blue);
  color: rgb(255, 255, 255);
  border: none;
}

.btn-icc-blue:hover,
.btn-icc-blue:focus {
  background-color: var(--bs-icc-blue-hover);
  color: rgb(255, 255, 255);
}

.badge.bg-light {
  color: var(--bs-icc-blue) !important;
}

.page-link {
  color: var(--bs-icc-blue) !important;
}

.page-link:hover,
.page-link:focus {
  color: var(--bs-icc-blue) !important;
}

.page-item.active .page-link {
  background-color: var(--bs-icc-blue) !important;
  border-color: var(--bs-icc-blue) !important;
  color: rgb(255, 255, 255) !important;
}

.breadcrumb-item a {
  color: var(--bs-icc-blue) !important;
  text-decoration: none;
}

.breadcrumb-item a:hover,
.breadcrumb-item a:focus {
  color: var(--bs-icc-blue) !important;
  text-decoration: underline;
}

/* Legacy author content keeps underlined links for readability, but leave
   button-styled anchors (e.g. .btn-icc-blue) to Bootstrap's own coloring. */
.page-content a:not(.btn) {
  color: var(--bs-icc-blue) !important;
  text-decoration: underline;
}

.list-group-icc-blue .list-group-item.active {
  background-color: var(--bs-icc-blue);
  color: rgb(255, 255, 255);
  border-color: var(--bs-icc-blue);
}

.list-group-icc-blue .list-group-item.active:hover,
.list-group-icc-blue .list-group-item.active:focus {
  background-color: var(--bs-icc-blue-hover);
  color: rgb(255, 255, 255);
  border-color: var(--bs-icc-blue-hover);
}

/* Member dashboard activity feed: each curated update is a single <p> authored
   in Redactor, optionally led by a Bootstrap Icon the author inserts. Only the
   divider and spacing live here so the snippet markup stays as plain as the
   editor produces. */
.member-activity-feed > p {
  margin: 0;
  padding: 0.75rem 0;
  border-top: var(--bs-border-width) solid var(--bs-border-color);
}

/* Brand-blue default for the leading icon; an inline text-* class still wins. */
.member-activity-feed > p .bi {
  margin-right: 0.4rem;
  color: var(--bs-icc-blue);
}

/* Legacy page content: Page.content is author-supplied raw HTML that
   predates Bootstrap, so bare tags inside .page-content get a
   Bootstrap-equivalent look (.table/.table-striped, .img-fluid) here.
   Bootstrap theme variables keep the styling correct in both light and
   dark mode. */
.page-content table {
  width: 100%;
  margin-bottom: 1rem;
  border-collapse: collapse;
  caption-side: bottom;
}

.page-content th,
.page-content td {
  padding: 0.5rem 0.75rem;
  border-bottom: var(--bs-border-width) solid var(--bs-border-color);
  text-align: left;
  vertical-align: top;
}

/* Legacy tables put header rows inside <tbody>, so header emphasis has to
   come from the <th> cells themselves; the cell background also sits above
   the row striping below. */
.page-content th {
  background-color: var(--bs-secondary-bg);
}

.page-content tbody tr:nth-of-type(odd) > td {
  background-color: rgba(var(--bs-emphasis-color-rgb), 0.05);
}

/* Stand-in for .table-responsive: legacy tables have no scroll wrapper
   div, so on narrow screens the table itself scrolls horizontally. */
@media (max-width: 767.98px) {
  .page-content table {
    display: block;
    overflow-x: auto;
  }
}

.page-content img {
  max-width: 100%;
  height: auto;
}

.page-content blockquote {
  padding-left: 1rem;
  border-left: 0.25rem solid var(--bs-border-color);
  color: var(--bs-secondary-color);
}

/* Legacy markup uses empty <p></p> pairs as spacers. */
.page-content p:empty {
  display: none;
}

#pdf-viewport {
  height: calc(100vh - 180px);
  overflow-y: auto;
  background: rgb(82, 86, 89);
}

/* Theme-aware logo swap (see _logo.html): light variant by default,
   dark variant when the dark theme is active. */
img.icc-logo-dark {
  display: none;
}

[data-bs-theme="dark"] img.icc-logo-light {
  display: none;
}

[data-bs-theme="dark"] img.icc-logo-dark {
  display: inline;
}

/* Sortable table headers (behavior in site.js). site.js wraps each header's
   text in a button so the <th> keeps its columnheader role; these rules strip
   the button chrome so it still reads as a plain header. */
.sortable-table th .sort-button {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
  /* Without this, click-dragging a header selects its text instead of sorting. */
  user-select: none;
}

.sortable-table th .sort-button:hover {
  color: var(--bs-link-hover-color);
}

.sortable-table th .sort-button:focus-visible {
  outline: 2px solid var(--bs-focus-ring-color);
  outline-offset: 2px;
}

/* Dimmed on inactive columns: present enough to advertise that the column
   sorts, quiet enough not to compete with the active one. */
.sortable-table .sort-indicator {
  font-size: 0.75em;
  opacity: 0.35;
}

.sortable-table th[aria-sort="ascending"] .sort-indicator,
.sortable-table th[aria-sort="descending"] .sort-indicator {
  opacity: 1;
}
