/* ============================================================================
 * SOLAR SYSTEM — Help panel
 *
 * Ported 1:1 from SOLAR_SYSTEM_help.html (visually locked prototype).
 * Preview-only chrome (backdrop, eclipse toggle) dropped.
 *
 * Scoping:
 *   - All HTML ids prefixed `help-` (no clashes with the main app).
 *   - All CSS variables prefixed `--hp-*` (no clashes with app variables).
 *   - Theme reactivity stays on `html.eclipse` — the JS module bridges this
 *     class from `document.body.dataset.theme === 'dark'` via MutationObserver.
 *   - `#help-panel` is a CSS container (container-type: inline-size); headers
 *     size off the panel via `cqw`, not the viewport — so the lockup never
 *     overflows the panel's fixed width on wide screens.
 * ========================================================================== */

#help-btn, #help-scrim, #help-panel {
  --hp-orange: #ff6a13;
  /* light (default) */
  --hp-bg: #f3f0ea;
  --hp-ink: #111110;
  --hp-ink-soft: #55524c;
  --hp-ink-faint: #8a857c;
  --hp-rule: rgba(17,17,16,0.12);
  --hp-rule-soft: rgba(17,17,16,0.07);
  --hp-panel-bg: #fbfaf7;
  --hp-panel-edge: rgba(17,17,16,0.10);
  --hp-hover: rgba(17,17,16,0.045);
  --hp-active: rgba(255,106,19,0.10);
  --hp-scrim: rgba(40,38,34,0.34);
  --hp-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --hp-mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
html.eclipse #help-btn, html.eclipse #help-scrim, html.eclipse #help-panel {
  --hp-bg: #0a0a0b;
  --hp-ink: #eceae5;
  --hp-ink-soft: #a6a29a;
  --hp-ink-faint: #6f6b63;
  --hp-rule: rgba(236,234,229,0.14);
  --hp-rule-soft: rgba(236,234,229,0.07);
  --hp-panel-bg: #141416;
  --hp-panel-edge: rgba(236,234,229,0.12);
  --hp-hover: rgba(236,234,229,0.06);
  --hp-active: rgba(255,106,19,0.16);
  --hp-scrim: rgba(0,0,0,0.6);
}

/* ── ? button (bottom-right of scene UI) ──────────────────────────────────── */
#help-btn {
  position: fixed; right: 22px; bottom: 22px;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--hp-panel-bg);
  border: 1px solid var(--hp-panel-edge);
  color: var(--hp-ink);
  font-family: var(--hp-sans); font-weight: 300; font-size: 19px;
  cursor: pointer; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 14px rgba(0,0,0,0.10);
  /* Color-related transitions match the eclipse tween (ECLIPSE_TWEEN_MS = 700ms
   * in main.js) so the button shifts in lockstep with the dock and scene
   * rather than snapping. Transform stays snappy so hover lift feels
   * responsive; opacity is the ob-active hide and stays fast. */
  transition:
    transform .18s ease,
    background-color .7s ease,
    border-color .7s ease,
    color .7s ease,
    opacity .25s ease;
  padding: 0;
}
#help-btn:hover { transform: translateY(-1px); border-color: var(--hp-orange); color: var(--hp-orange); }
/* Hidden while onboarding owns the screen (would overlap the tooltip layer). */
body.ob-active #help-btn { opacity: 0; pointer-events: none; }

/* ── scrim + panel ────────────────────────────────────────────────────────── */
#help-scrim {
  /* No tint — the scene shouldn't dim when the panel opens. The scrim exists
   * only as the click-to-close target; the blur is carried by the panel itself. */
  position: fixed; inset: 0; background: transparent;
  opacity: 0; pointer-events: none; transition: opacity .3s ease; z-index: 60;
}
#help-scrim.open { opacity: 1; pointer-events: auto; }

