/* ── PureGrain Help Documentation System ─────────────────────────────────── */
/* Load after base.css. All variables are inherited from the dark-space theme. */

:root {
  --green:  #4dc864;
  --yellow: #f0b030;
  --red:    #e06060;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.help-header {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #060618 0%, #0d1230 50%, #0b0b1f 100%);
  border-bottom: 2px solid var(--accent);
  padding: 24px 20px 20px; text-align: center;
}
.help-header::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(77,184,255,.08) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: help-shimmer 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes help-shimmer { 0% { transform: translateX(-100%); } 60%,100% { transform: translateX(100%); } }
.help-header-inner { max-width: 980px; margin: 0 auto; }
.help-header-brand { font-size: 1.5rem; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.help-header-brand span { color: var(--accent); }
.help-header-tagline { font-size: .78rem; color: var(--muted); letter-spacing: .05em; margin-top: 4px; }
.help-header-nav {
  display: flex; justify-content: center; gap: 20px; margin-top: 12px; flex-wrap: wrap;
}
.help-header-nav a { font-size: .84rem; color: var(--muted); text-decoration: none; }
.help-header-nav a:hover { color: var(--accent); }
.help-header-nav a.btn-sm {
  background: var(--accent); color: #000; padding: 5px 14px;
  border-radius: 6px; font-weight: 700; font-size: .82rem;
}
.help-header-nav a.btn-sm:hover { filter: brightness(1.1); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.help-layout {
  max-width: 980px; margin: 0 auto;
  display: grid; grid-template-columns: 220px 1fr;
  gap: 0; padding: 0 16px;
}
@media (max-width: 700px) { .help-layout { grid-template-columns: 1fr; padding: 0 12px; } }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.help-sidebar {
  padding: 32px 0 60px;
  position: sticky; top: 20px; align-self: start;
  max-height: calc(100vh - 40px); overflow-y: auto;
}
@media (max-width: 700px) {
  .help-sidebar {
    position: static; max-height: none;
    padding: 16px 0 0; border-bottom: 1px solid var(--line); margin-bottom: 28px;
  }
}
.sidebar-group { margin-bottom: 4px; }
.sidebar-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); padding: 14px 16px 5px; opacity: .7;
}
.sidebar-label:first-child { padding-top: 0; }
.sidebar-nav { list-style: none; }
.sidebar-nav a {
  display: block; padding: 5px 16px; font-size: .87rem; color: var(--muted);
  text-decoration: none; border-left: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s; border-radius: 0 6px 6px 0;
}
.sidebar-nav a:hover { color: var(--text); }
.sidebar-nav a.active { color: var(--accent); border-left-color: var(--accent); background: rgba(239,96,8,.06); }
@media (max-width: 700px) {
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 5px; padding-bottom: 12px; }
  .sidebar-nav a { border-left: none; border-radius: 20px; border: 1px solid var(--line); padding: 4px 11px; font-size: .8rem; }
  .sidebar-nav a.active { border-color: var(--accent); background: rgba(239,96,8,.1); }
  .sidebar-label { display: none; }
}

/* ── Main ────────────────────────────────────────────────────────────────── */
.help-main { padding: 32px 0 80px 36px; min-width: 0; }
@media (max-width: 700px) { .help-main { padding: 0 0 60px; } }

/* ── Section ─────────────────────────────────────────────────────────────── */
.help-section { margin-bottom: 72px; scroll-margin-top: 24px; }
.section-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.section-icon { font-size: 1.5rem; line-height: 1; }
.help-section h2 { font-size: 1.35rem; color: var(--text); }
.help-section h3 { font-size: .98rem; font-weight: 700; color: var(--accent); margin: 28px 0 10px; letter-spacing: .02em; }
.help-section p { line-height: 1.75; color: var(--text); font-size: .93rem; margin-bottom: 14px; }
.help-section ul, .help-section ol { padding-left: 22px; margin-bottom: 14px; }
.help-section li { line-height: 1.7; font-size: .93rem; margin-bottom: 5px; color: var(--text); }

/* ── Callouts ────────────────────────────────────────────────────────────── */
.callout {
  border-radius: 10px; padding: 13px 16px; margin: 16px 0;
  font-size: .88rem; line-height: 1.65;
  background: var(--panel); border: 1px solid var(--line);
}
.callout.tip  { border-left: 3px solid var(--accent-2); }
.callout.note { border-left: 3px solid var(--accent); }
.callout.warn { border-left: 3px solid var(--yellow); }
.callout-head { font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 5px; }
.callout.tip  .callout-head { color: var(--accent-2); }
.callout.note .callout-head { color: var(--accent); }
.callout.warn .callout-head { color: var(--yellow); }
.callout p { margin: 0; color: var(--muted); }
.callout a { color: var(--accent-2); }

/* ── Three-up card grid ──────────────────────────────────────────────────── */
.tri-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
@media (max-width: 520px) { .tri-grid { grid-template-columns: 1fr; } }
.tri-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.tri-card.hi { border-color: rgba(239,96,8,.4); }
.tri-card-head { font-size: .92rem; font-weight: 700; color: var(--text); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.tri-card-icon { font-size: 1.15rem; }
.tri-card p { font-size: .83rem; color: var(--muted); line-height: 1.55; margin: 0; }
.tri-card ul { padding-left: 16px; margin: 8px 0 0; }
.tri-card li { font-size: .83rem; color: var(--muted); line-height: 1.55; margin: 0 0 3px; }

/* ── Anatomy diagram ─────────────────────────────────────────────────────── */
.anatomy-wrap { display: flex; gap: 28px; align-items: flex-start; margin: 22px 0; flex-wrap: wrap; }
.anatomy-card {
  flex-shrink: 0; width: 168px;
  background: var(--panel); border: 1px solid rgba(239,96,8,.3);
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(239,96,8,.08), 0 8px 32px rgba(0,0,0,.5);
}
.anat-photo {
  position: relative; width: 100%; aspect-ratio: 1/1;
  background: var(--panel-2); display: flex; align-items: center; justify-content: center;
}
.anat-photo-icon { font-size: 3rem; opacity: .22; }
.anat-badge {
  position: absolute; top: 8px; left: 8px;
  font-size: .6rem; font-weight: 800; padding: 2px 7px;
  border-radius: 20px; letter-spacing: .04em; text-transform: uppercase;
}
.anat-badge.orange { background: var(--accent); color: #000; }
.anat-badge.blue { background: var(--accent-2); color: #000; }
.anat-ann {
  position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-2); color: #000014; font-size: .66rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; border: 1.5px solid #000014;
}
.anat-body { padding: 8px 10px 10px; position: relative; }
.anat-title { font-size: .8rem; font-weight: 600; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anat-meta { display: flex; align-items: center; gap: 6px; font-size: .82rem; }
.anatomy-legend { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 11px; }
.aleg-item { display: flex; gap: 11px; align-items: flex-start; }
.aleg-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-2); color: #000014; font-size: .7rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px;
}
.aleg-text strong { font-size: .87rem; color: var(--text); display: block; margin-bottom: 1px; }
.aleg-text span { font-size: .81rem; color: var(--muted); line-height: 1.45; }
.aleg-text a { color: var(--accent-2); }

/* ── Badge reference rows ────────────────────────────────────────────────── */
.badge-ref { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.bref-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px;
}
.bref-visual { flex-shrink: 0; min-width: 80px; display: flex; align-items: center; }
.bref-text strong { font-size: .87rem; color: var(--text); display: block; }
.bref-text span { font-size: .82rem; color: var(--muted); line-height: 1.4; }

/* ── Detail layout diagram ───────────────────────────────────────────────── */
.detail-diagram { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
@media (max-width: 500px) { .detail-diagram { grid-template-columns: 1fr; } }
.dd-col { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.dd-col-head { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.dd-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.dd-row:last-child { border-bottom: none; }
.dd-icon { font-size: .9rem; flex-shrink: 0; margin-top: 1px; }
.dd-row p { font-size: .84rem; color: var(--text); margin: 0; line-height: 1.45; }
.dd-row p span { color: var(--muted); font-size: .8rem; display: block; margin-top: 1px; }

/* ── Status flow ─────────────────────────────────────────────────────────── */
.status-flow { display: flex; align-items: center; flex-wrap: wrap; margin: 18px 0; row-gap: 10px; }
.sf-step {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 16px;
  font-size: .87rem; text-align: center; min-width: 110px; background: var(--panel);
}
.sf-step strong { display: block; margin-bottom: 2px; }
.sf-step span { font-size: .77rem; color: var(--muted); }
.sf-step.sf-new    { border-color: var(--accent);   background: rgba(239,96,8,.06); }
.sf-step.sf-new    strong { color: var(--accent); }
.sf-step.sf-active { border-color: var(--accent-2); background: rgba(77,184,255,.06); }
.sf-step.sf-active strong { color: var(--accent-2); }
.sf-step.sf-done   { border-color: var(--green);    background: rgba(77,200,100,.06); }
.sf-step.sf-done   strong { color: var(--green); }
.sf-step.sf-warn   { border-color: var(--yellow);   background: rgba(240,176,48,.06); }
.sf-step.sf-warn   strong { color: var(--yellow); }
.sf-step.sf-closed { border-color: var(--muted); opacity: .7; }
.sf-step.sf-closed strong { color: var(--muted); }
.sf-arrow { color: var(--muted); font-size: 1rem; padding: 0 8px; flex-shrink: 0; }

/* ── Branching flow ──────────────────────────────────────────────────────── */
.offer-flow { margin: 22px 0; }
.of-main { display: flex; align-items: center; flex-wrap: wrap; gap: 0; row-gap: 8px; }
.of-step { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: .87rem; text-align: center; min-width: 105px; }
.of-step strong { display: block; margin-bottom: 2px; }
.of-step span { font-size: .77rem; color: var(--muted); }
.of-step.start { border-color: var(--accent);   background: rgba(239,96,8,.07); }
.of-step.start strong { color: var(--accent); }
.of-step.mid   { border-color: var(--accent-2); background: rgba(77,184,255,.06); }
.of-step.mid   strong { color: var(--accent-2); }
.of-step.decide { border-color: var(--yellow); background: rgba(240,176,48,.06); }
.of-step.decide strong { color: var(--yellow); }
.of-arrow { color: var(--muted); font-size: 1rem; padding: 0 6px; flex-shrink: 0; }
.of-branches {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(104,120,160,.3);
}
@media (max-width: 520px) { .of-branches { grid-template-columns: 1fr; } }
.of-branch-label { font-size: .72rem; color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; text-align: center; }
.of-branch-arrow { text-align: center; color: var(--muted); font-size: .85rem; padding: 4px 0; }
.of-branch .of-step { width: 100%; }

/* ── Step wizard ─────────────────────────────────────────────────────────── */
.wizard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px; margin: 22px 0; }
.wz-track { display: flex; align-items: center; margin-bottom: 22px; }
.wz-dot {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 700; cursor: pointer; flex-shrink: 0;
  transition: background .2s, color .2s, box-shadow .2s;
}
.wz-dot.done    { background: rgba(239,96,8,.25); color: var(--accent); border: 1.5px solid var(--accent); }
.wz-dot.current { background: var(--accent); color: #000; box-shadow: 0 0 0 3px rgba(239,96,8,.25); }
.wz-dot.todo    { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.wz-line { flex: 1; height: 2px; background: var(--line); transition: background .25s; }
.wz-line.done { background: rgba(239,96,8,.4); }
.wz-body { min-height: 130px; }
.wz-panel { display: none; }
.wz-panel.active { display: block; }
.wz-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.wz-sub { font-size: .82rem; color: var(--accent); font-weight: 600; letter-spacing: .03em; margin-bottom: 10px; }
.wz-desc { font-size: .9rem; color: var(--text); line-height: 1.7; }
.wz-desc strong { color: var(--accent-2); }
.wz-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 10px; }
.wz-btn { padding: 9px 20px; border-radius: 8px; font-weight: 700; font-size: .88rem; cursor: pointer; border: none; transition: filter .15s; }
.wz-btn-prev { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.wz-btn-prev:disabled { opacity: .35; cursor: default; }
.wz-btn-next { background: var(--accent); color: #000; }
.wz-btn-next:disabled { opacity: .4; cursor: default; }
.wz-btn:not(:disabled):hover { filter: brightness(1.12); }
.wz-counter { font-size: .78rem; color: var(--muted); }

/* ── Compare table ───────────────────────────────────────────────────────── */
.compare-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .88rem; }
.compare-table th { padding: 9px 14px; text-align: left; border-bottom: 2px solid var(--line); font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.compare-table th.col-hi { color: var(--accent-2); }
.compare-table td { padding: 8px 14px; border-bottom: 1px solid rgba(30,32,68,.7); vertical-align: top; font-size: .87rem; }
.compare-table td:first-child { color: var(--muted); }
.compare-table .yes { color: var(--green); font-weight: 700; }
.compare-table .no  { color: var(--muted); opacity: .5; }

/* ── Cosmo widget preview ────────────────────────────────────────────────── */
.cosmo-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 20px 0; }
.cosmo-bar {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #0d1230 0%, #12122e 100%);
  border: 1px solid rgba(77,184,255,.38); border-radius: 10px; padding: 12px 14px;
  position: relative; overflow: hidden; cursor: pointer;
}
.cosmo-bar::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(77,184,255,.07), transparent);
  transform: translateX(-100%); animation: cosmo-shimmer 3.5s ease-in-out infinite; pointer-events: none;
}
@keyframes cosmo-shimmer { 0% { transform: translateX(-100%); } 60%,100% { transform: translateX(100%); } }
.cosmo-ava {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
  animation: cosmo-glow 2.5s ease-in-out infinite; background: var(--panel-2);
}
@keyframes cosmo-glow {
  0%,100% { box-shadow: 0 0 0 2px #0d1230, 0 0 0 4px rgba(77,184,255,.4), 0 0 16px rgba(77,184,255,.35); }
  50%      { box-shadow: 0 0 0 2px #0d1230, 0 0 0 6px rgba(77,184,255,.7), 0 0 28px rgba(77,184,255,.6); }
}
.cosmo-text { flex: 1; min-width: 0; }
.cosmo-name { font-size: .92rem; font-weight: 700; color: var(--text); }
.cosmo-sub  { font-size: .74rem; color: var(--muted); margin-top: 2px; }
.cosmo-badge { font-size: .64rem; font-weight: 700; color: var(--accent-2); border: 1px solid rgba(77,184,255,.4); border-radius: 4px; padding: 2px 6px; flex-shrink: 0; }
.cosmo-chev { font-size: .78rem; color: var(--muted); flex-shrink: 0; }
.cosmo-anns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
@media (max-width: 500px) { .cosmo-anns { grid-template-columns: 1fr; } }
.cosmo-ann-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: .81rem; color: var(--muted); line-height: 1.45; }
.cosmo-ann-item strong { display: block; font-size: .79rem; color: var(--accent-2); margin-bottom: 3px; }

/* ── Example questions grid ──────────────────────────────────────────────── */
.example-qs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 14px 0; }
.eq-item { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 13px; font-size: .83rem; color: var(--muted); line-height: 1.45; }
.eq-item::before { content: '"'; color: var(--accent-2); font-size: 1.1rem; margin-right: 2px; }

/* ── FAQ accordion ───────────────────────────────────────────────────────── */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-q {
  width: 100%; background: none; border: none; text-align: left;
  padding: 14px 2px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  color: var(--text); font-size: .93rem; font-weight: 600;
}
.faq-q:hover { color: var(--accent); }
.faq-chev { font-size: .76rem; color: var(--muted); transition: transform .25s cubic-bezier(.4,0,.2,1); flex-shrink: 0; }
.faq-q[aria-expanded="true"] .faq-chev { transform: rotate(180deg); }
.faq-a { overflow: hidden; max-height: 0; transition: max-height .3s ease; }
.faq-a-inner { padding: 0 2px 16px; font-size: .89rem; color: var(--muted); line-height: 1.72; }
.faq-a-inner a { color: var(--accent-2); }

/* ── Glossary grid ───────────────────────────────────────────────────────── */
.glossary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 16px; }
.gloss-item { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; }
.gloss-term { font-size: .87rem; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.gloss-def  { font-size: .82rem; color: var(--muted); line-height: 1.55; }

/* ── Help page footer ────────────────────────────────────────────────────── */
.help-footer { background: var(--panel); border-top: 1px solid var(--line); padding: 28px 20px 24px; margin-top: 20px; }
.help-footer-inner { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.help-footer-brand { font-size: 1rem; color: var(--accent); font-weight: 700; }
.help-footer-brand span { display: block; font-size: .77rem; font-weight: 400; color: var(--muted); margin-top: 2px; }
.help-footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; font-size: .84rem; }
.help-footer-links a { color: var(--muted); text-decoration: none; }
.help-footer-links a:hover { color: var(--accent); }
.help-footer-copy { font-size: .75rem; color: var(--muted); opacity: .7; }

/* ── Wizard JS initializer ───────────────────────────────────────────────── */
/* Call initWizard('wizard-id', 'prev-id', 'next-id', 'counter-id') from page JS */
