/* ==========================================================================
   FIAE phone & tablet fixes
   Loaded by the plugin after every page's own styles, so these rules win.
   ========================================================================== */

/* --- Nothing may widen the page sideways ------------------------------- */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

@supports (overflow: clip) {
  html,
  body {
    overflow-x: clip; /* like hidden, but keeps the sticky header working */
  }
}

/* Decorative glows in the page headers are 600-700px wide */
.page-hero,
.hero-section {
  overflow: hidden;
}

/* Grid and flex columns may shrink below the width of their content
   (long words, tables, embeds), instead of pushing the page wider */
.moot-main-grid > *,
.summit-main-grid > *,
.news-main-grid > *,
.courses-main-grid > *,
.post-layout-grid > *,
.podcast-grid > *,
.pub-grid > *,
.scholar-grid > *,
.webinar-grid > *,
.unit-card-grid > *,
.contact-main-grid > *,
.hero-grid > *,
.units-grid > *,
.programs-grid > * {
  min-width: 0;
}

img,
video,
iframe,
embed,
object {
  max-width: 100%;
}

/* Wide tables scroll inside their own box */
.schedule-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* --- Tablet ------------------------------------------------------------- */
@media (max-width: 1024px) {
  .units-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Phone -------------------------------------------------------------- */
@media (max-width: 768px) {
  .units-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  /* Compact announcement bar */
  .topbar {
    padding: 7px 0;
    font-size: 0.8rem;
    line-height: 1.4;
  }
  .topbar-content {
    gap: 2px 10px;
    text-align: center;
  }
  .topbar .badge {
    display: none;
  }

  /* Shorter header */
  .nav-container {
    height: 68px;
  }
  .brand-logo {
    gap: 10px;
    min-width: 0;
  }
  .logo-img-wrap {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
  }
  .brand-name {
    font-size: 1.15rem;
  }
  .brand-sub {
    font-size: 0.66rem;
    line-height: 1.25;
    max-width: 180px;
  }
  .nav-actions {
    gap: 2px;
    flex-shrink: 0;
  }

  /* Sticky filter bars sit right under the shorter header */
  .prog-filter-sticky,
  .units-subnav-sticky {
    top: 68px;
  }

  /* Mobile menu (opened by the menu button) */
  .site-header.nav-open .nav-menu {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
    border-top: 1px solid var(--border-light);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.14);
    padding: 4px 20px 16px;
    z-index: 1100;
  }
  .nav-menu .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .nav-menu .nav-item {
    border-bottom: 1px solid var(--border-light);
  }
  .nav-menu .nav-item:last-child {
    border-bottom: none;
  }
  .nav-menu .nav-link {
    justify-content: space-between;
    padding: 14px 0;
    font-size: 1.02rem;
  }

  /* Dropdowns open by tap (class "open"), not by hover */
  .nav-menu .dropdown-panel,
  .nav-menu .dropdown-menu,
  .nav-menu .units-dropdown-panel {
    display: none;
    position: static;
    width: auto;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    padding: 0 0 10px;
  }
  .nav-menu .nav-item.dropdown.open .dropdown-panel,
  .nav-menu .nav-item.dropdown.open .dropdown-menu {
    display: block;
  }
  .nav-menu .nav-item.dropdown.open .dropdown-icon {
    transform: rotate(180deg);
  }
  .nav-menu .dropdown-item {
    padding: 10px 8px;
  }

  /* Comfortable spacing and sizes on small screens */
  .page-hero {
    padding-top: 56px;
    padding-bottom: 52px;
  }
  .hero-section {
    padding-top: 48px;
    padding-bottom: 64px;
  }
  .cta-box {
    padding: 28px 20px;
  }
}

@media (max-width: 340px) {
  .brand-sub {
    display: none;
  }
}
