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

:root {
  --bg: #fafbfc;
  --card: #ffffff;
  --muted: #f1f3f5;
  --text: #1a1f2e;
  --subtext: #4a5568;
  --brand: #2563eb;
  --brand-2: #1e40af;
  --accent: #059669;
  --brand-green: #6fbf44;
  --brand-blue: #2b6cb0;
  --brand-orange: #f25c2a;
  --brand-gray: #64748b;
  --line: rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.02) 0%, rgba(15, 23, 42, 0.01) 100%),
              var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
  overflow-x: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 99990;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  overflow: visible;
  width: 100%;
  max-width: 100%;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  overflow: visible;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 99990;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-width: 0;
}

.brand-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 16px;
  background: transparent;
  padding: 0;
  border: none;
  box-shadow: none;
}

.brand-text small {
  color: var(--subtext);
  font-size: 13px;
}

.brand-logo-only {
  padding: 6px 0;
}

.brand-colored {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-colored .c-green { color: var(--brand-green); }
.brand-colored .c-blue { color: var(--brand-blue); }
.brand-colored .c-orange { color: var(--brand-orange); }
.brand-colored .c-gray { color: var(--brand-gray); }

.brand-names {
  margin-top: 6px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.2em;
}

.nav {
  display: flex;
  gap: 12px;
  align-items: center;
  overflow: visible;
  flex-wrap: nowrap;
  max-width: 100%;
  flex-shrink: 1;
  min-width: 0;
  position: relative;
}

.nav a,
.nav-link {
  padding: 0 20px;
  height: 72px;
  display: flex;
  align-items: center;
  color: var(--subtext);
  font-weight: 500;
  border-radius: 12px;
  background: transparent;
  transition: color 0.2s ease, transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  font-size: 14px;
}

.nav a:hover,
.nav-link:hover {
  color: var(--text);
  transform: translateY(-1px);
  background: rgba(37, 99, 235, 0.08);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.nav .dropdown {
  position: relative;
  z-index: 99999;
}

.nav .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 99999;
  padding: 8px 0;
}

.nav .dropdown:hover > .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 確保只有直接子選單在懸停時顯示 */
.nav .dropdown:not(:hover) > .dropdown-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
}

.nav .dropdown-menu a {
  display: block;
  padding: 12px 20px;
  height: auto;
  color: var(--subtext);
  border-radius: 0;
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav .dropdown-menu a:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
  transform: none;
  box-shadow: none;
}

/* 巢狀下拉選單（多層級） */
.nav .dropdown-menu .dropdown {
  position: relative;
}

.nav .dropdown-menu .dropdown-menu {
  top: 0;
  left: 100%;
  margin-top: 0;
  margin-left: 8px;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

/* 只有當滑鼠懸停在特定的父選單項上時，才顯示該項的子選單 */
.nav .dropdown-menu > .dropdown:hover > .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.nav .dropdown-menu .dropdown > a::after {
  content: '›';
  float: right;
  margin-left: 8px;
  color: var(--subtext);
}

/* 彈出式導覽視窗 */
.nav-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 9999;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.nav-modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
  pointer-events: auto;
}

.nav-modal-content {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.nav-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.nav-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--subtext);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-modal-close:hover {
  background: rgba(37, 99, 235, 0.1);
  color: var(--text);
}

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

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

.nav-modal-menu a {
  display: block;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s ease;
  font-weight: 500;
}

.nav-modal-menu a:hover {
  background: rgba(37, 99, 235, 0.08);
}

.nav-modal-menu .submenu {
  list-style: none;
  margin-left: 24px;
  margin-top: 4px;
  padding-left: 20px;
  border-left: 2px solid var(--line);
  position: relative;
}

.nav-modal-menu .submenu::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.nav-modal-menu .submenu li {
  margin-bottom: 4px;
  position: relative;
}

.nav-modal-menu .submenu li::before {
  content: '├─';
  position: absolute;
  left: -20px;
  color: var(--subtext);
  font-size: 12px;
}

