<!DOCTYPE html>
<html lang="en" itemscope itemtype="http://schema.org/WebPage">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <script>
        window.AALBC_CURRENT_PAGE = "/articles/feed";
    </script>

    <!-- OneAll Socialize Asynchronous Library -->
    <script type="text/javascript">
      var oneall_subdomain = 'aalbc';
      var oa = document.createElement('script'); oa.type = 'text/javascript'; oa.async = true;
      oa.src = 'https://' + oneall_subdomain + '.api.oneall.com/socialize/library.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(oa, s);
    </script>

    <!-- First-Party Plausible Analytics (Zero Tracking Cookies) -->
    <script async src="https://plausible.io/js/pa-3wQjZMmbX0cjh0QUNM-Il.js"></script>
    <script>
      window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};
      plausible.init();
    </script>

    <title>Article Not Found | AALBC</title>
    <meta name="description" content="The AALBC is the oldest and largest website dedicated to books by or about people of African descent.">
    <link rel="canonical" href="https://aalbc.com/articles/feed">

        
    <!-- Open Graph Social Metadata -->
    <meta property="og:site_name" content="AALBC.com">
    <meta property="og:type" content="website">
    <meta property="og:url" content="https://aalbc.com/articles/feed">
    <meta property="og:title" content="Article Not Found | AALBC">
    <meta property="og:description" content="The AALBC is the oldest and largest website dedicated to books by or about people of African descent.">
    
        <meta property="og:image" content="https://aalbc.com/images/AALBC-Logo-long-543-107.png">
    <meta property="og:image:type" content="image/png">
    <meta property="og:image:width" content="543">
    <meta property="og:image:height" content="107">

    <!-- Twitter Card Metadata -->
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:site" content="@aalbc">
    <meta name="twitter:title" content="Article Not Found | AALBC">
    <meta name="twitter:description" content="The AALBC is the oldest and largest website dedicated to books by or about people of African descent.">
    <meta name="twitter:image" content="https://aalbc.com/images/AALBC-Logo-long-543-107.png">

    <!-- Favicons -->
    <link rel="icon" type="image/x-icon" href="https://aalbc.com/favicon.ico">
    <link rel="icon" type="image/png" sizes="32x32" href="https://aalbc.com/images/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="https://aalbc.com/images/favicon-16x16.png">
    <link rel="apple-touch-icon" sizes="180x180" href="https://aalbc.com/images/apple-touch-icon.png">
    
    <!-- Progressive Web App (PWA) Config -->
    <link rel="manifest" href="/manifest.json">
    <meta name="theme-color" content="#FF5200">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="apple-mobile-web-app-title" content="AALBC">

    <!-- Fonts & Core Stylesheets -->
    <link rel="stylesheet" href="/fontawesome/css/all.min.css">
    <link rel="stylesheet" href="/css/css2026mimi.css?v=09032026">
    
    
    <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@graph": [
        {
          "@type": "WebSite",
          "@id": "https://aalbc.com/#website",
          "url": "https://aalbc.com/",
          "name": "AALBC.com",
          "description": "African American Literature Book Club - Celebrating Black Literature Since 1997",
          "publisher": { "@id": "https://aalbc.com/#organization" },
          "potentialAction": {
            "@type": "SearchAction",
            "target": {
              "@type": "EntryPoint",
              "urlTemplate": "https://aalbc.com/search/?q={search_term_string}"
            },
            "query-input": "required name=search_term_string"
          }
        },
        {
          "@type": "Organization",
          "@id": "https://aalbc.com/#organization",
          "name": "AALBC.com, LLC",
          "legalName": "AALBC.com, LLC",
          "alternateName": [
            "African American Literature Book Club",
            "DBA African American Literature Book Club",
            "AALBC"
          ],
          "url": "https://aalbc.com",
          "isni": "0000000509856750",
          "logo": {
            "@type": "ImageObject",
            "url": "https://aalbc.com/images/AALBC-Logo-long-543-107.png",
            "width": 543,
            "height": 107
          },
          "foundingDate": "1997-10-15",
          "founder": {
            "@type": "Person",
            "@id": "https://aalbc.com/#troyjohnson",
            "name": "Troy Johnson",
            "jobTitle": "Founder & Webmaster",
            "isni": "0000000530602616",
            "sameAs": [
              "https://www.wikidata.org/wiki/Q140552090",
              "https://isni.org/isni/0000000530602616"
            ]
          },
          "memberOf": [
            { "@type": "Organization", "name": "National Association of Black Bookstores" },
            { "@type": "Organization", "name": "American Booksellers Association" },
            { "@type": "Organization", "name": "Independent Book Publishers Association" },
            { "@type": "Organization", "name": "Black Book Accelerator" },
            { "@type": "Organization", "name": "The Authors Guild" }
          ],
          "sameAs": [
            "https://www.wikidata.org/wiki/Q4649891",
            "https://viaf.org/en/viaf/33172274614612452536",
            "https://isni.org/isni/0000000509856750",
            "https://www.facebook.com/aalbcfanpage/",
            "https://twitter.com/aalbc",
            "https://www.instagram.com/aalbc/",
            "https://www.youtube.com/channel/UCKiZCFRFwsYgtn8doHwRtHA",
            "https://www.linkedin.com/company/aalbc-com/",
            "https://bsky.app/profile/aalbc.bsky.social",
            "https://www.threads.net/@aalbc"
          ]
        }
      ]
    }
    </script>    </head>    <body>
        
