/* ==========================================================================
   bt-ux-upgrade.css
   Comprehensive UX polish layer applied AFTER bt-design.css.
   This file's job: bring every interaction up to institutional-product
   standard. Buttons feel solid. Links feel deliberate. Focus rings
   satisfy WCAG. Hovers transition cleanly. Cards lift with intent.
   No layout changes — only refinement of existing pattern library.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. FOCUS RINGS — WCAG 2.1 AA compliant focus-visible everywhere.
      Replaces the browser default outline with a brand-blue ring that
      sits 2px outside the element so it's never clipped.
   -------------------------------------------------------------------------- */
*:focus { outline: none; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--bt-blue-bright);
  outline-offset: 3px;
  border-radius: 4px;
  transition: outline-offset 0.12s ease;
}

/* Focus inside dark sections — use a brighter ring for contrast */
.bt-section.dark a:focus-visible,
.bt-section.dark button:focus-visible,
.bt-section.deep a:focus-visible,
.bt-section.deep button:focus-visible,
.bt-cta-band a:focus-visible,
.bt-cta-band button:focus-visible,
.bt-article-hero a:focus-visible,
.bt-nav.bt-nav-dark a:focus-visible,
.bt-nav.bt-nav-dark button:focus-visible {
  outline-color: #FCD34D;
  outline-offset: 4px;
}

/* --------------------------------------------------------------------------
   2. BUTTONS — refined hover/active/disabled states.
   -------------------------------------------------------------------------- */
.bt-btn {
  position: relative;
  transition:
    background-color 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Primary button: lift slightly on hover, depress on click */
.bt-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 92, 189, 0.28);
}
.bt-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(2, 92, 189, 0.22);
  transition-duration: 0.08s;
}

/* Dark button: same lift behavior */
.bt-btn-dark:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}
.bt-btn-dark:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  transition-duration: 0.08s;
}

/* Ghost buttons — subtle background fill on hover instead of full inversion */
.bt-btn-ghost-light:hover {
  background: rgba(2, 92, 189, 0.06);
  border-color: var(--bt-blue);
  color: var(--bt-blue);
}
.bt-btn-ghost-dark:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--bt-white);
}

/* Disabled state */
.bt-btn[disabled],
.bt-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* SVG icon inside buttons — polish the slide animation */
.bt-btn svg {
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.bt-btn:hover svg {
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   3. LINKS — distinguishable from running text without being noisy.
   -------------------------------------------------------------------------- */
/* Inline links inside body text get a subtle underline and color shift.
   Excludes structural links (cards, nav, buttons) by class. */
.bt-prose a:not(.bt-btn):not(.bt-no-underline),
.bt-article-body a:not(.bt-btn):not(.bt-no-underline),
p > a:not(.bt-btn):not(.bt-no-underline) {
  color: var(--bt-blue);
  text-decoration: underline;
  text-decoration-color: rgba(2, 92, 189, 0.32);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.18s ease, color 0.18s ease;
}
.bt-prose a:not(.bt-btn):not(.bt-no-underline):hover,
.bt-article-body a:not(.bt-btn):not(.bt-no-underline):hover,
p > a:not(.bt-btn):not(.bt-no-underline):hover {
  color: var(--bt-blue-deep);
  text-decoration-color: var(--bt-blue);
}

/* Inline links in dark contexts */
.bt-section.dark p a:not(.bt-btn),
.bt-section.deep p a:not(.bt-btn),
.bt-cta-band p a:not(.bt-btn),
.bt-article-hero p a:not(.bt-btn) {
  color: var(--bt-blue-bright);
  text-decoration-color: rgba(14, 165, 233, 0.4);
}
.bt-section.dark p a:not(.bt-btn):hover,
.bt-section.deep p a:not(.bt-btn):hover,
.bt-cta-band p a:not(.bt-btn):hover,
.bt-article-hero p a:not(.bt-btn):hover {
  color: #FCD34D;
  text-decoration-color: #FCD34D;
}

/* --------------------------------------------------------------------------
   4. CARD HOVER STATES — uniform lift across all interactive cards.
   -------------------------------------------------------------------------- */
.bt-offering-card,
.bt-fork-card,
.bt-ins-article,
.bt-team-card-mini,
.bt-thesis-point,
.bt-principle {
  transition:
    transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

a.bt-offering-card:hover,
a.bt-fork-card:hover,
a.bt-ins-article:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(1, 47, 107, 0.10);
  border-color: var(--bt-blue);
}

/* --------------------------------------------------------------------------
   5. FORM INPUTS — standardize focus, hover, and placeholder.
   -------------------------------------------------------------------------- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="number"],
textarea,
select {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--bt-ink);
  background: var(--bt-white);
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 4px;
  padding: 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

input:hover,
textarea:hover,
select:hover {
  border-color: rgba(0, 0, 0, 0.28);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--bt-blue);
  box-shadow: 0 0 0 3px rgba(2, 92, 189, 0.14);
  background: var(--bt-white);
}

input::placeholder,
textarea::placeholder {
  color: var(--bt-gray);
  opacity: 1;
}

/* Disabled inputs */
input[disabled],
textarea[disabled],
select[disabled] {
  background: var(--bt-paper);
  color: var(--bt-gray);
  cursor: not-allowed;
}

/* Required field marker */
.bt-form-required::after {
  content: ' *';
  color: var(--bt-blue);
  font-weight: 500;
}

/* Form labels */
.bt-form-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bt-gray);
  font-weight: 600;
  margin-bottom: 8px;
}

