/* help.css — the "?" overlay. Same language as the feel lab: warm near-black, hard edges, Fira Mono labels,
 * Comic Neue body, orange for "look here". Motion: one slide+fade, scaled by --mot (set from MOTION at open). */
@font-face { font-family: "Comic Neue"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/comic-neue-400.woff2") format("woff2"); }
@font-face { font-family: "Comic Neue"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/comic-neue-700.woff2") format("woff2"); }
@font-face { font-family: "Fira Mono"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/FiraMono-Bold.ttf") format("truetype"); }

.hp {
  --hp-ink: #f2ede4; --hp-body: #cfc6bb; --hp-dim: #a9a197; --hp-bg: #14120f; --hp-panel: #1d1a16; --hp-line: #3a332b;
  --hp-hot: #f7931a; --hp-my: #2fb3a5; --hp-foe: #d9503a; --hp-ease: cubic-bezier(.22,.61,.36,1);
  --hp-mono: "Fira Mono", ui-monospace, monospace;
  --mot: 1.3333;
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  font: 400 17px/1.6 "Comic Neue", system-ui, sans-serif; color: var(--hp-body);
}
.hp[hidden] { display: none; }
.hp *, .hp *::before, .hp *::after { box-sizing: border-box; }

/* ---------- element colours (the card face's --face-c-el values, so a pill reads like its card) ---------- */
.hp [data-el="CALM"] { --c: #35877A; } .hp [data-el="JOY"] { --c: #E0A81C; } .hp [data-el="ANGER"] { --c: #C93D2A; }
.hp [data-el="SORROW"] { --c: #4E6FA8; } .hp [data-el="MISCHIEF"] { --c: #8352C0; } .hp [data-el="SHAME"] { --c: #B25472; }
.hp [data-el="UNEASE"] { --c: #7C8C2A; } .hp [data-el="DRIVE"] { --c: #A85C1D; } .hp [data-el="XENHARMONIC"] { --c: #2E9E93; }

/* ---------- frame ---------- */
.hp-scrim { position: absolute; inset: 0; background: rgba(10, 8, 6, .74); opacity: 0;
  transition: opacity calc(.26s * var(--mot)) var(--hp-ease); }
.hp-sheet { position: relative; display: flex; flex-direction: column; width: min(1080px, calc(100vw - 48px)); height: min(900px, calc(100dvh - 48px));
  background: var(--hp-panel); border: 1px solid var(--hp-line); box-shadow: 0 30px 80px rgba(0,0,0,.55); outline: none;
  opacity: 0; transform: translateY(24px);
  transition: opacity calc(.2s * var(--mot)) var(--hp-ease), transform calc(.26s * var(--mot)) var(--hp-ease); }
.hp.is-open .hp-scrim { opacity: 1; }
.hp.is-open .hp-sheet { opacity: 1; transform: none; }
.hp.is-reduced .hp-scrim, .hp.is-reduced .hp-sheet { transition: none; transform: none; }

.hp-head { flex: none; display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--hp-line); }
.hp-head h2 { margin: 0; font: 700 14px/1 var(--hp-mono); letter-spacing: .24em; color: var(--hp-hot); }
.hp-ver { font: 700 11px/1 var(--hp-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--hp-dim); }
.hp-x { margin-left: auto; min-height: 38px; padding: 0 14px; border: 1px solid var(--hp-line); border-radius: 0; background: transparent; color: var(--hp-ink);
  font: 700 12px/1 var(--hp-mono); letter-spacing: .16em; cursor: pointer; }
.hp-x kbd { margin-left: 8px; padding: 2px 5px; border: 1px solid var(--hp-line); color: var(--hp-dim); font: inherit; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.hp-x:hover { border-color: var(--hp-hot); color: var(--hp-hot); }
.hp a:focus-visible, .hp button:focus-visible, .hp summary:focus-visible, .hp [tabindex]:focus-visible { outline: 2px solid var(--hp-hot); outline-offset: 2px; }
.hp-scroll:focus-visible { outline-offset: -3px; }
.hp h3:focus { outline: none; }

.hp-body { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: 236px minmax(0, 1fr); }

/* ---------- table of contents ---------- */
.hp-toc { overflow-y: auto; padding: 18px 12px 24px; border-right: 1px solid var(--hp-line); background: rgba(0,0,0,.14); }
.hp-toc ol { list-style: none; margin: 0; padding: 0; }
.hp-toc-h { margin: 18px 8px 6px; font: 700 10px/1 var(--hp-mono); letter-spacing: .24em; color: var(--hp-dim); }
.hp-toc a { display: grid; grid-template-columns: 30px 1fr; align-items: baseline; padding: 7px 8px; border-left: 3px solid transparent; color: var(--hp-body);
  text-decoration: none; font-size: 15px; line-height: 1.25; }
.hp-toc a i { font: 700 11px/1 var(--hp-mono); font-style: normal; color: var(--hp-dim); letter-spacing: .06em; }
.hp-toc a:hover { color: var(--hp-ink); background: rgba(255,255,255,.04); }
.hp-toc a.on { border-left-color: var(--hp-hot); color: var(--hp-ink); background: rgba(247,147,26,.08); }
.hp-toc a.on i { color: var(--hp-hot); }

/* ---------- reading column ---------- */
.hp-scroll { position: relative; overflow-y: auto; overscroll-behavior: contain; padding: 26px clamp(18px, 4vw, 52px) 48px; counter-reset: s r; }
.hp-sec { max-width: 66ch; padding: 0 0 34px; margin: 0 0 34px; border-bottom: 1px solid var(--hp-line); }
.hp-sec:last-of-type { border-bottom: 0; }
.hp-sec.is-ref { max-width: 78ch; }
.hp-sec h3 { margin: 0 0 14px; font: 700 27px/1.15 "Comic Neue", sans-serif; color: var(--hp-ink); }
.hp-sec h3::before { display: block; margin-bottom: 8px; font: 700 11px/1 var(--hp-mono); letter-spacing: .26em; color: var(--hp-hot); }
.hp-sec:not(.is-ref) h3::before { counter-increment: s; content: counter(s, decimal-leading-zero) " \0000b7  SECTION"; }
.hp-sec.is-ref h3::before { counter-increment: r; content: "R" counter(r) " \0000b7  REFERENCE"; }
.hp-sec h4 { margin: 24px 0 6px; font: 700 12px/1.2 var(--hp-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--hp-hot); }
.hp-sec p { margin: 0 0 14px; }
.hp-sec b, .hp-sec strong { color: var(--hp-ink); }
.hp-sec em { font-style: italic; color: var(--hp-ink); }
.hp-sec ul, .hp-sec ol { margin: 0 0 14px; }

/* injected values: visibly "from the table" */
.hp-v { font: 700 .88em/1.2 var(--hp-mono); color: #ffcf8a; background: rgba(247,147,26,.11); padding: 0 .3em; white-space: nowrap; }
.hp-term { font: 700 .85em var(--hp-mono); letter-spacing: .08em; color: var(--hp-ink); }
.hp-act { display: inline-block; padding: 1px 6px; border: 1px solid var(--hp-hot); color: var(--hp-hot); font: 700 .74em/1.5 var(--hp-mono); letter-spacing: .12em; vertical-align: .08em; }
.hp-el { display: inline-block; padding: 1px 7px 1px 9px; background: color-mix(in srgb, var(--c) 28%, transparent); border: 1px solid var(--c);
  box-shadow: inset 3px 0 0 var(--c); color: var(--hp-ink); font: 700 .7em/1.6 var(--hp-mono); letter-spacing: .08em; vertical-align: .1em; white-space: nowrap; }
.hp-chip { display: inline-block; padding: 2px 7px; background: rgba(247,147,26,.15); color: #ffd9a8; font: 700 11px/1.4 var(--hp-mono); letter-spacing: .1em; white-space: nowrap; }
.hp-tag { display: inline-block; padding: 0 7px; border: 1px solid var(--hp-line); color: var(--hp-dim); font: 700 10px/1.8 var(--hp-mono); letter-spacing: .16em; text-transform: uppercase; vertical-align: .1em; }
.hp-tag.on { border-color: var(--hp-my); color: var(--hp-my); }

.hp-note { padding: 10px 14px; border-left: 3px solid var(--hp-hot); background: rgba(255,255,255,.035); }
.hp-formula { padding: 10px 14px; background: rgba(0,0,0,.25); border: 1px solid var(--hp-line); font-size: 16px; }

/* definition rows */
.hp-dl { display: grid; grid-template-columns: 112px minmax(0, 1fr); margin: 0 0 16px; border-top: 1px solid var(--hp-line); }
.hp-dl dt { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--hp-line); font: 700 12px/1.7 var(--hp-mono); letter-spacing: .14em; color: var(--hp-hot); text-transform: uppercase; }
.hp-dl dd { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--hp-line); }
.hp-dl dt .hp-act { margin: 0; }

/* lists */
.hp-list { list-style: none; padding: 0; }
.hp-list > li { position: relative; padding: 0 0 9px 20px; }
.hp-list > li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; background: var(--hp-hot); }
.hp-marks { list-style: none; padding: 0; }
.hp-marks li { position: relative; padding: 3px 0 3px 2em; }
.hp-mk { position: absolute; left: 0; top: 3px; width: 1.4em; font-style: normal; text-align: center; }
.hp-mk.up { color: var(--hp-my); } .hp-mk.dn { color: var(--hp-foe); } .hp-mk.ev { color: var(--hp-dim); }

.hp-steps, .hp-sub { list-style: none; padding: 0; counter-reset: st; }
.hp-steps > li { position: relative; counter-increment: st; padding: 0 0 14px 46px; }
.hp-steps > li::before { content: counter(st); position: absolute; left: 0; top: 2px; width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--hp-hot); color: #14110D; font: 700 15px/1 var(--hp-mono); }
.hp-sub { margin: 8px 0 0; counter-reset: sb; }
.hp-sub > li { position: relative; counter-increment: sb; padding: 0 0 6px 30px; }
.hp-sub > li::before { content: counter(sb, lower-alpha); position: absolute; left: 0; top: 3px; width: 20px; height: 20px; display: grid; place-items: center;
  border: 1px solid var(--hp-line); color: var(--hp-dim); font: 700 11px/1 var(--hp-mono); }
.hp-order > li::before { content: counter(sb); }

/* tables */
.hp-table { width: 100%; margin: 0 0 16px; border-collapse: collapse; font-size: 16px; }
.hp-table th, .hp-table td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--hp-line); text-align: left; vertical-align: top; }
.hp-table thead th { font: 700 10px/1 var(--hp-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--hp-dim); padding-bottom: 6px; }
.hp-table tbody th { color: var(--hp-ink); font-weight: 700; white-space: nowrap; }
.hp-table th em { display: block; font: 400 12px/1.2 "Comic Neue"; color: var(--hp-dim); font-style: normal; }
.hp-tight th { width: 46%; white-space: normal !important; }
.hp-printed { color: var(--hp-body); }
.hp-dim { color: var(--hp-dim); font-style: italic; }
#hpMoves td:nth-child(2) { text-align: center; padding-right: 14px; }

/* the wheel */
.hp-wheel { position: relative; width: min(100%, 520px); aspect-ratio: 100 / 92; margin: 18px auto 46px; }
.hp-warrows { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--hp-hot); overflow: visible; }
.hp-warrows path { fill: none; stroke: currentColor; stroke-width: .8; }
.hp-warrows marker path { fill: currentColor; stroke: none; }
.hp-wnode { position: absolute; display: flex; flex-direction: column; gap: 4px; width: 32%; transform: translate(-50%, -50%); }
.hp-wnode .hp-el { display: block; text-align: center; font-size: 11px; padding: 3px 4px 3px 7px; }
.hp-wmid { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; }
.hp-wmid .hp-el { font-size: 10px; padding: 2px 5px 2px 8px; }
.hp-wmid em { display: block; margin-top: 3px; font: 400 12px/1.1 "Comic Neue"; color: var(--hp-dim); }
.hp-wcap { position: absolute; left: 0; right: 0; top: calc(100% + 10px); margin: 0 !important; text-align: center; font: 700 11px/1.3 var(--hp-mono); letter-spacing: .08em; color: var(--hp-dim); text-transform: uppercase; }

.hp-more { margin: 4px 0 14px; border: 1px solid var(--hp-line); }
.hp-more > summary, .hp-pass > summary { cursor: pointer; padding: 10px 12px; font: 700 11px/1.2 var(--hp-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--hp-hot); list-style: none; }
.hp-more > summary::-webkit-details-marker, .hp-pass > summary::-webkit-details-marker { display: none; }
.hp-more > summary::before { content: "+"; display: inline-block; width: 1.4em; }
.hp-more[open] > summary::before { content: "\2212"; }
.hp-grid-wrap { overflow-x: auto; padding: 0 12px 14px; }
.hp-matrix { border-collapse: collapse; margin: 0 auto; font-size: 13px; }
.hp-matrix caption { caption-side: bottom; padding-top: 8px; font: 400 13px/1.3 "Comic Neue"; color: var(--hp-dim); }
.hp-matrix th { font: 700 9px/1 var(--hp-mono); letter-spacing: .06em; color: var(--hp-ink); padding: 5px 4px; border-bottom: 3px solid var(--c); text-align: center; }
.hp-matrix tbody th { border-bottom: 0; border-left: 3px solid var(--c); text-align: right; padding-right: 8px; }
.hp-matrix td { width: 30px; height: 28px; text-align: center; border: 1px solid var(--hp-line); }
.hp-matrix td.up { color: var(--hp-my); background: rgba(47,179,165,.1); } .hp-matrix td.dn { color: var(--hp-foe); background: rgba(217,80,58,.1); } .hp-matrix td.ev { color: #6f685e; }

/* traps */
.hp-traps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.hp-trap { padding: 10px 12px 2px; border: 1px solid var(--hp-line); border-left: 4px solid var(--c); background: rgba(0,0,0,.18); }
.hp-trap header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.hp-trap header b { font-size: 17px; }
.hp-trap p { font-size: 15.5px; line-height: 1.45; margin: 0 0 10px; }
.hp-trap .hp-cond { color: var(--hp-dim); }

.hp-pass { border-bottom: 1px solid var(--hp-line); }
.hp-pass > summary { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; }
.hp-pass > summary span:last-child { color: var(--hp-dim); letter-spacing: .08em; }
.hp-pass[open] > summary { padding-bottom: 4px; }
.hp-pass .hp-table { margin-bottom: 10px; font-size: 15px; }
.hp-pass .hp-table th { width: 38%; white-space: normal; }

.hp-end { margin: 6px 0 0; font: 700 11px/1.4 var(--hp-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--hp-dim); }

/* ---------- narrow / portrait: full-screen sheet from the bottom, contents become a strip ---------- */
@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  .hp { align-items: flex-end; font-size: 16px; }
  .hp-sheet { width: 100vw; height: 100dvh; border: 0; transform: translateY(100%); opacity: 1;
    transition: transform calc(.26s * var(--mot)) var(--hp-ease); padding-top: env(safe-area-inset-top); }
  .hp.is-open .hp-sheet { transform: none; }
  .hp-head { min-height: 52px; padding-left: 16px; gap: 10px; }
  .hp-ver { display: none; }
  .hp-x { min-height: 44px; }
  .hp-x kbd { display: none; }
  .hp-body { display: flex; flex-direction: column; }
  .hp-toc { position: relative; flex: none; display: flex; align-items: stretch; overflow-x: auto; overflow-y: hidden; padding: 0 6px; border-right: 0; border-bottom: 1px solid var(--hp-line);
    scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .hp-toc::-webkit-scrollbar { display: none; }
  .hp-toc ol { display: flex; flex: none; }
  .hp-toc-h { align-self: center; margin: 0 6px 0 12px; white-space: nowrap; }
  .hp-toc a { display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 11px; border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; font-size: 14.5px; }
  .hp-toc a.on { border-left: 0; border-bottom-color: var(--hp-hot); }
  .hp-scroll { padding: 20px 18px calc(48px + env(safe-area-inset-bottom)); }
  .hp-sec h3 { font-size: 24px; }
  .hp-dl { grid-template-columns: 1fr; }
  .hp-dl dt { padding: 10px 0 0; border-bottom: 0; }
  .hp-dl dd { padding: 0 0 10px; }
  .hp-traps { grid-template-columns: 1fr; }
  .hp-table { font-size: 15px; }
  .hp-table th, .hp-table td { padding-right: 8px; }
  .hp-tight th { width: 52%; }
  .hp-wnode .hp-el { font-size: 10.5px; }
  .hp-sec { padding-bottom: 28px; margin-bottom: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .hp .hp-scrim, .hp .hp-sheet { transition: none; }
}
