/* ==========================================================================
   Responsive layer – PRL Stock & Share Brokers  (loaded last, after accessibility.css)
   Breakpoints: <=1199.98px hamburger menu (tablet + phone), <=991.98px tablet,
                <=767.98px large phone, <=575.98px phone
   ========================================================================== */

/* ---------- Base: nothing may be wider than the screen ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
img, video, svg, iframe, embed, object { max-width: 100%; }
img { height: auto; }
.fit-image, .full-image { max-width: none; }          /* theme images that are meant to cover their box */
table { max-width: 100%; }
p, li, td, th, h1, h2, h3, h4, h5, h6, a { overflow-wrap: break-word; }

/* ---------- Menu button (hidden on desktop) ---------- */
.nav-toggle { display: none; }

/* ---------- Top toolbar + search: compact, left aligned ---------- */
.a11y-toolbar { padding: .2rem 1rem; }
.a11y-search { justify-content: flex-start; gap: .4rem .75rem; padding: .4rem 1rem; }
.a11y-search input[type="search"] { min-width: 0; flex: 1 1 12rem; max-width: 28rem; }

/* Header is part of the page flow (the theme overlays it on the hero) */
header .navbar-expand { position: relative !important; }
header#header { position: relative; z-index: 1030; }

/* ---------- Desktop header (>=1200px): tidy wrap ---------- */
@media (min-width: 1200px) {
  header .navbar-expand .header { max-width: 1400px; margin: 0 auto; flex-wrap: nowrap; }
  header .navbar-expand .navbar-brand { flex: 0 0 auto; }
  header .navbar-expand .navbar-brand img { width: 260px; max-width: 100%; }
  header .navbar-expand .navbar-nav.items { flex: 1 1 auto; }
}

/* ---------- Hamburger layout (tablet + phone) ---------- */
@media (max-width: 1199.98px) {

  html.js-nav header#header { position: sticky; top: 0; z-index: 1030; }

  header .navbar-expand {
    position: relative !important;
    padding: 0 !important;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
  }
  header .navbar-expand .header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    padding: .4rem .75rem;
    width: 100%;
    max-width: 100%;
  }
  header .navbar-expand .navbar-brand {
    flex: 0 1 auto;
    min-width: 0;
    margin: 0;
    padding: .25rem 0;
  }
  header .navbar-expand .navbar-brand img {
    width: min(240px, 58vw);
    max-width: 100%;
    max-height: none;
    height: auto;
  }

  /* the button */
  html.js-nav .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
    padding: .35rem .8rem;
    color: #102b45;
    background: #fff;
    border: 2px solid #102b45;
    border-radius: .4rem;
    font: 700 1rem/1 Arial, sans-serif;
    cursor: pointer;
    touch-action: manipulation;
  }
  html.js-nav .nav-toggle:hover { background: #e8eef5; }
  .nav-toggle__bars { display: inline-block; position: relative; width: 22px; height: 16px; }
  .nav-toggle__bars span {
    position: absolute; left: 0; width: 100%; height: 2px; background: currentColor; border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease, top .2s ease;
  }
  .nav-toggle__bars span:nth-child(1) { top: 0; }
  .nav-toggle__bars span:nth-child(2) { top: 7px; }
  .nav-toggle__bars span:nth-child(3) { top: 14px; }
  nav.is-open .nav-toggle__bars span:nth-child(1) { top: 7px; transform: rotate(45deg); }
  nav.is-open .nav-toggle__bars span:nth-child(2) { opacity: 0; }
  nav.is-open .nav-toggle__bars span:nth-child(3) { top: 7px; transform: rotate(-45deg); }

  /* the menu panel (collapsed until the button is pressed) */
  html.js-nav header .navbar-expand .navbar-nav.items { display: none !important; }
  html.js-nav header .navbar-expand.is-open .navbar-nav.items {
    display: flex !important;
    flex-direction: column;
    flex: 0 0 100%;
    width: 100%;
    margin: .4rem 0 0;
    padding: 0;
    max-height: calc(100vh - 7rem);
    max-height: calc(100dvh - 7rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-top: 2px solid #102b45;
  }
  /* no-JS fallback: show the whole menu as a plain wrapped list */
  header .navbar-expand .navbar-nav.items { flex: 0 0 100%; justify-content: flex-start; }

  header .navbar-expand .navbar-nav.items .nav-item { width: 100%; margin: 0; border-bottom: 1px solid #d5dde6; }
  header .navbar-expand .navbar-nav.items .nav-item:last-child { border-bottom: 0; }
  header .navbar-expand .navbar-nav.items .nav-sep { margin: 0; padding: 0; border-left: 0; border-top: 2px solid #102b45; }
  header .navbar-expand .navbar-nav.items .nav-link {
    display: flex !important;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: .65rem .5rem !important;
    font-size: 1.0625rem;
    line-height: 1.3;
  }
  /* "Client Login" pill has inline styles in the HTML – keep it a full-width button */
  header .navbar-expand .navbar-nav.items .nav-link[style] {
    display: flex !important;
    justify-content: center;
    width: 100%;
    margin: .5rem 0;
    padding: .65rem 1rem !important;
    border-radius: .5rem !important;
  }
}

/* ---------- Tablet and below ---------- */
@media (max-width: 991.98px) {
  html { scroll-padding-top: 5rem; }
  section[style*="margin-top:89px"] { margin-top: 0 !important; }
}

/* ---------- Tables scroll inside their own box instead of widening the page ---------- */
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 1rem; }
.table-scroll > table { margin-bottom: 0; }
.table-scroll:focus-visible { outline-offset: -3px; }
table.tg th, table.tg td { overflow-wrap: anywhere; }
@media (max-width: 767.98px) {
  .table-scroll > table.tg { min-width: 36rem; }
  .table-scroll > table.table { min-width: 28rem; }
}

/* ---------- Flex children may shrink; fixes the long-link advisory block ---------- */
.row > * { min-width: 0; }
.row > div[class^="w-fullmax"] { flex: 0 0 100%; max-width: 100%; width: 100%; padding: 0 15px; }
a { overflow-wrap: anywhere; }

/* ---------- Footer contact column: long e-mail / address text wraps ---------- */
.contacts .navbar-nav { flex-direction: column; min-width: 0; max-width: 100%; }
.contacts .nav-item, .contacts .nav-link { white-space: normal; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 1199.98px) {
  footer .contacts { left: 0; top: 0; }
  footer .contacts::before, footer .contacts::after { display: none; }
}

/* ---------- Fluid headings on phones (no mid-word breaks) ---------- */
@media (max-width: 767.98px) {
  h2.hs1, .hs1 { font-size: clamp(1.75rem, 8vw, 2.5rem) !important; line-height: 1.2; }
  h2.hs3, .hs3 { font-size: clamp(1.5rem, 6.5vw, 2rem) !important; line-height: 1.25; }
  h1.title, h1 { font-size: clamp(1.9rem, 9vw, 3rem) !important; line-height: 1.15; }
  h1, h2, h3 { overflow-wrap: break-word; hyphens: auto; }
}
