/* =========================================================
   Forumly — Responsive Rules
   Breakpoints tested: 320, 375, 390, 414, 768, 1024, 1440+
   ========================================================= */

/* ---------- Tablet and below (<=1024px) ---------- */
@media (max-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .site-footer__inner { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- Small tablet / large phone (<=880px) ---------- */
@media (max-width: 880px) {
  .primary-nav {
    position: absolute;
    top: 76px;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    align-items: stretch;
    padding: 16px 24px 24px;
    display: none;
    box-shadow: var(--shadow-md);
  }
  .primary-nav.is-open { display: flex; }
  .primary-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .primary-nav__list > li { border-bottom: 1px solid var(--color-border); }
  .primary-nav__list > li > a,
  .dropdown-toggle,
  .dropdown-parent-link {
    padding: 14px 0;
    width: 100%;
    justify-content: space-between;
  }
  /* The hub link (e.g. "Services") and the expand toggle both show,
     side by side — tapping the link navigates to the hub page,
     tapping the arrow button expands the submenu below it. */
  .has-dropdown { display: flex; flex-wrap: wrap; align-items: center; }
  .has-dropdown .dropdown-parent-link { display: flex; flex: 1 1 auto; width: auto; }
  .has-dropdown .dropdown-toggle {
    display: flex;
    flex: 0 0 auto;
    width: 44px;
    justify-content: center;
    padding: 14px 0;
  }
  .dropdown-toggle-label { display: none; }
  .dropdown-toggle[aria-expanded="true"] .dropdown-arrow { transform: rotate(180deg); }
  .dropdown-menu {
    display: none;
    position: static;
    flex: 1 0 100%;
    box-shadow: none;
    border: none;
    margin: 0 0 8px;
    padding-left: 12px;
  }
  .has-dropdown.is-open .dropdown-menu { display: block; }
  .primary-nav__cta { margin-top: 16px; text-align: center; }
  .nav-toggle { display: flex; }

  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .hero__content { order: 1; }
  .hero__visual { order: 2; margin-top: 8px; }
  .hero__visual img { max-width: 300px; }
  .hero__actions { justify-content: center; }
  .stat-bar { grid-template-columns: repeat(3, 1fr); margin-top: -32px; }
  .site-footer__inner { grid-template-columns: 1fr 1fr; }

  /* Tables (admin lists, careers page job details) become their own
     horizontally-scrollable block instead of overflowing the page. */
  .admin-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

/* ---------- Mobile (<=600px) ---------- */
@media (max-width: 600px) {
  section { padding: 48px 0; }
  .hero { padding: 56px 0; }
  .hero__actions .btn { width: 100%; text-align: center; }
  .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .stat-bar { grid-template-columns: repeat(2, 1fr); padding: 24px 16px; }
  .site-footer__inner { grid-template-columns: 1fr; gap: 28px; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .cookie-banner__inner { flex-direction: column; align-items: flex-start; }
  .container { padding: 0 18px; }
}

/* ---------- Very small phones (<=360px) ---------- */
@media (max-width: 360px) {
  h1 { font-size: 1.7rem; }
  .stat-bar { grid-template-columns: 1fr 1fr; }
  .site-header__logo img { width: 120px; height: auto; }
}

/* ---------- Large desktop (>=1440px) ---------- */
@media (min-width: 1440px) {
  :root { --container-width: 1280px; }
}
