/* Verifate Global Navigation Styles */

:root {
  --vf-global-original-padding-top: 0px;
  --vf-global-height: 0px;
}

html.vf-global-ready body {
  padding-top: calc(var(--vf-global-original-padding-top) + var(--vf-global-height)) !important;
}

.vf-global-header {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  width: auto;
  z-index: 100;
  background-color: #faf8f2;
  color: #1a2a4a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid #e0dcd0;
}

.vf-global-header *,
.vf-global-header *::before,
.vf-global-header *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.vf-global-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 60px;
}

.vf-global-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 56px;
}

.vf-global-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
  min-height: 44px;
  padding: 8px 0;
}

.vf-global-brand-v {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: #1a2a4a;
  color: #faf8f2;
  border-radius: 4px;
  margin-right: 8px;
  font-size: 1.1rem;
  font-weight: 800;
}

.vf-global-brand-text {
  font-weight: 700;
}

.vf-global-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.vf-global-nav > a,
.vf-global-dropdown > summary,
.vf-global-lang-dropdown > summary {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background-color 0.2s, color 0.2s;
  white-space: nowrap;
  min-height: 44px;
}

.vf-global-nav > a:hover,
.vf-global-dropdown > summary:hover,
.vf-global-lang-dropdown > summary:hover {
  background-color: rgba(26, 42, 74, 0.08);
}

.vf-global-nav > a[aria-current="page"],
.vf-global-dropdown > summary[aria-current="page"] {
  background-color: rgba(26, 42, 74, 0.12);
  font-weight: 600;
}

.vf-global-workspace-link {
  background-color: #d4af37;
  color: #1a2a4a;
  font-weight: 700;
  border-radius: 999px;
  padding: 8px 16px;
}

.vf-global-workspace-link:hover {
  background-color: #c9a227;
}

.vf-global-dropdown,
.vf-global-lang-dropdown {
  position: relative;
  display: inline-block;
}

.vf-global-dropdown > summary,
.vf-global-lang-dropdown > summary {
  list-style: none;
}

.vf-global-dropdown > summary::-webkit-details-marker,
.vf-global-lang-dropdown > summary::-webkit-details-marker {
  display: none;
}

.vf-global-dropdown > summary::after,
.vf-global-lang-dropdown > summary::after {
  content: '▾';
  margin-left: 6px;
  font-size: 0.8em;
}

.vf-global-dropdown-menu,
.vf-global-lang-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background-color: #ffffff;
  color: #1a2a4a;
  border: 1px solid #d0ccc0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 8px 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.vf-global-lang-menu {
  min-width: 160px;
  right: 0;
  left: auto;
}