#help-panel {
  position: fixed; z-index: 61;
  top: 50%; left: 50%;
  width: min(860px, 92vw); height: min(680px, 88vh);
  transform: translate(-50%, -48%) scale(.985);
  /* Frosted glass with a slight theme back-fill (~10% more tint than before)
   * so text reads cleanly over a busy scene. Blur still carries the depth. */
  background: rgba(251, 250, 247, 0.58);
  backdrop-filter: blur(40px) saturate(1.5);
  -webkit-backdrop-filter: blur(40px) saturate(1.5);
  border: none;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease, transform .3s cubic-bezier(.2,.7,.2,1);
  display: flex; flex-direction: column; overflow: hidden;
  container-type: inline-size; container-name: help-panel;
  color: var(--hp-ink); font-family: var(--hp-sans);
}
html.eclipse #help-panel {
  background: rgba(20, 20, 22, 0.65);
  box-shadow: 0 24px 80px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* Consumer-laptop / 1080p browser heights: a panel centered at 50% can sit
 * close to (or clip) the dock at the bottom. Nudge it up so the dock is
 * fully clear. Threshold catches common laptop and 1080p browser viewports
 * (roughly 700-1000px after browser chrome); larger 1440p+ displays in
 * full-screen stay untouched. Sizing and everything else stays identical. */
@media (max-height: 1000px) {
  #help-panel { top: calc(50% - 50px); }
}
#help-panel.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }

/* ── header / tabs ────────────────────────────────────────────────────────── */
#help-panel .hp-head {
  display: flex; align-items: center; gap: 26px;
  padding: 0 20px; height: 54px;
  border-bottom: 1px solid var(--hp-rule);
  flex: 0 0 auto;
}
#help-panel .hp-tabs { display: flex; gap: 2px; height: 100%; }
#help-panel .hp-tab {
  background: none; border: none; cursor: pointer;
  font-family: var(--hp-sans); font-weight: 400; font-size: 13px;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--hp-ink-faint); padding: 0 14px; height: 100%;
  position: relative; transition: color .18s ease;
}
#help-panel .hp-tab:hover { color: var(--hp-ink-soft); }
#help-panel .hp-tab.active { color: var(--hp-ink); }
#help-panel .hp-tab.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px;
  background: var(--hp-orange);
}
#help-panel .hp-head-spacer { flex: 1; }
#help-panel .hp-close {
  background: none; border: 1px solid var(--hp-panel-edge); border-radius: 50%;
  width: 28px; height: 28px; cursor: pointer; color: var(--hp-ink-soft);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  transition: all .18s ease; padding: 0;
}
#help-panel .hp-close:hover { border-color: var(--hp-orange); color: var(--hp-orange); }

#help-panel .hp-body { flex: 1; overflow: hidden; display: flex; }

/* ── ABOUT ────────────────────────────────────────────────────────────────── */
#help-tab-about { display: none; width: 100%; flex-direction: column; position: relative; }
#help-tab-about.show { display: flex; }
#help-panel .about-wrap {
  flex: 1; max-width: 100%; margin: 0 auto; padding: 26px 24px 0;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  position: relative; z-index: 3;     /* above .fc-overlay so the Replay button is the click target */
}
#help-panel .about-lockup { display: flex; align-items: baseline; gap: .30em; justify-content: center; margin-bottom: 16px; white-space: nowrap; flex-wrap: nowrap; }
#help-panel .about-lockup .glyph {
  /* Keep the cuneiform 𒀭 character in the DOM so the wordmark inherits its
   * text-baseline metrics — `align-items: baseline` snaps the wordmark to the
   * glyph baseline, not the box bottom. Hide the text (transparent) and paint
   * the SOLAR sun SVG behind it at the same square footprint. */
  font-size: clamp(62px, 11.98cqw, 103px);
  width: 1em; height: 1em;
  color: transparent;
  display: inline-block; line-height: 1;
  background-image: url(../favicon.svg);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  /* Optical alignment nudge: the SVG fills its box edge-to-edge so its visual
   * center sits a touch above the wordmark cap-center. Push the glyph down a
   * hair via position/top — layout baseline is untouched, so the wordmark
   * stays put. */
  position: relative; top: .11em;
}
#help-panel .about-lockup .wordmark {
  font-weight: 300; font-size: clamp(50px, 9.53cqw, 82px); letter-spacing: .015em; text-transform: uppercase; color: var(--hp-ink); white-space: nowrap;
}
#help-panel .about-lockup .wordmark sup { font-size: .34em; vertical-align: top; position: relative; top: .5em; margin-left: .04em; }
#help-panel .about-version {
  font-family: var(--hp-sans); font-weight: 300; font-size: 16px; letter-spacing: .22em; color: var(--hp-ink-soft);
  margin-bottom: 24px;
}
#help-panel .about-tagline {
  font-size: 18px; line-height: 1.6; font-weight: 300; color: var(--hp-ink);
  max-width: 440px; margin: 0 auto 20px;
}
#help-panel .replay-btn {
  background: var(--hp-orange); color: #fff; border: none; border-radius: 7px;
  font-family: var(--hp-sans); font-weight: 400; font-size: 13px; letter-spacing: .06em;
  text-transform: uppercase; padding: 12px 26px; cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
