/*
Theme Name: Sarai Chinwag
Description: A versatile WordPress theme with dynamic Google Fonts integration and randomized content discovery. Features anti-chronological design, recipe functionality, and percentage-based font scaling. Perfect for food blogs or any content site. See it in action at saraichinwag.com.
Author: Chris Huber
Author URI: https://chubes.net
Theme URI: https://saraichinwag.com
Version: 2.2.6
License: Custom
License URI: https://saraichinwag.com/license
Text Domain: sarai-chinwag
Tags: blog, food, recipes, custom-fonts, responsive, google-fonts, customization
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
*/

/* ===== CSS VARIABLES ===== */
/* All CSS variables are now centralized in css/root.css */

/* ===== TYPOGRAPHY ===== */
body {
    font-family: var(--font-body);
    font-size: calc(var(--font-size-base) * var(--font-body-scale));
    background-color: var(--color-background);
    max-width: 100%;
    margin: auto;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    text-transform: uppercase;
    margin: 18px 0;
    line-height: 1.6;
    font-weight: 600;
}

h1 {
    font-size: calc(var(--font-size-h1) * var(--font-heading-scale));
}

h2 {
    font-size: calc(var(--font-size-h2) * var(--font-heading-scale));
}

h3 {
    font-size: calc(var(--font-size-h3) * var(--font-heading-scale));
}

h1.entry-title {
    margin: 15px 0;
    line-height: 1.4;
}
.entry-header .recipe-rating {
    padding: 5px 0 10px;
}

.widget-title {
    border-bottom: 3px dashed var(--color-secondary);
    width: max-content;
}
/* ===== BUTTONS AND FORM ELEMENTS ===== */
button {
    background-color: var(--color-primary);
    border-radius: 5px;
    color: var(--color-background);
    padding: 10px;
    cursor: pointer;
    border: 3px solid var(--color-secondary); 
    margin: 15px 0;
    font-size: inherit;
}

/* ===== LAYOUT AND BASE STYLES ===== */
p, li, ul{
    line-height: 1.9;
}

img{
    max-width: 100%;
    height: auto;
    position: relative; /* Ensure images are positioned relative */
}
.entry-content img{
    display: block;
    margin: 0 auto;
}

.site-main{
    margin: auto;
}

/* ===== HEADER AND NAVIGATION ===== */ 
.site-title {
    margin: .65em 0; /* Only vertical margins for proper flexbox centering */
    font-size: inherit;
}
p.site-title {
    line-height: 1.6;
}
.site-title a{
    color: var(--color-background);
    text-decoration-color: var(--color-primary);
    font-family: var(--font-heading);
    text-transform: uppercase;
    font-weight: 600;
}

.site-branding {
    flex-grow: 1;
    text-align: center;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    top: 0; 
    z-index: 100; /* Ensure the header is above other content */
    background-color: var(--color-header-footer-bg); /* Ensure the header has a background color */
    width: 100%; /* Ensure the header spans the full width */
    padding: 0 25px; /* Add horizontal padding for icon spacing */
    box-sizing: border-box; /* Include padding in width calculation */
    border-bottom: 3px solid var(--color-primary); /* Full width border */
}
#wpadminbar {
    z-index: 110 !important;
}

.main-navigation {
    display: none; /* Hide by default */
    flex-grow: 1;
    text-align: center;
    flex-direction: column;
    position: fixed; /* Fixed positioning to make it stay in place when scrolling */
    width: 100%; /* Full width */
    background-color: var(--color-header-footer-bg); /* Or any color that fits your design */
    z-index: 90; /* Ensure it's above other content */
    transition: transform 0.3s ease-out; /* Smooth transition for expanding */
    transform: translateY(-100%); /* Start hidden above the screen */
}
.main-navigation a {
    color: var(--color-background);
    text-decoration: none;

}

.main-navigation li {
    padding: 12px;
    border-bottom: 2px solid var(--color-secondary);
    font-size: 20px;
}
.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.main-navigation.active {
    transform: translateY(0); /* Slide down into view */
    border-bottom: 1px solid;
    text-transform: uppercase;
    display: flex;
}
.main-navigation a:hover{
    text-decoration: underline;
}
.entry-title a, .related-items a{
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-color: var(--color-primary);
}
.related-content h3 {
    background: var(--color-primary);
    color: var(--color-background);
    padding: 8px 15px;
    border-bottom: 4px solid #000;
    border-radius: 10px;
    width: max-content;
    max-width: 92%;
}

