/* ============================================================================
   VH Marketing: the navigation, shared by every page (the studio flight and
   the plain pages). build-pages.mjs writes the markup, vh-nav.js the behaviour.
   Everything here is position:fixed or lives in a <dialog>, so none of it ever
   enters the worldflight's document flow. Load after scrollcraft.css.
   ========================================================================== */

:root { --vh-nav-h: 4rem; }
@media (max-width: 1080px) { :root { --vh-nav-h: 3.5rem; } }

html.vh-locked { overflow: hidden; }
.vh-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- the bar --------------------------------------------------------------- */
.vh-nav { position: fixed; inset: 0 0 auto 0; z-index: 60; font-family: var(--sc-font-text); }
.vh-nav__bar {
  position: relative;
  height: var(--vh-nav-h);
  display: flex; align-items: center; gap: var(--sc-4);
  padding-inline: var(--sc-gutter);
  background: color-mix(in oklab, var(--sc-canvas) 80%, transparent);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  border-bottom: 1px solid var(--sc-hairline);
}
.vh-nav__brand {
  flex: none; font-weight: 600; letter-spacing: .3em; text-transform: uppercase;
  font-size: var(--sc-t-xs); color: var(--sc-ink); text-decoration: none; white-space: nowrap;
}
.vh-nav__brand b { color: var(--sc-accent); font-weight: 600; }

/* shared look for every bar control: a quiet pill that lights on hover */
.vh-nav__stop, .vh-nav__link, .vh-nav__now {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .75rem; border-radius: var(--sc-r-pill);
  background: none; border: 0; cursor: pointer;
  font: inherit; font-size: var(--sc-t-sm); color: var(--sc-ink-soft);
  text-decoration: none; white-space: nowrap;
  transition: color var(--sc-d-fast) ease, background-color var(--sc-d-fast) ease;
}
.vh-nav__stop:hover, .vh-nav__link:hover, .vh-nav__now:hover { color: var(--sc-ink); }
.vh-nav__link:hover, .vh-dd[open] > .vh-nav__link, .vh-nav__link[aria-current="page"] {
  background: color-mix(in oklab, var(--sc-ink) 7%, transparent);
}
.vh-nav__link[aria-current="page"] { color: var(--sc-ink); }
.vh-nav__chev { width: .62rem; height: .62rem; flex: none; transition: transform var(--sc-d-base) var(--sc-ease-out); }
.vh-dd[open] > summary .vh-nav__chev { transform: rotate(180deg); }

/* the tour: the studio's parts, with a lit pill that slides to the current one */
.vh-nav__tour { position: relative; display: flex; align-items: center; min-width: 0; }
.vh-nav__tour ol { list-style: none; margin: 0; padding: 0; display: flex; gap: .15rem; }
.vh-nav__stop { position: relative; z-index: 1; }
.vh-nav__stop[aria-current="step"] { color: var(--sc-ink); }
.vh-nav__ind {
  position: absolute; z-index: 0; left: 0; top: 50%; height: 2.1rem; width: var(--w, 0px);
  transform: translate(var(--x, 0px), -50%);
  border-radius: var(--sc-r-pill);
  background: color-mix(in oklab, var(--sc-ink) 8%, transparent);
  border: 1px solid var(--sc-hairline);
  opacity: 0; pointer-events: none;
  transition: transform var(--sc-d-slow) var(--sc-ease-out), width var(--sc-d-slow) var(--sc-ease-out), opacity var(--sc-d-base) ease;
}
.vh-nav__ind.is-on { opacity: 1; }
.vh-nav__ind.is-on::after {   /* the accent mark under the lit pill */
  content: ""; position: absolute; left: 50%; bottom: -.48rem; width: 1rem; height: 2px;
  border-radius: 2px; background: var(--sc-accent); transform: translateX(-50%);
}

/* the compact "where am I" button: replaces the tour links on narrower screens */
.vh-nav__now { display: none; min-width: 0; color: var(--sc-ink); border: 1px solid var(--sc-hairline-strong); padding-block: .38rem; }
.vh-nav__now [data-vh-now] { overflow: hidden; text-overflow: ellipsis; }
.vh-nav__dot { flex: none; width: .45rem; height: .45rem; border-radius: 50%; background: var(--sc-accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--sc-accent) 22%, transparent); }