<script>
function dismissSiteBanner() {
    var banner = document.getElementById('aalbc-site-alert-banner');
    if (banner) {
        banner.classList.add('is-hidden');
        banner.style.setProperty('display', 'none', 'important');
        sessionStorage.setItem('aalbc_site_banner_dismissed', 'true');
    }
}
</script>

<header class="site-header" style="display: block !important; width: 100% !important;">
    
    <div class="nav-container">
        <a href="https://aalbc.com/" class="nav-logo" title="AALBC.com Homepage">
            <img src="https://aalbc.com/images/AALBC-Logo-long-543-107.png" alt="AALBC Logo">
        </a>
        
        <form action="https://aalbc.com/search/" method="get" class="header-search">
            <input type="text" 
                   name="q" 
                   id="nav-search-input" 
                   placeholder="Search authors, books..." 
                   autocomplete="off" 
                   required>
            <button type="submit" aria-label="Submit Search"><i class="fa-solid fa-magnifying-glass"></i></button>
            <div id="live-search-results"></div>
        </form>

        <div class="mobile-menu-toggle" onclick="toggleMenu()" aria-label="Toggle Navigation Menu"><i class="fa-solid fa-bars"></i></div>

        <nav class="main-navigation" id="mainNav">
            <ul>
                <li><a href="https://aalbc.com/books/">Books</a></li>
                <li><a href="https://aalbc.com/authors/">Authors</a></li>
                <li><a href="https://aalbc.com/reviews/">Reviews</a></li>
                <li><a href="https://aalbc.com/events/">Events</a></li>
                <li><a href="https://aalbc.com/writers/">Resources</a></li>
                <li><a href="https://aalbc.com/tc/forum/5-culture-race-economy/">Forum</a></li>
                <li>
                    <a href="https://store.aalbc.com/cart.php" style="position: relative; display: inline-block; text-decoration: none; padding-right: 5px;" title="View Shopping Cart">
                        <i class="fa-solid fa-cart-shopping nav-cart-icon"></i>
                        <span id="bc-cart-badge" style="display: none; position: absolute; top: -8px; right: -10px; background-color: #FF5200; color: #ffffff; font-size: 10px; font-weight: bold; border-radius: 50%; padding: 2px 5px; line-height: 1; text-align: center; min-width: 14px; box-shadow: 0 2px 4px rgba(0,0,0,0.2);">0</span>
                    </a>
                </li>
                <li id="auth-section" style="margin-left: 10px; display: flex; align-items: center;">
                                            <a href="javascript:void(0)" onclick="openLoginModal()" style="font-weight: bold; color: #4a148c;"><i class="fa-solid fa-circle-user"></i> Login</a>
                                    </li>
            </ul>
        </nav>
    </div>
</header>
    
<!-- =========================================================================
     FIRST-PARTY AUTHENTICATION MODAL (Native & Secure)
     ========================================================================= -->
