/*
Theme Name: Gourmand
Description: A custom WordPress theme for food blogs with recipes, menus, reviews, and guides. Features a sticky header with dual navigation menus, responsive design, and custom post type support.
Version: 3.1.0
Author: TVG Development
Text Domain: gourmand
Domain Path: /languages
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

/* ===== RESET & BASICS ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    line-height: var(--leading-body-relaxed);
    color: #333;
    background-color: #fff;
    margin: 0;
    padding: 0;
}

/* ===== LAYOUT CONSTANTS ===== */
:root {
    --content-width: 1140px;
    --header-height: 80px;
    --header-height-shrunk: 60px;
    --footer-height: 200px;
    --primary-color: #000;
    --accent-color: #2271b1;
    --text-color: #333;
    --light-gray: #f8f9fa;
    --border-color: #e0e0e0;
}

/* ===== CONTAINER ===== */
.gourmand-container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0;
}

/* ===== HEADER ===== */
.gourmand-header {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--primary-color);
    z-index: 10002;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Account for WordPress admin bar */
.admin-bar .gourmand-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .gourmand-header {
        top: 46px;
    }
}

.gourmand-header-content {
    max-width: var(--content-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 20px;
    transition: height 0.3s ease;
}

/* Logo */
.gourmand-logo {
    flex: 0 0 40%;
    text-align: center;
    align-self: center;
}

.gourmand-logo a {
    color: white;
    text-decoration: none;
    font-family: var(--font-heading);
    font-size: var(--logo);
    font-weight: var(--weight-bold);
    line-height: var(--leading-heading-tight);
    transition: font-size 0.3s ease;
}

.gourmand-logo img {
    max-height: calc(var(--header-height) * 0.8);
    width: auto;
    transition: max-height 0.3s ease;
    vertical-align: middle;
}

/* Navigation Menus */
.gourmand-nav-left,
.gourmand-nav-right {
    flex: 0 0 30%;
}

.gourmand-nav-left {
    text-align: left;
}

.gourmand-nav-right {
    text-align: right;
}

.gourmand-nav-left ul,
.gourmand-nav-right ul {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.gourmand-nav-left li,
.gourmand-nav-right li {
    border: none;
    border-bottom: none;
    margin: 0;
    padding: 0;
}

.gourmand-nav-right ul {
    justify-content: flex-end;
}

.gourmand-nav-left a,
.gourmand-nav-right a {
    color: var(--color-nav);
    text-decoration: none;
    font-family: var(--font-nav);
    font-size: var(--nav-m);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-nav);
    text-transform: uppercase;
    line-height: var(--leading-nav);
    padding: 10px 0;
    transition: color 0.3s ease, font-size 0.3s ease, padding 0.3s ease;
}

.gourmand-nav-left a:hover,
.gourmand-nav-right a:hover {
    color: #ccc;
    text-decoration: none;
}

/* Mobile Navigation */
.gourmand-mobile-nav {
    display: none;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.gourmand-hamburger,
.gourmand-search-icon {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
}

.gourmand-hamburger {
    order: 1;
}

.gourmand-logo-mobile {
    order: 2;
    flex-grow: 1;
    text-align: center;
}

.gourmand-search-icon {
    order: 3;
}

/* ===== MAIN CONTENT ===== */
.gourmand-main {
    /* Just a semantic wrapper - styling handled by .gourmand-container */
}

/* ===== FOOTER (Mobile-First) ===== */
.gourmand-footer {
    background: var(--primary-color);
    color: white;
}

.gourmand-footer-content {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.gourmand-footer-logo {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gourmand-footer-logo .gourmand-logo {
    flex: none;
    width: 200px;
    max-width: 200px;
}

.gourmand-footer-logo .gourmand-logo img {
    width: 100%;
    height: auto;
    max-height: none;
}

/* Social icons - hidden on mobile, stacked below logo */
.gourmand-footer-social {
    display: none;
}

.gourmand-footer-social-link {
    display: block;
    transition: opacity 0.2s ease;
}

.gourmand-footer-social-link:hover {
    opacity: 0.7;
}

.gourmand-footer-social-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: block;
    filter: invert(1);
}

/* Tablet (768px+) */
@media (min-width: 768px) {
    .gourmand-footer-content {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        position: relative;
    }

    .gourmand-footer-logo {
        flex: 1;
        justify-content: center;
    }

    .gourmand-footer-logo .gourmand-logo {
        max-width: 240px;
    }

    /* Show social icons on tablet+ */
    .gourmand-footer-social {
        display: flex;
        gap: 1rem;
        position: absolute;
        right: 1rem;
        align-items: center;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .gourmand-footer-logo .gourmand-logo {
        max-width: 280px;
    }

    .gourmand-footer-social {
        right: 2rem;
    }
}

/* Copyright */
.gourmand-copyright {
    background: white;
    text-align: center;
    padding: 1rem;
}

.gourmand-copyright,
.gourmand-copyright p {
    font-family: var(--font-nav);
    font-size: var(--nav-m);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-nav);
    text-transform: uppercase;
    line-height: var(--leading-nav);
    color: var(--color-copyright);
    margin: 0;
}

.gourmand-privacy-link {
    margin-top: 0.5rem;
}

.gourmand-privacy-link a {
    color: var(--color-copyright);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.gourmand-privacy-link a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ===== RESPONSIVE DESIGN ===== */
/* iPad portrait and below - Switch to mobile navigation */
@media (max-width: 1024px) {
    /* Hide desktop navigation and logo */
    .gourmand-nav-left,
    .gourmand-nav-right,
    .gourmand-header-content > .gourmand-logo {
        display: none;
    }

    /* Show mobile navigation */
    .gourmand-mobile-nav {
        display: flex;
    }

    .gourmand-header-content {
        padding: 0 10px;
    }

    /* Adjust logo size on mobile */
    .gourmand-logo-mobile {
        flex: 0 0 50%;
    }
}

/* Standard tablet breakpoint */
@media (max-width: 768px) {
    .gourmand-header-content {
        padding: 0 10px;
    }
}

/* iPhone portrait and below - Mobile optimizations */
@media (max-width: 440px) {
    .gourmand-header-content {
        padding: 0 15px;
    }

    .post-content {
        padding: 0;
    }
}

/* Mobile Global Overrides */
@media (max-width: 768px) {
    /* Reduce padding on posts for mobile - pages stay at 0 */
    .single:not(.page) .post-content,
    .page-template-page-post-style .post-content {
        padding: 15px !important;
    }

    /* Pages keep no padding */
    .page .post-content {
        padding: 0 !important;
    }
}

/* ===== UTILITIES ===== */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* Override WordPress core column gap */
:where(.wp-block-columns.is-layout-flex) {
    gap: 0 !important;
}

/* Add vertical separators between columns */
.wp-block-columns {
    position: relative;
}

.wp-block-column:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 2rem;
    bottom: 2rem;
    width: 1px;
    background-color: #e0e0e0;
}

.wp-block-column {
    position: relative;
}

.gourmand-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--weight-bold);
    line-height: var(--leading-heading-normal);
    color: var(--color-heading);
    margin-bottom: 1rem;
}

h1 { font-size: var(--heading-xl); }
h2 { font-size: var(--heading-l); }
h3 { font-size: var(--heading-m); }
h4 { font-size: var(--heading-s); }
h5 { font-size: var(--heading-xs); }
h6 { font-size: var(--heading-xxs); }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== MOBILE MENU MODAL ===== */
.gourmand-mobile-menu-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.gourmand-mobile-menu-content {
    background: white;
    width: 100%;
    height: 100%;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 10001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.gourmand-menu-open .gourmand-mobile-menu-content {
    transform: translateX(0);
}

.gourmand-mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gourmand-menu-open .gourmand-mobile-menu-overlay {
    opacity: 1;
}

.gourmand-mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-gray);
}

