:root {
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-primary-contrast: #ffffff;
    --color-secondary: #6366f1;
    --color-secondary-hover: #4f46e5;
    
    /* Light Mode Tokens (Default) */
    --color-bg-main: #f8fafc;
    --color-bg-surface: #ffffff;
    --color-bg-surface-hover: #f1f5f9;
    --color-text-main: #0f172a;
    --color-text-muted: #475569;
    --color-text-disabled: #94a3b8;
    --color-border-subtle: #e2e8f0;
    --color-border-strong: #cbd5e1;
    
    --color-success: #10b981;
    --color-success-bg: #ecfdf5;
    --color-warning: #f59e0b;
    --color-warning-bg: #fffbeb;
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --color-danger-bg: #fef2f2;
    --color-info: #06b6d4;
    --color-info-bg: #ecfeff;
}

/* Dark Mode Overrides applied cleanly via a simple data attribute */
[data-theme="dark"] {
    --color-bg-main: #0f172a;
    --color-bg-surface: #1e293b;
    --color-bg-surface-hover: #334155;
    --color-text-main: #f8fafc;
    --color-text-muted: #94a3b8;
    --color-border-subtle: #334155;
    --color-border-strong: #475569;
}


/* ==========================================================================
   GLOBAL LAYOUT & SYSTEM DESIGN AUTO-THEMING
   ========================================================================== */

/* 1. Global Base Body HTML Reset */
body {
    background-color: var(--color-bg-main);
    color: var(--color-text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    text-align: left:
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* Global transition engine for seamless dark/light mode switching */
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. Main Site structural containers (#container or .wrapper depending on your MyBB theme setup) */
#container,
.main-site-container {
    background-color: var(--color-bg-main);
    width: 100%;
    max-width: 1260px; /* Aligns with your desktop post streams layout grid */
    margin: 0 auto;
    padding: 0 1.5rem;
    box-sizing: border-box;
    transition: background-color 0.3s ease;
}

/* 3. Global Content Card Layers (For forum tables, category wrappers, block components) */
#content,
.main-content-wrapper,
.tborder { /* .tborder targets standard MyBB structural fallback wrappers safely */
    background-color: var(--color-bg-surface);
    color: var(--color-text-main);
    border: 1px solid var(--color-border-subtle);
    border-radius: 0.75rem;
    padding: 2rem;
    box-sizing: border-box;
    text-align: left:
    /* Forces global internal elements to transition beautifully together */
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 4. Core Typography Theme Alignment Controls */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-text-main);
    font-weight: 750;
    line-height: 1.25;
    margin-top: 0;
    transition: color 0.3s ease;
}

p, span, li, td {
    color: var(--color-text-main);
    transition: color 0.3s ease;
}

/* 5. Sub-text and muted information layers across the portal */
.smalltext, 
.text-muted, 
.tfoot {
    color: var(--color-text-muted) !important;
    transition: color 0.3s ease;
}

/* 6. Text Links State Handling */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}

a:hover {
    color: var(--color-primary-hover);
}

/* 7. Classic Form Elements Auto-Theming */
input, select, textarea {
    background-color: var(--color-bg-surface);
    color: var(--color-text-main);
    border: 1px solid var(--color-border-strong);
    border-radius: 0.375rem;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); /* Soft outer focus glow ring */
}

/* 8. Adaptive Mobile Adjustments */
@media (max-width: 768px) {
    #container,
    .main-site-container {
        padding: 0 1rem;
    }

    #content,
    .main-content-wrapper {
        padding: 1.25rem;
        border-radius: 0.5rem;
    }
}



/* ========= HEADER ========== */

/* Base resets to blend with MyBB structures */
.site-header {
    background-color: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border-subtle);
    color: var(--color-text-main);
    font-family: system-ui, -apple-system, sans-serif;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s, border-color 0.3s;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}

/* Semantic Navigation */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover, .nav-link:focus {
    color: var(--color-primary);
}

/* Dropdown Engine */
.dropdown-wrapper {
    position: relative;
}

.dropdown-trigger {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-trigger:hover, .dropdown-trigger:focus {
    color: var(--color-primary);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    min-width: 220px;
    list-style: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    margin-top: 0.5rem;
    display: none; /* Controlled cleanly via JS/A11y state toggles */
}

.dropdown-wrapper:hover .dropdown-menu,
.dropdown-menu.is-active {
    display: block;
}

.dropdown-item a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.dropdown-item a:hover, .dropdown-item a:focus {
    background-color: var(--color-bg-surface-hover);
    color: var(--color-primary);
}

/* Action Controls */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--color-border-strong);
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    color: var(--color-text-main);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    background-color: var(--color-bg-surface-hover);
}

/* Mobile Toggle Button Defaults */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-main);
    cursor: pointer;
    padding: 0.5rem;
    min-width: 44px; /* Accessible hit targets */
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