.nav-modal-menu .submenu li:last-child::before {
  content: '└─';
}

.nav-modal-menu .submenu a {
  font-size: 14px;
  color: var(--subtext);
  font-weight: 400;
  padding-left: 4px;
}

.nav-modal-menu .submenu a:hover {
  color: var(--text);
}

/* 第三層及更深層子選單 */
.nav-modal-menu .submenu .submenu {
  list-style: none;
  margin-left: 20px;
  margin-top: 4px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
  position: relative;
}

.nav-modal-menu .submenu .submenu li {
  margin-bottom: 4px;
  position: relative;
}

.nav-modal-menu .submenu .submenu li::before {
  content: '├─';
  position: absolute;
  left: -18px;
  color: var(--subtext);
  font-size: 11px;
}

.nav-modal-menu .submenu .submenu li:last-child::before {
  content: '└─';
}

.nav-modal-menu .submenu .submenu a {
  font-size: 13px;
  color: var(--subtext);
  font-weight: 400;
  padding-left: 4px;
}

.nav-modal-menu .submenu .submenu a:hover {
  color: var(--text);
}

/* 第四層及更深層子選單 */
.nav-modal-menu .submenu .submenu .submenu {
  margin-left: 16px;
  padding-left: 16px;
  border-left: 1px dashed var(--line);
}

.nav-modal-menu .submenu .submenu .submenu li::before {
  left: -16px;
  font-size: 10px;
}

.nav-modal-menu .submenu .submenu .submenu a {
  font-size: 12px;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .nav-modal-content {
    width: 95%;
    max-height: 90vh;
    padding: 20px;
  }

  .nav-modal-header h3 {
    font-size: 18px;
  }
}

.nav .dropdown.cta-dropdown .dropdown-menu {
  right: 0;
  left: auto;
  z-index: 99999;
}

.nav .dropdown.cta-dropdown .dropdown-menu a {
  color: var(--subtext);
  background: var(--card);
}

.nav .dropdown.cta-dropdown .dropdown-menu a:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
}

/* 防止下拉選單交疊 */
.nav .dropdown-menu {
  pointer-events: auto;
}

.nav .dropdown:hover .dropdown-menu {
  pointer-events: auto;
}

/* 確保巢狀選單的 z-index 正確 */
.nav .dropdown-menu .dropdown-menu {
  z-index: 99999;
}

.nav .dropdown-menu .dropdown-menu .dropdown-menu {
  z-index: 99999;
}

.nav .cta {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  padding: 0 20px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 700;
  position: relative;
  transition: color 0.2s ease, transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.nav .cta::after {
  content: 'ζ';
  position: absolute;
  opacity: 0;
  transition: opacity 0.2s ease;
  font-size: 1.8em;
  font-weight: 900;
  letter-spacing: 0;
  color: var(--brand-blue);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  filter: none;
}

.nav .cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.nav .cta:hover::after {
  opacity: 1;
}

.nav .cta:hover {
  color: transparent;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
}

.has-sub .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.submenu {
  position: absolute;
  top: 120%;
  left: 0;
  min-width: 220px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  padding: 8px 0;
  z-index: 30;
}

.submenu a {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  transition: background 0.2s ease;
}

.submenu a:hover {
  background: rgba(255, 255, 255, 0.05);
}

.has-sub:hover > .submenu {
  display: flex;
}

.submenu.show {
  display: flex;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  gap: 6px;
  flex-direction: column;
  justify-content: center;
  padding: 10px;
}

.nav-toggle span {
  display: block;
  height: 3px;
  background: #111827;
  border-radius: 4px;
}

.hero {
  padding: 80px 0 40px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 32px;
  align-items: center;
}

.hero-copy h1 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.2;
  margin: 10px 0 16px;
}

.hero-copy .lede {
  color: var(--subtext);
  margin-bottom: 20px;
  max-width: 640px;
}

