/*
Theme Name: TechCapsules
Description: Clean, independent tech news theme with black header and responsive design
Version: 1.3.1
Author: TechCapsules Team
Text Domain: techcapsules
Requires at least: 5.9
Tested up to: 6.6
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: news, technology, responsive, clean, modern
*/

/* ====== CSS CUSTOM PROPERTIES ====== */
:root {
    /* Colors */
    --primary-color: #0073aa;
    --primary-hover: #005177;
    --text-color: #333;
    --text-secondary: #555;
    --text-muted: #666;
    --background-color: #fafafa;
    --background-secondary: #f8f9fa;
    --background-third: #fff;
    --border-color: #eee;
    --accent-red: #ff0000;

    /* Shadows */
    --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-footer: 0 -2px 4px rgba(0, 0, 0, 0.05);

    /* Layout */
    --header-height: 50px;
    --nav-height: 50px;
    --total-header-height: calc(var(--header-height) + var(--nav-height));
    --container-max-width: 1200px;

    /* Spacing */
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 15px;
    --spacing-lg: 20px;
    --spacing-xl: 40px;
    --spacing-xxl: 60px;

    /* Border radius */
    --border-radius-sm: 5px;
    --border-radius-md: 10px;

    /* Z-index */
    --z-header: 1001;
    --z-nav: 999;
    --z-overlay: 1;

    /* Typography */
    --font-size-xs: 0.8rem;
    --font-size-sm: 0.9rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.1rem;
    --font-size-xl: 1.2rem;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;

    /* Card dimensions */
    --card-min-height: 300px;
    --card-image-ratio: 16 / 9;
    --card-image-max-height: 250px;

    /* Gradients */
    --overlay-gradient: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.3) 100%);
}

/* ====== RESET & BASE ====== */
html {
    box-sizing: border-box;
    font-size: 16px;
    line-height: 1.6;
}

*, *:before, *:after {
    box-sizing: inherit;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--total-header-height);
    margin: 0;
}

/* ====== TYPOGRAPHY ====== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
    color: var(--text-color);
}

h1 { font-size: clamp(2rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: clamp(var(--font-size-xl), 3vw, 1.5rem); }
h4 { font-size: clamp(var(--font-size-base), 2.5vw, 1.25rem); }
h5 { font-size: clamp(var(--font-size-sm), 2vw, 1.125rem); }
h6 { font-size: var(--font-size-base); }

p { margin-bottom: 1rem; }

/* ====== LINKS ====== */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover { color: var(--primary-hover); }

.author-date { font-weight: normal; }
.author-date .author-name { font-weight: bold; }

/* ====== LAYOUT CONTAINERS ====== */
#page { display: flex; flex-direction: column; min-height: 100vh; width: 100%; }
#content { flex: 1; width: 100%; }

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    width: 100%;
}

/* ====== HEADER ====== */
.techcapsules-header {
    background: #000;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: var(--z-header);
    /*box-shadow: var(--shadow-light);*/
    /*border-bottom: 1px solid var(--border-color);*/
    /*opacity: 0.9; */
}

.header-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0px var(--spacing-lg);
    min-height: var(--header-height);
    max-height: var(--header-height);
}

.header-logo,
.header-title,
.header-nav-desktop,
.header-right,
.mobile-controls {
    display: flex;
    align-items: center;
    height: 100%;
}


.header-logo { flex: 0 0 auto; min-width: 120px; }
.logo-link { display: block; }
.logo-image, .custom-logo {
    max-height: 40px;
    width: auto;
    display: block;
    transition: opacity var(--transition-base);
}
.logo-link:hover .logo-image,
.logo-link:hover .custom-logo { opacity: 0.8; }

.header-title { flex: 1; display: flex; justify-content: center; align-items: center; }
.site-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}
.tech-text { color: var(--accent-red); }
.capsules-text { color: var(--background-third); }

.header-right { flex: 0 0 auto; min-width: 120px; display: flex; justify-content: flex-end; align-items: center; }

/* ====== MAIN NAVIGATION (OLD) ====== */
.main-navigation-container {
    /*background: var(--background-third); */
    background: var(--background-color);
    
    /*border-bottom: 1px solid var(--border-color);*/
    position: fixed;
    top: var(--header-height);
    left: 0; right: 0;
    z-index: var(--z-nav);
    /*box-shadow: var(--shadow-light); */
}

.main-navigation-wrapper { 
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg); 
}