/* Responsive Breakdown Media Query */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    /* Transform navigation container into full mobile drawer */
    .nav-menu {
        position: absolute;
        top: 70px; /* Aligns right underneath the header container */
        left: 0;
        width: 100%;
        background-color: var(--color-bg-surface);
        border-bottom: 1px solid var(--color-border-subtle);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 1rem 0;
        display: none; /* Controlled cleanly by JS state toggle */
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    }

    /* Active state when burger menu is clicked */
    .nav-menu.is-open {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-link, .dropdown-trigger {
        width: 100%;
        padding: 1rem 1.5rem;
        display: flex;
        justify-content: space-between;
        box-sizing: border-box;
        text-align: left;
    }

    /* Mobile Dropdown Custom Adjustments */
    .dropdown-menu {
        position: relative;
        top: 0;
        width: 100%;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background-color: var(--color-bg-main);
        margin-top: 0;
        padding: 0;
    }

    .dropdown-item a {
        padding: 1rem 2.5rem; /* Deep indent for visibility hierarchy */
    }
    
    /* Avoid desktop hover triggers breaking behavior on mobile touch devices */
    .dropdown-wrapper:hover .dropdown-menu {
        display: none;
    }
    
    .dropdown-wrapper:hover .dropdown-menu.is-active,
    .dropdown-menu.is-active {
        display: block;
    }
}



/* ===== USER SUB-NAV UTILITY BAR COMPONENT===== */

.user-utility-bar {
    background-color: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border-subtle);
    padding: 0.75rem 0;
    width: 100%;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.utility-container {
    max-width: 1200px; /* Synchronizes with your article grid layout limits */
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    box-sizing: border-box;
}

/* Informational Text Track */
.utility-welcome-message {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.user-highlight {
    color: var(--color-text-main);
    font-weight: 600;
}

/* Actions Navigation Area Grid Layout */
.utility-actions-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* Hyperlink Elements Tuning */
.utility-link {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.utility-link:hover {
    color: var(--color-primary);
}

.utility-link.text-danger:hover {
    color: var(--color-danger);
}

/* Primary "Get Started" Call To Action Button (Guests) */
.utility-btn-primary {
    display: inline-flex;
    align-items: center;
    background-color: var(--color-primary);
    color: var(--color-primary-contrast) !important;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.utility-btn-primary:hover {
    background-color: var(--color-primary-hover);
}

/* Creator Layout Trigger Button (Admins Only) */
.utility-btn-admin {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background-color: var(--color-success-bg);
    color: var(--color-success) !important;
    border: 1px solid var(--color-success);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.4rem 0.9rem;
    border-radius: 0.375rem;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
}

.utility-btn-admin:hover {
    background-color: var(--color-success);
    color: var(--color-bg-surface) !important;
}

/* Screen-Reader / Keyboard Focus Outline Accessibility Insurance */
.utility-actions-nav a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: 0.25rem;
}

/* Responsive Structural Breakdown Layer */
@media (max-width: 640px) {
    .utility-container {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .utility-actions-nav {
        width: 100%;
        justify-content: center;
        gap: 1.5rem;
    }
}

/* ========== FOOTER STYLE ==========*/

.site-footer {
    background-color: var(--color-bg-surface);
    border-top: 1px solid var(--color-border-subtle);
    color: var(--color-text-main);
    font-family: system-ui, -apple-system, sans-serif;
    margin-top: 4rem;
    padding: 4rem 0 0 0;
    transition: background-color 0.3s, border-color 0.3s;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr;
    gap: 3rem;
}

.footer-col {
    display: flex;
    flex-direction: column;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0 0 1rem 0;
}

.footer-bio {
    color: var(--color-text-muted);
    font-size: 0.925rem;
    line-height: 1.6;
    margin: 0;
}

.footer-heading {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-main);
    margin: 0 0 1.25rem 0;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
    display: inline-block;
}

.footer-links a:hover, .footer-links a:focus {
    color: var(--color-primary);
    text-decoration: underline;
}

/* Call to Action elements */
.footer-cta-text {
    font-size: 0.925rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0 0 1.25rem 0;
}

.footer-cta-btn {
    background-color: var(--color-primary);
    color: var(--color-primary-contrast) !important;
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.925rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: max-content;
    transition: background-color 0.2s, transform 0.1s;
}

.footer-cta-btn:hover {
    background-color: var(--color-primary-hover);
}

.footer-cta-btn:active {
    transform: scale(0.98);
}

/* Bottom bar details */
.footer-bottom {
    margin-top: 4rem;
    border-top: 1px solid var(--color-border-subtle);
    padding: 1.5rem 0;
    background-color: var(--color-bg-surface-hover);
}

.footer-bottom-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.footer-bottom-container p {
    margin: 0;
}

.back-to-top {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.back-to-top:hover {
    text-decoration: underline;
}

/* Responsive Adaptive Layer */
@media (max-width: 968px) {
    .footer-container {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
    }
}

@media (max-width: 576px) {
    .footer-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .site-footer {
        padding-top: 2.5rem;
    }
    
    .footer-bottom-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-cta-btn {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }
}



/* ========== HOMEPAGE (PORTAL) ========== */

/* Hero Component Styling */
.blog-hero {
    background-color: var(--color-bg-surface-hover); /* Light gray by default, dark mode handles the switch */
    color: var(--color-text-main);
    padding: 6rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--color-border-subtle);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: background-color 0.3s ease, border-color 0.3s ease, padding 0.3s ease;
}

.hero-container {
    max-width: 850px;
    margin: 0 auto;
}

.hero-main-text {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    margin: 0 0 1.5rem 0;
    letter-spacing: -0.03em;
    color: var(--color-text-main);
    display: inline-block;
    
    /* Subtle breathing scale animation */
    animation: heroPulse 6s ease-in-out infinite;
    transform-origin: center;
}

.hero-sub-text {
    font-size: 1.25rem;
    line-height: 1.65;
    color: var(--color-text-muted);
    margin: 0;
    font-weight: 400;
    max-width: 700px;
    margin: 0 auto;
}

/* Accessible scale animation profile */
@keyframes heroPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03); /* Gently increases appearance by 3% without breaking layout flows */
    }
}

