/* ==========================================================================
   sidebar.css — FORMA Shared Page Sidebar
   Used by: audit.html · ui-library.html
   Requires: tokens.css · shared.css (loaded before this file)
   ========================================================================== */

.page-sidebar {
  position: fixed;
  top: 48px;
  left: 0;
  width: 220px;
  height: calc(100vh - 48px);
  background: var(--surface);
  border-right: 1px solid var(--color-borders-default);
  padding: 32px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
  z-index: 100;
}

.page-sidebar__logo {
  font-family: var(--font-family-headings);
  font-size: var(--font-size-h6);
  letter-spacing: 0.06em;
  color: var(--color-text-primary);
  margin: 0 0 24px;
  line-height: var(--line-height-snug);
  animation: slide-up var(--dur-slow) var(--ease-expo) 60ms both;
}

.page-sidebar__group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
  opacity: 0;
  animation: fade-in var(--dur-base) ease both;
}

.page-sidebar__group:nth-child(2) { animation-delay: 160ms; }
.page-sidebar__group:nth-child(3) { animation-delay: 240ms; }
.page-sidebar__group:nth-child(4) { animation-delay: 320ms; }
.page-sidebar__group:nth-child(5) { animation-delay: 400ms; }

.page-sidebar__group-label {
  font-family: var(--font-family-body);
  font-size: var(--font-size-body-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-ghost);
  padding: 4px 8px;
  margin-bottom: 4px;
}

.page-sidebar a {
  font-family: var(--font-family-body);
  font-size: var(--font-size-body-md);
  line-height: var(--line-height-base);
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 10px 8px;
  min-height: 44px;
  display: flex;
  align-items: center;
  border-radius: var(--radius-4);
  transition: background-color var(--dur-fast) ease,
              color var(--dur-fast) ease;
}

.page-sidebar a:hover {
  background-color: var(--color-interactive-subtle);
  color: var(--color-interactive-primary-text);
}

.page-sidebar a.active {
  background-color: var(--color-interactive-subtle);
  color: var(--color-interactive-primary-text);
  font-weight: var(--font-weight-medium);
}
.page-sidebar a:focus-visible {
  outline: 2px solid var(--color-interactive-primary-text);
  outline-offset: -2px;
}

@media (max-width: 900px) {
  .page-sidebar {
    position: sticky;
    top: 48px;
    left: 0;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-borders-default);
    padding: 0 16px;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 4px;
    z-index: 90;
    scrollbar-width: none;
  }

  .page-sidebar::-webkit-scrollbar { display: none; }

  .page-sidebar__logo { display: none; }

  .page-sidebar__group {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    margin-bottom: 0;
    animation: none;
    opacity: 1;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .page-sidebar__group-label { display: none; }

  .page-sidebar a {
    white-space: nowrap;
    padding: 10px 12px;
    flex-shrink: 0;
  }
}
