:root {
  --header-offset: 122px;
}

body {
  padding-top: var(--header-offset);
  margin: 0;
  font-family: Arial, sans-serif;
  color: #333333;
  background-color: #F5F7FA;
  overflow-x: hidden;
}

/* Base styles for header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.header-top {
  background-color: #222222; /* Dark grey for contrast */
  min-height: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.header-container {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.logo {
  color: #FFFFFF;
  font-size: 24px;
  font-weight: bold;
  text-decoration: none;
  display: block;
  padding: 5px 0;
  line-height: 1;
}

.logo img {
  display: block;
  max-height: 60px;
  height: auto;
  width: auto;
  max-width: 280px;
  object-fit: contain;
}

.desktop-nav-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.mobile-nav-buttons {
  box-sizing: border-box;
  display: none; /* Hidden by default on desktop */
  min-height: 48px;
  background-color: #F5F7FA; /* Light background for mobile buttons */
  padding: 0 20px; /* Consistent padding */
}

.btn {
  padding: 10px 15px;
  border-radius: 5px;
  color: #FFFFFF;
  text-decoration: none;
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.3s ease;
  border: none;
  display: inline-block;
}

.btn-register, .btn-download {
  background: linear-gradient(180deg, #FF5A4F 0%, #E53935 100%);
}

.btn-register:hover, .btn-download:hover {
  opacity: 0.9;
}

.main-nav {
  background-color: #FFFFFF; /* White, contrasting with header-top */
  min-height: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.nav-container {
  box-sizing: border-box;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 0 20px;
}

.nav-link {
  color: #333333;
  text-decoration: none;
  padding: 10px 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.3s ease, background-color 0.3s ease;
}

.nav-link:hover {
  color: #E53935;
}

.hamburger-menu {
  display: none; /* Hidden by default on desktop */
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 1001;
}

.hamburger-menu::before, .hamburger-menu::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 3px;
  background-color: #FFFFFF;
  left: 0;
  transition: all 0.3s ease;
}

.hamburger-menu::before {
  top: 0;
}

.hamburger-menu::after {
  bottom: 0;
}

.hamburger-menu.active::before {
  transform: rotate(45deg);
  top: 10px;
}

.hamburger-menu.active::after {
  transform: rotate(-45deg);
  bottom: 11px;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

/* Footer styles */
.site-footer {
  background-color: #222222;
  color: #E0E0E0;
  padding: 40px 0 20px;
  font-size: 14px;
  box-sizing: border-box;
}

.footer-slot-anchor-top {
  max-width: 1200px;
  margin: 0 auto 20px;
  padding: 0 20px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-col h3 {
  color: #FFFFFF;
  font-size: 16px;
  margin-bottom: 15px;
}

.footer-logo {
  color: #FF5A4F;
  font-size: 20px;
  font-weight: bold;
  text-decoration: none;
  display: block;
  margin-bottom: 15px;
}

.footer-description {
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.footer-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav li {
  margin-bottom: 10px;
}

.footer-nav a {
  color: #E0E0E0;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-nav a:hover {
  color: #FF5A4F;
}

.footer-slot-anchor-inner {
  margin-top: 20px; /* Placeholder for injected content */
}

.footer-slot-anchor-mid-1, .footer-slot-anchor-mid-2,
.footer-slot-anchor-mid-r1-c1, .footer-slot-anchor-mid-r1-c2, .footer-slot-anchor-mid-r1-c3, .footer-slot-anchor-mid-r1-c4,
.footer-slot-anchor-mid-r2-c1, .footer-slot-anchor-mid-r2-c2, .footer-slot-anchor-mid-r2-c3, .footer-slot-anchor-mid-r2-c4,
.footer-slot-anchor-bottom-1 {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 20px;
}

.footer-bottom {
  text-align: center;
  margin-top: 40px;
  padding: 20px;
  border-top: 1px solid #333333;
  color: #999999;
}

.footer-bottom p {
  margin: 0;
}

/* Mobile styles */
@media (max-width: 768px) {
  :root {
    --header-offset: 110px;
  }

  .header-top {
    min-height: 60px !important;
    height: 60px !important;
    padding: 0 15px; /* Adjust padding for mobile */
  }

  .header-container {
    width: 100%;
    max-width: none;
    padding: 0;
    justify-content: space-between;
  }

  .logo {
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    font-size: 20px;
  }

  .logo img {
    max-height: 56px !important;
  }

  .desktop-nav-buttons {
    display: none !important;
  }

  .mobile-nav-buttons {
    display: flex !important;
    min-height: 48px;
    align-items: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 15px;
    overflow: hidden;
    gap: 10px;
    flex-wrap: nowrap;
    justify-content: center;
    background-color: #F5F7FA; /* Match body background */
  }

  .mobile-nav-buttons .btn {
    flex: 1;
    min-width: 0;
    max-width: calc(50% - 5px);
    box-sizing: border-box;
    padding: 8px 12px;
    font-size: 13px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .hamburger-menu {
    display: block;
    position: relative;
    left: 0;
    top: 0;
    transform: none;
    z-index: 1001;
  }

  .hamburger-menu::before, .hamburger-menu::after {
    background-color: #FFFFFF;
  }

  .main-nav {
    display: none; /* Hidden by default */
    flex-direction: column;
    position: fixed;
    top: 0; /* Will be adjusted by JS to below header-top + mobile-nav-buttons */
    left: 0;
    width: 70%; /* Adjust as needed */
    height: 100%; /* Will be adjusted by JS to fill remaining height */
    background-color: #FFFFFF;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    transform: translateX(-100%); /* Slide out from left */
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    padding-top: 20px; /* Padding inside the menu */
    min-height: unset !important;
    height: unset !important;
  }

  .main-nav.active {
    display: flex; /* Show menu */
    transform: translateX(0); /* Slide in */
  }

  .nav-container {
    flex-direction: column;
    align-items: flex-start;
    padding: 0 20px;
    height: auto;
  }

  .nav-link {
    width: 100%;
    padding: 12px 0;
    border-bottom: 1px solid #E0E0E0;
  }

  .nav-link:last-child {
    border-bottom: none;
  }

  .overlay.active {
    display: block;
  }

  .site-footer {
    padding: 30px 0 15px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    padding: 0 15px;
  }

  .footer-col {
    margin-bottom: 20px;
  }

  .footer-bottom {
    margin-top: 20px;
    padding: 15px;
  }

  .page-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
  .page-content {
    overflow-x: hidden;
    max-width: 100%;
  }
  body {
    overflow-x: hidden;
  }
}

/* WCAG AA contrast check for text on backgrounds */
.header-top .logo, .header-top .hamburger-menu::before, .header-top .hamburger-menu::after {
  color: #FFFFFF; /* Ensures white text on #222222 background has good contrast */
}

.main-nav .nav-link {
  color: #333333; /* Ensures dark text on #FFFFFF background has good contrast */
}

.btn {
  color: #FFFFFF; /* Ensures white text on gradient button has good contrast */
}

.site-footer h3, .site-footer .footer-logo {
  color: #FFFFFF; /* Ensures white text on #222222 background has good contrast */
}

.site-footer .footer-description, .site-footer .footer-nav a {
  color: #E0E0E0; /* Ensures light grey text on #222222 background has good contrast */
}

.footer-bottom p {
  color: #999999; /* Ensures light grey text on #222222 background has good contrast */
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@media (max-width: 768px) {
  .page-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
  .page-content {
    overflow-x: hidden;
    max-width: 100%;
  }
  body {
    overflow-x: hidden;
  }
}
