/* KRONOS Unified Mobile Navigation Drawer
 * Native top-layer <dialog> + CSS scroll-snap swipe + scroll-driven ::backdrop fade
 */

:root {
  --kn-bg-top: #0E1525;
  --kn-bg-bottom: #060910;
  --kn-surface: rgba(255, 255, 255, 0.045);
  --kn-surface-hover: rgba(255, 255, 255, 0.085);
  --kn-border: rgba(255, 255, 255, 0.11);
  --kn-fg: #F8FAFC;
  --kn-muted: #94A3B8;
  --kn-cyan: #22D3EE;
  --kn-emerald: #10B981;
  --kn-indigo: #818CF8;
  --kn-discord: #5865F2;
}

/* ==========================================================================
   1. Sleek 1-Row Mobile Header & Hamburger Trigger Across All Store Pages
   ========================================================================== */

.kn-mobile-actions {
  display: none;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.kn-quick-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-block-size: 38px;
  padding-inline: 0.85rem;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--kn-cyan), var(--kn-emerald));
  color: #041315 !important;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(34, 211, 238, 0.22);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.kn-quick-cta:hover {
  filter: brightness(1.08);
}

.kn-quick-cta:active {
  transform: scale(0.97);
}

button.kn-trigger,
header.site-header button.menu-button.kn-trigger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 44px;
  block-size: 44px;
  min-inline-size: 44px;
  min-block-size: 44px;
  padding: 0;
  margin: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.055);
  color: var(--kn-fg);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

button.kn-trigger:hover,
header.site-header button.menu-button.kn-trigger:hover {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.45);
  color: var(--kn-cyan);
}

button.kn-trigger:active,
header.site-header button.menu-button.kn-trigger:active {
  transform: scale(0.94);
}

button.kn-trigger:focus-visible,
.Drawer-close:focus-visible,
.Drawer-link:focus-visible,
.Drawer-anchor-chip:focus-visible,
.Drawer-cta-primary:focus-visible,
.Drawer-cta-discord:focus-visible,
.Drawer-legal a:focus-visible {
  outline: 2px solid var(--kn-cyan);
  outline-offset: 2px;
}

button.kn-trigger svg {
  display: block;
  inline-size: 21px;
  block-size: 21px;
  pointer-events: none;
}

/* Variant A: Root Storefront (menumake.net/) */
@media (max-width: 860px) {
  body.kn-store-root .site-header .header-inner {
    flex-wrap: nowrap;
    justify-content: space-between;
    padding: 0.58rem 0.85rem;
    gap: 0.65rem;
  }

  body.kn-store-root .site-header nav[aria-label="Primary"] {
    display: none;
  }

  body.kn-store-root .site-header .kn-mobile-actions {
    display: inline-flex;
  }
}

/* Variant B: Dynamic ResizeObserver headers (spoofer, rob-run, autoquest) */
html body header.site-header#siteHeader.is-wide .kn-mobile-only,
html body header.site-header#siteHeader.is-wide .kn-quick-cta,
html body header.site-header#siteHeader.is-wide button.menu-button.kn-trigger {
  display: none !important;
}

header.site-header#siteHeader:not(.is-wide) .site-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

header.site-header#siteHeader:not(.is-wide) .kn-mobile-only {
  display: inline-flex;
}

header.site-header#siteHeader:not(.is-wide) .header-inner {
  flex-wrap: nowrap;
  justify-content: space-between;
  padding-block: 0.58rem;
  padding-inline: 0.85rem;
  gap: 0.65rem;
}

html.kn-drawer-ready header.site-header#siteHeader:not(.is-wide) .site-menu {
  display: none !important;
}

