/* APIC Help – shared stylesheet
   Consolidated from the inline <style> blocks that used to live in every
   help page. Kept as one theme so all pages stay visually consistent.
   Supports light/dark themes via CSS variables; dark is the default. */

:root {
    --bg: #14161a;
    --text: #e6e9ee;
    --muted: #a7b0bd;

    --header-grad-1: #003d7a;
    --header-grad-2: #00857c;
    --header-text: #ffffff;

    --nav-bg: #1c1f24;
    --nav-border: #2a2e35;
    --nav-text: #8fd4ff;
    --nav-text-hover: #4fd1c5;
    --nav-scrolled-bg: rgba(10, 11, 13, 0.94);
    --nav-scrolled-text: #eef2f7;
    --nav-scrolled-text-hover: #5fe0d3;

    --heading: #7fd0ff;
    --heading-border: #00b2a9;

    --code-bg: #23262d;
    --pre-bg: #1a1c21;

    --table-bg: #1b1e23;
    --table-border: #333941;
    --table-head-bg: #0059b2;
    --table-head-text: #ffffff;
    --table-row-alt: #202329;

    --note-bg: #382c17;
    --note-border: #ffb84d;

    --card-bg: #1b1e23;
    --card-border: #2a2e35;
    --card-shadow: rgba(0, 0, 0, 0.35);

    --footer-bg: #101216;
    --footer-text: #8b93a1;

    --link: #6ec1ff;
    --link-hover: #4fd1c5;

    --pill-bg: #24303c;
    --pill-text: #8fd4ff;
    --pill-hover-bg: #0059b2;
    --pill-hover-text: #ffffff;
}

[data-theme="light"] {
    --bg: #f9fafc;
    --text: #222222;
    --muted: #6b7a8a;

    --header-grad-1: #0059b2;
    --header-grad-2: #00b2a9;
    --header-text: #ffffff;

    --nav-bg: #e9ecef;
    --nav-border: #cccccc;
    --nav-text: #0059b2;
    --nav-text-hover: #00b2a9;
    --nav-scrolled-bg: rgba(20, 22, 26, 0.92);
    --nav-scrolled-text: #f3f6fa;
    --nav-scrolled-text-hover: #5fe0d3;

    --heading: #003366;
    --heading-border: #00b2a9;

    --code-bg: #eef2ff;
    --pre-bg: #f1f1f1;

    --table-bg: #ffffff;
    --table-border: #cccccc;
    --table-head-bg: #0059b2;
    --table-head-text: #ffffff;
    --table-row-alt: #f7f9fb;

    --note-bg: #fff4e5;
    --note-border: #ffb84d;

    --card-bg: #ffffff;
    --card-border: #eef3fb;
    --card-shadow: rgba(0, 0, 0, 0.15);

    --footer-bg: #e9ecef;
    --footer-text: #666666;

    --link: #003366;
    --link-hover: #00b2a9;

    --pill-bg: #eef6ff;
    --pill-text: #0b63b6;
    --pill-hover-bg: #0059b2;
    --pill-hover-text: #ffffff;
}

html {
    scroll-behavior: smooth;
}

:root {
    --nav-height: 72px; /* fallback; JS on index.html updates this on load/resize */
}

body {
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    opacity: 0;
    animation: fadeInPage 1.1s ease forwards;
    transition: background .25s ease, color .25s ease;
}

header {
    background: linear-gradient(135deg, var(--header-grad-1), var(--header-grad-2));
    color: var(--header-text);
    padding: 2.2rem 1rem;
    text-align: center;
    transform: translateY(-20px);
    animation: slideDown .8s ease forwards;
}

main {
    max-width: 980px;
    margin: 1.25rem auto;
    padding: 0 1rem;
}

/* Base link color for plain inline links in body text (reference cross-links,
   etc). Browser default link blue has poor contrast on the dark theme's
   background, so give every unstyled <a> a theme-aware color. More specific
   rules (nav a, .nav a, #toc a, .left-panel a, .link) override this. */
a {
    color: var(--link);
}

    a:visited {
        color: var(--link);
    }

    a:hover {
        color: var(--link-hover);
    }

.link {
    text-decoration: none; /* removes underline */
    color: inherit;
}

/* ---------- Section reveal-on-scroll ---------- */

/* #main is a top-level page-content wrapper on several pages, sometimes
   containing further nested <section> reveal targets. It can be taller
   than the viewport, which means the reveal IntersectionObserver's 15%
   threshold may never fire for it on load, hiding the entire page behind
   opacity:0. Always show it; nested sections still get their own reveal. */
#main {
    opacity: 1;
    transform: none;
}

section {
    margin: 2rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: all .7s cubic-bezier(.2,.9,.2,1);
    scroll-margin-top: calc(var(--nav-height) + 12px);
}

    section.visible {
        opacity: 1;
        transform: translateY(0);
    }

    section h2 {
        margin-top: 18px;
        color: var(--heading);
    }

h2 {
    border-bottom: 2px solid var(--heading-border);
    padding-bottom: .35rem;
    color: var(--heading);
    transition: color .22s ease;
}

    h2:hover {
        color: var(--heading-border);
    }

h3 {
    color: var(--heading);
    margin-top: 2rem;
}

/* ---------- Site-wide sticky nav (index.html, id="toc") ---------- */

