/* ==========================================================================
   Shared component styles (components.css)
   --------------------------------------------------------------------------
   Site header (Ticker bar + Nav + off-canvas drawer/scrim) and Footer.
   Pairs with the <site-header>/<site-footer> elements in assets/js/components.js.
   Depends on the :root variables and the .btn-pill base class from base.css — must be loaded AFTER base.css.
   Breakpoints: desktop 1081–1920, mobile <1080.
   ========================================================================== */

/* The custom-element shell produces no box, preserving the original layout and the sticky containing block (= body) */
site-header,
site-footer {
  display: contents;
}

/* ==========================================================================
   Top ticker bar (ticker)
   ========================================================================== */
.ticker {
  background: var(--dark-3);
  height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.ticker-inner {
  width: min(var(--wide), 100% - 48px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 40px;
  font-size: 14px;
  white-space: nowrap;
  justify-content: space-between;
}

.tk {
  display: inline-flex;
  align-items: center;
  gap: clamp(7px, 0.63vw, 12px);
}

.tk .sym {
  color: var(--t-400);
}

.tk .val {
  color: #fff;
  font-weight: 700;
}

.tk .chg.up {
  color: var(--up);
}

.tk .chg.down {
  color: var(--down);
}

/* Marquee duplicate set: hidden on desktop, shown only for the mobile auto-scroll */
.tk-clone {
  display: none;
}

@keyframes ticker-marquee {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

/* ==========================================================================
   Navigation header
   ========================================================================== */
.nav {
  background: var(--dark-2);
  position: relative;
  z-index: 2;
}

/* Sticky nav: hide on scroll down, show on scroll up */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform .35s ease;
  will-change: transform;
}

.site-header.nav--hidden {
  transform: translateY(-100%);
}

.nav-inner {
  width: min(var(--wide), 100% - 48px);
  margin-inline: auto;
  height: 86px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand .globe {
  width: 37px;
  height: 37px;
  object-fit: contain;
}

.brand .name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.brand .divider {
  width: 1px;
  height: 34px;
  background: rgba(255, 255, 255, .25);
  margin: 0 4px;
}

.brand .sub {
  font-size: 16px;
  color: var(--t-300);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28.93px;
  margin-left: 43px;
  font-size: 16px;
  flex: 1;
}

.nav-links a {
  color: var(--t-300);
  position: relative;
  padding: 6px 0;
  transition: color .15s;
  white-space: nowrap;
}

.nav-links a:hover {
  color: #fff;
}

.nav-links a.active {
  color: var(--orange);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -28px;
  width: 80px;
  height: 4px;
  background: var(--orange);
}

/* Top-level item with a submenu: the trigger itself is not a link, hovering (desktop)
   or tapping (mobile) reveals .nav-dropdown instead of navigating. */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--t-300);
  position: relative;
  padding: 6px 0;
  cursor: pointer;
  transition: color .15s;
  white-space: nowrap;
  user-select: none;
}

.nav-item:hover .nav-trigger {
  color: #fff;
}

.nav-trigger.active {
  color: var(--orange);
}

.nav-trigger.active::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -28px;
  width: 80px;
  height: 4px;
  background: var(--orange);
}

.nav-caret {
  width: 0;
  height: 0;
  margin-top: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: .6;
  transition: transform .2s;
}

.nav-item:hover .nav-caret,
.nav-item.open .nav-caret {
  transform: rotate(180deg);
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  min-width: 150px;
  margin-top: 10px;
  background: var(--dark-2);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 4px);
  transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
  z-index: 50;
}

.nav-item:hover .nav-dropdown,
.nav-item.open .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity .15s ease, transform .15s ease, visibility 0s;
}

.nav-dropdown a {
  display: block;
  padding: 10px 20px;
  font-size: 15px;
  color: var(--t-300);
  white-space: nowrap;
  transition: color .15s, background-color .15s;
}

.nav-dropdown a:hover {
  color: #fff;
  background: rgba(255, 255, 255, .06);
}

.nav-dropdown a.active {
  color: var(--orange);
}

/* .nav-links a.active::after's absolute underline is meant for the top-level bar;
   suppress it here since .nav-dropdown is nested inside .nav-links */
.nav-dropdown a.active::after {
  display: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.nav-actions .btn-login {
  background: var(--orange);
  color: #000;
  padding: 10px;
  min-width: 80px;
  height: 42px;
  font-size: 16px;
}

.nav-actions .btn-open {
  border: 1px solid var(--orange);
  color: var(--orange);
  padding: 10px;
  min-width: 112px;
  height: 42px;
  font-size: 16px;
}

/* Mobile hamburger button */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  transition: .25s;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  height: 100%;
  background: #000;
  color: #fff;
  overflow: hidden;
}