.vh-nav__site { display: flex; align-items: center; gap: .15rem; margin-left: auto; }

.vh-nav__cta {
  flex: none; display: inline-flex; align-items: center;
  font-weight: 600; font-size: var(--sc-t-sm); color: var(--sc-accent-ink); background: var(--sc-accent);
  padding: .55rem 1.05rem; border-radius: var(--sc-r-pill); text-decoration: none; white-space: nowrap;
  transition: transform var(--sc-d-base) var(--sc-ease-out);
}
.vh-nav__cta:hover { transform: translateY(-1px); color: var(--sc-accent-ink); text-decoration: none; }
.vh-nav__cta-short { display: none; }

.vh-nav__menu {
  display: none; flex: none; align-items: center; gap: .55rem;
  background: none; border: 1px solid var(--sc-hairline-strong); border-radius: var(--sc-r-pill);
  padding: .42rem .85rem; cursor: pointer;
  font: inherit; font-size: var(--sc-t-sm); color: var(--sc-ink);
  transition: border-color var(--sc-d-fast) ease;
}
.vh-nav__menu:hover { border-color: var(--sc-accent); }
.vh-nav__burger { position: relative; width: .95rem; height: .6rem; flex: none; }
.vh-nav__burger::before, .vh-nav__burger::after { content: ""; position: absolute; left: 0; right: 0; height: 1.5px; border-radius: 2px; background: currentColor; }
.vh-nav__burger::before { top: 0; }
.vh-nav__burger::after { bottom: 0; }

/* ---- the Branscher dropdown (a <details>, so it opens even without script) - */
.vh-dd { position: relative; }
.vh-dd > summary { list-style: none; }
.vh-dd > summary::-webkit-details-marker { display: none; }
.vh-dd__panel {
  position: absolute; top: calc(100% + .7rem); right: 0;
  width: min(25rem, calc(100vw - 2rem));
  padding: .45rem; background: #110f0d;
  border: 1px solid var(--sc-hairline-strong); border-radius: var(--sc-r-lg);
  box-shadow: var(--sc-e3);
}
.vh-dd[open] > .vh-dd__panel { animation: vh-dd-in var(--sc-d-base) var(--sc-ease-out); }
@keyframes vh-dd-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.vh-dd__list, .vh-menu__list { list-style: none; margin: 0; padding: 0; display: grid; }
.vh-dd__list a, .vh-menu__list a {
  display: grid; gap: .1rem; padding: .7rem .85rem; border-radius: var(--sc-r-md);
  color: var(--sc-ink); text-decoration: none;
  transition: background-color var(--sc-d-fast) ease;
}
.vh-dd__list a:hover, .vh-dd__list a:focus-visible, .vh-menu__list a:hover { background: color-mix(in oklab, var(--sc-ink) 6%, transparent); }
.vh-dd__list b, .vh-menu__list b { font-weight: 600; font-size: var(--sc-t-sm); }
.vh-dd__list span, .vh-menu__list span { font-size: var(--sc-t-xs); color: var(--sc-ink-soft); line-height: 1.45; }
.vh-dd__list a[aria-current="page"] b, .vh-menu__list a[aria-current="page"] b { color: var(--sc-accent); }
.vh-dd__foot { margin: .3rem 0 0; padding: .75rem .85rem .4rem; border-top: 1px solid var(--sc-hairline); font-size: var(--sc-t-xs); }
.vh-dd__foot a { color: var(--sc-accent); text-decoration: none; }
.vh-dd__foot a:hover { color: var(--sc-ink); }

