/**
 * LINQDOM Shell Additions
 * - Header dropdown menus (desktop hover + click)
 * - Mobile drawer menu
 * - Header scrolled state
 * - Hamburger animation
 * - Sticky shadow
 *
 * Loaded AFTER design-tokens.css and style.css
 */

/* ================================================================
 * 1. SITE HEADER (sticky with shadow on scroll)
 * ================================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--color-bg-white);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow 0.3s ease;
}

.site-header.is-scrolled {
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 32px;
}

/* Brand */
.site-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
  color: var(--color-primary);
  font-weight: var(--font-weight-extrabold);
  font-size: 20px;
  transition: var(--transition-base);
}

.site-brand:hover {
  transform: scale(1.03);
  filter: drop-shadow(0 2px 8px var(--color-primary-glow));
}

.site-brand i {
  font-size: 22px;
}

/* 横向中英文 LOGO：LINQDOM | 联创域 */
.site-brand-name {
  font-size: 20px;
  font-weight: var(--font-weight-extrabold);
  letter-spacing: 1px;
  line-height: 1;
  white-space: nowrap;
}

.site-brand-divider {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--color-border);
}

.site-brand-sub {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1;
  white-space: nowrap;
}

/* 站点 LOGO 图片（后台上传：系统配置 → 基本配置 → Website LOGO） */
.site-brand-logo {
  display: block;
  height: 56px;      /* 放大页头 LOGO（原 40px），仍在 70px 页头内居中 */
  width: auto;
  max-width: 300px;
  object-fit: contain;
}

@media (max-width: 768px) {
  .site-brand-logo {
    height: 40px;    /* 手机端放大页头 LOGO（原 32px） */
  }
}

/* Primary Nav */
.primary-nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

.primary-nav__list {
  display: flex;
  list-style: none;
  gap: 20px;
  margin: 0;
  padding: 0;
}

.primary-nav__item,
.nav-item,
.nav-item--has-dropdown {
  position: relative;
}

/* Nav link (no dropdown) */
.nav-link {
  text-decoration: none;
  color: var(--color-text-dark);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 24px 0;
  white-space: nowrap;
  transition: color 0.2s;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 18px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-50%);
}

.nav-link:hover {
  color: var(--color-primary);
}

.nav-link:hover::after {
  width: 100%;
}

.nav-link .caret {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.nav-item--has-dropdown.is-open > .nav-link .caret {
  transform: rotate(180deg);
}

.nav-item--has-dropdown.is-open > .nav-link {
  color: var(--color-primary);
}

.nav-item--has-dropdown.is-open > .nav-link::after {
  width: 100%;
}

/* Dropdown menu */
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  transform: translateY(8px);
  min-width: 240px;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 0;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 100;
}

.nav-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-dropdown::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 24px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--color-bg-white);
}

.nav-dropdown__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-dropdown__item a {
  display: block;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--color-text-dark);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.nav-dropdown__item a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding-left: 24px;
}

.nav-dropdown__item a .dd-icon {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-right: 8px;
  transition: color 0.15s ease;
}

.nav-dropdown__item a:hover .dd-icon {
  color: var(--color-primary);
}

/* ------------------------------------------------------------------
 * Product dropdown flyout (三级菜单)
 * 产品下拉：鼠标悬浮某个产品分类项时，才在该项「右侧」展开该分类的产品
 * 默认 display:none，不占据任何空间
 * ------------------------------------------------------------------ */
.nav-dropdown__item--flyout {
  position: relative;
}

.nav-dropdown__item--flyout > a {
  display: flex;
  align-items: center;
}

.nav-dropdown__item--flyout > a .flyout-arrow {
  margin-left: auto;
  font-size: 9px;
  color: var(--color-text-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

/* hover 时箭头向右轻推，提示内容在右侧展开 */
.nav-dropdown__item--flyout:hover > a .flyout-arrow,
.nav-dropdown__item--flyout:focus-within > a .flyout-arrow {
  color: var(--color-primary);
  transform: translateX(3px);
}

.nav-flyout {
  position: absolute;
  top: -13px;
  left: 100%;
  display: none;
  width: 240px;
  margin-left: 8px;
  padding: 10px 0;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.1);
  z-index: 101;
}

/* 透明桥接区：补上「分类项 → 右侧面板」之间的缝隙，鼠标经过时不闪烁 */
.nav-flyout::before {
  content: "";
  position: absolute;
  top: 0;
  left: -10px;
  width: 10px;
  height: 100%;
}

/* 只有悬浮/键盘聚焦该分类项时才展开 */
.nav-dropdown__item--flyout:hover .nav-flyout,
.nav-dropdown__item--flyout:focus-within .nav-flyout {
  display: block;
}

.nav-flyout__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-dropdown__item .nav-flyout__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--color-text-dark);
  text-decoration: none;
}

