/* =========================================================================
   SWF Docs - Trove UI (Flash) decompile reference.
   A hidden, unlisted page: a markdown viewer with a grouped, searchable
   sidebar. Shares the brand palette + navbar with docs.css / style.css.
   ========================================================================= */

:root {
    --bg-dark: #12161c;
    --bg-panel: #1d232b;
    --bg-elev: #232a34;
    --bg-code: #0d1117;
    --border-color: #2d3542;
    --border-soft: #232a34;
    --text-main: #ffffff;
    --text-muted: #a3adc2;
    --text-dim: #79839a;
    --accent-blue: #5ec6ff;
    --accent-orange: #ff9800;
    --accent-yellow: #fbc02d;
    --accent-green: #46d39a;
    --accent-purple: #b794f6;
    --accent-red: #ff6b6b;
    --discord-blurple: #5865F2;
    --sidebar-w: 320px;
    --navbar-h: 72px;   /* matches the shared site navbar (style.css) height */
}

* { box-sizing: border-box; }

body, html {
    margin: 0; padding: 0;
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.65;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.highlight-blue { color: var(--accent-blue); }

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 2000;
    background: var(--accent-blue); color: #06131c; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- Navbar */
/* The shared site navbar (partials/navbar.html) is styled by style.css now;
   this page only reserves the layout column below it. The navbar is sticky
   (in-flow), so the layout needs no padding-top offset. */

/* ---------------------------------------------------------------- Layout */
/* The fixed sidebar is reserved with padding-left on the layout; .content
   then fills the whole remaining column to the right of it. */
.docs-layout { padding-left: var(--sidebar-w); min-height: 100vh; }

.sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 900;
}
.sidebar-backdrop.show { display: block; }

/* ---------------------------------------------------------------- Sidebar */
.sidebar {
    position: fixed; top: var(--navbar-h); left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 18px 14px 40px;
    z-index: 950;
}
.sidebar-mobile-nav { display: none; }

.sidebar-head { padding: 0 4px 12px; }
.sidebar-head .eyebrow {
    margin: 0; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--accent-orange); font-weight: 700;
}
.sidebar-head h1 { margin: 4px 0 2px; font-size: 1.15rem; }
.sidebar-head p { margin: 0; color: var(--text-dim); font-size: 0.8rem; }

.sidebar-search {
    position: relative; margin: 4px 0 14px;
}
.sidebar-search i {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-dim); font-size: 0.85rem;
}
.sidebar-search input {
    width: 100%; padding: 10px 12px 10px 34px;
    background: var(--bg-dark); border: 1px solid var(--border-color); border-radius: 8px;
    color: var(--text-main); font-size: 0.88rem; outline: none;
}
.sidebar-search input:focus { border-color: var(--accent-blue); }

.nav-group { margin-bottom: 16px; }
.nav-group-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-dim); font-weight: 700; padding: 0 6px 6px;
}
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group li a {
    display: flex; align-items: baseline; gap: 8px;
    padding: 6px 10px; border-radius: 7px; color: var(--text-muted);
    font-size: 0.88rem; font-weight: 500; line-height: 1.35;
}
.nav-group li a:hover { background: rgba(255,255,255,0.05); color: #fff; text-decoration: none; }
.nav-group li a.active { background: rgba(94,198,255,0.14); color: var(--accent-blue); font-weight: 600; }
.nav-group li a .cls {
    margin-left: auto; font-size: 0.7rem; color: var(--text-dim);
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; white-space: nowrap;
}
.nav-group li a.active .cls { color: var(--accent-blue); }
.nav-empty { display: none; color: var(--text-dim); font-size: 0.85rem; padding: 10px; text-align: center; }

/* Divider fencing off the shared component libraries from the UI screens. */
.nav-divider {
    margin: 6px 6px 14px; padding-top: 14px;
    border-top: 1px solid var(--border-color);
    display: flex; flex-direction: column; gap: 1px;
}
.nav-divider span {
    font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--accent-orange); font-weight: 700;
}
.nav-divider small { font-size: 0.72rem; color: var(--text-dim); }
.nav-group--shared .nav-group-title { color: var(--accent-orange); }
.nav-group--shared li a .cls { font-style: italic; }

/* ---------------------------------------------------------------- Content */
.content {
    /* Fills the whole column left of nothing / right of the sidebar. */
    padding: 32px clamp(20px, 5vw, 64px) 80px;
}

.doc-meta {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border-soft);
}
.doc-chip {
    font-size: 0.74rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
    background: var(--bg-elev); border: 1px solid var(--border-color); color: var(--text-muted);
    display: inline-flex; align-items: center; gap: 6px;
}
.doc-chip code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; color: var(--accent-blue); }
.doc-loading, .doc-error { color: var(--text-dim); padding: 40px 0; font-size: 0.95rem; }
.doc-error { color: var(--accent-red); }

