/* ===== Global guards to prevent horizontal overflow ===== */
html, body { overflow-x: clip !important; width:100%; max-width:100%; }

/* CSS variables for easy control */
:root {
  --header-font-sans: "Metropolis", system-ui, -apple-system, "Segoe UI", Roboto,
                      "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif,
                      "Apple Color Emoji","Segoe UI Emoji";
  --header-font-serif: "Marcellus", "Times New Roman", Times, serif;
  --header-bg-color: #0a1a4f;
  --header-text-color: #fff;
  --header-hover-color: #618dc2;
  --header-font-size: 12px;
  --header-font-weight: 700;
  --header-letter-spacing: 0.8px;

  /* Tweak globally */
  --settings-cog-size: 20px;
}

/* Metropolis (Regular + Bold) via CDN */
@font-face {
  font-family: "Metropolis";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("https://cdn.jsdelivr.net/gh/chrismsimpson/Metropolis/Fonts/WEB/Metropolis-Regular.woff2") format("woff2"),
       url("https://cdn.jsdelivr.net/gh/chrismsimpson/Metropolis/Fonts/WEB/Metropolis-Regular.woff") format("woff");
}
@font-face {
  font-family: "Metropolis";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url("https://cdn.jsdelivr.net/gh/chrismsimpson/Metropolis/Fonts/WEB/Metropolis-Bold.woff2") format("woff2"),
       url("https://cdn.jsdelivr.net/gh/chrismsimpson/Metropolis/Fonts/WEB/Metropolis-Bold.woff") format("woff");
}

/* Set Metropolis for all textual elements in the header */
header,
header a,
header span,
header button,
header input,
header label,
header li,
header .dropdown-menu a,
header form { font-family: var(--header-font-sans) !important; }

/* The UMAK wordmark: always Marcellus */
header .logo-section .umak-text { font-family: var(--header-font-serif) !important; }

/* Header */
header {
  width: 100% !important;
  background: var(--header-bg-color) !important;
  color: var(--header-text-color) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 5px 40px !important;
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important;
  z-index: 9999 !important;
  height: 60px !important;
  box-sizing: border-box !important;
  padding-left: 20px !important;

  /* contain header effects; helps prevent seams */
  isolation: isolate;
}

/* Reset any centering or flex properties */
header * { margin: 0; padding: 0; box-sizing: border-box; }

/* Logo + Wordmark */
header .logo-section {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 0 0 auto !important;
  justify-content: flex-start !important;
  margin-right: auto !important;
  position: relative !important;
  z-index: 10001 !important;
  min-width: auto !important;
  max-width: none !important;
}
header .logo-section img { width: 50px !important; height: 50px !important; flex-shrink: 0 !important; display: block !important; }
header .logo-section .umak-text{
  color:#fff !important; text-transform:uppercase !important; letter-spacing:normal !important;
  font-weight:400 !important; font-size:20px !important; line-height:1 !important; white-space:nowrap !important;
  display:inline-block !important; overflow:visible !important; text-overflow:unset !important;
  -webkit-font-smoothing:antialiased !important; -moz-osx-font-smoothing:grayscale !important; max-width:none !important;
}

/* Navigation */
header nav { display:flex !important; align-items:center !important; position:relative !important; z-index:10000 !important; }
header nav ul { list-style:none !important; display:flex !important; gap:20px !important; align-items:center !important; margin:0 !important; padding:0 !important; }
header nav ul li { list-style:none !important; margin:0 !important; padding:0 !important; }
header nav ul li a {
  color:#fff !important; text-decoration:none !important; display:flex !important; align-items:center !important; gap:5px !important;
  text-transform:uppercase !important; font-weight:var(--header-font-weight) !important; font-size:var(--header-font-size) !important;
  letter-spacing:var(--header-letter-spacing) !important;
}
header nav ul li a:hover { color:var(--header-hover-color) !important; }