/* Newsletter input on dark footer — polish */
.bt-footer input[type="email"] {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--bt-white);
}
.bt-footer input[type="email"]::placeholder {
  color: rgba(255, 255, 255, 0.45);
}
.bt-footer input[type="email"]:hover {
  border-color: rgba(255, 255, 255, 0.32);
}
.bt-footer input[type="email"]:focus {
  border-color: var(--bt-blue-bright);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}

/* --------------------------------------------------------------------------
   6. SCROLLBAR POLISH — desktop only, branded thin scrollbar.
   -------------------------------------------------------------------------- */
@media (min-width: 769px) {
  /* Webkit */
  ::-webkit-scrollbar { width: 12px; height: 12px; }
  ::-webkit-scrollbar-track { background: var(--bt-paper); }
  ::-webkit-scrollbar-thumb {
    background: rgba(2, 92, 189, 0.24);
    border-radius: 100px;
    border: 3px solid var(--bt-paper);
  }
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(2, 92, 189, 0.42);
  }
  /* Firefox */
  html {
    scrollbar-width: thin;
    scrollbar-color: rgba(2, 92, 189, 0.32) var(--bt-paper);
  }
}

/* --------------------------------------------------------------------------
   7. SELECTION COLOR — branded text selection.
   -------------------------------------------------------------------------- */
::selection {
  background: rgba(2, 92, 189, 0.85);
  color: #FFFFFF;
}
::-moz-selection {
  background: rgba(2, 92, 189, 0.85);
  color: #FFFFFF;
}

/* --------------------------------------------------------------------------
   8. SMOOTH SCROLLING — anchor links glide instead of jumping.
   -------------------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 120px;  /* Account for sticky ticker + nav */
  scroll-padding-top: calc(120px + env(safe-area-inset-top, 0px));
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* --------------------------------------------------------------------------
   9. DETAILS / SUMMARY — used in FAQ. Polish the open/close.
   -------------------------------------------------------------------------- */
