/*
 * Sharkawy global layout system.
 * A compact mobile-first replacement for the former breakpoint-heavy
 * navigation/footer stylesheet.
 */
:root {
  --sh-bg: #f9fcff;
  --sh-surface: #fff;
  --sh-primary: #0d47a1;
  --sh-secondary: #1565c0;
  --sh-accent: #66b2ff;
  --sh-text: #182536;
  --sh-muted: #526274;
  --sh-border: #dce7f1;
  --sh-content: 90rem;
  --sh-header-height: 4.5rem;
  --sh-space: clamp(1rem, 2.5vw, 2rem);
  --sh-radius: .8rem;
  --sh-shadow: 0 .4rem 1.4rem rgba(13, 71, 161, .12);
}

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; }
body {
  min-width: 20rem;
  margin: 0;
  padding-top: var(--sh-header-height);
  color: var(--sh-text);
  background: var(--sh-bg);
  font-family: Inter, Arial, sans-serif;
  line-height: 1.55;
}
img, svg, video, iframe { max-width: 100%; }
img { height: auto; }

.site-header { position: relative; z-index: 2000; }
.navbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--sh-header-height);
  width: 100%;
  margin: 0;
  padding: .65rem max(1rem, calc((100vw - var(--sh-content)) / 2));
  color: var(--sh-primary);
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--sh-border);
  box-shadow: 0 .2rem .8rem rgba(13, 71, 161, .08);
  backdrop-filter: blur(.7rem);
}

/* Keep the site navigation below WordPress's logged-in administrator bar. */
body.admin-bar { --sh-admin-offset: 32px; }
body.admin-bar .navbar { top: var(--sh-admin-offset); }
body.admin-bar #wpadminbar { position: fixed; }
.logo {
  flex: 0 0 auto;
  color: var(--sh-primary);
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  font-weight: 800;
  line-height: 1;
  text-decoration: none !important;
  white-space: nowrap;
}
.logo:is(:hover, :focus, :visited) { color: var(--sh-primary); text-decoration: none !important; }
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(.65rem, 1.5vw, 1.35rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-links a, .dropdown-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: .45rem .2rem;
  color: var(--sh-primary);
  background: transparent;
  border: 0;
  font: inherit;
  font-size: clamp(.88rem, 1.1vw, 1rem);
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.nav-links a:is(:hover, :focus-visible), .dropdown-toggle:is(:hover, :focus-visible),
.nav-links a[aria-current="page"], .dropdown-toggle[aria-expanded="true"] { color: var(--sh-secondary); }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  inset: calc(100% + .25rem) auto auto 0;
  display: none;
  min-width: 15rem;
  margin: 0;
  padding: .45rem;
  list-style: none;
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  box-shadow: var(--sh-shadow);
}
.dropdown:is(:hover, :focus-within, .is-open) > .dropdown-menu { display: block; }
.dropdown-menu a { width: 100%; padding: .7rem .8rem; border-radius: .5rem; }
.dropdown-menu a:hover { color: #fff; background: var(--sh-secondary); }
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: .28rem;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: .5rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: .5rem;
  cursor: pointer;
}
.nav-toggle span { display: block; width: 1.45rem; height: .16rem; background: var(--sh-primary); border-radius: 1rem; transition: transform .2s ease, opacity .2s ease; }
.nav-toggle.active span:nth-child(1) { transform: translateY(.44rem) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-.44rem) rotate(-45deg); }
.nav-scrim {
  position: fixed;
  inset: calc(var(--sh-admin-offset, 0px) + var(--sh-header-height)) 0 0;
  z-index: 1980;
  display: block;
  width: 100%;
  padding: 0;
  background: rgba(5, 20, 38, .48);
  border: 0;
  opacity: 1;
  cursor: default;
  backdrop-filter: blur(2px);
  transition: opacity .22s ease;
}
.nav-scrim[hidden] { display: none; }
body.nav-open { overflow: hidden; }

.site-content { min-height: 55vh; }

/* Homepage map: contained on desktop and converted to a usable touch layout. */
#membership-map { width: min(100% - 2rem, var(--sh-content)); margin-inline: auto; }
#membership-map .map-frame { position: relative; width: 100%; min-height: clamp(24rem, 55vw, 49rem); overflow: hidden; border-radius: var(--sh-radius); }
#membership-map .world { display: block; width: 100%; height: auto; }
.filter-btn-container { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 1rem; }
.filter-btn { min-height: 2.65rem; padding: .5rem .85rem; color: var(--sh-primary); background: var(--sh-surface); border: 1px solid var(--sh-border); border-radius: 999px; cursor: pointer; font: inherit; font-weight: 700; }
.filter-btn:is(:hover, :focus-visible), .filter-btn[aria-pressed="true"] { color: #fff; background: var(--sh-secondary); border-color: var(--sh-secondary); }
.country-card { max-width: min(26rem, calc(100% - 1rem)); margin: 0; }
.site-footer {
  width: 100%;
  margin: 2rem 0 0;
  padding: clamp(2.25rem, 5vw, 4.5rem) var(--sh-space) 1.25rem;
  color: #fff;
  background: linear-gradient(135deg, var(--sh-primary), var(--sh-secondary));
}
.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: clamp(1rem, 2.5vw, 2rem);
  width: min(100%, var(--sh-content));
  margin: 0 auto 2rem;
}
.footer-column {
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.4rem);
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--sh-radius);
}
.footer-column h2, .footer-column h3 {
  margin: 0 0 .9rem;
  padding: 0 0 .55rem;
  color: #fff;
  border-bottom: 2px solid rgba(255, 255, 255, .2);
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  text-align: left;
}
.footer-list, .sub-list { margin: 0; padding: 0; list-style: none; }
.footer-list li { margin: 0 0 .55rem; overflow-wrap: anywhere; }
.footer-list a { color: #fff; font-weight: 550; text-decoration: none; }
.footer-list a:hover { color: #d9efff; text-decoration: underline; }
.footer-list .sub-list { margin-top: .4rem; padding-left: 1rem; list-style: disc; }
.footer-bottom {
  width: min(100%, var(--sh-content));
  margin: 0 auto;
  padding-top: 1rem;
  color: #e7f1fa;
  border-top: 1px solid rgba(255, 255, 255, .2);
  font-size: .88rem;
  text-align: center;
}

@media (max-width: 64rem) {
  :root { --sh-header-height: 4rem; }
  .navbar { padding-inline: clamp(1rem, 3vw, 1.5rem); }
  .nav-toggle {
    display: flex;
    border-color: var(--sh-border);
    background: #f5f9fd;
    box-shadow: 0 .15rem .45rem rgba(13, 71, 161, .08);
  }
  .nav-toggle:is(:hover, :focus-visible), .nav-toggle.active { background: #e8f3fc; border-color: #a9c9e6; }
  .nav-links {
    position: fixed;
    inset: calc(var(--sh-admin-offset, 0px) + var(--sh-header-height)) 0 0 auto;
    z-index: 1990;
    display: flex;
    width: min(26rem, calc(100% - 1.25rem));
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex-direction: column;
    align-items: stretch;
    gap: .45rem;
    padding: 1rem max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) 1rem;
    background: linear-gradient(180deg, #fff 0%, #f5f9fd 100%);
    border: 1px solid var(--sh-border);
    border-width: 0 0 1px 1px;
    border-radius: 0 0 0 1.25rem;
    box-shadow: -.8rem 1.2rem 2.6rem rgba(5, 35, 68, .2);
    visibility: hidden;
    opacity: 0;
    transform: translateX(105%);
    pointer-events: none;
    transition: transform .25s ease, opacity .2s ease, visibility .25s;
  }
  .nav-links.active { visibility: visible; opacity: 1; transform: translateX(0); pointer-events: auto; }
  .nav-links > li { width: 100%; }
  .nav-links a, .dropdown-toggle {
    position: relative;
    width: 100%;
    min-height: 3.25rem;
    padding: .75rem .9rem;
    color: #163d63;
    background: #fff;
    border: 1px solid #dce8f2;
    border-radius: .7rem;
    font-size: 1rem;
    box-shadow: 0 .1rem .3rem rgba(13, 71, 161, .05);
  }
  .nav-links a::before {
    content: "";
    width: .25rem;
    height: 1.5rem;
    margin-right: .7rem;
    background: #c8dbea;
    border-radius: 999px;
  }
  .nav-links a[aria-current="page"] { color: #fff; background: linear-gradient(135deg, var(--sh-primary), var(--sh-secondary)); border-color: transparent; }
  .nav-links a[aria-current="page"]::before { background: #fff; }
  .dropdown-toggle span { transition: transform .2s ease; }
  .dropdown-toggle[aria-expanded="true"] span { transform: rotate(180deg); }
  .dropdown-menu { position: static; width: calc(100% - .75rem); min-width: 0; margin: .4rem 0 .2rem .75rem; padding: .45rem; background: #eaf3fa; border-color: #cedfec; border-radius: .75rem; box-shadow: none; }
  .dropdown-menu a { min-height: 2.9rem; padding: .6rem .75rem; background: rgba(255,255,255,.88); box-shadow: none; }
  .dropdown-menu a::before { width: .2rem; height: 1.15rem; margin-right: .6rem; }
  .dropdown:not(.is-open) > .dropdown-menu { display: none; }
  .dropdown.is-open > .dropdown-menu { display: block; }
  .dropdown-toggle { justify-content: space-between; }
}

@media (max-width: 48.875rem) {
  body.admin-bar { --sh-admin-offset: 46px; }
  .nav-links { width: min(24rem, 92vw); }
}

/* Dedicated tablet navigation: more space and fewer long vertical lists. */
@media (min-width: 45rem) and (max-width: 64rem) {
  :root { --sh-header-height: 4.25rem; }
  .navbar { padding-inline: clamp(1.25rem, 3.5vw, 2rem); }
  .logo { font-size: clamp(1.2rem, 2.3vw, 1.5rem); }
  .nav-toggle { width: 3rem; height: 3rem; }
  .nav-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    align-items: start;
    width: min(38rem, 82vw);
    gap: .65rem;
    padding: 1.25rem max(1.25rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) 1.25rem;
  }
  .nav-links > li { min-width: 0; }
  .nav-links > .dropdown { grid-column: 1 / -1; }
  .nav-links a, .dropdown-toggle { min-height: 3.4rem; padding: .8rem 1rem; font-size: 1.02rem; }
  .dropdown-menu {
    width: calc(100% - 1rem);
    margin: .5rem .5rem .15rem;
    padding: .65rem;
  }
  .dropdown.is-open > .dropdown-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
  }
  .dropdown-menu a { min-height: 3rem; padding: .65rem .8rem; font-size: .95rem; }
}

@media (min-width: 55rem) and (max-width: 64rem) {
  .nav-links { width: min(42rem, 76vw); }
}

@media (max-width: 40rem) {
  :root { --sh-header-height: 3.85rem; }
  .navbar { padding-inline: max(.8rem, env(safe-area-inset-left)) max(.8rem, env(safe-area-inset-right)); }
  .nav-links { left: 0; width: 100%; padding-inline: max(.8rem, env(safe-area-inset-left)) max(.8rem, env(safe-area-inset-right)); border-inline: 0; border-radius: 0; }
  .nav-links a, .dropdown-toggle { min-height: 3.15rem; }
  .footer-content { grid-template-columns: 1fr; }
  .site-footer { padding-inline: 1rem; }
  #membership-map { width: min(100% - 1rem, var(--sh-content)); }
  #membership-map .map-frame { min-height: 31rem; overflow: visible; margin-bottom: 1rem; }
  .filter-btn-container { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding: .2rem .1rem .6rem; scroll-snap-type: x proximity; }
  .filter-btn { flex: 0 0 auto; scroll-snap-align: start; }
  .country-card { margin: 0; }
}

@media (max-width: 23.5rem) {
  :root { --sh-header-height: 3.65rem; }
  .logo { max-width: calc(100% - 3.25rem); overflow: hidden; font-size: .98rem; text-overflow: ellipsis; }
  .nav-toggle { width: 2.55rem; height: 2.55rem; }
  .nav-links { gap: .3rem; padding: .65rem; }
  .nav-links a, .dropdown-toggle { min-height: 2.85rem; padding: .55rem .7rem; font-size: .92rem; }
  .dropdown-menu { width: calc(100% - .4rem); margin-left: .4rem; }
}

@media (max-width: 64rem) and (max-height: 32rem) and (orientation: landscape) {
  .nav-links { gap: .25rem; padding-block: .55rem; }
  .nav-links a, .dropdown-toggle { min-height: 2.65rem; padding-block: .45rem; }
  .dropdown-menu { margin-top: .2rem; }
}

/* Large desktop: use the available width while retaining readable line lengths. */
@media (min-width: 90rem) {
  :root {
    --sh-content: 100rem;
    --sh-header-height: 4.85rem;
    --sh-space: clamp(1.5rem, 2.2vw, 2.75rem);
  }
  body { font-size: 1.0125rem; }
  .navbar { padding-block: .8rem; }
  .logo { font-size: 1.55rem; }
  .nav-links { gap: clamp(1rem, 1.35vw, 1.65rem); }
  .nav-links a, .dropdown-toggle { min-height: 3rem; font-size: 1.025rem; }
  .dropdown-menu { min-width: 18rem; }
  .dropdown-menu a { padding: .8rem 1rem; }
  .site-content > .container { width: 100%; max-width: none; margin-inline: auto; }
  .site-content :where(.wrap, .collab-section, .board-section, .contact-section, .diploma-width) { width: min(calc(100% - 4rem), var(--sh-content)); max-width: var(--sh-content); margin-inline: auto; }
  #membership-map, .fellowship-media-section { width: min(calc(100% - 4rem), var(--sh-content)); max-width: var(--sh-content); }
  .sse-media-gallery { grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.4rem; }
  .country-card { max-width: 29rem; }
  .footer-content { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
  .footer-column { padding: 1.55rem; }
}

/* 2K and common 4K scaled viewports. */
@media (min-width: 120rem) {
  :root {
    --sh-content: 112rem;
    --sh-header-height: 5.1rem;
  }
  body { font-size: 1.035rem; }
  .navbar { padding-block: .9rem; }
  .logo { font-size: 1.7rem; }
  .nav-links { gap: 1.75rem; }
  .nav-links a, .dropdown-toggle { font-size: 1.075rem; }
  .site-footer { padding-top: 5rem; }
  .footer-content { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 2.5rem; }
  .sse-media-gallery { grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 1.6rem; }
  .fellowship-media-section { padding-block: 6.5rem; }
}

/* Ultra-wide displays: stop expansion before content becomes difficult to scan. */
@media (min-width: 160rem) {
  :root {
    --sh-content: 128rem;
    --sh-header-height: 5.35rem;
  }
  body { font-size: 1.0625rem; }
  .navbar { padding-block: 1rem; }
  .logo { font-size: 1.85rem; }
  .nav-links a, .dropdown-toggle { font-size: 1.1rem; }
  .footer-content { gap: 3rem; }
  .footer-column { padding: 1.8rem; }
  .sse-media-gallery { grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); }
}

@media (min-width: 200rem) {
  :root { --sh-content: 140rem; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-toggle span, .nav-links, .nav-scrim, .dropdown-toggle span { transition: none; }
}