.main-menu-items {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0; padding: 0;
    min-height: var(--nav-height);
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /*scroll-snap-type: x mandatory;*/
    /*scroll-behavior: smooth;*/
    /* Remove snap — it fights against programmatic smooth scrolling */
    /*scroll-snap-type: none;*/
    
}
.main-menu-items::-webkit-scrollbar { height: 0; }
.main-menu-items li { 
    margin-right: var(--spacing-xs); 
    /*scroll-snap-align: start; */
    /*scroll-snap-align: none;*/
}
.main-menu-items li:last-child { margin-right: 0; }
.main-menu-items a {
    color: var(--text-color);
    /*color: #fff;*/
    
    font-size: var(--font-size-sm);
    font-weight: 500;
    padding: var(--spacing-xs) 17px;
    border-radius: var(--border-radius-sm);
    /*: 1px solid #eeeeee;*/
    /*border-color:  #cccccc;*/
    /*background: var(--background-secondary);*/
    background: #eeeeee;
    
    display: block;
}
.main-menu-items a:hover { background: #dddddd; /*font-weight: 500; border-color: var(--primary-color);*/}
.main-menu-items a.current { background: var(--primary-color); color: var(--background-color); border-color: var(--primary-color)}

/* ====== NEW HEADER NAV (DESKTOP & MOBILE) ====== */
@media (min-width: 768px) {
    /*.header-container { justify-content: space-between; }*/
    /*.header-left { flex: 0 0 auto; }*/
    .header-nav-desktop { flex: 1; display: flex; justify-content: center; }
    .header-menu-items { display: flex; list-style: none; margin: 0; padding: 0; gap: 12px;}
    .menu-item { position: relative; display: inline-block; }
    .menu-item-link {
        display: block;
        /*padding: var(--spacing-sm) var(--spacing-md);*/
        padding: var(--spacing-xs) var(--spacing-sm);
        color: #fff;
        font-weight: 500;
        font-size: var(--font-size-sm);
        cursor: default;
        transition: color var(--transition-base);
    }
    /* Blue on hover */
    .menu-item-link:hover,
    .menu-item-link:focus {
        color: #82E1FF;
    }
    
    /* Blue when clicked open */
    .menu-item.submenu-open .menu-item-link {
        color: #82E1FF;
    }
    
    /* Blue for current page */
    .menu-item.current .menu-item-link { 
        color: #82E1FF; 
    }
    /* ===== DESKTOP NAVIGATION SUBMENU STYLES ===== */

    /* Base submenu - hidden by default */
    .submenu {
        position: absolute;
        top: 100%; 
        left: 0;
        background: #000;
        list-style: none;
        margin: 0; 
        padding: var(--spacing-md) 0;
        min-width: 200px;
        box-shadow: var(--shadow-hover);
        opacity: 0; 
        visibility: hidden;
        pointer-events: none;
        transition: opacity var(--transition-base), visibility var(--transition-base);
        z-index: 1005;
        white-space: nowrap;
    }
    
    /* Show submenu ONLY on pure CSS hover (when no click-opened submenus exist) */
    .header-nav-desktop:not(.has-open-submenu) .menu-item:hover > .submenu {
        opacity: 1; 
        visibility: visible;
        pointer-events: auto;
    }
    
    /* Show submenu when explicitly opened via click - OVERRIDES everything */
    .menu-item.submenu-open > .submenu { 
        opacity: 1 !important; 
        visibility: visible !important;
        pointer-events: auto !important;
    }
    
    /* When has-open-submenu is active, FORCE HIDE all non-open submenus */
    .header-nav-desktop.has-open-submenu .menu-item:not(.submenu-open):hover > .submenu {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
    
    .submenu-link {
        display: block;
        padding: var(--spacing-sm) var(--spacing-lg);
        color: #fff;
        text-decoration: none;
        transition: background var(--transition-fast);
    }
    
    .submenu-link:hover,
    .submenu-link:focus { 
        background: var(--primary-color); 
        color: #fff; 
    }
    
    .mobile-menu-toggle, #mobile-menu { display: none; }
    
    /* Hide mobile controls on desktop - FIX FOR ISSUE A */
    .mobile-controls {
        display: none !important;
    }
    
    /* Keep desktop search visible */
    .header-right {
        display: flex;
    }
}

@media (max-width: 767px) {
    .header-container { justify-content: flex-start; position: relative; }
    .site-title { font-size: 1rem; }
    /*.header-left { flex: 1; }*/
    
    /* Mobile: Search + Hamburger - FIX FOR ISSUE A */
    .mobile-controls {
        display: flex; 
        position: absolute; 
        right: 10px; 
        top: 50%;
        transform: translateY(-50%); 
        align-items: center; 
        z-index: 1002;
    }
    
    .mobile-controls .search-toggle,
    .mobile-controls .mobile-search-toggle,
    .mobile-search-toggle,
    .mobile-menu-toggle {
        background: none; 
        border: none; 
        cursor: pointer;
        padding: 0px 8px; 
        color: #fff; 
        /*border-radius: 6px;*/
        display: flex; 
        align-items: center; 
        justify-content: center;
        transition: background 0.2s ease;
    }
    
    .mobile-controls .search-toggle:hover,
    .mobile-controls .mobile-search-toggle:hover,
    .mobile-menu-toggle:hover { 
        background: rgba(255, 255, 255, 0.15); 
    }
    
    .mobile-controls svg,
    .mobile-menu-toggle svg { 
        width: 20px; 
        height: 20px; 
        stroke: currentColor; 
    }
    
    /* Hamburger lines - FIX FOR ISSUE B */
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 30px;
        min-width: 30px;
    }
    
    .hamburger-line {
        display: block;
        width: 20px;
        height: 2px;
        background: #fff;
        margin: 2px 0;
        transition: 0.3s;
        border-radius: 2px;
    }
    
    .mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) { 
        transform: rotate(-45deg) translate(-5px, 6px); 
    }
    .mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) { 
        opacity: 0; 
    }
    .mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) { 
        transform: rotate(45deg) translate(-5px, -6px); 
    }

    #mobile-menu {
        position: fixed; top: var(--header-height); left: 0; width: 100%; height: calc(100vh - var(--header-height));
        background: rgba(0, 0, 0, 0.95); z-index: 1000;
        display: none; align-items: flex-start; justify-content: center;
        opacity: 0; visibility: hidden;
        transition: opacity var(--transition-base), visibility var(--transition-base);
    }
    #mobile-menu[aria-hidden="false"] { display: flex; opacity: 1; visibility: visible; }
    .mobile-menu-content { width: 100%; max-height: calc(100vh - var(--header-height)); background: #000; overflow-y: auto; }
    .mobile-menu-header { display: flex; justify-content: space-between; align-items: center; padding: var(--spacing-lg); }
    .mobile-menu-header h2 { margin: 0; color: #fff; font-size: var(--font-size-lg); }
    .mobile-menu-close {
        background: none; border: none; font-size: 2rem; color: #fff;
        cursor: pointer; width: 30px; height: 30px;
        display: flex; align-items: center; justify-content: center;
    }
    .mobile-menu-items { list-style: none; margin: 0; padding: 0; }
    .mobile-menu-items a,
    .mobile-parent-toggle {
        display: block; padding: var(--spacing-sm) var(--spacing-lg);
        color: #fff; text-decoration: none; background: none; border: none;
        cursor: pointer; font-size: var(--font-size-base);
        transition: background var(--transition-fast); text-align: left; width: 100%;
    }
    .mobile-menu-items a:hover,
    .mobile-parent-toggle:hover { background: var(--primary-color); }
    .mobile-parent-toggle { display: flex; justify-content: space-between; align-items: center; font-weight: 500; }
    .mobile-arrow { transition: transform var(--transition-fast); font-size: 0.8rem; }
    .mobile-parent-toggle[aria-expanded="true"] .mobile-arrow { transform: rotate(180deg); }
    .mobile-submenu {
        display: none; list-style: none; margin: 0; padding-left: 10px;
        max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
        background: rgba(255, 255, 255, 0.05);
    }
    .mobile-parent-toggle[aria-expanded="true"] + .mobile-submenu { display: block; max-height: 500px; }
    .mobile-submenu-link { padding-left: var(--spacing-xl); font-size: var(--font-size-sm); }
    .header-nav-desktop { display: none; }
    
    /* Hide desktop search on mobile */
    .header-right .search-toggle { 
        display: none; 
    }
}

/* Tablet Nav Adjustments
@media (min-width: 768px) and (max-width: 1024px) {
    .menu-item-link { padding: var(--spacing-xs) var(--spacing-sm); font-size: var(--font-size-sm); }
    .submenu { min-width: 180px; }
} */

/* ====== CARD SYSTEM (SHARED) ====== */
.category-grid,
.search-results-section .category-grid {
    display: grid;
    gap: var(--spacing-md);
    align-items: stretch;
}

.news-card-wrapper {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.news-card-wrapper:hover,
.news-card-wrapper:visited { color: inherit; text-decoration: none; }

.news-card {
    background: var(--background-third);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: var(--card-min-height);
    transition: box-shadow var(--transition-base);
}

.news-card-wrapper:hover .news-card { box-shadow: var(--shadow-hover); }

.card-image {
    width: 100%;
    aspect-ratio: var(--card-image-ratio);
    max-height: var(--card-image-max-height);
    overflow: hidden;
    background: var(--background-secondary);
    flex-shrink: 0;
}
.card-image img {
    width: 100%; height: 100%; object-fit: cover;
}

.card-content { flex: 1; display: flex; flex-direction: column; padding: var(--spacing-md); }
.card-heading h3 {
    font-size: var(--font-size-xl);
    margin: 0 0 var(--spacing-sm);
    line-height: 1.3;
}
.news-card-wrapper:hover .card-heading h3 { color: var(--primary-color); }

.card-summary { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.content-truncated {
    display: -webkit-box;
    -webkit-line-clamp: 11;
    line-clamp: 11;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: var(--font-size-base);
    line-height: 1.4;
    margin: 0 0 var(--spacing-sm);
}

.card-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-top: auto;
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.card-source { font-size: 0.7em; color: var(--text-muted); margin-bottom: var(--spacing-sm); }
.source-link { font-weight: 500; color: red; }

/* ====== CARD SIZES & OVERLAYS - REFACTORED (FIX FOR ISSUES C & D) ====== */
@media (min-width: 601px) {
    /* Large cards */
    .news-card-wrapper[data-size="large"] {
        grid-column: span 2; grid-row: span 2;
    }
    .news-card-wrapper[data-size="large"] .card-image { max-height: 350px; }
    .news-card-wrapper[data-size="large"] .card-heading h3 { font-size: 1.3rem; }
    .news-card-wrapper[data-size="large"] .content-truncated { -webkit-line-clamp: 9; line-clamp: 9; }

    /* Wide cards - Default normal display */
    .news-card-wrapper[data-size="wide"] {
        grid-column: span 2; 
        grid-row: span 1;
    }
    
    .news-card-wrapper[data-size="wide"] .content-truncated {
        display: none !important;
    }

    /* Wide cards - Overlay effect ONLY on category pages */
    .news-card-wrapper[data-size="wide"] .news-card {
        position: relative; 
        height: 100%;
    }
    
   
    .news-card-wrapper[data-size="wide"] .card-content {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: var(--spacing-md);
        z-index: var(--z-overlay);
        background: var(--overlay-gradient);
    }

    .news-card-wrapper[data-size="wide"] .card-image {
        position: absolute; 
        top: 0; 
        left: 0; 
        width: 100%; 
        height: 100%; 
        max-height: none;
    }
    
    .news-card-wrapper[data-size="wide"] .card-image img { 
        opacity: 0.9; 
    }
    
    .news-card-wrapper[data-size="wide"] .card-heading h3 {
        color: var(--background-third); 
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
        font-size: calc(var(--font-size-xl) + 0.2em);
        
    }
    
    .news-card-wrapper[data-size="wide"] .card-footer {
        color: var(--background-color); 
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
        border-top: none; 
        padding-top: 0;
    }
    
    .news-card-wrapper[data-size="wide"] .card-source { 
        color: var(--background-color); 
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); 
    }

    /* Small and regular cards - hide content everywhere */
    .news-card-wrapper[data-size="small"] .content-truncated,
    .news-card-wrapper[data-size="regular"] .content-truncated {
        display: none !important;
    }
    
    .news-card-wrapper[data-size="small"],
    .news-card-wrapper[data-size="regular"] {
        grid-column: span 1; grid-row: span 1;
    }
    .news-card-wrapper[data-size="small"] .card-image { max-height: 200px; }
    .news-card-wrapper[data-size="small"] .card-heading h3 { font-size: var(--font-size-lg); }
}

/* ====== MOBILE CARD RESET ====== */
@media (max-width: 600px) {
    body { padding-top: var(--total-header-height); }
    .container { padding: 0 var(--spacing-md); }
    .header-container { min-height: var(--header-height); }
    .main-navigation-container { top: var(--header-height); }
    .main-menu-items a { font-size: var(--font-size-xs); padding: 8px 12px; }
    .header-logo { min-width: 100px; }
    .logo-image, .custom-logo { max-height: 32px; }
    .header-right { min-width: 60px; }
    .category-title { font-size: 2rem; }

    .category-grid,
    .search-results-section .category-grid { display: flex; flex-direction: column; gap: 0; }

    .news-card-wrapper { margin-bottom: var(--spacing-lg); }
    
    /* Reset all cards to normal display on mobile */
    
    .news-card-wrapper .card-image {
        position: relative;
        max-height: var(--card-image-max-height);
        height: auto;
        width: 100%;
    }
    
    .news-card-wrapper .card-content { 
        position: relative; 
    }
    
    .news-card-wrapper .card-image img { 
        opacity: 1; 
    }
    
    .news-card-wrapper .card-heading h3 { 
        color: var(--text-color); 
        text-shadow: none; 
        font-size: var(--font-size-xl); 
    }
    
    .news-card-wrapper .card-footer { 
        color: var(--text-muted); 
        text-shadow: none; 
        border-top: 1px solid var(--border-color); 
        padding-top: var(--spacing-sm); 
    }
    
    .news-card-wrapper .card-source {
        color: var(--text-muted);
        text-shadow: none;
    }
    
    .news-card-wrapper .content-truncated {
        display: -webkit-box !important;
        -webkit-line-clamp: 11; 
        line-clamp: 11;
        -webkit-box-orient: vertical; 
        overflow: hidden;
    }
}

/* Extra small mobile */
@media (max-width: 480px) {
    .container { padding: 0 var(--spacing-sm); }
    .header-logo { min-width: 80px; }
    .logo-image, .custom-logo { max-height: 28px; }
}

/* ====== GRID LAYOUTS ====== */
@media (min-width: 1024px) {
    .category-grid,
    .search-results-section .category-grid { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, minmax(var(--card-min-height), auto)); }
    .posts-container { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 769px) and (max-width: 1023px) {
    .category-grid,
    .search-results-section .category-grid { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(4, minmax(250px, auto)); }
    .posts-container { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 601px) and (max-width: 768px) {
    .category-grid,
    .search-results-section .category-grid { grid-template-columns: repeat(2, 1fr); grid-auto-flow: dense; }
    .posts-container { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .posts-container { grid-template-columns: 1fr; }
}

/* ====== BUTTONS & LOAD MORE ====== */
.btn {
    background: var(--primary-color);
    color: var(--background-color);
    border: none;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}
.btn:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[aria-disabled="true"] { background: #ccc; cursor: not-allowed; transform: none; }

.load-more-container { margin: var(--spacing-xl) 0; text-align: center; }
.load-more-btn.loading { position: relative; cursor: wait; }
.load-more-btn.loading::after {
    content: ''; border: 2px solid var(--background-color); border-top: 2px solid transparent;
    border-radius: 50%; width: 16px; height: 16px; animation: spin 1s linear infinite;
    position: absolute; right: var(--spacing-sm); top: 50%; transform: translateY(-50%);
}
@keyframes spin { from { transform: translateY(-50%) rotate(0deg); } to { transform: translateY(-50%) rotate(360deg); } }

/* ====== INDEX PAGE POSTS ====== */
.posts-container { display: grid; gap: 2rem; margin: 2rem 0; }
.post-item { background: var(--background-color); border: 1px solid var(--border-color); border-radius: var(--border-radius-md); overflow: hidden; box-shadow: var(--shadow-light); transition: box-shadow var(--transition-base); }
.post-item:hover { box-shadow: var(--shadow-hover); }
.post-thumbnail { width: 100%; aspect-ratio: var(--card-image-ratio); max-height: var(--card-image-max-height); overflow: hidden; }
.post-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-base); }
.post-thumbnail:hover img { transform: scale(1.05); }
.post-content { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }
.post-title { margin: 0 0 1rem; font-size: 1.5rem; line-height: 1.3; }
.post-title a { color: var(--text-color); text-decoration: none; }
.post-title a:hover { color: var(--primary-color); }
.post-meta { font-size: var(--font-size-sm); color: var(--text-muted); margin-bottom: 1rem; }
.post-meta span { margin-right: 0.5rem; }
.post-excerpt { font-size: var(--font-size-base); line-height: 1.6; color: var(--text-secondary); margin-bottom: 1.5rem; }

/* Pagination */
.navigation.pagination,
.search-pagination { margin: 3rem 0; text-align: center; }
.page-numbers,
.search-pagination .page-numbers {
    display: inline-block; margin: 0 0.25rem; padding: 0.5rem 0.75rem;
    background: var(--background-secondary); color: var(--text-color);
    text-decoration: none; border-radius: var(--border-radius-sm);
    transition: all var(--transition-base);
    font-size: 0.8rem;
}
.page-numbers:hover,
.page-numbers.current,
.search-pagination .page-numbers:hover,
.search-pagination .page-numbers.current {
    background: var(--primary-color); color: var(--background-color);
}
.search-pagination .nav-links { display: flex; justify-content: center; gap: var(--spacing-sm); flex-wrap: wrap; }
.search-pagination .page-numbers { border: 1px solid var(--border-color); }
.search-pagination .page-numbers.dots { background: none; border: none; cursor: default; }
.search-pagination .page-numbers.prev,
.search-pagination .page-numbers.next { font-weight: 600; }

/* ====== NO POSTS / NO RESULTS ====== */
.no-posts,
.no-results {
    text-align: center;
    padding: var(--spacing-xxl) var(--spacing-lg);
    color: var(--text-muted);
    font-size: var(--font-size-lg);
    grid-column: 1 / -1;
}
.no-posts h2,
.no-results p:first-child { font-size: 2rem; margin-bottom: 1rem; font-weight: 600; color: var(--text-color); }

/* ====== FOOTER ====== */
.techcapsules-footer {
    background: #000;
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-lg) 0;
    box-shadow: var(--shadow-footer);
    margin-top: auto;
}
.footer-container { text-align: center; }
.footer-menu { margin-bottom: var(--spacing-md); }
.footer-menu-items { display: flex; justify-content: center; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.footer-menu-items li { margin: 0 var(--spacing-sm); }
.footer-menu-items a {
    color: var(--background-color);
    font-size: var(--font-size-sm);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-base);
}
.footer-menu-items a:hover { color: var(--primary-color); background: var(--background-secondary); }
.footer-copyright { font-size: var(--font-size-xs); color: var(--text-muted); margin: 0; }

/* ====== BREADCRUMBS ====== */
.breadcrumbs {
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-xs) 0;
    margin-bottom: var(--spacing-xs);
}
.breadcrumbs-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-xs);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}
.breadcrumb-item {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-base);
}
.breadcrumb-item:hover { text-decoration: underline; }
.breadcrumb-item.parent { color: var(--text-muted); font-weight: 500; }
.breadcrumb-item.current { color: var(--primary-color); font-weight: 600; }
.breadcrumb-separator { margin: 0 4px; color: var(--text-muted); font-size: var(--font-size-sm); user-select: none; }
.breadcrumb-item:first-child::before { content: '🏠 '; font-size: 0.9em; }