/* Dropdown */
.dropdown { position:relative !important; }
.dropdown-menu{
  position:absolute !important; top:40px !important; right:0 !important;
  background:var(--header-bg-color) !important; border-radius:6px !important; overflow:hidden !important;
  box-shadow:0 4px 8px rgba(0,0,0,0.3) !important; min-width:120px !important; z-index:10002 !important;
  flex-direction:column !important; opacity:0 !important; transform:translateY(-10px) !important;
  pointer-events:none !important; transition:opacity .3s ease, transform .3s ease !important;
}
.dropdown-menu a{
  display:block !important; padding:10px 15px !important; color:#fff !important; text-decoration:none !important;
  font-size:var(--header-font-size) !important; text-transform:uppercase !important; font-weight:var(--header-font-weight) !important;
  letter-spacing:var(--header-letter-spacing) !important;
}
.dropdown-menu a:hover { background:var(--header-hover-color) !important; color:#000 !important; }
.dropdown.active .dropdown-menu { display:flex !important; opacity:1 !important; transform:translateY(0) !important; pointer-events:auto !important; }

/* Cog Animation */
.dropdown > a i { transition: transform .4s ease !important; }
.dropdown.active > a i { transform: rotate(180deg) !important; }

/* Hamburger (hidden on desktop) */
.menu-toggle{
  display:none; font-size:24px !important; cursor:pointer !important; color:#fff !important; background:none !important;
  border:none !important; padding:5px !important; flex-shrink:0 !important; position:relative !important; z-index:10001 !important; outline:none !important;
}
.menu-toggle i{ transition:transform .3s ease !important; display:block !important; }
.menu-toggle.active i{ transform:rotate(90deg) !important; }

/* Settings text (hidden on desktop) */
.settings-text{ display:none; text-transform:uppercase !important; font-weight:var(--header-font-weight) !important; font-size:var(--header-font-size) !important; letter-spacing:var(--header-letter-spacing) !important; }

/* Mobile overlay */
.mobile-overlay{
  display:none; position:fixed !important; top:0 !important; left:0 !important; width:100% !important; height:100% !important;
  background:rgba(0,0,0,.5) !important; z-index:9998 !important; opacity:0; transition:opacity .3s ease !important;
}
.mobile-overlay.active{ display:block !important; opacity:1 !important; }

/* Search bar (kept for pages that use it) */
.search-item { display:flex !important; align-items:center !important; }
#headerSearchForm{
  display:flex !important; align-items:center !important; gap:8px !important;
  background:rgba(255,255,255,.12) !important; border:1px solid rgba(255,255,255,.2) !important; padding:6px 10px !important; border-radius:999px !important;
}
#headerSearchForm input[type="search"]{
  background:transparent !important; border:none !important; outline:none !important; color:#fff !important; font-size:14px !important; min-width:220px !important;
  font-family:var(--header-font-sans) !important;
}
#headerSearchForm input::placeholder{ color:rgba(255,255,255,.75) !important; font-family:var(--header-font-sans) !important; }
#headerSearchForm button{
  background:var(--header-hover-color) !important; border:none !important; color:#000 !important; border-radius:999px !important; padding:6px 10px !important;
  cursor:pointer !important; font-size:14px !important; font-family:var(--header-font-sans) !important;
}
#headerSearchForm button:hover{ filter:brightness(1.1) !important; }

/* Visually hidden (for accessibility labels) */
.sr-only{ position:absolute !important; width:1px !important; height:1px !important; padding:0 !important; margin:-1px !important; overflow:hidden !important; clip:rect(0,0,0,0) !important; white-space:nowrap !important; border:0 !important; }

/* =========================
   Mobile Responsive Styles
   ========================= */
