/* 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 {
    --bar-height: 52px; /* fixed APIC help bar */
    --nav-height: 72px; /* fallback; JS on help.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;
}

/* a heading a link / search result jumps to stays below the sticky help bar */
main h1[id], main h2[id], main h3[id], main h4[id] {
    scroll-margin-top: calc(var(--bar-height) + 12px);
}

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 (help.html, id="toc") ---------- */

#toc {
    background: var(--nav-bg);
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--nav-border);
    position: sticky;
    top: var(--bar-height);
    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 (help.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;
        }
}

/* ---------- Unified site header (site.js) ---------- */

header#site-header {
    padding-top: 3.6rem;
    animation: none;
    transform: none; /* a transform would make the fixed bar scroll with the header */
}

.site-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--bar-height);
    box-sizing: border-box;
    z-index: 1100;
    backdrop-filter: blur(6px);
    background: linear-gradient(135deg, var(--header-grad-1), var(--header-grad-2));
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .55rem 1rem;
    text-align: left;
}

.site-homebtn,
.site-homebtn:visited {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(0,0,0,0.25);
    color: #fff;
    text-decoration: none;
}

    .site-homebtn:hover {
        background: rgba(0,0,0,0.4);
    }

    .site-homebtn svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

.site-home,
.site-home:visited {
    color: var(--header-text);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.site-search {
    position: relative;
    flex: 1;
    max-width: 520px;
    margin-left: auto;
}

#site-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: .45rem .8rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(0,0,0,0.25);
    color: #fff;
    font-size: .95rem;
    outline: none;
}

    #site-search-input::placeholder {
        color: rgba(255,255,255,0.75);
    }

    #site-search-input:focus {
        background: rgba(0,0,0,0.45);
        border-color: #fff;
    }

#site-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 2000;
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--heading-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    text-align: left;
}

    #site-search-results[hidden] {
        display: none;
    }

.sr-item,
.sr-item:visited {
    display: block;
    padding: .55rem .8rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid rgba(128,128,128,0.25);
}

    .sr-item:hover,
    .sr-item.active {
        background: rgba(0,178,169,0.18);
    }

    .sr-item span {
        display: block;
    }

.sr-page {
    font-weight: 700;
    color: var(--heading);
    font-size: .9rem;
}

.sr-head {
    font-size: .85rem;
    opacity: .85;
}

/* a section whose data-search keywords match the search (site.js) */
.sr-item.sr-best {
    border-left: 3px solid rgba(0,178,169,0.9);
}

.sr-tag {
    font-style: normal;
    font-size: .72rem;
    font-weight: 700;
    padding: 0 .35rem;
    margin-right: .45rem;
    border-radius: 3px;
    background: rgba(0,178,169,0.25);
}

.sr-snip {
    font-size: .82rem;
    opacity: .8;
}

    .sr-snip mark {
        background: rgba(255,200,0,0.45);
        color: inherit;
        border-radius: 2px;
    }

.sr-none {
    padding: .6rem .8rem;
    font-size: .85rem;
    opacity: .8;
}

/* the theme toggle lives in the bar now */
.site-bar #theme-toggle {
    position: static;
    flex: none;
    width: 34px;
    height: 34px;
}

@media (max-width: 520px) {
    .site-home { display: none; }
    .site-search { max-width: none; }
}


/* ---------- Unified site footer (site.js): link columns, divider, logo + copyright ---------- */

footer#site-footer {
    text-align: left;
    padding: 2.5rem 1.5rem 1.5rem;
    margin-top: 2rem;
    background: linear-gradient(135deg, #0a1a4a, #1b1170 60%, #0a1a4a);
    color: #d6dcf0;
    font-size: .95rem;
}

.sf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.5rem 2rem;
    max-width: 980px;
    margin: 0 auto;
}

.sf-col h3 {
    margin: 0 0 .6rem;
    font-size: 1.05rem;
    color: #fff;
}

.sf-col a,
.sf-col a:visited,
.sf-copy a,
.sf-copy a:visited {
    display: block;
    padding: .18rem 0;
    color: #7fb4ff;
}

.sf-copy a {
    display: inline;
}

    .sf-col a:hover,
    .sf-copy a:hover {
        color: #fff;
    }

.sf-bottom {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    max-width: 980px;
    margin: 2rem auto 0;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(127,180,255,0.35);
}

.sf-logo img {
    height: 56px;
    width: auto;
    display: block;
    border-radius: 8px;
}

.sf-copy {
    line-height: 1.6;
    font-size: .9rem;
}

@media (max-width: 520px) {
    .sf-bottom { flex-direction: column; text-align: center; }
}

.site-logo {
    flex: none;
    display: flex;
    align-items: center;
}

    .site-logo img {
        height: 30px;
        border-radius: 6px;
        width: auto;
        display: block;
    }