.gourmand-mobile-menu-header h2 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--heading-xs);
    font-weight: var(--weight-bold);
    line-height: var(--leading-heading-normal);
    color: var(--color-heading);
}

.gourmand-mobile-menu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    color: #666;
}

.gourmand-mobile-menu-nav {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(100% - 80px); /* Account for header space */
}

.gourmand-mobile-menu-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gourmand-mobile-menu-nav li {
    border-bottom: 1px solid var(--border-color);
}

.gourmand-mobile-menu-nav a {
    display: block;
    padding: 15px 0;
    color: var(--text-color);
    text-decoration: none;
    font-family: var(--font-nav);
    font-size: var(--nav-m);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-nav);
    text-transform: uppercase;
    line-height: var(--leading-nav);
    transition: color 0.3s ease;
    text-align: center;
}

.gourmand-mobile-menu-nav a:hover {
    color: var(--accent-color);
}

/* Larger mobile menu for tablets - intentional one-off size for touch UX */
@media (min-width: 768px) and (max-width: 1024px) {
    .gourmand-mobile-menu-nav a {
        font-size: 1.8rem;
        padding: 35px 0;
    }
}

/* ===== SEARCH MODAL ===== */
.gourmand-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.gourmand-search-content {
    background: white;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.gourmand-search-open .gourmand-search-content {
    transform: scale(1);
    opacity: 1;
}

.gourmand-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
}