.vf-global-dropdown-menu a,
.vf-global-lang-menu a {
  display: block;
  padding: 8px 16px;
  text-decoration: none;
  color: inherit;
  font-size: 0.9rem;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.vf-global-dropdown-menu a:hover,
.vf-global-lang-menu a:hover {
  background-color: rgba(26, 42, 74, 0.08);
}

.vf-global-lang-menu a.vf-global-current-lang {
  font-weight: 700;
  background-color: rgba(26, 42, 74, 0.05);
}

/* Hide menus when details not open */
.vf-global-dropdown:not([open]) > .vf-global-dropdown-menu,
.vf-global-lang-dropdown:not([open]) > .vf-global-lang-menu {
  display: none;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .vf-global-header {
    background-color: #0d1b2a;
    color: #e0c87a;
    border-bottom-color: #2a3a4a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  .vf-global-brand-v {
    background-color: #e0c87a;
    color: #0d1b2a;
  }

  .vf-global-nav > a:hover,
  .vf-global-dropdown > summary:hover,
  .vf-global-lang-dropdown > summary:hover {
    background-color: rgba(224, 200, 122, 0.15);
  }

  .vf-global-nav > a[aria-current="page"],
  .vf-global-dropdown > summary[aria-current="page"] {
    background-color: rgba(224, 200, 122, 0.2);
  }

  .vf-global-workspace-link {
    background-color: #e0c87a;
    color: #0d1b2a;
  }

  .vf-global-workspace-link:hover {
    background-color: #d4b85a;
  }

  .vf-global-dropdown-menu,
  .vf-global-lang-menu {
    background-color: #1a2a3a;
    color: #e0c87a;
    border-color: #3a4a5a;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  }

  .vf-global-dropdown-menu a:hover,
  .vf-global-lang-menu a:hover {
    background-color: rgba(224, 200, 122, 0.15);
  }

  .vf-global-lang-menu a.vf-global-current-lang {
    background-color: rgba(224, 200, 122, 0.1);
  }
}

/* Mobile layout */
@media (max-width: 768px) {
  .vf-global-inner {
    padding: 0 12px;
  }

  .vf-global-brand-row {
    min-height: 56px;
  }

  .vf-global-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding: 4px 0;
    width: 100%;
    scrollbar-width: thin;
  }

  .vf-global-nav > a,
  .vf-global-dropdown > summary,
  .vf-global-lang-dropdown > summary {
    padding: 6px 10px;
    font-size: 0.85rem;
    flex-shrink: 0;
    min-height: 44px;
  }

  .vf-global-dropdown-menu {
    position: fixed;
    top: var(--vf-global-height);
    left: 12px;
    right: 12px;
    width: auto;
    min-width: 0;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 300;
  }

  .vf-global-lang-menu {
    position: fixed;
    top: 56px;
    right: 12px;
    left: auto;
    width: 160px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 300;
  }
}

@media (max-width: 320px) {
  .vf-global-inner {
    padding: 0 8px;
  }

  .vf-global-nav > a,
  .vf-global-dropdown > summary,
  .vf-global-lang-dropdown > summary {
    padding: 5px 8px;
    font-size: 0.8rem;
  }

  .vf-global-dropdown-menu {
    left: 8px;
    right: 8px;
  }

  .vf-global-lang-menu {
    right: 8px;
  }
}

/* Hide legacy headers only under new header */
html.vf-global-ready .vf-global-header ~ .vf2-header,
html.vf-global-ready .vf-global-header ~ header.vf-common-header,
html.vf-global-ready .vf-global-header ~ header.vf-header,
html.vf-global-ready .vf-global-header ~ nav.vf-engine-nav,
html.vf-global-ready .vf-global-header ~ .account-language {
  display: none !important;
}

/* Ensure legacy language buttons hidden on engine pages */
html.vf-global-ready .vf-global-header ~ button[data-l] {
  display: none !important;
}

/* Focus styles */
.vf-global-header a:focus-visible,
.vf-global-header summary:focus-visible {
  outline: 2px solid #1a2a4a;
  outline-offset: 2px;
}

@media (prefers-color-scheme: dark) {
  .vf-global-header a:focus-visible,
  .vf-global-header summary:focus-visible {
    outline-color: #e0c87a;
  }
}

/* 页面级样式可能重写header、a、details；全局顶栏自行明确恢复。 */
.vf-global-header {margin:0!important;padding:0!important;max-width:none!important;box-sizing:border-box;}
.vf-global-header .vf-global-dropdown,.vf-global-header .vf-global-lang-dropdown {border:0;margin:0;padding:0;}
.vf-global-header a {border-bottom:0;}
.vf-global-header .vf-global-inner {width:100%;box-sizing:border-box;}
.vf-global-header .vf-global-nav {min-width:0;}
.vf-global-header .vf-global-workspace-link {color:#18213b;background:#c9a455;}
.vf-global-header .vf-global-dropdown-menu {max-height:70vh;overflow-y:auto;}
@media(min-width:1000px){
 .vf-global-header .vf-global-inner{flex-direction:row;align-items:center;gap:20px;}
 .vf-global-header .vf-global-brand-row{width:auto;flex:1;min-width:300px;}
 .vf-global-header .vf-global-nav{flex-wrap:nowrap;}
}
@media(max-width:999px){
 .vf-global-header .vf-global-inner{flex-direction:column;}
 .vf-global-header .vf-global-brand-row{width:100%;}
 .vf-global-header .vf-global-nav{flex-wrap:nowrap;overflow-x:auto;width:100%;}
 .vf-global-header .vf-global-dropdown-menu{position:fixed;top:var(--vf-global-height);left:12px;right:12px;min-width:0;width:auto;}
}
@media(prefers-color-scheme:dark){
 .vf-global-header{background:#141830;color:#eee8d7;border-color:#303556;}
 .vf-global-header .vf-global-dropdown-menu,.vf-global-header .vf-global-lang-menu{background:#191e38;color:#eee8d7;border-color:#303556;}
}
/* 旧header可能包在wrap内部，不能只按新header的直接兄弟筛选。 */
html.vf-global-ready header.vf2-header,
html.vf-global-ready header.vf-common-header,
html.vf-global-ready header.vf-header,
html.vf-global-ready nav.vf-engine-nav,
html.vf-global-ready .account-language {display:none!important;}

/* Fix for details width collapse on mobile */
@media (max-width: 999px) {
  .vf-global-header .vf-global-dropdown,
  .vf-global-header .vf-global-lang-dropdown {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
  }
}
