/**
 * WOLKENTAKT · Layout · Header
 *
 * 吸顶头部、主导航、图标按钮、购物车角标、WP 菜单分隔线。
 *
 * 来源：拆分自原 components.css（2026-11-16），规则内容未修改。
 * 修改本文件时请同步更新《公共框架与子主题规范梳理.md》。
 */

/* ==========================================================================
   WOLKENTAKT Components · Insta360-inspired Minimalist System
   Layer: components only. Base layout/buttons live in globals.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. GLOBAL STICKY HEADER
   -------------------------------------------------------------------------- */
.wt-site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--wt-border-subtle);
  padding: 0;
  margin: 0;
}

.wt-header-inner {
  width: min(100% - 48px, var(--wt-wide-width));
  height: 72px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.wt-brand-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.wt-brand-logo img {
  height: 30px;
  width: auto;
  display: block;
}

.wt-primary-nav {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.wt-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 26px;
}

.wt-nav-list a {
  color: var(--wt-carbon);
  font-size: 0.9375rem;
  font-weight: 500;
  /* 固定行高：回退字体与 Inter 的默认行高不同，换字体时导航会从 26 变 27 px，带动下方整体下移（CLS） */
  line-height: 26px;
  text-decoration: none;
  white-space: nowrap;
}

.wt-nav-list a:hover {
  color: var(--wt-link-blue);
}

.wt-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.wt-header-store-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 18px;
  border-radius: var(--wt-radius-control);
  background: var(--wt-carbon);
  color: #FFFFFF;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.wt-header-store-btn:hover {
  background: var(--wt-carbon-hover);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.wt-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--wt-carbon);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.wt-icon-btn:hover {
  background: var(--wt-surface-subtle);
  color: var(--wt-carbon);
}

.wt-locale-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--wt-text-secondary);
  padding-left: 6px;
  white-space: nowrap;
}

/* Cart count bubble */
.wt-cart-count-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--wt-radius-pill);
  background: var(--wt-carbon);
  color: #FFFFFF;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  display: none;
}

.wt-cart-count-badge.has-items {
  display: inline-block;
}

/* --------------------------------------------------------------------------
   WP-Menü: Trennlinie
   Ein Menüpunkt mit der Klasse `wt-nav-sep` bekommt links eine feine Linie,
   an derselben Stelle wie zuvor der statische .wt-nav-divider.
   -------------------------------------------------------------------------- */
.wt-nav-list li.wt-nav-sep {
  display: flex;
  align-items: center;
}

.wt-nav-list li.wt-nav-sep::before {
  content: "";
  width: 1px;
  height: 14px;
  background: var(--wt-border);
  margin-right: 26px;
  flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   主导航下拉（Marken / Kategorien）
   父项由 inc/nav.php 渲染为 <button>，用 :hover / :focus-within 展开，
   不依赖 JS；无子项时 .sub-menu:empty 不占位。
   -------------------------------------------------------------------------- */
.wt-nav-list > li {
  position: relative;
}

.wt-nav-list .wt-nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--wt-text-secondary, #5a6270);
  cursor: pointer;
}

.wt-nav-list .wt-nav-toggle:hover,
.wt-nav-list li.menu-item-has-children:hover > .wt-nav-toggle,
.wt-nav-list li.menu-item-has-children:focus-within > .wt-nav-toggle {
  color: var(--wt-carbon, #101419);
}

.wt-nav-caret {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.18s ease;
}

.wt-nav-list li.menu-item-has-children:hover .wt-nav-caret,
.wt-nav-list li.menu-item-has-children:focus-within .wt-nav-caret {
  transform: rotate(225deg) translateY(-2px);
}

.wt-nav-list .sub-menu {
  position: absolute;
  top: calc(100% + 16px);
  left: 50%;
  transform: translate(-50%, -6px);
  min-width: 232px;
  margin: 0;
  padding: 10px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--wt-border, #e6e8ec);
  border-radius: 16px;
  box-shadow: 0 20px 44px rgba(16, 20, 25, 0.12);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 80;
}

.wt-nav-list li.menu-item-has-children:hover > .sub-menu,
.wt-nav-list li.menu-item-has-children:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.wt-nav-list .sub-menu li {
  display: block;
}

.wt-nav-list .sub-menu a {
  display: block;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.875rem;
  color: var(--wt-text-secondary, #5a6270);
  text-decoration: none;
  white-space: nowrap;
}

.wt-nav-list .sub-menu a:hover {
  background: #f4f5f7;
  color: var(--wt-carbon, #101419);
}

.wt-nav-list .sub-menu:empty {
  display: none;
}

/* --------------------------------------------------------------------------
   中间断点（1025–1180px）
   带下拉的 7 项导航在窄笔电上会被挤压：这一步收紧要隐藏地区徽标、
   缩小间距与字号，保证 1025px 起仍能完整显示，不被截断。
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) and (min-width: 1025px) {
  .wt-nav-list {
    gap: 14px;
  }

  .wt-nav-list > li > a,
  .wt-nav-list .wt-nav-toggle {
    font-size: 0.8125rem;
  }

  .wt-header-actions {
    gap: 8px;
  }

  .wt-locale-badge {
    display: none;
  }

  .wt-header-store-btn {
    padding: 0 14px;
    font-size: 0.8125rem;
  }

  .wt-brand-logo img {
    height: 27px;
  }
}

/* 德国国旗（本地化标识，2026-11-17） */
.wt-locale-badge__flag {
  display: inline-flex;
  width: 18px;
  height: 13px;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(16, 20, 25, 0.12);
  flex-shrink: 0;
}

.wt-locale-badge__flag svg {
  display: block;
  width: 100%;
  height: 100%;
}