.nav-dropdown__item .nav-flyout__link:hover {
  padding-left: 16px;
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* 缩略图：小图，34px */
.nav-flyout__thumb {
  flex: 0 0 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background: var(--color-bg-white);
  color: var(--color-text-muted);
  font-size: 13px;
}

.nav-flyout__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nav-flyout__name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  transition: color 0.15s ease;
}

.nav-dropdown__item .nav-flyout__link:hover .nav-flyout__name {
  color: var(--color-primary);
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Language toggle */
.lang-toggle {
  position: relative;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.2s;
}

.lang-toggle:hover {
  background: var(--color-bg-section);
}

.lang-toggle .caret {
  font-size: 10px;
  margin-left: 4px;
}

.lang-toggle__menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 140px;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 6px 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s;
  z-index: 100;
}

.lang-toggle.is-open .lang-toggle__menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lang-toggle__menu a {
  display: block;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--color-text-dark);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-toggle__menu a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.lang-toggle__menu a.is-active {
  color: var(--color-primary);
  font-weight: 700;
}

/* ================================================================
 * 2. HAMBURGER MENU TOGGLE (mobile only)
 * ================================================================ */

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  z-index: 1100;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-dark);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.menu-toggle.is-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.is-active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ================================================================
 * 3. MOBILE DRAWER
 * ================================================================ */

.mobile-drawer {
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: calc(100vh - 70px);
  height: calc(100dvh - 70px);
  background: var(--color-bg-white);
  z-index: 999;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 16px 0 60px;
}

.mobile-drawer.is-open {
  transform: translateX(0);
}

.mobile-drawer__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-drawer__item {
  border-bottom: 1px solid var(--color-border);
}

.mobile-drawer__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  text-decoration: none;
  color: var(--color-text-dark);
  font-size: 15px;
  font-weight: 600;
}

.mobile-drawer__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--color-text-dark);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-family-base);
}

.mobile-drawer__toggle .caret {
  font-size: 12px;
  color: var(--color-text-muted);
  transition: transform 0.2s ease;
}

.mobile-drawer__submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: var(--color-bg-section);
}

.mobile-drawer__submenu.is-open {
  max-height: 400px;
}

.mobile-drawer__submenu a {
  display: block;
  padding: 12px 24px 12px 40px;
  color: var(--color-text-dark);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.mobile-drawer__submenu a:hover,
.mobile-drawer__submenu a:active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.mobile-drawer__cta {
  padding: 20px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-drawer__cta .btn-primary {
  width: 100%;
  justify-content: center;
}

.mobile-drawer__lang {
  display: flex;
  gap: 8px;
  padding: 16px 24px 0;
}

.mobile-drawer__lang a {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-dark);
  text-decoration: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  transition: all 0.15s ease;
}

.mobile-drawer__lang a:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.mobile-drawer__lang a.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* Body scroll lock when drawer is open */
body.no-scroll {
  overflow: hidden;
}

/* ================================================================
 * 4. RESPONSIVE BREAKPOINTS
 * ================================================================ */

@media (max-width: 991px) {
  /* Hide desktop nav and language toggle, show hamburger */
  .primary-nav {
    display: none;
  }
  .header-actions .lang-toggle,
  .header-actions .btn-contact {
    display: none;
  }
  .menu-toggle {
    display: flex;
  }
}

@media (min-width: 992px) {
  .mobile-drawer {
    display: none !important;
  }
}

/* ================================================================
 * 5. BREADCRUMB + PAGE TITLE BANNER (for shell test page)
 * ================================================================ */

.page-banner {
  background: var(--color-bg-section);
  padding: 32px 0 40px;
  border-bottom: 1px solid var(--color-border);
}

.page-banner h1 {
  font-size: 32px;
  font-weight: var(--font-weight-extrabold);
  margin-bottom: 8px;
  color: var(--color-text-dark);
}

.page-banner .lead {
  font-size: 15px;
  color: var(--color-text-muted);
  max-width: 760px;
}

/* ================================================================
 * 6. CONTENT DEMO BLOCKS (shell test only — strips of sample UI)
 * ================================================================ */

.demo-strip {
  padding: 48px 0;
  border-bottom: 1px dashed var(--color-border);
}

.demo-strip h2 {
  font-size: 18px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 24px;
  color: var(--color-text-dark);
}

.demo-strip .demo-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