/* Mobile */
@media (max-width: 600px) {
    .breadcrumb-item { font-size: var(--font-size-xs); }
    .breadcrumb-separator { margin: 0 4px; font-size: 0.75rem; }
}

/* ====== SEARCH MODAL ====== */
.search-toggle {
    background: none; border: none; cursor: pointer;
    /*padding: 8px;*/ 
    color: #fff; border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.3s ease;
}
.search-toggle:hover { opacity: 0.8; background: rgba(255, 255, 255, 0.1); }
.search-toggle svg { stroke: currentColor; }

.search-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background: rgba(0, 0, 0, 0.9); z-index: 2000;
    display: none; align-items: flex-start; justify-content: center;
    padding-top: 100px; opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.search-modal[aria-hidden="false"] { display: flex; opacity: 1; visibility: visible; }

.search-modal-content {
    width: 90%; max-width: 600px; background: #000;
    border-radius: 10px; padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.search-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.search-header h2 { color: #fff; font-size: 1.5rem; margin: 0; }
.search-close {
    background: none; border: none; font-size: 2rem; color: #fff;
    cursor: pointer; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: background 0.3s ease;
}
.search-close:hover { background: rgba(255, 255, 255, 0.1); }

.search-input-wrapper {
    position: relative; display: flex; align-items: center;
    background: rgba(255, 255, 255, 0.1); border-radius: 8px;
    padding: 12px 15px; gap: 10px; border: 2px solid transparent;
    transition: border-color 0.3s ease;
}
.search-input-wrapper:focus-within { border-color: var(--primary-color); background: rgba(255, 255, 255, 0.15); }
.search-input-wrapper svg { stroke: #999; flex-shrink: 0; }
.search-input-wrapper input[type="search"] {
    flex: 1; background: none; border: none; color: #fff;
    font-size: 1rem; outline: none; padding: 0;
}
.search-input-wrapper input[type="search"]::placeholder { color: #999; }
.search-input-wrapper button[type="submit"] {
    background: var(--primary-color); color: #fff; border: none;
    padding: 8px 20px; border-radius: 5px; font-weight: 600;
    cursor: pointer; transition: background 0.3s ease; white-space: nowrap;
}
.search-input-wrapper button[type="submit"]:hover { background: var(--primary-hover); }

.search-hint { color: #999; font-size: 0.85rem; margin-top: 15px; text-align: center; }

/* Mobile Search */
@media (max-width: 767px) {
    .search-modal-content { padding: 20px; width: 95%; }
    .search-header h2 { font-size: 1.2rem; }
    .search-input-wrapper { padding: 10px 12px; }
    .search-input-wrapper input[type="search"] { font-size: 0.9rem; }
    .search-input-wrapper button[type="submit"] { padding: 6px 15px; font-size: 0.85rem; }
}

/* Prevent scroll when modal open */
body.search-open { overflow: hidden; }

/* ====== SEARCH RESULTS PAGE ====== */
.search-header {
    text-align: center;
    margin: 0 auto;
    padding: var(--spacing-md) var(--spacing-lg) 0;
    max-width: var(--container-max-width);
}
.search-title { font-size: var(--font-size-md); font-weight: 600; }
.search-query { color: var(--primary-color); font-weight: 700; }
.search-count { font-size: var(--font-size-md); color: var(--text-muted); }

.search-results-section {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md) var(--spacing-lg);
}

/* ====== ACCESSIBILITY ====== */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
    .submenu, #mobile-menu, .hamburger-line, .mobile-arrow { transition: none; }
}

@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.3);
        --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.4);
    }
}

