/*
 * Page sidebar — permanent left panel for site links (one per page).
 * Separate from the app slide-out menu (.menu), which Learn does not use.
 */

/* --page-sidebar-width set in layout-responsive.css */

.page-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: var(--page-sidebar-width);
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  color: var(--color-text);
  border-right: 1px solid var(--color-border);
}

.page-sidebar__header {
  display: flex;
  align-items: stretch;
  min-height: 72px;
  padding: 14px 10px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  box-sizing: border-box;
}

.page-sidebar__home {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  line-height: 22px;
  color: var(--color-text);
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.2s ease;
}

.page-sidebar__brand {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 22px;
}

.page-sidebar__brand sup {
  font-size: 0.6em;
  font-weight: 600;
  vertical-align: super;
  line-height: 0;
}

.page-sidebar__home:not(.page-sidebar__home--active):hover {
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.page-sidebar__home--active,
.page-sidebar__home--active:hover {
  background: transparent;
  color: var(--color-text);
}

.page-sidebar__home:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.page-sidebar__home-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.page-sidebar__title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.page-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

/* Nav links (markup from site-nav.js — was in legacy menu.css) */
.menu__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-sidebar__nav .menu__link {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.2s ease, color 0.15s ease;
}

.page-sidebar__nav .menu__link:hover {
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.page-sidebar__nav .menu__link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.menu__link--active {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-accent);
}

/* Nav groups — collapsible section + staggered sub-links */
.menu__group {
  margin-bottom: 8px;
}

.menu__details {
  border-radius: var(--radius-md);
}

.menu__label {
  display: block;
  padding: 6px 14px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  cursor: pointer;
  list-style: none;
  -webkit-user-select: none;
  user-select: none;
  transition: color 0.15s ease;
}

.menu__label::-webkit-details-marker {
  display: none;
}

.menu__label::marker {
  content: "";
}

.menu__label:hover {
  color: var(--color-text);
}

.menu__details[open] > .menu__label {
  color: var(--color-text);
}

.menu__sublist {
  list-style: none;
  margin: 0;
  padding: 0 0 0 10px;
  border-left: 1px solid var(--color-border);
  margin-left: 18px;
}

.menu__sublist .menu__link--sub {
  padding: 9px 14px 9px 12px;
  font-size: 14px;
  font-weight: 500;
}

.menu__link sup {
  font-size: 0.6em;
  font-weight: 600;
  vertical-align: super;
  line-height: 0;
}

.page-sidebar__footer {
  margin-top: auto;
  padding: 12px 10px 16px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.page-sidebar__footer-links {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.page-sidebar__footer-links .menu__link {
  display: inline;
  padding: 0;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  font-size: inherit;
  font-weight: inherit;
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.15s ease;
}

.page-sidebar__footer-links .menu__link:hover {
  background: none;
  color: var(--color-accent);
  text-decoration: underline;
}

.page-sidebar__footer-links .menu__link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.page-sidebar__footer-sep {
  margin: 0 0.3em;
  color: var(--color-text-muted);
  -webkit-user-select: none;
  user-select: none;
  flex-shrink: 0;
}

.has-page-sidebar .app-main {
  margin-left: var(--page-sidebar-width);
  padding-top: 0;
  box-sizing: border-box;
}

/* Mobile drawer — width must not use --page-sidebar-width (0 on narrow viewports) */
@media (max-width: 900px) {
  .has-page-sidebar .page-sidebar {
    z-index: 110;
    width: min(280px, 88vw);
    max-width: 88vw;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .has-page-sidebar:not(.is-sidebar-open) .page-sidebar {
    overflow: hidden;
  }
}