<div id="login-modal" class="modal-overlay" style="display:none;">
    <div class="modal-content">
        <span class="close-modal" onclick="closeLoginModal()">&times;</span>
            
        
            
        <h2 style="text-align: center; margin-bottom: 8px; color: var(--dark); font-family: var(--font-main);">Welcome to AALBC</h2>
        <p style="color: #666; font-size: 0.9rem; margin-top: 0; margin-bottom: 20px; text-align: center;">Log in or create an account with your email</p>
           
        <form id="auth-form" method="POST">
            <input type="hidden" name="redirect_to" value="/articles/feed">
            <div style="display:none;"><input type="text" name="aalbc_verify_hp" value=""></div>
                
            <div style="text-align: left; margin-bottom: 12px;">
                <label for="auth-email" style="font-weight: 600; font-size: 0.85rem; color: #333; display: block; margin-bottom: 4px;">Email Address</label>
                <input type="email" name="email" id="auth-email" class="auth-input" placeholder="you@example.com" autocomplete="username" required style="margin: 0; width: 100%;">
            </div>
                
            <div style="text-align: left; margin-bottom: 15px;">
                <label for="auth-password" style="font-weight: 600; font-size: 0.85rem; color: #333; display: block; margin-bottom: 4px;">Password</label>
                <div style="position: relative; width: 100%;">
                    <input type="password" name="password" id="auth-password" class="auth-input" placeholder="Enter your password" autocomplete="current-password" required style="margin: 0; width: 100%; padding-right: 40px;">
                    <i class="fa-solid fa-eye" id="modalTogglePassword" style="position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; color: #777;" title="Show/Hide Password"></i>
                </div>
            </div>
                
            <div style="display: flex; align-items: center; justify-content: flex-start; margin: 15px 0; gap: 10px; font-family: var(--font-main);">
                <input type="checkbox" id="human_check" name="human_check" style="width: 18px; height: 18px; cursor: pointer; accent-color: #FF5200;">
                <label for="human_check" style="font-size: 0.9rem; color: #555; cursor: pointer; user-select: none;">
                    I am a human visitor
                </label>
            </div>
                
            <div class="auth-button-group" style="display: flex; gap: 10px; margin-top: 20px;">
                <button type="button" onclick="handleAuth('login')" class="btn-main" style="flex: 1; background: #FF5200 !important;">LOG IN</button>
                <button type="button" onclick="handleAuth('signup')" class="btn-main" style="flex: 1; background: #333 !important;">SIGN UP</button>
            </div>
    
            <div style="display: flex; justify-content: center; gap: 12px; margin-top: 20px; font-size: 0.85rem; flex-wrap: wrap;">
                <a href="javascript:void(0)" onclick="closeLoginModal(); openForgotModal(); return false;" style="color: #555; text-decoration: underline;">Forgot password?</a>
                <span style="color:#ccc;">|</span>
                <a href="javascript:void(0)" onclick="closeLoginModal(); openResendModal(); return false;" style="color: #FF5200; font-weight: bold; text-decoration: underline;">Resend verification email</a>
            </div>
        </form>
    </div>
</div>

<!-- =========================================================================
     RESEND VERIFICATION MODAL
     ========================================================================= -->
<div id="resendVerificationModal" class="resend-modal-overlay" style="display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.6); z-index:99999; align-items:center; justify-content:center;">
    <div class="resend-modal-box" style="background:#fff; padding:30px; border-radius:12px; max-width:420px; width:90%; position:relative; text-align:left; box-shadow:0 10px 25px rgba(0,0,0,0.2);">
        <span onclick="closeResendModal();" style="position: absolute; right: 15px; top: 10px; cursor: pointer; font-size: 1.8rem; color: #888;">&times;</span>
        <h2 style="margin-bottom: 10px; font-size: 1.4rem; color:#333; font-family: var(--font-main);"><i class="fa-solid fa-paper-plane" style="color:#FF5200; margin-right:6px;"></i> Resend Verification Link</h2>
        <p style="color: #666; font-size: 0.9rem; margin-bottom: 20px; line-height: 1.5;">Enter the email address you used during signup. We will send a fresh verification link to activate your account.</p>
        
        <form action="/process_resend_verification.php" method="POST">
            <label style="font-weight: bold; display: block; margin-bottom: 8px; color:#333; font-size: 0.85rem;">Email Address</label>
            <input type="email" name="email" id="resend-email-input" placeholder="you@example.com" required style="width: 100%; padding: 12px; margin-bottom: 20px; border: 1px solid #ccc; border-radius: var(--radius); box-sizing: border-box; font-size: 0.95rem;">
            <button type="submit" class="btn-main" style="width: 100%; padding: 12px; font-size: 0.95rem !important; border: none; cursor: pointer; font-weight: bold; background: #FF5200 !important;">Send Verification Link</button>
        </form>
    </div>
</div>
    
<script type="text/javascript">
function toggleMenu() { document.getElementById('mainNav').classList.toggle('active'); }
function toggleDropdown() {
    const dropdown = document.getElementById('user-dropdown');
    dropdown.style.display = (dropdown.style.display === 'block') ? 'none' : 'block';
}
function openLoginModal() { 
    var modal = document.getElementById('login-modal');
    if (modal) { modal.style.display = 'flex'; }
}
function closeLoginModal() { 
    var modal = document.getElementById('login-modal');
    if (modal) { modal.style.display = 'none'; }
}
function openResendModal() { 
    var authEmail = document.getElementById('auth-email');
    var resendEmail = document.getElementById('resend-email-input');
    if (authEmail && resendEmail && authEmail.value.trim() !== '') {
        resendEmail.value = authEmail.value.trim();
    }
    var modal = document.getElementById('resendVerificationModal');
    if (modal) { modal.style.display = 'flex'; }
}
function closeResendModal() { 
    var modal = document.getElementById('resendVerificationModal');
    if (modal) { modal.style.display = 'none'; }
}
function handleLogout() { 
    if (confirm("Are you sure you want to log out?")) { 
        window.location.href = '/logout.php'; 
    } 
}

