/* ==========================================================================
   Help pages (src/help/*.html, generated from docs/help/*.md by scripts/build-help.mjs).
   Loads after tokens.css and base.css. Tokens only: no raw colours.
   ========================================================================== */

/* A reading site: the shared base makes the body a full-height app shell, so let this one scroll */
html, body { height: auto; }
body.help { overflow: auto; font-size: 16px; line-height: 1.65; }
html { scroll-padding-top: 88px; scroll-behavior: smooth; }

.help a { color: var(--volt-2); text-underline-offset: 3px; }
.help a:hover { color: var(--white); }

.help-skip { position: absolute; left: 12px; top: -48px; z-index: var(--z-toast); padding: 10px 14px; border-radius: var(--r-sm); background: var(--volt); color: var(--on-accent); font-weight: 700; text-decoration: none; }
.help-skip:focus { top: 12px; }

/* ── Header ── */
.help-head {
    position: sticky; top: 0; z-index: var(--z-chrome);
    display: flex; align-items: center; gap: 16px;
    height: 64px; padding: 0 var(--inset);
    background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--stroke);
}
.help-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); flex: none; }
.help-brand img { height: 26px; width: auto; }
.help-brand span { font-weight: 700; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--stroke-2); line-height: 1.2; }
.help-open {
    margin-left: auto; flex: none; height: 38px; padding: 0 16px; border-radius: var(--r-pill);
    display: inline-flex; align-items: center; font-weight: 700; font-size: var(--fs-md); text-decoration: none;
    background: var(--volt); color: var(--on-accent); box-shadow: 0 6px 20px var(--volt-glow);
}
.help .help-open { color: var(--on-accent); }
.help .help-open:hover { background: var(--volt-2); color: var(--on-accent); }

/* ── Search ── */
.help-search { position: relative; display: flex; align-items: center; gap: 8px; flex: 0 1 340px; min-width: 0; height: 40px; padding: 0 12px; border-radius: var(--r-pill); background: var(--well); border: 1px solid var(--stroke-2); color: var(--muted); }
.help-search[hidden] { display: none; }
.help-search:focus-within { border-color: var(--volt); box-shadow: var(--focus-ring); }
.help-search input { flex: 1; min-width: 0; height: 100%; background: none; border: none; outline: none; box-shadow: none; color: var(--text); font-size: var(--fs-lg); }
.help-search input::placeholder { color: var(--dim); }
.help-search__key { font-family: var(--mono); font-size: var(--fs-xs); padding: 1px 7px; border-radius: 6px; border: 1px solid var(--stroke-2); color: var(--dim); }
.help-search:focus-within .help-search__key { display: none; }
.help-results {
    position: absolute; left: 0; right: 0; top: calc(100% + 8px); max-height: min(70vh, 460px); overflow: auto;
    list-style: none; padding: 6px; border-radius: var(--r-md);
    background: var(--bg); border: 1px solid var(--stroke-2); box-shadow: var(--shadow);
}
.help-results[hidden] { display: none; }
.help-results li a { display: block; padding: 9px 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--text); }
.help-results li a b { display: block; font-size: var(--fs-md); }
.help-results li a span { display: block; font-size: var(--fs-sm); color: var(--muted); line-height: 1.4; margin-top: 2px; }
.help-results li[aria-selected="true"] a, .help-results li a:hover { background: var(--glass-press); }
.help-results__none { padding: 12px; color: var(--muted); font-size: var(--fs-md); }

/* ── Menu button (phones; a checkbox so it works without JavaScript) ── */
.help-menu-toggle { position: absolute; top: 0; left: 0; }
.help-menu-button { display: none; width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1px solid var(--stroke-2); cursor: pointer; align-items: center; justify-content: center; flex-direction: column; gap: 4px; }
.help-menu-button span { display: block; width: 16px; height: 2px; border-radius: 2px; background: var(--text); }
.help-menu-toggle:focus-visible ~ .help-head .help-menu-button { box-shadow: var(--focus-ring); }

/* ── Layout ── */
.help-layout { display: grid; grid-template-columns: 250px minmax(0, 740px) 210px; gap: 0 40px; justify-content: center; padding: 0 var(--inset); }
.help-main { grid-column: 2; padding: 40px 0 64px; min-width: 0; }
.help-toc { grid-column: 3; grid-row: 1; position: sticky; top: 88px; align-self: start; padding: 40px 0; max-height: calc(100vh - 88px); overflow: auto; }

