/* =================================================================================
   Vertex Digest - Custom Stylesheet
   Author: Haider Shah
   Version: 1.2 (Accessibility Update)
================================================================================== */

/* --------------------------------------------------------------------------------
   1. GLOBAL STYLES & VARIABLES
---------------------------------------------------------------------------------- */
:root {
    /* UPDATED: A darker primary blue for better contrast on light backgrounds */
    --bs-primary-rgb: 0, 109, 156;
    /* NEW: A lighter blue for use on dark backgrounds (e.g., navbar, footer) */
    --bs-primary-light-rgb: 87, 180, 222;
    
    --bs-dark-rgb: 33, 37, 41;
    --bs-font-sans-serif: 'Segoe UI', system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-body-bg: #f8f9fa; /* A very light grey for the background */
}

body {
    color: #343a40;
}


/* --------------------------------------------------------------------------------
   2. TYPOGRAPHY & LINKS
---------------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
}

/* Default link color for light backgrounds */
a {
    color: #005a8d; /* Darker blue for accessibility */
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Customizing Bootstrap primary color classes */
.text-primary {
    color: rgb(var(--bs-primary-rgb)) !important;
}
.bg-primary {
    background-color: rgb(var(--bs-primary-rgb)) !important;
}

/* Specific rule for .text-primary when on a dark background */
.bg-dark .text-primary, footer .text-primary {
    color: rgb(var(--bs-primary-light-rgb)) !important;
}

/* Button color definitions */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: rgb(var(--bs-primary-rgb));
    --bs-btn-border-color: rgb(var(--bs-primary-rgb));
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #005a8d; /* Darker hover state */
    --bs-btn-hover-border-color: #005a8d;
}
.btn-outline-primary {
    --bs-btn-color: rgb(var(--bs-primary-rgb));
    --bs-btn-border-color: rgb(var(--bs-primary-rgb));
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: rgb(var(--bs-primary-rgb));
    --bs-btn-hover-border-color: rgb(var(--bs-primary-rgb));
}


/* --------------------------------------------------------------------------------
   3. NAVBAR
---------------------------------------------------------------------------------- */
.navbar-brand {
    font-size: 1.5rem;
}
.navbar .nav-link {
    transition: color 0.2s ease-in-out;
}

/* --------------------------------------------------------------------------------
   4. HOMEPAGE COMPONENTS
---------------------------------------------------------------------------------- */
.hero-section {
    background-color: #212529;
    min-height: 60vh;
    display: flex;
    align-items: center;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}

.category-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, color 0.2s ease-in-out;
    color: #333;
}
.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1) !important;
    color: rgb(var(--bs-primary-rgb));
    text-decoration: none;
}

/* --------------------------------------------------------------------------------
   5. POST CARD COMPONENT
---------------------------------------------------------------------------------- */
.post-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1) !important;
}
.post-card .card-img-top {
    height: 200px;
    object-fit: cover;
}
.post-card .card-title a:hover {
    color: rgb(var(--bs-primary-rgb));
    text-decoration: none;
}

/* --------------------------------------------------------------------------------
   6. SINGLE POST PAGE
---------------------------------------------------------------------------------- */
.post-header { text-align: center; margin-bottom: 2.5rem; }
.post-title { font-size: 2.8rem; font-weight: 700; line-height: 1.2; }
.post-meta { font-size: 0.95rem; }
.post-meta a { color: inherit; text-decoration: none; }
.post-meta a:hover { color: rgb(var(--bs-primary-rgb)); text-decoration: underline; }
.post-thumbnail { border-radius: 12px; margin-bottom: 2rem; max-height: 500px; width: 100%; object-fit: cover; }

.post-content { font-size: 1.1rem; line-height: 1.8; }
.post-content h2, .post-content h3, .post-content h4 { margin-top: 2.5rem; margin-bottom: 1.2rem; font-weight: 600; line-height: 1.3; }
.post-content p { margin-bottom: 1.5rem; }
.post-content img { max-width: 100%; height: auto; border-radius: 8px; margin: 2rem auto; display: block; }
.post-content blockquote { border-left: 4px solid rgb(var(--bs-primary-rgb)); padding: 1rem 1.5rem; margin: 2rem 0; background-color: #e9ecef; font-style: italic; }
.post-content pre { background-color: var(--bs-dark); color: #f8f9fa; padding: 1.5rem; border-radius: 8px; overflow-x: auto; font-family: 'Courier New', Courier, monospace; }
.post-content code { font-size: 0.9em; padding: 0.2em 0.4em; margin: 0; background-color: rgba(0,0,0,0.05); border-radius: 3px; }

/* Placeholder for ads */
.ad-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e9ecef;
    border: 1px dashed #ced4da;
    color: #6c757d;
    font-size: 0.9rem;
    text-transform: uppercase;
}

/* Author Bio section */
.author-bio img {
    width: 80px;
    height: 80px;
}


/* --------------------------------------------------------------------------------
   7. ACCESSIBILITY FIXES
---------------------------------------------------------------------------------- */
/* Improve contrast for muted text (e.g., post meta, card snippets) */
.text-muted {
    --bs-text-opacity: 1;
    color: #495057 !important; /* Darker grey for better readability on light backgrounds */
}

/* Improve contrast for footer links */
.footer a.text-white-50 {
    color: rgba(255, 255, 255, 0.75) !important; /* 75% opacity instead of 50% */
    text-decoration: none;
}
.footer a.text-white-50:hover {
    color: #fff !important;
    text-decoration: underline;
}
.btn-outline-secondary {
    --bs-btn-color: #495057; /* Use our darker, accessible grey */
    --bs-btn-border-color: #adb5bd;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #6c757d;
    --bs-btn-hover-border-color: #6c757d;
}
/* =================================================================================
   9. CUSTOM COMPONENTS (Affiliate Product Boxes)
================================================================================== */
.product-box {
    border: 2px solid rgb(var(--bs-primary-rgb));
    padding: 20px;
    border-radius: 10px;
    margin: 30px 0;
    background-color: #f8f9fa;
}
.product-item {
    display: flex;
    flex-wrap: wrap;       /* Allows items to wrap on small screens */
    align-items: center;
    gap: 15px 20px;        /* Row-gap and Column-gap */
    justify-content: center; /* Center items on mobile when they wrap */
}
.product-image {
    flex-shrink: 0; /* Prevents image from shrinking */
    width: 100px; /* Larger, more visible image size */
    height: 100px;
    object-fit: contain;
}
.product-info {
    flex: 1; /* Allows text to take up remaining space */
    min-width: 200px; /* Prevents text from getting too squished */
}
.product-button {
    white-space: nowrap;
    background-color: rgb(var(--bs-primary-rgb));
    color: #ffffff !important; /* IMPORTANT: Fix for unreadable text */
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.2s ease-in-out;
}
.product-button:hover {
    background-color: #005a8d;
    color: #ffffff !important;
    text-decoration: none;
}
/* On medium screens and up, align items to the side */
@media (min-width: 768px) {
    .product-item {
        flex-wrap: nowrap;
        justify-content: space-between; /* Pushes items to the edges */
    }
}