/* Variant C: Static breakpoint site-header pages (status, support, account, hwid-reset, terms, privacy, success, reset-password) */
@media (min-width: 921px) {
  html body header.site-header:not(#siteHeader) button.menu-button.kn-trigger,
  html body header.site-header:not(#siteHeader) .kn-mobile-only {
    display: none !important;
  }
}

header.site-header:not(#siteHeader) .kn-mobile-only {
  display: none;
}

@media (max-width: 920px) {
  html body header.site-header:not(#siteHeader) .header-inner {
    flex-wrap: nowrap;
    justify-content: space-between;
    padding-block: 0.58rem;
    padding-inline: 0.85rem;
    gap: 0.65rem;
  }

  html body header.site-header:not(#siteHeader) .site-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
  }

  html body header.site-header:not(#siteHeader) .site-menu {
    display: none !important;
  }

  html body header.site-header:not(#siteHeader) .menu-button,
  html body header.site-header:not(#siteHeader) .kn-mobile-only {
    display: inline-flex !important;
  }
}

/* Variant D: Checkout (buy.php header.top) */
@media (max-width: 920px) {
  html body header.top {
    position: sticky;
    inset-block-start: 0.6rem;
    z-index: 40;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center;
    gap: 0.65rem;
    padding: 0.58rem 0.85rem !important;
    border-radius: 16px;
    background: rgba(11, 16, 24, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  html body header.top .nav-links {
    display: none !important;
  }

  html body header.top .kn-mobile-actions {
    display: inline-flex;
  }
}

/* Variant E: Download gate (download.php .top) */
@media (max-width: 720px) {
  html body .top.kn-download-top {
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.8rem;
    border-radius: 14px;
    background: rgba(11, 16, 24, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.09);
  }

  html body .top.kn-download-top > a:not(:first-child) {
    display: none;
  }

  html body .top.kn-download-top .kn-mobile-actions {
    display: inline-flex;
  }
}

/* Ultra-narrow phone polish (prevent logo/badge crowding on 320px-440px screens) */
@media (max-width: 480px) {
  html body .site-logo,
  html body header.top .brand {
    min-inline-size: 0;
    gap: 0.45rem !important;
    font-size: 1rem !important;
  }

  html body .site-logo .ver,
  html body .site-logo .store-chip,
  html body header.top .brand .chip {
    font-size: 0.62rem !important;
    padding: 2px 7px !important;
    max-inline-size: 8.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 360px) {
  .kn-quick-cta {
    padding-inline: 0.65rem;
    font-size: 0.74rem;
  }

  html body .site-logo .ver,
  html body header.top .brand .chip {
    display: none;
  }
}

/* ==========================================================================
   2. Native Top-Layer Slide-In Navigation Drawer (<dialog class="Drawer">)
   ========================================================================== */

dialog.Drawer {
  /* Leave ~16-20% viewport peek on mobile so tap-outside & swipe affordance is obvious */
  --drawer-width: min(20.5rem, 84dvw, 100dvw - 44px);
  --drawer-backdrop: 0;

  /* Reset UA <dialog> centering, margins, borders and max-size constraints */
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  overflow: visible;
  color: var(--kn-fg);
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}

dialog.Drawer:not([open]) {
  display: none;
}

dialog.Drawer::backdrop {
  background: #02050C;
  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;
}

.Drawer-scroller::-webkit-scrollbar {
  display: none;
}

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

/* Empty full-viewport spacer creating the "closed" snap stop */
.Drawer-scroller::after {
  content: "";
  scroll-snap-align: end;
  scroll-initial-target: nearest;
}

.Drawer-sheet {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  /* Use svh (not vh/dvh) so sheet height never jumps when mobile URL bars resize mid-swipe */
  height: 100vh;
  height: 100svh;
  background:
    radial-gradient(circle at 0% 0%, rgba(34, 211, 238, 0.13), transparent 44%),
    radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.09), transparent 42%),
    linear-gradient(180deg, var(--kn-bg-top) 0%, var(--kn-bg-bottom) 100%);
  color: var(--kn-fg);
  border-inline-end: 1px solid var(--kn-border);
  box-shadow: 18px 0 48px rgba(0, 0, 0, 0.75);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-align: start;
  scrollbar-width: none;
}

.Drawer-sheet::-webkit-scrollbar {
  display: none;
}

/* Subtle right-edge swipe pill hint (moves with the sheet during swipe) */
.Drawer-sheet::after {
  content: "";
  position: absolute;
  inset-block-start: 50svh;
  inset-inline-end: 6px;
  inline-size: 3px;
  block-size: 36px;
  translate: 0 -50%;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
  z-index: 3;
}

/* Scroll-driven ::backdrop fade — strictly gated in @supports */
@supports (animation-timeline: scroll()) {
  dialog.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; }
  }
}

/* ==========================================================================
   3. Drawer Interior Sections, Links & Footer Dock
   ========================================================================== */

.Drawer-head {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 0.95rem 0.85rem 1.1rem;
  background: rgba(11, 16, 28, 0.92);
  border-block-end: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.Drawer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--kn-fg);
  min-inline-size: 0;
}

.Drawer-brand-logo {
  inline-size: 34px;
  block-size: 34px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  border-radius: 7px;
  filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.28));
}

.Drawer-brand-text {
  display: grid;
  line-height: 1.15;
}

.Drawer-brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  color: var(--kn-fg);
}

.Drawer-brand-sub {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--kn-cyan);
  text-transform: uppercase;
}

