/**
 * =========================================================
 * XT DBS Header CSS
 *
 * 文件位置：
 * /wp-content/themes/elementra/xt-custom/assets/css/xt-dbs-header.css
 *
 * 作用：
 * 1. Design Build Sol custom header
 * 2. PC dropdown menu
 * 3. Mobile drawer menu
 * 4. Mobile accordion submenu
 * 5. Theme style conflict isolation
 * 6. Fixed header always attached to top
 * 7. Opaque dropdown background
 * =========================================================
 */

/* =========================
   Header Isolation
========================= */

.dbs-header,
.dbs-header * {
  box-sizing: border-box;
}

body.dbs-menu-open {
  overflow: hidden;
}

.dbs-header {
  --dbs-max: 1380px;
  --dbs-side: clamp(18px, 4vw, 72px);

  --dbs-text: #2a221c;
  --dbs-muted: #746a60;
  --dbs-soft: #9b9187;
  --dbs-line: rgba(42, 34, 28, 0.11);
  --dbs-line-strong: rgba(42, 34, 28, 0.18);
  --dbs-gold: #b38a57;
  --dbs-dark: #15110e;
  --dbs-white: #ffffff;
  --dbs-cream: #fffaf3;
  --dbs-cream-hover: #f4eadf;
  --dbs-shadow: 0 18px 46px rgba(67, 52, 35, 0.12);

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  width: 100%;

  color: var(--dbs-text);
  background: linear-gradient(180deg, #faf7f1 0%, #f7f1e8 100%);
  border-bottom: 1px solid var(--dbs-line);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

.dbs-header-spacer {
  width: 100%;
  height: 76px;
  pointer-events: none;
}

.admin-bar .dbs-header {
  top: 32px;
}

.dbs-header a {
  color: inherit;
  text-decoration: none;
}

.dbs-header a:hover,
.dbs-header a:focus {
  color: inherit;
  text-decoration: none;
}

.dbs-header img,
.dbs-header svg {
  display: block;
  max-width: 100%;
}

.dbs-header ul,
.dbs-header li,
.dbs-header p {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dbs-header [role="button"] {
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

/* =========================
   PC Header Layout
========================= */

.dbs-header__inner {
  width: min(var(--dbs-max), calc(100% - var(--dbs-side) * 2));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.dbs-header__logo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 60px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.dbs-header__logo:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.dbs-header__logo img {
  width: clamp(38px, 2.8vw, 48px);
  height: auto;
  object-fit: contain;
}

.dbs-header__nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
}

.dbs-header__menu {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dbs-header__menu > li {
  position: relative;
}

.dbs-header__link,
.dbs-header__dropdown-toggle {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  border: 0 !important;
  outline: none !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;

  color: var(--dbs-muted) !important;
  font-size: 16px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  text-transform: none;
  transition: color 0.22s ease, background 0.22s ease;
}

.dbs-header__link:hover,
.dbs-header__dropdown-toggle:hover,
.dbs-header__menu > li:hover > .dbs-header__link,
.dbs-header__menu > li:hover > .dbs-header__dropdown-toggle {
  color: var(--dbs-text) !important;
  background: rgba(179, 138, 87, 0.08) !important;
  border-radius: 999px;
}

.dbs-header__chevron {
  width: 13px;
  height: 13px;
  color: currentColor;
  opacity: 0.7;
  transition: transform 0.22s ease;
}

.dbs-header__menu > li:hover .dbs-header__chevron {
  transform: rotate(180deg);
}

/* =========================
   PC Dropdown - Opaque
========================= */

.dbs-header__dropdown {
  position: absolute;
  left: 50%;
  top: calc(100% + 14px);
  width: 292px;
  padding: 10px;

  background: var(--dbs-cream) !important;
  background-color: var(--dbs-cream) !important;
  background-image: none !important;

  border: 1px solid rgba(42, 34, 28, 0.12) !important;
  border-radius: 22px;
  box-shadow: 0 18px 46px rgba(67, 52, 35, 0.14) !important;

  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;

  transform: translate(-50%, 10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    visibility 0.22s ease,
    transform 0.22s ease;
}

.dbs-header__dropdown::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -16px;
  height: 16px;
}

.dbs-header__menu > li:hover > .dbs-header__dropdown,
.dbs-header__menu > li:focus-within > .dbs-header__dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.dbs-header__dropdown-list {
  display: grid;
  gap: 3px;
}

.dbs-header__dropdown-link {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border-radius: 16px;
  color: var(--dbs-text) !important;
  background: transparent !important;
  transition: background 0.2s ease, transform 0.2s ease;
}

.dbs-header__dropdown-link:hover {
  background: var(--dbs-cream-hover) !important;
  transform: translateX(2px);
}

.dbs-header__dropdown-title {
  color: var(--dbs-text);
  font-size: 15px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dbs-header__dropdown-desc {
  color: var(--dbs-soft);
  font-size: 12.5px;
  line-height: 1.45;
}

/* =========================
   PC CTA
========================= */

.dbs-header__actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.dbs-header__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  border: 0 !important;
  outline: none !important;
  background: var(--dbs-dark) !important;
  background-color: var(--dbs-dark) !important;
  color: #fff !important;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 14px 28px rgba(21, 17, 14, 0.12);
  text-transform: none;
  transition:
    transform 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease;
}

.dbs-header__cta::after {
  content: "→";
  font-size: 16px;
  line-height: 1;
  transition: transform 0.22s ease;
}

.dbs-header__cta:hover {
  background: #2a221c !important;
  background-color: #2a221c !important;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(21, 17, 14, 0.16);
}

.dbs-header__cta:hover::after {
  transform: translateX(3px);
}

/* =========================
   Mobile Toggle
========================= */

.dbs-header__mobile-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--dbs-line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.52);
  color: var(--dbs-text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.22s ease,
    transform 0.22s ease,
    border-color 0.22s ease;
}

.dbs-header__mobile-toggle:hover {
  background: #fff;
  border-color: rgba(179, 138, 87, 0.42);
  transform: translateY(-1px);
}

.dbs-header__hamburger {
  position: relative;
  width: 18px;
  height: 12px;
}

.dbs-header__hamburger span {
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
  transition:
    transform 0.25s ease,
    top 0.25s ease,
    opacity 0.2s ease;
}

.dbs-header__hamburger span:nth-child(1) {
  top: 0;
}

.dbs-header__hamburger span:nth-child(2) {
  top: 5px;
}

.dbs-header__hamburger span:nth-child(3) {
  top: 10px;
}

.dbs-header.is-open .dbs-header__hamburger span:nth-child(1) {
  top: 5px;
  transform: rotate(45deg);
}

.dbs-header.is-open .dbs-header__hamburger span:nth-child(2) {
  opacity: 0;
}

.dbs-header.is-open .dbs-header__hamburger span:nth-child(3) {
  top: 5px;
  transform: rotate(-45deg);
}

/* =========================
   Mobile Drawer
========================= */

.dbs-header__overlay {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(21, 17, 14, 0.34);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.dbs-header.is-open .dbs-header__overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.dbs-header__mobile-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 999;
  width: min(420px, 88vw);
  height: 100vh;
  padding: 22px 20px 24px;
  background:
    radial-gradient(circle at 100% 0%, rgba(179, 138, 87, 0.10), transparent 32%),
    linear-gradient(180deg, #fbf8f2 0%, #f2ebe1 100%);
  border-left: 1px solid rgba(42, 34, 28, 0.10);
  box-shadow: -24px 0 60px rgba(30, 24, 18, 0.16);
  transform: translateX(105%);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
}

.admin-bar .dbs-header__mobile-panel {
  top: 32px;
  height: calc(100vh - 32px);
}

.dbs-header.is-open .dbs-header__mobile-panel {
  transform: translateX(0);
}

.dbs-header__mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--dbs-line);
}

.dbs-header__mobile-logo img {
  width: 48px;
  height: auto;
  object-fit: contain;
}

.dbs-header__mobile-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--dbs-line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.58);
  color: var(--dbs-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dbs-header__mobile-close svg {
  width: 18px;
  height: 18px;
}

.dbs-header__mobile-menu {
  padding: 18px 0 8px;
}

.dbs-header__mobile-item {
  border-bottom: 1px solid var(--dbs-line);
}

.dbs-header__mobile-link,
.dbs-header__mobile-accordion {
  width: 100%;
  min-height: 58px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 0;
  background: transparent;
  color: var(--dbs-text);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: -0.035em;
  cursor: pointer;
  text-align: left;
}

.dbs-header__mobile-link {
  justify-content: flex-start;
}

.dbs-header__mobile-accordion::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--dbs-soft);
  font-size: 24px;
  line-height: 1;
  font-weight: 300;
  transition: transform 0.25s ease, color 0.25s ease;
}

.dbs-header__mobile-item.is-open .dbs-header__mobile-accordion::after {
  content: "−";
  color: var(--dbs-gold);
  transform: rotate(180deg);
}

.dbs-header__mobile-subpanel {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    max-height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.25s ease,
    transform 0.32s ease;
}

.dbs-header__mobile-item.is-open .dbs-header__mobile-subpanel {
  opacity: 1;
  transform: translateY(0);
}

.dbs-header__mobile-sublist {
  display: grid;
  gap: 6px;
  padding: 0 0 18px;
}

.dbs-header__mobile-sublist a {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--dbs-cream) !important;
  color: var(--dbs-text);
  transition: background 0.2s ease, transform 0.2s ease;
}

.dbs-header__mobile-sublist a:hover {
  background: var(--dbs-cream-hover) !important;
  transform: translateX(2px);
}

.dbs-header__mobile-subtitle {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}

.dbs-header__mobile-subdesc {
  color: var(--dbs-soft);
  font-size: 12px;
  line-height: 1.4;
}

/* =========================
   Mobile Contact
========================= */

.dbs-header__mobile-actions {
  display: grid;
  gap: 14px;
  padding-top: 20px;
}

.dbs-header__mobile-cta {
  min-height: 52px;
  border-radius: 999px;
  background: var(--dbs-dark);
  color: #fff !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 850;
  box-shadow: 0 14px 28px rgba(21, 17, 14, 0.13);
}

.dbs-header__mobile-cta::after {
  content: "→";
  font-size: 17px;
}

.dbs-header__mobile-contact {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(42, 34, 28, 0.10);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.46);
}

.dbs-header__mobile-contact-title {
  margin: 0 0 2px;
  color: var(--dbs-text);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dbs-header__mobile-contact-grid {
  display: grid;
  gap: 8px;
}

.dbs-header__mobile-contact-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(250, 247, 241, 0.74);
  color: var(--dbs-muted);
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.dbs-header__mobile-contact-link:hover {
  background: #fff;
  color: var(--dbs-text);
  transform: translateY(-1px);
}

.dbs-header__mobile-contact-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(179, 138, 87, 0.10);
  color: var(--dbs-gold);
}

.dbs-header__mobile-contact-icon svg {
  width: 16px;
  height: 16px;
}

.dbs-header__mobile-contact-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.dbs-header__mobile-contact-label {
  color: var(--dbs-soft);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dbs-header__mobile-contact-value {
  color: var(--dbs-text);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 750;
  word-break: break-word;
}

.dbs-header__mobile-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dbs-header__mobile-mini a {
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid var(--dbs-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--dbs-muted);
  background: rgba(255, 255, 255, 0.34);
  font-size: 13px;
  font-weight: 800;
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.dbs-header__mobile-mini a:hover {
  background: #fff;
  color: var(--dbs-text);
  transform: translateY(-1px);
}

/* =========================
   Responsive
========================= */

@media (max-width: 1180px) {
  .dbs-header__menu {
    gap: 2px;
  }

  .dbs-header__link,
  .dbs-header__dropdown-toggle {
    padding: 0 12px;
    font-size: 15px;
  }
}

@media (max-width: 980px) {
  .dbs-header__inner {
    min-height: 72px;
  }

  .dbs-header-spacer {
    height: 72px;
  }

  .dbs-header__nav,
  .dbs-header__actions {
    display: none;
  }

  .dbs-header__mobile-toggle {
    display: inline-flex;
  }

  .dbs-header__logo {
    max-width: 60px;
  }

  .dbs-header__logo img {
    width: 52px;
  }
}

@media (max-width: 782px) {
  .admin-bar .dbs-header {
    top: 46px;
  }

  .admin-bar .dbs-header__mobile-panel {
    top: 46px;
    height: calc(100vh - 46px);
  }
}

@media (max-width: 480px) {
  .dbs-header__inner {
    width: min(var(--dbs-max), calc(100% - 32px));
    min-height: 68px;
  }

  .dbs-header-spacer {
    height: 68px;
  }

  .dbs-header__logo img {
    width: 48px;
  }

  .dbs-header__mobile-panel {
    width: 92vw;
    padding: 18px 16px 22px;
  }

  .dbs-header__mobile-logo img {
    width: 48px;
  }

  .dbs-header__mobile-link,
  .dbs-header__mobile-accordion {
    min-height: 56px;
    font-size: 17px;
  }

  .dbs-header__mobile-contact {
    padding: 12px;
  }

  .dbs-header__mobile-contact-link {
    padding: 9px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dbs-header *,
  .dbs-header *::before,
  .dbs-header *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}