/* User guide chapter pages (/guide, /guide/<chapter>, /guide/manual).

   The manual's own <style> block is a print stylesheet: A4 @page rules and a
   light paper palette. It is still what renders the PDF, and it is deliberately
   NOT reused here — these pages are part of the site and use the site's tokens,
   so a theme change moves the guide with everything else. The class names come
   from the manual's markup (.test, .path, .ref, .notice, .tag …) because the
   generator publishes the authored HTML untouched; only the presentation is
   restated in site terms. */

/* ── Layout ─────────────────────────────────────────────────────────────── */

.guide-layout {
    display: grid;
    grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
    align-items: start;
    gap: clamp(28px, 5vw, 72px);
    padding-bottom: clamp(48px, 7vw, 96px);
}

.guide-toc {
    position: sticky;
    top: 96px;
    padding: var(--sp-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-soft);
}

.guide-toc .kicker {
    margin: 0 0 var(--sp-3);
    color: var(--accent-link);
    font-family: var(--font-mono);
    font-size: var(--fs-mono-eyebrow);
    font-weight: 600;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
}

.guide-toc ol {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: guide-chapter;
}

.guide-toc li {
    counter-increment: guide-chapter;
}

.guide-toc a {
    display: block;
    padding: 7px 0;
    color: var(--text-soft);
    font-size: var(--fs-sm);
    line-height: var(--lh-snug);
    text-decoration: none;
}

.guide-toc a::before {
    content: counter(guide-chapter) '. ';
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
}

.guide-toc a:hover,
.guide-toc a:focus-visible {
    color: var(--accent-link);
}

.guide-toc a[aria-current='page'] {
    color: var(--text-strong);
    font-weight: var(--weight-semi);
}

.guide-toc-foot {
    margin: var(--sp-3) 0 0;
    padding-top: var(--sp-3);
    border-top: 1px solid var(--line);
    color: var(--text-faint);
    font-size: var(--fs-xs);
}

@media (max-width: 1024px) {
    .guide-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .guide-toc {
        position: static;
        order: 2;
    }
}

/* ── Prose ──────────────────────────────────────────────────────────────── */

.guide-article {
    max-width: 74ch;
    color: var(--text);
    font-size: var(--fs-base);
    line-height: var(--lh-relaxed);
}

.guide-article.is-full {
    max-width: none;
}

.guide-article h2 {
    margin: clamp(40px, 5vw, 68px) 0 var(--sp-3);
    color: var(--text-strong);
    font-family: var(--font-display);
    font-size: var(--fs-h2);
    font-weight: var(--weight-semi);
    letter-spacing: var(--tracking-tight);
    line-height: var(--lh-tight);
}

.guide-article > .guide-section:first-child > h2:first-child {
    margin-top: 0;
}

.guide-article h3 {
    margin: 0;
    color: var(--text-strong);
    font-size: var(--fs-md);
    font-weight: var(--weight-semi);
    line-height: var(--lh-snug);
}

.guide-article p {
    margin: 0 0 var(--sp-3);
}

.guide-article ol,
.guide-article ul {
    margin: 0 0 var(--sp-3);
    padding-left: 1.25em;
}

.guide-article li {
    margin-bottom: 6px;
}

.guide-article b {
    color: var(--text-strong);
    font-weight: var(--weight-semi);
}

.guide-article code {
    padding: 1px 5px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    background: var(--surface-soft);
    font-family: var(--font-mono);
    font-size: 0.88em;
}

.guide-article .intro {
    margin-bottom: var(--sp-4);
    color: var(--text-soft);
    font-size: var(--fs-lead);
    line-height: var(--lh-relaxed);
}

.guide-section + .guide-section {
    margin-top: clamp(32px, 4vw, 56px);
}

/* ── How-to cards ───────────────────────────────────────────────────────── */

.guide-article .test {
    margin: 0 0 var(--sp-4);
    padding: var(--sp-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.guide-article .test-head {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
}

.guide-article .test-no {
    flex: none;
    min-width: 30px;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-align: center;
}

.guide-article .test-title {
    flex: 1;
}

.guide-article .path {
    margin-bottom: var(--sp-3);
    padding: 8px 11px;
    border-left: 2px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: var(--fs-sm);
}

.guide-article .path b {
    color: var(--accent-link);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
}

.guide-article .test-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--sp-4);
}

