/* Guides — real docs page layout.
   Two views:
     .guides-index   — list of guide cards (linked to detail)
     .guide-detail   — sticky TOC left + long-form content right
   All tokens scoped to :root already exist in styles.css (--color-*).
*/

/* ── Index ─────────────────────────────────────────────────────── */

.guides-index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    align-items: start; /* stop the tallest card from dictating everyone's height */
}

.guide-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.35rem 1.35rem 1.5rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
    cursor: pointer;
}
.guide-card:hover {
    border-color: color-mix(in srgb, var(--color-border) 40%, var(--color-accent));
    transform: translateY(-1px);
}
.guide-card:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}
.guide-card-hdr { display: flex; align-items: center; gap: 0.75rem; }
.guide-card-icon {
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(166, 117, 255, 0.12);
    border: 1px solid rgba(166, 117, 255, 0.25);
    border-radius: 9px;
    color: var(--color-accent);
    flex-shrink: 0;
}
.guide-card-icon svg { width: 22px; height: 22px; }
.guide-card-titles { min-width: 0; }
.guide-card-name { font-size: 1.05rem; font-weight: 600; color: var(--color-text-primary); line-height: 1.25; }
.guide-card-tag  { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 0.15rem; }
.guide-card-desc {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0;
    /* Cap at 3 lines with ellipsis so long copy doesn't blow up card height. */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.guide-card-cta {
    color: var(--color-accent);
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.guide-card-count {
    color: var(--color-text-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

/* ── Detail: layout ────────────────────────────────────────────── */

.guide-detail {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2.5rem;
    align-items: start;
    margin-top: 1rem;
}
@media (max-width: 820px) {
    .guide-detail { grid-template-columns: 1fr; gap: 1rem; }
}

.guide-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    text-decoration: none;
    margin-bottom: 1rem;
    transition: color 0.15s;
}
.guide-back:hover { color: var(--color-text-primary); }

.guide-title-block {
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}
.guide-title-block h1 { font-size: 2rem; font-weight: 700; margin: 0 0 0.35rem; letter-spacing: -0.02em; color: var(--color-text-primary); }
.guide-title-tag { color: var(--color-text-muted); font-size: 0.9rem; font-weight: 500; margin: 0 0 0.85rem; letter-spacing: 0.02em; }
.guide-intro { color: var(--color-text-secondary); font-size: 1rem; line-height: 1.6; margin: 0; max-width: 68ch; }

/* ── Detail: sidebar TOC ───────────────────────────────────────── */

.guide-toc {
    position: sticky;
    top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    align-self: start;
}
.guide-toc-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--color-text-muted);
    font-weight: 700;
    margin-bottom: 0.6rem;
}
.guide-toc a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    line-height: 1.35;
    border-left: 2px solid transparent;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.guide-toc a:hover {
    color: var(--color-text-primary);
    background: rgba(166, 117, 255, 0.05);
}
.guide-toc a.active {
    color: var(--color-text-primary);
    border-left-color: var(--color-accent);
    background: rgba(166, 117, 255, 0.08);
    font-weight: 500;
}
@media (max-width: 820px) {
    .guide-toc {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
        border: 1px solid var(--color-border);
        border-radius: 8px;
        padding: 0.5rem;
        margin-bottom: 1rem;
    }
    .guide-toc-label { display: none; }
    .guide-toc a { padding: 0.35rem 0.7rem; border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
    .guide-toc a.active { border-left: 0; border-bottom-color: var(--color-accent); }
}

/* ── Detail: content column ────────────────────────────────────── */

.guide-content { max-width: 72ch; min-width: 0; }

/* "Read this first" callout above the sections in setup guides. Warning-yellow
   accent so it reads as important without being a red error banner. Sits
   above the first section's h2 heading, tight visual separation. */
.guide-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-left: 4px solid #f59e0b;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 0 0 1.75rem;
    color: var(--color-text-primary);
    font-size: 0.92rem;
    line-height: 1.5;
}
.guide-warning-title {
    font-weight: 700;
    color: #f59e0b;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.75rem;
    margin-bottom: 0.45rem;
}
.guide-warning p { margin: 0; }
.guide-warning a {
    color: #f59e0b;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
.guide-warning a:hover { color: #fbbf24; }

.guide-section {
    /* Override the bare `section { padding: 4rem 0 }` rule in styles.css:382
       (a marketing-site holdover). Without this each guide section inherits
       64px top + 64px bottom padding on TOP of the margin-bottom, giving
       ~176px of dead space between consecutive sections. Same fix pattern
       as .plan-group in dashboard-app.css. */
    padding: 0;
    margin-bottom: 2rem;
    scroll-margin-top: 1rem;   /* fragment scroll leaves the header visible */
}
.guide-section:last-child { margin-bottom: 0; }

.guide-section-h {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.015em;
}
.guide-section-h .guide-anchor {
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 400;
    font-size: 0.85em;
    opacity: 0;
    transition: opacity 0.15s;
}
.guide-section-h:hover .guide-anchor,
.guide-section-h:focus-within .guide-anchor { opacity: 1; }
.guide-anchor:hover { color: var(--color-accent); }

/* Markdown body typography */
.guide-body { color: var(--color-text-primary); line-height: 1.65; font-size: 0.98rem; }
.guide-body h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 1.75rem 0 0.75rem;
    letter-spacing: -0.005em;
}
.guide-body h2:first-child { margin-top: 0; }
.guide-body h3 { font-size: 1rem; font-weight: 600; color: var(--color-text-primary); margin: 1.35rem 0 0.5rem; }
.guide-body h4 { font-size: 0.92rem; font-weight: 600; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin: 1.25rem 0 0.45rem; }

.guide-body p { margin: 0 0 0.85rem; color: var(--color-text-primary); }
.guide-body p:last-child { margin-bottom: 0; }
.guide-body strong { color: var(--color-text-primary); font-weight: 700; }
.guide-body em { font-style: italic; color: var(--color-text-primary); }

.guide-body ul, .guide-body ol { margin: 0 0 1rem; padding-left: 1.5rem; }
.guide-body ul li, .guide-body ol li { margin-bottom: 0.4rem; color: var(--color-text-primary); }
.guide-body ul li::marker { color: var(--color-text-muted); }
.guide-body ol li::marker { color: var(--color-accent); font-weight: 600; }

.guide-body code {
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.87em;
    color: var(--color-text-primary);
}
.guide-body pre {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    overflow-x: auto;
    margin: 0.85rem 0 1rem;
    font-size: 0.85rem;
    line-height: 1.55;
}
.guide-body pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: var(--color-text-primary);
    font-size: inherit;
}
.guide-body a {
    color: var(--color-accent);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--color-accent) 35%, transparent);
    transition: border-color 0.15s;
}
.guide-body a:hover { border-bottom-color: var(--color-accent); }

