/* ============================================================
   Charles Tillman Cornerstone Foundation - mobile responsive layer
   Loaded LAST in <head> (Site.master + standalone index.aspx).
   Desktop (>900px) untouched except hiding the mobile-only elements.
   Theme: navy #012548 / #003569, orange accent #FB900E.
   ============================================================ */

/* ---- mobile-only elements: hidden on desktop ---- */
#ctHamburger { display: none; }
#ctMobileNav { display: none; }
#ctNavBackdrop { display: none; }
#ctMobileHero { display: none; }

@media screen and (max-width: 900px) {

  /* ---------- fluid chrome ---------- */
  html, body { overflow-x: hidden; }
  .headerRow, .converterRow, .contentTable, .contentTableFull { width: 100% !important; }
  .header, .headerHeight, .headerRow { height: auto !important; }
  .header td { padding: 8px 10px !important; }
  .converter { position: relative; height: auto !important; min-height: 56px; }
  .converterRow, .converterHeight { height: auto !important; }
  .converterRow td { padding: 8px 10px !important; }
  #imgBannerLogo { max-width: 220px; height: auto; }

  /* hide the desktop CMS menu and its unwired burger overlay */
  #mbmcpebul_table, [id^="mbmcpebul_table_burger"] { display: none !important; }

  /* ---------- fluid content ---------- */
  .bigTable img { max-width: 100%; height: auto !important; }
  /* viewport units, not % - inside auto-layout tables a % width is circular
     against a cell that sizes itself from the embed, so it has no effect */
  .bigTable iframe, .bigTable embed, .bigTable object, .bigTable video {
    width: calc(100vw - 44px) !important; max-width: calc(100vw - 44px) !important;
  }
  .bigTable iframe[src*="youtube"], .bigTable iframe[src*="youtu.be"], .bigTable iframe[src*="vimeo"] {
    height: auto !important; aspect-ratio: 16 / 9;
  }
  .bigTable [style*="width:"] { max-width: 100% !important; }
  .bigTable table[style*="width:"] { width: 100% !important; }
  .bigTable div[style*="width: 1200px"] { width: 100% !important; }
  .bigTable table[width], .bigTable td[width] { max-width: 100% !important; }
  .contentTable, .contentTableFull { table-layout: auto; }
  .contentTable td, .contentTableFull td { word-wrap: break-word; }
  .homeCell, .footerCell { padding-left: 12px !important; padding-right: 12px !important; }

  h1 { font-size: 30px !important; line-height: 1.15 !important; }
  h2 { font-size: 22px !important; line-height: 1.2 !important; }

  /* Headings built as spans/divs with an inline font-size inherit the fixed
     body line-height, so once they wrap the lines overlap. Give oversized
     ones a proportional line-height and cap the largest so they still fit. */
  .bigTable [style*="font-size: 60px"],
  .bigTable [style*="font-size: 50px"],
  .bigTable [style*="font-size: 48px"] { font-size: 32px !important; line-height: 1.15 !important; }
  .bigTable [style*="font-size: 40px"],
  .bigTable [style*="font-size: 36px"] { font-size: 28px !important; line-height: 1.15 !important; }
  .bigTable [style*="font-size: 30px"],
  .bigTable [style*="font-size: 25px"],
  .bigTable [style*="font-size: 24px"] { line-height: 1.25 !important; }

  /* ---------- slideshow: LayerSlider is responsive:false ---------- */
  #layerslider-container-fw { display: none !important; }
  .slideshowRow { height: auto !important; }
  #ctMobileHero { display: block; }
  #ctMobileHero img { width: 100%; height: auto; display: block; }

  .subFooter1Row, .subFooter2Row { height: auto !important; }
}