/* Search Form Styles */

.header-search {
    display: none;
    flex-grow: 1;
    text-align: center;
    flex-direction: column;
    position: fixed;
    width: 100%;
    left: 0;
    background-color: var(--color-header-footer-bg);
    z-index: 90;
    transition: transform 0.3s ease-out;
    transform: translateY(-100%);
    padding: 20px; /* Adjust padding as needed */
    justify-content: center;
    align-items: center;
}
.header-search div {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 90%;
  }

.header-search.active {
    transform: translateY(0);
    border-bottom: 1px solid;
    display: flex;
}

.header-search form {
    width: 100%;
}

.header-search input#s {
    width: 80%; /* Adjust width as needed */
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.header-search input[type="submit"] {
    padding: 10px 20px;
    font-size: 16px;
    background-color: var(--color-primary);
    border: none;
    border-radius: 4px;
    color: var(--color-background);
    cursor: pointer;
    margin: 0 2px;
}

.header-search input[type="submit"]:hover {
    background-color: #17a2b8;
}
#search-icon {
    fill:#fff;
    height: 1em;
    cursor: pointer;
    display: block; /* Ensure this is always visible */
}
#search-icon:hover  {
    fill: var(--color-primary);
}
#random-icon:hover,
#random-icon-link:hover #random-icon {
    fill: var(--color-primary);
}

#random-icon-link {
    display: block;
    padding: 5px; /* Increase hover area */
    line-height: 0; /* Remove line height spacing */
}

.site-header #random-icon{
    display: block;
    cursor: pointer;
    fill: #fff;
    transition: all 0.3s ease; /* Smooth transition for all properties */
    filter: drop-shadow(0 0 3px rgba(31, 197, 226, 0.3)); /* Subtle glow */
}

.site-header #random-icon:hover {
    fill: var(--color-primary);
    filter: drop-shadow(0 0 6px rgba(31, 197, 226, 0.6)); /* Enhanced glow on hover */
    animation: randomIconPulse 2s ease-in-out infinite; /* Gentle pulse */
}

#colophon #random-icon {
    height: 1em;
fill: #fff;
}
/* ===== POST GRID AND CONTENT LAYOUT ===== */


/* Square aspect ratio for post thumbnails */
.post-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1; /* Modern browsers */
    overflow: hidden;
    position: relative;
}

.discovery-post .post-thumbnail {
    margin-bottom: 10px;
}


/* Image styling */
.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== FOOTER ===== */
.site-footer{
    background-color: var(--color-header-footer-bg);
    color: var(--color-background);
    text-align: center;
    display: flex;
    width: 100%;
    flex-direction: column;
    margin-top: 15px;
}

.surprise-me{
    max-width: 80%;
    width: 40%;
    margin: 30px auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.stars {
    display: inline-block;
}

.star {
    cursor: pointer;
    color: gold;
}

.star.rated,
.star.selected {
    color: gold;
}

#average-rating {
    margin-left: 10px;
}
.random-button-section, .posts-navigation {
    display: flex;
    flex-direction: row;
    justify-content: center;
    margin: 10px 0;
    width: 100%;
}
.random-button-section a {
 margin: 0 5px;
}
#random_recipes, #random_posts{
    display: flex;
    flex-direction: column;
}
#random_recipes a, #random_posts a{
    display: flex;
    flex-direction: column;
    font-family: var(--font-heading);
    text-transform: uppercase;
    font-size: calc(1.1rem * var(--font-heading-scale));
    color: #000;
    text-decoration-color: var(--color-primary);
}
.load-more-container{
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
    clear: both;
    margin: 2rem auto 0;
    -webkit-column-break-inside: avoid;
    break-inside: avoid;
    column-span: all;
}

.load-more-container #load-more {
    margin-left: auto;
    margin-right: auto;
}


#footer-menu {
    display: flex;
    flex-direction:row;
    list-style: none;
    margin: auto;
    justify-content: center;
    padding: 0;
}
#footer-menu .menu-item{
    padding: 15px;

}
#footer-menu .menu-item a{
    color: var(--color-background);
    text-decoration: underline;
    text-decoration-style:dotted;
    text-decoration-color: var(--color-secondary);

}

.image-count-badge {
    display: inline-block;
    background-color: #0073aa; /* Adjust background color */
    color: #ffffff; /* Adjust text color */
    font-size: 0.85em;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    margin-right: 10px;
    margin-top: 5px;
}

