/* =====================================================================
   SNU responsive layer
   ≥1440 large desktop · 1200–1439 desktop · 992–1199 small desktop/tablet landscape
   768–991 tablet · 480–767 large phone · <480 phone
   ===================================================================== */

@media (min-width: 1440px) {
  .container { max-width: 1360px; }
  .nav-link { padding: 0 .9rem; }
}

/* Somali labels are longer: tighten the bar so it stays on one row */
@media (min-width: 1200px) and (max-width: 1439.98px) {
  [data-ui-lang="so"] .nav-link { padding: 0 .45rem; }
}

/* the header CTA needs the room the brand row has from 992px up */
@media (max-width: 991.98px) {
  .header-cta { display: none; }
}

/* ---------- below desktop navigation ---------- */
@media (max-width: 1199.98px) {
  :root { --header-h: 72px; --sticky-h: var(--header-h); }
  .site-header { top: 0; }
  .header-nav { display: none; }
  .menu-toggle { display: inline-grid; }
  .header-actions { margin-left: auto; }
  .topbar-links { display: none; }
  .topbar-social { margin-left: auto; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .quick-grid li:nth-child(4) { border-left: 0; }
  .quick-grid li:nth-child(n+4) { border-top: 1px solid var(--line-2); }
  .stats-grid { grid-template-columns: repeat(3, 1fr); row-gap: 2rem; }
  .stat:nth-child(4) { border-left: 0; }
  .campus-row { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .page-layout.with-sidebar { grid-template-columns: minmax(0, 1fr) 270px; gap: 2.5rem; }
  .article-layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 2.5rem; }
  .org-row { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- tablet ---------- */
@media (max-width: 991.98px) {
  .topbar-contact a:last-child span { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  .about-img { aspect-ratio: 16 / 10; }
  .about-badge { right: 16px; }
  .rector-strip { grid-template-columns: auto 1fr; }
  .rector-strip .btn { grid-column: 1 / -1; justify-self: start; }
  .news-home { grid-template-columns: 1fr; }
  .annc-strip ul { grid-template-columns: 1fr; }
  .research-grid { grid-template-columns: repeat(2, 1fr); }
  .centre-strip ul { grid-template-columns: repeat(2, 1fr); }
  .life-grid { grid-template-columns: repeat(2, 1fr); }
  .life-card { aspect-ratio: 4 / 3; }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
  .partners-wrap { grid-template-columns: 1fr; gap: 1.5rem; }
  .cta-band-inner { flex-direction: column; align-items: flex-start; }
  .page-layout.with-sidebar, .article-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .article-aside { position: static; }
  .sidebar .side-nav ul { display: flex; flex-wrap: wrap; gap: .3rem; }
  .sidebar .side-nav a { border: 1px solid var(--line); border-radius: 999px; padding: .4rem .85rem; }
  .sidebar .side-nav a[aria-current] { border-color: var(--gold); }
  .card-grid.cols-3, .goal-grid, .req-grid, .contact-grid { grid-template-columns: repeat(2, 1fr); }
  .portal-grid { grid-template-columns: repeat(2, 1fr); }
  .campus-section { grid-template-columns: 1fr; gap: 1.5rem; }
  .campus-section:nth-of-type(even) .campus-section-media { order: 0; }
  .campus-section-img { position: static; aspect-ratio: 16 / 9; }
  .contact-layout { grid-template-columns: 1fr; }
  .centre-grid, .area-grid { grid-template-columns: minmax(0, 1fr); }
  .num-list { grid-template-columns: 1fr; }
  .mega-inner { display: none; }
}

/* ---------- phones ---------- */
@media (max-width: 767.98px) {
  .topbar-contact { gap: .8rem; }
  .topbar-contact a:first-child span { display: none; }
  .topbar-social a { width: 28px; height: 28px; }
  .header-inner { gap: .5rem; }
  .brand { flex-shrink: 1; min-width: 0; gap: .55rem; }
  .brand-emblem { width: 38px; }
  .header-actions { gap: .35rem; margin-left: auto; }
  .icon-btn { width: 40px; height: 40px; }
  .quick-access { margin-top: 0; padding-top: 1.25rem; }
  .hero-controls { bottom: 22px; }

  .hero { height: auto; min-height: 560px; }
  .hero-slides { position: relative; min-height: 560px; }
  .hero-content { justify-content: flex-end; padding-top: 6rem; padding-bottom: 6.5rem; }
  .hero-shade { background: linear-gradient(0deg, rgba(10, 39, 66, .96) 15%, rgba(10, 39, 66, .55) 60%, rgba(10, 39, 66, .3)); }
  .hero-actions .btn { flex: 1 1 auto; }
  .hero-controls { bottom: 20px; }

  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid li { border-left: 0 !important; border-top: 1px solid var(--line-2); }
  .quick-grid li:nth-child(-n+2) { border-top: 0; }
  .quick-grid li:nth-child(even) { border-left: 1px solid var(--line-2) !important; }
  .quick-tile { flex-direction: column; gap: .4rem; padding: 1.1rem; }
  .quick-tile small { display: none; }

  .section-head { flex-direction: column; align-items: flex-start; gap: .8rem; margin-bottom: 1.8rem; }
  .vm-grid { grid-template-columns: 1fr; }
  .rector-strip { grid-template-columns: 1fr; text-align: left; padding: 1.6rem; gap: 1.2rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat { border-left: 0 !important; }
  .faculty-grid { grid-template-columns: 1fr; }
  .news-card-row { flex-direction: column; }
  .news-card-row .news-card-media, .news-list-compact .news-card-row .news-card-media { flex-basis: auto; aspect-ratio: 16 / 9; min-height: 0; }
  .news-feature-body { padding: 1.2rem; }
  .research-grid, .centre-strip ul { grid-template-columns: 1fr; }
  .life-grid { grid-template-columns: 1fr; }
  .campus-row { grid-template-columns: repeat(2, 1fr); }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .gallery-home .gallery-item:first-child { grid-column: span 2; grid-row: auto; }
  .gallery-home .gallery-item:first-child a { aspect-ratio: 4 / 3; }
  .gallery-item figcaption { opacity: 1; transform: none; padding: 1.2rem .5rem .4rem; }
  .country-list { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; padding-top: 3rem; }
  .footer-bottom-inner { flex-direction: column; }
  .cta-actions .btn { flex: 1 1 auto; }

  .page-hero { padding: 1.8rem 0 2.4rem; }
  .page-hero.has-image { padding: 2rem 0 2.8rem; }
  .page-layout { padding-top: 2rem; padding-bottom: 3rem; }
  .card-grid.cols-2, .card-grid.cols-3, .goal-grid, .req-grid, .contact-grid, .two-col, .leader-grid { grid-template-columns: 1fr; }
  .rector-feature, .profile-head { grid-template-columns: 1fr; flex-direction: column; align-items: flex-start; padding: 1.4rem; }
  .profile-head { padding: 0; }
  .avatar-xxl { width: 140px; height: 140px; }
  .leader-card { flex-direction: column; }
  .timeline::before { left: 8px; }
  .tl-item { grid-template-columns: 1fr; gap: .3rem; padding-left: 2rem; }
  .tl-item::before { left: 2px; }
  .org-row-mid { flex-direction: column; gap: .5rem; }
  .org-row { grid-template-columns: 1fr 1fr; }
  .org-top { min-width: 0; }
  .program-row { flex-direction: column; align-items: flex-start; gap: .6rem; }
  .filter-bar { padding: .8rem; }
  .filter-bar select { flex: 1 1 45%; }
  .filter-count { margin-left: 0; width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .contact-form { padding: 1.3rem; }
  .portal-grid { grid-template-columns: 1fr 1fr; }
  .doc-list .muted { margin-left: 0; width: 100%; }
  .notice-item { flex-direction: column; }
  .search-form-big { padding: 1.3rem; }
  .search-field { flex-wrap: wrap; border-radius: var(--radius); padding: .5rem .8rem; }
  .search-field .btn { width: 100%; }
  .lightbox .lb-prev, .lightbox .lb-next { top: auto; bottom: 1rem; transform: none; }
  .lightbox .lb-prev { left: calc(50% - 60px); }
  .lightbox .lb-next { right: calc(50% - 60px); }
  .anchor-nav { position: static; }
  .lang-notice { flex-direction: row; font-size: .8rem; }
}

/* stacked tables on small screens */
@media (max-width: 599.98px) {
  .table-wrap { border: 0; overflow: visible; }
  .data-table { min-width: 0; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data-table tr { display: block; margin-bottom: .8rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--white) !important; }
  .data-table td { display: grid; grid-template-columns: 42% 1fr; gap: .8rem; padding: .6rem .9rem; border-top: 1px solid var(--line-2); }
  .data-table td:first-child { border-top: 0; background: var(--surface); }
  .data-table td::before { content: attr(data-label); font-weight: 700; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
}

@media (max-width: 479.98px) {
  .news-grid, .event-grid, .faculty-grid, .program-cards, .link-cards, .campus-list, .member-grid, .fact-grid, .year-grid { grid-template-columns: minmax(0, 1fr); }
  .brand-sub { display: none; }
  .topbar-contact a:last-child span { display: none; }
  .campus-row, .portal-grid { grid-template-columns: 1fr; }
  .org-row { grid-template-columns: 1fr; }
  .btn { white-space: normal; text-align: center; }
  .stat-value { font-size: 1.9rem; }
}

/* enable sidebar navigation layout above tablet in landscape */
@media (max-width: 1199.98px) {
  .faculty-grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 991.98px) {
  .faculty-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grad-banner { flex-wrap: wrap; }
}
@media (max-width: 767.98px) {
  .faculty-grid-4 { grid-template-columns: 1fr; }
  .grad-banner { padding: 1.3rem; }
}
