:root {
    --primary-dark: #0E264C;
    --primary: #1a3a6e;
    --accent: #00aeef;
    --text: #333333;
    --bg: #f5f7fa;
    --bg-white: #ffffff;
    --border: #e2e8f0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg); color: var(--text); line-height: 1.6; }

.header {
    background: var(--primary-dark);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.header-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo { display: flex; align-items: center; }
.logo img { height: 44px; width: auto; }

.header-nav { display: flex; gap: 2rem; }
.header-nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.header-nav a:hover { color: white; border-bottom-color: var(--accent); }

.mobile-header { display: none; }

.page-wrapper {
    max-width: 1600px;
    margin: 0 auto;
    padding: 5rem 2rem 2rem;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}
.sidebar > * { width: 100%; }
.sidebar::-webkit-scrollbar { width: 0; height: 0; }

.menu-card, .news-card {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    width: 100%;
}
.menu-header {
    background: var(--primary-dark);
    color: white;
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}
.menu-list { list-style: none; padding: 0.5rem 0; }
.menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.menu-link:hover, .menu-link.active {
    background: rgba(14, 38, 76, 0.04);
    color: var(--primary-dark);
    border-left-color: var(--accent);
}
.menu-link.sub { padding-left: 2.5rem; font-size: 0.85rem; color: #666; }

.news-tabs { display: flex; background: var(--primary-dark); }
.news-tab {
    flex: 1;
    padding: 0.875rem;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.85rem;
}
.news-tab.active { color: white; background: rgba(255,255,255,0.15); }
.news-content { padding: 1rem; min-height: 320px; }
.news-list { list-style: none; }
.news-item { padding: 0.875rem 0; border-bottom: 1px solid var(--border); }
.news-date { font-size: 0.75rem; color: #666; margin-bottom: 0.25rem; }
.news-link { color: var(--primary-dark); text-decoration: none; font-weight: 500; font-size: 0.9rem; }
.news-link:hover { color: var(--accent); }

.main-content { display: flex; flex-direction: column; gap: 2rem; }

.hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #2d5a9e 100%);
    color: white;
    padding: 3rem;
    border-radius: 12px;
    text-align: center;
}
.hero h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 1rem; }
.hero p { font-size: 1.15rem; opacity: 0.9; margin-bottom: 1.5rem; }
.hero-buttons { display: flex; gap: 1rem; justify-content: center; margin-bottom: 2rem; }

.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.875rem 1.75rem; border-radius: 6px;
    font-weight: 600; text-decoration: none; transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-secondary { background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.3); }

.content { background: var(--bg-white); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 2.5rem; }
.page-title { font-size: 2rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 0.5rem; }
.content { line-height: 1.72; }
.content h1 { margin: 12px 0 14px; line-height: 1.25; }
.content h2 { margin: 1.55em 0 0.8em; line-height: 1.28; }
.content h3 { margin: 1.35em 0 0.7em; line-height: 1.32; }
.content p { display: block; margin: 1.0em 0; }
.content ul, .content ol { padding: 0 0 0 40px; margin: 1.2em 0; }
.content li { display: list-item; }
.content pre {
    position: relative;
    margin: 1.2em 0;
    padding: 2.1rem 1rem 1rem 1rem;
    background: linear-gradient(180deg, #0f1729 0%, #0b1220 100%);
    border: 1px solid #25324a;
    border-radius: 10px;
    color: #e5edf7;
    box-shadow: 0 8px 20px rgba(2, 8, 23, 0.25);
    overflow-x: auto;
}
.content pre::before {
    content: "$ shell";
    position: absolute;
    top: 0.5rem;
    left: 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #9fb3d1;
}
.content pre code {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.92rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.content code {
    background: #0f172a;
    border: 1px solid #2a3a57;
    border-radius: 6px;
    padding: 0.12rem 0.38rem;
    color: #c8dcff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.92em;
}
.content pre code br {
    display: none;
}
.content table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin: 1.25em 0;
    background: #fff;
    font-size: 0.95rem;
}
.content th,
.content td {
    border: 1px solid var(--border);
    padding: 0.7rem 0.85rem;
    text-align: left;
    vertical-align: top;
}
.content th {
    background: #f3f6fa;
    color: var(--primary-dark);
    font-weight: 700;
}
.content tbody tr:nth-child(even) {
    background: #fafbfd;
}
.content form[action*="paypal.com/cgi-bin/webscr"] {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 0.2rem 0;
}
.content th:has(form[action*="paypal.com/cgi-bin/webscr"]),
.content td:has(form[action*="paypal.com/cgi-bin/webscr"]) {
    text-align: center;
    vertical-align: middle;
}
.content form[action*="paypal.com/cgi-bin/webscr"] input[type="image"] {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.18));
    transition: transform 0.2s ease, filter 0.2s ease;
}
.content form[action*="paypal.com/cgi-bin/webscr"] input[type="image"]:hover {
    transform: translateY(-1px) scale(1.02);
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.23));
}
.content form[action*="paypal.com/cgi-bin/webscr"] img[width="1"][height="1"],
.content form[action*="paypal.com/cgi-bin/webscr"] img[hidden] {
    display: none !important;
}

