/* Page help — a quiet glass layer above the tactical workspace. */

.page-view {
  position: relative;
}

.page-help-slot {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: min(100%, 1400px);
  min-height: 44px;
  margin: 0 auto 8px;
  padding-inline: clamp(12px, 2.2vw, 28px);
  pointer-events: none;
}

.page-help-slot--standalone {
  width: min(100%, 1280px);
  margin-top: 12px;
}

.page-help-trigger {
  position: relative !important;
  z-index: 1;
  display: grid !important;
  place-items: center;
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  border: 1px solid transparent !important;
  border-radius: 50% !important;
  color: var(--text-primary, #fff) !important;
  background:
    linear-gradient(rgba(22, 22, 25, 0.82), rgba(22, 22, 25, 0.72)) padding-box,
    linear-gradient(135deg, rgba(194, 21, 0, 0.92), rgba(255, 197, 0, 0.92)) border-box !important;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24), inset 0 1px rgba(255, 255, 255, 0.12) !important;
  -webkit-backdrop-filter: blur(14px) saturate(145%);
  backdrop-filter: blur(14px) saturate(145%);
  cursor: pointer;
  pointer-events: auto;
  isolation: isolate;
  transition: transform 140ms cubic-bezier(0.2, 0, 0, 1), box-shadow 180ms ease, color 180ms ease !important;
}

.page-help-trigger::before {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: -1;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.035);
}

.page-help-trigger__mark {
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

@media (hover: hover) and (pointer: fine) {
  .page-help-trigger:hover {
    transform: translateY(-2px);
    color: #fff !important;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.3), inset 0 1px rgba(255, 255, 255, 0.16) !important;
  }
}

.page-help-trigger:active {
  transform: scale(0.96);
}

.page-help-trigger:focus-visible,
.page-help-close:focus-visible {
  outline: 2px solid var(--pl-cyan, #22d3ee) !important;
  outline-offset: 3px !important;
}

.page-help-layer {
  position: fixed;
  inset: 0;
  z-index: 10020;
  visibility: hidden;
  pointer-events: none;
}

.page-help-layer.is-open {
  visibility: visible;
  pointer-events: auto;
}

.page-help-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  opacity: 0;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
  transition: opacity 220ms ease-in, backdrop-filter 220ms ease-in;
}

.page-help-layer.is-open .page-help-backdrop {
  opacity: 1;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  transition-duration: 340ms;
  transition-timing-function: cubic-bezier(0.05, 0.7, 0.1, 1);
}

.page-help-panel {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  width: min(440px, calc(100vw - 24px));
  min-width: 0;
  overflow: hidden;
  color: #fff;
  background: rgba(18, 18, 21, 0.86);
  border-inline-start: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(26px) saturate(145%);
  backdrop-filter: blur(26px) saturate(145%);
  clip-path: inset(0 0 0 100%);
  opacity: 0;
  transform: translateX(24px);
  transition:
    clip-path 220ms ease-in,
    opacity 160ms ease-in,
    transform 220ms ease-in,
    box-shadow 220ms ease-in;
}

.page-help-panel::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-start: 0;
  height: 3px;
  background: linear-gradient(90deg, #c21500, #ffc500);
  transform: scaleX(0.28);
  transform-origin: left;
  opacity: 0.6;
  transition: transform 340ms cubic-bezier(0.05, 0.7, 0.1, 1) 40ms, opacity 240ms ease;
}

.page-help-layer.is-open .page-help-panel {
  clip-path: inset(0 0 0 0);
  opacity: 1;
  transform: translateX(0);
  transition-duration: 380ms, 260ms, 380ms, 380ms;
  transition-timing-function: cubic-bezier(0.05, 0.7, 0.1, 1);
}

.page-help-layer.is-open .page-help-panel::before {
  transform: scaleX(1);
  opacity: 1;
}

.page-help-panel__inner {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(24px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
  scrollbar-width: thin;
  scrollbar-color: #ffc500 rgba(255, 255, 255, 0.06);
}

.page-help-panel__inner::-webkit-scrollbar { width: 9px; }
.page-help-panel__inner::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); }
.page-help-panel__inner::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 10px;
  background: linear-gradient(#c21500, #ffc500) padding-box;
}

.page-help-close {
  position: absolute !important;
  inset-block-start: max(16px, env(safe-area-inset-top));
  inset-inline-end: 16px;
  z-index: 2;
  display: grid !important;
  place-items: center;
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  color: #fff !important;
  background: rgba(255, 255, 255, 0.055) !important;
  border: 1px solid rgba(255, 255, 255, 0.11) !important;
  border-radius: 50% !important;
  cursor: pointer;
  transition: transform 140ms cubic-bezier(0.2, 0, 0, 1), background-color 140ms ease !important;
}

.page-help-close:hover { background: rgba(255, 255, 255, 0.1) !important; }
.page-help-close:active { transform: scale(0.96); }

.page-help-heading {
  max-width: 330px;
  margin: 38px 0 14px;
  font: 650 clamp(1.7rem, 5vw, 2.2rem) / 1.08 "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.page-help-summary {
  max-width: 66ch;
  margin: 0 0 30px;
  color: #d4d4d8;
  font-size: 1rem;
  line-height: 1.62;
}

.page-help-section {
  padding: 22px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.page-help-section h3 {
  margin: 0 0 12px;
  color: #ffc500;
  font: 600 0.68rem / 1.2 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.page-help-section p,
.page-help-section li {
  color: #e4e4e7;
  font-size: 0.93rem;
  line-height: 1.62;
}

.page-help-section p { margin: 0; }
.page-help-section ol { margin: 0; padding-inline-start: 1.2rem; }
.page-help-section li + li { margin-top: 10px; }

.page-help-source {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 8px;
  padding: 14px;
  color: #d4d4d8;
  font-size: 0.78rem;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.page-help-source::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-top: 0.34rem;
  border-radius: 50%;
  background: #22d3ee;
}

:root.light-mode .page-help-trigger {
  color: #101012 !important;
  background:
    linear-gradient(rgba(255, 255, 255, 0.88), rgba(247, 247, 245, 0.82)) padding-box,
    linear-gradient(135deg, #c21500, #ffc500) border-box !important;
  box-shadow: 0 10px 24px rgba(33, 24, 14, 0.15), inset 0 1px #fff !important;
}

html.page-help-scroll-lock,
html.page-help-scroll-lock body { overflow: hidden !important; }

@media (max-width: 640px) {
  .page-help-slot {
    min-height: 48px;
    margin-bottom: 4px;
    padding-inline: 16px;
  }

  .page-help-panel {
    width: calc(100vw - 12px);
  }

  .page-help-panel__inner {
    padding-inline: 20px;
  }

  .page-help-heading {
    max-width: calc(100% - 42px);
    margin-top: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-help-trigger,
  .page-help-close,
  .page-help-backdrop,
  .page-help-panel,
  .page-help-panel::before {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

@media (forced-colors: active) {
  .page-help-trigger,
  .page-help-close,
  .page-help-panel { border: 1px solid CanvasText !important; }
}
