:root {
  --primary-color: #2F6BFF;
  --secondary-color: #6FA3FF;
  --header-top-bg: #204BCC; /* Darker blue for header-top */
  --main-nav-bg: #6FA3FF; /* Lighter blue for main-nav */
  --button-gradient: linear-gradient(180deg, #4A8BFF 0%, #2F6BFF 100%);
  --card-bg: #FFFFFF;
  --body-bg: #F4F7FB;
  --text-main: #1F2D3D;
  --border-color: #D6E2FF;
  --glow-color: #A5C4FF;
  --footer-bg: #E8EEF7; /* Slightly darker than body-bg */

  /* Header offset calculation (Desktop) */
  --header-offset: 122px; /* 68px (header-top) + 52px (main-nav) + 2px buffer */
}

body {
  font-family: 'Arial', sans-serif;
  margin: 0;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--body-bg);
  padding-top: var(--header-offset); /* Important: Body padding for fixed header */
  overflow-x: hidden; /* Prevent horizontal scroll on desktop too */
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  background-color: transparent; /* Managed by children */
}

.header-top {
  box-sizing: border-box;
  min-height: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background-color: var(--header-top-bg);
  width: 100%;
  color: #fff;
}

.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 {
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
  display: block; /* Ensure logo is visible */
  flex-shrink: 0;
  white-space: nowrap;
}

.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;
  flex-shrink: 0;
}

.mobile-nav-buttons {
  box-sizing: border-box;
  display: none; /* Hidden by default on desktop */
  min-height: 48px;
  background-color: var(--card-bg); /* Use a light background for mobile buttons */
  width: 100%;
}

.hamburger-menu {
  display: none; /* Hidden on desktop */
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  position: relative;
  z-index: 1001; /* Above header */
  flex-shrink: 0;
}

.hamburger-menu .bar {
  display: block;
  width: 25px;
  height: 3px;
  background-color: #fff;
  margin: 5px 0;
  transition: all 0.3s ease;
}

.hamburger-menu.active .bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger-menu.active .bar:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.active .bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.main-nav {
  box-sizing: border-box;
  min-height: 52px;
  height: 52px;
  display: flex; /* Desktop default: flex */
  align-items: center;
  overflow: hidden;
  background-color: var(--main-nav-bg);
  width: 100%;
}

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

.nav-link {
  color: #fff;
  text-decoration: none;
  padding: 8px 15px;
  font-weight: bold;
  transition: background-color 0.3s ease;
  white-space: nowrap; /* Prevent wrapping on desktop */
  font-size: 15px;
}

.nav-link:hover, .nav-link.active {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  color: #fff;
  background: var(--button-gradient);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  border: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

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

.overlay.active {
  display: block;
  opacity: 1;
}

/* Footer Styles */
.site-footer {
  background-color: var(--footer-bg);
  color: var(--text-main);
  padding: 40px 20px 20px;
  font-size: 14px;
}

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

.footer-col h3 {
  font-size: 18px;
  margin-bottom: 15px;
  color: var(--primary-color);
}

.footer-col .footer-logo {
  font-size: 22px;
  font-weight: bold;
  color: var(--primary-color);
  text-decoration: none;
  margin-bottom: 15px;
  display: block;
}

.footer-col .footer-description {
  margin-bottom: 15px;
  line-height: 1.8;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

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

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

.footer-nav a {
  color: var(--text-main);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-nav a:hover {
  color: var(--primary-color);
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  margin-top: 20px;
  color: #666;
}

/* Slot anchors - must be visible */
.footer-slot-anchor-inner {
  min-height: 1px; /* Ensure visibility for layout */
}

/* Mobile styles */
@media (max-width: 768px) {
  :root {
    /* Header offset calculation (Mobile) */
    --header-offset: 110px; /* 60px (header-top) + 48px (mobile-nav-buttons) + 2px buffer */
  }

  /* Header */
  .header-top {
    min-height: 60px !important;
    height: 60px !important;
    justify-content: space-between; /* To push hamburger left and leave space for logo */
    padding: 0 15px; /* Padding on the header-top itself */
    position: relative; /* For absolute positioning of logo */
  }

  .header-container {
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    padding: 0; /* No padding, header-top handles it */
    display: flex;
    justify-content: flex-end; /* Push desktop buttons (hidden) to the right */
    align-items: center;
  }

  .hamburger-menu {
    display: block;
    position: relative;
    z-index: 1001;
  }

  .hamburger-menu .bar {
    background-color: #fff;
  }

  /* Mobile logo centering (Method 1: flexbox + !important) */
  .logo {
    position: absolute !important; /* Absolute positioning for true centering */
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    max-width: calc(100% - 100px); /* Ensure space for hamburger */
    height: 100%; /* Fill header-top height */
    text-align: center; /* For text logos */
    z-index: 1; /* Below hamburger */
  }

  .logo img {
    max-height: 56px !important; /* Mobile specific logo height */
    max-width: 100%;
    height: auto;
  }
  
  /* Hide desktop buttons */
  .desktop-nav-buttons {
    display: none !important;
  }

  /* Show and style mobile buttons */
  .mobile-nav-buttons {
    display: flex !important; /* Show mobile buttons */
    min-height: 48px;
    align-items: center;
    justify-content: center; /* Center buttons if only one */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 15px; /* Consistent padding */
    overflow: hidden;
    gap: 10px;
    flex-wrap: nowrap;
    background-color: var(--card-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  }

  .mobile-nav-buttons .btn {
    flex: 1;
    min-width: 0;
    max-width: calc(50% - 5px); /* For two buttons with 10px gap */
    box-sizing: border-box;
    padding: 8px 12px;
    font-size: 13px;
    white-space: normal; /* Allow text to wrap */
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Main Navigation (Hamburger Menu Content) */
  .main-nav {
    display: none; /* Hidden by default on mobile */
    flex-direction: column; /* Vertical menu */
    position: fixed; /* Fixed position for overlay menu */
    top: var(--header-offset); /* Below fixed header and mobile buttons */
    left: 0;
    width: 80%; /* Menu width */
    max-width: 300px;
    height: calc(100% - var(--header-offset)); /* Full height below header */
    background-color: var(--header-top-bg);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    transform: translateX(-100%); /* Off-screen by default */
    transition: transform 0.3s ease;
    overflow-y: auto; /* Scrollable if many links */
    z-index: 1000;
    padding: 20px 0;
  }

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

  .nav-container {
    flex-direction: column;
    padding: 0;
    gap: 0;
    width: 100%;
    max-width: none;
    align-items: flex-start;
  }

  .nav-link {
    width: 100%;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    text-align: left;
  }

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

  .overlay.active {
    display: block;
    z-index: 998;
  }

  /* Footer */
  .site-footer {
    padding: 30px 15px 15px;
  }

  .footer-top-grid {
    grid-template-columns: 1fr; /* Single column on mobile */
  }
  .footer-col {
    margin-bottom: 20px;
  }
  .footer-col:last-of-type {
    margin-bottom: 0;
  }

  /* Ensure page content images don't overflow */
  .page-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
  .page-content {
    overflow-x: hidden;
    max-width: 100%;
  }
  body {
    overflow-x: hidden;
  }
}

/* No-scroll for body when menu is open */
body.no-scroll {
  overflow: hidden;
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@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;
  }
}