/* Side navigation: the first grid column on wide screens, a full-screen menu on phones */
.help-nav { grid-column: 1; grid-row: 1; position: sticky; top: 64px; align-self: start; max-height: calc(100vh - 64px); overflow: auto; padding: 32px 12px 32px 0; font-size: var(--fs-md); }
.help-nav__group { margin-bottom: 22px; }
.help-nav__title { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); padding: 0 10px 6px; }
.help-nav ul { list-style: none; }
.help-nav a { display: block; padding: 6px 10px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-weight: 500; }
.help-nav a:hover { color: var(--text); background: var(--glass-hi); }
.help-nav a[aria-current="page"] { color: var(--volt-2); background: var(--volt-soft); font-weight: 600; }

.help-toc__title { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.help-toc ul { list-style: none; border-left: 1px solid var(--stroke); }
.help-toc a { display: block; padding: 4px 0 4px 14px; font-size: var(--fs-md); line-height: 1.4; color: var(--muted); text-decoration: none; }
.help-toc a:hover { color: var(--text); }

/* ── Article ── */
.help-article h1 { font-size: 36px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
.help-article .lede { font-size: 19px; line-height: 1.55; color: var(--muted); margin: 12px 0 32px; }
.help-article h2 { font-size: 26px; line-height: 1.25; font-weight: 800; letter-spacing: -0.01em; margin: 56px 0 14px; }
.help-article h3 { font-size: 19px; line-height: 1.3; font-weight: 700; margin: 36px 0 10px; }
.help-article h2, .help-article h3 { position: relative; }
.help-article h2 .anchor, .help-article h3 .anchor { position: absolute; left: -1.1em; color: var(--dim); text-decoration: none; opacity: 0; font-weight: 500; }
.help-article h2:hover .anchor, .help-article h3:hover .anchor, .help-article .anchor:focus-visible { opacity: 1; }
.help-article p { margin: 0 0 16px; }
.help-article ul, .help-article ol { margin: 0 0 18px; padding-left: 1.4em; }
.help-article li { margin: 6px 0; }
.help-article li > ul, .help-article li > ol { margin: 6px 0 0; }
.help-article strong { font-weight: 700; color: var(--white); }
.help-article hr { border: none; border-top: 1px solid var(--stroke); margin: 40px 0; }
.help-article code { font-family: var(--mono); font-size: 0.88em; padding: 2px 6px; border-radius: 6px; background: var(--well); border: 1px solid var(--stroke); }
.help-article pre { margin: 0 0 20px; padding: 14px 16px; overflow: auto; border-radius: var(--r-md); background: var(--well); border: 1px solid var(--stroke); }
.help-article pre code { padding: 0; border: none; background: none; font-size: var(--fs-md); }
kbd {
    font-family: var(--mono); font-size: 0.82em; font-weight: 500; white-space: nowrap;
    padding: 2px 7px; border-radius: 6px; background: var(--glass-hi); border: 1px solid var(--stroke-2); border-bottom-width: 2px; color: var(--text);
}

/* The numbered marker that ties a sentence to a pin drawn on a screenshot */
.pin {
    display: inline-flex; align-items: center; justify-content: center; vertical-align: 0.08em;
    min-width: 1.45em; height: 1.45em; padding: 0 0.3em; border-radius: var(--r-pill);
    background: var(--amber); color: var(--on-light); font-size: 0.78em; font-weight: 800; line-height: 1;
}

/* Figures */
.help-article figure { margin: 24px 0 28px; }
.help-article figure img { width: 100%; height: auto; border-radius: var(--r-md); border: 1px solid var(--stroke-2); box-shadow: var(--shadow); background: var(--map-bg); }
.help-article figcaption { margin-top: 10px; font-size: var(--fs-md); line-height: 1.5; color: var(--muted); }

/* Callouts */
.callout { margin: 22px 0; padding: 14px 18px 14px 16px; border-radius: var(--r-md); border: 1px solid var(--stroke-2); border-left-width: 4px; background: var(--glass-hi); }
.callout > :last-child { margin-bottom: 0; }
.callout__label { display: block; margin-bottom: 4px; font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; }
.callout--tip { border-left-color: var(--volt); background: var(--volt-soft); }
.callout--tip .callout__label { color: var(--volt-2); }
.callout--note { border-left-color: var(--amber); background: var(--amber-soft); }
.callout--note .callout__label { color: var(--amber-2); }

/* Steps: a big numeral for each item of an ordered list */
.steps > ol { list-style: none; padding: 0; counter-reset: step; }
.steps > ol > li { counter-increment: step; position: relative; margin: 0 0 14px; padding: 4px 0 4px 54px; min-height: 40px; }
.steps > ol > li::before {
    content: counter(step); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--volt-soft); color: var(--volt-2); border: 1px solid var(--volt-glow); font-weight: 800; font-size: var(--fs-lg);
}

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 22px; border-radius: var(--r-md); border: 1px solid var(--stroke-2); }
.help-article table { width: 100%; border-collapse: collapse; font-size: var(--fs-lg); }
.help-article th { text-align: left; font-size: var(--fs-sm); font-weight: 700; color: var(--muted); background: var(--glass-hi); }
.help-article th, .help-article td { padding: 10px 14px; border-bottom: 1px solid var(--stroke); vertical-align: top; }
.help-article tr:last-child td { border-bottom: none; }
.help-article td[data-label="Keys"] { width: 42%; }   /* the shortcut tables line up */

