/* N216 build14 (owner 15.11.2026: «ветка должна быть везде, а не открываться отдельно»): the "Tools & guides" tree is a side column on every
   guide page from 768 px (process pages included), and a block in the page's flow below 768 px - never a slide-over with "Close".
   Shipped as assets/guides-tree.css by tree.py; loaded after the bundle and guides-b.css. The bundle's drawer code stays in the files but
   cannot start: its opener (.dl-open) is hidden from 768 px and guides-tree.js takes its click on phones. Tokens: --dl-tree, --dl-gap, --dl-top, --dl-max. */

/* from 768 px: no drawer parts */
@media (min-width: 768px) {
  .dl-open, .dl-close, .dl-backdrop { display: none !important; }
}

/* 768-1023 px: the bundle's desktop shell (docs.css, from 1024 px) with a narrower column */
@media (min-width: 768px) and (max-width: 1023.98px) {
  :root { --dl-tree: 12.5rem; }
  .dl { display: grid; grid-template-columns: var(--dl-tree) minmax(0, 1fr); column-gap: var(--dl-gap); box-sizing: border-box;
    width: 100%; max-width: var(--dl-max); margin-inline: auto; padding-inline: 1.25rem; }
  .dl > main { grid-column: 2; grid-row: 1; min-width: 0; }
  .js .dl > .dl-side { grid-column: 1; grid-row: 1; position: sticky; z-index: 5; top: var(--dl-top); bottom: auto; left: auto; align-self: start;
    box-sizing: border-box; width: 100%; margin: var(--dl-top) 0 2.5rem; max-height: calc(100vh - var(--dl-top) - 1.5rem); overflow: auto;
    overscroll-behavior: contain; padding: 0 0 1rem; scrollbar-width: thin; background: none; box-shadow: none; transform: none;
    visibility: visible; transition: none; scroll-padding-top: 0; }
  .js .dl-side .doc-head { position: static; margin-bottom: .25rem; border-radius: .5rem; background: none; box-shadow: none; }
  .js .dl-side .doc-head[aria-current="page"] { background: #EEF0F5; box-shadow: inset 3px 0 0 #5B3BE0; }
  .doc-tree a, .doc-tree summary { min-height: 2.5rem; }
  .js .dl .crumbs { display: flex; }
  .dl > main .wrap { max-width: none; margin-inline: 0; padding-inline: 0; }
  .dl > main .page-hero, .dl > main .gw-page { padding-top: var(--dl-top); padding-bottom: clamp(1.5rem, 2.5vw, 2.25rem); }
}

/* phones, below 768 px: the tree is a block above the page, closed; the page's own "Tools & guides" button (.dl-open) opens it in place */
@media (max-width: 767.98px) {
  .js .dl > .dl-side { position: static; display: none; width: auto; max-height: none; box-sizing: border-box; overflow: visible;
    margin: calc(var(--head-h, 4.5rem) + .5rem) var(--gutter, 1.25rem) .25rem; padding: .5rem .5rem .75rem; border-radius: 14px; background: #fff;
    box-shadow: inset 0 0 0 1px var(--line-2, #e3e1ee); transform: none; visibility: visible; transition: none; }
  .js .dl.is-tree-open > .dl-side { display: block; }
  /* build22: the open tree stands under the button that opened it; the button keeps its place (.is-tree-held and the four values
     are set by guides-tree.js where the button is the first thing of the page) */
  .js .dl.is-tree-held > .dl-side { margin-top: 0; }
  .js .dl.is-tree-held { position: relative; padding-top: var(--dl-pad, calc(var(--head-h, 4.5rem) + .5rem)); }
  .js .dl.is-tree-held .dl-open { position: absolute; z-index: 1; top: var(--dl-bt, 0px); left: var(--dl-bl, 0px); width: var(--dl-bw, auto); box-sizing: border-box; margin: 0; }
  /* the page's first block cuts what leaves it (overflow: hidden, for its glow) - the held button is above it now; the cut stays at the
     sides and the bottom and opens upward only */
  .js .dl.is-tree-held > main .page-hero { overflow: visible; clip-path: inset(-9999px 0 0 0); }
  .js .dl-side .doc-head { position: static; margin-bottom: .25rem; border-radius: .5rem; background: none; box-shadow: none; }
  .js .dl-side .doc-head[aria-current="page"] { background: #EEF0F5; box-shadow: inset 3px 0 0 #5B3BE0; }
  .dl.is-tree-open .dl-open { background: #EEF0F5; }
}

/* process pages (.gv-drawer): N216 build17 - the same shell as every other guide page (owner 16.11: «делай как было просто полные гайды
   переводи под структуру как у нас было»). build15's own grid for them (from 1024 px: no max width, the tree in the window's corner; 768-1023 px:
   the player over the tree) is gone; the frame sits in <main> (guide-frame.css). Only short windows keep a rule of their own: */
@media (min-width: 768px) and (max-height: 640px) {
  .dl.gv-drawer .gv-top .dl-open { display: none !important; }
}
.dl > .dl-side { scroll-margin-top: calc(var(--head-h, 4.5rem) + .5rem); }

/* the language banner (.gv > .lang-hint) is part of the page's flow, as wide as the player, and the player gives up its height */
.gv > .lang-hint { position: relative; inset: auto; z-index: 3; width: var(--gv-w); max-width: none; box-sizing: border-box;
  margin: 0 calc((100% - var(--gv-w)) / 2) .5rem; }
@media (min-width: 768px) { .gv > .lang-hint { margin-inline: 0 auto; } }   /* in the shell the frame starts at the column's edge (guide-frame.css) */
/* phones (< 720 px): the banner follows the step row in the flow, so the first screen (picture, steps, Next) keeps its height under the cookie card */
@media (max-width: 719.98px) { .gv { display: flex; flex-direction: column; } .gv > .lang-hint { order: 9; width: auto; margin: .75rem 0 0; } }
/* every other page with the tree (tool guides, reference pages, the guides index): the banner is the first thing in the page's flow, below the
   header and above the crumbs and the h1 - never over them */
.dl > main :not(.gv) > .lang-hint { position: relative; inset: auto; z-index: 3; width: auto; max-width: none; box-sizing: border-box; margin: 0 0 1rem; }
@media (max-width: 767.98px) { .dl > main :not(.gv) > .lang-hint { margin: .5rem var(--gutter, 1.25rem) 1rem; } }
/* the banner's height in the player's reserve (guide-frame.css sums --gv-lh into --gv-res on .gv): taller where the frame is narrow (a column
   below 768 px; build15: a window below 1024 px, whose frame was at most ~730 px wide) */
.dl.gv-drawer > main:has(> .gv > .lang-hint) > .gv { --gv-lh: 5.25rem; }
@container gvcol (max-width: 767.98px) { .dl.gv-drawer > main:has(> .gv > .lang-hint) > .gv { --gv-lh: 7rem; } }
@media (max-width: 719.98px) { .dl.gv-drawer > main:has(> .gv > .lang-hint) > .gv { --gv-lh: 0px; } }
/* short windows (height <= 640 px, e.g. 960x600, a phone on its side 844x390): the same as phones - the banner follows the step row, so the
   player keeps its full size (above the title it took 75 px of a 390 px window and the player shrank from 444x250 to 238x134) */
@media (min-width: 720px) and (max-height: 640px) {
  .gv { display: flex; flex-direction: column; }
  .gv > .lang-hint { order: 9; margin: .75rem calc((100% - var(--gv-w)) / 2) 0; }
  .dl.gv-drawer > main:has(> .gv > .lang-hint) > .gv { --gv-lh: 0px; }
}
@media (min-width: 768px) and (max-height: 640px) { .gv > .lang-hint { margin-inline: 0 auto; } }

/* the route number "8" repeated on the five whole processes (alternatives, not a step) says nothing: only the Learn route keeps its numbers 1-7 */
.doc-tree .doc-route a[data-step="8"]::before { display: none; }

/* N216 build17 round 3, variant b3 (appended by shell17.py; every page with the tree loads this file): a wider guide shell on wide windows.
   The bundle caps the shell (.dl, and the header and footer of tree pages: `body:has(> .dl) :is(.site-head, .site-foot) > .wrap`) at
   --dl-max = 103rem, so from a 1401 px window the logo and the tree stand further in and the process player is held by the column. Here the
   cap grows with the window from 1593 px (88vw = 103rem): the logo, the tree, the column and the header's right side move out together and
   keep their gutters, type and widths; the header's items, the open «Tools & guides» menu (it hangs under its button) and the tree's
   type do not change. 88vw makes the column about as wide as the process player at 16:9 windows (1920x1080: column 1282 px, player
   1276 px), so the frame neither runs far past the header's right edge nor leaves a field beside it. Below 1593 px nothing changes. */
body:has(> .dl) { --dl-max: max(103rem, 88vw); }
