/*
Theme Name: Calckpeak
Theme URI:  https://example.com/calckpeak
Author:      Calckpeak Theme Builder
Author URI:  https://example.com
Description: Enhanced Calckpeak — modern WordPress theme with dark/light toggle, customizable hero with background image, and responsive layout.
Version:     1.2
License:     GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: calckpeak
Tags: dark, light, responsive, accessibility, custom-logo, custom-menu, custom-background
*/
:root {
    --bg: #0f1724;
    --card: #0b1220;
    --muted: #94a3b8;
    --accent: #4CAF50; /* Professional green */
    --accent-2: #1976D2; /* Deeper professional blue */
    --glass: rgba(255,255,255,0.04);
    --radius: 8px;
    --max-width: 1200px;
    --ff-sans: 'Roboto', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Arial;
    --text: #e6eef8;
    --header-bg: #1A237E; /* Darker blue for professionalism */
    --header-gradient: linear-gradient(to right, #1A237E, #283593);
    --footer-bg: #0b1220; /* Unified footer background */
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--ff-sans); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 15px; }

/* Professional Header */
.site-header {
    width: 100%;
    background: var(--header-gradient);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.header-inner {
    padding: 8px 0;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}
.brand .custom-logo img {
    max-height: 28px; /* Match text height of CalcPeak */
    max-width: 120px; /* Prevent wide logos from expanding */
    width: auto;
    height: auto;
    object-fit: contain; /* Ensure logo fits without stretching or overflow */
    vertical-align: middle;
}
.site-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    margin: 0;
    font-family: 'Roboto', sans-serif;
    letter-spacing: 0.5px;
    line-height: 1.2;
}
.main-nav {
    flex-grow: 1;
    margin: 0 15px;
}
.menu-container {
    display: flex;
    align-items: center;
    gap: 12px;
}
.menu-container > li {
    position: relative;
}
.menu-container > li > a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.3s, color 0.3s;
}
.menu-container > li > a:hover {
    background: rgba(255,255,255,0.15);
    color: var(--accent);
}
.menu-container > li .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--accent-2);
    border-radius: 4px;
    min-width: 140px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    padding: 5px 0;
    list-style: none;
}
.menu-container > li:hover .sub-menu {
    display: block;
}
.sub-menu li {
    display: block;
}
.sub-menu li a {
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 6px 15px;
    display: block;
    transition: background 0.3s;
}
.sub-menu li a:hover {
    background: rgba(255,255,255,0.15);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.search-form {
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 4px;
    overflow: hidden;
    width: 350px; /* Increased width for more input space */
}
.search-field {
    border: none;
    background: transparent; /* Matches dark theme */
    color: #fff;
    padding: 0.8rem 1.2rem; /* Increased padding for roomier input */
    font-size: 0.85rem;
    flex-grow: 1;
    width: 100%;
}
.search-submit {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.8rem; /* Reduced for smaller icon */
    padding: 0.5rem 0.6rem; /* Tightened padding */
    cursor: pointer;
    margin-left: auto; /* Ensures right alignment */
}
.search-submit:hover {
    color: var(--accent);
}
.social-icons a {
    color: #fff;
    font-size: 1rem;
    margin-left: 6px;
    text-decoration: none;
    transition: color 0.3s;
}
.social-icons a:hover {
    color: var(--accent);
}
.theme-toggle {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1rem;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}
.theme-toggle:hover {
    background: rgba(255,255,255,0.1);
}
.mobile-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.1rem;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
}

/* Hero and Category Hero */
.hero, .category-hero {
    padding: 60px 15px;
    border-radius: var(--radius);
    margin: 0 0 30px;
    background: linear-gradient(135deg, rgba(25,118,210,0.15), rgba(76,175,80,0.1));
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-align: center;
}
.hero[style], .category-hero[style] {
    background-color: transparent;
    background-blend-mode: normal;
}
.hero-inner {
    max-width: 800px;
    margin: 0 auto;
}
.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.2;
    text-align: center;
}
.hero-sub {
    font-size: 1.1rem;
    margin: 0 0 15px;
    color: var(--muted);
}
.hero-ctas {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Categories and Posts Grid */
.categories-section, .posts-section {
    padding: 30px 0;
}
.section-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0 0 15px;
    color: var(--text);
    text-align: center;
}
.categories-grid, .posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}
.cat-card, .post-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.cat-card:hover, .post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}
.card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}
.card-media {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    overflow: hidden;
}
.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-placeholder {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    opacity: 0.9;
}
.card-body {
    padding: 10px;
}
.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}
.card-count, .card-excerpt {
    font-size: 0.85rem;
    margin: 0;
    color: var(--muted);
}
.pagination-container {
    text-align: center;
    width: 100%;
    margin-top: 20px;
}
.pagination-container .next-button {
    display: inline-block;
    margin: 0 auto;
}
.pagination a.next-button {
    background-color: #1976D2; /* Distinct blue background */
    color: #ffffff; /* White text for contrast */
    opacity: 1; /* Ensure visibility */
    visibility: visible; /* Ensure visibility */
    padding: 8px 20px; /* Increase padding for better visibility */
    font-weight: 600;
}
.pagination a.next-button:hover {
    background-color: #1565C0; /* Darker blue on hover */
    color: #ffffff; /* Keep white text on hover */
    text-decoration: none;
}

/* Professional Footer */
.site-footer {
    background: var(--footer-bg);
    padding: 40px 15px 15px;
    border-top: 1px solid var(--glass);
}
.footer-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: var(--max-width);
    margin: 0 auto;
}
.footer-column {
    margin-bottom: 15px;
}
.footer-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 10px;
    color: var(--text);
    text-align: left; /* Left-aligned headings */
}
.footer-menu, .social-links {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-menu li a, .social-links li a {
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.8;
    transition: color 0.2s;
}
.footer-menu li a:hover, .social-links li a:hover {
    color: var(--accent);
}
.fallback-links {
    display: none; /* Hidden by default, shown if menu fails */
}
.footer-menu:empty + .fallback-links {
    display: block; /* Show fallback if menu is empty */
}
.footer-bottom {
    margin-top: 20px;
    text-align: center;
    border-top: 1px solid var(--glass);
    padding-top: 15px;
}
.footer-bottom p {
    font-size: 0.85rem;
    margin: 0;
    color: #fff;
}

/* Buttons */
.button {
    background: var(--accent);
    color: #fff;
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}
.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.button.ghost {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--text);
}

/* Utility */
.muted { color: var(--muted); }

/* Mobile */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 10px;
    }
    .brand .custom-logo img {
        max-height: 28px;
        max-width: 100px;
    }
    .main-nav {
        display: none;
        width: 100%;
    }
    .main-nav.active {
        display: block;
    }
    .menu-container {
        flex-direction: column;
        gap: 8px;
        max-width: 100%;
        overflow-x: visible;
    }
    .search-form {
        width: 100%;
    }
    .search-field {
        width: 100%;
    }
    .mobile-toggle {
        display: inline-block;
    }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .menu-container {
        max-width: 45%;
    }
    .search-form {
        width: 180px;
    }
    .brand .custom-logo img {
        max-height: 28px;
        max-width: 110px;
    }
}

/* Additional centering for titles */
.hero-title, .section-title, .card-title, .post-title {
    text-align: center;
}