/**
 * Article Single View — Professional -Style Edition
 * Cleaned, Deduplicated, and Typography-Optimized
 */

/* ─── 1. VARIABLES & THEMING ─────────────────────────────────────────────── */
:root { 
    --apx-brand: #0284c7; 
    --apx-bg: #ffffff; 
    --apx-text: #1a1a1a; 
    --apx-text-mut: #6b7280; 
    --apx-border: #f3f4f6; 
    --apx-border-heavy: #e5e7eb; 
    --apx-panel: #fafafa; 
    --apx-font-sans: 'Source Sans 3', -apple-system, sans-serif; 
    --apx-font-serif: 'Merriweather', Georgia, serif; 
    --apx-ease: cubic-bezier(0.25, 1, 0.5, 1); 
}

body.dark-mode { 
    --apx-bg: #0f172a; 
    --apx-text: #f8fafc; 
    --apx-text-mut: #94a3b8; 
    --apx-border: #1e293b; 
    --apx-border-heavy: #334155; 
    --apx-panel: #1e293b; 
    background-color: var(--apx-bg); 
    color: var(--apx-text); 
}

body { 
    background-color: var(--apx-bg); 
    color: var(--apx-text); 
    margin: 0; 
    padding: 0; 
    transition: background-color 0.2s, color 0.2s; 
    -webkit-font-smoothing: antialiased; 
}

/* ─── 2. STRICT FONT ASSIGNMENTS (As Requested) ──────────────────────────── */
body, .reader-container, .reader-container div, .reader-container p, .reader-container span, .reader-container a { 
    font-family: var(--apx-font-serif) !important; 
}

.reader-container h1, .reader-container h2, .reader-container h3, .reader-container h4, .reader-container h5, .reader-container h6,
.av-meta-row, .av-meta-row *, .av-actions-bar, .av-actions-bar *, .av-bottom-actions, .av-bottom-actions *, .av-bio-box, .av-bio-box *, 
.av-comments-sec, .av-comments-sec *, .av-tags, .av-tags *, .apx-login-wall *, .av-related-wrapper * { 
    font-family: var(--apx-font-sans) !important; 
}

h1, h2, h3, h4, .av-ui-font { font-family: var(--apx-font-sans); }
.av-content, .av-deck { font-family: var(--apx-font-serif); }

/* ─── 3. BASE LAYOUT & HERO ──────────────────────────────────────────────── */
.reader-container { 
    max-width: 680px; 
    margin: 40px auto 60px auto; 
    padding: 0 24px; 
    min-height: 70vh; 
}

.av-category-tag { 
    display: inline-block; font-size: 13px; font-weight: 700; text-transform: uppercase; 
    letter-spacing: 0.05em; color: var(--apx-brand); margin-bottom: 16px; 
    text-decoration: none; transition: 0.2s; 
}
.av-category-tag:hover { opacity: 0.8; }

.av-title { font-size: clamp(34px, 5vw, 46px); font-weight: 800; line-height: 1.15; color: var(--apx-text); margin: 0 0 12px 0; letter-spacing: -0.02em; }
.av-deck { font-size: 20px; font-weight: 400; line-height: 1.4; color: var(--apx-text-mut); margin: 0 0 32px 0; }