/* ====================================================================== */
/* NEWSLETTER & SOCIAL ICONS - CORRECTED VERSION                          */
/* Matches existing TechCapsules design system                            */
/* ====================================================================== */

/* ====== HEADER ICONS (Newsletter, Twitter, Search) ====== */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right .newsletter-toggle,
.header-right .twitter-link,
.header-right .search-toggle {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 5px;
    text-decoration: none;
}

.header-right .newsletter-toggle:hover,
.header-right .twitter-link:hover,
.header-right .search-toggle:hover {
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.1);
}

.header-right .newsletter-toggle svg,
.header-right .twitter-link svg,
.header-right .search-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* ====== NEWSLETTER MODAL ====== */
.newsletter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.newsletter-modal[aria-hidden="false"] {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.newsletter-modal-content {
    width: 90%;
    max-width: 450px;
    background: #000;
    border-radius: 10px;
    padding: 40px 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.newsletter-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
    line-height: 1;
    padding: 0;
}

.newsletter-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.newsletter-body {
    text-align: center;
}

.newsletter-body h2 {
    color: #fff;
    font-size: 1.75rem;
    margin: 0 0 10px;
    font-weight: 600;
}

.newsletter-body > p {
    color: #999;
    font-size: 0.95rem;
    margin: 0 0 25px;
}

.newsletter-form {
    margin-bottom: 15px;
}

.newsletter-form input[type="email"] {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.newsletter-form input[type="email"]::placeholder {
    color: #999;
}

.newsletter-form input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.15);
}