#toc {
    background: var(--nav-bg);
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--nav-border);
    position: sticky;
    top: 0;
    z-index: 999;
    transition: background .28s ease, opacity .28s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

    #toc h2 {
        font-size: 1rem;
        color: var(--muted);
        border: none;
    }

    #toc ul {
        list-style: none;
        margin: 0;
        padding-left: 0;
        display: flex;
        flex-wrap: wrap;
        gap: .5rem .75rem;
    }

    #toc li {
        margin: 0;
    }

    #toc a {
        display: inline-block;
        padding: .35rem .5rem;
        border-radius: 6px;
        background: transparent;
        color: var(--nav-text);
        text-decoration: none;
        transition: all .18s ease;
        font-size: .95rem;
    }

        #toc a:hover {
            background: transparent;
            color: var(--nav-text-hover);
            transform: translateY(-2px);
        }

        #toc a.active {
            background: transparent;
            color: var(--nav-text-hover);
            font-weight: 600;
            position: relative;
        }

            #toc a.active::after {
                content: '';
                position: absolute;
                left: -8px;
                top: 50%;
                width: 6px;
                height: 6px;
                border-radius: 50%;
                background: var(--nav-text-hover);
                transform: translateY(-50%);
                animation: pulseDot 1.5s infinite;
            }

    /* Elevated/solid state once the page has scrolled — always high-contrast
       regardless of theme, so nav text never washes out over page content. */
    #toc.scrolled {
        background: var(--nav-scrolled-bg);
    }

        #toc.scrolled a {
            color: var(--nav-scrolled-text);
        }

            #toc.scrolled a:hover,
            #toc.scrolled a.active {
                color: var(--nav-scrolled-text-hover);
            }

/* ---------- In-page quick nav (plain <nav> with direct <a> children) ---------- */

nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

    nav a {
        padding: 8px 12px;
        border-radius: 8px;
        background: var(--pill-bg);
        color: var(--pill-text);
        text-decoration: none;
        font-weight: 600;
        font-size: .9rem;
    }

        nav a:hover {
            background: var(--pill-hover-bg);
            color: var(--pill-hover-text);
        }

/* ---------- Back-to-index footer nav (<div class="nav">) ---------- */

.nav {
    text-align: center;
    margin-top: 1rem;
}

    .nav a {
        text-decoration: none;
        background: var(--table-head-bg);
        color: white;
        padding: .4rem 1rem;
        border-radius: 6px;
        transition: all 0.3s ease;
    }

        .nav a:hover {
            background: var(--link-hover);
        }

/* ---------- Image bullet lists (index.html architecture list) ---------- */

.image-bullets {
    list-style: none;
    padding-left: 0;
    line-height: 1.8;
    max-width: 900px;
}

    .image-bullets li {
        position: relative;
        padding-left: 40px;
        margin-bottom: 12px;
        display: flex;
        align-items: flex-start;
    }

        .image-bullets li img {
            position: absolute;
            left: 0;
            top: 0;
            width: 28px;
            height: 28px;
        }

/* ---------- Code & preformatted blocks ---------- */

code {
    background: var(--code-bg);
    padding: .15rem .4rem;
    border-radius: 4px;
    font-family: monospace;
}

pre {
    background: var(--pre-bg);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: monospace;
}

    pre code {
        background: none;
        padding: 0;
    }

/* ---------- Tables ---------- */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--table-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

th, td {
    padding: .5rem .7rem;
    border: 1px solid var(--table-border);
    text-align: left;
}

th {
    background: var(--table-head-bg);
    color: var(--table-head-text);
    font-weight: 600;
}

tr:nth-child(even) {
    background: var(--table-row-alt);
}

/* ---------- Callouts & layout helpers ---------- */

.note {
    background: var(--note-bg);
    border-left: 4px solid var(--note-border);
    padding: 12px;
    border-radius: 6px;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 18px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 12px;
    border-radius: 8px;
}

.left-panel {
    min-width: 260px;
    max-width: 340px;
    width: 260px;
    border-right: 1px solid var(--table-border);
    padding: 16px;
    box-sizing: border-box;
}

    .left-panel h2 {
        margin-top: 0;
        font-size: 20px;
    }

    .left-panel a {
        display: block;
        color: var(--link);
        text-decoration: none;
        padding: 8px 0;
        margin-left: 10px;
    }

.right-panel {
    flex: 1;
    background: var(--card-bg);
    padding: 16px;
    box-sizing: border-box;
}

/* ---------- Collapsible details ---------- */

details summary {
    font-size: 1.1rem;
    list-style: none;
}

details[open] summary::after {
    content: "▲";
    float: right;
}

details summary::after {
    content: "▼";
    float: right;
}

/* ---------- Footer ---------- */

footer {
    text-align: center;
    padding: 1.25rem;
    background: var(--footer-bg);
    color: var(--footer-text);
    font-size: .9rem;
}

/* ---------- Theme toggle button ---------- */

#theme-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1000;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(0,0,0,0.25);
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: transform .18s ease, background .18s ease;
}

    #theme-toggle:hover {
        transform: translateY(-2px) scale(1.05);
        background: rgba(0,0,0,0.4);
    }

/* ---------- Animations ---------- */

@keyframes fadeInPage {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pulseDot {
    0%, 100% { transform: translateY(-50%) scale(1); opacity: 1; }
    50% { transform: translateY(-50%) scale(1.4); opacity: .6; }
}

/* ---------- Responsive tweaks ---------- */

@media (min-width: 720px) {
    #toc ul {
        gap: .35rem 1rem;
    }
}

@media (max-width: 900px) {
    .two-col {
        grid-template-columns: 1fr;
    }

    nav {
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    header h1 {
        font-size: 1.6rem;
    }

    #toc {
        padding: .6rem .8rem;
    }

        #toc ul {
            gap: .25rem .4rem;
        }

        #toc a {
            font-size: .88rem;
            padding: .25rem .45rem;
        }
}
