/* Hardwired 28 - Online Manual Stylesheet */
@import url('style-base.css');

html, body {
    overflow-x: hidden;
}

/* Web-specific variables */
:root {
    --color-table-header-bg: #e0e0e0;
    --color-table-header-text: #000;
    --sidebar-width: 260px;
    --color-corporate: #2563EB;
}

body {
    font-size: 11pt;
    line-height: 1.6;
    background: var(--color-bg-muted);
    padding: 0;
    margin: 0;
}

body.has-app-menu {
    padding-top: var(--app-menu-height);
}

/* Main layout: sidebar + content */
.manual-layout {
    display: flex;
    max-width: 1150px;
    margin: 0 auto;
    background: #fff;
    min-height: calc(100vh - var(--app-menu-height));
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--app-menu-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--app-menu-height));
    overflow-y: auto;
    padding: 1.5em 1em;
    background: var(--color-row-alt);
    font-size: 10pt;
    box-sizing: border-box;
    z-index: 100;
    box-shadow: 1px 0 3px rgba(0,0,0,0.05);
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin: 0;
}

.sidebar-nav a {
    display: block;
    padding: 0.4em 0.5em;
    color: var(--color-text);
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
    background: var(--color-row-hover);
    color: var(--color-text);
}

.sidebar-nav a.active {
    background: var(--color-corporate-dark);
    color: var(--color-text-inverse);
}

/* Make active h2/h3 more noticeable */
.sidebar-nav .toc-h2 > a.active {
    background: var(--color-corporate);
    color: var(--color-text-inverse);
    font-weight: 600;
    box-shadow: -3px 0 0 var(--color-corporate);
}

.sidebar-nav .toc-h3 > a.active {
    background: var(--color-row-hover);
    color: var(--color-text);
    font-weight: 500;
}

/* Nested levels */
.sidebar-nav .toc-h1 > a {
    font-weight: 600;
    padding-top: 0.6em;
}

.sidebar-nav .toc-h2 {
    padding-left: 1em;
}

.sidebar-nav .toc-h2 > a {
    font-size: 9.5pt;
    color: var(--color-text-muted);
}

.sidebar-nav .toc-h3 {
    padding-left: 2em;
}

.sidebar-nav .toc-h3 > a {
    font-size: 9pt;
    color: var(--color-text-muted);
}

/* Content area */
.content {
    flex: 1;
    max-width: 850px;
    margin-left: var(--sidebar-width);
    padding: 2em 3em 4em 3em;
    background: #fff;
}

/* Headings - web sizes (smaller than before) */
h1 {
    font-size: 28pt;
    letter-spacing: 0.5pt;
    margin: 0 0 0.5em 0;
    padding-top: 0.5em;
}

h2 {
    font-size: 20pt;
    border-bottom: 2px solid var(--color-border);
    letter-spacing: 0.5pt;
    margin: 1.5em 0 0.5em 0;
    padding-bottom: 0.2em;
}

h3 {
    font-size: 16pt;
    letter-spacing: 0.3pt;
    margin: 1.2em 0 0.4em 0;
}

h4 {
    font-size: 14pt;
    letter-spacing: 0.2pt;
    margin: 1em 0 0.4em 0;
}

/* First h1 after content start - no top padding */
.content > h1:first-child {
    padding-top: 0;
    margin-top: 0;
}

/* Anchor link offset for fixed nav */
[id] {
    scroll-margin-top: calc(var(--app-menu-height) + 1em);
}

/* Paragraphs */
p {
    margin: 0.5em 0;
}

/* Blockquote */
blockquote {
    margin: 1em 0;
    padding-left: 1.5em;
    border-left: 4px solid #ccc;
}

/* Lists */
ol, ul {
    margin: 1em 0;
}

/* Tables - web styles */
table {
    font-size: 10pt;
    margin: 1.5em 0;
}

table + h1,
table + h2,
table + h3,
table + h4,
table + h5,
table + h6 {
    margin-top: 2em;
}

/* Large text wrapper for bigger tables */
.large-text table {
    font-size: 18pt;
    font-family: var(--font-heading);
}

.large-text h3 {
    font-size: 18pt;
}

.large-text th:empty {
    display: none;
}

/* Spacer */
.spacer {
    height: 1em;
}

th, td {
    border-color: #333;
    padding: 0.5em 0.75em;
}

th {
    background: var(--color-table-header-bg);
    color: var(--color-table-header-text);
}

td:first-child {
    font-weight: 600;
}

td:last-child {
    text-align: left;
}

/* HR */
hr {
    margin: 3em 0;
}

/* Code */
code {
    font-size: 10pt;
    background: var(--color-bg-muted);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

pre {
    font-size: 10pt;
    background: var(--color-bg-muted);
    padding: 1em;
    border-radius: 5px;
    margin: 1em 0;
}

/* Cover image full width */
.content > p:first-of-type img {
    width: 100%;
    height: auto;
}

/* Mobile: hide sidebar */
@media (max-width: 900px) {
    .manual-layout {
        flex-direction: column;
    }

    .sidebar {
        display: none;
    }

    .content {
        margin-left: 0;
        max-width: 100%;
        padding: 1.5em 1.5em 3em 1.5em;
    }

    h1 { font-size: 24pt; }
    h2 { font-size: 18pt; }
    h3 { font-size: 15pt; }

    /* Responsive tables */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 9pt;
    }

    th, td {
        padding: 0.4em 0.5em;
        white-space: nowrap;
    }
}

/* Mobile sidebar toggle (shown via JS) */
.sidebar.mobile-open {
    display: block;
    position: fixed;
    top: var(--app-menu-height);
    left: 0;
    width: 280px;
    height: calc(100vh - var(--app-menu-height));
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--app-menu-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Mobile ToC button - hidden on desktop */
.mobile-toc-btn {
    display: none;
}

@media (max-width: 900px) {
    .mobile-toc-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 1em;
        right: 1em;
        z-index: 998;
        background: var(--color-corporate);
        color: white;
        border: none;
        width: 3em;
        height: 3em;
        border-radius: 50%;
        font-size: 10pt;
        font-weight: 600;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }

    /* List icon for ToC */
    .mobile-toc-btn::before {
        content: '';
        width: 1.2em;
        height: 1em;
        background:
            linear-gradient(white, white) 0 0 / 0.3em 2px no-repeat,
            linear-gradient(white, white) 0.5em 0 / 0.7em 2px no-repeat,
            linear-gradient(white, white) 0 0.4em / 0.3em 2px no-repeat,
            linear-gradient(white, white) 0.5em 0.4em / 0.7em 2px no-repeat,
            linear-gradient(white, white) 0 0.8em / 0.3em 2px no-repeat,
            linear-gradient(white, white) 0.5em 0.8em / 0.7em 2px no-repeat;
    }

    .mobile-toc-btn:hover {
        background: #1D4ED8;
    }
}
