/* =========================================
   DESIGN SYSTEM: PAGE LAYOUTS (Layout.css)
   ========================================= */

/* --- 1. GLOBAL SCAFFOLDING --- */
.site-layout {
    display: flex;
    justify-content: space-between;
    min-height: 100vh;
    width: 100%;
    margin: 0 auto;
    position: relative;
}

.main-content-area { 
    flex-grow: 1; padding: 2rem; min-width: 0; max-width: 1000px; margin: 0 auto; 
}

.grid-layout-3col { 
    display: grid; grid-template-columns: 1fr; gap: 1.5rem; 
}

@media (min-width: 900px) { 
    .grid-layout-3col { grid-template-columns: repeat(2, minmax(0, 1fr)); } 
    .lg\:col-span-2 { grid-column: span 2 / span 2; } 
}

@media (min-width: 1350px) { 
    .grid-layout-3col { grid-template-columns: repeat(3, minmax(0, 1fr)); } 
}

/* --- 2. SIDEBARS (Left & Right) --- */
.global-sidebar-left {
    width: 240px; flex-shrink: 0; padding: 2rem 1.5rem;
    border-right: 2px solid var(--border-color); display: none;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    box-sizing: border-box; 
    overflow-x: hidden;
}

.global-sidebar-left.collapsed { 
    width: 80px; 
    padding: 2rem 1rem; 
}

/* THE DESPAWN MECHANICS */
.global-sidebar-left.collapsed .sidebar-master-title,
.global-sidebar-left.collapsed .sidebar-title-container,
.global-sidebar-left.collapsed .sidebar-nav-title,
.global-sidebar-left.collapsed #global-sidebar-nav,
.global-sidebar-left.collapsed .kofi-text { 
    display: none !important; /* Physically rips them out of the render tree */
}

.global-sidebar-left.collapsed .btn-manga-text { 
    display: none !important; 
}
.global-sidebar-left.collapsed .btn-manga-content { 
    transform: none !important;
    gap: 0; 
    justify-content: center; 
}
.global-sidebar-left.collapsed .btn-manga-slanted { 
    padding: 0.6rem; 
    transform: none;
}
.global-sidebar-left.collapsed .btn-manga-slanted:hover { 
    transform: translate(-2px, -2px);
}
.global-sidebar-left.collapsed .btn-manga-icon { 
    width: auto; 
    font-size: 1.25rem; 
    margin: 0; 
}

.local-sidebar-right {
    width: 220px; flex-shrink: 0; padding: 2rem 1.5rem;
    border-left: 2px solid var(--border-color); display: none;
    position: sticky; top: 0; height: 100vh; overflow-y: auto; box-sizing: border-box;
}

@media (min-width: 1024px) { 
    .global-sidebar-left { display: flex; flex-direction: column; } 
    .local-sidebar-right { display: block; } 
}

/* Sidebar Internal Layouts */
.sidebar-master-title {
    font-family: 'Finger-Paint', sans-serif;
    font-size: 1.15rem;
    color: var(--text-white);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    text-shadow: 2px 2px 0px var(--manga-shadow);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sidebar-header-top { display: flex; align-items: center; margin-bottom: 1.5rem; width: 100%; white-space: normal; }
.sidebar-site-logo { width: 38px; height: 38px; border: 2px solid var(--border-color); box-shadow: 2px 2px 0px var(--manga-shadow); object-fit: cover; flex-shrink: 0; }
.sidebar-title-container { display: flex; flex-direction: column; margin-left: 0.75rem; flex-grow: 1; min-width: 0; }
.sidebar-title-container .site-title { 
    font-size: 1rem; 
    white-space: normal; 
    overflow: visible; 
    line-height: 1.1; 
    word-wrap: break-word;
}

.sidebar-toggle-btn {
    background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer;
    padding: 0; margin: 0 0 1.5rem 0; display: block; width: 100%; text-align: left;
    transition: color 0.2s, transform 0.2s; transform-origin: left center;
}

.sidebar-nav-title {
    font-family: 'CC-Wild-Words', sans-serif; font-size: 0.85rem; color: var(--accent-blue);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; margin-top: 0.5rem;
    text-shadow: 1px 1px 0px var(--manga-shadow);
}
.sidebar-nav-title:first-child { margin-top: 0; }

.toc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.25rem; }