#help-panel .replay-btn:hover { filter: none; transform: none; background: #000; color: #fff; }
html.eclipse #help-panel .replay-btn:hover { background: #fff; color: #000; }
#help-panel a.replay-btn { display: inline-block; text-decoration: none; line-height: 1; }
#help-panel .fb-send { margin-top: 4px; }

#help-panel .about-copyright {
  position: relative; z-index: 2;
  align-self: flex-start;
  margin: 0 0 75px 0;            /* sits ~10px higher than the prototype default */
  padding-left: 11%;             /* aligns left edge to the footer "F" (F starts at 11% of width) */
  font-size: 13px; line-height: 1.35; color: #000; font-weight: 300; letter-spacing: .02em;
  text-align: left;
}
html.eclipse #help-panel .about-copyright { color: var(--hp-ink); }

/* FC footer overlay (big graphic anchored to panel bottom, bleeds off the edge). */
#help-panel .fc-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  z-index: 1; pointer-events: none;
  display: flex; align-items: flex-end;
}
#help-panel .fc-foot-link {
  display: block; width: 100%;
  /* IMPORTANT: pointer-events is auto only when the panel is OPEN. When the
   * panel is closed it has pointer-events: none — but a child set to auto
   * would override that and keep this link clickable through the closed panel,
   * intercepting clicks on the 3D scene below. */
  pointer-events: none;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
#help-panel.open .fc-foot-link { pointer-events: auto; }
#help-panel .fc-foot { width: 100%; height: auto; display: none; }
#help-panel .fc-foot-light { display: block; }
#help-panel .fc-foot-dark { display: none; }
html.eclipse #help-panel .fc-foot-light { display: none; }
html.eclipse #help-panel .fc-foot-dark { display: block; }

/* ── GUIDE ────────────────────────────────────────────────────────────────── */
#help-tab-guide { display: none; width: 100%; }
#help-tab-guide.show { display: flex; }
#help-panel .guide-side {
  flex: 0 0 226px; border-right: 1px solid var(--hp-rule);
  overflow-y: auto; padding: 14px 0;
}
#help-panel .guide-side-group {
  font-family: var(--hp-mono); font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--hp-ink-faint); padding: 14px 22px 6px; font-weight: 400;
}
#help-panel .guide-nav-item {
  display: block; width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  font-family: var(--hp-sans); font-size: 13.5px; font-weight: 300; color: var(--hp-ink-soft);
  padding: 7px 22px; transition: background .12s ease, color .12s ease;
  border-left: 2px solid transparent;
}
#help-panel .guide-nav-item:hover { background: var(--hp-hover); color: var(--hp-ink); }
#help-panel .guide-nav-item.active {
  color: var(--hp-ink); background: var(--hp-active); border-left-color: var(--hp-orange); font-weight: 400;
}
#help-panel .guide-content { flex: 1; overflow-y: auto; padding: 44px 52px 64px; }
/* Getting Started: not enough content to warrant a scrollbar at any reasonable
 * panel height. Tighten top/bottom padding + h1, lede, and paragraph spacing
 * just enough to fit on one screen. Scoped via data-chapter so longer chapters
 * keep their breathing room. */
