/* The six-item site menu (tools/site_nav.py, Saife 2026-10-22), styled to the website design system
   (Projects/marrinn-website-v3/DESIGN-SYSTEM.md, "Header and menu"). Restyled 2026-10-22 (Saife: "so far i like the
   nav menu but it must match our brand design system"): the header is the one on /agentic-erp/ (pages/erp/world.css,
   Saife 2026-10-19). It is clear, with no fill, no blur and no edge; a veil in the page ground sits behind the links
   and fades to nothing 56px below the bar, so the page scrolls into the menu without a line. Links keep the
   reference's type, colour and spacing (Inter 500 14px, ink-2, 8px 12px, a 14 to 28px gap); the chevrons are kept
   small. Dropdowns and the phone sheet are solid, quiet surfaces on the brand palette: panel ground, hairlines,
   small type, an offset shadow, no glow. Loads after v2.css and layer.css and overrides their .bar and .dd rules.
   Loaded today by /nav-test/ and /custom-software/ only; the live pages keep the old header until Saife approves. */

:root {
  --nav-veil: 8 9 13;              /* the ink ground as an rgb triplet; .erp pages override with their own ground */
  --nav-veil-light: 252 251 255;   /* the light ground */
}
body.erp { --nav-veil: 10 8 20; }

/* ---------------------------------------------------------------- the bar: clear, a veil behind it
   One plain gradient and nothing else: a blur layer keeps a hard edge wherever a browser ignores its mask, which was
   the line Saife kept seeing on 2026-10-19 (the ::before is lifted from pages/erp/world.css as it is). */
.bar, .bar.is-scrolled, .bar--light, .bar--light.is-scrolled {
  background: none; border-bottom-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none;
}
.bar::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: calc(100% + 56px); z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgb(var(--nav-veil) / .8) 0%, rgb(var(--nav-veil) / .66) 30%, rgb(var(--nav-veil) / .44) 50%,
    rgb(var(--nav-veil) / .24) 66%, rgb(var(--nav-veil) / .1) 80%, rgb(var(--nav-veil) / .03) 91%, rgb(var(--nav-veil) / 0) 100%);
}
/* over a light section the same veil in the light ground, a little heavier: dark links need the ground under them */
.bar--light::before {
  background: linear-gradient(180deg, rgb(var(--nav-veil-light) / .94) 0%, rgb(var(--nav-veil-light) / .84) 30%, rgb(var(--nav-veil-light) / .62) 50%,
    rgb(var(--nav-veil-light) / .36) 66%, rgb(var(--nav-veil-light) / .14) 80%, rgb(var(--nav-veil-light) / .04) 91%, rgb(var(--nav-veil-light) / 0) 100%);
}

/* ---------------------------------------------------------------- the links: the reference's spacing and type */
.bar__nav { gap: clamp(14px, 2vw, 28px); }
.bar__link, .dd__btn {
  white-space: nowrap; font-family: var(--sc-font-text); font-size: 14px; font-weight: 500; line-height: 1.62; letter-spacing: -.005em;
  padding: 8px 12px; border-radius: 8px;
}
/* the chevron: five pixels, thin, half-strength until the item is live; turns over when its menu is open by click */
.dd__btn::after {
  width: 5px; height: 5px; margin-left: 7px; border-width: 1.25px; opacity: .55;
  transform: translateY(-3px) rotate(45deg); transition: transform .18s var(--ease), opacity .16s;
}
.dd__btn:hover::after, .dd__btn[aria-expanded="true"]::after { opacity: 1; }
.dd__btn[aria-expanded="true"]::after { transform: translateY(0) rotate(-135deg); }