/* ---- the tour timeline: drag or click it to fly to any point ---------------- */
.vh-track {
  position: absolute; left: 0; right: 0; bottom: -2px; height: 3px;
  cursor: pointer; touch-action: none; outline: none;
}
.vh-track::before { content: ""; position: absolute; left: 0; right: 0; top: -9px; bottom: -9px; }   /* a taller hit area */
.vh-track__rail { position: absolute; inset: 0; background: var(--sc-hairline); }
.vh-track__fill { position: absolute; inset: 0; background: var(--sc-accent); transform: scaleX(var(--vh-prog, 0)); transform-origin: left center; }
/* ticks and the head ride 7px in from each end, so neither is cut at 0 or 1 */
.vh-track__tick {
  position: absolute; top: 50%; left: calc(7px + var(--at) * (100% - 14px));
  width: 7px; height: 7px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #110f0d; border: 1px solid var(--sc-hairline-strong);
  transition: background-color var(--sc-d-base) ease, border-color var(--sc-d-base) ease;
}
.vh-track__tick.is-past { background: var(--sc-accent); border-color: var(--sc-accent); }
.vh-track__head {
  position: absolute; top: 50%; left: calc(7px + var(--vh-prog, 0) * (100% - 14px));
  width: 11px; height: 11px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--sc-accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--sc-accent) 24%, transparent);
  transition: box-shadow var(--sc-d-fast) ease;
}
.vh-track:hover .vh-track__head, .vh-track.is-drag .vh-track__head, .vh-track:focus-visible .vh-track__head {
  box-shadow: 0 0 0 6px color-mix(in oklab, var(--sc-accent) 30%, transparent);
}
.vh-track__tip {
  position: absolute; top: 14px; left: var(--tip-x, 0px);
  transform: translateX(-50%);
  padding: .3rem .6rem; border-radius: var(--sc-r-sm);
  background: #110f0d; border: 1px solid var(--sc-hairline-strong); box-shadow: var(--sc-e2);
  font-size: var(--sc-t-xs); color: var(--sc-ink); white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity var(--sc-d-fast) ease;
}
.vh-track:hover .vh-track__tip, .vh-track.is-drag .vh-track__tip, .vh-track:focus-visible .vh-track__tip { opacity: 1; }

/* ---- "Nästa": one press flies to the next part of the tour ----------------- */
.vh-next {
  position: fixed; z-index: 45; left: 50%; bottom: max(1.1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .55rem .7rem .55rem 1rem; border-radius: var(--sc-r-pill);
  border: 1px solid var(--sc-hairline-strong);
  background: color-mix(in oklab, var(--sc-canvas) 76%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--sc-e2);
  font-family: var(--sc-font-text); font-size: var(--sc-t-sm); color: var(--sc-ink);
  cursor: pointer;
  transition: opacity var(--sc-d-base) ease, transform var(--sc-d-base) var(--sc-ease-out), border-color var(--sc-d-fast) ease, visibility 0s;
}
.vh-next:hover { border-color: var(--sc-accent); }
.vh-next__k { color: var(--sc-ink-soft); }
.vh-next__arrow {
  display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--sc-accent); color: var(--sc-accent-ink); font-size: .8rem; font-weight: 600;
}
.vh-next.is-off { opacity: 0; visibility: hidden; transform: translate(-50%, 10px); pointer-events: none; transition: opacity var(--sc-d-base) ease, transform var(--sc-d-base) ease, visibility 0s linear var(--sc-d-base); }
@media (max-height: 679px) { .vh-next { display: none; } }

/* ---- the menu sheet -------------------------------------------------------- */
.vh-menu {
  position: fixed; inset: 0 0 0 auto; margin: 0;
  width: min(30rem, 100vw); max-width: 100vw;
  height: 100vh; height: 100dvh; max-height: none;
  padding: 0; border: 0; border-left: 1px solid var(--sc-hairline-strong);
  background: #110f0d; color: var(--sc-ink);
  font-family: var(--sc-font-text);
  overflow: auto; overscroll-behavior: contain;
}
.vh-menu::backdrop { background: rgba(6, 5, 4, .7); }
.vh-menu[open] { animation: vh-sheet var(--sc-d-slow) var(--sc-ease-drawer); }
@keyframes vh-sheet { from { transform: translateX(100%); } to { transform: none; } }
.vh-menu__head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--vh-nav-h); padding-inline: var(--sc-5);
  background: #110f0d; border-bottom: 1px solid var(--sc-hairline);
}
.vh-menu__close {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1px solid var(--sc-hairline-strong); background: none;
  color: var(--sc-ink); font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.vh-menu__close:hover { border-color: var(--sc-accent); color: var(--sc-accent); }
.vh-menu__body { padding: var(--sc-5) var(--sc-5) var(--sc-7); display: grid; gap: var(--sc-6); }
.vh-menu h2 {
  margin: 0 0 var(--sc-3); font-size: var(--sc-t-xs); font-weight: 600;
  letter-spacing: .24em; text-transform: uppercase; color: var(--sc-accent);
}
.vh-menu__tour { list-style: none; margin: 0; padding: 0; counter-reset: m; }
.vh-menu__tour a {
  display: grid; grid-template-columns: 2.2rem 1fr auto; align-items: baseline;
  padding: .7rem 0; border-top: 1px solid var(--sc-hairline);
  color: var(--sc-ink); text-decoration: none;
  font-family: var(--sc-font-display); font-weight: 500; font-size: var(--sc-t-lg); line-height: 1.2;
  transition: color var(--sc-d-fast) ease;
}
.vh-menu__tour li:last-child a { border-bottom: 1px solid var(--sc-hairline); }
.vh-menu__tour a::before {
  counter-increment: m; content: "0" counter(m);
  font-family: var(--sc-font-text); font-size: var(--sc-t-xs); color: var(--sc-ink-soft);
  font-variant-numeric: tabular-nums;
}
.vh-menu__tour a:hover { color: var(--sc-accent); }
.vh-menu__tour a[aria-current="step"] { color: var(--sc-accent); }
.vh-menu__tour a[aria-current="step"]::after {
  content: "Du är här"; font-family: var(--sc-font-text); font-size: var(--sc-t-xs);
  color: var(--sc-accent); letter-spacing: .02em;
}
.vh-menu__list a { padding-inline: 0; }
.vh-menu__list li + li a { border-top: 1px solid var(--sc-hairline); border-radius: 0; }
.vh-menu__more { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.vh-menu__more a, .vh-menu__more button {
  display: block; width: 100%; text-align: left; padding: .55rem 0;
  background: none; border: 0; cursor: pointer;
  font: inherit; font-size: var(--sc-t-base); color: var(--sc-ink); text-decoration: none;
}
.vh-menu__more a:hover, .vh-menu__more button:hover { color: var(--sc-accent); }
.vh-menu__more a::after, .vh-menu__more button::after { content: " →"; color: var(--sc-accent); }
.vh-menu__cta {
  justify-self: start; display: inline-flex; align-items: center;
  font-weight: 600; color: var(--sc-accent-ink); background: var(--sc-accent);
  padding: .85rem 1.4rem; border-radius: var(--sc-r-pill); text-decoration: none;
}
.vh-menu__cta:hover { color: var(--sc-accent-ink); text-decoration: none; }
.vh-menu__fine { margin: -1rem 0 0; font-size: var(--sc-t-sm); color: var(--sc-ink-soft); }
.vh-menu__keys { display: none; margin: var(--sc-3) 0 0; font-size: var(--sc-t-xs); color: var(--sc-ink-soft); }
.vh-menu__keys kbd {
  font-family: var(--sc-font-text); font-size: .7rem; padding: .05rem .35rem; border-radius: 4px;
  border: 1px solid var(--sc-hairline-strong); color: var(--sc-ink);
}
@media (hover: hover) and (pointer: fine) { .vh-menu__keys { display: block; } }

:where(.vh-nav, .vh-menu, .vh-next) :focus-visible { outline: 2px solid var(--sc-accent); outline-offset: 2px; }
.vh-track:focus-visible .vh-track__rail { outline: 2px solid var(--sc-accent); outline-offset: 4px; }

/* ---- narrower screens: the menu takes over --------------------------------- */
@media (max-width: 1080px) {
  .vh-nav__bar { gap: var(--sc-3); }
  .vh-nav__tour, .vh-nav__site { display: none; }
  .vh-nav__now, .vh-nav__menu { display: inline-flex; }
  .vh-nav__cta { margin-left: auto; padding: .5rem .95rem; }
}
@media (max-width: 520px) {
  .vh-nav__brand span { display: none; }   /* "VH" is enough on a phone */
  .vh-nav__cta-long { display: none; }
  .vh-nav__cta-short { display: inline; }
  .vh-nav__menu { padding: .5rem .62rem; }
  .vh-nav__menu-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  .vh-nav__ind, .vh-nav__chev, .vh-next { transition: none; }
  .vh-menu[open], .vh-dd[open] > .vh-dd__panel { animation: none; }
}
@media print {
  .vh-nav, .vh-menu, .vh-next { display: none !important; }
}