.footer-inner {
  width: min(1196px, 100% - 48px);
  margin-inline: auto;
  padding: 98px 0 0;
}

.footer-cols {
  display: flex;
  justify-content: flex-start;
  gap: 114px;
  padding-bottom: 50px;
}

.footer-about {
  flex: 0 0 400px;
  max-width: 400px;
}

.footer-col {
  flex: 0 0 176px;
}

.footer-about h3 {
  font-size: 20px;
  font-weight: 700;
  line-height: 32px;
  letter-spacing: 1px;
  margin-bottom: 24.22px;
}

.footer-about p {
  font-size: 14px;
  line-height: 1.625;
  color: rgba(255, 255, 255, .4);
}

.footer-col h4 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .4);
  margin-bottom: 32px;
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-col a {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  transition: color .15s;
}

.footer-col a:hover {
  color: var(--orange);
}

.footer-bottom {
  width: 1200px;
  margin-left: -2px;
  border-top: 1px solid rgba(255, 255, 255, .2);
  padding: 35px 0 143px;
  text-align: center;
}

.footer-bottom p {
  font-size: 12px;
  letter-spacing: 1px;
  line-height: 1.25;
  color: rgba(255, 255, 255, .4);
}

.footer-risk,
.footer-copy {
  max-width: 774px;
  margin-inline: auto;
}

/* ==========================================================================
   Responsive — mobile (<1080): ticker bar / nav off-canvas drawer / footer
   ========================================================================== */
