/*
Theme Name: WorthIt Finds
Theme URI: https://worthitfinds.net
Author: WorthIt Finds
Author URI: https://worthitfinds.net
Description: Custom affiliate review theme for WorthIt Finds. Clean card grid layout with star ratings and Amazon Buy It Now buttons on every card.
Version: 1.0.0
Requires at least: 5.8
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: worthitfinds
Tags: affiliate, amazon, reviews, custom-header, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 1rem;
    line-height: 1.65;
    color: #333333;
    background-color: #f5f5f5;
}

a {
    color: #46b454;
    text-decoration: none;
}

a:hover {
    color: #3a9947;
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =============================================
   HEADER
   ============================================= */
#site-header {
    background-color: #1a1a2e;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.site-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.site-logo img {
    height: 45px;
    width: auto;
}

.site-title-fallback {
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* =============================================
   NAVIGATION
   ============================================= */
#site-nav {
    display: flex;
    align-items: center;
}

#site-nav ul {
    list-style: none;
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 0;
}

#site-nav ul li a {
    color: #e0e0e0;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    white-space: nowrap;
    display: block;
}

#site-nav ul li a:hover,
#site-nav ul li.current-menu-item > a,
#site-nav ul li.current-cat > a {
    background-color: #46b454;
    color: #ffffff;
}

/* Hamburger - mobile */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: all 0.3s;
}

/* =============================================
   MAIN CONTENT AREA
   ============================================= */
#main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

/* =============================================
   PAGE / ARCHIVE HEADER
   ============================================= */
.page-header {
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid #46b454;
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a2e;
}

.page-header .category-description {
    margin-top: 8px;
    color: #666;
    font-size: 0.95rem;
}

/* =============================================
   POST CARD GRID
   ============================================= */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
}

.post-card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.13);
}