// Password Visibility Eye Toggle
document.getElementById('modalTogglePassword')?.addEventListener('click', function() {
    const pwd = document.getElementById('auth-password');
    if (pwd) {
        const type = pwd.getAttribute('type') === 'password' ? 'text' : 'password';
        pwd.setAttribute('type', type);
        this.classList.toggle('fa-eye');
        this.classList.toggle('fa-eye-slash');
    }
});

// Close Dropdown & Modal on Background Click
window.addEventListener('click', function(e) {
    const dropdown = document.getElementById('user-dropdown');
    const menu = document.getElementById('user-nav-menu');
    const resendModal = document.getElementById('resendVerificationModal');
    const loginModal = document.getElementById('login-modal');
    
    if (dropdown && menu && !menu.contains(e.target)) { dropdown.style.display = 'none'; }
    if (e.target === resendModal) { resendModal.style.display = 'none'; }
    if (e.target === loginModal) { loginModal.style.display = 'none'; }
});

// Form Submission Dispatcher
function handleAuth(mode) {
    const form = document.getElementById('auth-form');
    const isHuman = document.getElementById('human_check').checked;
    if (!isHuman) {
        alert("Please check the 'I am a human' box to continue.");
        return;
    }
    const email = document.getElementById('auth-email').value.trim();
    const pass = document.getElementById('auth-password').value;
    if (!email || !pass) {
        alert("Please enter both email and password.");
        return;
    }
    form.action = (mode === 'signup') ? '/register_handler.php' : '/login_handler_email.php';
    form.submit();
}
</script>        <div class="container" style="text-align:center; padding:50px 20px;">
            <h1>Article Not Found</h1>
            <p>We couldn’t find the article you were looking for.</p>
            <a href="https://aalbc.com/authors/" class="btn-main">Browse Authors</a>
        </div>
        <footer class="site-footer" id="colophon">
    <!-- Trust & Feature Value Highlights -->
    <div class="footer-features">
        <a href="https://aalbc.com/Bookstore-Policies-and-Procedures" class="footer-feature-item" title="Free shipping on orders over $75">
            <i class="fa-solid fa-truck-fast"></i>
            <span>Free shipping on orders over $75</span>
        </a>
        <a href="https://aalbc.com/Bookstore-Policies-and-Procedures" class="footer-feature-item" title="Sales tax only on Florida orders">
            <i class="fa-solid fa-receipt"></i>
            <span>Sales tax only on Florida orders</span>
        </a>
        <a href="https://aalbc.com/Bookstore-Policies-and-Procedures" class="footer-feature-item" title="Bulk discounts up to 20%">
            <i class="fa-solid fa-tags"></i>
            <span>Bulk discounts up to 20%</span>
        </a>
    </div>

    <div class="footer-grid">
        <div class="footer-col">
            <h4>Company</h4>
            <ul>
                <li><a href="https://aalbc.com/about-us">About Us</a></li>
                <li><a href="https://aalbc.com/AALBC-Privacy-Policy">Privacy Policy</a></li>
                <li><a href="https://aalbc.com/aalbc-ai-policy">AI Policy</a></li>
                <li><a href="https://aalbc.com/Bookstore-Policies-and-Procedures">Store Policies</a></li>
            </ul>
        </div>
        <div class="footer-col">
            <h4>Support & Services</h4>
            <ul>
                <li><a href="https://aalbc.com/enewsletter/">Subscribe to Newsletter</a></li>
                <li><a href="https://aalbc.com/advertise.php">Advertise with Us</a></li>
                <li><a href="https://aalbc.com/faq/">FAQ</a></li>
                <li><a href="mailto:troy@aalbc.com"><i class="fa-solid fa-envelope"></i> troy@aalbc.com</a></li>
                <li><a href="tel:347-692-2522"><i class="fa-solid fa-phone"></i> 347-69-AALBC</a></li>
            </ul>
        </div>
        <div class="footer-col">
            <h4>Connect</h4>
            <div class="footer-social-icons">
                <!-- Main Social Channels -->
                <a href="https://www.instagram.com/aalbc/" target="_blank" rel="noopener" class="social-btn" title="Instagram"><i class="fa-brands fa-instagram"></i></a>
                <a href="https://www.youtube.com/channel/UCKiZCFRFwsYgtn8doHwRtHA?sub_confirmation=1" target="_blank" rel="noopener" class="social-btn" title="YouTube"><i class="fa-brands fa-youtube"></i></a>    
                <a href="https://www.facebook.com/aalbcfanpage/" target="_blank" rel="noopener" class="social-btn" title="Facebook"><i class="fa-brands fa-facebook-f"></i></a>
                <a href="https://twitter.com/aalbc" target="_blank" rel="noopener" class="social-btn" title="X (Twitter)"><i class="fa-brands fa-x-twitter"></i></a>
                <a href="https://www.threads.net/@aalbc" target="_blank" rel="noopener" class="social-btn" title="Threads"><i class="fa-brands fa-threads"></i></a>
                <a href="https://aalbc.bsky.social/" target="_blank" rel="noopener" class="social-btn" title="Share on Bluesky"><i class="fa-brands fa-bluesky"></i></a>
                <a href="https://www.tiktok.com/@aalbccom" target="_blank" rel="noopener" class="social-btn" title="TikTok"><i class="fa-brands fa-tiktok"></i></a>
                <!-- Professional & Niche -->
                <a href="https://www.linkedin.com/company/aalbc-com/" target="_blank" rel="noopener" class="social-btn" title="LinkedIn"><i class="fa-brands fa-linkedin-in"></i></a>
                <a href="https://pinterest.com/aalbc/" target="_blank" rel="noopener" class="social-btn" title="Pinterest"><i class="fa-brands fa-pinterest-p"></i></a>
                <a href="https://www.flickr.com/people/aalbc/" target="_blank" rel="noopener" class="social-btn" title="Flickr"><i class="fa-brands fa-flickr"></i></a>
            </div>
        </div>
    </div>
    
    <div class="footer-bottom">
        &copy; 1997&ndash;2026, All Rights Reserved.<br>
        <a href="https://aalbc.com">African American Literature Book Club</a>, AALBC.com, LLC.
    </div>
