/* Resources Page Styles */

.resources-layout {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
    padding: calc(var(--navh) + 2rem) 2rem 6rem 2rem;
    color: #c0c0c0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
}

/* Sidebar */
.resources-sidebar {
    position: sticky;
    top: calc(var(--navh) + 2rem);
    width: 230px;
    flex-shrink: 0;
    max-height: calc(100vh - var(--navh) - 4rem);
    overflow-y: auto;
    font-size: 0.9rem;
}

.resources-sidebar a {
    display: block;
    color: #999;
    text-decoration: none;
    padding: 0.2rem 0;
    transition: color 0.2s ease;
}

.resources-sidebar a:hover {
    color: white;
}

.resources-tree,
.resources-tree ul {
    list-style: none;
}

.resources-tree > li {
    margin-bottom: 0.25rem;
}

.resources-tree .resources-page {
    color: #d0d0d0;
    font-weight: 600;
}

.resources-tree > li.active > .resources-page {
    color: var(--bs-primary);
}

/* Current page's sections, nested under its entry */
.resources-tree .toc {
    margin: 0.25rem 0 0.75rem 0.35rem;
}

.resources-tree .toc ul {
    border-left: 1px solid rgba(153, 153, 153, 0.25);
    padding-left: 0.85rem;
}

.resources-tree .toc ul ul {
    margin-left: 0.1rem;
}

.resources-tree .toc ul ul a {
    font-size: 0.85rem;
}

/* Content */
.resources-content {
    flex: 1;
    min-width: 0;
    max-width: 900px;
}

.resources-content h1 {
    font-size: 2.5rem;
    color: white;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
}

.resources-content h2 {
    font-size: 1.6rem;
    color: white;
    margin: 2.5rem 0 1rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(153, 153, 153, 0.2);
}

.resources-content h3 {
    font-size: 1.2rem;
    color: white;
    margin: 1.75rem 0 0.75rem 0;
}

.resources-content h2,
.resources-content h3 {
    scroll-margin-top: calc(var(--navh) + 1rem);
}

.resources-content p,
.resources-content ol,
.resources-content ul {
    margin: 0.75rem 0;
}

.resources-content ol,
.resources-content ul {
    padding-left: 1.5rem;
}

.resources-content a {
    color: var(--bs-primary);
}

.resources-content code {
    background: rgba(255, 255, 255, 0.06);
    color: #f0f0f0;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.resources-content pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(153, 153, 153, 0.2);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.resources-content pre code {
    background: none;
    padding: 0;
}

.resources-content table {
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.resources-content th,
.resources-content td {
    border: 1px solid rgba(153, 153, 153, 0.2);
    padding: 0.45rem 0.8rem;
    text-align: left;
    vertical-align: top;
}

.resources-content th {
    background: rgba(31, 157, 39, 0.08);
    color: white;
}

/* User manual headings: "##" part, "###" chapter, "####" section. Styled
   after the 2026 PDF manual (chapters large in green, sections bold at body
   size), with parts as small spaced capitals over a rule. Matches the app's
   manual window (src/helpdocs.cpp, headingStyle). */
.resources-manual h2 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.55);
    margin: 4rem 0 0.25rem 0;
    padding: 1.25rem 0 0 0;
    border-bottom: none;
    border-top: 1px solid rgba(153, 153, 153, 0.25);
}

.resources-manual h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--bs-primary);
    margin: 2.5rem 0 0.75rem 0;
}

.resources-manual h2 + h3 {
    margin-top: 0.4rem;
}

.resources-manual h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: white;
    margin: 1.5rem 0 0.4rem 0;
}

.resources-manual h3,
.resources-manual h4 {
    scroll-margin-top: calc(var(--navh) + 1rem);
}

/* User manual screenshots: fit the column, never upscaled. */
.resources-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.5rem 0;
}

.resources-content blockquote {
    border-left: 3px solid rgba(153, 153, 153, 0.35);
    margin: 1rem 0;
    padding: 0.2rem 0 0.2rem 1rem;
    opacity: 0.85;
}

/* Long URLs and OSC paths wrap instead of widening the page. break-word,
   not anywhere: it leaves tables at their natural width, scrolling. */
.resources-content {
    overflow-wrap: break-word;
}

/* The contents' summary bar only shows on phones (see resources.js). */
.resources-summary {
    display: none;
}

/* Responsive Design */
@media (max-width: 800px) {
    /* stretch, not the desktop flex-start: stacked, flex-start sizes the
       content column to its widest code block or table, pushing the whole
       page past the screen. Stretched, it's the screen's width and those
       scroll inside it. */
    .resources-layout {
        flex-direction: column;
        align-items: stretch;
        gap: 1.25rem;
        padding: calc(var(--navh) + 1rem) 16px 4rem 16px;
    }

    /* Contents as a bar that stays under the navbar while reading, and
       drops down over the page when tapped. */
    .resources-sidebar {
        position: sticky;
        top: var(--navh);
        z-index: 5;
        width: 100%;
        max-height: none;
        overflow: visible;
        background-color: var(--site-bg-color);
        border: 1px solid rgba(153, 153, 153, 0.25);
        border-radius: 8px;
    }

    .resources-summary {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.7rem 1rem;
        cursor: pointer;
        list-style: none;
        color: #d0d0d0;
    }

    .resources-summary::-webkit-details-marker {
        display: none;
    }

    .resources-summary-label {
        font-size: 0.7rem;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: #888;
    }

    .resources-summary-title {
        flex: 1;
        min-width: 0;
        font-weight: 600;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .resources-summary::after {
        content: "";
        width: 7px;
        height: 7px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: translateY(-2px) rotate(45deg);
        transition: transform 0.2s ease;
    }

    .resources-sidebar[open] .resources-summary::after {
        transform: translateY(2px) rotate(-135deg);
    }

    .resources-sidebar > nav {
        max-height: 60vh;
        overflow-y: auto;
        padding: 0.5rem 1rem 0.75rem;
        border-top: 1px solid rgba(153, 153, 153, 0.2);
    }

    /* Clear the sticky contents bar as well as the navbar. */
    .resources-content h2,
    .resources-content h3,
    .resources-manual h4 {
        scroll-margin-top: calc(var(--navh) + 4rem);
    }

    .resources-content h1 {
        font-size: 1.75rem;
    }

    .resources-content h2 {
        font-size: 1.35rem;
    }

    .resources-manual h2 {
        font-size: 0.75rem;
        margin-top: 3rem;
    }

    .resources-manual h3 {
        font-size: 1.4rem;
    }

    .resources-content pre {
        padding: 0.75rem;
        font-size: 0.85em;
    }

    .resources-content table {
        font-size: 0.85rem;
    }

    .resources-content th,
    .resources-content td {
        padding: 0.4rem 0.6rem;
    }
}
