/* Shared header styles for Xaltrix site */
* {
  -webkit-tap-highlight-color: transparent
}

html {
  scroll-behavior: smooth
}

header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 2rem;
  height: 64px;
  background: var(--menu-bg);
  position: fixed;
  width: 100%;
  box-sizing: border-box;
  z-index: 1000;
  top: 0;
  left: 0;
  color: var(--text-dark);
  overflow-x: hidden;
}

.logo {
  display: flex;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  margin-right: 2rem;
  min-height: 48px
}

.logo-image {
  width: 40px;
  height: 40px;
  margin-right: 0.8rem;
  border-radius: 8px;
  object-fit: cover
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  margin-left: 10px;
  color: var(--text-dark);
  font-family: 'Forum', serif;
  white-space: nowrap
}

.nav-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative
}

nav ul {
  list-style: none;
  display: flex;
  gap: 2.5rem;
  margin: 0;
  padding: 0;
  align-items: center
}

nav a {
  color: var(--text-dark);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
  transition: color 0.2s;
  display: block;
  padding: 0.5rem;
  min-height: 44px;
  display: flex;
  align-items: center
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  width: 44px;
  height: 44px;
  cursor: pointer;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: 0;
  -webkit-user-select: none;
  user-select: none
}

.hamburger span {
  height: 3px;
  width: 24px;
  background: var(--text-dark);
  margin: 4px 0;
  border-radius: 2px;
  transition: all 0.3s
}

/* Submenu styles */
.has-submenu {
  position: relative;
  display: inline-block
}

.has-submenu>a {
  position: relative
}

.has-submenu>.submenu {
  position: absolute;
  top: calc(100% + 0px);
  left: 0;
  min-width: 180px;
  background: var(--menu-bg);
  border-radius: 6px;
  padding: 8px 0;
  margin: 0;
  list-style: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 1100;
}

.has-submenu>.submenu li {
  padding: 0;
  margin: 0;
  display: block
}

.has-submenu>.submenu a {
  display: block;
  padding: 10px 16px;
  white-space: nowrap;
  color: var(--text-dark);
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  transition: background 0.15s;
}

.has-submenu>.submenu a:hover {
  background: rgba(79, 209, 197, 0.1)
}

.has-submenu:hover>.submenu,
.has-submenu:focus-within>.submenu {
  opacity: 1;
  visibility: visible;
}

.has-submenu.open>.submenu {
  display: flex !important;
  flex-direction: column;
  opacity: 1;
  visibility: visible;
}

/* Tablet: 768px to 1024px */
@media (max-width:1024px) {
  header {
    padding: 0 1.5rem
  }

  nav ul {
    gap: 2rem
  }

  .logo-text {
    font-size: 1.1rem
  }
}

/* Medium devices: 600px to 900px */
@media (max-width:900px) {
  header {
    padding: 0 1rem;
    height: 60px
  }

  nav ul {
    gap: 1.2rem
  }

  .logo-text {
    font-size: 1rem
  }

  .logo-image {
    width: 36px;
    height: 36px
  }

  nav a {
    font-size: 1rem
  }
}

/* Small tablets: 480px to 768px */
@media (max-width:768px) {
  header {
    padding: 0 1rem;
    height: 56px
  }

  .logo {
    margin-right: 1rem
  }

  .logo-image {
    width: 32px;
    height: 32px
  }

  .logo-text {
    font-size: 0.95rem;
    margin-left: 0.5rem
  }

  nav ul {
    display: none !important;
    position: absolute;
    top: 56px;
    left: 0;
    width: 100vw;
    background: var(--menu-bg);
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid #333;
    z-index: 1050;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    margin: 0;
    padding: 0;
    align-items: stretch
  }

  nav ul.show {
    display: flex !important;
    flex-direction: column;
    z-index: 1050
  }

  /* Use fixed so menu overlays page content instead of being clipped by header */
  nav ul {
    display: none !important;
    position: fixed;
    top: 56px;
    left: 0;
    width: 100vw;
    background: var(--menu-bg);
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid #333;
    z-index: 1050;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    margin: 0;
    padding: 0;
    align-items: stretch
  }

  nav ul.show {
    display: flex !important;
    flex-direction: column;
    z-index: 1050
  }

  nav ul li {
    width: 100%;
    padding: 0;
    border-bottom: 1px solid #232946;
    margin: 0;
    display: block
  }

  .hamburger {
    display: flex;
    z-index: 1100
  }

  nav a {
    color: var(--text-dark) !important;
    font-size: 1rem;
    padding: 1rem !important;
    display: block !important;
    text-align: left;
    width: 100%;
    min-height: auto;
    flex: none
  }

  nav a:not([href^="mailto"]) {
    display: block !important
  }

  .hamburger span {
    background: var(--text-dark)
  }
}

/* Mobile: up to 480px */
@media (max-width:480px) {
  header {
    padding: 0 0.75rem;
    height: 56px
  }

  .logo {
    margin-right: 0.75rem
  }

  .logo-text {
    font-size: 0.9rem;
    /* display: none; Removed to show text */
  }

  .nav-center {
    justify-content: flex-end;
  }

  .logo-image {
    width: 32px;
    height: 32px;
    margin-right: 0.5rem
  }

  nav ul {
    display: none !important;
    position: absolute;
    top: 56px;
    left: 0;
    width: 100vw;
    background: var(--menu-bg);
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid #333;
    z-index: 250;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    margin: 0;
    padding: 0;
    align-items: stretch
  }

  nav ul.show {
    display: flex !important;
    flex-direction: column
  }

  /* Mobile: fixed so navigation overlays the body content */
  nav ul {
    display: none !important;
    position: fixed;
    top: 56px;
    left: 0;
    width: 100vw;
    background: var(--menu-bg);
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid #333;
    z-index: 250;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    margin: 0;
    padding: 0;
    align-items: stretch
  }

  nav ul.show {
    display: flex !important;
    flex-direction: column
  }

  nav ul li {
    width: 100%;
    padding: 0;
    border-bottom: 1px solid #232946;
    margin: 0;
    display: block
  }

  .hamburger {
    display: flex;
    width: 40px;
    height: 40px
  }

  .hamburger span {
    width: 20px
  }

  nav a {
    color: var(--text-dark) !important;
    font-size: 0.95rem;
    padding: 0.75rem 1rem !important;
    display: block !important;
    text-align: left;
    width: 100%;
    min-height: auto;
    flex: none
  }

  nav a:not([href^="mailto"]) {
    display: block !important
  }
}

/* Landscape orientation */
@media (max-height:500px) {
  header {
    height: 48px
  }

  .logo-image {
    width: 32px;
    height: 32px
  }

  .logo-text {
    font-size: 0.95rem
  }

  nav a {
    min-height: 40px
  }
}