/* Modernized Donate blocks (legacy CMSMS table markup) */
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) {
    width: min(100%, 940px) !important;
    margin: calc(1.25rem + 10px) auto 1.25rem;
    border: 1px solid #d7e3f2 !important;
    border-radius: 12px;
    overflow: visible;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
    box-shadow: 0 8px 20px rgba(14, 38, 76, 0.08);
    position: relative;
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"])::before {
    content: "Support BlueOnyx";
    position: absolute;
    top: 0;
    right: 1rem;
    transform: translateY(-52%);
    background: var(--primary-dark);
    color: #fff;
    border-radius: 999px;
    padding: 0.18rem 0.62rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(14, 38, 76, 0.22);
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"])::after {
    content: "Donations";
    position: absolute;
    top: 0;
    left: 1rem;
    transform: translateY(-52%);
    background: var(--primary-dark);
    color: #fff;
    border-radius: 999px;
    padding: 0.18rem 0.62rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(14, 38, 76, 0.22);
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) table:has(form[action*="paypal.com/cgi-bin/webscr"])::before {
    content: none !important;
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) table:has(form[action*="paypal.com/cgi-bin/webscr"])::after {
    content: none !important;
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) > caption {
    caption-side: top;
    text-align: left;
    padding: 0;
    margin: 0;
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) > caption > strong {
    display: none;
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) th,
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) td {
    border: 0 !important;
    background: transparent !important;
    padding: 0.9rem 1rem;
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) tr {
    border: 0 !important;
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) tr > th:has(form[action*="paypal.com/cgi-bin/webscr"]),
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) tr > td:has(form[action*="paypal.com/cgi-bin/webscr"]) {
    width: 220px !important;
    min-width: 180px;
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) th[width="1%"],
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) td[width="1%"] {
    display: none;
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) tr > td:not(:has(form[action*="paypal.com/cgi-bin/webscr"])),
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) tr > th:not(:has(form[action*="paypal.com/cgi-bin/webscr"])) {
    color: #2d3b4e;
    font-size: 0.97rem;
    line-height: 1.72;
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) > tbody > tr > td > table,
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) > tbody > tr > th > table {
    width: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
}
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) > tbody > tr > td > table > tbody > tr,
.content table:has(form[action*="paypal.com/cgi-bin/webscr"]) > tbody > tr > th > table > tbody > tr {
    display: grid;
    grid-template-columns: minmax(170px, 220px) 1fr;
    align-items: center;
    gap: 0.2rem 0.8rem;
}

@media (max-width: 820px) {
    .content table:has(form[action*="paypal.com/cgi-bin/webscr"]) > tbody > tr > td > table > tbody > tr,
    .content table:has(form[action*="paypal.com/cgi-bin/webscr"]) > tbody > tr > th > table > tbody > tr {
        grid-template-columns: 1fr;
    }
    .content table:has(form[action*="paypal.com/cgi-bin/webscr"]) tr > th:has(form[action*="paypal.com/cgi-bin/webscr"]),
    .content table:has(form[action*="paypal.com/cgi-bin/webscr"]) tr > td:has(form[action*="paypal.com/cgi-bin/webscr"]) {
        width: 100% !important;
        min-width: 0;
    }
}
.content-news-widget {
    margin: 0.75rem 0 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}
.content-news-tabbar {
    display: flex;
    background: var(--primary-dark);
}
.content-news-tab {
    flex: 1;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,0.76);
    padding: 0.8rem 1rem;
    font-weight: 600;
    cursor: pointer;
}
.content-news-tab.active {
    color: #fff;
    background: rgba(255,255,255,0.15);
}
.content-news-panel {
    display: none;
    padding: 1rem 1.1rem;
}
.content-news-panel.active {
    display: block;
}
.content-news-item {
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0 0.9rem;
}
.content-news-item:last-child {
    border-bottom: 0;
    padding-bottom: 0.2rem;
}
.content-news-item h3 {
    margin: 0 0 0.3rem;
    font-size: 1.05rem;
    line-height: 1.3;
}
.content-news-item h3 a {
    color: var(--primary-dark);
    text-decoration: none;
}
.content-news-item h3 a:hover {
    color: var(--accent);
}
.content-news-meta {
    color: #5b6776;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}
.content-news-summary {
    color: #313b47;
}
.content-news-more {
    margin-top: 0.35rem;
}
.content-news-more a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
}
.content-news-more a:hover {
    color: var(--accent);
}

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; margin: 2rem 0; }
.feature-card { background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%); border-radius: 10px; padding: 1.5rem; border: 1px solid var(--border); }

footer { text-align: center; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); color: #666; font-size: 0.875rem; }

.hidden { display: none !important; }
.mobile-nav-only { display: none; }

@media (max-width: 1024px) {
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 1rem;
        padding: 1rem;
        background: var(--primary-dark);
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 1001;
        height: 60px;
    }
    .mobile-logo { flex: 1; display: flex; justify-content: flex-start; }
    .mobile-logo img { height: 36px; width: auto; }
    .mobile-menu-btn {
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
    }
    .header { display: none; }
    .page-wrapper {
        padding: 5rem 1rem 1rem;
        grid-template-columns: 1fr;
        margin-top: 60px;
    }
    .sidebar {
        position: fixed;
        top: 60px;
        left: -280px;
        width: 280px;
        height: calc(100vh - 60px);
        background: var(--bg-white);
        z-index: 999;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        padding: 1rem;
        overflow-y: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .sidebar::-webkit-scrollbar { display: none; }
    .sidebar > * { flex-shrink: 0; width: 100%; }
    .mobile-nav-only { display: none !important; }
    .sidebar.open { left: 0; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 60px; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 998;
    }
    .sidebar-overlay.show { display: block; }
    .hero h1 { font-size: 1.75rem; }
    .hero { padding: 2rem; }
    .hero-buttons { flex-direction: column; align-items: center; }
}
