body {
    margin: 0;
    font-family: sans-serif;
    min-height: 100vh;
    position: relative;
    padding-top: calc(var(--main-nav-height, 48px) + var(--sub-nav-height, 30px));
  }
  :root { --main-nav-height: 48px; --sub-nav-height: 30px; }
  
  body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #f2f5fb no-repeat center center fixed;
    background-size: cover;
    opacity: 0.5; /* 50% transparency */
    z-index: -1;
  }

  /* Random background from /media/backgrounds/*.png on page load */
  @keyframes __bgSwap { from { opacity: 0; } to { opacity: 1; } }
  .bg-loaded::before { animation: __bgSwap 600ms ease forwards; }
  
  
  .main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    background: #7A4FA0;
    font-size: 1rem;
    gap: 0;
    height: var(--main-nav-height);
  }

  .main-nav svg {
    height: 32px;
    width: auto;
    color: white; 
  }
  
  /* Keep links to the left */
  .nav-links {
    display: flex;
    gap: 0;
  }
  
  .main-nav a {
    text-decoration: none;
    font-weight: bold;
    color: white;
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 0.75rem; /* match nav-primary */
  }
  
  .main-nav .nav-primary {
    color: white !important;
  }
  
  .main-nav a:hover {
    color: #007acc;
  }
  
  /* Highlighted primary link */
  .nav-primary {
    background-color: #007acc;
    color: white !important;
    font-weight: bold;
    text-decoration: none;
    height: 48px;
    line-height: 48px;
    display: inline-block;
    border-radius: 0;
    vertical-align: middle;
    transition: background-color 0.3s ease;
  }
  
  .nav-primary:hover {
    background-color: #005fa3;
  }

  .nav-primary .home-icon {
    color: white;
  }

  .nav-links img {
    vertical-align: middle;
  }

  .nav-primary:hover .home-icon {
    color: #f0f0f0;
  }

  .home-icon {
    width: 24px;
    height: 24px;
    color: #333; /* match other nav links */
    cursor: pointer;
    vertical-align: middle;
  }

.main-nav > .nav-logo {
  color: white; 
  padding: 0 0.75rem;
  height: 48px;
  display: flex;
  align-items: center;
  background-color: #7A4FA0;
  color: white !important;
  font-weight: bold;
  text-decoration: none;
  line-height: 48px;
  border-radius: 0;
  vertical-align: middle;
  transition: background-color 0.3s ease;
}

.main-nav > .nav-logo svg {
  height: 24px;
  width: auto;
  fill: currentColor;
  display: block;
}

/* === Section Sub-Navigation === */
  .sub-nav {
    position: fixed;
    top: var(--main-nav-height); /* sits below the fixed main nav */
    left: 0; right: 0;
    z-index: 1999;
    background: #007acc;
    display: flex;
    align-items: center;
    height: var(--sub-nav-height);
    padding: 0 1.5rem;
    font-size: 0.95rem;
  }

  .sub-nav-links {
    display: flex;
    gap: 0;
  }

  .sub-nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
  }

  .sub-nav a.sub-nav-primary {
    background-color: #7AC9A0;
    color: white;
    font-weight: bold;
    text-decoration: none;
    height: 30px;
    line-height: 1;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    border-radius: 0;
    transition: background-color 0.3s ease;
  }
  
  /* --- MOBILE STYLES --- */
  @media (max-width: 768px) {
    :root {
      --logo-bar-height: 44px;
      --main-links-height: 44px;
      --main-nav-height: calc(var(--logo-bar-height) + var(--main-links-height));
      --sub-nav-height: 36px;
    }
    body { padding-top: calc(var(--main-nav-height) + var(--sub-nav-height)); }
    .main-nav {
      height: var(--main-nav-height);
      padding: 0;
      display: block; /* allow absolute children to stack */
    }
    /* Row 1: Logo bar */
    .main-nav > .nav-logo {
      position: absolute;
      top: 0; left: 0; right: 0;
      height: var(--logo-bar-height);
      display: flex;
      align-items: center;
      justify-content: center; /* center-middle logo */
      padding: 0 0.75rem;
    }
    .main-nav > .nav-logo svg { height: 22px; }
    /* Row 2: Main links bar */
    .nav-links {
      position: absolute;
      top: var(--logo-bar-height);
      left: 0; right: 0;
      height: var(--main-links-height);
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 0;
    }
    .nav-links a {
      height: var(--main-links-height);
      line-height: var(--main-links-height);
      padding: 0 0.5rem;
    }
    .nav-primary { height: var(--main-links-height); line-height: var(--main-links-height); }
    /* Sub-nav sits below both rows */
    .sub-nav { top: var(--main-nav-height); height: var(--sub-nav-height); font-size: clamp(0.85rem, 3.2vw, 1.05rem); padding: 0 0.75rem; }
    .sub-nav a { padding: 0 0.5rem; }
    .sub-nav a.sub-nav-primary { height: var(--sub-nav-height); line-height: var(--sub-nav-height); }

  /* Responsive labels: show short on mobile */
  .sub-nav .label-full { display: none; }
  .sub-nav .label-short { display: inline; }
  }

/* Desktop/tablet: show full labels */
.sub-nav .label-full { display: inline; }
.sub-nav .label-short { display: none; }

/* Ensure sub-nav primary fills the bar on larger screens too */
.sub-nav a.sub-nav-primary { height: var(--sub-nav-height); line-height: var(--sub-nav-height); }