details summary {
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
details summary::-webkit-details-marker { display: none; }

/* Pulse the chevron on hover */
.bt-faq-q .bt-faq-chevron,
details summary svg.chevron {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
details[open] summary svg.chevron,
details[open] .bt-faq-q .bt-faq-chevron {
  transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   10. SKIP LINK — was hidden, now properly styled when focused.
   -------------------------------------------------------------------------- */
.bt-skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  z-index: 9999;
  padding: 12px 20px;
  background: var(--bt-blue);
  color: var(--bt-white);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 4px;
  transition: top 0.2s ease;
}
.bt-skip-link:focus,
.bt-skip-link:focus-visible {
  top: 8px;
}

/* --------------------------------------------------------------------------
   11. NAV — refined hover and active states.
   -------------------------------------------------------------------------- */
.bt-nav-link {
  position: relative;
  transition: color 0.18s ease;
}
.bt-nav-link::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -4px;
  height: 2px;
  width: 0;
  background: var(--bt-blue);
  transform: translateX(-50%);
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.bt-nav-link:hover::after,
.bt-nav-link.active::after,
.bt-nav-link[aria-current="page"]::after {
  width: 22px;
}
.bt-nav.bt-nav-dark .bt-nav-link::after {
  background: var(--bt-blue-bright);
}

/* --------------------------------------------------------------------------
   12. ENHANCED MOBILE MENU TRANSITIONS
   -------------------------------------------------------------------------- */
.bt-nav-mobile {
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.bt-nav-mobile-inner {
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.bt-nav-mobile:not(.is-open) .bt-nav-mobile-inner {
  transform: translateY(-12px);
}

/* --------------------------------------------------------------------------
   13. TOOLTIP / GLOSSARY POLISH
   -------------------------------------------------------------------------- */
[data-glossary] {
  border-bottom: 1px dashed rgba(2, 92, 189, 0.45);
  cursor: help;
  transition: border-bottom-color 0.18s ease, color 0.18s ease;
}
[data-glossary]:hover {
  border-bottom-color: var(--bt-blue);
  color: var(--bt-blue);
}
.bt-section.dark [data-glossary],
.bt-section.deep [data-glossary],
.bt-cta-band [data-glossary],
.bt-article-hero [data-glossary] {
  border-bottom-color: rgba(14, 165, 233, 0.55);
}
.bt-section.dark [data-glossary]:hover,
.bt-section.deep [data-glossary]:hover,
.bt-cta-band [data-glossary]:hover,
.bt-article-hero [data-glossary]:hover {
  border-bottom-color: var(--bt-blue-bright);
  color: var(--bt-blue-bright);
}

/* --------------------------------------------------------------------------
   14. SECTION REVEAL TRANSITIONS — softer easing
   -------------------------------------------------------------------------- */
.bt-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.bt-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .bt-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   15. INSIGHT/ARTICLE BLOCKQUOTE — premium pull-quote treatment
   -------------------------------------------------------------------------- */
.bt-article-body blockquote {
  position: relative;
  font-family: var(--serif);
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.45;
  color: var(--bt-blue-deep);
  margin: 56px 0;
  padding: 8px 0 8px 32px;
  border-left: 3px solid var(--bt-blue);
  font-style: italic;
}
.bt-article-body blockquote::before {
  content: '"';
  position: absolute;
  left: 16px;
  top: -20px;
  font-size: 80px;
  line-height: 1;
  color: rgba(2, 92, 189, 0.18);
  font-family: var(--serif);
  font-style: italic;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   16. INSIGHT ARTICLE BODY — improved readability
   -------------------------------------------------------------------------- */
.bt-article-body p {
  margin: 22px 0;
}
.bt-article-body p:first-of-type::first-letter {
  font-family: var(--serif);
  font-size: 4em;
  font-weight: 400;
  float: left;
  line-height: 0.85;
  margin: 6px 8px -2px 0;
  color: var(--bt-blue-deep);
}
.bt-article-body h2 {
  margin: 56px 0 20px;
  font-family: var(--serif);
  font-size: clamp(28px, 3.5vw, 38px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--bt-blue-ink);
}
.bt-article-body h2 em {
  color: var(--bt-blue);
  font-style: italic;
}
.bt-article-body strong {
  color: var(--bt-blue-deep);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   17. STAT NUMBERS — tabular alignment everywhere
   -------------------------------------------------------------------------- */
[class*="stat-val"],
[class*="stat-num"],
[class*="-num"],
[class*="-amt"],
.bt-data-table td:not(:first-child),
.bt-ticker-price {
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  font-variant-numeric: tabular-nums lining-nums;
}

/* --------------------------------------------------------------------------
   18. IMAGE LOAD POLISH — fade-in to avoid pop
   -------------------------------------------------------------------------- */
img[loading="lazy"] {
  transition: opacity 0.4s ease;
}
img[loading="lazy"]:not([data-loaded]) {
  opacity: 0;
}
img[loading="lazy"][data-loaded] {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   19. TICKER FADE EDGES — visual polish at the stream boundaries
   -------------------------------------------------------------------------- */
.bt-ticker-stream::before,
.bt-ticker-stream::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  z-index: 2;
  pointer-events: none;
}
.bt-ticker-stream::before {
  left: 0;
  background: linear-gradient(90deg, var(--bt-blue-ink) 0%, transparent 100%);
}
.bt-ticker-stream::after {
  right: 0;
  background: linear-gradient(90deg, transparent 0%, var(--bt-blue-ink) 100%);
}

/* --------------------------------------------------------------------------
   20. ACCESSIBLE MOTION REDUCTION
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   21. FY1 NAV CHART — interactive polish
   -------------------------------------------------------------------------- */
.bt-fy1-chart-frame {
  transition: box-shadow 0.3s ease;
}
.bt-fy1-chart-frame:hover {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

/* --------------------------------------------------------------------------
   22. CREDIBILITY RAIL CARDS — subtle hover treatment
   -------------------------------------------------------------------------- */
.bt-cred-rail > div {
  transition:
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.bt-cred-rail > div:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(1, 47, 107, 0.08);
  border-color: rgba(2, 92, 189, 0.18);
}

/* --------------------------------------------------------------------------
   23. CTA BAND BUTTONS — slightly larger touch targets
   -------------------------------------------------------------------------- */
.bt-cta-band .bt-btn {
  padding: 16px 28px;
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   24. TABLE POLISH — stripe and hover for data tables
   -------------------------------------------------------------------------- */
.bt-data-table {
  border-collapse: collapse;
  width: 100%;
}
.bt-data-table tbody tr {
  transition: background-color 0.15s ease;
}
.bt-data-table tbody tr:nth-child(even) {
  background: rgba(2, 92, 189, 0.025);
}
.bt-data-table tbody tr:hover {
  background: rgba(2, 92, 189, 0.06);
}
.bt-data-table th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bt-gray);
  font-weight: 600;
  padding: 14px 16px;
  border-bottom: 2px solid var(--bt-ink);
  text-align: left;
}
.bt-data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* --------------------------------------------------------------------------
   25. OFFERING CARDS — refined tag pills + cta arrow
   -------------------------------------------------------------------------- */
.bt-offering-card-cta {
  position: relative;
  padding-right: 20px;
  transition: color 0.2s ease;
}
.bt-offering-card-cta svg {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.bt-offering-card:hover .bt-offering-card-cta {
  color: var(--bt-blue);
}
.bt-offering-card:hover .bt-offering-card-cta svg {
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   26. STATUS DOT PULSE — subtle live indicator
   -------------------------------------------------------------------------- */
.bt-status-dot.ok {
  position: relative;
}
.bt-status-dot.ok::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: bt-status-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes bt-status-pulse {
  0%   { transform: scale(1);   opacity: 0.55; }
  100% { transform: scale(2.2); opacity: 0;    }
}
@media (prefers-reduced-motion: reduce) {
  .bt-status-dot.ok::after { animation: none; }
}

/* --------------------------------------------------------------------------
   27. STICKY CTA — softer, more polished
   -------------------------------------------------------------------------- */
.bt-sticky-mobile-cta {
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
  transition:
    transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.32s ease;
}
.bt-sticky-mobile-cta:not(.is-visible) {
  transform: translateY(100%);
}

/* --------------------------------------------------------------------------
   28. PAGE TRANSITIONS — fade-in on load
   -------------------------------------------------------------------------- */
body {
  animation: bt-page-fade-in 0.4s ease-out;
}
@keyframes bt-page-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
}

/* --------------------------------------------------------------------------
   29. ARTICLE END CTA POLISH
   -------------------------------------------------------------------------- */
.bt-article-end-cta {
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.bt-article-end-cta:hover {
  box-shadow: 0 12px 32px rgba(2, 92, 189, 0.10);
  border-color: var(--bt-blue);
}

/* --------------------------------------------------------------------------
   30. PRINT STYLES — clean print output for any page that gets printed
   -------------------------------------------------------------------------- */
@media print {
  .bt-ticker, .bt-nav, .bt-nav-mobile,
  .bt-sticky-mobile-cta, .bt-cta-band-ctas,
  .bt-footer-bottom-right, video, canvas,
  .bt-wcg, .bt-status-strip {
    display: none !important;
  }
  body {
    color: #000;
    background: #FFF;
  }
  a {
    color: #000;
    text-decoration: underline;
  }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #444;
  }
}
