/* ============================================================
   SIDE MENU — what the sticky side menu adds to the course menu (course.css .course-menu)
   Requires: tokens.css, course.css. Markup: site/src/components/SideMenu.astro
   .side-menu--anchors    in-page links; the section on screen is current (aria-current="location"), the same dark pill
   .side-menu--accordion  groups that open one at a time (a trigger with a count, the rows in a drawer); the open
                          group takes a fill one step from the panel's
   .side-menu--plain      no panel, no head: the rows straight on the page, the current one marked by its dot
                          (live /features); phones keep the bar and a filled list
   ============================================================ */

.course-menu__link[aria-current="location"] { background: var(--menu-current-bg); color: var(--menu-current-ink); }
.course-menu__link[aria-current="location"]::before { background: var(--menu-current-ink); }

/* accordion */
.side-menu { --menu-open-bg: var(--color-surface-muted); }
.theme-dark .side-menu { --menu-open-bg: var(--color-bg-grey-hover); }
.side-menu__group { border-radius: var(--radius-md); transition: background-color var(--duration-hover) var(--ease-hover); }
.side-menu__group.is-open { background: var(--menu-open-bg); }
.side-menu__trigger {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm);
  width: 100%; padding: var(--space-xs) var(--space-sm); border: 0; border-radius: var(--radius-md);
  background: none; color: inherit; text-align: left; cursor: pointer;
}
.side-menu__row-count { flex: none; margin-left: auto; padding-left: var(--space-xs); } /* a row's number at its end (SideMenu items with count) */
.side-menu__group + .side-menu__group { margin-top: var(--space-xxs); } /* groups never touch: a hovered one next to the open one */
@media (hover: hover) { .side-menu__group:not(.is-open):hover { background: var(--menu-open-bg); } } /* the hover is the group's own fill and radius, as when open */
.side-menu__drawer { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows var(--duration-hover) var(--ease-hover), visibility 0s var(--duration-hover); }
.side-menu__group.is-open .side-menu__drawer { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows var(--duration-hover) var(--ease-hover); }
.side-menu__items { overflow: hidden; gap: 0; padding: 0 var(--space-xs); } /* the current row's pill 8 in from the group's edge (Liliya 30.10.2026) */
.side-menu__group.is-open .side-menu__items { padding-bottom: var(--space-xs); } /* only when open: closed, the group is its trigger alone, text centred in the hover fill */
/* one rhythm: a row in a group is as tall as a group's trigger (8 · text · 8), a step in under its group (Liliya 30.10: the
   current row looked squeezed at 4 · text · 4 while the triggers stood far apart) */
.side-menu__items .course-menu__link { padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-xs); } /* 16 inside the pill, as the course menu's rows (Liliya 02.11.2026); nested radius 12 − 8 */
@media (prefers-reduced-motion: reduce) { .side-menu__group, .side-menu__drawer { transition: none; } }

/* plain: the rows on the page itself */
.course-menu.side-menu--plain { --menu-bg: transparent; }
@media (min-width: 48rem) { .side-menu--plain .course-menu__list { gap: 0; } } /* rows touch: step 40, not 48 — denser (Liliya, /features review 02.11.2026); the phone list keeps the course menu's 8 */
.side-menu--plain .course-menu__head { display: none; }
.side-menu--plain .course-menu__scroll { padding: 0; }
.side-menu--plain .course-menu__link[aria-current] { background: none; color: inherit; }
.side-menu--plain .course-menu__link[aria-current]::before { width: var(--space-xs); height: var(--space-xs); margin-right: var(--space-xs); background: var(--menu-dot); }

@media (max-width: 47.9375rem) {
  .course-menu.side-menu--plain { --menu-bg: var(--color-surface); }
  .theme-dark .course-menu.side-menu--plain { --menu-bg: var(--color-bg-grey); }
  .side-menu--plain .course-menu__scroll { padding: var(--space-xs) var(--space-sm) var(--space-sm); }
}