/* Highlights: a hero and a grid of tiles */
.hero { margin: 8px 0 40px; padding: 28px; border-radius: var(--r-xl); background: var(--volt-soft); border: 1px solid var(--volt-glow); }
.hero > :last-child { margin-bottom: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin: 0 0 32px; }
.tile { position: relative; display: flex; flex-direction: column; padding: 14px 14px 18px; border-radius: var(--r-lg); background: var(--glass-hi); border: 1px solid var(--stroke-2); transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast); }
.tile:hover, .tile:focus-within { border-color: var(--volt); background: var(--glass-press); transform: translateY(-2px); }
.tile figure { margin: 0 0 12px; }
.tile figure img { box-shadow: none; aspect-ratio: 16 / 10; object-fit: cover; }
.help-article .tile h3 { margin: 0 0 6px; font-size: 18px; }
.help-article .tile h3 .anchor { display: none; }
.tile p { margin: 0 0 10px; font-size: var(--fs-lg); line-height: 1.5; color: var(--muted); }
.tile p:last-child { margin: auto 0 0; padding-top: 4px; }
.tile p:last-child a { font-weight: 700; text-decoration: none; }
.tile p:last-child a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-lg); }   /* the whole card is the link */
.tile p:last-child a:focus-visible { outline: none; box-shadow: none; }
.tile:focus-within { box-shadow: var(--focus-ring); }

/* Watch screens: round frames side by side */
.watch-frames { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin: 24px 0 28px; }
.watch-frames figure { margin: 0; flex: 0 1 200px; text-align: center; }
.watch-frames figure img { border-radius: 50%; border: 6px solid var(--stroke-2); box-shadow: var(--shadow); background: var(--on-light); }

/* Previous and next */
.help-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; }
.help-pager a { display: block; padding: 14px 18px; border-radius: var(--r-md); border: 1px solid var(--stroke-2); text-decoration: none; color: var(--text); }
.help-pager a:hover { border-color: var(--volt); background: var(--glass-hi); }
.help-pager small { display: block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.help-pager span { font-weight: 700; }
.help-pager__next { text-align: right; grid-column: 2; }
.help-foot { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--stroke); font-size: var(--fs-md); color: var(--dim); }

/* ── Narrower screens ── */
@media (max-width: 1180px) {
    .help-layout { grid-template-columns: 250px minmax(0, 740px); }
    .help-toc { display: none; }
}
@media (max-width: 980px) {
    .help-layout { grid-template-columns: minmax(0, 1fr); }
    .help-main { grid-column: 1; padding-top: 28px; }
    .help-menu-button { display: flex; }
    .help-open { display: none; }
    .help-search { flex: 1 1 auto; margin-left: auto; }
    .help-search__key { display: none; }
    .help-brand span { display: none; }
    .help-nav {
        display: none; position: fixed; top: 64px; left: 0; right: 0; bottom: 0; align-self: stretch; max-height: none; z-index: var(--z-chrome); overflow: auto; padding: 20px var(--inset) 40px;
        background: var(--bg); border-top: 1px solid var(--stroke);
    }
    .help-menu-toggle:checked ~ .help-layout .help-nav { display: block; }
    .help-article h1 { font-size: 30px; }
    .help-article .lede { font-size: 17px; }
    .help-article h2 { font-size: 23px; margin-top: 44px; }
    .help-article h2 .anchor, .help-article h3 .anchor { display: none; }
    .help-pager { grid-template-columns: 1fr; }
    .help-pager__next { grid-column: 1; }
    .hero { padding: 20px; }
}

@media print {
    .help-head, .help-toc, .help-pager, .help-skip, .help-nav { display: none !important; }
    body.help { background: var(--white); color: var(--on-light); }
    .help-layout { display: block; padding: 0; }
    .help-article strong, .help a { color: var(--on-light); }
    .help-article figure img { box-shadow: none; }
    .callout, .tile, .hero { background: none; }
}