/* Screenshot figure — an `![alt](src)` block-level line becomes one of these.
   Rounded, bordered, subtle drop shadow. Alt text renders as a small caption
   underneath. Constrained to the guide-content column width. */
/* Sized so screenshots feel like inset reference figures — not full-column
   panels. Portrait Settings panels stay tall but capped at max-height so
   they don't dominate the reading flow. On narrow viewports the figure
   goes to 100% of column width. */
.guide-figure {
    margin: 1.5rem auto;
    max-width: 420px;
    text-align: center;
}
.guide-figure img,
.guide-figure video {
    max-width: 100%;
    max-height: 480px;
    width: auto;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    display: block;
    margin: 0 auto;
}
.guide-figure video { background: #000; }
.guide-figure figcaption {
    max-width: 100%;
}

/* Consecutive images in one markdown block wrap as a grid row so a set of
   screenshots reads as one visual unit instead of a stack of centered
   panels. Individual figures inside a row lose their own max-width so the
   grid can decide the sizing. Two-column at desktop widths, single-column
   fallback on narrow viewports via auto-fit. */
.guide-figure-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
    align-items: center;
}
.guide-figure-row .guide-figure {
    margin: 0;
    max-width: 100%;
}
.guide-figure-row .guide-figure img,
.guide-figure-row .guide-figure video {
    max-height: 340px;
    width: 100%;
    object-fit: cover;
    object-position: center top;
}
/* Two-item rows: force a real 2-column layout instead of ballooning to
   one wide item on medium screens. */
.guide-figure-row[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 560px) {
    .guide-figure-row[data-count="2"] { grid-template-columns: 1fr; }
}
.guide-figure figcaption {
    margin-top: 0.55rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-style: italic;
    line-height: 1.4;
}