/* Card thumbnail */
.card-thumbnail {
    display: block;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #f0f0f0;
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-card:hover .card-thumbnail img {
    transform: scale(1.04);
}

.card-thumbnail.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: linear-gradient(135deg, #1a1a2e 0%, #46b454 100%);
}

.card-thumbnail.no-image span {
    font-size: 3rem;
}

/* Card body */
.card-body {
    padding: 18px 20px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-category {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #46b454;
    margin-bottom: 6px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
}

.card-title a {
    color: #1a1a2e;
    text-decoration: none;
    transition: color 0.2s;
}

.card-title a:hover {
    color: #46b454;
}

/* Card excerpt — this contains the stars + Buy It Now button */
.card-excerpt {
    flex: 1;
    font-size: 0.88rem;
    color: #555;
    line-height: 1.55;
}

/* Override WordPress auto-added paragraph margins in excerpt */
.card-excerpt p {
    margin: 6px 0;
}

/* Stars block from excerpt */
.card-excerpt > div[style*="background:#FFF8F5"],
.card-excerpt > div[style*="background: #FFF8F5"] {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

/* Buy It Now button from excerpt — ensure it looks right */
.card-excerpt a[href*="amazon.com"] {
    display: inline-block !important;
    background: #FF9900 !important;
    color: #111 !important;
    padding: 8px 18px !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    margin-top: 4px !important;
    box-shadow: 0 2px 6px rgba(255,153,0,0.35) !important;
    transition: background 0.2s !important;
    white-space: nowrap;
}

.card-excerpt a[href*="amazon.com"]:hover {
    background: #e68900 !important;
    text-decoration: none !important;
}

/* Card meta */
.card-meta {
    font-size: 0.75rem;
    color: #999;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-meta time {
    color: #999;
}

/* Read more link */
.card-read-more {
    margin-top: 10px;
}

.card-read-more a {
    font-size: 0.82rem;
    color: #46b454;
    font-weight: 600;
    text-decoration: none;
}

.card-read-more a:hover {
    text-decoration: underline;
}

/* =============================================
   PAGINATION
   ============================================= */
.archive-pagination {
    margin-top: 48px;
    text-align: center;
}

.archive-pagination .nav-links {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.archive-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #ffffff;
    color: #333;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    text-decoration: none;
    transition: all 0.2s;
}

.archive-pagination .page-numbers:hover {
    background: #46b454;
    color: #ffffff;
}

.archive-pagination .page-numbers.current {
    background: #46b454;
    color: #ffffff;
}

.archive-pagination .page-numbers.dots {
    background: none;
    box-shadow: none;
    color: #999;
}

/* =============================================
   SINGLE POST PAGE
   ============================================= */
.single-post-wrap {
    max-width: 820px;
    margin: 0 auto;
}

.single-post-header {
    margin-bottom: 24px;
}

.single-post-categories {
    margin-bottom: 10px;
}

.single-post-categories a {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #46b454;
    text-decoration: none;
}

.single-post-categories a:hover {
    text-decoration: underline;
}

.single-post-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.3;
    color: #1a1a2e;
    margin-bottom: 12px;
}

.single-post-meta {
    font-size: 0.82rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 10px;
}

.single-post-featured-image {
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 28px;
    max-height: 480px;
}

.single-post-featured-image img {
    width: 100%;
    object-fit: cover;
}

.single-post-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #333;
}

.single-post-content h1,
.single-post-content h2,
.single-post-content h3,
.single-post-content h4,
.single-post-content h5,
.single-post-content h6 {
    color: #1a1a2e;
    margin: 1.8em 0 0.6em;
    font-weight: 700;
    line-height: 1.3;
}

.single-post-content h2 { font-size: 1.5rem; }
.single-post-content h3 { font-size: 1.25rem; }
.single-post-content h4 { font-size: 1.1rem; }

.single-post-content p {
    margin-bottom: 1.2em;
}

.single-post-content ul,
.single-post-content ol {
    margin: 0 0 1.2em 1.5em;
}

.single-post-content li {
    margin-bottom: 0.4em;
}

.single-post-content blockquote {
    border-left: 4px solid #46b454;
    padding: 12px 20px;
    margin: 1.5em 0;
    background: #f9f9f9;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #555;
}

.single-post-content img {
    border-radius: 8px;
    max-width: 100%;
}

.single-post-content a {
    color: #46b454;
}

.single-post-content a:hover {
    text-decoration: underline;
}

/* Amazon button in single post — preserve inline styles but ensure visibility */
.single-post-content a[href*="amazon.com"][style*="background:#FF9900"],
.single-post-content a[href*="amazon.com"][style*="background: #FF9900"] {
    display: inline-block;
}

/* Post navigation */
.single-post-nav {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.single-post-nav a {
    font-size: 0.88rem;
    color: #46b454;
    font-weight: 600;
    text-decoration: none;
    max-width: 45%;
}

.single-post-nav a:hover {
    text-decoration: underline;
}

.single-post-nav .nav-prev { text-align: left; }
.single-post-nav .nav-next { text-align: right; }
.single-post-nav .nav-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    font-weight: 400;
    margin-bottom: 4px;
}

/* Back to category link */
.back-to-category {
    margin-bottom: 20px;
}

.back-to-category a {
    font-size: 0.85rem;
    color: #666;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.back-to-category a:hover {
    color: #46b454;
}

/* =============================================
   FOOTER
   ============================================= */
#site-footer {
    background-color: #1a1a2e;
    color: #c0c0c0;
    padding: 48px 20px 24px;
    margin-top: auto;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-top {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 36px;
}

.footer-logo img {
    height: 40px;
    width: auto;
    margin-bottom: 12px;
    opacity: 0.9;
}

.footer-logo .site-tagline {
    font-size: 0.85rem;
    color: #888;
    line-height: 1.5;
}

.footer-col h4 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffffff;
    margin-bottom: 14px;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col ul li a {
    color: #888;
    font-size: 0.88rem;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-col ul li a:hover {
    color: #46b454;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 0.78rem;
    color: #666;
    line-height: 1.6;
}

.footer-bottom a {
    color: #888;
}

.footer-bottom a:hover {
    color: #46b454;
}

.affiliate-disclosure {
    margin-top: 10px;
    font-size: 0.74rem;
    color: #555;
}

/* =============================================
   NO POSTS FOUND
   ============================================= */
.no-posts-found {
    text-align: center;
    padding: 80px 20px;
    color: #888;
}

.no-posts-found h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 12px;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 900px) {
    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 20px;
    }

    .footer-top {
        grid-template-columns: 1fr 1fr;
        gap: 28px;
    }
}

@media (max-width: 650px) {
    .header-inner {
        height: 60px;
    }

    .nav-toggle {
        display: flex;
    }

    #site-nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: #1a1a2e;
        padding: 16px 20px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }

    #site-nav.nav-open {
        display: flex;
    }

    #site-nav ul {
        flex-direction: column;
        width: 100%;
        gap: 2px;
    }

    #site-nav ul li a {
        padding: 10px 16px;
        font-size: 0.95rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .single-post-title {
        font-size: 1.5rem;
    }

    .footer-top {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}