#help-panel .guide-content[data-chapter="getting-started"] { padding: 30px 52px 36px; }
#help-panel .guide-content[data-chapter="getting-started"] h1 { margin-bottom: 13px; }
#help-panel .guide-content[data-chapter="getting-started"] .lede { margin-bottom: 20px; }
#help-panel .guide-content[data-chapter="getting-started"] p { margin-bottom: 12px; line-height: 1.6; }
#help-panel .guide-content[data-chapter="getting-started"] h3 { margin: 18px 0 7px; }
#help-panel .guide-content h1 {
  font-weight: 300; font-size: clamp(34px, 6.98cqw, 60px); letter-spacing: .015em;
  text-transform: uppercase; margin-bottom: 18px; color: var(--hp-ink); line-height: 1.04;
}
#help-panel .guide-content h1.module-title { text-transform: uppercase; letter-spacing: .015em; }
#help-panel .guide-content .lede {
  font-size: 15px; font-weight: 300; color: var(--hp-ink); font-style: italic;
  margin-bottom: 26px; line-height: 1.5;
}
#help-panel .guide-content h3 {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 500;
  color: var(--hp-ink); margin: 30px 0 10px;
}
#help-panel .guide-content h3:first-of-type { margin-top: 8px; }
#help-panel .guide-content p { font-size: 14.5px; line-height: 1.72; font-weight: 300; color: var(--hp-ink); margin-bottom: 13px; }
#help-panel .guide-content ul { margin: 4px 0 16px; padding-left: 20px; }
#help-panel .guide-content li { font-size: 14.5px; line-height: 1.7; font-weight: 300; color: var(--hp-ink); margin-bottom: 4px; }
#help-panel .guide-content b { font-weight: 600; color: var(--hp-ink); }
#help-panel .guide-content code {
  font-family: var(--hp-mono); font-size: 12.5px; background: var(--hp-hover);
  padding: 1px 6px; border-radius: 4px; color: var(--hp-ink);
}
/* Inline preset-row visualization (e.g. KEYBOARD chapter — mirrors the on-screen
 * preset row, with the hotkey badge above each preset name). Twelve EQUAL
 * columns (grid) so the numbers form a perfectly aligned row above the names. */
#help-panel .preset-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin: 10px 0 18px;
  padding: 16px 14px;
  background: var(--hp-hover); border-radius: 7px;
}
#help-panel .preset-row .preset {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-family: var(--hp-sans); font-weight: 300;
  min-width: 0;
}
#help-panel .preset-row .preset .n {
  font-family: var(--hp-mono); font-size: 14px; font-weight: 400;
  color: var(--hp-orange); line-height: 1;
}
#help-panel .preset-row .preset .nm {
  font-size: 10.5px; color: var(--hp-ink); letter-spacing: .01em; line-height: 1;
  text-align: center;
}

/* Scene chapter "seven modules" list — each row leads with a 7-dot pointy-top
 * hex marker. Six dots are orange (the ring of outer modules) and one dot is
 * rendered in `currentColor` (== ink). The currentColor dot's position encodes
 * that module's place on the ring: NEXUS = center, AURA = back (top),
 * NOVA = back-right, OPAL = front-right, EMERALD = front (bottom),
 * QUARTZ = front-left, WORMHOLE = back-left. Because the highlight dot uses
 * currentColor it tracks the theme — dark on light mode, light on eclipse. */
/* Flush-left override — the generic `.guide-content ul` rule above sets
 * padding-left: 20px for default bullet space; this list has no bullets and
 * wants the hex marker aligned with the surrounding paragraph edge. */
#help-panel .guide-content ul.scene-modules,
#help-panel .scene-modules {
  list-style: none;
  padding: 0;
  padding-left: 0;
  margin: 10px 0 18px;
  margin-inline-start: 0;
}
#help-panel .scene-modules li {
  display: flex;
  align-items: center;           /* hex marker vertically centers against the (single-line) title row */
  gap: 5px;                      /* tight — the marker sits right next to the name, no tab indent */
  margin-bottom: 18px;           /* near-double spacing — rows breathe with a clear gap between them */
  color: var(--hp-ink);          /* drives currentColor on the highlight dot */
  white-space: nowrap;           /* one row per module */
}
#help-panel .scene-modules .hex-marker {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}
#help-panel .scene-modules li .m {
  flex: 1 1 auto;
  min-width: 0;
  /* Sized so the longest tagline (WORMHOLE) fits on one line at the help-panel
   * container width. Smaller than the chapter body — the marker + name carry
   * the visual. */
  font-size: clamp(9.5px, 1.25cqw, 10.75px);
  line-height: 1.35;
}
#help-panel .scene-modules li b {
  color: var(--hp-ink);
  /* Name is larger than the description but NOT bold — weight 400, just scale + tracking */
  font-weight: 400;
  font-size: clamp(12px, 1.6cqw, 14px);
  letter-spacing: .015em;
}
#help-panel .scene-modules li .bar {
  /* Pure ink (theme-reactive) — not the soft rule color */
  color: var(--hp-ink);
  margin: 0 .45em 0 .25em;
  font-weight: 300;
  opacity: .55;                  /* a hair of softening so it sits visually behind the words */
}

/* Shortcuts table */
#help-panel .sc-group { margin-bottom: 24px; }
#help-panel .sc-group h3 { margin-bottom: 8px; }
#help-panel .sc-row { display: flex; gap: 18px; padding: 6px 0; border-bottom: 1px solid var(--hp-rule-soft); }
#help-panel .sc-key {
  flex: 0 0 200px; font-family: var(--hp-mono); font-size: 12.5px; color: var(--hp-ink);
}
#help-panel .sc-desc { font-size: 13.5px; font-weight: 300; color: var(--hp-ink); }
#help-panel .sc-note {
  font-size: 12px; font-style: italic; color: var(--hp-ink); margin-bottom: 22px;
  padding: 10px 14px; background: var(--hp-hover); border-radius: 6px;
}

/* ── FEEDBACK ─────────────────────────────────────────────────────────────── */
#help-tab-feedback { display: none; width: 100%; flex-direction: column; position: relative; }
#help-tab-feedback.show { display: flex; }
#help-panel .fb-wrap { flex: 1; max-width: 100%; margin: 0 auto; padding: 26px 24px 0; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  position: relative; z-index: 3; }    /* above .fc-overlay so the Send Feedback link is the click target */
#help-panel .fb-wrap p.intro { font-size: 18px; font-weight: 300; color: var(--hp-ink); margin: 0 auto 20px; line-height: 1.6; max-width: 440px; min-height: 57.6px; }

/* ── Scrollbars (thin, restrained) ────────────────────────────────────────── */
#help-panel .guide-content::-webkit-scrollbar { width: 6px; }
#help-panel .guide-content::-webkit-scrollbar-track { background: transparent; }
#help-panel .guide-content::-webkit-scrollbar-thumb { background: var(--hp-rule); border-radius: 0; }
#help-panel .guide-content { scrollbar-width: thin; scrollbar-color: var(--hp-rule) transparent; }
#help-tab-about::-webkit-scrollbar, #help-tab-feedback::-webkit-scrollbar, #help-panel .guide-side::-webkit-scrollbar { width: 6px; }
#help-tab-about::-webkit-scrollbar-thumb, #help-tab-feedback::-webkit-scrollbar-thumb, #help-panel .guide-side::-webkit-scrollbar-thumb { background: var(--hp-rule); border-radius: 0; }
