/**
 * index.css - UNIFORM SYMMETRICAL FRAME (V20.1.31)
 * Features: Fluid Logo-Title Symmetry + Responsive Caption + Edge-to-Edge
 * Version: 2026.04.27
 * Update: Hardened Mobile Parity + Full Legacy Logic + Precision Scaling.
 * Accessibility: Focus-States, Reduced Motion, and Screen-Reader Optimizations.
 */

/* --- INDUSTRY STANDARD DENSITY NORMALIZATION --- */
:root {
    /* Base font size for standard displays - Using pixels here as the absolute anchor */
    font-size: 16px;
}

/* Specifically targets high-resolution Android/iPhone regardless of reported width */
@media screen and (max-width: 1024px), (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    :root {
        /* Bumps the global scale to counter-act high-PPI "tiny text" */
        font-size: 18px; 
    }
}

/* --- GLOBAL SCROLLBAR SUPPRESSION (PAGE LEVEL) --- */
html, body {
    scrollbar-width: none; 
    -ms-overflow-style: none;
    overflow: hidden; 
    height: 100%;
    margin: 0;
    padding: 0; 
    background-color: #ffffff;
    /* Force mobile browsers to respect declared font sizes - Vital for iPhone/Android parity */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
    width: 0;
}

#index_page {
    /* Responsive unit conversion (0.0625rem = 1px) */
    --gutter-size: 0rem; 
    --bg-main: #ffffff;
    --bg-card: #ffffff;
    --text-main: #1c1e21;
    --text-muted: #606770;
    --accent: #d47a24;
    --accent-hover: #b3661e;
    --border-color: #ced4da;
    --danger: #dc3545;
    --success: #28a745;
    --terminal-green: #00ff41;
    --terminal-dark: #030712;
    --terminal-border: #1e293b;

    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0; 
    height: 100vh;
    height: 100dvh; 
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Improves font rendering on high-res mobile screens */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- PROFESSIONAL LOGO ASSET INTEGRATION --- */
#index_page .site-logo-main {
    /* SYMMETRY LOCK: Scaled to match the new larger Title+Caption height */
    height: clamp(3.8rem, 10vw, 5.2rem);
    width: auto;
    display: block;
    flex-shrink: 0;
    object-fit: contain;
    background: transparent;
    border: none; 
}

/* --- ADMINISTRATIVE IMMUNITY BANNER --- */
#index_page .admin-offline-banner {
    background: #7f1d1d;
    color: #fecaca;
    text-align: center;
    padding: 0.75rem;
    font-family: 'Courier New', monospace;
    font-weight: 900;
    font-size: 0.85rem;
    border-bottom: 0.125rem solid #ef4444;
    flex-shrink: 0; 
    z-index: 2000;
    letter-spacing: 0.0625rem;
}

/* --- MASTER CONTAINER: NOW FLUSH TO SCREEN EDGES --- */
#index_page .master-container {
    width: 100%; 
    max-width: none; 
    margin: 0; 
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    height: 100vh; 
    height: 100dvh;
    box-sizing: border-box;
    border-radius: 0; 
    box-shadow: none; 
    overflow: hidden;
    border: none; 
    position: relative;
}

/* --- FROZEN HEADER SECTION --- */
#index_page .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 0.0625rem solid var(--border-color);
    /* Fluid padding based on viewport dimensions */
    padding: clamp(0.75rem, 2.5vh, 1.25rem) clamp(0.9375rem, 4vw, 1.5625rem);
    background: var(--bg-card);
    flex-shrink: 0; 
    z-index: 1000;
}

#index_page .logo-brand-group {
    display: flex;
    align-items: center;
    gap: 1.125rem;
}

#index_page .title-caption-stack {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#index_page .main-site-title { 
    margin: 0; 
    font-size: clamp(1.6rem, 5.5vw, 2.4rem); 
    font-weight: 850; 
    color: var(--text-main); 
    line-height: 1.0; 
    letter-spacing: -0.01em;
}

#index_page .site-caption {
    /* INCREASED & FLUID: minimum 0.9rem, preferred 2.5vw, max 1.15rem */
    font-size: clamp(0.9rem, 2.5vw, 1.15rem);
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.35rem;
}

/* Nav wrapper for Terminal + Admin Center side-by-side */
#index_page .header-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

#index_page .btn-terminal {
    text-decoration: none;
    color: #fff;
    background: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.625rem 1.125rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}
#index_page .btn-terminal:hover { background: var(--accent); }

/* --- ACCESSIBILITY: FOCUS STATES --- */
#index_page .card-link:focus {
    outline: 0.1875rem solid var(--accent);
    outline-offset: -0.1875rem;
    background: rgba(212, 122, 36, 0.03);
}

#index_page .btn-terminal:focus,
#index_page .skip-link:focus {
    outline: 0.1875rem solid var(--accent);
    outline-offset: 0.125rem;
}

/* --- INTERNAL SCROLLABLE CONTENT AREA --- */
#index_page .table-scroll-wrapper {
    flex-grow: 1; 
    overflow-y: auto; 
    overflow-x: hidden;
    padding: 1.25rem 1.5625rem;
    background: #fdfdfd;
    scrollbar-width: thin; 
    scrollbar-color: var(--border-color) transparent;
}

#index_page .table-scroll-wrapper::-webkit-scrollbar { width: 0.375rem; }
#index_page .table-scroll-wrapper::-webkit-scrollbar-track { background: transparent; }
#index_page .table-scroll-wrapper::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 0.625rem;
}

#index_page .feed-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

#index_page .post-card {
    background: #ffffff;
    border: 0.0625rem solid var(--border-color);
    border-radius: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

#index_page .post-card:hover {
    transform: translateY(-0.15rem);
    box-shadow: 0 0.3rem 1rem rgba(0,0,0,0.05);
    border-color: var(--accent);
}

#index_page .card-link {
    text-decoration: none;
    display: block;
    padding: clamp(1.2rem, 4vw, 1.8rem);
    color: inherit;
}

#index_page .post-title {
    margin: 0;
    font-size: clamp(1.6rem, 6vw, 2.1rem); 
    font-weight: 850;
    color: var(--text-main);
    line-height: 1.2;
}

#index_page .post-summary {
    margin: 0.75rem 0 1.25rem 0;
    color: var(--text-muted);
    font-size: clamp(1.15rem, 4.5vw, 1.4rem); 
    line-height: 1.5;
}

#index_page .post-meta {
    display: flex;
    justify-content: flex-start; 
    align-items: center;
    border-top: 0.0625rem solid #f1f1f1;
    padding-top: 0.8rem;
}

#index_page .meta-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: monospace;
    margin-right: 1rem;
}

/* --- BADGES --- */
#index_page .badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.2rem 0.6rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
}
#index_page .badge-ai { background: #e6f4ea; color: #1e4620; border: 0.0625rem solid #c3e6cb; }
#index_page .badge-human { background: #eef2ff; color: #3730a3; border: 0.0625rem solid #c7d2fe; }
#index_page .badge-ghost { background: #fff5f5; color: var(--danger); border: 0.0625rem solid #feb2b2; }

#index_page .deactivated { background: #fafafa; opacity: 0.6; }

/* --- MAINTENANCE GATE (PRESERVED) --- */
#index_page.maintenance-gate {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--terminal-dark) !important;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

#index_page.maintenance-gate::before {
    content: " ";
    position: fixed;
    inset: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 255, 65, 0.03) 50%);
    background-size: 100% 0.25rem;
    z-index: 100;
    pointer-events: none;
}

#index_page.maintenance-gate .shutdown-box {
    background: #0b0f1a;
    border: 0.0625rem solid var(--terminal-green);
    padding: 3rem;
    text-align: center;
    color: var(--terminal-green);
    font-family: 'Courier New', monospace;
    box-shadow: 0 0 1.875rem rgba(0, 255, 65, 0.15);
    max-width: 28.125rem;
    position: relative;
    z-index: 101;
    animation: ipFadeIn 0.6s steps(4);
}

#index_page.maintenance-gate .progress-container {
    width: 100%; height: 0.25rem; background: var(--terminal-dark);
    margin: 1.5rem 0; overflow: hidden; border: 0.0625rem solid var(--terminal-border);
}

#index_page.maintenance-gate .progress-bar {
    width: 35%; height: 100%; background: var(--terminal-green);
    box-shadow: 0 0 0.9375rem var(--terminal-green); animation: pulse 1.5s infinite ease-in-out;
}

/* --- ANIMATIONS & REDUCED MOTION --- */
@keyframes pulse { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }
@keyframes ipFadeIn { from { opacity: 0; transform: translateY(0.625rem); } to { opacity: 1; transform: translateY(0); } }
#index_page .blink { animation: blinker 1.2s linear infinite; }
@keyframes blinker { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    #index_page *, #index_page .post-card, #index_page .blink, #index_page .progress-bar {
        animation: none !important;
        transition: none !important;
    }
}

/* --- EXHAUSTIVE MOBILE OVERRIDE & DENSITY FIX --- */
@media screen and (max-width: 1024px), (-webkit-min-device-pixel-ratio: 2) {
    html, body {
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100svh !important;
        position: relative;
    }

    #index_page { 
        display: flex !important; 
        flex-direction: column;
        height: auto !important;
        min-height: 100svh !important;
        overflow-y: visible !important; 
    }

    #index_page .master-container { 
        width: 100% !important; 
        margin: 0 !important; 
        height: auto !important; 
        min-height: 100svh !important;
        overflow: visible !important; 
        padding-bottom: 1.5rem !important; 
        flex-shrink: 0;
    }

    #index_page .site-logo-main {
        /* Boosted to match Title + Expanded Caption height on Android */
        height: 5rem; 
    }

    #index_page .table-scroll-wrapper {
        overflow-y: visible !important; 
        height: auto !important;
        padding: 1.125rem; 
    }

    #index_page .site-caption {
        font-size: 1.05rem !important; /* Fixed boost for high-density mobile readability */
    }

    /* PARITY LOCK FOR MOTOROLA & HIGH-RES DEVICES */
    @media (orientation: portrait) {
        #index_page .post-title { font-size: 2.3rem !important; }
        #index_page .post-summary { font-size: 1.55rem !important; }
    }

    @media (orientation: landscape) {
        #index_page .post-title { font-size: 1.8rem !important; }
        #index_page .post-summary { font-size: 1.3rem !important; }
        #index_page .site-logo-main { height: 4rem; }
    }

    #index_page .meta-date { font-size: 1.1rem !important; }
    #index_page .badge { font-size: 0.85rem !important; }

    #index_page .header { 
        /* FIXED: Using sticky to ensure header remains frozen without breaking document flow */
        position: sticky !important;
        top: 0;
        z-index: 2000;
        padding: 1.125rem; 
        background: var(--bg-card);
        border-bottom: 0.0625rem solid var(--border-color);
    }

    #index_page footer {
        display: block !important;
        visibility: visible !important;
        padding: 4rem 0 7rem 0 !important; 
        width: 100%;
        margin-top: auto;
    }
}

/* LANDSCAPE ORIENTATION OPTIMIZATION */
@media screen and (orientation: landscape) and (max-height: 500px) {
    #index_page .header { 
        position: sticky !important;
        top: 0;
        padding: 0.5rem 1.125rem; 
        z-index: 2000;
        background: var(--bg-card);
    }
    #index_page .site-logo-main { height: 3.2rem; }
    
    /* MODIFIED: Caption visibility restored with fluid height scaling */
    #index_page .site-caption { 
        display: block !important; 
        font-size: 0.85rem; 
        margin-top: 0.15rem;
    }
    
    #index_page .master-container { height: auto; min-height: 100vh; }
    #index_page .table-scroll-wrapper { overflow-y: visible; height: auto; }
}