/* V118 WS-S (V118-SB-01, Sidebar R2). Regular layouts set html[data-pb118-sb="r2"] when rendering the site sidebar.
   _PbSidebar links this stylesheet after the base shell styles for an R2 tree.
   - Widths: >= 1200 240 expanded / 80 rail (PB-C027 232-264; R2 board 292-337 / 292-674) instead of the V101 224 / 72.
   - 768-1199: the forced 80 rail keeps its own control, which opens the labelled modal drawer (SB-T28; pb-sidebar.js).
   - < 768: drawer min(320px, 100vw - 32px) = 288px at 320 (QA frames 295-1035), a scrolling list, the close control at the top,
     safe areas. The Regular bottom globe opens preferences in column 2. Explore remains in the drawer.
   - Current row: tint + a 3px leading mark in --pb-focus (#BD006E light / #FFB2D8 dark), kept on hover; focus stays its own ring.
   Colours only from pb-tokens.css (light and dark resolve through the tokens). */

@media (min-width: 1200px) {
    html[data-pb118-sb="r2"] .pb-sb-root { --pb-sb-w: 240px; --pb-sb-rail: 80px; }
}

/* ------------------------------------------------------------------ rows: one current mark, quiet dividers, one heading */
html[data-pb118-sb="r2"] .pb-sb .pb-sb-link[aria-current]::before { background: var(--pb-focus); }
html[data-pb118-sb="r2"] .pb-sb .pb-sb-link[aria-current]:hover { background: var(--pb-surface-selected); }
html[data-pb118-sb="r2"] .pb-sb .pb-sb-group.pb118-sb-divider {
    block-size: 1px; margin: 12px 8px; padding: 0; overflow: hidden; color: transparent; border-block-start: 1px solid var(--pb-divider);
}
html[data-pb118-sb="r2"] .pb-sb .pb-sb-text { overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ the drawer: 288px at 320, scroll, close on top, safe areas */
html[data-pb118-sb="r2"] .pb-sb-drawer { inline-size: min(320px, calc(100vw - 32px)); max-inline-size: calc(100vw - 32px); }
html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-head { padding-block-start: max(14px, env(safe-area-inset-top, 0px)); }
html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-scroll { padding-block-end: calc(16px + env(safe-area-inset-bottom, 0px)); }
html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-close { min-inline-size: 44px; min-block-size: 44px; }

/* ------------------------------------------------------------------ 768-1199: the rail control opens the labelled drawer */
@media (min-width: 768px) and (max-width: 1199.98px) {
    html[data-pb118-sb="r2"] .pb-sb .pb-sb-collapse { display: inline-flex; }
    html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb { display: flex; position: static; inline-size: 100%; block-size: 100%; border-inline-end: 0; transition: none; }
    html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-head { flex-direction: row; justify-content: space-between; padding-inline: 16px 12px; }
    html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-logo { inline-size: 48px; block-size: 48px; }
    html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-word { display: inline; }
    html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-scroll { padding-inline: 16px; }
    html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-link { justify-content: flex-start; padding-inline: 16px; }
    html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-text {
        position: static; inline-size: auto; block-size: auto; overflow: visible; clip: auto; clip-path: none; white-space: normal;
    }
    html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-group { block-size: auto; margin: 20px 8px 8px; overflow: visible; color: var(--pb-text-secondary); border-block-start: 0; }
    html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-group.pb118-sb-divider { block-size: 1px; margin: 12px 8px; overflow: hidden; color: transparent; border-block-start: 1px solid var(--pb-divider); }
    html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-foot { display: block; }
    html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-collapse { display: none; }
    html[data-pb118-sb="r2"] .pb-sb-drawer .pb-sb .pb-sb-close { display: inline-flex; }
}

@media (forced-colors: active) {
    html[data-pb118-sb="r2"] .pb-sb .pb-sb-link[aria-current]::before { background: Highlight; }
}