.av-author-strip { display: flex; align-items: center; gap: 16px; margin-bottom: 32px; }
.av-meta-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.av-author-info { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.av-author-name { font-weight: 600; font-size: 16px; color: var(--apx-text); text-decoration: none; }
.av-meta-stats { font-size: 14.5px; color: var(--apx-text-mut); }

.av-btn-follow { background: transparent; border: 1px solid var(--apx-text); border-radius: 99px; color: var(--apx-text); padding: 4px 14px; font-size: 14px; font-weight: 500; cursor: pointer; transition: 0.2s; margin-left: 4px; }
.av-btn-follow:hover { background: var(--apx-text); color: var(--apx-bg); }
.av-btn-follow.active { color: var(--apx-text-mut); border-color: var(--apx-text-mut); }

.av-hero-img { margin: 0 0 40px 0; width: 100%; }
.av-hero-img img { width: 100%; height: auto; object-fit: cover; border-radius: 4px; }
.av-hero-caption { text-align: center; font-size: 13.5px; color: var(--apx-text-mut); margin-top: 10px; }

/* ─── 4. -STYLE ARTICLE CONTENT ────────────────────────────────────── */
.av-content { 
    font-size: 21px;           /* Authentic  sizing */
     letter-spacing: -0.003em;  /* Better readability for long text */
    color: var(--apx-text); 
    position: relative; 
    word-wrap: break-word;
}
/* Force clean -style typography on BOTH paragraphs and divs */
.av-content p,
.av-content div { 
    margin-bottom: 1.6em !important; 
    font-family: unset;
    line-height: 1.6 !important; 
}

/* Ensure the span tags inside don't inherit weird editor fonts */
.av-content span {
    line-height: inherit !important;
    font-family: inherit !important;
}
.av-content img { max-width: 100%; height: auto; margin: 2em 0; border-radius: 4px; }
.av-content h2 { font-size: 36px; font-weight: 800; margin: 1.8em 0 0.6em; line-height: 1.2; letter-spacing: -0.01em; }
.av-content h3 { font-size: 24px; font-weight: 700; margin: 1.5em 0 0.6em; line-height: 1.2; }
.av-content a { color: var(--apx-brand); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: opacity 0.2s; }
.av-content a:hover { opacity: 0.8; }
.av-content blockquote {
    border-left: 3px solid #1141ad;
    margin: 40px 0;
    padding: 0 0 0 24px;
    font-style: italic;
    font-size: 24px;
    line-height: 1.48;
    color: #407bff;
}

/* ─── 5. ACTION BARS & REACTIONS ─────────────────────────────────────────── */
.av-actions-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--apx-border-heavy); border-bottom: 1px solid var(--apx-border-heavy); margin-bottom: 40px; flex-wrap: wrap; gap: 16px; }
.av-actions-left { display: flex; align-items: center; gap: 20px; margin-right: auto; }
.av-actions-right { display: flex; gap: 24px; align-items: center; }

.av-stat-item { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--apx-text-mut); text-decoration: none; transition: 0.2s; cursor: pointer; user-select: none; }
.av-stat-item:hover { color: var(--apx-text); }
.av-stat-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.av-stat-item svg.solid-icon { fill: currentColor; stroke: none; } 

