/* Shared site toolbar. Themes set the colours. Workspace pages use a wider layout. */

:root {
  --vnh-height: 64px;
}

.vn-header {
  --vnh-bg: rgba(250, 251, 252, 0.86);
  --vnh-panel: #ffffff;
  --vnh-ink: #101418;
  --vnh-muted: #56616b;
  --vnh-line: rgba(16, 20, 24, 0.1);
  --vnh-hover: rgba(16, 20, 24, 0.06);
  --vnh-accent: #101418;
  --vnh-accent-ink: #ffffff;
  --vnh-focus: #2d65b3;
  --vnh-content-width: 1280px;
  --vnh-gutter: max(clamp(1.1rem, 4vw, 4rem), calc((100vw - var(--vnh-content-width)) / 2));
  --vnh-logo-size: 36px;
  --vnh-control-size: 44px;
  --vnh-control-radius: 12px;
  --vnh-control-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 3px rgba(13, 23, 38, 0.07);
  --vnh-control-fill: color-mix(in srgb, var(--vnh-panel) 68%, var(--vnh-hover));
  position: sticky;
  z-index: 60;
  top: 0;
  display: flex;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100vw;
  min-height: var(--vnh-height);
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--vnh-line);
  background: var(--vnh-bg);
  padding: 0 max(1rem, var(--vnh-gutter), env(safe-area-inset-right)) 0
    max(1rem, var(--vnh-gutter), env(safe-area-inset-left));
  color: var(--vnh-ink);
  font-size: 1rem;
  line-height: 1.2;
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  backdrop-filter: saturate(1.5) blur(16px);
}

.vn-header *,
.vn-header *::before,
.vn-header *::after {
  box-sizing: border-box;
}

.vn-header[data-theme="quikzip"] {
  --vnh-bg: rgba(247, 244, 238, 0.88);
  --vnh-panel: #fbf9f5;
  --vnh-ink: #121a2b;
  --vnh-muted: #505a69;
  --vnh-line: rgba(31, 47, 72, 0.14);
  --vnh-hover: rgba(31, 47, 72, 0.07);
  --vnh-accent: #121a2b;
  --vnh-focus: #b9470d;
}

.vn-header[data-theme="storebench"] {
  --vnh-bg: rgba(255, 255, 255, 0.88);
  --vnh-ink: #18372e;
  --vnh-muted: #4f655b;
  --vnh-line: #cedbd0;
  --vnh-hover: #e9f1ea;
  --vnh-accent: #244f3c;
  --vnh-focus: #244f3c;
}

.vn-header[data-theme="mymole"] {
  --vnh-bg: rgba(255, 255, 255, 0.88);
  --vnh-ink: #10292d;
  --vnh-muted: #4a6467;
  --vnh-line: #cfe2e2;
  --vnh-hover: #e4f5f4;
  --vnh-accent: #0f6f6b;
  --vnh-focus: #0f6f6b;
}

.vn-header[data-theme="teamscribe"] {
  --vnh-bg: rgba(255, 255, 255, 0.88);
  --vnh-ink: #25203b;
  --vnh-muted: #5f596e;
  --vnh-line: #e2ddec;
  --vnh-hover: #f1edfc;
  --vnh-accent: #5530d9;
  --vnh-focus: #5530d9;
}

.vn-header[data-layout="workspace"] {
  --vnh-content-width: 1480px;
}

/* Web demos sit on a dark page. --vnh-tint is the page colour behind the bar.
   The bar stays below a demo's own sheets, dialogs and full-screen panels. */
.vn-header[data-tone="dark"] {
  --vnh-tint: 12, 15, 20;
  --vnh-bg: rgba(var(--vnh-tint), 0.86);
  --vnh-panel: rgb(var(--vnh-tint));
  --vnh-ink: #f3f5f8;
  --vnh-muted: #b3bcc8;
  --vnh-line: rgba(255, 255, 255, 0.12);
  --vnh-hover: rgba(255, 255, 255, 0.09);
  --vnh-accent: #f4f6f8;
  --vnh-accent-ink: #0b0d10;
  --vnh-focus: #9cc4ff;
  --vnh-control-fill: var(--vnh-hover);
  --vnh-control-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  z-index: 20;
}