.Drawer-close {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 44px;
  block-size: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #CBD5E1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.14s ease;
}

.Drawer-close:hover {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.45);
  color: #FCA5A5;
}

.Drawer-close:active {
  transform: scale(0.93);
}

.Drawer-body {
  padding: 0.95rem 0.9rem 1.15rem;
  display: grid;
  gap: 1.15rem;
  align-content: start;
}

.Drawer-group {
  display: grid;
  gap: 0.35rem;
}

.Drawer-group-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748B;
  padding-inline: 0.55rem;
  margin-block-end: 0.15rem;
}

.Drawer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.25rem;
}

.Drawer-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.72rem;
  min-block-size: 48px;
  padding: 0.45rem 0.72rem;
  border-radius: 12px;
  border: 1px solid transparent;
  color: #CBD5E1;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.Drawer-link:hover {
  background: var(--kn-surface-hover);
  color: #FFFFFF;
}

.Drawer-link-ico {
  inline-size: 32px;
  block-size: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--item-accent, #CBD5E1);
}

.Drawer-link-ico svg {
  inline-size: 16px;
  block-size: 16px;
  display: block;
}

.Drawer-link-text {
  flex: 1 1 auto;
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.Drawer-link-tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--item-accent, #94A3B8);
  text-transform: uppercase;
  flex-shrink: 0;
}

.Drawer-live-dot {
  inline-size: 7px;
  block-size: 7px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 8px #34D399;
  flex-shrink: 0;
}

/* Active page state: non-color visual indicator (pill bar + border + badge) with >= 3:1 contrast */
.Drawer-link[aria-current="page"] {
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.36);
  color: #FFFFFF;
  font-weight: 700;
}

.Drawer-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block: 10px;
  inline-size: 3.5px;
  border-radius: 0 4px 4px 0;
  background: var(--item-accent, var(--kn-cyan));
}

.Drawer-link[aria-current="page"] .Drawer-link-ico {
  background: rgba(34, 211, 238, 0.15);
  border-color: rgba(34, 211, 238, 0.4);
  color: var(--item-accent, var(--kn-cyan));
}

/* On-This-Page quick anchor pills */
.Drawer-anchors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  padding-inline: 0.2rem;
}

.Drawer-anchor-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-block-size: 36px;
  padding-inline: 0.78rem;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #E2E8F0;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.Drawer-anchor-chip:hover {
  background: rgba(34, 211, 238, 0.13);
  border-color: rgba(34, 211, 238, 0.45);
  color: #FFFFFF;
}

/* Sticky Bottom Footer Dock */
.Drawer-foot {
  position: sticky;
  inset-block-end: 0;
  z-index: 2;
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem 0.95rem calc(0.95rem + env(safe-area-inset-bottom, 0px));
  background: rgba(8, 12, 20, 0.95);
  border-block-start: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.Drawer-cta-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-block-size: 48px;
  padding-inline: 1rem;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--kn-cyan), var(--kn-emerald));
  color: #041315 !important;
  font-weight: 800;
  font-size: 0.92rem;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.22);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.Drawer-cta-primary:hover {
  filter: brightness(1.07);
}

.Drawer-cta-primary:active {
  transform: scale(0.98);
}

.Drawer-cta-discord {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-block-size: 44px;
  padding-inline: 1rem;
  border-radius: 12px;
  background: rgba(88, 101, 242, 0.18);
  border: 1px solid rgba(88, 101, 242, 0.48);
  color: #E0E7FF !important;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.Drawer-cta-discord:hover {
  background: rgba(88, 101, 242, 0.3);
  border-color: rgba(129, 140, 248, 0.72);
}

.Drawer-legal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding-block-start: 0.2rem;
  font-size: 0.73rem;
  color: #64748B;
}

.Drawer-legal a {
  color: #94A3B8;
  text-decoration: none;
  padding: 0.15rem 0.25rem;
}

.Drawer-legal a:hover {
  color: #F8FAFC;
  text-decoration: underline;
}

/* High-contrast / Windows Forced Colors accessibility support */
@media (forced-colors: active) {
  .Drawer-sheet {
    border-inline-end: 2px solid CanvasText;
  }

  button.kn-trigger,
  .Drawer-close,
  .Drawer-cta-primary,
  .Drawer-cta-discord {
    border: 1px solid ButtonText;
  }

  .Drawer-link[aria-current="page"] {
    border: 2px solid Highlight;
  }

  .Drawer-link[aria-current="page"]::before {
    background: Highlight;
  }
}