.av-action-icon { background: transparent; border: none; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--apx-text-mut); transition: 0.2s; }
.av-action-icon:hover { color: var(--apx-text); }
.av-action-icon svg { width: 22px; height: 22px; stroke-width: 1.2; stroke: currentColor; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.av-action-icon.active svg, .av-action-icon svg.fill-icon { fill: currentColor; stroke: none; }

.rxn-wrap { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.rxn-trigger { display: flex; align-items: center; gap: 6px; background: transparent; border: none; font-size: 14px; color: var(--apx-text-mut); cursor: pointer; padding: 0; transition: 0.2s; }
.rxn-trigger:hover { color: var(--apx-text); }
.rxn-trigger .icon { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; }
.rxn-picker { position: absolute; bottom: calc(100% + 8px); left: 0; display: flex; gap: 6px; background: var(--apx-bg); border: 1px solid var(--apx-border-heavy); border-radius: 99px; padding: 6px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); opacity: 0; pointer-events: none; transform: translateY(10px) scale(0.95); transition: 0.2s; z-index: 50; }
.rxn-picker.open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.rxn-opt { width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.15s; }
.rxn-opt:hover { transform: scale(1.3) translateY(-4px); }

.av-bottom-actions { background: var(--apx-panel); border: 1px solid var(--apx-border-heavy); border-radius: 12px; padding: 20px 30px; margin: 40px 0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }
.av-bottom-actions .av-actions-left { gap: 32px; }
.av-bottom-actions .rxn-trigger, .av-bottom-actions .av-stat-item, .av-bottom-actions .av-action-icon { font-size: 16px; font-weight: 600; color: var(--apx-text); }
.av-bottom-actions svg { width: 26px; height: 26px; }

/* ─── 6. ADS ─────────────────────────────────────────────────────────────── */
.apx-ad-isolate { margin: 40px 0; padding: 12px 0; text-align: center; border-top: 1px dashed var(--apx-border-heavy); border-bottom: 1px dashed var(--apx-border-heavy); }
.apx-ad-isolate-label { font-size: 10px; color: var(--apx-text-mut); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; display: block; font-weight: 700; }
.apx-ad-isolate-content { display: block; width: 100%; }

/* ─── 7. COMMENTS ────────────────────────────────────────────────────────── */
.av-comments-sec { border-top: 1px solid var(--apx-border-heavy); padding-top: 48px; margin-top: 48px; }
.av-comments-sec h2 { font-weight: 800; font-size: 22px; margin: 0 0 32px 0; color: var(--apx-text); }
.av-comments-sec .fa-solid, .av-comments-sec .fa-regular, .av-comments-sec i[class*="fa-"] { font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 5 Free", "FontAwesome" !important; font-weight: 900 !important; }

.av-comment-form textarea { width: 100%; background: transparent; border: 1px solid var(--apx-border-heavy); border-radius: 8px; padding: 14px; font-size: 15px; color: var(--apx-text); resize: vertical; margin-bottom: 12px; box-sizing: border-box; transition: border-color 0.2s; }
.av-comment-form textarea:focus { outline: none; border-color: var(--apx-text-mut); }
.av-btn-post { background: var(--apx-text); color: var(--apx-bg); border: none; padding: 8px 20px; border-radius: 99px; font-weight: 600; cursor: pointer; transition: 0.2s; font-size: 14px; }
.av-btn-post:hover { opacity: 0.85; }

.av-comment { display: flex; gap: 16px; padding: 24px 0; border-bottom: 1px solid var(--apx-border-heavy); }
.av-comment:last-child { border-bottom: none; }
.av-c-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.av-c-body { flex: 1; }
.av-c-header { margin-bottom: 12px; }
.av-c-name { font-weight: 600; font-size: 15px; color: var(--apx-text); display: flex; align-items: center; text-decoration: none; }
.av-c-time { font-size: 13.5px; color: var(--apx-text-mut); margin-top: 2px; }
.av-c-text { font-size: 15.5px; line-height: 1.6; color: var(--apx-text); margin-bottom: 12px; word-break: break-word; }
.av-c-actions { display: flex; gap: 16px; align-items: center; }
.av-c-reply-btn { background: none; border: none; color: var(--apx-text-mut); font-weight: 500; font-size: 13.5px; cursor: pointer; padding: 0; transition: color 0.2s; }
.av-c-reply-btn:hover { color: var(--apx-text); }
.av-reply-form { display: none; margin-top: 16px; }
.av-reply-form.active { display: block; }
.av-reply { display: flex; gap: 14px; margin-top: 20px; padding-left: 20px; border-left: 2px solid var(--apx-border-heavy); }
.av-reply .av-c-avatar { width: 32px; height: 32px; }

/* ─── 8. RELATED ARTICLES & BOOKS GRIDS ──────────────────────────────────── */
.av-related-wrapper { background: var(--apx-panel); border-top: 1px solid var(--apx-border-heavy); padding: 60px 24px; margin-top: 60px; }
.av-related-inner { max-width: 1200px; margin: 0 auto 60px auto; }
.av-related-inner h2 { font-size: 24px; font-weight: 800; margin: 0 0 32px 0; color: var(--apx-text); border-bottom: 2px solid var(--apx-border-heavy); padding-bottom: 12px; }

.av-rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 40px; }
.av-r-card { display: flex; flex-direction: column; text-decoration: none; transition: transform 0.2s; }
.av-r-card:hover { transform: translateY(-4px); }
.av-r-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 4px; margin-bottom: 16px; }
.av-r-title { font-size: 22px; font-weight: 800; line-height: 1.25; color: var(--apx-text); margin: 0 0 8px 0; letter-spacing: -0.01em; }
.av-r-deck { font-size: 15px; color: var(--apx-text-mut); line-height: 1.5; margin: 0 0 20px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.av-r-actions { display: flex; justify-content: flex-start; align-items: center; border-top: 1px solid var(--apx-border-heavy); padding-top: 16px; color: var(--apx-text-mut); font-size: 14px; gap: 24px; }
.av-r-stat { display: flex; align-items: center; gap: 6px; }
.av-r-stat svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.av-r-stat svg.solid-icon { fill: currentColor; stroke: none; }

.books-grid-wrapper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 24px; }
@media (max-width: 768px) { .books-grid-wrapper { grid-template-columns: repeat(2, 1fr); gap: 14px; } }