</footer>

<div id="su-footer-links" style="text-align: center;"></div>


<!-- ==========================================================
     GLOBAL MODALS (Forgot Password & Access Restriction)
     ========================================================== -->
<div id="forgotPasswordModal" class="forgot-modal-overlay">
    <div class="forgot-modal-box">
        <span onclick="closeForgotModal();" style="position: absolute; right: 15px; top: 10px; cursor: pointer; font-size: 1.8rem; color: #888;">&times;</span>
        <h2 style="margin-bottom: 10px; font-size: 1.5rem; color:#333;"><i class="fa-solid fa-key" style="color:#FF5200; margin-right:6px;"></i> Reset Password</h2>
        <p style="color: #666; font-size: 0.95rem; margin-bottom: 20px; line-height: 1.5;">Enter your email address below and we will send you a secure link to reset your password.</p>
        
        <form action="/process_forgot_password.php" method="POST">
            <label style="font-weight: bold; display: block; margin-bottom: 8px; color:#333; font-size: 0.9rem;">Email Address</label>
            <input type="email" name="email" placeholder="you@example.com" required style="width: 100%; padding: 12px; margin-bottom: 20px; border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box; font-size: 1rem;">
            <button type="submit" class="btn-main" style="width: 100%; background: #FF5200 !important; border: none; cursor: pointer; padding: 14px;">Send Reset Link</button>
        </form>
    </div>
</div>

<div id="unauthorizedModal" class="modal-overlay" style="display:none;">
    <div class="modal-content">
        <span onclick="document.getElementById('unauthorizedModal').style.display='none'" class="close-modal">&times;</span>
        
        <i class="fa-solid fa-circle-exclamation" style="font-size: 3rem; color: #d32f2f; margin-bottom: 15px;"></i>
        <h2 style="margin-top:0; color:#333;">Access Restricted</h2>
        
        <p id="unauthMessage" style="color:#666; font-size:0.95rem; margin-bottom:20px; line-height: 1.5;">
            Access to this page is restricted. Please log in with an authorized account.
        </p>
        
        <div style="display: flex; gap: 10px; justify-content: center;">
            <button type="button" onclick="document.getElementById('unauthorizedModal').style.display='none';" class="btn-main" style="background:#eee !important; color:#333 !important;">CLOSE</button>
            <button type="button" id="unauthLoginBtn" onclick="document.getElementById('unauthorizedModal').style.display='none'; openLoginModal();" class="btn-main" style="background:#4a148c !important;">LOG IN</button>
        </div>
    </div>
</div>

<!-- ==========================================================
     CORE JAVASCRIPT ENGINES
     ========================================================== -->
<script>
/**
 * 1. Smooth Scroll and Auto-Open Details (URL Hash Anchors)
 */
