html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; }

/* ---------- Header ---------- */
#site-header { background: transparent; }
#site-header.scrolled {
  background: rgba(11, 27, 43, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.45);
}
#site-header.scrolled nav { height: 4rem; }

.nav-link { position: relative; transition: color .2s ease; }
.nav-link::after {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  bottom: -6px;
  height: 2px;
  width: 0;
  background: #FF6B00;
  transition: width .25s ease;
}
.nav-link:hover { color: #fff; }
.nav-link:hover::after { width: 100%; }

/* ---------- Hero ---------- */
.hero-bg {
  background-image: url('https://images.unsplash.com/photo-1497435334941-8c899ee9e8e9?auto=format&fit=crop&w=2000&q=80');
  background-size: cover;
  background-position: center;
  background-attachment: scroll;
}
@media (min-width: 1024px) {
  .hero-bg { background-attachment: fixed; }
}

/* ---------- Stats ---------- */
.stat-card {
  background: #fff;
  border: 1px solid #E7EDF4;
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.stat-card:hover {
  transform: translateY(-4px);
  border-color: #CFE0F4;
  box-shadow: 0 18px 40px -24px rgba(10, 95, 191, 0.45);
}

/* ---------- Product cards ---------- */
.product-card {
  background: #fff;
  border: 1px solid #E7EDF4;
  border-radius: 16px;
  overflow: hidden;
  transition: transform .3s ease, box-shadow .3s ease;
}
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 50px -28px rgba(11, 27, 43, 0.5);
}
.product-card img { transition: transform .6s ease; }
.product-card:hover img { transform: scale(1.06); }

.badge-img {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  background: rgba(11, 27, 43, 0.85);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.link-more {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-top: 1.25rem;
  font-size: .875rem;
  font-weight: 600;
  color: #0A5FBF;
  transition: gap .2s ease, color .2s ease;
}
.link-more:hover { gap: .7rem; color: #063A78; }

/* ---------- Case cards ---------- */
.case-card {
  background: #fff;
  border: 1px solid #E7EDF4;
  border-radius: 16px;
  overflow: hidden;
  transition: transform .3s ease, box-shadow .3s ease;
}
.case-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 50px -28px rgba(11, 27, 43, 0.5);
}
.case-card img { transition: transform .6s ease; }
.case-card:hover img { transform: scale(1.05); }

.case-country {
  position: absolute;
  bottom: 12px;
  inset-inline-start: 12px;
  background: #FF6B00;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  box-shadow: 0 8px 20px -8px rgba(255, 107, 0, 0.8);
}

/* ---------- Partner logos ---------- */
.partner-logo {
  display: grid;
  place-items: center;
  height: 56px;
  border: 1px dashed #CBD5E1;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #64748B;
  filter: grayscale(100%);
  transition: filter .25s ease, color .25s ease, border-color .25s ease;
}
.partner-logo:hover {
  filter: grayscale(0);
  color: #0A5FBF;
  border-color: #9FC2E8;
}

/* ---------- Form ---------- */
#quote-form input:invalid:not(:placeholder-shown),
#quote-form textarea:invalid:not(:placeholder-shown) {
  border-color: #F87171;
}

/* ---------- RTL ---------- */
html[dir='rtl'] body { direction: rtl; }
html[dir='rtl'] .nav-link::after { inset-inline-start: 0; }
html[dir='rtl'] .hero-bg { background-position: center; }
html[dir='rtl'] .link-more svg,
html[dir='rtl'] .link-more span:last-child { transform: scaleX(-1); }

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #F1F5F9; }
::-webkit-scrollbar-thumb { background: #94A3B8; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #64748B; }

/* ==========================================================
   屏幕比例适配（竖屏 / 横屏 / 超宽屏）
   ========================================================== */

/* ---------- 使用 clamp() 的自适应字号层级 ---------- */
#home h1 {
  font-size: clamp(1.75rem, 6.2vw, 3.75rem) !important;
  line-height: 1.12 !important;
  overflow-wrap: break-word;
  word-break: break-word;
}

#about h2,
#products h2,
#projects h2,
#contact h2 {
  font-size: clamp(1.5rem, 4.4vw, 2.5rem) !important;
  line-height: 1.2 !important;
  overflow-wrap: break-word;
}

#home p,
#about p,
#products p,
#projects p,
#contact p {
  font-size: clamp(0.875rem, 1.6vw, 1.125rem) !important;
}