/* Respect user preferences for reduced motion (PWD Accessibility Rule) */
@media (prefers-reduced-motion: reduce) {
    .hero-main-text {
        animation: none;
    }
}

/* Main Layout Positioning */
.main-content-layout {
    background-color: var(--color-bg-main);
    min-height: 40vh;
    padding: 4rem 1.5rem;
    transition: background-color 0.3s ease;
}

.articles-feed-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* Media Queries for Smaller Devices */
@media (max-width: 768px) {
    .blog-hero {
        padding: 4rem 1.25rem;
    }
    
    .hero-main-text {
        font-size: 2.25rem;
        animation: none; /* Turn off pulsing on small displays to keep mobile viewports stable */
    }
    
    .hero-sub-text {
        font-size: 1.1rem;
    }
    
    .main-content-layout {
        padding: 2.5rem 1rem;
    }
}


/* ===== ANNOUNCEMENT (ARTICLE) ===== */

/* Main Grid Layout (Stays 2 columns on desktop) */
.articles-feed-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5rem;
}

/* Article Card Box */
.article-card {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 0.75rem;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
    display: flex;
    flex-direction: column;
    gap: 1.25rem; /* Creates perfect uniform spacing down the card elements */
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.3s ease;
}

.article-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-border-strong);
    box-shadow: 0 12px 30px -5px rgba(15, 23, 42, 0.05);
}

/* Header & Metadata styles */
.article-card-header {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.article-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.3;
}

.article-title a {
    color: var(--color-text-main);
    text-decoration: none;
    transition: color 0.15s ease;
}

.article-title a:hover {
    color: var(--color-primary);
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    font-weight: 600;
}

/* New Cover Banner Frame */
.article-cover-block {
    width: 100%;
    height: 200px; /* Controls the uniform height of your article previews */
    overflow: hidden;
    border-radius: 0.5rem;
}

/* Completely hides the block spacing if there is no image asset */
.article-cover-block:has(img[src=""]),
.article-cover-block:has(img:not([src])) {
    display: none !important;
}

.article-cover-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 1px solid var(--color-border-subtle);
    border-radius: 0.5rem;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.article-card:hover .article-cover-banner {
    transform: scale(1.02); /* Smooth immersive zoom when hovering card */
}

/* Excerpt Engine */
.article-body-wrapper {
    flex-grow: 1;
}

.article-excerpt {
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Read More Button styles */
.article-card-footer {
    display: flex;
    justify-content: flex-start;
    padding-top: 0.5rem;
}

.read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.15s ease;
}

.read-more-btn:hover {
    color: var(--color-primary-hover);
}

.read-more-btn svg {
    transition: transform 0.2s ease;
}

.read-more-btn:hover svg {
    transform: translateX(4px);
}

/* Responsive Adaptive Viewports */
@media (max-width: 900px) {
    .articles-feed-container {
        grid-template-columns: 1fr;
        max-width: 600px;
    }
    
    .article-cover-block {
        height: 220px; /* Slightly taller on mobile screens for better impact */
    }
}

@media (max-width: 480px) {
    .article-card {
        padding: 1.5rem;
    }
    
    .article-title {
        font-size: 1.35rem;
    }
    
    .article-cover-block {
        height: 160px;
    }
}