/* help.css — the Quick help page. Builds on rubiks.css; colours are site tokens. */

.qh-hero { margin-bottom: 16px; }

/* ── pickers ─────────────────────────────────────────────────────────────── */
.qh-pick { display: grid; gap: 12px; }
.qh-pick-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qh-pick-label {
  min-width: 6.5em; font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-dim);
}
.qh-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-sunken); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 0 12px; color: var(--ink-dim);
}
.qh-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.qh-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding-left: 0; padding-right: 0; outline: none; }

/* ── search results ──────────────────────────────────────────────────────── */
.qh-results { margin: 16px 0; }
.qh-results-title { font-size: 1.05rem; }
.qh-results-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.qh-hit {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
}
.qh-hit:hover, .qh-hit:focus-visible { border-color: var(--accent-line); }
.qh-hit-text { flex: 1; min-width: 12ch; }
.qh-hit-alg { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; color: var(--ink-dim); overflow-wrap: anywhere; }

/* ── stage cards ─────────────────────────────────────────────────────────── */
.qh-stages { margin-top: 24px; }
.qh-stages-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.qh-stages-head h2 { margin: 0; font-size: 1.2rem; }
.qh-stages-head p { margin: 0; }
.qh-stage-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
}
.qh-stage {
  display: flex; align-items: center; gap: 12px; height: 100%;
  padding: 10px 12px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.qh-stage:hover { border-color: var(--accent-line); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.qh-stage.is-open { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.qh-stage.is-parity { background: var(--accent-soft); border-color: var(--accent-line); }
/* another way to do a step (the daisy…): dashed, and not numbered */
.qh-stage.is-optional { border-style: dashed; background: var(--surface-sunken); }
.qh-stage.is-optional .qh-stage-num { color: var(--ink-dim); }
.qh-stage-pic { flex: none; width: 64px; }
.qh-stage-pic svg { width: 100%; height: auto; display: block; }
.qh-stage-text { display: flex; flex-direction: column; min-width: 0; }
.qh-stage-num { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-text); }
.qh-stage-title { font-weight: 700; line-height: 1.25; }
.qh-stage-sum { font-size: var(--fs-small); color: var(--ink-dim); line-height: 1.35; }

/* ── the help panel ──────────────────────────────────────────────────────── */
.qh-panel {
  margin-top: 24px; padding: var(--pad);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1); outline: none;
  scroll-margin-top: calc(var(--bar-h) + 12px);
}
.qh-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.qh-panel-head h2 { margin: 0; outline: none; }
.qh-overview { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 20px; align-items: start; }
.qh-goal { margin: 0; text-align: center; }
.qh-goal-pic { background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; }
.qh-goal-pic svg { width: 100%; max-width: 180px; height: auto; display: block; margin: 0 auto; }
.qh-goal figcaption { font-size: var(--fs-small); color: var(--ink-dim); margin-top: 6px; }
.qh-recognise h3 { margin-top: 0; }
.qh-recognise p { max-width: 64ch; }
.qh-tip { color: var(--ink-dim); padding-left: 12px; border-left: 3px solid var(--accent-line); }
.qh-section-title { margin: 24px 0 8px; }
.qh-group { font-size: 0.95rem; margin: 16px 0 8px; color: var(--ink-dim); }

.qh-callout {
  border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 8px 12px; margin: 12px 0; background: var(--surface);
}
.qh-callout p { margin: 0; }
.qh-callout-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent-text); margin-bottom: 2px !important; }
.qh-callout.mistake { border-left-color: var(--warn); }
.qh-callout.mistake .qh-callout-title { color: var(--warn); }
.qh-mistakes { margin-top: 16px; max-width: 72ch; }

/* case picker */
.qh-case-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 112px), 1fr)); }
.qh-case-grid.is-wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); }
.qh-case {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 6px; border-radius: var(--radius);
  background: var(--surface-sunken); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; text-align: center;
}
.qh-case:hover { border-color: var(--accent-line); }
.qh-case.is-open { border-color: var(--accent); background: var(--accent-soft); }
.qh-case-pic { display: flex; gap: 4px; justify-content: center; width: 100%; }
.qh-case-pic svg { width: 100%; max-width: 84px; height: auto; }
.qh-case-pic.is-pair svg { max-width: 70px; }
.qh-case-name { font-size: 0.8rem; font-weight: 600; line-height: 1.25; }

/* one case */
.qh-case-detail {
  margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 24px; align-items: start;
  scroll-margin-top: calc(var(--bar-h) + 12px);
}
.qh-case-main h3 { font-size: 1.25rem; margin-top: 0; outline: none; }
.qh-alg { margin: 12px 0; }
.qh-alg code {
  display: inline-block; font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(1.1rem, 0.95rem + 0.8vw, 1.5rem); line-height: 1.5; word-spacing: 0.2em;
  background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 12px; overflow-wrap: anywhere;
}
.qh-alg.small-alg code { font-size: 1.05rem; }
/* every position of a white-layer case, with its moves */
.qh-positions { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: var(--fs-small); }
.qh-positions caption { text-align: left; font-weight: 700; margin-bottom: 4px; }
.qh-positions th, .qh-positions td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.qh-positions th { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-dim); }
.qh-positions td:first-child { width: 42%; }
/* a long move list wraps inside one chip instead of breaking it apart */
.qh-positions code.alg { white-space: normal; display: inline-block; }
.qh-practice-goal { margin: 0; font-weight: 600; }
.qh-moves { margin: 12px 0; }
.qh-moves summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
.qh-moves ol { margin: 6px 0 0; padding-left: 1.6em; font-size: var(--fs-small); }
.qh-moves li + li { margin-top: 4px; }
.qh-case-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.qh-mode { align-self: flex-start; }
.qh-3d { min-width: 0; }
.qh-practice-stage { max-height: 360px; }
.qh-practice-bar { margin-top: 2px; }
.qh-answer code.alg { white-space: normal; }

/* identify my case */
.qh-identify {
  margin-top: 16px; padding: 14px; border-radius: var(--radius-lg);
  background: var(--surface-sunken); border: 1px solid var(--line);
}
.qh-palette { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.qh-swatch {
  display: inline-flex; align-items: center; gap: 6px;
  min-block-size: 40px; padding: 0 10px; border-radius: var(--radius-pill);
  font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); cursor: pointer;
}
.qh-swatch[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.qh-swatch-dot { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgb(0 0 0 / 0.35); }
.qh-painters { display: flex; flex-wrap: wrap; gap: 20px; }
.qh-painter { margin: 0; }
.qh-painter figcaption { font-size: var(--fs-small); color: var(--ink-dim); margin-bottom: 6px; }
.qh-grid { display: grid; gap: 4px; width: min(100%, 300px); aspect-ratio: 1; }
.qh-cell {
  min-width: 0; min-height: 0; padding: 0; border-radius: 6px; cursor: pointer;
  border: 2px solid var(--cube-plastic);
  background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 4px, var(--surface-hi) 4px, var(--surface-hi) 8px);
}
.qh-cell.side { border-radius: 4px; }
.qh-cell:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 1px; }
.qh-cell.is-fixed { cursor: default; }
.qh-cell[data-c="x"] { background: var(--surface-hi); opacity: 0.45; }
/* sticker colours (also for the palette dots) */
[data-c="0"].qh-cell, .qh-swatch-dot[data-c="0"] { background: var(--st-w); }
[data-c="1"].qh-cell, .qh-swatch-dot[data-c="1"] { background: var(--st-r); }
[data-c="2"].qh-cell, .qh-swatch-dot[data-c="2"] { background: var(--st-g); }
[data-c="3"].qh-cell, .qh-swatch-dot[data-c="3"] { background: var(--st-y); }
[data-c="4"].qh-cell, .qh-swatch-dot[data-c="4"] { background: var(--st-o); }
[data-c="5"].qh-cell, .qh-swatch-dot[data-c="5"] { background: var(--st-b); }
[data-c="7"].qh-cell, .qh-swatch-dot[data-c="7"] { background: var(--st-unknown); }
.qh-swatch-dot[data-c="6"] { background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 3px, var(--line-strong) 3px, var(--line-strong) 5px); }
.qh-id-result { margin-top: 12px; }
.qh-id-hit { font-size: 1.1rem; }
.qh-id-list { margin: 4px 0; padding-left: 1.3em; columns: 2; }
.qh-route { padding-left: 1.4em; }
.qh-route li + li { margin-top: 4px; }

/* ── phones ──────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .qh-overview { grid-template-columns: minmax(0, 1fr); }
  .qh-goal-pic svg { max-width: 140px; }
  .qh-case-detail { grid-template-columns: minmax(0, 1fr); }
  .qh-case-side { max-width: 380px; width: 100%; justify-self: center; }
  .qh-pick-label { min-width: 0; width: 100%; }
  .qh-pick .seg { width: 100%; }
  .qh-pick .seg button { flex: 1; }
}
@media (max-width: 420px) {
  .qh-stage-pic { width: 52px; }
  .qh-case-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .qh-case-grid.is-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qh-id-list { columns: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .qh-stage { transition: none; }
}