/* Video placeholder box for showcase reels that aren't shipped yet. */
.guide-video-slot {
    margin: 1.25rem 0;
    padding: 3rem 1rem;
    background: var(--color-bg-secondary);
    border: 1px dashed var(--color-border);
    border-radius: 10px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* Segmented tile switcher (`:::switch` / `::panel Title` in markdown source).
   Renders as a pill-style button row above the currently-visible panel — one
   panel visible at a time. Click delegation lives in dashboard-app.js. Used
   in the v3 guide for the Apple Silicon vs Intel branching. */
.guide-switch { margin: 1rem 0 1.25rem; }
.guide-switch-tabs {
    display: inline-flex;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    margin-bottom: 1rem;
    max-width: 100%;
    flex-wrap: wrap;
}
.guide-switch-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--color-text-secondary);
    border: 0;
    border-radius: 7px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}
.guide-switch-tab:hover { color: var(--color-text-primary); }
.guide-switch-tab.active {
    background: var(--color-accent);
    color: #fff;
}
.guide-switch-tab:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}
.guide-switch-panel { display: none; }
.guide-switch-panel.active { display: block; }
.guide-switch-panel > :first-child { margin-top: 0; }
.guide-switch-panel > :last-child { margin-bottom: 0; }

/* Inline callout for warnings inside guide bodies (`:::warning ... :::` in the
   markdown source). Amber accent, matches the top-of-guide "Read this first"
   banner but tighter — sits inline between paragraphs rather than above the
   whole section. */
.guide-callout {
    border-radius: 8px;
    padding: 0.85rem 1.05rem;
    margin: 1rem 0;
    font-size: 0.94rem;
    line-height: 1.55;
}
.guide-callout > :first-child { margin-top: 0; }
.guide-callout > :last-child { margin-bottom: 0; }
.guide-callout p { margin: 0 0 0.6rem; }
.guide-callout p:last-child { margin-bottom: 0; }
.guide-callout-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-left: 4px solid #f59e0b;
    color: var(--color-text-primary);
}
.guide-callout-warning strong { color: #f59e0b; }
.guide-callout-warning a {
    color: #f59e0b;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    border-bottom: 0;
}
.guide-callout-warning a:hover { color: #fbbf24; }

/* Accordion for Bypass Guides — each proctoring service is a <details>.
   Keeps the section scannable (users pick their service, expand just that
   one) instead of walling the reader with 5 near-identical guides in a row.
   The <summary> shows a rotating chevron; body is regular guide-body. */
.guide-drops { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.5rem; }
.guide-drop {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg-secondary);
    overflow: hidden;
    transition: border-color 0.15s;
}
.guide-drop[open] { border-color: color-mix(in srgb, var(--color-border) 40%, var(--color-accent)); }
.guide-drop-summary {
    cursor: pointer;
    padding: 0.85rem 1.1rem;
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-primary);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    transition: background 0.15s;
    user-select: none;
}
.guide-drop-summary::-webkit-details-marker { display: none; }
.guide-drop-summary::marker { content: ''; }
.guide-drop-summary::before {
    content: '';
    width: 0; height: 0;
    border-left: 6px solid var(--color-text-muted);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}
.guide-drop[open] > .guide-drop-summary::before { transform: rotate(90deg); }
.guide-drop-summary:hover { background: rgba(166, 117, 255, 0.05); }
.guide-drop-body {
    padding: 0.25rem 1.1rem 1.1rem;
    border-top: 1px solid var(--color-border);
}
/* First heading in the body needs to breathe from the summary. */
.guide-drop-body > *:first-child { margin-top: 0.9rem; }

/* Prev / next footer */
.guide-nav-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
}
.guide-nav-btn {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem 1rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-text-primary);
    min-width: 180px;
    transition: border-color 0.15s;
}
.guide-nav-btn:hover { border-color: color-mix(in srgb, var(--color-border) 40%, var(--color-accent)); }
.guide-nav-btn-dir { color: var(--color-text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.guide-nav-btn-title { font-size: 0.95rem; font-weight: 600; }
.guide-nav-btn.prev { text-align: left; }
.guide-nav-btn.next { text-align: right; margin-left: auto; }

/* Empty state */
.guide-empty {
    padding: 2rem;
    text-align: center;
    color: var(--color-text-muted);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 10px;
}