/* HIDE GROW WIDGET */
.grow-content-body.customize-support div#grow-me-root{
    display: none;
}
/* ===== RESPONSIVE MEDIA QUERIES ===== */
/* Mobile First Method - Progressive Enhancement */

/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
    #secondary {
        margin: auto;
    }
    #primary p, #primary h1, #primary h2, #primary h3, #primary h4, #primary h5, ul.wp-block-list, ol.wp-block-list  {
        width: 92%;
        margin-left: auto;
        margin-right: auto;
    }
    #secondary p, #secondary h1, #secondary h3, #secondary h4, #secondary h5, #secondary button, #secondary #pinterest_follow {
        width: 92%;
        margin-left: auto;
        margin-right: auto;
    }
    .site-info{
        max-width: 92%;
        margin: auto;
    }
    .wp-block-separator{
    border-top: 1px solid;
    max-width: 92%;
    margin: auto;
    }
    .post-badge-breadcrumbs, .archive-breadcrumbs {
        width: 92%;
    }
    #secondary #random_posts h2, #secondary #random_recipes h2{
        width: max-content;
        margin-left:4%;
    }
    .related-item h4 {
        font-size: calc(1.1em * var(--font-heading-scale));
        margin:5px 0;
    }
    .site-title a,
    h1.page-title {
        font-size: calc(1.1rem * var(--font-heading-scale));
    }
    #secondary, .related-items {
        text-align: center;
    }
}

/* Mini, iPhone Retina */
@media only screen and (min-width : 400px) {
    .site-title a{
        font-size: calc(1.25rem * var(--font-heading-scale));
    }
    h1.page-title {
        font-size: calc(1.2rem * var(--font-heading-scale));
    }

}
/* Extra Small Devices, Phones */
@media only screen and (min-width : 480px) {
    .site-title a{
        font-size: calc(1.5rem * var(--font-heading-scale));
    }
}

/* Small Devices, Tablets */
 @media only screen and (min-width : 768px) {
    h1.page-title {
        font-size: calc(1.5rem * var(--font-heading-scale));
    }
}

/* Medium Devices, Desktops */
@media only screen and (min-width : 992px) {
    .wp-block-separator{
        max-width: 100%;
    }
    .site-main {
        max-width: 89%;
    }
    #primary p, #primary h1, #primary h2, #primary h3, #primary h4, #primary h5, ul.wp-block-list, ol.wp-block-list, .post-badge-breadcrumbs, .archive-breadcrumbs {
        width: 100%;
    }
    #primary {
        float: left;
        width: 66%;
    }
    #secondary {
        float: right;
        width: 28%;
        padding: 0 0 0 6px;
        display: flex;
        flex-direction: column;
    }
    .content-wrap{
        max-width: 85%;
        margin: auto;
    }
    
    /* Full-width pages override */
    .home .content-wrap,
    .archive .content-wrap,
    .search .content-wrap {
        max-width: 95%;
    }
    .related-content {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        margin: 15px 0;
    }
    .related-items { 
        display: flex;
        justify-content: space-between;
        flex: 1 1 30%; /* Adjust flex to ensure consistent sizing within the grid */

}
    .related-item {
        width: 30%;
    }
    
}
/* Large Devices, Wide Screens */

@media only screen and (min-width : 1200px) {

}



/* Footer credit link styling */
.footer-credit-link {
    color: var(--color-background);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--color-primary);
}

/* ===== ENHANCED USER EXPERIENCE IMPROVEMENTS ===== */

/* 1. Enhanced Random Button Interactions */
.random-button-section a {
    transition: all 0.3s ease;
    transform: translateY(0);
}
.random-button-section a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background-color: var(--color-secondary);
    border-color: var(--color-primary);
}

/* 2. Enhanced Widget Separation */
.widget {
    padding: .5em;
    background-color: rgba(255,255,255,0.02);
    border-radius: 8px;
}

/* 3. Better Related Content Cards */
#random_posts a, #random_recipes a {
    transition: transform 0.3s ease;
    border-radius: 6px;
    overflow: hidden;
}
#random_posts a:hover, #random_recipes a:hover {
    transform: scale(1.02);
}

/* 4. Consistent Button Hover States */
button:hover {
    background-color: var(--color-secondary);
    border-color: var(--color-primary);
    transition: all 0.3s ease;
}