document.addEventListener("DOMContentLoaded", function() {
    if (window.location.hash) {
        const targetId = window.location.hash;
        try {
            const targetElement = document.querySelector(targetId);
            if (targetElement) {
                const parentDetails = targetElement.closest('details');
                if (parentDetails) { parentDetails.open = true; }
                setTimeout(() => {
                    targetElement.scrollIntoView({behavior: "smooth", block: "start"});
                }, 200);
            }
        } catch (e) { console.warn("Hash anchor routing error:", e); }
    }
});

/**
 * 2. Toggle Favorite Book (Bookshelf Sync)
 */
function toggleFavorite(btn, isbn) {
    if (!isbn) {
        alert("System Error: ISBN is missing.");
        return;
    }

    const textSpan = btn.querySelector('.btn-text');
    const currentText = textSpan ? textSpan.innerText.trim() : '';
    const icon = btn.querySelector('i, svg');
    
    let isAdding = true;
    if (btn.classList.contains('active')) isAdding = false;
    else if (currentText && !currentText.toLowerCase().includes('save to')) isAdding = false;

    const action = isAdding ? 'add' : 'remove';

    btn.classList.toggle('active');
    if (icon) {
        icon.classList.toggle('fa-solid');
        icon.classList.toggle('fa-regular');
    }
    if (textSpan) textSpan.innerText = 'Saving...';
    
    btn.style.pointerEvents = 'none'; 

    const formData = new FormData();
    formData.append('isbn', isbn);       
    formData.append('isbn13', isbn);     
    formData.append('action', action);

    fetch('/toggle_favorite', {
        method: 'POST',
        headers: { 'X-Requested-With': 'XMLHttpRequest' },
        body: formData
    })
    .then(async response => {
        if (response.redirected && response.url.includes('signup')) return { status: 'unauthorized' };
        const text = await response.text();
        if (text.trim().startsWith('<')) return { status: 'unauthorized' };
        return JSON.parse(text); 
    })
    .then(data => {
        btn.style.pointerEvents = 'auto';

        if (data.status === 'unauthorized') {
            btn.classList.toggle('active');
            if (icon) { icon.classList.toggle('fa-solid'); icon.classList.toggle('fa-regular'); }
            if (textSpan) textSpan.innerText = currentText; 
            window.location.href = '/signup.php?auth_required=1&redirect_to=' + encodeURIComponent(window.location.pathname);
            return;
        }

        if (data.success) {
            if (textSpan) textSpan.innerText = isAdding ? 'Saved to Bookshelf' : 'Save to Bookshelf';
            if (btn.hasAttribute('title')) {
                btn.title = isAdding ? "Remove from Bookshelf" : "Add to Your Bookshelf";
            }
        } else {
            btn.classList.toggle('active');
            if (icon) { icon.classList.toggle('fa-solid'); icon.classList.toggle('fa-regular'); }
            if (textSpan) textSpan.innerText = currentText;
            alert("Error: " + (data.message || "Could not update Bookshelf."));
        }
    })
    .catch(err => {
        btn.style.pointerEvents = 'auto';
        btn.classList.toggle('active');
        if (icon) { icon.classList.toggle('fa-solid'); icon.classList.toggle('fa-regular'); }
        if (textSpan) textSpan.innerText = currentText; 
        console.error("Favorite toggle failed:", err);
    });
}

/**
 * 3. Toggle Follow Author
 */
function toggleFollowAuthor(btn, aid) {
    if (!btn || !aid) return;
    
    const textSpan = btn.querySelector('.btn-text');
    const currentText = textSpan ? textSpan.innerText.trim() : '';
    
    const isAdding = currentText.toLowerCase().includes('follow author');
    const action = isAdding ? 'follow' : 'unfollow';

    if (textSpan) textSpan.innerText = 'Saving...';
    btn.style.opacity = '0.7';
    btn.style.pointerEvents = 'none';

    const formData = new FormData();
    formData.append('author_id', aid);
    formData.append('action', action);

    fetch('/toggle_follow', {
        method: 'POST',
        headers: { 'X-Requested-With': 'XMLHttpRequest' },
        body: formData
    })
    .then(async response => {
        if (response.redirected && response.url.includes('signup')) return { status: 'unauthorized' };
        const text = await response.text();
        if (text.trim().startsWith('<')) return { status: 'unauthorized' };
        return JSON.parse(text);
    })
    .then(data => {
        btn.style.opacity = '1';
        btn.style.pointerEvents = 'auto';

        if (data.status === 'unauthorized') {
            if (textSpan) textSpan.innerText = currentText;
            window.location.href = '/signup.php?auth_required=1&redirect_to=' + encodeURIComponent(window.location.pathname);
            return;
        }

        if (data.success) {
            if (textSpan) textSpan.innerText = isAdding ? 'Following' : 'Follow Author';
            const icon = btn.querySelector('i, svg');
            if (icon) {
                if (icon.tagName.toLowerCase() === 'svg') {
                    icon.setAttribute('data-prefix', isAdding ? 'fas' : 'far');
                }
                icon.classList.remove(isAdding ? 'fa-regular' : 'fa-solid');
                icon.classList.add(isAdding ? 'fa-solid' : 'fa-regular');
                icon.style.color = isAdding ? '#4a148c' : '#777';
                btn.style.borderColor = isAdding ? '#4a148c' : '#ddd';
            }
        } else {
            if (textSpan) textSpan.innerText = currentText;
            alert("Error: " + (data.message || "Could not save author follow status."));
        }
    })
    .catch(err => {
        btn.style.opacity = '1';
        btn.style.pointerEvents = 'auto';
        if (textSpan) textSpan.innerText = currentText;
        console.error("Follow Error:", err);
    });
}

