/* Site header: two-logo brand lockup + flat nav row (normal flow, not fixed) */
.site-header {
  position: relative;
  z-index: 10;
  background: #ffffff;
  border-bottom: 1px solid #e3e8f0;
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.04);
}

.site-header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 64px;
  position: relative;
}

/* Left brand: logo-main -> www.ha.edu.cn */
.brand-main {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}
.brand-main img {
  height: 40px;
  width: auto;
  display: block;
}

/* Separators flanking the nav */
.brand-sep {
  flex-shrink: 0;
  width: 1px;
  height: 36px;
  background: #d7dde8;
}

/* Flat nav — absolutely centered in the header so the two brands stay
   adjacent on the left without shifting the nav's visual center */
.site-nav {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: nowrap;
  pointer-events: auto;
}

.site-nav a {
  color: #1f2937;
  text-decoration: none;
  font-size: 17px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
}

.site-nav a:hover {
  color: #437EF7;
  background-color: rgba(67, 126, 247, 0.08);
}

.site-nav a.active {
  color: #437EF7;
  background-color: rgba(67, 126, 247, 0.1);
}

/* Right brand: logo-hernet + "Mirror" -> mirrors.ha.edu.cn */
.brand-mirror {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none !important;
  color: #0E59A6;
  font-weight: 700;
  font-size: 22px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.brand-mirror:hover {
  text-decoration: none !important;
  background-color: rgba(14, 89, 166, 0.06);
  transform: translateY(-1px);
  color: #0E59A6;
}

.brand-mirror img {
  height: 30px;
  width: auto;
  display: block;
  margin-right: -2px;
}

.brand-mirror span { line-height: 1; }

/* Tablet: compact nav spacing */
@media (max-width: 1100px) {
  .site-header-inner { gap: 14px; padding: 10px 18px; }
  .site-nav { gap: 14px; }
  .site-nav a { font-size: 16px; font-weight: 700; padding: 5px 10px; }
  .brand-main img { height: 34px; }
  .brand-mirror img { height: 26px; }
  .brand-mirror { font-size: 18px; }
}

/* Mobile: brands stay grouped and centered; nav drops to a full-width row */
@media (max-width: 768px) {
  .site-header-inner {
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px 14px;
    gap: 10px;
  }
  .site-nav {
    position: static;
    transform: none;
    order: 4;
    width: 100%;
    justify-content: center;
    overflow-x: auto;
    gap: 4px;
    padding-top: 4px;
    border-top: 1px solid #eef1f6;
  }
  .site-nav a { font-size: 15px; font-weight: 700; padding: 4px 8px; flex-shrink: 0; }
  .brand-main { order: 1; }
  .brand-sep { order: 2; height: 24px; }
  .brand-mirror { order: 3; margin-left: 0; font-size: 16px; }
  .brand-main img { height: 30px; }
  .brand-mirror img { height: 22px; }
}

@media (max-width: 480px) {
  .brand-mirror span { display: none; }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .site-header {
    background: #2C3444;
    border-bottom-color: #3b4457;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  }
  .brand-sep { background: #3b4457; }
  .brand-main img,
  .brand-mirror img {
    filter: invert(0.92) hue-rotate(180deg) brightness(1.15);
  }
  .site-nav a { color: #F9F9F9; }
  .site-nav a:hover,
  .site-nav a.active {
    color: #8BB4E8;
    background-color: rgba(139, 180, 232, 0.12);
  }
  .brand-mirror { color: #8BB4E8; }
  .brand-mirror:hover {
    color: #8BB4E8;
    background-color: rgba(139, 180, 232, 0.12);
  }
}