.sidebar-action-dock {
    display: flex; flex-direction: column; gap: 0.75rem; width: 100%;
    padding: 0 1.5rem 1.5rem 1.5rem; box-sizing: border-box; margin-top: auto;
}
.global-sidebar-left.collapsed .sidebar-action-dock { padding: 0 0.5rem 1.5rem 0.5rem; gap: 1rem; }

/* --- 3. PAGE HEADERS & GRIDS --- */
.home-main-header { border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; margin-bottom: 2rem; }
.home-main-title { font-size: 2rem; margin: 0; color: var(--text-white); }

.header-split-wrapper, .dashboard-header-split {
    display: flex; justify-content: space-between; align-items: flex-end;
    border-bottom: 2px solid var(--accent-blue); padding-bottom: 0.75rem;
    margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;
}
.dashboard-header-split { padding-bottom: 0.5rem; margin-bottom: 1rem; flex-wrap: nowrap; gap: 0.5rem; }

.section-title-clean { border-bottom: none !important; margin-bottom: 0 !important; padding-bottom: 0 !important; transform: translateY(4px); }
.section-title-flex { border-bottom: none !important; margin-bottom: 0 !important; padding-bottom: 0 !important; display: flex; align-items: baseline; gap: 0.75rem; transform: translateY(4px); }

.hub-link { font-size: 0.75rem; color: var(--text-muted); font-family: var(--text-mono); text-decoration: none; transition: color 0.2s; margin-top: 0.25rem; }
.hub-link:hover { color: var(--accent-blue); }

/* Grids & Galleries */
.roster-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }
.systems-grid-container { display: flex; flex-direction: column; gap: 1rem; }
.system-button-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0.5rem; }