/**
 * 4. High-Accuracy Impression Tracker
 */
document.addEventListener('DOMContentLoaded', function() {
    const adTracker = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.dataset.timer = setTimeout(() => {
                    const adId = entry.target.getAttribute('data-ad-id');
                    if (navigator.sendBeacon) {
                        const formData = new FormData();
                        formData.append('id', adId);
                        navigator.sendBeacon('/data/collect_impression.php', formData);
                    } else {
                        fetch(`/data/collect_impression.php?id=${adId}`, { method: 'POST', keepalive: true });
                    }
                    adTracker.unobserve(entry.target);
                }, 1000); 
            } else {
                clearTimeout(entry.target.dataset.timer);
            }
        });
    }, { threshold: 0.5 });

    document.querySelectorAll('.track-ad-item').forEach(el => adTracker.observe(el));
});

/**
 * 5. Live Search Dropdown Handler
 */
document.addEventListener("DOMContentLoaded", function() {
    const searchInput = document.getElementById('nav-search-input');
    const resultsBox = document.getElementById('live-search-results');

    if (searchInput && resultsBox) {
        searchInput.addEventListener('input', function() {
            const q = this.value.trim();
            if (q.length < 3) {
                resultsBox.style.display = 'none';
                return;
            }

            fetch(`/search/live_search.php?q=${encodeURIComponent(q)}`)
                .then(response => response.text())
                .then(data => {
                    if (data.trim().length > 0) {
                        resultsBox.innerHTML = data;
                        resultsBox.style.display = 'block';
                    } else {
                        resultsBox.style.display = 'none';
                    }
                })
                .catch(err => console.error("Live search request failed:", err));
        });

        window.addEventListener('click', function(e) {
            if (!searchInput.contains(e.target) && !resultsBox.contains(e.target)) {
                resultsBox.style.display = 'none';
            }
        });
    }
});

/**
 * 6. Modal Functions (Forgot Password & Unauthorized Alert)
 */
function openForgotModal() { document.getElementById('forgotPasswordModal').style.display = 'flex'; }
function closeForgotModal() { document.getElementById('forgotPasswordModal').style.display = 'none'; }

window.addEventListener('click', function(event) {
    const forgotModal = document.getElementById('forgotPasswordModal');
    if (event.target === forgotModal) { forgotModal.style.display = "none"; }
});

document.addEventListener("DOMContentLoaded", function() {
    const urlParams = new URLSearchParams(window.location.search);
    const errorType = urlParams.get('error');
    
    if (errorType === 'unauthorized' || errorType === 'unauthorized_role' || errorType === 'unauthorized_access' || errorType === 'banned') {
        const modal = document.getElementById('unauthorizedModal');
        const msgText = document.getElementById('unauthMessage');
        const loginBtn = document.getElementById('unauthLoginBtn');
        
        if (errorType === 'unauthorized_role' || errorType === 'unauthorized_access') {
            msgText.innerHTML = "<strong>Access Denied.</strong><br>Your current account does not have permission to view this page.";
            if (loginBtn) loginBtn.style.display = 'none';
        } else {
            msgText.innerHTML = "Access to this page is restricted. Please log in to continue.";
            if (loginBtn) loginBtn.style.display = 'inline-block';
            
            const redirectTo = urlParams.get('redirect_to');
            if (redirectTo) {
                const formRedirect = document.querySelector('input[name="redirect_to"]');
                if (formRedirect) { formRedirect.value = redirectTo; }
            }
        }

        modal.style.display = 'flex';
        const cleanUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
        window.history.replaceState({path: cleanUrl}, '', cleanUrl);
    }
});

/**
 * 7. Universal BigCommerce Cart Badge Listener
 */
