/* ==========================================================================
   典元機械 (Dean Yuan Machinery Ltd.) 現代工業風格樣式表 (極致 RWD 手機版完美適配版)
   ========================================================================== */

:root {
  --primary-color: #0f2b48;
  --primary-light: #1b4974;
  --accent-color: #d93829;
  --accent-hover: #b82a1d;
  --secondary-color: #2b394a;
  --bg-light: #f8fafc;
  --bg-surface: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #475569;
  --text-light: #64748b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 6px 18px rgba(15,43,72,0.09);
  --shadow-lg: 0 12px 30px rgba(15,43,72,0.14);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --transition: all 0.25s ease-in-out;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden; /* 徹底杜絕手機版左右滑動白邊 */
  position: relative;
}

body {
  font-family: var(--font-sans);
  color: var(--text-main);
  background-color: var(--bg-light);
  line-height: 1.75;
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 容器與佈局 */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 80px 0;
  width: 100%;
  overflow-x: hidden;
}

.section-bg {
  background-color: var(--bg-surface);
}

.text-center { text-align: center; }
.text-accent { color: var(--accent-color); }
.text-muted { color: var(--text-muted); }

/* 頂部快速資訊列 (Topbar) */
.topbar {
  background-color: #081726;
  color: #cbd5e1;
  font-size: 15px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.topbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.topbar-info {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.topbar-info span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.lang-switch {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.lang-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.25);
  color: #cbd5e1;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}
.lang-btn.active, .lang-btn:hover {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;
}

/* 主導覽列 Header */
.header {
  background-color: rgba(255,255,255,0.98);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border-color);
}
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 90px;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
}
.logo-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--accent-color), #f05342);
  color: white;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 26px;
  box-shadow: 0 4px 12px rgba(217, 56, 41, 0.35);
  flex-shrink: 0;
}
.brand-text h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary-color);
  letter-spacing: 0.5px;
  line-height: 1.2;
}
.brand-text span {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 1.2px;
  font-weight: 600;
  display: block;
  margin-top: 2px;
}

.nav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 36px;
}
.nav-link {
  font-weight: 700;
  color: var(--secondary-color);
  font-size: 17px;
  position: relative;
  padding: 8px 0;
}
.nav-link:hover, .nav-link.active {
  color: var(--accent-color);
}
.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--accent-color);
  border-radius: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 手機版漢堡選單切換按鈕 */
.mobile-nav-toggle {
  display: none;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--primary-color);
  padding: 0;
  transition: var(--transition);
  text-align: center;
}
.mobile-nav-toggle:hover, .mobile-nav-toggle:active {
  background-color: #e2e8f0;
  color: var(--accent-color);
}

/* 手機版下拉選單 (優雅滑出面板) */
.mobile-nav-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: #ffffff;
  box-shadow: 0 16px 32px rgba(15, 43, 72, 0.18);
  border-top: 1px solid var(--border-color);
  border-bottom: 3px solid var(--accent-color);
  padding: 20px 24px 28px;
  z-index: 1001;
  animation: slideDown 0.25s ease-out forwards;
}
.mobile-nav-menu.active {
  display: block;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.mobile-nav-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.mobile-nav-menu li {
  border-bottom: 1px solid #f1f5f9;
}
.mobile-nav-menu li:last-child {
  border-bottom: none;
}
.mobile-nav-menu a {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
  transition: var(--transition);
}
.mobile-nav-menu a:hover, .mobile-nav-menu a.active {
  color: var(--accent-color);
  padding-left: 8px;
}
.mobile-nav-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mobile-lang-switch {
  display: flex;
  gap: 10px;
}
.mobile-lang-switch .lang-btn {
  flex: 1;
  padding: 8px;
  font-size: 14px;
  color: var(--secondary-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-light);
}
.mobile-lang-switch .lang-btn.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* 按鈕系列 (大氣清晰) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 26px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  line-height: 1.2;
  text-align: center;
}
.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
}
.btn-primary {
  background-color: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(217, 56, 41, 0.28);
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(217, 56, 41, 0.4);
}
.btn-secondary {
  background-color: var(--primary-color);
  color: #ffffff;
}
.btn-secondary:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
}
.btn-outline {
  background-color: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}
.btn-outline:hover {
  background-color: var(--primary-color);
  color: #ffffff;
}

/* Hero 旗艦形象區 */
.hero {
  background: linear-gradient(135deg, #091a2e 0%, #153b61 100%);
  color: #ffffff;
  padding: 90px 0 110px;
  position: relative;
  overflow: hidden;
  width: 100%;
}
.hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(217,56,41,0.18) 0%, rgba(255,255,255,0) 70%);
  pointer-events: none;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
  align-items: center;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 24px;
  color: #e2e8f0;
}
.hero-tag .dot {
  width: 10px;
  height: 10px;
  background-color: #22c55e;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
.hero-title {
  font-size: 50px;
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
  word-break: break-word;
}
.hero-desc {
  font-size: 20px;
  color: #cbd5e1;
  line-height: 1.8;
  margin-bottom: 36px;
  max-width: 620px;
}
.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid rgba(255,255,255,0.18);
}
.stat-item h3 {
  font-size: 38px;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 4px;
}
.stat-item p {
  font-size: 14px;
  color: #cbd5e1;
  font-weight: 500;
}

