/*
Theme Name: PickThis Pro
Author: PickThis
Description: A mobile-first, performance-optimized theme with universal drawer navigation and sticky logic.
Version: 2.1
*/

:root {
    /* -- Customizer Variables (Defaults) -- */
    --color-primary: #0096D6; /* HP Blue */
    --color-accent: #2D3436;  /* Slate */
    --color-text: #2d3748;
    --color-text-light: #718096;
    --color-bg: #f7fafc;
    --color-white: #ffffff;
    --color-border: #e2e8f0;
    --color-card-bg: #ffffff;
    --color-header-bg: rgba(255, 255, 255, 0.95);
    
    /* -- Layout -- */
    --container-width: 1200px;
    --header-height: 70px;
    --drawer-width: 320px;
    
    /* -- Typography -- */
    --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --font-heading: var(--font-base);
}

/* --- DARK MODE VARIABLES --- */
[data-theme="dark"] {
    --color-bg: #1a202c;         /* Dark Navy */
    --color-text: #f7fafc;       /* Off White */
    --color-text-light: #a0aec0; /* Grey */
    --color-border: #2d3748;     /* Darker Border */
    --color-white: #2d3748;      /* Cards become dark grey */
    --color-accent: #e2e8f0;     /* Accent becomes light */
    --color-card-bg: #2d3748;
    --color-header-bg: rgba(26, 32, 44, 0.95);
}

/* ------------------------------------------------------------------------- *
 * 1. Reset & Global
 * ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-base);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-accent); /* In dark mode, this flips to light grey */
    margin-top: 0;
    line-height: 1.3;
}

a { color: var(--color-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-accent); }
img { max-width: 100%; height: auto; display: block; }

/* ------------------------------------------------------------------------- *
 * 2. Header & Navigation (Burger First)
 * ------------------------------------------------------------------------- */
.site-header {
    background: var(--color-header-bg);
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.site-header.is-scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border-bottom-color: var(--color-border);
}

.header-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.site-branding { display: flex; align-items: center; }
.custom-logo { max-height: 40px; width: auto; }
.site-title { font-size: 1.5rem; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.site-title a { color: var(--color-accent); }

/* Header Actions */
.header-actions { display: flex; align-items: center; gap: 0.5rem; }

.header-cta {
    background: var(--color-primary);
    color: #fff !important;
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    display: none;
    margin-left: 1rem;
}
@media (min-width: 768px) { .header-cta { display: inline-block; } }

.header-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem; /* Icon size */
    color: var(--color-accent);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
    width: 40px;
    height: 40px;
}
.header-icon-btn:hover { background-color: rgba(0,0,0,0.05); }
[data-theme="dark"] .header-icon-btn:hover { background-color: rgba(255,255,255,0.1); }

/* ------------------------------------------------------------------------- *
 * 3. Off-Canvas Drawer
 * ------------------------------------------------------------------------- */
.site-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: var(--drawer-width);
    height: 100vh;
    background: var(--color-card-bg);
    z-index: 2000;
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 2rem;
    overflow-y: auto;
}

.site-drawer.is-open { right: 0; }

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    backdrop-filter: blur(2px);
}
.drawer-overlay.is-active { opacity: 1; visibility: visible; }

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.drawer-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    color: var(--color-text);
}

/* Drawer Menu */
.drawer-menu ul { list-style: none; padding: 0; margin: 0; }
.drawer-menu li { border-bottom: 1px solid var(--color-border); }
.drawer-menu a {
    display: block;
    padding: 1rem 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--color-accent);
}
.drawer-menu .sub-menu { display: none; padding-left: 1rem; border-top: 1px solid var(--color-border); }
.drawer-menu .menu-item-has-children > a::after { content: '+'; float: right; }

/* ------------------------------------------------------------------------- *
 * 4. Layouts & Templates
 * ------------------------------------------------------------------------- */
.site-content {
    max-width: var(--container-width);
    margin: calc(var(--header-height) + 2rem) auto 4rem;
    padding: 0 1.5rem;
    display: grid;
    gap: 3rem;
}

@media (min-width: 992px) {
    .site-content {
        grid-template-columns: 1fr 300px;
    }
}

.page-template-page-fullwidth .site-content {
    grid-template-columns: 1fr;
    max-width: 100%;
    padding: 0;
}
.page-template-page-fullwidth .entry-content {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ------------------------------------------------------------------------- *
 * 5. Components: Posts, Grid, Single
 * ------------------------------------------------------------------------- */
.post-grid {
    display: grid;
    gap: 2rem;
}
@media (min-width: 768px) {
    .post-grid { grid-template-columns: repeat(2, 1fr); }
}

.post-card {
    background: var(--color-card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s;
    border: 1px solid var(--color-border);
}
.post-card:hover { transform: translateY(-5px); }

.post-thumbnail { height: 200px; overflow: hidden; }
.post-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

.post-content { padding: 1.5rem; }
.entry-title { font-size: 1.25rem; margin-bottom: 0.5rem; }
.entry-title a { color: var(--color-accent); }

/* Single Post */
.single-post-header { margin-bottom: 2rem; }
.single-breadcrumbs { font-size: 0.85rem; color: var(--color-text-light); margin-bottom: 1rem; }
.single-title { font-size: 2.5rem; font-weight: 800; margin-bottom: 1rem; color: var(--color-accent); }
.single-meta { font-size: 0.9rem; color: var(--color-text-light); margin-bottom: 1.5rem; }

.single-featured-image {
    margin-bottom: 2.5rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

/* Table of Contents */
.pt-toc {
    background: var(--color-bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
    border: 1px solid var(--color-border);
}
.pt-toc-header {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    cursor: pointer;
    color: var(--color-accent);
}
.pt-toc-list { margin-top: 1rem; padding-left: 1.5rem; }
.pt-toc-list.is-hidden { display: none; }
.pt-toc-list li { margin-bottom: 0.5rem; }

/* Content Typography */
.entry-content { font-size: 1.125rem; color: var(--color-text); }
.entry-content p { margin-bottom: 1.5rem; }
.entry-content ul, .entry-content ol { margin-bottom: 1.5rem; padding-left: 2rem; }
.entry-content blockquote {
    border-left: 4px solid var(--color-primary);
    margin: 2rem 0;
    padding: 1rem 1.5rem;
    background: var(--color-card-bg);
    font-style: italic;
    color: var(--color-accent);
}

/* Funnel */
.single-post-funnel {
    background: var(--color-accent);
    color: var(--color-bg);
    padding: 2.5rem;
    border-radius: 8px;
    margin-top: 4rem;
    text-align: center;
}
[data-theme="dark"] .single-post-funnel {
    color: #1a202c; /* Ensure text is readable on light accent in dark mode */
}
.funnel-title { color: inherit; margin-bottom: 1rem; }
.funnel-btn {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    margin-top: 1.5rem;
}
.funnel-btn:hover { background: #fff; color: var(--color-primary); }

/* ------------------------------------------------------------------------- *
 * 6. Sidebar & Widgets
 * ------------------------------------------------------------------------- */
.widget-area-sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--header-height) + 2rem);
}

.widget { margin-bottom: 2.5rem; }
.widget-title {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0.5rem;
    margin-bottom: 1.25rem;
    color: var(--color-accent);
}
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
}
.widget li a { color: var(--color-text); }
.widget li a:hover { color: var(--color-primary); }

/* Footer */
.site-footer {
    background: var(--color-accent);
    color: #cbd5e0;
    padding: 4rem 0 2rem;
}
[data-theme="dark"] .site-footer {
    background: #111; /* Even darker footer in dark mode */
}
.footer-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}
.site-footer h3 { color: #fff; }
.site-footer a { color: #cbd5e0; }
.site-footer a:hover { color: #fff; }

.copyright {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.9rem;
}

/* ------------------------------------------------------------------------- *
 * 7. Comments & Forms
 * ------------------------------------------------------------------------- */
input[type="text"], input[type="email"], input[type="url"], textarea, input[type="search"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--color-card-bg);
    color: var(--color-text);
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 150, 214, 0.1);
}

.comment-list { list-style: none; padding: 0; }
.comment-body { background: var(--color-card-bg); padding: 1.5rem; border-radius: 8px; margin-bottom: 1.5rem; border: 1px solid var(--color-border); }
.comment-meta { margin-bottom: 1rem; font-size: 0.9rem; }
.fn { font-weight: 700; font-style: normal; color: var(--color-accent); }

/* ------------------------------------------------------------------------- *
 * 8. Search Overlay
 * ------------------------------------------------------------------------- */
.search-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--color-header-bg);
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.search-overlay.is-active { opacity: 1; visibility: visible; }
.search-overlay form { width: 100%; max-width: 600px; padding: 2rem; }
.search-overlay input {
    font-size: 2rem;
    border: none;
    border-bottom: 2px solid var(--color-accent);
    background: transparent;
    padding: 1rem 0;
    border-radius: 0;
    color: var(--color-text);
}
.search-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-size: 3rem;
    cursor: pointer;
    color: var(--color-accent);
}

/* ------------------------------------------------------------------------- *
 * 9. DIRECTORY PLUGIN OVERRIDES (Crucial for Dark Mode)
 * ------------------------------------------------------------------------- */
[data-theme="dark"] .pickthis-card {
    background-color: var(--color-card-bg);
    border-color: var(--color-border);
}
[data-theme="dark"] .pt-card-header {
    background-color: #4a5568; /* Slightly lighter than card bg for contrast */
}
[data-theme="dark"] .pickthis-filters-sidebar {
    background-color: var(--color-card-bg);
    border-color: var(--color-border);
}
[data-theme="dark"] .pt-filter-list li a {
    color: var(--color-text);
}
[data-theme="dark"] .pickthis-card h3 a {
    color: var(--color-text);
}
[data-theme="dark"] .pt-card-footer {
    background-color: rgba(0,0,0,0.2);
    border-top-color: var(--color-border);
}
[data-theme="dark"] .pickthis-pagination a, 
[data-theme="dark"] .pickthis-pagination span {
    background-color: var(--color-card-bg);
    color: var(--color-text);
    border-color: var(--color-border);
}