.newsletter-form button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.newsletter-form button[type="submit"]:hover {
    background: var(--primary-hover);
}

.newsletter-form button[type="submit"]:disabled {
    background: #555;
    cursor: not-allowed;
}

.newsletter-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
}

.newsletter-message.success {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.newsletter-message.error {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.4);
}

.newsletter-privacy {
    color: #666;
    font-size: 0.8rem;
    margin: 0;
}

/* ====== FOOTER NEWSLETTER ====== */
.footer-newsletter {
    background: #111;
    border: 1px solid #222;
    padding: 30px 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: center;
}

.footer-newsletter h3 {
    margin: 0 0 8px;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
}

.footer-newsletter > p {
    margin: 0 0 20px;
    color: #999;
    font-size: 0.9rem;
}

.footer-newsletter-form {
    max-width: 450px;
    margin: 0 auto;
}

.footer-newsletter-form input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 0.95rem;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.footer-newsletter-form input[type="email"]::placeholder {
    color: #666;
}

.footer-newsletter-form input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
}

.footer-newsletter-form button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.footer-newsletter-form button[type="submit"]:hover {
    background: var(--primary-hover);
}

.footer-newsletter-form button[type="submit"]:disabled {
    background: #555;
    cursor: not-allowed;
}

.footer-newsletter-message {
    margin-top: 12px;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.85rem;
}