.gourmand-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.gourmand-search-header h2 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--heading-xs);
    font-weight: var(--weight-bold);
    line-height: var(--leading-heading-normal);
    color: var(--color-heading);
}

.gourmand-search-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    color: #666;
}

.gourmand-search-form {
    padding: 20px;
}

/* Search form UI elements - sizes intentionally not tokenized (UI, not content) */
.gourmand-search-form input[type="search"] {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.gourmand-search-form button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.gourmand-search-form button:hover {
    background: #1a5e96;
}

/* ===== CONTENT STYLING ===== */
.posts-container {
    display: grid;
    gap: 40px;
    padding: 0;
}

.post-thumbnail {
    position: relative;
    overflow: hidden;
}

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

article:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-featured-image {
    margin-bottom: 30px;
    overflow: hidden;
    height: 250px;
}

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

.post-content {
    padding: 0;
    line-height: 1.7; /* Intentional: legacy wrapper, specific spacing for mixed content */
}

/* Add white background and padding for posts and custom post types (not pages) */
.single:not(.page) .post-content {
    background-color: #ffffff;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 30px; /* Desktop/tablet padding */
}

/* Pages get no padding or background */
.page .post-content {
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 0;
}

/* Exception: Apply post styling to pages using the Post Style Page template */
.page-template-page-post-style .post-content {
    background-color: #ffffff;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 30px; /* Desktop/tablet padding */
}

.post-title {
    margin-bottom: 15px;
}

.post-title a {
    color: var(--text-color);
    text-decoration: none;
}

.post-title a:hover {
    color: var(--accent-color);
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    font-family: var(--font-meta);
    font-size: var(--meta-m);
    font-weight: var(--weight-medium);
    letter-spacing: var(--tracking-meta);
    text-transform: uppercase;
    color: var(--color-meta);
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.read-more {
    display: inline-block;
    margin-top: 15px;
    font-family: var(--font-meta);
    font-size: var(--meta-m);
    font-weight: var(--weight-medium);
    letter-spacing: var(--tracking-meta);
    text-transform: uppercase;
    color: var(--accent-color);
    text-decoration: none;
}

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

/* ===== COMMENTS ===== */
.comments-area,
#comments,
#respond {
    padding-left: 30px;
    padding-right: 30px;
}

.comments-area {
    margin-top: 40px;
}

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

.page-numbers {
    display: inline-block;
    padding: 10px 15px;
    margin: 0 5px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.page-numbers:hover,
.page-numbers.current {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* ===== FOOTER ENHANCEMENTS ===== */
.gourmand-email-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.gourmand-email-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.gourmand-email-form input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.gourmand-email-form button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.gourmand-email-form button:hover {
    background: #1a5e96;
}

/* ===== HEADER SCROLL EFFECTS ===== */
.gourmand-header.scrolled {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.gourmand-header.shrunk {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.gourmand-header.shrunk .gourmand-header-content {
    height: var(--header-height-shrunk);
}

.gourmand-header.shrunk .gourmand-logo img {
    max-height: calc(var(--header-height-shrunk) * 0.8);
}

.gourmand-header.shrunk .gourmand-logo a {
    font-size: calc(var(--logo) * 0.78);
}

.gourmand-header.shrunk .gourmand-nav-left a,
.gourmand-header.shrunk .gourmand-nav-right a {
    font-size: calc(var(--nav-m) * 0.9);
    padding: 5px 0;
}

/* ===== BODY CLASSES ===== */
body.gourmand-menu-open,
body.gourmand-search-open {
    overflow: hidden;
}

/* ===== NO SHADOW TEMPLATE ===== */
/* No special styling needed - uses default article styling */

/* ===== SINGLE POST NARROW TEMPLATES ===== */
/* Used by single.php, single-gourmand_recipe_c.php, etc. */

.single-post-narrow {
    width: 100%;
}

.single-content-wrapper,
.single-comments-wrapper {
    max-width: var(--single-content-width, 720px);
    margin: 0 auto;
    padding: 0 1rem;
}

.single-post-title {
    font-family: var(--font-heading);
    font-size: var(--heading-l);
    font-weight: var(--weight-bold);
    line-height: var(--leading-heading-normal);
    color: var(--color-heading);
    margin: 0 0 1rem 0;
}

.single-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-family: var(--font-meta);
    font-size: var(--meta-m);
    font-weight: var(--weight-medium);
    letter-spacing: var(--tracking-meta);
    text-transform: uppercase;
    color: var(--color-meta);
}

.single-post-meta a {
    color: inherit;
    text-decoration: none;
}

.single-post-meta a:hover {
    color: var(--accent-color, #2271b1);
    text-decoration: underline;
}

.single-post-content {
    margin: 2rem 0;
    font-family: var(--font-body);
    font-size: var(--body-m);
    font-weight: var(--weight-normal);
    line-height: var(--leading-body-normal);
    color: var(--color-body);
}

.single-post-content p {
    margin-bottom: 1.5rem;
}

.single-post-content h2 {
    font-size: var(--heading-s);
    margin: 2rem 0 1rem;
}

.single-post-content h3 {
    font-size: var(--heading-xs);
    margin: 1.5rem 0 0.75rem;
}

.single-post-content img {
    max-width: 100%;
    height: auto;
}

.single-post-content blockquote {
    border-left: 4px solid var(--accent-color, #2271b1);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #555;
}

.single-post-tags {
    font-family: var(--font-meta);
    font-size: var(--meta-m);
    color: var(--color-meta);
}

.single-post-tags .tags-label {
    font-weight: var(--weight-semibold);
    margin-right: 0.5rem;
}

.single-post-tags a {
    color: inherit;
    text-decoration: none;
}

.single-post-tags a:hover {
    color: var(--accent-color, #2271b1);
    text-decoration: underline;
}

/* Comments wrapper */
.single-comments-wrapper {
    margin-top: 3rem;
}

/* Tablet and up */
@media (min-width: 768px) {
    .single-content-wrapper,
    .single-comments-wrapper {
        padding: 0 2rem;
    }

    .single-post-header {
        margin-bottom: 2.5rem;
        padding-bottom: 2rem;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .single-content-wrapper,
    .single-comments-wrapper {
        padding: 0;
    }
}

/* ===== REDUCED MOTION ===== */
/* Respects user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .gourmand-header,
    .gourmand-header-content,
    .gourmand-logo a,
    .gourmand-logo img,
    .gourmand-nav-left a,
    .gourmand-nav-right a,
    .gourmand-search-content,
    .page-numbers {
        transition: none;
    }

    .gourmand-header.scrolled {
        backdrop-filter: none;
    }
}

/* ===== LOW-END DEVICE PATH ===== */
/* JS adds .gourmand-low-end class based on hardware detection */
body.gourmand-low-end .gourmand-header {
    backdrop-filter: none;
    transition: none;
}

body.gourmand-low-end .gourmand-header-content,
body.gourmand-low-end .gourmand-logo a,
body.gourmand-low-end .gourmand-logo img,
body.gourmand-low-end .gourmand-nav-left a,
body.gourmand-low-end .gourmand-nav-right a {
    transition: none;
}

body.gourmand-low-end .gourmand-header.scrolled {
    backdrop-filter: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}