@media (max-width: 768px) {
    .guide-article .test-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--sp-3);
    }
}

.guide-article .label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
}

.guide-article .expected {
    color: var(--text-soft);
    font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
}

/* ── Plan badges ────────────────────────────────────────────────────────── */

.guide-article .tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
}

/* Semantics match the app and the pricing page: free is available to everyone,
   Essentials is the one-time paid tier, Premium is the gold marker. */
.guide-article .tag.free {
    border: 1px solid var(--success-line);
    background: var(--success-soft);
    color: var(--success);
}

.guide-article .tag.paid {
    border: 1px solid var(--line-strong);
    background: var(--surface-strong);
    color: var(--text-strong);
}

.guide-article .tag.premium {
    border: 1px solid var(--pro-line);
    background: var(--pro-soft);
    color: var(--pro-from);
}

.guide-article .tag.optional {
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text-faint);
}

/* ── Notices ────────────────────────────────────────────────────────────── */

.guide-article .notice,
.guide-article .callout,
.guide-article .notes-box {
    margin: 0 0 var(--sp-4);
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--accent-soft);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
}

.guide-article .notice.warning {
    border-color: var(--warning-line);
    border-left-color: var(--warning);
    background: var(--warning-soft);
}

.guide-article .notice b,
.guide-article .callout b {
    color: var(--text-strong);
}

.guide-article .footer-note {
    color: var(--text-faint);
    font-size: var(--fs-xs);
}

/* ── Reference tables ───────────────────────────────────────────────────── */

.guide-article .ref {
    width: 100%;
    margin: 0 0 var(--sp-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    border-collapse: collapse;
    font-size: var(--fs-sm);
    overflow: hidden;
}

.guide-article .ref th,
.guide-article .ref td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.guide-article .ref thead th {
    background: var(--surface-strong);
    color: var(--text-strong);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
}

.guide-article .ref tbody tr:last-child td {
    border-bottom: 0;
}

.guide-article .ref .k,
.guide-article .ref .key {
    color: var(--text-strong);
    font-weight: var(--weight-semi);
}

/* A reference table is the one thing here that can legitimately be wider than
   the reading column on a phone; scroll it rather than crushing the columns. */
@media (max-width: 768px) {
    .guide-article .ref {
        display: block;
        overflow-x: auto;
    }
}

/* ── Checklists ─────────────────────────────────────────────────────────── */

.guide-checklist {
    max-width: 74ch;
}

.guide-article .check,
.guide-article .checkbox-list {
    list-style: none;
}

.guide-article .check {
    position: relative;
    padding-left: 26px;
    margin-bottom: 10px;
}

.guide-article .check::before {
    position: absolute;
    left: 0;
    color: var(--success);
    content: '✓';
    font-weight: 700;
}

.guide-article .notes-lines {
    min-height: 60px;
    border-top: 1px dashed var(--line);
}

/* ── Chapter pager ──────────────────────────────────────────────────────── */

.guide-pager-section {
    padding: 0 0 clamp(56px, 8vw, 110px);
}

.guide-pager {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--sp-3);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--line);
}

.guide-pager-link {
    display: block;
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-soft);
    text-decoration: none;
}

.guide-pager-link.is-next {
    text-align: right;
}

.guide-pager-link span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
}

.guide-pager-link b {
    color: var(--text-strong);
    font-size: var(--fs-md);
    font-weight: var(--weight-semi);
}

.guide-pager-link:hover,
.guide-pager-link:focus-visible {
    border-color: var(--accent);
}

@media (max-width: 600px) {
    .guide-pager {
        grid-template-columns: minmax(0, 1fr);
    }

    .guide-pager-link.is-next {
        text-align: left;
    }
}

/* ── Single-page manual ─────────────────────────────────────────────────── */

.guide-section-group {
    padding-top: clamp(40px, 6vw, 80px);
}

.guide-section-group + .guide-section-group {
    border-top: 1px solid var(--line);
}

.guide-section-group > .kicker {
    margin: 0 0 var(--sp-2);
    color: var(--accent-link);
    font-family: var(--font-mono);
    font-size: var(--fs-mono-eyebrow);
    font-weight: 600;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
}

.guide-section-group > h2 a {
    color: inherit;
    text-decoration: none;
}

.guide-section-group > h2 a:hover {
    color: var(--accent-link);
}