.footer-newsletter-message.success {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
}

.footer-newsletter-message.error {
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
}

/* ====== FOOTER SOCIAL LINKS ====== */
.footer-social {
    margin: 20px 0;
    text-align: center;
}

.footer-social-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #999;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.footer-social-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.footer-social-link svg {
    width: 18px;
    height: 18px;
}

/* ====== MOBILE MENU ADDITIONS ====== */
.mobile-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 15px 0;
}

.mobile-menu-action {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    padding: 12px 20px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.3s ease;
    font-size: 1rem;
    font-family: inherit;
}

.mobile-menu-action:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-action svg {
    flex-shrink: 0;
}

/* ====== MOBILE RESPONSIVENESS ====== */
@media (max-width: 768px) {
    .header-right {
        display: none;
    }

    .newsletter-modal-content {
        padding: 30px 20px;
        max-width: 95%;
    }

    .newsletter-body h2 {
        font-size: 1.4rem;
    }

    .footer-newsletter {
        padding: 25px 20px;
    }

    .footer-newsletter h3 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .newsletter-form input[type="email"],
    .footer-newsletter-form input[type="email"] {
        font-size: 16px; /* Prevent iOS zoom */
    }

    .newsletter-body h2 {
        font-size: 1.25rem;
    }

    .newsletter-modal-content {
        padding: 25px 18px;
    }
}


/* ====== ACCESSIBILITY ====== */
@media (prefers-reduced-motion: reduce) {
    .newsletter-modal,
    .newsletter-modal-content {
        animation: none;
        transition: none;
    }
}

/* ====== PRINT ====== */
@media print {
    .newsletter-modal,
    .footer-newsletter,
    .footer-social {
        display: none !important;
    }
}


/* ====== CARD SHARE & LIKE BUTTONS ====== */

/* Make card-source a flex row so source-link is left, share button is right */
.card-source {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Share button — ghost/flat, sits inline with source domain */
.card-share-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-family: inherit;
    line-height: 1;
    transition: color var(--transition-fast);
    /* Prevent the card anchor from getting double-clicked weirdly */
    position: relative;
    z-index: 1;
}

.card-share-button svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.card-share-button:hover {
    color: var(--primary-color);
}

/* Wide card variant — source text is white, so button should match */
.news-card-wrapper[data-size="wide"] .card-share-button {
    color: rgba(255, 255, 255, 0.75);
}
.news-card-wrapper[data-size="wide"] .card-share-button:hover {
    color: #fff;
}

/* ====== CARD FOOTER SPLIT ====== */

/* Give the footer a proper left/right split */
.card-footer {
    justify-content: space-between; /* override the existing flex-start */
}

.card-footer-left {
    display: flex;
    align-items: center;
}

.card-footer-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: var(--spacing-sm);
}

/* Like button — flat, icon + count inline */
.card-like-button {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-family: inherit;
    line-height: 1;
    transition: color var(--transition-fast);
    position: relative;
    z-index: 1;
}

.card-like-button svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.card-like-button:hover {
    color: #e0245e; /* heart red on hover */
}

/* Liked state (add class "liked" via JS later) */
.card-like-button.liked {
    color: #e0245e;
}
.card-like-button.liked svg {
    fill: #e0245e;
}

/* Wide card variant — match white text */
.news-card-wrapper[data-size="wide"] .card-like-button {
    color: rgba(255, 255, 255, 0.75);
}
.news-card-wrapper[data-size="wide"] .card-like-button:hover {
    color: #ff6b8a;
}

/* ====== MOBILE: WIDE CARD BUTTON COLOUR RESET ====== */
/* On desktop the wide card is an image overlay with white text/buttons.
   On mobile the overlay is stripped — but button colours stay white,
   making them invisible against the dark card background.
   This resets them to match normal card buttons on mobile. */
@media (max-width: 600px) {
    .news-card-wrapper[data-size="wide"] .card-share-button,
    .news-card-wrapper[data-size="wide"] .card-like-button {
        color: var(--text-muted);
    }
    .news-card-wrapper[data-size="wide"] .card-share-button:hover {
        color: var(--primary-color);
    }
    .news-card-wrapper[data-size="wide"] .card-like-button:hover,
    .news-card-wrapper[data-size="wide"] .card-like-button.liked {
        color: #e0245e;
    }
    .news-card-wrapper[data-size="wide"] .card-like-button.liked svg {
        fill: #e0245e;
    }
}


/* ==========================================================================
   NEWSLETTER MODAL — 2-STEP REDESIGN
   Paste at the bottom of style.css
   ========================================================================== */

/* ── Scroll lock ───────────────────────────────────────────────────────── */
body.newsletter-open { overflow: hidden; }

/* ── Modal overlay ─────────────────────────────────────────────────────── */
.newsletter-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0, 0, 0, 0.65);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    padding: 16px;
}

.newsletter-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

/* ── Modal card ────────────────────────────────────────────────────────── */
.newsletter-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: nl-slide-up 0.3s ease;
}

