/* Drawer — right-side slide-in nav for narrow viewports.
 * CSS hides it on desktop (display: none); the topbar's media query
 * flips it to flex below the 700px breakpoint, and the JS module
 * (modules/drawer.js) toggles `.open` to slide it in.
 */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--shadow-drawer);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 50;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.drawer-backdrop.open { opacity: 1; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(82vw, 320px);
  background: linear-gradient(180deg, var(--surface-drawer-top) 0%, var(--surface-drawer-bot) 100%);
  border-left: 1px solid var(--line);
  box-shadow: -10px 0 40px -10px var(--shadow-strong);
  display: none;
  flex-direction: column;
  z-index: 60;
  transform: translateX(100%);
  transition: transform 0.22s ease;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.drawer-head .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}
.drawer-head .brand .badge {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.3) 0%, transparent 70%);
  display: grid;
  place-items: center;
}
.drawer-head .brand .badge img {
  width: 24px; height: 24px;
  filter: drop-shadow(0 0 5px rgba(var(--accent-rgb), 0.4));
}
.drawer-head .brand .name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
}
.drawer-head .brand .name .accent { color: var(--accent); }
.drawer-close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 28px;
  line-height: 1;
  width: 36px; height: 36px;
  cursor: pointer;
  border-radius: 6px;
}
.drawer-close:hover { color: var(--accent); background: rgba(var(--accent-rgb), 0.06); }

.drawer-nav {
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  flex: 1;
  overflow-y: auto;
}
.drawer-item {
  position: relative;
  padding: 14px 16px 14px 22px;
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.drawer-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.drawer-item.active {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}
.drawer-item.active::before {
  content: "";
  position: absolute;
  left: 8px; top: 10px; bottom: 10px;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.6);
}

.drawer-foot {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.drawer-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.drawer-user .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  flex: 0 0 auto;
}
.drawer-user .meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.drawer-user .meta strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-user .meta .email {
  color: var(--text-soft);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-foot button.link {
  font-family: inherit;
  padding: 6px 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  border: 1px solid var(--line);
  cursor: pointer;
}
.drawer-foot button.link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Stop background scroll while drawer is open. */
body.drawer-locked { overflow: hidden; }

/* Desktop hides the drawer (.drawer above is `display: none`); flip
   it back on at the same 700px breakpoint topbar.css uses to fold
   tabs + user-menu away. Same number, same intent — kept here so
   the drawer's responsive behavior is self-contained. */
@media (max-width: 700px) {
  .drawer { display: flex; }
}