/* 視覺卡片區 (Hero Visual Card) */
.hero-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  padding: 34px;
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: relative;
  width: 100%;
}
.hero-card h4 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 14px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.badge-tech {
  background-color: var(--accent-color);
  color: #fff;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 800;
}
.feature-list {
  list-style: none;
  margin: 20px 0;
}
.feature-list li {
  padding: 10px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  color: #f1f5f9;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-weight: 500;
}
.feature-list li:last-child {
  border-bottom: none;
}
.check-icon {
  color: #4ade80;
  font-weight: 900;
  font-size: 18px;
  flex-shrink: 0;
}

/* 區塊標題 */
.section-header {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 50px;
  padding: 0 10px;
}
.section-subtitle {
  color: var(--accent-color);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
}
.section-title {
  font-size: 38px;
  font-weight: 900;
  color: var(--primary-color);
  margin-bottom: 16px;
  letter-spacing: -0.5px;
  line-height: 1.3;
}
.section-desc {
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1.7;
}

/* 核心優勢網格 (Why Dean Yuan) */
.grid-features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.feature-box {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  padding: 32px 24px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  position: relative;
  width: 100%;
}
.feature-box:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}
.feature-box-icon {
  width: 56px;
  height: 56px;
  background-color: #f1f5f9;
  color: var(--accent-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 18px;
}
.feature-box h4 {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 10px;
}
.feature-box p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
}

/* 產品展示網格 (Product Grid) */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.product-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  width: 100%;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #94a3b8;
}
.product-img-wrapper {
  background: linear-gradient(135deg, #eef2f6 0%, #e2e8f0 100%);
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 16px;
}
.machine-visual {
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, #334155 0%, #0f172a 100%);
  border-radius: 50%;
  border: 4px solid #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 10px 20px rgba(0,0,0,0.18);
  transition: var(--transition);
}
.product-card:hover .machine-visual {
  transform: scale(1.05) rotate(2deg);
}
.product-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background-color: var(--accent-color);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 4px;
}
.product-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.product-category {
  font-size: 13px;
  color: var(--accent-color);
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.product-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 10px;
  line-height: 1.4;
}
.product-summary {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 18px;
  flex-grow: 1;
}
.product-specs-mini {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.product-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* 產業應用卡片 */
.app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.app-card {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 30px 24px;
  transition: var(--transition);
  width: 100%;
}
.app-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-color);
  box-shadow: var(--shadow-md);
}
.app-icon {
  font-size: 38px;
  margin-bottom: 16px;
}
.app-card h4 {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 8px;
}
.app-card p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* 頁尾 Footer */
.footer {
  background-color: #081726;
  color: #cbd5e1;
  padding: 70px 0 30px;
  font-size: 15px;
  border-top: 4px solid var(--accent-color);
  width: 100%;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.3fr;
  gap: 36px;
  margin-bottom: 40px;
}
.footer-col h5 {
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 18px;
}
.footer-links {
  list-style: none;
}
.footer-links li {
  margin-bottom: 10px;
}
.footer-links a:hover {
  color: #ffffff;
  padding-left: 6px;
}
.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  line-height: 1.6;
}
.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #94a3b8;
  flex-wrap: wrap;
  gap: 10px;
}

/* 動畫效果 */
@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* ==========================================================================
   響應式排版 (RWD Breakpoints: 平板與手機版全方位校驗)
   ========================================================================== */

@media (max-width: 992px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .grid-features { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .app-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .navbar { height: 80px; }
  .hero-title { font-size: 40px; }
}

@media (max-width: 768px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .section { padding: 45px 0; }
  
  /* 頂部列與主選單手機適配 */
  .topbar { display: none; }
  .nav-menu { display: none; }
  .nav-actions { display: none; } /* 手機版將 CTA 整合入抽屜選單，保留版面給 Logo 與漢堡鈕 */
  .mobile-nav-toggle { display: flex; align-items: center; justify-content: center; }
  
  .navbar { height: 70px; }
  .logo-icon { width: 40px; height: 40px; font-size: 20px; }
  .brand-text h1 { font-size: 19px; }
  .brand-text span { font-size: 10.5px; }

  /* Hero 手機版完美適配 (杜絕文字擠壓與折行破版) */
  .hero { padding: 40px 0 50px; }
  .hero-tag { font-size: 12px; padding: 5px 12px; margin-bottom: 14px; }
  .hero-title { font-size: 26px; line-height: 1.35; margin-bottom: 14px; }
  .hero-desc { font-size: 15px; line-height: 1.7; margin-bottom: 20px; }
  
  .hero-cta {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }
  .hero-cta .btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
  }
  .stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
  }
  .stat-item h3 { font-size: 22px; margin-bottom: 0; }
  .stat-item p { font-size: 13px; }

  .hero-card { padding: 20px 16px; border-radius: var(--radius-md); }
  .hero-card h4 { font-size: 18px; }
  .feature-list li { font-size: 14px; padding: 8px 0; }

  /* 區塊標題與網格手機版全改單欄 */
  .section-header { margin-bottom: 30px; }
  .section-title { font-size: 24px; }
  .section-desc { font-size: 14.5px; }

  .grid-features { grid-template-columns: 1fr; gap: 16px; }
  .product-grid { grid-template-columns: 1fr; gap: 20px; }
  .app-grid { grid-template-columns: 1fr; gap: 16px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  /* 產品詳情與產業應用卡片手機適配 */
  .solution-card {
    grid-template-columns: 1fr !important;
    padding: 20px !important;
    gap: 16px !important;
  }
  .about-story-grid {
    grid-template-columns: 1fr !important;
    gap: 30px !important;
  }

  /* 浮動詢價籃手機端精巧尺寸 */
  .rfq-floating-btn {
    bottom: 20px !important;
    right: 16px !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
  }
}