/* ---------------------------------------------------------------- Markdown */
.md-body { font-size: 0.95rem; color: var(--text-main); }
.md-body .mp-md-h, .md-body h1, .md-body h2, .md-body h3, .md-body h4 {
    line-height: 1.3; font-weight: 700; scroll-margin-top: calc(var(--navbar-h) + 16px);
}
.md-body h1 { font-size: 1.85rem; margin: 0 0 16px; }
.md-body h2 {
    font-size: 1.35rem; margin: 34px 0 14px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border-soft);
}
.md-body h3 { font-size: 1.12rem; margin: 26px 0 10px; color: var(--accent-blue); }
.md-body h4 { font-size: 1rem; margin: 20px 0 8px; color: var(--text-muted); }
.md-body p { margin: 0 0 14px; }
.md-body ul, .md-body ol { margin: 0 0 14px; padding-left: 24px; }
.md-body li { margin: 4px 0; }
.md-body a { color: var(--accent-blue); }
.md-body strong { color: #fff; }
.md-body hr { border: none; border-top: 1px solid var(--border-soft); margin: 28px 0; }

.md-body blockquote, .md-body .mp-md-quote {
    margin: 0 0 16px; padding: 10px 16px;
    border-left: 3px solid var(--accent-blue);
    background: rgba(94,198,255,0.06); border-radius: 0 8px 8px 0; color: var(--text-muted);
}
.md-body code {
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 0.86em;
    background: var(--bg-code); border: 1px solid var(--border-color);
    padding: 1px 6px; border-radius: 5px; color: var(--accent-orange);
}
.md-body pre, .md-body .mp-md-pre {
    background: var(--bg-code); border: 1px solid var(--border-color);
    border-radius: 10px; padding: 14px 16px; overflow-x: auto; margin: 0 0 16px;
}
.md-body pre code { background: none; border: none; padding: 0; color: #c9d1d9; font-size: 0.85rem; }

.md-body table, .md-body .mp-md-table {
    width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 0.88rem;
    display: block; overflow-x: auto;
}
.md-body th, .md-body td { border: 1px solid var(--border-color); padding: 8px 12px; text-align: left; vertical-align: top; }
.md-body th { background: var(--bg-elev); font-weight: 700; }
.md-body tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.md-body img { max-width: 100%; border-radius: 8px; }

.doc-foot {
    margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border-soft);
    color: var(--text-dim); font-size: 0.82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}

#to-top {
    /* Sits above the bottom-right support pill so the two don't overlap. */
    position: fixed; bottom: 84px; right: 24px; z-index: 800;
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--accent-blue); color: #06131c; border: none; cursor: pointer;
    font-size: 1rem; display: none; align-items: center; justify-content: center;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}
#to-top.show { display: flex; }

/* Mobile-only floating button that opens the screen list (the docs sidebar).
   On desktop the sidebar is always visible, so this is hidden there. */
.docs-fab {
    position: fixed; bottom: 84px; left: 24px; z-index: 800;
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--bg-elev); color: var(--text-main); border: 1px solid var(--border-color); cursor: pointer;
    font-size: 1rem; display: none; align-items: center; justify-content: center;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

/* ---------------------------------------------------- Support pill (corner)
   Self-contained copy of the shared .support-* widget (style.css) adapted to
   this page's tokens, since this standalone page doesn't load style.css/app.js.
   Markup comes from partials/support_widget.html; toggled by swf-docs.js. */
.support-widget { position: fixed; bottom: 20px; right: 20px; z-index: 9000; }
.support-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border: none; border-radius: 999px; cursor: pointer;
    background: linear-gradient(135deg, #ff6f91, #ff8a3d); color: #fff;
    font: 600 0.95rem inherit;
    box-shadow: 0 4px 20px rgba(255,111,145,0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}
.support-trigger:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(255,111,145,0.55); }
.support-trigger i { animation: support-pulse 2.4s ease-in-out infinite; }
@keyframes support-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
.support-panel {
    position: absolute; bottom: calc(100% + 12px); right: 0; width: 300px; padding: 16px;
    background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 14px;
    box-shadow: 0 12px 50px rgba(0,0,0,0.5); display: grid; gap: 10px;
    opacity: 0; transform: translateY(8px) scale(0.96); pointer-events: none;
    transition: opacity 0.18s, transform 0.22s ease;
}
.support-widget.open .support-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.support-headline { color: var(--text-main); font-size: 0.85rem; line-height: 1.5; margin: 0 0 4px; }
.support-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: var(--bg-elev); border: 1px solid var(--border-color); border-radius: 10px;
    color: var(--text-main); font-weight: 500; font-size: 0.95rem;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.support-link:hover { background: #2a323d; transform: translateX(2px); color: var(--text-main); text-decoration: none; }
.support-paypal:hover { border-color: #009cde; }
.support-kofi:hover { border-color: #ff5e5b; }
.support-bmac:hover { border-color: #ffdd00; }
.support-link i { font-size: 1.3rem; width: 24px; text-align: center; }
.support-paypal i { color: #009cde; }
.support-kofi i { color: #ff5e5b; }
.support-bmac i { color: #ffdd00; }
@media (max-width: 480px) {
    .support-widget { bottom: 16px; right: 16px; }
    .support-trigger { padding: 8px 14px; font-size: 0.88rem; }
    .support-panel { width: calc(100vw - 32px); max-width: 320px; }
}

/* ---------------------------------------------------------------- Mobile */
@media (max-width: 980px) {
    .docs-fab { display: inline-flex; align-items: center; justify-content: center; }
    .sidebar {
        transform: translateX(-100%); transition: transform 0.25s ease;
        width: min(86vw, 340px); box-shadow: 0 0 40px rgba(0,0,0,0.5);
    }
    .sidebar.open { transform: translateX(0); }
    .docs-layout { padding-left: 0; }
    .content { padding: 24px 18px 70px; }
    .sidebar-mobile-nav {
        display: flex; flex-direction: column; gap: 4px;
        margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft);
    }
    .sidebar-mobile-nav a { color: var(--text-muted); padding: 8px 10px; border-radius: 7px; font-size: 0.9rem; }
    .sidebar-mobile-nav a:hover { background: rgba(255,255,255,0.05); color: #fff; text-decoration: none; }
}