.stat-card p:first-child {
  font-size: clamp(1.5rem, 3.6vw, 2.25rem) !important;
  line-height: 1.1 !important;
}

.product-card h3,
.case-card h3 {
  font-size: clamp(1rem, 2.2vw, 1.125rem) !important;
  line-height: 1.35 !important;
  overflow-wrap: break-word;
}

/* 按钮与导航永不裁切文字 */
#site-header a,
#site-header button,
#home a,
#about a,
#quote-form button,
#modal-close {
  white-space: normal;
  overflow-wrap: break-word;
  text-align: center;
  line-height: 1.3;
}

/* ---------- 竖屏（Portrait）：网格强制单列 ---------- */
@media (orientation: portrait) and (max-width: 767px) {
  #products .grid,
  #projects .grid {
    grid-template-columns: 1fr !important;
  }
  .stat-card {
    padding: 1.25rem 1rem;
  }
}

/* 平板竖屏：产品两列、案例单列，避免挤压 */
@media (orientation: portrait) and (min-width: 768px) and (max-width: 1023px) {
  #products .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  #projects .grid {
    grid-template-columns: 1fr !important;
  }
}

/* ---------- 横屏（Landscape）：压缩 Hero 高度，首屏可见导航 + 标题 + CTA ---------- */
@media (orientation: landscape) and (max-height: 900px) {
  #home {
    min-height: 60vh !important;
    padding-top: 0 !important;
  }
  #home .max-w-8xl {
    padding-top: 5.5rem !important;
    padding-bottom: 2rem !important;
  }
  #home h1 {
    font-size: clamp(1.5rem, 4.2vw, 2.75rem) !important;
  }
  #home p {
    font-size: clamp(0.8125rem, 1.35vw, 1rem) !important;
    max-width: 42rem;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  #home .mt-10 {
    margin-top: 1.25rem !important;
  }
  #home .mt-12 {
    margin-top: 1.25rem !important;
  }
  #home .mt-6 {
    margin-top: 0.75rem !important;
  }
  #home a {
    padding-top: 0.7rem !important;
    padding-bottom: 0.7rem !important;
  }
  #site-header nav {
    height: 3.5rem !important;
  }
}

/* 手机横屏（高度很小的横屏）：进一步收紧 */
@media (orientation: landscape) and (max-height: 480px) {
  #home {
    min-height: 100svh !important;
    align-items: flex-start !important;
  }
  #home .max-w-8xl {
    padding-top: 4.25rem !important;
    padding-bottom: 1rem !important;
  }
  #home h1 {
    font-size: clamp(1.35rem, 3.6vw, 2rem) !important;
  }
  #home p {
    -webkit-line-clamp: 2;
    font-size: 0.8125rem !important;
  }
  #home .mt-10,
  #home .mt-12 {
    margin-top: 0.75rem !important;
  }
  #site-header nav {
    height: 3.25rem !important;
  }
}

/* ---------- 超宽屏（>=1920px）：限制阅读行长 ---------- */
@media (min-width: 1920px) {
  #home h1 {
    font-size: clamp(3rem, 3.4vw, 4.25rem) !important;
  }
  #about p,
  #products p,
  #projects p,
  #contact p {
    max-width: 60ch;
  }
}

/* ---------- 法语（及长文案语言）排版容错 ---------- */
body.lang-long #site-header .nav-link {
  letter-spacing: -0.01em;
}
body.lang-long #site-header ul {
  gap: 1.25rem;
}
body.lang-long #site-header a,
body.lang-long #home a {
  white-space: normal;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  max-width: 100%;
}
body.lang-long .product-card h3,
body.lang-long .case-card h3 {
  line-height: 1.4 !important;
  hyphens: auto;
}
body.lang-long .badge-img,
body.lang-long .case-country {
  max-width: calc(100% - 24px);
  white-space: normal;
  line-height: 1.25;
}
body.lang-long #lang-menu {
  width: 12rem;
}
body.lang-long dl .text-end {
  max-width: 58%;
  overflow-wrap: break-word;
}

/* 横屏时导航紧凑排布 */
@media (orientation: landscape) and (max-height: 900px) {
  body.lang-long #site-header ul {
    gap: 0.9rem;
  }
  body.lang-long #site-header .nav-link {
    font-size: 0.8125rem;
  }
}