/* ---------------------------------------------------------------- dropdowns: solid, quiet, hairlined */
.dd__menu {
  top: calc(100% + 8px); left: -12px; width: 404px; padding: 6px; border-radius: 12px;
  background: #10121a; border: 1px solid #2c303c;
  box-shadow: 0 2px 4px rgb(5 6 10 / .35), 0 18px 40px -8px rgb(5 6 10 / .6);
}
/* a bridge over the 8px gap, so the pointer can travel from the item to its menu without closing it */
.dd__menu::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.dd__menu a { padding: 9px 12px; border-radius: 8px; transition: background-color .14s; }
.dd__menu a:hover, .dd__menu a:focus-visible { background: #161923; }
.dd__menu b { font-size: 14px; font-weight: 600; line-height: 1.35; }
.dd__menu span { font-size: 13px; line-height: 1.45; color: #8a8f9b; margin-top: 1px; white-space: normal; }  /* 404px and wrapping: the TagFlow line overflowed at 336px (Saife, 2026-10-27) */
.dd__menu--wide { width: 640px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 6px; }
/* Company sits at the right end of the bar: open it leftwards so it never runs off the screen */
.bar__nav > .dd:last-of-type .dd__menu { left: auto; right: -12px; }
.bar--light .dd__menu { background: #fff; border-color: #e0d9f3; box-shadow: 0 2px 4px rgb(26 16 51 / .06), 0 18px 40px -8px rgb(26 16 51 / .18); }
.bar--light .dd__menu a:hover, .bar--light .dd__menu a:focus-visible { background: #f3f0fb; }
.bar--light .dd__menu span { color: #635a7c; }

.bar__menu { display: none; }
.nav-sheet { display: none; }

/* ---------------------------------------------------------------- phones and small laptops: the menu button and the sheet
   seven items at the reference's spacing, plus the wordmark and the button, need about 1,200px (Digital Twin went top-level 2026-10-26) */
@media (max-width: 1220px) {
  .bar__nav { display: none; }
  .bar .btn { margin-left: auto; }
  .bar__menu {
    display: inline-grid; place-content: center; gap: 5px; width: 44px; height: 44px; margin-right: -10px;
    background: none; border: 0; border-radius: 10px; cursor: pointer; color: #f4f3ef;
  }
  .bar--light .bar__menu { color: #1a1033; }
  .bar__menu i { display: block; width: 20px; height: 1.5px; background: currentColor; border-radius: 1px; transition: transform .2s var(--ease); }
  .bar__menu[aria-expanded="true"] i:first-child { transform: translateY(3.25px) rotate(45deg); }
  .bar__menu[aria-expanded="true"] i:last-child { transform: translateY(-3.25px) rotate(-45deg); }
  .bar__menu:focus-visible { outline: 2px solid #b6abff; outline-offset: 2px; }
  .bar--light .bar__menu:focus-visible { outline-color: #7b58c5; }

  /* the sheet fills the screen under the clear bar, on the page's own ground, so the bar reads as part of it */
  .nav-sheet:not([hidden]) {
    display: block; position: fixed; inset: 0; z-index: calc(var(--z-bar) - 1); overflow-y: auto; overscroll-behavior: contain;
    padding: calc(var(--bar-h) + 8px) clamp(16px, 3.4vw, 44px) 32px; background: #08090d; color: #f4f3ef;
  }
  .nav-sheet__link, .nav-sheet__group > summary {
    display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 4px;
    color: inherit; font-size: 17px; font-weight: 500; text-decoration: none; border-bottom: 1px solid #1f222c;
    cursor: pointer; list-style: none;
  }
  .nav-sheet__group > summary::-webkit-details-marker { display: none; }
  .nav-sheet__group > summary::after {
    content: ""; width: 6px; height: 6px; margin-right: 6px; border-right: 1.25px solid currentColor; border-bottom: 1.25px solid currentColor;
    opacity: .55; transform: rotate(45deg); transition: transform .2s var(--ease);
  }
  .nav-sheet__group[open] > summary::after { opacity: 1; transform: rotate(-135deg); }
  .nav-sheet__group a { display: block; padding: 10px 4px 10px 14px; color: inherit; text-decoration: none; }
  .nav-sheet__group a b { display: block; font-weight: 600; font-size: 15px; line-height: 1.35; }
  .nav-sheet__group a span { display: block; font-size: 13px; line-height: 1.45; color: #8a8f9b; }
  .nav-sheet__group[open] { padding-bottom: 8px; border-bottom: 1px solid #1f222c; }
  .nav-sheet__group[open] > summary { border-bottom: 0; }
  .nav-sheet__cta { display: flex; justify-content: center; margin-top: 24px; }
  /* opened over a light section: the light ground and its inks */
  .bar--light + .nav-sheet:not([hidden]) { background: #fcfbff; color: #1a1033; }
  .bar--light + .nav-sheet .nav-sheet__link, .bar--light + .nav-sheet .nav-sheet__group > summary,
  .bar--light + .nav-sheet .nav-sheet__group[open] { border-bottom-color: #e8e4f2; }
  .bar--light + .nav-sheet .nav-sheet__group a span { color: #635a7c; }
  html.nav-open { overflow: hidden; }
}
/* small phones (2026-10-25 mobile audit): at 360px the button plus the -10px margin pushed the menu button 13px off screen */
@media (max-width: 400px) {
  .bar .btn { padding: 9px 12px; font-size: 13px; }
  .bar__menu { margin-right: -2px; }
}

@media (prefers-reduced-motion: reduce) {
  .dd__menu, .dd__btn::after, .bar__menu i, .nav-sheet__group > summary::after { transition: none; }
}