.eyebrow {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin: 12px 0 20px;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.btn.ghost {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(15, 23, 42, 0.02);
}

.btn.block {
  width: 100%;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.35);
}

.hero-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.hero-highlights div {
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 12px;
}

.hero-highlights strong {
  font-size: 22px;
  display: block;
}

.hero-panel {
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.04), #ffffff);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.panel-steps {
  list-style: none;
  margin: 12px 0;
  display: grid;
  gap: 10px;
}

.panel-steps li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 12px;
  border: 1px solid var(--line);
}

.panel-steps span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(91, 141, 239, 0.2);
  color: #fff;
  font-weight: 700;
}

main {
  position: relative;
  z-index: 1;
}

.section {
  padding: 70px 0;
  position: relative;
  z-index: 1;
}

.section.muted {
  background: var(--muted);
  border-block: 1px solid var(--line);
}

.section-header {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 32px;
}

.section-header h2 {
  font-size: clamp(24px, 3.2vw, 36px);
  margin: 10px 0;
}

.section-header p {
  color: var(--subtext);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 10px 0 8px;
}

.card p {
  color: var(--subtext);
}

.card ul {
  margin: 10px 0 12px 18px;
  color: var(--text);
  list-style: disc;
}

.card-badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand-blue);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}

.text-link {
  font-weight: 700;
  color: #1d4ed8;
}

.product-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.product-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.03), #ffffff);
}

.product-card h3 {
  margin-bottom: 8px;
}

.services-grid .card {
  background: #ffffff;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.blog-card {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

.blog-card .tag {
  display: inline-flex;
  padding: 6px 10px;
  background: rgba(155, 123, 255, 0.15);
  border-radius: 10px;
  color: #e9d5ff;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
}

.blog-card h3 {
  margin: 10px 0 8px;
}

.blog-card .meta {
  color: var(--subtext);
  font-size: 13px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  align-items: start;
}

.about-list {
  margin: 14px 0 0 18px;
  color: var(--text);
  list-style: disc;
}

.about-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.contact-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.contact-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-weight: 600;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #0f172a;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: 1px solid var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-note {
  color: var(--subtext);
  font-size: 13px;
}

.footer {
  padding: 30px 0;
  border-top: 1px solid var(--line);
  background: #f1f4fb;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  align-items: start;
}

.footer .brand-logo {
  width: 48px;
  height: 48px;
  padding: 4px;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.footer-links h4 {
  margin-bottom: 8px;
}

.footer-links a {
  display: block;
  color: var(--subtext);
  margin: 4px 0;
}

.footer-copy {
  color: var(--subtext);
  margin-top: 8px;
}

@media (max-width: 1200px) {
  .nav {
    gap: 8px;
  }
  .nav a,
  .nav-link {
    padding: 0 12px;
    font-size: 13px;
  }
  .nav .cta {
    padding: 0 16px;
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  .nav {
    display: none;
    position: fixed !important;
    top: 64px;
    right: 4vw;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
    flex-direction: column;
    width: min(220px, 80vw);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.2);
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 100000 !important;
    isolation: isolate;
  }
  .nav.show {
    display: flex;
    z-index: 100000 !important;
  }
  /* 確保所有內容都在選單下方 */
  main,
  .section,
  .container:not(.header-inner) {
    z-index: 1 !important;
    position: relative;
  }
  .submenu {
    position: static;
    border: 1px solid var(--line);
    box-shadow: none;
    margin-top: 6px;
  }
  .has-sub:hover > .submenu {
    display: none;
  }
  .nav-toggle {
    display: inline-flex;
    z-index: 99999 !important;
    position: relative;
  }
  .hero-grid,
  .about-grid {
    grid-template-columns: 1fr;
  }
  .site-header {
    position: sticky;
    top: 0;
    width: 100%;
    max-width: 100%;
    padding-top: env(safe-area-inset-top);
    overflow-x: hidden;
  }
  .header-inner {
    overflow-x: hidden;
    max-width: 100%;
  }
  .hero {
    padding-top: 110px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