.filter-bar-inline { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.filter-group { display: flex; align-items: center; gap: 0.5rem; }
.filter-label { font-family: 'CC-Wild-Words', sans-serif; font-size: 0.75rem; color: var(--accent-blue); text-transform: uppercase; }

/* --- 4. SCROLL BOXES --- */
.scroll-lg { max-height: 450px !important; }
.scroll-sm { max-height: 220px !important; }

.faq-scroll-box { 
    max-height: 380px; overflow-y: auto; padding: 0.25rem 0.5rem 0.5rem 0.25rem;
}
.faq-scroll-box::-webkit-scrollbar, #site-updates-dashboard::-webkit-scrollbar { width: 6px; }
.faq-scroll-box::-webkit-scrollbar-track, #site-updates-dashboard::-webkit-scrollbar-track { background: var(--bg-main); }
.faq-scroll-box::-webkit-scrollbar-thumb, #site-updates-dashboard::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 0; }

#site-updates-dashboard { max-height: 410px !important; overflow-y: auto; overflow-x: hidden; }

/* --- 5. INTERNAL SECTION LAYOUTS --- */
/* Game Info Widget */
.game-info-logo-box { display: flex; flex-direction: column; align-items: center; margin-bottom: 1.5rem; }
.game-info-title { font-family: 'Finger-Paint', sans-serif; font-size: 1.125rem; color: var(--text-white); letter-spacing: 0.15em; text-align: center; line-height: 1.2; margin: 0; }
.game-info-label { display: block; color: hsl(215, 8%, 47%); font-weight: bold; margin-bottom: 0.25rem; }
.game-info-subtext { color: hsl(212, 9%, 58%); font-size: 0.75rem; display: block; }
.game-info-footer { padding-top: 1rem; border-top: 1px solid var(--border-color); margin-top: 1rem; }
.game-info-link { display: block; color: hsl(213, 94%, 68%); text-decoration: none; margin-bottom: 0.5rem; }

/* Update Log Tables */
.update-log-summary { cursor: pointer; list-style: none; outline: none; }
.update-log-summary::-webkit-details-marker { display: none; }
.update-log-meta { display: flex; gap: 0.5rem; align-items: center; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.25rem; font-family: var(--text-mono); }
.expand-hint { margin-left: auto; font-size: 0.75rem; color: var(--text-muted); transition: transform 0.2s ease; }
.update-log-item[open] .expand-hint { transform: rotate(180deg); }
.update-title { margin: 0; font-size: 1.15rem; color: var(--text-white); font-family: 'CC-Wild-Words', sans-serif; }
.update-log-body { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 2px dashed var(--border-color); }

.update-table-container { overflow-x: auto; }
.update-table { width: 100%; font-size: 0.875rem; text-align: left; color: var(--text-primary); border-collapse: collapse; }
.update-table th { padding: 0.5rem 0.75rem; font-family: 'CC-Wild-Words', sans-serif; font-size: 0.75rem; color: var(--text-white); background-color: var(--bg-main); border-bottom: 2px solid var(--accent-blue); }
.update-table td { padding: 0.75rem; border-bottom: 1px solid var(--border-color); }
.update-row:hover { background-color: hsl(215, 28%, 17%); }

/* FAQ Sections */
.faq-summary { display: flex; justify-content: space-between; align-items: center; font-family: 'CC-Wild-Words', sans-serif; color: var(--accent-blue); cursor: pointer; list-style: none; text-shadow: 1px 1px 0px #000; }
.faq-summary::-webkit-details-marker { display: none; }
.faq-arrow { font-size: 0.75rem; color: var(--text-muted); transition: transform 0.2s ease; }
.faq-details[open] .faq-arrow { transform: rotate(180deg); }
.faq-content { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 2px dashed var(--border-color); color: var(--text-primary); line-height: 1.6; }

/* Profile / Biography Layouts */
.profile-top-split { display: flex; gap: 2rem; flex-wrap: wrap; }
.profile-card { flex: 1; min-width: 250px; max-width: 320px; align-self: flex-start; }
.profile-text-wrapper { flex: 2; min-width: 300px; }
.profile-stat-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border-color); }
.profile-stat-label { color: #8b949e; font-size: 0.9rem; }
.profile-stat-val { color: var(--text-white); font-weight: bold; font-size: 0.9rem; }
.profile-portrait { width: 100%; border-radius: 4px; margin-bottom: 1rem; border: 1px solid var(--border-color); }

/* Tier List Layout */
.tier-tabs { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 2rem; border-bottom: 2px solid var(--border-color); padding-bottom: 1.5rem; justify-content: center; }
.tier-list-container { background: var(--bg-main); border: 2px solid var(--border-color); box-shadow: 6px 6px 0px var(--manga-shadow); display: flex; flex-direction: column; gap: 2px; }
.tier-row { display: flex; background: var(--bg-secondary); min-height: 80px; border-bottom: 2px dashed var(--border-color); }
.tier-row:last-child { border-bottom: none; }
.tier-label { width: 100px; display: flex; align-items: center; justify-content: center; font-family: 'CC-Wild-Words', sans-serif; font-size: 1.25rem; color: #000; text-align: center; padding: 0.5rem; border-right: 2px solid var(--border-color); text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.5); }
.tier-characters { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px; flex-grow: 1; }
.tier-char-tooltip { position: absolute; bottom: 0; left: 0; width: 100%; background: rgba(0, 0, 0, 0.85); color: var(--text-white); font-family: var(--text-mono); font-size: 0.65rem; text-align: center; padding: 4px 0; pointer-events: none; border-top: 1px solid var(--accent-blue); }

/* Footer & Credits */
.footer-grid-section { margin-top: 1.5rem; border-top: 1px solid var(--border-color); padding-top: 2rem; }
.credits-list { list-style: none; padding: 0; margin: 0; }
.credits-list li { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.aggregated-contributors-footer { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 2.5rem; margin-bottom: 0.5rem; padding: 1rem 1.25rem; background: var(--bg-main); border: 2px solid var(--border-color); clear: both; box-shadow: 6px 6px 0px var(--manga-shadow); position: relative; }
.aggregated-contributors-footer::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background-color: var(--accent-blue); }
.contributors-header { display: flex; align-items: center; gap: 0.5rem; font-family: 'CC-Wild-Words', sans-serif; font-size: 0.85rem; color: var(--text-white); text-transform: uppercase; border-bottom: 2px dashed var(--border-color); padding-bottom: 0.5rem; }
.contributors-list { display: flex; flex-wrap: wrap; gap: 0.75rem; padding-top: 0.25rem; }

/* General Typography & Utility */
.loading-msg { color: var(--text-muted); font-style: italic; margin: 0; }
.wiki-block-heading { color: var(--text-white); font-weight: 600; margin-top: 1.25rem; margin-bottom: 0.5rem; }
.wiki-block-heading[style*="center"] { clear: both; display: block; }
.wiki-block-list { list-style-type: disc; padding-left: 1.25rem; margin-bottom: 0.75rem; }
.strategy-paragraph { margin-bottom: 0.75rem; line-height: 1.6; }
.matchup-heading { border-left: 3px solid hsl(212, 12%, 21%); padding-left: 0.75rem; }
.counterplay-heading { border-left: 3px solid hsl(0, 60%, 50%); padding-left: 0.75rem; }
.card-header-flex { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 0.75rem; margin-bottom: 1rem; }
.card-header-title { 
    font-family: 'Finger-Paint', sans-serif;
    color: var(--text-white); 
    font-size: 1.5rem; 
    margin: 0; 
    font-weight: bold; 
}
.card-tier-label { font-size: 0.85rem; font-weight: bold; text-transform: uppercase; }

.space-y-8 > * + * { margin-top: 2.5rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.hidden { display: none !important; }

/* Media Formatting Helpers */
.wiki-media { border-radius: 4px; border: 1px solid var(--border-color); }
.wiki-media-left { float: left; margin: 0.5rem 1.5rem 1rem 0; }
.wiki-media-right { float: right; margin: 0.5rem 0 1rem 1.5rem; }
.wiki-media-center { display: block; margin: 1.5rem auto; }
.wiki-media-full { margin: 1.5rem 0; }

/* --- 6. MOBILE SUPPORT --- */
.mobile-top-bar { display: none; }
.mobile-backdrop { display: none; }

@media (max-width: 1023px) {
    .mobile-top-bar {
        display: flex; align-items: center; justify-content: space-between;
        background-color: var(--bg-secondary); border: 2px solid var(--border-color);
        padding: 0.75rem 1rem; margin-bottom: 1.5rem; position: sticky; top: 1rem;
        z-index: 40; box-shadow: 4px 4px 0px var(--manga-shadow);
    }

    .global-sidebar-left {
        display: flex; flex-direction: column; position: fixed; top: 0; left: 0;
        width: 260px !important; height: 100vh; padding: 2rem 1.5rem !important; 
        background-color: var(--bg-main); z-index: 50; transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 8px 0px 0px var(--manga-shadow); border-right: 2px solid var(--accent-blue);
    }

    .global-sidebar-left.mobile-open { transform: translateX(0); }
    .sidebar-toggle-btn { display: none !important; }

    .mobile-backdrop {
        display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
        background: rgba(10, 10, 10, 0.8); backdrop-filter: blur(4px); z-index: 45;
    }

    .mobile-backdrop.active { display: block; animation: fadeIn 0.2s ease-out; }
    
    .mobile-logo-link { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; }
    .mobile-logo-img { width: 32px; height: 32px; border: 2px solid var(--border-color); box-shadow: 2px 2px 0px #000; object-fit: cover; }
    .mobile-site-title { font-size: 1.25rem; margin: 0; line-height: 1; color: var(--text-white); }
    .mobile-menu-btn { background: none; border: none; color: var(--text-white); font-size: 1.75rem; padding: 0; }
    
    .mobile-edit-fab {
        display: flex !important; align-items: center; justify-content: center;
        position: fixed; bottom: 1.5rem; right: 1.5rem; width: 56px; height: 56px;
        background: var(--bg-main); border: 2px solid var(--accent-blue); color: var(--accent-blue);
        z-index: 900; box-shadow: 4px 4px 0px var(--manga-shadow); transform: skewX(-10deg);
    }
    .mobile-edit-fab svg { transform: skewX(10deg); }
    /* Mobile Sidebar Dock Collapsing */
    .global-sidebar-left.collapsed .btn-manga-text { display: none; }
    .global-sidebar-left.collapsed .btn-manga-slanted { padding: 0.6rem; justify-content: center; }
    .global-sidebar-left.collapsed .btn-manga-icon { margin: 0; width: 100%; font-size: 1.5rem; transform: translateY(2px); }
    .global-sidebar-left.collapsed .dock-badge { top: -4px; right: -4px; width: 14px; height: 14px; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }