/* NAV-V2 (Dima 2026-12-03, designer's archive «agentgid-navigation»): main menu «Группы и быстрый выбор» and the cards'
   sticky section menu «Мягкий объём». Loaded only when html[data-nav2] is set (flag AGENTGID_NAV_V2). Site tokens only. */

/* ---------- main menu, desktop: one wide panel per group, labelled columns, an icon per item ---------- */
html[data-nav2] .site-header .wrap { position: relative; }
html[data-nav2] .nav-group { position: static; }
html[data-nav2] .nav-panel.n2-panel { display: block; left: 50%; top: calc(100% + 1px); translate: -50% 0; /* translate, not transform: the site's chatIn open animation owns transform */ width: min(880px, calc(100vw - 32px));
  padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--border); box-shadow: 0 18px 44px -18px rgba(0, 0, 0, .3); }
html[data-nav2] .nav-group > summary { display: inline-flex; align-items: center; min-height: 40px; }
html[data-nav2] .nav-group[open] > summary { background: var(--accent-wash); color: var(--link); }
.n2-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 8px 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.n2-head strong { font-size: var(--fs-base); font-weight: 600; color: var(--ink); }
.n2-head a { font-size: var(--fs-sm); color: var(--link); }
.n2-cols { display: grid; grid-template-columns: repeat(var(--n2-cols, 2), minmax(0, 1fr)); gap: 20px; }
.n2-col { display: grid; align-content: start; gap: 2px; min-width: 0; }
.n2-ct { margin: 0 0 6px; padding: 0 8px; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--meta); }
html[data-nav2] .n2-panel a.n2-item, .n2-item { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.n2-ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--meta); }
.n2-tx { display: grid; gap: 2px; min-width: 0; }
html[data-nav2] .n2-panel .n2-tx b, .n2-tx b { font-size: var(--fs-base); font-weight: 600; line-height: 1.35; }
html[data-nav2] .n2-panel .n2-tx span, .n2-tx span { font-size: var(--fs-xs); line-height: 1.4; color: var(--ink-2); }
html[data-nav2] .n2-panel a.n2-item:hover, .n2-item:hover { background: var(--surface-2); text-decoration: none; }
.n2-item:hover b, .n2-item[aria-current="page"] b { color: var(--link); }
.n2-item:hover .n2-ic, .n2-item[aria-current="page"] .n2-ic { background: var(--accent-wash); color: var(--link); }
html[data-nav2] .n2-panel a.n2-item[aria-current="page"] { background: var(--accent-wash); }
.n2-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 14px 16px; border-radius: var(--r-md); background: var(--accent-wash); }
.n2-cta strong { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.n2-cta small { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--ink-2); }
html[data-nav2] .n2-panel .n2-cta a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--link); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
html[data-nav2] .n2-panel .n2-cta a:hover { background: var(--surface-2); text-decoration: none; }
@media (max-width: 1100px) { .n2-tx span { display: none; } html[data-nav2] .n2-panel a.n2-item { min-height: 44px; } }

/* ---------- main menu, phone: search, one open group, the finder, two utility links ---------- */
html[data-nav2] .mobile-menu .wrap { display: grid; gap: 0; }
html[data-nav2] .mobile-menu .n2-search[data-sp-open] { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; margin: 2px 0 10px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--plane); color: var(--meta); font-size: var(--fs-md); text-decoration: none; text-align: left; }
.n2-acc { border-bottom: 1px solid var(--border); }
.n2-acc > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 10px 6px; cursor: pointer; color: var(--ink); font-size: var(--fs-md); font-weight: 600; }
.n2-acc > summary::-webkit-details-marker { display: none; }
.n2-acc-t { display: grid; gap: 2px; }
.n2-acc-t small { font-size: var(--fs-xs); font-weight: 400; color: var(--meta); }
.n2-acc > summary .n2-i { flex: none; color: var(--meta); }
.n2-acc[open] > summary { color: var(--link); }
.n2-acc[open] > summary .n2-i { transform: rotate(180deg); }
.n2-acc-b { display: grid; gap: 2px; padding: 0 0 12px; }
.n2-acc-b .n2-ct { margin-top: 10px; }
.n2-acc-b .n2-item { min-height: 46px; padding: 6px 8px; }
.n2-acc-b .n2-ic { width: 28px; height: 28px; }
.n2-finder { margin-top: 16px; padding: 14px; border-radius: var(--r-md); background: var(--accent-wash); }
.n2-finder strong { display: block; font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.n2-finder p { margin: 4px 0 12px; font-size: var(--fs-sm); color: var(--ink-2); }
.n2-finder a { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--link); font-weight: 600; text-decoration: none; }
.n2-util { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin: 10px 0 0; }
.n2-util a { display: inline-flex; align-items: center; min-height: 44px; font-size: var(--fs-sm); color: var(--ink-2); }

/* ---------- card section menu «Мягкий объём»: an island with a sliding marker; a collapsed «On this page» on phones ---------- */
html[data-nav2] .ac-nav { background: var(--plane); border-bottom: 0; box-shadow: none; padding-block: 6px; } /* page colour around the island, so text never shows through above it */
html[data-nav2] .ac-nav-row { position: relative; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: 0 6px 20px -10px rgba(0, 0, 0, .22); }
html[data-nav2] .ac-nav a { position: relative; z-index: 1; flex: 1 0 auto; justify-content: center; min-height: 44px; padding: 0 14px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500; font-size: var(--fs-base); }
html[data-nav2] .ac-nav a:hover { background: color-mix(in srgb, var(--accent-wash) 50%, transparent); color: var(--ink); }
html[data-nav2] .ac-nav a[aria-current="location"] { color: var(--link); font-weight: 600; }
html[data-nav2] .ac-nav:not(.n2-ready) a[aria-current="location"] { background: var(--ac-nav-tint, var(--accent-wash)); box-shadow: inset 0 0 0 1px var(--ac-nav-ring, var(--border-strong)); }
html[data-nav2] .ac-nav.n2-ready a[aria-current="location"] { background: transparent; box-shadow: none; }
.n2-marker { position: absolute; left: 0; top: 4px; bottom: 4px; width: 0; z-index: 0; pointer-events: none; border-radius: var(--r-sm);
  background: var(--ac-nav-tint, var(--accent-wash)); box-shadow: inset 0 0 0 1px var(--ac-nav-ring, var(--border-strong)), 0 2px 6px -2px rgba(0, 0, 0, .18); }
.n2-marker::after { content: ""; position: absolute; left: calc(50% - 8px); bottom: 5px; width: 16px; height: 2px; border-radius: 2px; background: var(--link); }
@media (prefers-reduced-motion: no-preference) {
  .ac-nav.n2-anim .n2-marker { transition: transform .24s cubic-bezier(.2, .8, .2, 1), width .24s cubic-bezier(.2, .8, .2, 1); }
  .n2-acc > summary .n2-i { transition: transform .16s ease; }
  .n2-sel .n2-i { transition: transform .18s ease; }
}
.n2-mbar { display: none; }
@media (max-width: 640px) {
  html[data-nav2] .ac-nav.n2-ready .n2-mbar { display: flex; align-items: center; gap: 8px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
    box-shadow: 0 6px 20px -10px rgba(0, 0, 0, .22); }
  .n2-sel { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 4px 10px; border: 0; border-radius: var(--r-sm);
    background: var(--accent-wash); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
  .n2-sel small { display: block; font-size: var(--fs-2xs); color: var(--ink-2); }
  .n2-sel strong { display: block; font-size: var(--fs-md); font-weight: 600; color: var(--link); overflow-wrap: anywhere; }
  .n2-sel .n2-i { flex: none; color: var(--meta); }
  .ac-nav.is-open .n2-sel .n2-i { transform: rotate(180deg); }
  html[data-nav2] .ac-nav a.n2-mcta { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
    background: var(--surface); color: var(--ink); font-size: var(--fs-sm); font-weight: 500; text-decoration: none; box-shadow: none; } /* beats the section links' rule: the selector takes the width */
  html[data-nav2] .ac-nav a.n2-mcta[aria-current="location"] { background: var(--accent-wash); color: var(--link); }
  html[data-nav2] .ac-nav.n2-ready .ac-nav-row { display: none; }
  html[data-nav2] .ac-nav.n2-ready.is-open .ac-nav-row { display: grid; gap: 2px; margin-top: 6px; padding: 6px; overflow-y: auto; white-space: normal;
    max-height: calc(100dvh - var(--site-head-h, 56px) - 96px); }
  html[data-nav2] .ac-nav.n2-ready .ac-nav-row a { justify-content: space-between; min-height: 46px; padding: 0 12px; }
  html[data-nav2] .ac-nav.n2-ready .ac-nav-row a[aria-current="location"] { background: var(--accent-wash); }
  html[data-nav2] .ac-nav.n2-ready .ac-nav-row a::after { content: attr(data-n2-n); font-size: var(--fs-2xs); font-weight: 400; color: var(--meta); font-variant-numeric: tabular-nums; }
  html[data-nav2] .ac-nav.n2-ready .n2-marker { display: none; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 640px) {
  .ac-nav.is-open .ac-nav-row { animation: n2-in .16s ease-out both; }
  @keyframes n2-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
}

/* ---------- phone header: the «AgentGid» wordmark next to the logo (Dima 2026-12-03 05:16 UTC) ----------
   style.css hides .brand-word under 480 px; here it stays, in the same font and weight, and the header keeps one line:
   tighter gaps, a smaller wordmark under 375 px, and under 340 px the «Log in» link gives way («Sign up» opens the same
   account page, where signing in is the first option). The link keeps its aria-label, so the name is read once. */
@media (max-width: 480px) {
  /* NAV-V2-NOWRAP: the header never wraps to two lines; on a cold load a header-tools item is briefly wider and the
     wrap made a layout shift (CLS up to 0.26 on the phone home page). At rest everything fits on one line anyway. */
  html[data-nav2] .site-header .wrap { column-gap: 8px; flex-wrap: nowrap; }
  html[data-nav2] .site-header .brand { gap: 6px; min-width: 0; flex-shrink: 1; }
  html[data-nav2] .site-header .header-tools { flex-shrink: 0; }
  html[data-nav2] .site-header .brand-word { display: inline; font-size: var(--fs-md); white-space: nowrap; }
  html[data-nav2] .site-header .header-tools { gap: 4px; }
  html[data-nav2] .site-header .account-link { padding-inline: 6px; }
  html[data-nav2] .site-header .signup-btn { padding-inline: 8px; }
}
@media (max-width: 374px) {
  html[data-nav2] .site-header .wrap { padding-inline: 12px; }
  html[data-nav2] .site-header .brand-word { font-size: var(--fs-ui); }
}
@media (max-width: 339px) {
  html[data-nav2] .site-header .account-link:not(.docs-link) { display: none; }
}

/* ---------- NAV-V2-SCRIM: the phone menu reads as a sheet over the page (Dima 2026-12-03 16:54/16:55 UTC) ----------
   While the menu is open (app.js puts .menu-open on <html>): the page behind is dimmed by a scrim, the header row too
   except the Menu button (which shows an X), and the menu is a sheet with its own «Menu» title and close button,
   rounded bottom corners and a shadow; it stops short of the bottom so the dimmed page stays visible. A tap on the
   scrim closes it (app.js's outside click). nav-v2.js makes the rest of the page inert while it is open, keeps the
   scrollbar's width, gives the focus back to the Menu button. No animation under reduced motion. */
:root { --n2-scrim: color-mix(in srgb, var(--ink) 48%, transparent); --n2-sheet-shadow: 0 18px 40px -12px color-mix(in srgb, var(--ink) 40%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --n2-scrim: color-mix(in srgb, var(--plane) 74%, transparent); --n2-sheet-shadow: 0 18px 40px -12px var(--plane); } }
:root[data-theme="dark"] { --n2-scrim: color-mix(in srgb, var(--plane) 74%, transparent); --n2-sheet-shadow: 0 18px 40px -12px var(--plane); }
.n2-mhead { display: none; }
@media (max-width: 879px) {
  html[data-nav2] body::after { content: ""; position: fixed; inset: 0; z-index: 65; background: var(--n2-scrim); opacity: 0; visibility: hidden; pointer-events: none; }
  html[data-nav2].menu-open body::after { opacity: 1; visibility: visible; pointer-events: auto; }
  html[data-nav2].menu-open .site-header { z-index: 70; }
  html[data-nav2] .site-header > .wrap { position: relative; }
  html[data-nav2] .site-header > .wrap::after { content: ""; position: absolute; top: 0; bottom: 0; left: calc(50% - 50vw); right: calc(50% - 50vw); z-index: 3;
    background: var(--n2-scrim); opacity: 0; visibility: hidden; pointer-events: none; }
  html[data-nav2].menu-open .site-header > .wrap::after { opacity: 1; visibility: visible; pointer-events: auto; }
  html[data-nav2].menu-open .site-header .menu-btn { position: relative; z-index: 4; background: var(--surface); border-color: var(--border-strong); }
  html[data-nav2].menu-open .site-header .menu-btn svg { display: none; }
  html[data-nav2].menu-open .site-header .menu-btn::before { content: ""; width: 16px; height: 16px; background: var(--ink);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat; }
  html[data-nav2] .mobile-menu { position: relative; border-bottom: 1px solid var(--border-strong); border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: var(--n2-sheet-shadow); }
  html[data-nav2] .site-header .mobile-menu .wrap { padding-top: 0; }
  html[data-nav2] .n2-mhead { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-inline: -4px; padding: 6px 4px; background: var(--surface); border-bottom: 1px solid var(--border); margin-bottom: 10px; }
  html[data-nav2] .n2-mhead strong { font-size: var(--fs-lg); font-weight: 600; color: var(--ink); }
  html[data-nav2] .n2-mclose { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border);
    border-radius: var(--r-sm); background: var(--surface); color: var(--ink); cursor: pointer; }
  html[data-nav2] .n2-mclose:hover { background: var(--surface-2); }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 879px) {
  html[data-nav2] body::after, html[data-nav2] .site-header > .wrap::after { transition: opacity .22s ease, visibility 0s linear .22s; }
  html[data-nav2].menu-open body::after, html[data-nav2].menu-open .site-header > .wrap::after { transition: opacity .22s ease, visibility 0s; }
  html[data-nav2] .mobile-menu:not([hidden]) { animation: n2-sheet .24s cubic-bezier(.2, .8, .2, 1) both; }
  @keyframes n2-sheet { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
}