@media (max-width: 1080px) {
  .ticker {
    height: 8.3333vw;
    min-height: 32px;
    max-height: 90px;
  }

  /* Mobile: slow auto-scrolling marquee. The duplicate set (.tk-clone) makes the
     translateX(-50%) loop seamless; spacing uses margin (not gap) so -50% lands
     exactly one set over. */
  .ticker-inner {
    width: max-content;
    gap: 0;
    font-size: clamp(11px, 2.78vw, 30px);
    justify-content: flex-start;
    animation: ticker-marquee 40s linear infinite;
    will-change: transform;
  }

  .ticker-inner .tk {
    gap: 1.1111vw;
    margin-right: clamp(28px, 7.41vw, 80px);
  }

  .ticker-inner .tk-clone {
    display: inline-flex;
  }

  @media (prefers-reduced-motion: reduce) {
    .ticker-inner {
      animation: none;
    }
  }

  .nav-inner {
    width: calc(100% - 40px);
    height: 13.8889vw;
    min-height: 54px;
    max-height: 150px;
    gap: 2.2222vw;
  }

  .brand {
    gap: 1.4815vw;
  }

  .brand .globe {
    width: 7.037vw;
    height: 6.9444vw;
    min-width: 29px;
    min-height: 29px;
  }

  .brand .name {
    font-size: clamp(11px, 2.59vw, 28px);
  }

  .brand .divider {
    display: block;
    width: 1px;
    height: 4.2593vw;
    background: rgba(255, 255, 255, .30);
    margin: 0 0.7407vw;
  }

  .brand .sub {
    font-size: clamp(10px, 2.59vw, 28px);
    color: var(--t-300);
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    width: 78%;
    max-width: 360px;
    height: 100vh;
    background: var(--dark-2);
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 84px 28px 28px;
    margin: 0;
    z-index: 200;
    /* Pushed off-canvas via transform (only overflows at <=360px, already clipped by the root overflow-x:clip);
       visibility:hidden makes it unfocusable / out of Tab order when closed, hidden only after the slide-out animation finishes */
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .3s ease, visibility 0s linear .3s;
    box-shadow: -8px 0 30px rgba(0, 0, 0, .4);
    box-sizing: border-box;
    /* An expanded submenu accordion can push total content past 100vh: scroll the
       drawer itself instead of letting it overflow past the fixed-position box */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-links.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform .3s ease, visibility 0s;
  }

  .nav-links a {
    font-size: clamp(15px, 4.44vw, 18px);
    padding: 14px 0;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
  }

  .nav-links a.active::after {
    display: none;
  }

  .nav-links a.active {
    color: var(--orange);
  }

  /* Submenu becomes an inline accordion inside the off-canvas drawer (tap to expand) */
  .nav-item {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .nav-trigger {
    width: 100%;
    font-size: clamp(15px, 4.44vw, 18px);
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    justify-content: space-between;
  }

  .nav-trigger.active::after {
    display: none;
  }

  .nav-caret {
    margin-top: 0;
  }

  .nav-dropdown {
    position: static;
    transform: none;
    margin-top: 0;
    opacity: 1;
    visibility: visible;
    background: rgba(255, 255, 255, .04);
    border: none;
    box-shadow: none;
    border-radius: 0;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    transition: max-height .3s ease;
  }

  .nav-item.open .nav-dropdown {
    /* The desktop hover/open rule (.nav-item.open .nav-dropdown, 3 classes) outranks the
       plain .nav-dropdown reset above (1 class) regardless of this media query, so transform
       must be re-reset at the same specificity here or the desktop translateX(-50%) centering
       reasserts itself and shifts the accordion off-screen to the left. */
    transform: none;
    max-height: 400px;
    padding: 4px 0 8px;
  }

  .nav-dropdown a {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 0 12px 16px;
    font-size: clamp(14px, 4vw, 17px);
    text-align: left;
    white-space: normal;
    word-break: break-word;
    border-bottom: none;
  }

  .nav-actions {
    display: none;
  }

  .nav-toggle {
    display: flex;
    position: relative;
    /* Make z-index take effect: the X close button floats above the drawer panel */
    z-index: 201;
    width: 5.9259vw;
    height: 5.9259vw;
    min-width: 32px;
    min-height: 32px;
  }

  .nav-toggle span {
    width: 4.0741vw;
    min-width: 22px;
    height: 2px;
  }

  .nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* The scrim sits below the .site-header (z=100) stacking context: it only dims the page content,
     while the drawer panel (z=200) and close button (z=201) float above it and remain clickable/navigable */
  .nav-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
  }

  .nav-scrim.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Mobile footer: keep only the brand blurb, centered (matching the mobile design) */
  .footer {
    height: 100%;
    overflow: hidden;
  }

  .footer-inner {
    width: calc(100% - 30px);
    height: 100%;
    padding-top: clamp(34px, 9.17vw, 99px);
    padding-bottom: clamp(25px, 6.67vw, 72px);
    box-sizing: border-box;
    position: relative;
  }

  .footer-cols {
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding-bottom: clamp(19px, 5.19vw, 56px);
  }

  .footer-col {
    display: none;
  }

  .footer-about {
    flex-basis: auto;
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
  }

  .footer-about h3 {
    font-size: clamp(11px, 2.96vw, 32px);
    line-height: 1.4;
    margin-bottom: clamp(27px, 7.13vw, 77px);
    letter-spacing: 0;
  }

  .footer-about p,
  .footer-bottom p {
    font-size: clamp(8px, 2.22vw, 24px);
    line-height: 1.55;
    letter-spacing: 0;
  }

  .footer-about p {
    max-width: 88.6111vw;
    margin-inline: auto;
  }

  .footer-bottom {
    position: relative;
    width: 100%;
    margin-left: 0;
    border-top: 0;
    padding: 0 0 0;
  }

  .footer-bottom::before {
    content: "";
    position: absolute;
    left: 2.2222vw;
    right: 0.4815vw;
    top: 13.8vw;
    height: 1px;
    background: #898989;
  }

  .footer-risk {
    max-width: 86.5741vw;
  }

  .footer-copy {
    margin-top: 10.4vw;
  }
}

/* Very narrow screens (<=380): hide the brand subtitle */
@media (max-width: 380px) {
  .brand .sub {
    display: none;
  }
}

/* Narrow desktop (1081–1400): tighten the nav to avoid 7 menu items + brand + buttons overflowing */
@media (min-width: 1081px) and (max-width: 1400px) {
  .nav-links {
    gap: 24px;
    margin-left: 32px;
  }

  .nav-actions {
    gap: 10px;
  }
}

@media (min-width: 1081px) {

  .brand,
  .nav-actions {
    transform: translateY(-1px);
  }
}

@media (min-width: 1081px) and (max-width: 1280px) {

  .brand .divider,
  .brand .sub {
    display: none;
  }

  .nav-links {
    gap: 50.27px;
    margin-left: 24px;
    font-size: 15px;
  }

  .nav-actions .btn-login {
    min-width: 72px;
  }

  .nav-actions .btn-open {
    min-width: 92px;
  }

  .ticker-inner {
    gap: 28px;
  }
}