/* Help guides (Pages/Guides): GuideShell + GuideSection. Global on purpose: section bodies are MarkupString
   content and the print rules must apply page-wide. Colours come from MudBlazor theme variables except the
   per-guide accent passed as --cfm-guide-accent. */

.cfm-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%);
    white-space: nowrap; border: 0;
}

/* Layout: one column; from 960px (MudBlazor md) a sticky table of contents beside the sections. */
.cfm-guide { display: block; }
.cfm-guide-main { min-width: 0; }
.cfm-guide-toc { display: none; }

@media (min-width: 960px) {
    .cfm-guide--with-toc {
        display: grid;
        grid-template-columns: 248px minmax(0, 1fr);
        gap: 32px;
        align-items: start;
    }
    .cfm-guide-toc {
        display: block;
        position: sticky;
        top: 88px; /* 64px fixed MudAppBar + 24px */
        max-height: calc(100vh - 112px);
        overflow-y: auto;
        padding: 16px;
        background: var(--mud-palette-surface);
        border-radius: 12px;
        box-shadow: var(--mud-elevation-1);
    }
}

.cfm-guide-toc__title {
    margin: 0 0 8px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}
.cfm-guide-toc__list { list-style: none; margin: 0; padding: 0; }
.cfm-guide-toc__link {
    display: flex;
    gap: 10px;
    align-items: baseline;
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 8px;
    color: var(--mud-palette-text-primary);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
}
.cfm-guide-toc__link:hover { background: rgba(232, 98, 42, .08); color: var(--mud-palette-text-primary); text-decoration: underline; }
.cfm-guide-toc__link:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 1px; }
.cfm-guide-toc__num { min-width: 1.25em; font-weight: 700; color: var(--mud-palette-text-secondary); }

.cfm-guide-tools {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 8px;
}

/* Section card: matches the old MudPaper pa-5, Elevation 1, radius 12, 4px accent border. */
.cfm-guide-section {
    --cfm-guide-accent: var(--mud-palette-primary);
    background: var(--mud-palette-surface);
    border-radius: 12px;
    border-left: 4px solid var(--cfm-guide-accent);
    box-shadow: var(--mud-elevation-1);
    margin-bottom: 16px;
    scroll-margin-top: 72px; /* 56px phone app bar */
}
@media (min-width: 600px) {
    .cfm-guide-section { scroll-margin-top: 80px; } /* 64px app bar */
}

.cfm-guide-section__summary {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    border-radius: 12px;
}
.cfm-guide-section__summary::-webkit-details-marker { display: none; }
.cfm-guide-section__summary::marker { content: ""; }
.cfm-guide-section__summary:focus-visible { outline: 3px solid var(--cfm-guide-accent); outline-offset: 2px; }
.cfm-guide-section__summary:hover .cfm-guide-section__title { text-decoration: underline; text-underline-offset: 3px; }
.cfm-guide-section[open] > .cfm-guide-section__summary { padding-bottom: 12px; }

.cfm-guide-section__title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--mud-palette-text-primary);
    overflow-wrap: anywhere;
}

.cfm-guide-section__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cfm-guide-accent);
    color: #fff;
    /* 19px bold counts as large text (WCAG 1.4.3), so white on the orange accent (about 3.4:1) passes. */
    font-size: 19px;
    font-weight: 700;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.cfm-guide-section__chevron {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    margin: 0 4px 4px 0;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    color: var(--mud-palette-text-secondary);
    transform: rotate(45deg);
}
.cfm-guide-section[open] > .cfm-guide-section__summary .cfm-guide-section__chevron {
    margin: 4px 4px 0 0;
    transform: rotate(-135deg);
}
@media (prefers-reduced-motion: no-preference) {
    .cfm-guide-section__chevron { transition: transform 150ms ease; }
}

.cfm-guide-section__body { padding: 0 20px 20px; overflow-wrap: anywhere; }

/* FAQ on Index */
.cfm-guide-faq { max-width: 880px; }
.cfm-guide-section--dense { border-left-width: 3px; margin-bottom: 12px; }
.cfm-guide-section--dense > .cfm-guide-section__summary { min-height: 48px; padding: 14px 16px; }
.cfm-guide-section--dense[open] > .cfm-guide-section__summary { padding-bottom: 8px; }
.cfm-guide-section--dense .cfm-guide-section__title { font-size: 1rem; }
.cfm-guide-section--dense > .cfm-guide-section__body { padding: 0 16px 16px; }

@media (forced-colors: active) {
    .cfm-guide-section { border: 1px solid CanvasText; border-left-width: 4px; }
}

@media print {
    .cfm-guide-toc, .cfm-guide-tools { display: none !important; }
    .cfm-guide--with-toc { display: block; }
    .cfm-guide-section { box-shadow: none; border: 1px solid #ccc; border-left: 4px solid var(--cfm-guide-accent); break-inside: auto; }
    .cfm-guide-section__summary { break-after: avoid; padding-bottom: 8px; }
    .cfm-guide-section__chevron { display: none; }
}
/* Separate block: a browser that does not know ::details-content drops only this rule
   (guides.js beforeprint opens the sections there). */
@media print {
    .cfm-guide-section::details-content { content-visibility: visible; display: block; height: auto; }
}
