/* =====================================================================
   NYCE site-wide accessibility layer (WCAG 2.1 AA)
   Loaded on every page after Bootstrap.
   ===================================================================== */

/* ---------- 2.4.1 Bypass Blocks: skip link ---------- */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2000;
  padding: 0.75rem 1rem;
  background: #ffffff;
  color: #0a3d91;
  font-weight: 700;
  text-decoration: underline;
  transform: translateY(-120%);
}
.skip-link:focus {
  transform: translateY(0);
}

/* ---------- 2.4.7 Focus Visible / 1.4.11 Non-text Contrast ---------- */
:focus-visible {
  outline: 3px solid #0a3d91 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 2px #ffffff !important;
}
/* On dark surfaces use a yellow ring so it stays at least 3:1 */
.site-navbar :focus-visible,
.site-footer :focus-visible,
.hero-carousel :focus-visible,
#sebiPopup .sp-head :focus-visible {
  outline-color: #ffd43b !important;
  box-shadow: 0 0 0 2px #000000 !important;
}
/* Programmatic focus targets (main, headings) do not need a ring */
[tabindex="-1"]:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- 1.4.1 Use of Color: links in content are underlined ---------- */
main a:not(.btn):not(.nav-link):not(.dropdown-item),
.site-footer a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
main a:not(.btn):hover,
.site-footer a:hover {
  text-decoration-thickness: 2px;
}

/* ---------- Header: sticky only where there is room (1.4.10 Reflow) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
}
@media (max-width: 991.98px), (max-height: 500px) {
  .site-header {
    position: static;
  }
}
.site-navbar .navbar-brand img {
  height: 40px;
  width: auto;
}
/* Anchor targets are not hidden under the sticky header (2.4.3/2.4.7) */
:target,
main h2,
main h3,
[id] {
  scroll-margin-top: 90px;
}

/* ---------- 1.4.10 Reflow / 1.4.12 Text Spacing ---------- */
img,
video,
iframe,
svg {
  max-width: 100%;
}
img {
  height: auto;
}
main {
  overflow-wrap: break-word;
}
main a[href^="http"],
main a[href^="mailto:"] {
  overflow-wrap: anywhere;
}
.table-scroll {
  overflow-x: auto;
  margin-bottom: 1rem;
}
.table-scroll > .table {
  margin-bottom: 0;
}

/* ---------- Content helpers ---------- */
main {
  padding-top: 2rem;
  padding-bottom: 2rem;
}
main:focus {
  outline: none;
}
.figure-block {
  margin: 1.5rem 0;
}
.figure-block figcaption {
  font-size: 0.95rem;
  color: #495057; /* 8.2:1 on white */
  margin-top: 0.5rem;
}
.ratio-table caption,
.data-table caption {
  caption-side: top;
  color: #212529;
  font-weight: 700;
  font-size: 1.05rem;
}
.ratio-table .formula {
  display: inline-block;
  text-align: center;
}
.ratio-table .formula .num {
  display: block;
  border-bottom: 1px solid currentColor;
}
.ratio-table .formula .den {
  display: block;
}
blockquote.quote {
  border-left: 4px solid #198754;
  padding-left: 1rem;
  margin: 1.5rem 0;
}

/* ---------- Glossary A–Z index (target size >= 24px) ---------- */
.az-index ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}
.az-index a,
.az-index span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  border: 1px solid #6c757d;
  border-radius: 0.375rem;
}
.az-index a {
  text-decoration: none;
}
.az-index a:hover {
  background: #e7f1ff;
}
.az-index span {
  color: #595959; /* 7:1 on white */
  border-style: dashed;
}
.back-to-top {
  display: inline-block;
  margin: 0.5rem 0 1.5rem;
}

/* ---------- Form errors (3.3.1 / 3.3.3) ---------- */
.field-error {
  color: #b02a37; /* 6.1:1 on white */
  font-weight: 600;
  margin-top: 0.25rem;
}
.form-control[aria-invalid="true"] {
  border-color: #b02a37;
  border-width: 2px;
}
.required-mark {
  color: #b02a37;
}

/* ---------- Home: hero carousel with real text (1.4.5) ---------- */
.hero-carousel {
  position: relative;
  background: #0b1219;
}
.hero-slide {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(220px, 45vw, 560px);
  padding: 2rem 4.5rem;
  background: #0b1219 url("/assets/images/carousels/hero-bg.jpg") center / cover no-repeat;
  text-align: center;
}
.hero-slide::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.hero-title {
  position: relative;
  margin: 0;
  font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
  line-height: 1.05;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}
.hero-title .hero-accent {
  display: block;
  color: #86e07a; /* 11:1 on the darkened background */
  font-weight: 700;
  font-size: clamp(2.25rem, 8vw, 7rem);
}
.hero-title .hero-sub {
  display: block;
  color: #ffffff;
  font-weight: 300;
  font-size: clamp(2rem, 7.5vw, 6.5rem);
  letter-spacing: 0.04em;
}
.hero-carousel .carousel-control-prev,
.hero-carousel .carousel-control-next {
  width: 3.5rem;
  opacity: 1;
}
.hero-carousel .carousel-control-prev-icon,
.hero-carousel .carousel-control-next-icon {
  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  background-size: 60%;
  width: 2.75rem;
  height: 2.75rem;
}
.carousel-pause {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.9rem;
  border: 2px solid #ffffff;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  font-weight: 600;
}
.carousel-pause:hover {
  background: #000000;
}

/* Home cards: whole card clickable via stretched-link */
.action-card img {
  max-width: 50%;
}

/* ---------- 2.2.2 / 2.3.1: honour reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- Third-party: TradingView attribution link contrast (1.4.3) ---------- */
/* ID selectors so this beats the stylesheet TradingView injects at runtime */
#cardRow .tradingview-widget-copyright,
#cardRow .tradingview-widget-copyright a,
#cardRow .tradingview-widget-copyright a:visited {
  color: #3d4250 !important; /* 10:1 on white */
  font-size: 0.875rem !important;
  text-decoration: underline !important;
}
.site-footer a {
  overflow-wrap: anywhere;
}

/* Room under the footer so the fixed accessibility-widget launcher never
   covers the last lines of content (1.4.10 / 2.4.11-style obscuring) */
.site-footer > .container:last-child {
  padding-bottom: 6.5rem !important;
}