document.addEventListener("DOMContentLoaded", function() {
    let match = document.cookie.match(new RegExp('(^| )universal_cart_qty=([^;]+)'));
    if (match) {
        let cartQty = parseInt(match[2]);
        if (cartQty > 0) {
            const badge = document.getElementById('bc-cart-badge');
            if (badge) {
                badge.innerText = cartQty;
                badge.style.display = 'inline-block';
            }
        }
    }
});

/**
 * 8. First-Party Interaction Analytics Engine
 */
document.addEventListener('DOMContentLoaded', () => {
    document.addEventListener('click', (event) => {
        const link = event.target.closest('a');
        if (!link || !link.href || link.href.startsWith('javascript:') || link.href.startsWith('#')) return;

        try {
            const destination = new URL(link.href);
            const hostname = destination.hostname.toLowerCase();
            const pathname = destination.pathname.toLowerCase();
            const searchParams = destination.searchParams;
            
            let eventType = 'standard_link';
            let clickContext = '';
            let targetUri = pathname + destination.search;

            if (pathname.includes('social-share-track.php') && searchParams.has('p')) {
                eventType = 'social_click';
                clickContext = searchParams.get('p');
                if (searchParams.has('target')) {
                    targetUri = decodeURIComponent(searchParams.get('target'));
                }
            }
            else if (link.classList.contains('buybutton') || link.classList.contains('btn-main') || link.innerText.toLowerCase().includes('buy')) {
                eventType = 'affiliate_click';
                const isbnContext = window.location.pathname.match(/\/books\/([0-9]{10,13})/) || window.location.search.match(/isbn13=([0-9]{10,13})/);
                const prefix = isbnContext ? '[' + isbnContext[1] + '] ' : '';
                clickContext = prefix + 'Buy Button: ' + hostname.replace('www.', '');
            }
            else if (['amazon.com', 'amzn.to', 'libro.fm', 'bookshop.org', 'barnesandnoble.com', 'bn.com'].some(domain => hostname.includes(domain))) {
                eventType = 'affiliate_click';
                clickContext = hostname.replace('www.', '');
            }
            else if (['facebook.com', 'instagram.com', 'twitter.com', 'x.com', 'threads.net', 'bsky.social', 'tiktok.com'].some(domain => hostname.includes(domain))) {
                eventType = 'social_click';
                clickContext = hostname.replace('www.', '');
            }
            else if (hostname.includes('aalbc.com')) {
                const isbnMatch = pathname.match(/\/books\/([0-9]{10,13})/) || link.href.match(/isbn13=([0-9]{10,13})/);
                if (isbnMatch) {
                    eventType = 'book_click';
                    clickContext = isbnMatch[1];
                } 
                else if (pathname.includes('/authors/')) {
                    if (pathname.includes('author.php')) {
                        clickContext = searchParams.get('author_name') || '';
                    } else {
                        const paths = pathname.split('/').filter(Boolean);
                        if (paths.length === 2 && paths[1] !== 'list' && paths[1] !== 'bestselling-authors') {
                            clickContext = decodeURIComponent(paths[1]).replace(/-/g, ' ');
                        }
                    }
                    if (clickContext) {
                        eventType = 'author_click';
                    }
                }
            }

            if (eventType !== 'standard_link') {
                const payload = new FormData();
                payload.append('event_type', eventType);
                payload.append('current_uri', window.location.pathname);
                payload.append('target_uri', targetUri);
                payload.append('click_context', clickContext);

                if (navigator.sendBeacon) {
                    navigator.sendBeacon('/api/log_internal_click', payload);
                } else {
                    fetch('/api/log_internal_click', { method: 'POST', body: payload, keepalive: true });
                }
            }

        } catch (e) {
            console.warn('Analytics tracking bypassed:', e);
        }
    });
});

/**
 * 9. PWA Service Worker Registration
 */
if ('serviceWorker' in navigator) {
    window.addEventListener('load', function() {
        navigator.serviceWorker.register('/service-worker.js')
            .then(function(registration) {
                console.log('AALBC PWA ServiceWorker active. Scope:', registration.scope);
            })
            .catch(function(error) {
                console.error('AALBC PWA ServiceWorker failed:', error);
            });
    });
}

/**
 * 10. Self-Hosted & Facade Video Loaders
 */
function loadSelfHostedVideo(container, videoSrc) {
    container.innerHTML = `
        <video controls autoplay playsinline style="width:100%; height:100%; object-fit:contain; background:#000;">
            <source src="${videoSrc}" type="video/mp4">
            Your browser does not support HTML5 video.
        </video>
    `;
}

function loadYouTubeVideo(container, videoId) {
    container.innerHTML = `
        <iframe src="https://www.youtube-nocookie.com/embed/${videoId}?autoplay=1&rel=0" 
                title="AALBC Video" 
                allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" 
                allowfullscreen>
        </iframe>
    `;
}
</script>

    </body>
    </html>
    