/**
 * view_post.css - NAMESPACED PUBLIC RENDERER (V17.8.51)
 * Strategy: Comprehensive Class-Based Library for Strict CSP & Render Fidelity.
 * Features: Complete RGB-to-Class support, Maintenance Gate, and Secure Rating Nexus.
 * Compliance: CSP-3, OWASP UI Security, Mobile-First Accessibility.
 * Update: Hard-syncing Mobile Parity Logic & Density Overrides with index.css V20.1.31.
 */

/* --- INDUSTRY STANDARD DENSITY NORMALIZATION --- */
:root {
    font-size: 16px;
}

@media screen and (max-width: 1024px), (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    :root {
        font-size: 18px; 
    }
}

/* --- GLOBAL SCROLLBAR SUPPRESSION (PAGE LEVEL SYNC) --- */
html, body {
    scrollbar-width: none; 
    -ms-overflow-style: none;
    overflow: hidden; 
    height: 100%;
    margin: 0;
    padding: 0; 
    background-color: #ffffff;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

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

#view_post {
    --bg-main: #ffffff; 
    --bg-card: #ffffff;
    --text-main: #1c1e21;
    --text-muted: #606770; 
    --accent: #d47a24;
    --accent-hover: #b3661e;
    --border-color: #ced4da;
    --danger: #dc3545;
    --success: #28a745;
    
    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;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden; 
}

#view_post .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;
    box-shadow: none; 
    border: none;     
    position: relative;
    overflow: hidden;
}

/* --- FROZEN HEADER SECTION (SYNCED WITH INDEX.CSS) --- */
#view_post .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 0.0625rem solid var(--border-color);
    padding: clamp(0.75rem, 2.5vh, 1.25rem) clamp(0.9375rem, 4vw, 1.5625rem);
    background: var(--bg-card);
    flex-shrink: 0; 
    z-index: 2000;
    position: sticky;
    top: 0;
}

#view_post .logo-link { 
    text-decoration: none; 
    color: var(--text-main);
}

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

#view_post .site-logo-main {
    height: clamp(3.8rem, 10vw, 5.2rem); 
    width: auto;
    display: block;
    flex-shrink: 0;
    object-fit: contain;
}

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

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

#view_post .site-caption {
    font-size: clamp(0.9rem, 2.5vw, 1.15rem);
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.35rem;
}

#view_post .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: background 0.2s ease;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

#view_post .btn-terminal:hover { background: var(--accent); }

/* --- INTERNAL SCROLLABLE CONTENT AREA (PADDING SYNC) --- */
#view_post .post-content-grid {
    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;
    box-sizing: border-box;
}

#view_post .post-content-grid::-webkit-scrollbar { width: 0.375rem; }
#view_post .post-content-grid::-webkit-scrollbar-track { background: transparent; }
#view_post .post-content-grid::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 0.625rem;
}

#view_post .article-node {
    background: #ffffff;
    border: 0.0625rem solid var(--border-color);
    border-radius: 0.5rem;
    padding: clamp(1.2rem, 4vw, 1.8rem); 
    max-width: 1200px;
    margin: 0 auto;
}

#view_post .post-display-title {
    font-size: clamp(1.6rem, 6vw, 2.4rem);
    font-weight: 850;
    margin: 10px 0 15px 0;
    line-height: 1.2;
    word-break: break-word;
    color: var(--text-main);
}

#view_post .meta-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    border-bottom: 0.0625rem solid #f1f1f1;
    padding-bottom: 15px;
}

#view_post .date-stamp {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: monospace;
    font-weight: 600;
}

#view_post .badge-separator {
    color: var(--border-color);
    font-weight: 400;
}

#view_post .article-summary {
    font-size: clamp(1.15rem, 4.5vw, 1.4rem);
    line-height: 1.6;
    color: #2d3436;
    padding: 20px;
    background: #f8f9fa;
    border-left: 5px solid var(--accent);
    border-radius: 4px;
    word-break: break-word;
    margin-bottom: 20px;
}

/* --- CONTENT AREA & SCROLL WRAPPER --- */
#view_post .content-scroll-wrapper {
    overflow: visible; 
    padding-top: 10px;
    margin-bottom: 20px;
}

#view_post .content-scroll-wrapper::-webkit-scrollbar { width: 8px; }
#view_post .content-scroll-wrapper::-webkit-scrollbar-track { background: #f1f1f1; }
#view_post .content-scroll-wrapper::-webkit-scrollbar-thumb { 
    background: #c1c1c1; border-radius: 4px; 
}
#view_post .content-scroll-wrapper::-webkit-scrollbar-thumb:hover { background: var(--accent); }

#view_post .post-inline-image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    width: 100%;
}

/* --- BADGES --- */
#view_post .badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.2rem 0.6rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
}
#view_post .badge-ai { background: #e6f4ea; color: #1e4620; border: 1px solid #c3e6cb; }
#view_post .badge-human { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }

/* --- COMPACT SIDE-BY-SIDE RATING NEXUS --- */
#view_post .rating-nexus {
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

#view_post .rating-box {
    background: #ffffff;
    padding: 15px 25px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex; 
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap; 
}

#view_post .rating-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0; 
    letter-spacing: 0.5px;
    white-space: nowrap;
}

#view_post .rating-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

#view_post .rating-select {
    padding: 8px 15px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    min-width: 160px;
    transition: border-color 0.2s;
}

#view_post .rating-select:focus {
    outline: none;
    border-color: var(--accent);
}

#view_post .rating-btn {
    background: var(--text-main);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

#view_post .rating-btn:hover { 
    background: var(--accent);
    transform: translateY(-1px);
}

