/* ==========================================================================
   NATIVE MODAL <dialog> SWIPE NAVIGATION DRAWER
   Scroll-snap swipe gesture + scroll-driven backdrop fade
   ========================================================================== */
.Drawer {
  --drawer-width: min(21rem, 82dvw, calc(100dvw - 24px));
  --drawer-backdrop: 0;

  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  overflow: visible;
}

.Drawer::backdrop {
  background: #020408;
  opacity: calc(var(--drawer-backdrop) * 0.78);
}

.Drawer-scroller {
  position: relative;
  display: grid;
  grid-template-columns: var(--drawer-width) 100%;
  overflow-x: scroll;
  overscroll-behavior: none;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

@supports not (scrollbar-width: none) {
  .Drawer-scroller::-webkit-scrollbar {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .Drawer-scroller {
    scroll-behavior: smooth;
  }
}

.Drawer-scroller::after {
  content: '';
  scroll-snap-align: end;
  scroll-initial-target: nearest;
}

.Drawer-sheet {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100svh;
  background: rgba(8, 13, 21, 0.98);
  color: var(--text-main);
  border-right: 1px solid var(--panel-border-bright);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.75);
  overflow-y: auto;
  scroll-snap-align: start;
  scrollbar-width: none;
  padding: 20px;
  gap: 20px;
}

.Drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--panel-border);
}

.Drawer-close {
  background: rgba(15, 24, 38, 0.95);
  border: 1px solid var(--panel-border);
  color: var(--cyber-emerald);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.Drawer-close:hover {
  border-color: var(--cyber-emerald);
  background: rgba(0, 255, 136, 0.14);
}

.Drawer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.Drawer-links a {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(15, 24, 38, 0.72);
  border: 1px solid rgba(0, 255, 136, 0.14);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 14px;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.Drawer-links a:hover {
  color: var(--cyber-emerald);
  border-color: var(--cyber-emerald);
}

.Drawer-links a.drawer-call {
  color: var(--cyber-emerald);
  border-color: rgba(0, 255, 136, 0.36);
  background: rgba(0, 255, 136, 0.08);
}

.Drawer-footer {
  padding-top: 14px;
  border-top: 1px solid var(--panel-border-subtle);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Scroll-driven backdrop fade gated by @supports */
@supports (animation-timeline: scroll()) {
  .Drawer {
    timeline-scope: --drawer-fade;
    animation: fade-drawer-backdrop linear both;
    animation-timeline: --drawer-fade;
  }

  .Drawer-scroller {
    scroll-timeline: --drawer-fade x;
  }

  @property --drawer-backdrop {
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
  }

  @keyframes fade-drawer-backdrop {
    0% {
      --drawer-backdrop: 1;
    }
    100% {
      --drawer-backdrop: 0;
    }
  }
}