@media screen and (max-width: 700px) {
  /* stack multi-column content tables */
  .contentTable table, .contentTable tbody, .contentTable tr, .contentTable td {
    display: block; width: 100% !important; box-sizing: border-box;
  }
  .contentTable td[width="25%"], .contentTable td[width="33%"], .contentTable td[width="50%"] {
    display: block; width: 100% !important;
  }
  /* board roster table: stacked rows need breathing room */
  .contentTable td[style*="background-color: #cccccc"],
  .contentTable td[style*="background-color: #d57f17"] { padding: 8px 12px !important; }

  /* once cells stack they keep their default left alignment, stranding
     fixed-width image tiles; center cells whose only content is an image */
  .contentTable td > a:only-child > img:only-child,
  .contentTable td > img:only-child,
  .contentTableFull td > a:only-child > img:only-child,
  .contentTableFull td > img:only-child {
    display: block; margin-left: auto; margin-right: auto;
  }

  h1 { font-size: 26px !important; }
  /* photo gallery thumbs: 2 per row */
  #vlightbox1 img, .photo-gallery img { width: 46vw !important; height: auto !important; margin: 4px; }
}

/* ============================================================
   Mobile menu (hamburger + slide-in panel + backdrop)
   ============================================================ */
@media screen and (max-width: 900px) {
  #ctHamburger {
    display: block; position: absolute; top: 50%; right: 14px;
    transform: translateY(-50%);
    width: 44px; height: 40px; padding: 8px 9px;
    background: transparent; border: 2px solid #FB900E; border-radius: 6px;
    cursor: pointer; z-index: 10010;
  }
  #ctHamburger span {
    display: block; height: 3px; width: 100%; background: #ffffff;
    border-radius: 2px; margin: 4px 0;
  }
  #ctNavBackdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 10020;
  }
  #ctNavBackdrop.show { opacity: 1; pointer-events: auto; }
  #ctMobileNav {
    display: block; position: fixed; top: 0; right: 0; bottom: 0;
    width: 290px; max-width: 85vw; background: #012548;
    border-left: 4px solid #FB900E;
    transform: translateX(102%); transition: transform .28s ease;
    z-index: 10030; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 18px 0 30px 0; box-sizing: border-box;
  }
  #ctMobileNav.open { transform: translateX(0); }
  #ctMobileNav .ct-nav-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px 14px 18px; border-bottom: 1px solid #16406b;
  }
  #ctMobileNav .ct-nav-head img { width: 130px; height: auto; }
  #ctMobileNav .ct-nav-close {
    background: none; border: 0; color: #ffffff; font-size: 30px;
    line-height: 1; cursor: pointer; padding: 4px 8px;
  }
  #ctMobileNav a.ct-link {
    display: block; padding: 14px 22px; color: #ffffff; text-decoration: none;
    font-family: Arial, Helvetica, sans-serif; font-size: 15px; font-weight: bold;
    letter-spacing: 1px; text-transform: uppercase;
    border-bottom: 1px solid #16406b;
  }
  #ctMobileNav a.ct-link:hover, #ctMobileNav a.ct-link:active { background: #023a6b; color: #FB900E; }
  #ctMobileNav .ct-group {
    padding: 14px 22px 6px 22px; color: #FB900E;
    font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold;
    letter-spacing: 1.5px; text-transform: uppercase;
  }
  #ctMobileNav a.ct-sub {
    display: block; padding: 9px 22px 9px 34px; color: #cfd9e4; text-decoration: none;
    font-family: Arial, Helvetica, sans-serif; font-size: 13px; letter-spacing: .4px;
  }
  #ctMobileNav a.ct-sub:hover, #ctMobileNav a.ct-sub:active { color: #FB900E; }
  #ctMobileNav .ct-more {
    display: block; width: calc(100% - 44px); margin: 4px 22px 0; padding: 8px 0;
    background: none; border: 0; color: #FB900E; text-align: left; cursor: pointer;
    font-family: Arial, Helvetica, sans-serif; font-size: 12px; letter-spacing: 1px;
    text-transform: uppercase;
  }
  /* must out-specify "#ctMobileNav a.ct-sub { display:block }" above */
  #ctMobileNav a.ct-sub.ct-collapsed { display: none !important; }
  #ctMobileNav .ct-nav-cta { padding: 18px 22px 6px 22px; text-align: center; }
  #ctMobileNav .ct-nav-cta a {
    display: block; padding: 12px 10px; border-radius: 4px; background: #FB900E;
    color: #012548; font-family: Arial, Helvetica, sans-serif; font-size: 14px;
    font-weight: bold; letter-spacing: 1px; text-decoration: none; text-transform: uppercase;
  }
  body.ct-nav-open { overflow: hidden; }
}