/* --- EXHAUSTIVE MOBILE OVERRIDE & DENSITY FIX (INDEX SYNC) --- */
@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;
    }

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

    #view_post .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;
    }

    #view_post .site-logo-main {
        height: 5rem; 
    }

    #view_post .post-content-grid {
        overflow-y: visible !important; 
        height: auto !important;
        padding: 1.125rem; 
    }

    #view_post .site-caption {
        font-size: 1.05rem !important; /* Density boost */
    }

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

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

    #view_post .header { 
        position: sticky !important;
        top: 0;
        z-index: 2000;
        padding: 1.125rem; 
        background: var(--bg-card);
        border-bottom: 0.0625rem solid var(--border-color);
    }

    /* Rating stack only on tiny phones */
    @media (max-width: 600px) {
        #view_post .rating-box { flex-direction: column; gap: 15px; padding: 20px; }
        #view_post .rating-form { flex-direction: column; width: 100%; }
        #view_post .rating-select, #view_post .rating-btn { width: 100%; }
    }
}

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

/* --- QUILL OVERRIDES --- */
.ql-editor img { max-width: 100%; height: auto; display: block; }
.ql-editor .ql-image-resizer, 
.ql-editor .ql-resizer-wrapper, 
.ql-editor [contenteditable="false"] { 
    display: none !important; 
    visibility: hidden !important; 
    pointer-events: none !important;
}

#sc-editor { white-space: pre-wrap; word-wrap: break-word; }
.ql-editor { padding: 12px 0; min-height: 200px; }

.ql-video {
    display: block;
    max-width: 100%;
    margin: 20px 0;
    border: none;
}

@media print {
    .header, .btn-terminal, .rating-nexus { display: none !important; }
    .master-container { width: 100%; padding: 0; margin: 0; box-shadow: none; border: none; }
}

/* --- INFOPUMPKIN TERMINAL IMMUNITY UI --- */
#ip-maintenance-mode {
    display: flex !important;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: #030712 !important; 
    color: #00ff41 !important;      
    font-family: 'Courier New', monospace;
    overflow: hidden;
    position: fixed;
    top: 0; left: 0; width: 100%; z-index: 10001;
}

#ip-maintenance-mode::before {
    content: " ";
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 255, 65, 0.03) 50%);
    background-size: 100% 4px;
    z-index: 100;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

.shutdown-box {
    border: 1px solid #00ff41;
    padding: 3rem;
    max-width: 500px;
    background: #0b0f1a;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.15);
    text-align: center;
    animation: ipFadeIn 0.6s steps(4);
}

.progress-container {
    width: 100%;
    height: 4px;
    background: #111827;
    margin: 25px 0;
    overflow: hidden;
    border-radius: 2px;
}

.progress-bar {
    width: 40%;
    height: 100%;
    background: #00ff41;
    box-shadow: 0 0 15px #00ff41;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: translateX(-110%); }
    100% { transform: translateX(300%); }
}

@keyframes flicker {
    0% { opacity: 0.97; }
    50% { opacity: 1; }
    100% { opacity: 0.98; }
}

@keyframes ipFadeIn { 
    from { opacity: 0; transform: translateY(10px); } 
    to { opacity: 1; transform: translateY(0); } 
}

.blink { animation: blinker 1.2s linear infinite; }
@keyframes blinker { 50% { opacity: 0; } }

.is-hidden { display: none !important; }

/* VIEW_POST SECURE ARCHITECTURE STYLES */
.master-container { 
    opacity: 0; 
    visibility: hidden; 
    transition: opacity 0.3s ease-in; 
}

.node-ready .master-container { 
    opacity: 1 !important; 
    visibility: visible !important; 
}

body#view_post { 
    background: var(--bg-main); 
}

.ql-anchor-id { 
    scroll-margin-top: 100px; 
}

/* MAINTENANCE GATE UI */
body.maintenance-gate { 
    background: #030712 !important; 
    color: #00ff41 !important; 
    font-family: 'Courier New', monospace; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100vh; 
    margin: 0; 
    overflow: hidden; 
}

body.maintenance-gate::before { 
    content: " "; 
    position: fixed; 
    top: 0; 
    left: 0; 
    bottom: 0; 
    right: 0; 
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 255, 65, 0.03) 50%); 
    background-size: 100% 4px; 
    z-index: 100; 
    pointer-events: none; 
}

.shutdown-box { 
    border: 1px solid #00ff41; 
    padding: 3rem; 
    text-align: center; 
    background: #0b0f1a; 
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.15); 
    max-width: 450px; 
    position: relative; 
    z-index: 101; 
    animation: ipFadeIn 0.6s steps(4); 
}

.shutdown-box h2 { 
    margin: 0; 
    letter-spacing: 3px; 
    font-size: 1.4rem; 
    text-transform: uppercase; 
}

.shutdown-box p { 
    color: #94a3b8; 
    font-size: 0.9rem; 
    margin-top: 10px; 
}

.progress-container { 
    width: 100%; 
    height: 4px; 
    background: #111827; 
    margin: 25px 0; 
    overflow: hidden; 
    border: 1px solid #1e293b; 
}

.progress-bar { 
    width: 35%; 
    height: 100%; 
    background: #00ff41; 
    box-shadow: 0 0 15px #00ff41; 
    animation: pulse 1.5s infinite ease-in-out; 
}

.status-line { font-size: 0.75rem; }
.diag-text { font-size: 0.8rem; color: #4b5563; margin-top: 2rem; }

/* SECURE VIDEO RENDERER */
.ql-video-secure {
    width: 100%;
    aspect-ratio: 16/9;
}

/* ANIMATIONS */
@keyframes pulse { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }
@keyframes ipFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.blink { animation: blinker 1.2s linear infinite; }
@keyframes blinker { 50% { opacity: 0; } }