@keyframes nl-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Close button ──────────────────────────────────────────────────────── */
.newsletter-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
    z-index: 1;
}
.newsletter-close:hover { color: #333; background: #f0f0f0; }

/* ── Body shared ───────────────────────────────────────────────────────── */
.newsletter-body {
    padding: 36px 32px 28px;
}
.newsletter-body h2 {
    margin: 0 0 8px;
    font-size: 1.35rem;
    font-weight: 700;
    color: #111;
    line-height: 1.3;
}
.newsletter-body > p {
    margin: 0 0 20px;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
}
.newsletter-privacy {
    margin: 12px 0 0 !important;
    font-size: 0.78rem !important;
    color: #aaa !important;
}
.nl-text-btn {
    background: none;
    border: none;
    color: var(--primary-color, #0073aa);
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.nl-text-btn:hover { color: var(--primary-hover, #005177); }

/* ── Icon above title (step 1 & 3) ─────────────────────────────────────── */
.nl-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: #f0f7ff;
    border-radius: 50%;
    color: var(--primary-color, #0073aa);
    margin-bottom: 16px;
}

/* ── Step 1 form ───────────────────────────────────────────────────────── */
.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.newsletter-form input[type="email"] {
    width: 100%;
    padding: 11px 14px;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s ease;
    background: #fff;
    color: #333;
}
.newsletter-form input[type="email"]:focus { border-color: var(--primary-color, #0073aa); }
.newsletter-form button[type="submit"],
#nl-step1-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color, #0073aa);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease;
}
.newsletter-form button[type="submit"]:hover,
#nl-step1-btn:hover { background: var(--primary-hover, #005177); }
.newsletter-form button[type="submit"]:disabled,
#nl-step1-btn:disabled { background: #999; cursor: not-allowed; }

/* ── Newsletter message (shared across steps) ───────────────────────────── */
.newsletter-message {
    padding: 10px 12px;
    border-radius: 5px;
    font-size: 0.85rem;
    line-height: 1.5;
    display: none;
}
.newsletter-message.error   { background: rgba(244, 67, 54, 0.1);  color: #c62828; }
.newsletter-message.success { background: rgba(76, 175, 80, 0.1);  color: #2e7d32; }

/* ── STEP 2: Newsletter tiles ───────────────────────────────────────────── */
.nl-tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

/* Hide the real checkbox visually — tile label acts as toggle */
.nl-tile input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.nl-tile {
    cursor: pointer;
    display: block;
}

.nl-tile-inner {
    position: relative;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    padding: 14px 14px 12px;
    background: #fafafa;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    height: 100%;
}

/* Selected state */
.nl-tile--selected .nl-tile-inner {
    border-color: var(--primary-color, #0073aa);
    background: #f0f7ff;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.nl-tile-inner:hover {
    border-color: #bbb;
    background: #f5f5f5;
}
.nl-tile--selected .nl-tile-inner:hover {
    border-color: var(--primary-color, #0073aa);
    background: #e8f3fb;
}

/* Tile header: badge + frequency */
.nl-tile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.nl-tile-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}
.nl-badge-bigtech {
    background: #111;
    color: #fff;
}
.nl-badge-future {
    background: #0d1117;
    color: #00c9a7;
    border: 1px solid rgba(0, 201, 167, 0.4);
}

.nl-tile-freq {
    font-size: 10px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tile name & description */
.nl-tile-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #222;
    margin-bottom: 4px;
    line-height: 1.3;
}
.nl-tile-desc {
    font-size: 0.76rem;
    color: #888;
    line-height: 1.5;
}

/* Checkmark in bottom-right corner */
.nl-tile-check {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: background 0.15s ease, color 0.15s ease;
}
.nl-tile--selected .nl-tile-check {
    background: var(--primary-color, #0073aa);
    color: #fff;
}

/* Step 2 submit */
.nl-step2-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#nl-step2-submit {
    width: 100%;
    padding: 12px;
    background: var(--primary-color, #0073aa);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease;
}
#nl-step2-submit:hover:not(:disabled) { background: var(--primary-hover, #005177); }
#nl-step2-submit:disabled { background: #999; cursor: not-allowed; }

/* ── STEP 3: Centred confirmation ───────────────────────────────────────── */
.nl-body-center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.nl-success-icon {
    width: 72px;
    height: 72px;
    background: #f0f7ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color, #0073aa);
    margin-bottom: 16px;
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .newsletter-body { padding: 28px 20px 24px; }
    .nl-tiles { grid-template-columns: 1fr; }
    .newsletter-modal-content { border-radius: 10px; }
}




/* Prevent scroll when share modal is open */
body.share-open {
    overflow: hidden;
}

/* ====== MODAL SCROLL LOCK — CLASS BASED (replaces all body.style.overflow inline styles) ======
   All three modals (search, share, mobile menu) now use body classes exclusively.
   No JS file should ever touch body.style.overflow directly.
   ====================================================================== */

body.search-open,
body.share-open,
body.mobile-open {
    overflow: hidden;
}

/* ====== UTILITY CLASSES (Optional - remove if unused) ====== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.p-0 { padding: 0; }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }