/* ===== CSS Variables and Root Settings ===== */
:root {
  --theme-color: #87ceeb; /* Light Sky Blue */
  --theme-color-dark: #5f9ea0; /* Cadet Blue */
  --text-color-dark: #2c3e50; /* Darker text for contrast */
  --card-shadow: rgba(0, 0, 0, 0.1);
  --card-hover-shadow: rgba(135, 206, 235, 0.25); /* Shadow based on theme color */
}

/* ===== Global Styles ===== */
* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: 'Segoe UI', 'Roboto', 'Calibri', sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background-color: #f4f7f6;
  padding-top: 56px; /* Navbar height */
  overflow-x: hidden;
  overflow-y: auto;
  height: 100%;
  min-height: 100vh;
  position: relative;
}

/* ===== Scrollbar Styles ===== */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ===== Loader Animation ===== */
.loader-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.loader-gif {
  width: 150px;
  height: 150px;
}

/* ===== Navigation Bar Styles ===== */
.navbar-nav .nav-link {
  font-size: 1rem !important;
  padding: 0.5rem 0.75rem !important;
}

.navbar-brand {
  font-size: 1.25rem !important;
}

.navbar-collapse {
  overflow: visible !important;
}

.navbar {
  overflow: visible !important;
}

/* ===== Main Layout ===== */
.content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  overflow: visible;
}

/* ===== First Block (Hero Section) ===== */
#first-block {
  margin: 10vh 0 30vh 0;
  width: 80%;
  padding: 40px;
  text-align: center;
}

#first-block h2,
#first-block p {
  color: var(--text-color-dark);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1s ease-out, transform 1s ease-out;
}

#first-block h2 {
  font-size: 3rem;
  font-weight: 700;
  font-style: normal;
}

#first-block p {
  font-size: 1.5rem;
  transition-delay: 0.5s;
}

.fade-in {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* ===== Card Styles ===== */
.card-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-top: 50px;
  align-items: center;
  gap: 30px;
}

.card {
  width: 90%;
  max-width: 1000px;
  background-color: #ffffff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 6px var(--card-shadow);
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 17px var(--card-hover-shadow);
}

.card-content {
  display: flex;
  align-items: center;
}

.card-content-reverse {
  display: flex;
  align-items: center;
  flex-direction: row-reverse;
}

.card-image {
  width: 300px;
  height: 300px;
  object-fit: cover;
}

.card-text {
  flex: 1;
  padding: 30px;
}

.card-preview {
  font-size: 1.8rem;
  color: var(--text-color-dark);
  margin: 0;
  font-weight: 600;
}

.card-full-content {
  display: none;
  font-size: 1.1rem;
  color: #666;
  margin-top: 15px;
}

.card.expanded .card-full-content {
  display: block;
}

/* ===== Fade-in Section Styles ===== */
.fade-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  margin-top: 15vh;
  width: 100%;
  display: flex;
  justify-content: center;
}

.fade-section.active {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Additional Content Section ===== */
.additional-content {
  width: 90%;
  max-width: 1000px;
  margin-bottom: 30px;
  background-color: #ffffff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 6px var(--card-shadow);
  padding: 30px;
  display: flex;
  align-items: center;
}

.additional-content-text {
  flex: 1;
  padding: 30px;
}

.additional-content-text h3 {
  font-size: 2rem;
  color: var(--text-color-dark);
  margin-top: 0;
}

.additional-content-image {
  width: 40%;
  height: auto;
  object-fit: contain;
  margin: 40px;
}

.read-more-wrapper {
  margin-top: 20px;
}

.read-more-button {
  padding: 10px 20px;
  background-color: var(--theme-color);
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-size: 1rem;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.read-more-button:hover {
  background-color: var(--theme-color-dark);
  color: white;
}

/* ===== A.P.E. Solution Section ===== */
.ape-solution {
  width: 90%;
  max-width: 1000px;
  margin-bottom: 30px;
  background-color: #ffffff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 6px var(--card-shadow);
  padding: 30px;
  text-align: center;
}

.ape-solution h2 {
  font-size: 2.5rem;
  color: var(--text-color-dark);
  margin-bottom: 40px;
}

.ape-solution h2 span {
  color: var(--theme-color);
}

.ape-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 30px;
  text-align: left;
}

.ape-icon {
  width: 150px;
  height: 150px;
  margin-right: 30px;
}

.ape-text {
  flex: 1;
}

.ape-title {
  font-size: 1.5rem;
  color: var(--text-color-dark);
  margin: 0 0 5px 0;
}

.highlight-letter {
  color: var(--theme-color);
  font-size: 1.5em;
  font-weight: 700;
}

.ape-description {
  font-size: 1.1rem;
  color: #666;
  margin: 0;
}

/* ===== Last Block (Footer Section) ===== */
#last-block {
  padding: 40px;
  text-align: center;
  margin-top: 15vh;
  margin-bottom: 15vh;
}

#last-block h4,
#last-block h2 {
  color: var(--text-color-dark);
  font-style: italic;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#last-block h4 {
  font-size: 1.5rem;
}

#last-block h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-top: 2rem;
  color: var(--theme-color-dark);
}

/* ===== Scroll Progress Ring ===== */
#scroll-progress-container {
  position: fixed;
  bottom: 25px;
  left: 30px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

#scroll-progress-container.visible {
  opacity: 1;
  visibility: visible;
}

.progress-ring-bg,
.progress-ring-bar {
  fill: transparent;
  stroke-width: 6;
}

.progress-ring-bg {
  stroke: #e6e6e6;
}

.progress-ring-bar {
  stroke: var(--theme-color);
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.1s linear;
}

/* ===== 高分辨率显示修复（增强版） ===== */
@media screen and (min-resolution: 96dpi) {
  html, body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: 100vh !important;
    max-height: none !important;
  }
  
  .container-fluid, .container {
    overflow: visible !important;
    max-height: none !important;
  }
  
  /* 修复导航栏在高分辨率下的问题 */
  .navbar-collapse {
    overflow: visible !important;
    max-height: none !important;
  }
  
  .dropdown-menu {
    position: absolute !important;
    max-height: none !important;
  }
}


/* ===== 修复125%缩放下的问题 ===== */
@media screen and (min-resolution: 120dpi) {
  html {
    zoom: 1;
    transform: scale(1);
    transform-origin: 0 0;
  }
  
  body {
    font-size: 14px; /* 略微减小字体防止溢出 */
    overflow-y: scroll !important;
  }
  
  .content-wrapper {
    max-width: 1100px; /* 减小最大宽度适应缩放 */
  }
  
  #first-block h2 {
    font-size: 2.5rem; /* 减小标题字体 */
  }
  
  #first-block p {
    font-size: 1.3rem; /* 减小段落字体 */
  }
}

/* ===== 强制修复导航栏问题 ===== */
.navbar {
  overflow: visible !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1030 !important;
}

.dropdown-menu.show {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

/* 防止下拉菜单自动展开 */
.dropdown-menu:not(.show) {
  display: none !important;
}

/* ===== Responsive Design ===== */
@media (max-width: 1200px) {
  .navbar-nav .nav-link {
    font-size: 0.9rem !important;
    padding: 0.4rem 0.6rem !important;
  }
  
  .navbar-brand {
    font-size: 1.1rem !important;
  }
}

@media (max-width: 992px) {
  .navbar-nav .nav-link {
    font-size: 0.85rem !important;
    padding: 0.3rem 0.5rem !important;
  }
}

@media (max-width: 768px) {
  #first-block h2 { 
    font-size: 2.5rem; 
  }
  
  #first-block p { 
    font-size: 1.2rem; 
  }
  
  .card-content, 
  .card-content-reverse {
    flex-direction: column;
  }

  .card-content-reverse {
    flex-direction: column-reverse;
  }

  .card-image {
    width: 100%;
    height: 200px;
  }
  
  .additional-content {
    flex-direction: column;
  }
  
  .additional-content-image {
    width: 80%;
    margin: 20px 0;
  }

  .ape-row {
    flex-direction: column;
    text-align: center;
  }
  
  .ape-icon {
    margin-right: 0;
    margin-bottom: 15px;
  }
}