@media (max-width: 768px) {
  /* Header spacing */
  header { padding:5px 20px !important; padding-left:12px !important; }

  /* Logo block */
  header .logo-section{
    display:flex !important; align-items:center !important; gap:6px !important; flex:1 1 auto !important; justify-content:flex-start !important;
    margin-right:10px !important; position:relative !important; width:auto !important; max-width:calc(100% - 60px) !important; min-width:0 !important;
  }
  header .logo-section img{ width:44px !important; height:44px !important; display:block !important; flex-shrink:0 !important; }
  header .logo-section .umak-text{
    font-size:18px !important; letter-spacing:normal !important; white-space:nowrap !important; overflow:hidden !important; text-overflow:ellipsis !important;
    display:inline-block !important; flex:1 1 auto !important; min-width:0 !important;
  }

  /* === Off-canvas Nav (NO right:-250px; uses transform) === */
  header nav{
    position:fixed !important;
    top:60px !important;
    right:0 !important;               /* drawer anchored to the right edge */
    width:250px !important;
    height:calc(100dvh - 60px) !important;
    background:var(--header-bg-color) !important;
    box-shadow:-2px 0 10px rgba(0,0,0,0.3) !important;
    z-index:9999 !important;
    overflow-y:auto !important;
    display:block !important;

    /* Hidden by default without affecting layout width */
    transform: translateX(100%);
    will-change: transform;
    transition: transform .3s ease !important;

    /* These keep the drawer from expanding the layout */
    contain: paint;
  }
  header nav.active{ transform: translateX(0); }

  header nav ul{
    flex-direction:column !important; padding:20px 0 !important; gap:0 !important; width:100% !important; display:flex !important;
  }
  header nav ul li{ width:100% !important; border-bottom:1px solid rgba(255,255,255,.1) !important; }
  header nav ul li:last-child{ border-bottom:none !important; }
  header nav ul li a{
    padding:15px 20px !important; font-size:14px !important; font-weight:var(--header-font-weight) !important; text-transform:uppercase !important;
    letter-spacing:var(--header-letter-spacing) !important; transition:background .3s ease !important; width:100% !important; display:flex !important; justify-content:flex-start !important;
  }
  /* Mobile hover - text stays white */
  header nav ul li a:hover{ background:rgba(97,141,194,.1) !important; color:#fff !important; }

  /* Dropdown (mobile) */
  .dropdown{ position:static !important; width:100% !important; }
  .dropdown > a{
    display:flex !important; justify-content:space-between !important; align-items:center !important; width:100% !important; padding:15px 20px !important;
  }
  .dropdown > a::after{
    content:'\f107' !important; font-family:'Font Awesome 6 Free' !important; font-weight:900 !important; transition:transform .3s ease !important; margin-left:auto !important;
  }
  .dropdown.active > a::after{ transform:rotate(180deg) !important; }
  .dropdown > a i{ display:none !important; }
  .settings-text{ display:inline !important; font-weight:var(--header-font-weight) !important; font-size:14px !important; text-transform:uppercase !important; letter-spacing:var(--header-letter-spacing) !important; }

  .dropdown-menu{
    position:static !important; opacity:1 !important; transform:none !important; pointer-events:auto !important; background:rgba(0,0,0,.2) !important;
    box-shadow:none !important; border-radius:0 !important; margin-top:0 !important; max-height:0 !important; overflow:hidden !important;
    transition:max-height .3s ease !important; display:block !important;
  }
  .dropdown.active .dropdown-menu{ max-height:300px !important; }
  .dropdown-menu a{
    padding:12px 40px !important; border-left:3px solid transparent !important; transition:all .3s ease !important; font-size:14px !important;
    text-transform:uppercase !important; font-weight:var(--header-font-weight) !important; letter-spacing:var(--header-letter-spacing) !important;
  }
  .dropdown-menu a:hover{ border-left-color:var(--header-hover-color) !important; background:rgba(97,141,194,.1) !important; color:#fff !important; }

  .menu-toggle{ display:block !important; margin-left:auto !important; flex:0 0 auto !important; width:40px !important; }
}

/* Extra small devices */
@media (max-width: 480px) {
  header { padding:5px 15px !important; padding-left:10px !important; }
  header .logo-section{ gap:6px !important; }
  header .logo-section .umak-text{ font-size:16px !important; letter-spacing:normal !important; min-width:0 !important; flex:1 1 auto !important; overflow:hidden !important; text-overflow:ellipsis !important; }
  header .logo-section img{ width:36px !important; height:36px !important; flex-shrink:0 !important; }
  .menu-toggle{ font-size:18px !important; }
  /* Drawer width smaller on very small screens */
  header nav{ width:200px !important; }
}

/* Wide screens */
@media (min-width: 1200px) {
  header .logo-section .umak-text{ font-size:20px !important; letter-spacing:normal !important; }
  header{ padding:5px 60px !important; padding-left:36px !important; }
}

/* Fixed-size cog icon */
header .dropdown > a i.fa-cog{
  font-size:var(--settings-cog-size) !important;
  width:var(--settings-cog-size) !important; height:var(--settings-cog-size) !important; line-height:var(--settings-cog-size) !important;
  display:inline-flex !important; align-items:center !important; justify-content:center !important; flex:0 0 var(--settings-cog-size) !important;
}