/* 5. Mobile Touch Targets */


/* 7. Smooth Font Transitions */
body, h1, h2, h3, h4, h5, h6 {
    transition: font-size 0.3s ease, font-family 0.3s ease;
}

/* 8. Better Focus States */
button:focus, a:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 3px;
}

/* 9. Random Icon Pulse Animation */
@keyframes randomIconPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 6px rgba(31, 197, 226, 0.6));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 8px rgba(31, 197, 226, 0.8));
    }
}

/* Enhanced touch target for mobile */

/* ===== BADGE-BREADCRUMB SYSTEM ===== */

/* Badge-breadcrumbs for single posts */
.post-badge-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 15px 0 10px 0;
    padding: 0;
}

.badge-breadcrumb {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.75em;
    font-weight: 500;
    text-decoration: none;
    border-radius: 20px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.badge-category {
    background-color: var(--color-primary);
    color: var(--color-background);
}

.badge-category:hover {
    background-color: var(--color-secondary);
    color: var(--color-background);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.badge-tag {
    background-color: var(--color-secondary);
    color: var(--color-background);
}

.badge-tag:hover {
    background-color: var(--color-primary);
    color: var(--color-background);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Gallery Discovery Badges */
.gallery-discovery-badges {
    margin: 20px 0 25px 0;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 12px;
    border: 1px solid #e5e5e5;
}

.gallery-badges-title {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--color-text);
    text-align: center;
}

.gallery-badges-description {
    font-size: 0.9em;
    color: #666;
    text-align: center;
    margin: 0 0 15px 0;
    font-style: italic;
}

.gallery-badges-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.gallery-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.8em;
    font-weight: 500;
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.3s ease;
    white-space: nowrap;
    border: 2px solid transparent;
}

.gallery-badge .badge-text {
    font-weight: 600;
}

.gallery-badge .badge-count {
    font-size: 0.9em;
    opacity: 0.8;
    font-weight: 400;
}

/* Category gallery badges */
.gallery-badge.badge-category {
    background-color: var(--color-primary);
    color: var(--color-background);
}

.gallery-badge.badge-category:hover {
    background-color: var(--color-secondary);
    color: var(--color-background);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Tag gallery badges */
.gallery-badge.badge-tag {
    background-color: var(--color-secondary);
    color: var(--color-background);
}

.gallery-badge.badge-tag:hover {
    background-color: var(--color-primary);
    color: var(--color-background);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Site gallery badges (homepage) */
.gallery-badge.badge-site {
    background-color: var(--color-primary);
    color: var(--color-background);
}

.gallery-badge.badge-site:hover {
    background-color: var(--color-secondary);
    color: var(--color-background);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Search gallery badges */
.gallery-badge.badge-search {
    background-color: var(--color-secondary);
    color: var(--color-background);
}

.gallery-badge.badge-search:hover {
    background-color: var(--color-primary);
    color: var(--color-background);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Archive image mode card width constraint */
.archive-image-mode {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Traditional breadcrumbs for archive pages */
.archive-breadcrumbs {
    font-size: 0.8em;
    color: var(--color-text-light);
    margin: 10px 0 15px 0;
    padding: 0;
}

.archive-breadcrumbs a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.archive-breadcrumbs a:hover {
    color: var(--color-secondary);
    text-decoration: underline;
}

/* Mobile responsiveness */

/* ===== RANDOM DISCOVERY SECTION ===== */

.random-discovery {
    margin: 30px 0;
    padding: 20px 0;
    border-top: 3px dashed var(--color-secondary);
}

.random-discovery .widget-title {
    text-align: center;
    margin-bottom: 20px;
    background: var(--color-primary);
    color: var(--color-background);
    padding: 8px 15px;
    border-bottom: 4px solid #000;
    border-radius: 10px;
    width: max-content;
    margin: 0 auto 20px;
}

.discovery-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    gap: 15px;
}

.discovery-post {
    flex: 1 1 30%;
    max-width: 30%;
    min-width: 250px;
    text-align: center;
}

.discovery-post .entry-title {
    font-size: 1.1em;
    margin: 10px 0 5px;
    line-height: 1.4;
}

.discovery-post .entry-title a {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-color: var(--color-primary);
}

.discovery-post .entry-title a:hover {
    text-decoration-color: var(--color-secondary);
}

/* Mobile adjustments for discovery section */

@media (min-width: 992px) {
    .discovery-post {
        max-width: 29%;
    }
}

/* ===== FULL-WIDTH LAYOUT SYSTEM ===== */

/* Full-width layout for home and archive pages */
.home #primary, 
.archive #primary, 
.search #primary {
    width: 100%;
    max-width: 100%;
    float: none;
}

.home #secondary, 
.archive #secondary, 
.search #secondary {
    display: none;
}


/* Enhanced post grid for full-width layouts */
.home .post-grid,
.archive .post-grid,
.search .post-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 15px;
    margin: 15px 0;
}

.home .post-grid article,
.archive .post-grid article,
.search .post-grid article {
    flex: 1 1 calc(23% - 10px);
    max-width: calc(23% - 10px);
    margin: 0;
}

/* Responsive grid adjustments */
@media only screen and (max-width: 1199px) {
    .home .post-grid article,
    .archive .post-grid article,
    .search .post-grid article {
        flex-basis: calc(30% - 10px);
        max-width: calc(30% - 10px);
    }
}

@media only screen and (max-width: 991px) {
    .home .post-grid article,
    .archive .post-grid article,
    .search .post-grid article {
        flex-basis: calc(47% - 10px);
        max-width: calc(47% - 10px);
    }
}

@media only screen and (max-width: 768px) {
    /* Reduce header padding on mobile */
    .site-header {
        padding: 0 15px;
    }
    
    /* Fix search bar mobile gap */
    .header-search {
        margin: 0;
        padding: 20px;
    }
    
    .home .post-grid,
    .archive .post-grid,
    .search .post-grid {
        flex-direction: column;
        gap: 20px;
    }
    
    .home .post-grid article,
    .archive .post-grid article,
    .search .post-grid article {
        flex: 1 1 100%;
        max-width: 100%;
        position: relative;
        margin-bottom: 20px;
    }
    
    
    .home .content-wrap,
    .archive .content-wrap,
    .search .content-wrap {
        max-width: 100%;
    }
    
    /* Better spacing for mobile post titles */
    .home .entry-title,
    .archive .entry-title {
        font-size: 1.1em;
        line-height: 1.3;
        margin: 10px 0;
    }
    
    /* Reduce navigation font size on mobile */
    .main-navigation li {
        font-size: 20px;
    }
    
    /* Load more button mobile optimization */
    #load-more {
        width: 100%;
        max-width: 300px;
        margin: 20px auto;
        padding: 15px;
        font-size: 16px;
    }
    
    .load-more-container {
        text-align: center;
    }
}

/* ===== FOOTER PINTEREST BUTTON ===== */

.footer-pinterest {
    text-align: center;
    margin: 20px 0;
}

.pinterest-follow-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #E60023; /* Pinterest brand color */
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.pinterest-follow-btn:hover {
    background-color: #ad081b; /* Darker Pinterest red */
    color: white;
    border-color: var(--color-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(230, 0, 35, 0.3);
}

.pinterest-logo {
    flex-shrink: 0;
}

/* ===== FILTER BAR SYSTEM ===== */

.filter-bar {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 20px;
    margin: 20px auto 30px;
    max-width: 75%;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 600;
    color: var(--color-text);
    margin-right: 5px;
    white-space: nowrap;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    background: white;
    border: 2px solid var(--color-border);
    color: var(--color-text);
    padding: 8px 16px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
    transform: translateY(-1px);
}

.filter-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}


/* Secondary color for type filter buttons */
.type-btn {
    border-color: var(--color-secondary);
}

.type-btn:hover {
    border-color: var(--color-secondary);
    background: var(--color-secondary);
    color: white;
    transform: translateY(-1px);
}

.type-btn.active {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: white;
}


.filter-data {
    display: none;
}



/* Mobile responsiveness for filter bar */
@media (max-width: 768px) {
    .filter-bar {
        max-width: 95%;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        padding: 12px;
        margin: 15px auto 25px;
    }
    
    .filter-section {
        width: 100%;
        justify-content: center;
    }
    
    .filter-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .filter-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    
    /* Consolidated mobile touch targets */
    #random_posts a, #random_recipes a {
        min-height: 44px;
        padding: 12px;
    }
    
    #random-icon-link {
        padding: 8px;
    }
    
    /* Consolidated badge-breadcrumb mobile styles */
    .post-badge-breadcrumbs {
        margin: 10px auto 8px;
        gap: 6px;
    }
    
    .badge-breadcrumb {
        padding: 5px 10px;
        font-size: 0.7em;
    }
    
    .archive-breadcrumbs {
        font-size: 0.75em;
        margin: 8px auto 12px;
    }
    
    /* Gallery discovery badges mobile styles */
    .gallery-discovery-badges {
        margin: 15px 0 20px 0;
        padding: 15px;
        border-radius: 8px;
    }
    
    .gallery-badges-title {
        font-size: 1em;
        margin-bottom: 12px;
    }
    
    .gallery-badges-nav {
        gap: 8px;
    }
    
    .gallery-badge {
        padding: 6px 12px;
        font-size: 0.75em;
        gap: 5px;
        border-radius: 20px;
    }
    
    .gallery-badge .badge-count {
        font-size: 0.85em;
    }
    
    /* Consolidated discovery section mobile styles */
    .random-discovery {
        margin: 20px 0;
        padding: 15px 0;
    }
    
    .discovery-grid {
        flex-direction: column;
        gap: 20px;
    }
    
    .discovery-post {
        flex: 1 1 100%;
        max-width: 100%;
    }
    
    .discovery-post .post-thumbnail {
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .filter-bar {
        max-width: 98%;
        margin: 10px auto 20px;
        padding: 10px;
    }
    
    .filter-section {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .filter-buttons {
        width: 100%;
        justify-content: center;
        gap: 6px;
    }
    
    .filter-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 50px;
        min-height: 44px;
    }
    
    
    .home .entry-title,
    .archive .entry-title {
        font-size: 1em;
        margin: 12px 0;
    }
    
    /* Mobile-friendly Pinterest button */
    .pinterest-follow-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Image Gallery - Pinterest Style Masonry Layout */
/* Base layout uses CSS columns as a fallback; JS converts to fixed columns to avoid reshuffling */
.image-gallery {
    column-count: 4;
    column-gap: 1rem;
    margin: 2rem 0;
}

/* When JS initializes masonry, we replace CSS columns with flex containers for stable appends */
.image-gallery.masonry {
    column-count: initial;
    column-gap: 0;
    display: flex;
    gap: .5rem;
}

.image-gallery.masonry .gallery-col {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.image-gallery.masonry .gallery-item {
    margin-bottom: 0;
}

.gallery-item {
    position: relative;
    display: block;
    width: 100%;
    margin-bottom: 1rem;
    break-inside: avoid;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.gallery-image {
    width: 100%;
    height: auto;
    display: block;
}

.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.source-post-link {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.source-post-link:hover {
    color: #fff;
    text-decoration: none;
}

/* ===== IMAGE GALLERY DEEP LINK SUPPORT ===== */
/* Anchor wrapper around images inside single posts for direct deep links */
.sc-image-anchor {
    display: inline-block;
    scroll-margin-top: 40px; /* cushion for admin bar, adjust if header becomes sticky */
    position: relative;
}

/* Full-card link for gallery items */
.gallery-link {
    display: block;
    position: relative;
    text-decoration: none;
    color: inherit;
}

/* Ensure overlay doesn't block click */
.gallery-item-overlay { pointer-events: none; }

/* Keyboard accessibility: show overlay when focused */
.gallery-link:focus-visible .gallery-item-overlay { opacity: 1; }

/* Stronger focus outline encompassing entire card */
.gallery-link:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 12px;
}

.image-gallery-header {
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
}

.gallery-stats p {
    margin: 0.5rem 0;
    color: #666;
}

.back-to-posts a {
    color: #0073aa;
    text-decoration: none;
}

.back-to-posts a:hover {
    text-decoration: underline;
}

.no-images-found {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.no-images-found a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.no-images-found a:hover {
    text-decoration: underline;
}

.load-more-gallery {
    text-align: center;
    margin: 2rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    color: #666;
    column-span: all;
}

/* Image Gallery Responsive Design */
@media (max-width: 1200px) {
    .image-gallery:not(.masonry) { 
        column-count: 3; 
    }
}

@media (max-width: 768px) {
    .image-gallery:not(.masonry) {
        column-gap: 0.75rem;
    }
    
    .gallery-item {
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .gallery-item-overlay {
        padding: 0.75rem;
    }
    
    .source-post-link {
        font-size: 0.8rem;
    }
}

@media (max-width: 450px) {
    .image-gallery:not(.masonry) {
        column-count: 1;
        column-gap: 0;
    }
    
    .gallery-item {
        margin-bottom: 1rem;
    }
}
