/* General Reset & Body */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: #1F2D3D; /* Text Main */
  background-color: #F4F7FB; /* Background */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: var(--header-offset); /* IMPORTANT: Body padding for fixed header */
  overflow-x: hidden; /* Prevent horizontal scroll on desktop */
}

/* Color Variables */
:root {
  --primary-color: #2F6BFF;
  --secondary-color: #6FA3FF;
  --button-gradient: linear-gradient(180deg, #4A8BFF 0%, #2F6BFF 100%);
  --card-bg: #FFFFFF;
  --background-color: #F4F7FB;
  --text-main: #1F2D3D;
  --border-color: #D6E2FF;
  --glow-color: #A5C4FF;
  --header-offset: 122px; /* Desktop: header-top (68px) + main-nav (52px) + 2px buffer */
}

/* Site Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  background-color: var(--card-bg); /* Use a solid color, not transparent */
  box-sizing: border-box;
  overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Header Top Section */
.header-top {
  box-sizing: border-box;
  height: 68px; /* Desktop fixed height */
  display: flex;
  align-items: center;
  background-color: var(--primary-color); /* Different from main-nav */
  color: #fff;
  overflow: hidden;
}

.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; /* Padding for logo and buttons */
}

/* Logo */
.logo {
  display: flex; /* Use flex for potential image centering, even if text */
  align-items: center;
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
  white-space: nowrap; /* Prevent logo text from wrapping */
  line-height: 1; /* Adjust line height for better vertical alignment */
}
.logo img {
  display: block;
  max-height: 60px; /* Desktop image logo max height */
  height: auto;
  width: auto;
  max-width: 280px;
  object-fit: contain;
}

/* Desktop Nav Buttons */
.desktop-nav-buttons {
  display: flex; /* Global (desktop) default */
  gap: 12px;
  align-items: center;
}

/* Mobile Nav Buttons (hidden by default on desktop) */
.mobile-nav-buttons {
  box-sizing: border-box;
  display: none; /* Global (desktop) default - IMPORTANT for the truth table */
  min-height: 48px; /* Mobile fixed height */
  background-color: #F0F0F0; /* A neutral color, distinct from main nav */
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
}

/* Main Navigation */
.main-nav {
  box-sizing: border-box;
  height: 52px; /* Desktop fixed height */
  display: flex; /* Global (desktop) default */
  align-items: center;
  background-color: var(--card-bg); /* Different from header-top */
  border-top: 1px solid var(--border-color); /* Add a subtle border */
  overflow: hidden;
}

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

.nav-link {
  color: var(--text-main);
  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,
.nav-link.active {
  color: var(--primary-color);
  background-color: #e6f0ff; /* Light hover background */
  border-radius: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 25px;
  text-decoration: none;
  font-weight: bold;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  color: #fff;
  background: var(--button-gradient); /* Button gradient */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

/* Hamburger Menu (Mobile) */
.hamburger-menu {
  display: none; /* Hidden on desktop */
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  z-index: 1001; /* Above header */
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}

.hamburger-menu span {
  display: block;
  width: 25px;
  height: 3px;
  background-color: #fff;
  transition: all 0.3s ease;
  border-radius: 2px;
}

/* Hamburger menu active state (X icon) */
.hamburger-menu.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}
.hamburger-menu.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Overlay for Mobile Menu */
.overlay {
  display: none; /* Hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 998; /* Below mobile menu, above content */
  transition: opacity 0.3s ease;
  opacity: 0;
}

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

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

  body {
    padding-top: var(--header-offset);
    overflow-x: hidden; /* Ensure body also prevents horizontal scroll */
  }
  .page-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
  .page-content {
    overflow-x: hidden;
    max-width: 100%;
  }

  /* Header Top Mobile */
  .header-top {
    height: 60px; /* Mobile fixed height */
  }

  .header-container {
    padding: 0 15px; /* Smaller padding for mobile */
    justify-content: space-between; /* Hamburger left, Logo center */
    position: relative; /* For absolute logo centering if needed */
  }

  /* Mobile Logo Centering (Method 1: Flexbox) */
  .logo {
    flex: 1 !important; /* Take available space */
    display: flex !important;
    justify-content: center !important; /* Center the logo text/image */
    align-items: center !important;
    position: absolute; /* To allow hamburger on left and logo center */
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 100px); /* Leave space for hamburger */
  }
  .logo img {
    max-height: 56px !important; /* Mobile image logo max height */
  }

  /* Hamburger Menu Mobile */
  .hamburger-menu {
    display: flex; /* Show hamburger on mobile */
    order: -1; /* Place it first (left) */
    position: relative; /* Ensure it stays in flow for its order */
    z-index: 1002; /* Above logo if needed */
  }
  .hamburger-menu span {
    background-color: #fff; /* White bars on blue background */
  }

  /* Desktop Nav Buttons (hidden on mobile) */
  .desktop-nav-buttons {
    display: none !important;
  }

  /* Mobile Nav Buttons (visible on mobile, below header-top) */
  .mobile-nav-buttons {
    display: flex !important; /* Show mobile buttons */
    min-height: 48px; /* Mobile fixed height */
    align-items: center;
    justify-content: center; /* Center buttons horizontally */
    width: 100%;
    max-width: 100%; /* Ensure it doesn't overflow */
    box-sizing: border-box;
    padding: 0 15px; /* Padding for mobile buttons */
    overflow: hidden;
    gap: 10px; /* Space between buttons */
    flex-wrap: nowrap; /* Prevent buttons from wrapping */
    background-color: #F0F0F0; /* A neutral color, distinct from main nav */
    border-bottom: 1px solid var(--border-color);
  }
  .mobile-nav-buttons .btn {
    flex: 1; /* Distribute space evenly */
    min-width: 0; /* Allow shrinking */
    max-width: calc(50% - 5px); /* Max width for two buttons with gap */
    box-sizing: border-box;
    padding: 8px 12px; /* Smaller padding */
    font-size: 13px; /* Smaller font size */
    white-space: normal; /* Allow text wrapping */
    word-wrap: break-word; /* Allow long words to break */
    overflow-wrap: break-word;
  }

  /* Main Navigation Mobile */
  .main-nav {
    display: none; /* Hidden by default, toggled by JS */
    flex-direction: column; /* Vertical layout */
    position: fixed; /* Fixed position for off-canvas menu */
    top: var(--header-offset); /* Position below header */
    left: 0;
    width: 75%; /* Adjust as needed */
    max-width: 300px; /* Max width for mobile menu */
    height: calc(100% - var(--header-offset)); /* Full height below header */
    background-color: var(--card-bg); /* Use card background for menu */
    transform: translateX(-100%); /* Off-canvas to the left */
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto; /* Scroll for long menus */
    z-index: 999; /* Above overlay */
    border-top: none; /* Remove desktop border */
  }

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

  .nav-container {
    flex-direction: column; /* Vertical links */
    padding: 20px 0;
    width: 100%;
    max-width: none; /* No max-width for mobile container */
    align-items: flex-start; /* Align links to the left */
  }

  .nav-link {
    width: 100%;
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
  }
  .nav-link:last-child {
    border-bottom: none;
  }
}

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

.footer-top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

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

.footer-col p {
  line-height: 1.8;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

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

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

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

.footer-nav a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

.footer-bottom {
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 20px;
  color: rgba(255, 255, 255, 0.7);
}

.footer-bottom p {
  margin: 0;
}

/* Footer Slot Anchors (must be present and empty) */
.footer-slot-anchor-inner {
  display: none; /* Hidden as they are just placeholders for injection */
}

/* Mobile Footer */
@media (max-width: 768px) {
  .site-footer {
    padding: 30px 15px 15px;
  }
  .footer-top-grid {
    grid-template-columns: 1fr; /* Single column layout for mobile */
    gap: 20px;
    margin-bottom: 20px;
  }
  .footer-col h3 {
    margin-bottom: 10px;
  }
  .footer-nav li {
    margin-bottom: 8px;
  }
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@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;
  }
}