.book-card-item { display: flex; flex-direction: column; text-decoration: none; transition: transform 0.25s ease, box-shadow 0.25s ease; }
.book-card-item:hover { transform: translateY(-4px); }
.book-cover-box { position: relative; width: 100%; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden; background: #cbd5e1; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); }
.book-cover-box img { width: 100%; height: 100%; object-fit: cover; display: block; }

.book-cover-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.2) 60%, transparent 100%); display: flex; flex-direction: column; justify-content: flex-end; padding: 12px; z-index: 3; }
.book-cover-title { font-family: var(--apx-font-serif, serif); font-size: 25px; font-weight: 800; color: #ffffff; line-height: 1.3; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 2px 4px rgba(0,0,0,0.8); }
.book-author-sub { font-size: 11px; font-weight: 600; color: #38bdf8; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--apx-text-mut); font-weight: 600; }

/* ─── 9. PAYWALL & GATES ─────────────────────────────────────────────────── */
.apx-av-pw-locked {
    position: relative;
    overflow: hidden;
    max-height: 220px;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 20%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0%, #000 20%, transparent 100%);
    pointer-events: none;
    user-select: none;
}

.apx-av-pw-gate {
    position: relative; margin: 32px auto 48px; max-width: 580px;
    background: var(--apx-bg, #ffffff); border: 1px solid var(--apx-border, #e5e7eb);
    border-radius: 20px; padding: 40px 32px; text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.02);
    font-family: var(--apx-font-sans, 'Source Sans 3', sans-serif);
}
[data-theme="dark"] .apx-av-pw-gate { background: #18181b; border-color: #27272a; box-shadow: 0 12px 40px rgba(0,0,0,0.5); }

.apx-av-pw-icon-wrap {
    width: 58px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px;
}
.apx-av-pw-icon-wrap.apx-av-pw-theme-login  { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.apx-av-pw-icon-wrap.apx-av-pw-theme-unlock { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.apx-av-pw-icon-wrap svg { width: 26px; height: 26px; fill: #ffffff; }

.apx-av-pw-title { font-size: 24px; font-weight: 800; color: var(--apx-text, #0f172a); margin: 0 0 10px; letter-spacing: -.02em; }
[data-theme="dark"] .apx-av-pw-title { color: #f8fafc; }

.apx-av-pw-subtitle { font-size: 15px; color: var(--apx-text-mut, #64748b); margin: 0 0 24px; }

.apx-av-pw-price-tag {
    display: inline-flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, #fef3c7, #fde68a); border: 1px solid #f59e0b;
    color: #92400e; font-size: 19px; font-weight: 800;
    padding: 10px 24px; border-radius: 50px; margin-bottom: 22px;
}
[data-theme="dark"] .apx-av-pw-price-tag { background: linear-gradient(135deg, #451a03, #78350f); border-color: #b45309; color: #fde68a; }

.apx-av-pw-balance-info { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; margin-bottom: 22px; color: var(--apx-text-mut, #64748b); }
.apx-av-pw-balance-value { font-weight: 700; color: var(--apx-text, #0f172a); }
[data-theme="dark"] .apx-av-pw-balance-value { color: #f8fafc; }
.apx-av-pw-balance-valid { color: #059669; font-weight: 600; }
.apx-av-pw-balance-invalid { color: #dc2626; font-weight: 600; }

.apx-av-pw-perks-list { list-style: none; padding: 0; margin: 0 0 26px; text-align: left; display: inline-block; }
.apx-av-pw-perks-list li { font-size: 14px; color: var(--apx-text, #334155); padding: 6px 0; display: flex; align-items: center; gap: 10px; }
[data-theme="dark"] .apx-av-pw-perks-list li { color: #cbd5e1; }
.apx-av-pw-perks-list li::before {
    content: ''; width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%; background: #10b981;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-size: 12px; background-position: center; background-repeat: no-repeat;
}

.apx-av-pw-btn-cta {
    display: block; width: 100%; padding: 15px 28px; font-size: 16px; font-weight: 700; border: none;
    border-radius: 12px; cursor: pointer; text-decoration: none; transition: all .2s ease; letter-spacing: .01em; margin-bottom: 12px;
    color: #ffffff; text-align: center; box-sizing: border-box;
}
.apx-av-pw-btn-cta.apx-av-pw-btn-login  { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.apx-av-pw-btn-cta.apx-av-pw-btn-unlock { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.apx-av-pw-btn-cta:hover { opacity: .92; transform: translateY(-1px); }
.apx-av-pw-btn-cta:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.apx-av-pw-link-topup { display: inline-block; font-size: 14px; font-weight: 600; color: #6366f1; text-decoration: none; cursor: pointer; }
.apx-av-pw-link-topup:hover { text-decoration: underline; }
.apx-av-pw-meta-note { font-size: 13px; color: var(--apx-text-mut, #64748b); margin: 0; }

.apx-av-badge-container { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; vertical-align: middle; }
.apx-av-badge-icon { display: inline-flex; vertical-align: middle; }
.apx-av-badge-verified { width: 16px; height: 16px; color: #1d9bf0; }
.apx-av-badge-journo { color: #8b5cf6; font-size: 13px; }
.apx-av-badge-author { color: #7c3aed; font-size: 12px; margin-left: 3px; }

.apx-av-paid-header-pill {
    display: inline-flex; align-items: center; gap: 5px;
    background: linear-gradient(135deg, #fef3c7, #fde68a); border: 1px solid #f59e0b; color: #92400e; font-size: 12px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px; vertical-align: middle; margin-left: 8px;
}
[data-theme="dark"] .apx-av-paid-header-pill { background: #451a03; border-color: #b45309; color: #fde68a; }

.apx-av-pw-feedback { padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; margin-bottom: 12px; display: none; }
.apx-av-pw-feedback.apx-av-pw-success { background: #d1fae5; color: #065f46; }
.apx-av-pw-feedback.apx-av-pw-error   { background: #fee2e2; color: #991b1b; }

@media (max-width: 640px) {
    .apx-av-pw-gate { padding: 28px 20px; border-radius: 16px; }
    .apx-av-pw-title { font-size: 20px; }
}

/* ─── 10. SYSTEM UI CONTROLS ─────────────────────────────────────────────── */
.progress-container { position: fixed; top: 0; left: 0; width: 100%; height: 4px; z-index: 9999; background: transparent; }
.progress-bar { height: 100%; background: var(--apx-brand); width: 0%; }
.floating-controls { position: fixed; bottom: 80px; right: 30px; z-index: 1000; }
.theme-toggle-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--apx-text); color: var(--apx-bg); border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.15); transition: transform 0.2s; }
.theme-toggle-btn:hover { transform: scale(1.08); }