.vn-header[data-tone="dark"][data-theme="inkline"] { --vnh-tint: 17, 21, 28; z-index: 30; }
.vn-header[data-tone="dark"][data-theme="rune"] { --vnh-tint: 8, 11, 16; }
.vn-header[data-tone="dark"][data-theme="quikzip"] { --vnh-tint: 24, 25, 30; }
.vn-header[data-tone="dark"][data-theme="storebench"] { --vnh-tint: 15, 24, 40; z-index: 30; }
.vn-header[data-tone="dark"][data-theme="mymole"] { --vnh-tint: 9, 20, 22; z-index: 30; }

.vn-brand {
  display: inline-flex;
  min-width: var(--vnh-logo-size);
  flex: 0 0 auto;
  align-items: center;
  gap: 0.6rem;
  border-radius: 10px;
  color: inherit;
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.vn-brand-icon,
.vn-brand-mark {
  width: var(--vnh-logo-size);
  height: var(--vnh-logo-size);
}

:is(.vn-brand-icon, .product-icon) {
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

.vn-brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: var(--vnh-ink);
  color: var(--vnh-panel);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.vn-brand-name {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
}

.vn-brand-tag {
  flex: 0 0 auto;
  border: 1px solid var(--vnh-line);
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  color: var(--vnh-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Without the script the links stay on one row and scroll sideways. */
.vn-nav {
  display: flex;
  overflow-x: auto;
  min-width: 0;
  flex: 0 1 auto;
  align-items: center;
  gap: 0.1rem;
  margin-left: auto;
  scrollbar-width: none;
}

.vn-nav::-webkit-scrollbar {
  display: none;
}

.vn-secondary-links {
  display: flex;
  flex: 0 0 auto;
  gap: inherit;
}

.vn-header.is-ready:not(.is-collapsed) .vn-nav {
  overflow: visible;
}

.vn-nav a {
  display: inline-flex;
  min-height: var(--vnh-control-size);
  flex: 0 0 auto;
  align-items: center;
  border-radius: var(--vnh-control-radius);
  padding: 0 0.72rem;
  color: var(--vnh-muted);
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.vn-nav a[aria-current] {
  color: var(--vnh-ink);
  text-decoration: underline;
  text-decoration-color: var(--vnh-focus);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

.vn-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.5rem;
}

.vn-cta {
  display: inline-flex;
  min-height: var(--vnh-control-size);
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--vnh-control-radius);
  background: var(--vnh-accent);
  padding: 0 1rem;
  color: var(--vnh-accent-ink);
  font-size: 0.9rem;
  font-weight: 720;
  text-decoration: none;
  white-space: nowrap;
}

.vn-header :is(.vn-nav-mobile-demo, .vn-nav-mobile-cta) {
  display: none;
}

.vn-back-link {
  display: inline-flex;
  min-height: var(--vnh-control-size);
  flex: 0 0 auto;
  align-items: center;
  margin-left: auto;
  border-radius: var(--vnh-control-radius);
  padding: 0 0.7rem;
  color: var(--vnh-ink);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.vn-parent-link {
  min-width: var(--vnh-control-size);
  justify-content: center;
  gap: 0.5rem;
  margin-left: 0;
  border: 1px solid var(--vnh-line);
  background: var(--vnh-panel);
  background: var(--vnh-control-fill);
  padding: 0 0.7rem;
  box-shadow: var(--vnh-control-shadow);
  font-size: 0.85rem;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.vn-parent-link::before {
  width: 0.49rem;
  height: 0.49rem;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  border-bottom-left-radius: 1.5px;
  content: "";
  transform: rotate(45deg);
}

.vn-parent-link[data-back-link] {
  width: var(--vnh-control-size);
  padding: 0;
}

.vn-parent-link + .vn-brand {
  flex: 0 1 auto;
}

.vn-menu-button {
  display: none;
  width: var(--vnh-control-size);
  height: var(--vnh-control-size);
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--vnh-line);
  border-radius: var(--vnh-control-radius);
  background: var(--vnh-panel);
  background: var(--vnh-control-fill);
  padding: 0;
  box-shadow: var(--vnh-control-shadow);
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.vn-menu-label {
  display: none;
}

.vn-header.is-ready:not(.is-collapsed) .vn-menu-button[data-more-menu] {
  display: inline-flex;
  width: auto;
  gap: 0.5rem;
  padding-inline: 0.75rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
}

.vn-header.is-ready:not(.is-collapsed) .vn-menu-button[data-more-menu] .vn-menu-label {
  display: inline;
}

.vn-header.is-ready:not(.is-collapsed) .vn-menu-button[data-more-menu] .vn-menu-icon {
  display: none;
}

.vn-header.is-ready:not(.is-collapsed) .vn-menu-button[data-more-menu]::after {
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  transform: translateY(-1px) rotate(45deg);
}

.vn-header.is-ready:not(.is-collapsed).is-open .vn-menu-button[data-more-menu]::after {
  transform: translateY(1px) rotate(225deg);
}

.vn-header.is-open .vn-menu-button,
.vn-header :is(.vn-back-link, .vn-menu-button):active,
.vn-header :is(.vn-back-link, .vn-menu-button, .vn-nav a):focus-visible {
  background: var(--vnh-hover);
  color: var(--vnh-ink);
}

@media (hover: hover) and (pointer: fine) {
  .vn-header :is(.vn-back-link, .vn-menu-button, .vn-nav a):hover {
    background: var(--vnh-hover);
    color: var(--vnh-ink);
  }

  .vn-cta:hover {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--vnh-accent) 22%, transparent);
  }
}

.vn-menu-icon,
.vn-menu-icon::before,
.vn-menu-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.vn-menu-icon {
  position: relative;
}

.vn-menu-icon::before,
.vn-menu-icon::after {
  position: absolute;
  left: 0;
  content: "";
}

.vn-menu-icon::before { top: -6px; }
.vn-menu-icon::after { top: 6px; }

.vn-header.is-open .vn-menu-icon { background: transparent; }
.vn-header.is-open .vn-menu-icon::before { top: 0; transform: rotate(45deg); }
.vn-header.is-open .vn-menu-icon::after { top: 0; transform: rotate(-45deg); }

@media (forced-colors: active) {
  .vn-menu-icon,
  .vn-menu-icon::before,
  .vn-menu-icon::after {
    forced-color-adjust: none;
    color: ButtonText;
  }

  .vn-nav a[aria-current] {
    text-decoration: underline;
    text-underline-offset: 0.2em;
  }
}

.vn-brand:focus-visible,
.vn-nav a:focus-visible,
.vn-cta:focus-visible,
.vn-back-link:focus-visible,
.vn-menu-button:focus-visible {
  outline: 2px solid var(--vnh-focus);
  outline-offset: 2px;
}

/* Collapsed: the links become a menu below the bar. */
.vn-header.is-collapsed .vn-brand {
  flex: 0 1 auto;
}

.vn-header.is-collapsed .vn-actions {
  margin-left: auto;
}

.vn-header.is-collapsed .vn-menu-button {
  display: inline-flex;
}

.vn-header.is-collapsed .vn-secondary-links {
  flex-direction: column;
}

.vn-header.is-collapsed .vn-nav,
.vn-header.is-ready:not(.is-collapsed) .vn-secondary-links {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  display: none;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - var(--vnh-height));
  max-height: calc(100dvh - var(--vnh-height));
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  margin: 0;
  border-bottom: 1px solid var(--vnh-line);
  background: var(--vnh-panel);
  padding: 0.4rem max(0.5rem, calc(var(--vnh-gutter) - 0.5rem), env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom))
    max(0.5rem, calc(var(--vnh-gutter) - 0.5rem), env(safe-area-inset-left));
  box-shadow: 0 28px 44px -22px rgba(0, 0, 0, 0.35);
  overscroll-behavior: contain;
}

.vn-header.is-collapsed.is-open .vn-nav,
.vn-header.is-ready:not(.is-collapsed).is-open .vn-secondary-links {
  display: flex;
}

.vn-header.is-collapsed .vn-nav a,
.vn-header.is-ready:not(.is-collapsed) .vn-secondary-links a {
  min-height: 48px;
  border-radius: 12px;
  padding: 0 0.75rem;
  color: var(--vnh-ink);
  font-size: 1.02rem;
  font-weight: 620;
}

.vn-header.is-collapsed .vn-nav a[aria-current],
.vn-header.is-ready:not(.is-collapsed) .vn-secondary-links a[aria-current] {
  background: var(--vnh-hover);
}

@media (min-width: 720px) {
  .vn-header.is-collapsed .vn-nav,
  .vn-header.is-ready:not(.is-collapsed) .vn-secondary-links {
    right: max(1rem, var(--vnh-gutter), env(safe-area-inset-right));
    left: auto;
    width: 17rem;
    max-height: calc(100vh - var(--vnh-height) - 1rem);
    max-height: calc(100dvh - var(--vnh-height) - 1rem);
    margin-top: 0.45rem;
    border: 1px solid var(--vnh-line);
    border-radius: 14px;
    padding: 0.35rem;
  }

  .vn-header.is-collapsed .vn-nav a,
  .vn-header.is-ready:not(.is-collapsed) .vn-secondary-links a {
    min-height: 44px;
    font-size: 0.94rem;
  }
}

@media (max-width: 479px) {
  .vn-parent-link + .vn-brand .vn-brand-tag {
    display: none;
  }

  .vn-header[data-compact-actions].is-collapsed .vn-cta {
    display: none;
  }

  .vn-header.is-collapsed :is(.vn-nav-mobile-demo, .vn-nav-mobile-cta) {
    display: inline-flex;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .vn-nav a,
  .vn-cta,
  .vn-back-link,
  .vn-menu-button {
    transition: background-color 140ms ease-out, color 140ms ease-out, box-shadow 140ms ease-out;
  }

  .vn-menu-icon,
  .vn-menu-icon::before,
  .vn-menu-icon::after {
    transition: transform 160ms ease-out, top 160ms ease-out, background-color 160ms ease-out;
  }

  .vn-header.is-collapsed.is-open .vn-nav,
  .vn-header.is-ready:not(.is-collapsed).is-open .vn-secondary-links {
    animation: vn-menu-in 160ms ease-out;
  }
}

@keyframes vn-menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@media (max-width: 719px) {
  :root {
    --vnh-height: 56px;
  }

  .vn-header {
    --vnh-logo-size: 32px;
    gap: 0.5rem;
  }

  .vn-brand {
    gap: 0.5rem;
    font-size: 0.98rem;
  }

  .vn-cta {
    padding: 0 0.8rem;
    font-size: 0.84rem;
  }
}

@media (max-width: 359px) {
  .vn-brand-tag {
    display: none;
  }

  .vn-cta {
    padding: 0 0.65rem;
  }

  .vn-back-link {
    padding-inline: 0.4rem;
  }
}

@media print {
  .vn-header {
    position: static;
  }

  .vn-nav,
  .vn-actions,
  .vn-parent-link {
    display: none;
  }
}

/* Keep one toolbar surface during same-origin navigation. Individual controls
   would otherwise double up while the outgoing and incoming snapshots blend. */
@view-transition {
  navigation: auto;
}

.vn-header {
  view-transition-name: vn-header;
}

::view-transition-group(vn-header) {
  animation: none;
  z-index: 1;
}

::view-transition-old(vn-header) {
  animation: none;
  opacity: 0;
}

::view-transition-new(vn-header) {
  animation: none;
  mix-blend-mode: normal;
}

@keyframes vn-page-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

::view-transition-old(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-new(root) {
  animation: vn-page-in 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
  mix-blend-mode: normal;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
