/* /css/main.css */

/* NEW: Import a modern font for the logo */
@import url('https://fonts.googleapis.com/css2?family=Oxanium:wght@600&family=Poppins:wght@600&display=swap'); /* Added Oxanium */


:root {
    --primary-color: #3A4750;      /* Softer Dark Slate */
    --secondary-color: #D19E5D;    /* Richer Golden Amber */
    --background-color: #ffffff;   /* Ensured pure white */
    --surface-color: #ffffff;      /* Ensured pure white */
    --text-color: #2A2F3A;         /* Softer Almost Black */
    --text-light-color: #718096;   /* Slate Gray */
    --border-color: #e2e8f0;       /* Light Gray */
    --shadow-color: rgba(0, 0, 0, 0.08); /* Slightly more prominent shadow */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --top-announcement-bar-height: 28px; /* Height of the top announcement bar */
     /* Calculate desktop header height (header-top-row + tagline + main-nav padding) */
    --site-header-desktop-height: 120px; /* Estimated height for desktop header with 3 rows */
    /* REVISED: Increased mobile header height to accommodate tagline */
    --site-header-mobile-height: 70px; /* Approx height for mobile header (logo + tagline + padding) */ 

     /* Total height of ALL fixed elements at the top for desktop */
    --header-total-height: calc(var(--top-announcement-bar-height) + var(--site-header-desktop-height));

    /* NEW: Approximate height of the mobile category navigation bar */
    --mobile-category-nav-height: 46px; /* 0.5rem top + 0.5rem bottom padding + 20px link height + 1px border */
     /* NEW: Approximate height for static page headers (logo only) */
    --site-header-static-height: 80px; /* Adjust based on logo/announcement bar */
}


/* Global Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* FIX: Add padding-top to body to push content down from fixed header */
body {
    font-family: var(--font-family);
    background-color: var(--background-color); /* This now refers to pure white */
    color: var(--text-color);
    line-height: 1.6;
    padding-top: var(--header-total-height); /* THIS IS THE KEY FIX FOR DESKTOP */
}

body.static-page-body {
    /* Calculate padding-top based on top bar + static header height */
    padding-top: calc(var(--top-announcement-bar-height) + var(--site-header-static-height));
}

/* Ensure smooth scrolling when navigating to hash links, accounting for sticky header */
html {
	scroll-padding-top: var(--header-total-height); /* Use the same variable for consistency */
    scroll-behavior: smooth; /* Keep smooth scrolling */
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

a:hover {
    /* A slightly darker amber for hover effect */
    color: #dd9b4d; 
}

img {
    max-width: 100%;
    display: block;
}

/* Main Layout - This class is no longer used, but kept for reference */
.content-area {
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}


/* --- Scroll to Top Button Styles --- */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background-color: var(--secondary-color);
}

/* --- REMOVED: Custom Cursor Styles --- */
/*
@media (hover: hover) and (pointer: fine) {
    * {
        cursor: none;
    }
}

.cursor-dot,
.cursor-outline {
    pointer-events: none;
    position: fixed;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    opacity: 0;
    transform: translate(-50%, -50%);
    z-index: 9999;
    transition: opacity 0.3s ease-in-out, transform 0.2s ease-in-out;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: var(--secondary-color);
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 2px solid var(--secondary-color);
    transition-duration: 0s;
}

.cursor-outline.grow {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0.5;
}
*/


/* --- NEW: Loading Screen Styles --- */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color); /* Matches your site background (now pure white) */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Ensure it's on top of everything */
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out; /* For fade out effect */
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Allows clicks through once hidden */
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--secondary-color); /* Use your amber secondary color for a modern look */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite; /* Spin animation */
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-screen p {
    font-size: 1.25rem; /* Slightly larger text */
    color: var(--primary-color); /* Use your primary dark slate color for better contrast */
    font-family: 'Poppins', var(--font-family); /* Use the same modern font as your logo */
    font-weight: 600; /* Make it bolder */
    opacity: 0; /* Start hidden for animation */
    animation: text-fade-in 1s ease-out forwards; /* Text fade-in animation */
    animation-delay: 0.2s; /* Delay the text animation slightly after spinner starts */
}

@keyframes text-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Mobile Menu Overlay Styles (REVISED for left-to-right slide) --- */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    /* REVISED: Start hidden on the left, occupy 0 width */
    left: 0;
    width: 0; /* Start with 0 width */
    height: 100vh; /* Occupy full height of the viewport */
    background-color: var(--surface-color);
    z-index: 1050;
    overflow-x: hidden; /* Hide horizontal overflow when collapsed */
    overflow-y: auto; /* Allow vertical scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    /* REVISED: Transition width and transform for slide effect */
    transition: width 0.3s ease-in-out, transform 0.3s ease-in-out, background-color 0.3s ease;

    /* Initially off-screen to the left */
    transform: translateX(-100%);
    box-shadow: none; /* No shadow when collapsed */
}

.mobile-menu-overlay.active {
    /* REVISED: Expand to desired width and slide into view */
    width: 85%; /* Occupy 85% of screen width (adjust to 80% or 90% as desired) */
    transform: translateX(0); /* Slide into view */
    background-color: var(--surface-color);
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1); /* Add shadow when active, sliding from left */
}

/* REVISED: Mobile Menu Header (Social links and Close Button) */
.mobile-menu-header {
    width: 100%;
    padding: 0.75rem 4%; 
    background-color: var(--surface-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0; 
}

/* NEW: Social links in mobile menu header */
.mobile-menu-header .social-links {
    display: flex;
    gap: 0.75rem;
}
.mobile-menu-header .social-links a {
    color: var(--primary-color);
    transition: color 0.2s ease, transform 0.2s ease;
}
.mobile-menu-header .social-links a:hover {
    color: var(--secondary-color);
    transform: scale(1.1);
}
.mobile-menu-header .social-links svg {
    width: 22px; /* Slightly smaller for mobile header */
    height: 22px;
}

.close-overlay-btn { /* Re-used from header.css for consistency */
    background: none;
    border: none;
    color: var(--text-light-color);
    font-size: 2rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
}
.close-overlay-btn:hover {
    color: var(--primary-color);
}

/* REVISED: Overlay Content area for mobile */
.mobile-menu-overlay .overlay-content {
    width: 100%;
    padding: 2rem 5%; /* Padding for content within overlay */
    overflow-y: auto; /* Allow scrolling if content is long */
    flex-grow: 1; /* Allow content to take available height */
}

/* REUSED: Subscribe link and separator */
/* Adjusted for smaller size in mobile overlay */
.mobile-menu-overlay .subscribe-link {
    display: block;
    text-align: center;
    padding: 0.6rem 1.5rem; /* Reduced padding */
    font-size: 0.9rem; /* Reduced font size */
    background-color: var(--secondary-color);
    color: white;
    font-weight: 600;
    border-radius: 30px;
    margin-bottom: 1.5rem; /* Reduced margin */
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.mobile-menu-overlay .subscribe-link:hover {
    background-color: #dd9b4d;
    transform: translateY(-2px);
}
.mobile-menu-overlay .overlay-separator {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0; /* Reduced margin */
}

/* REUSED: Overlay search container */
/* Adjusted for smaller size in mobile overlay */
.mobile-menu-overlay .overlay-search-container {
    margin-bottom: 1.5rem; /* Reduced margin */
    position: relative; /* CRUCIAL for search results dropdown positioning */
}

.mobile-menu-overlay .overlay-search-container input {
    width: 100%;
    padding: 0.8rem 1.2rem; /* Reduced padding */
    border-radius: 4px; /* Changed from 25px to 4px for a square look */
    border: 2px solid var(--border-color);
    font-size: 1rem; /* Reduced font size */
    text-align: center;
    transition: all 0.3s ease;
}

.mobile-menu-overlay .overlay-search-container input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(209, 158, 93, 0.2);
}

/* NEW: Mobile Sort Container Styles within the overlay */
.mobile-menu-overlay .overlay-search-container .sort-container {
    margin-top: 1rem; /* Space between search input and sort dropdown */
    position: relative;
    display: none; /* Changed from 'block' to 'none' to hide it */
}

.mobile-menu-overlay .overlay-search-container #mobileOverlaySortSelect {
    width: 100%;
    padding: 0.7rem 1.2rem; /* Reduced padding for smaller input */
    border-radius: 25px; /* Slightly smaller border radius */
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    font-size: 0.9rem; /* Reduced font size */
    color: var(--text-color);
    -webkit-appearance: none; /* Remove default dropdown arrow */
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
    padding-right: 2.5rem; /* Space for the custom arrow */
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-overlay .overlay-search-container #mobileOverlaySortSelect:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(209, 158, 93, 0.2);
}


/* REVERTED for mobile overlay: search results dropdown needs its old style */
.mobile-menu-overlay .search-results-dropdown {
    position: absolute; /* Changed to absolute for proper dropdown behavior */
    top: calc(100% + 5px); /* Position below the search input, add small gap */
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 16px var(--shadow-color);
    z-index: 999;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.mobile-menu-overlay .search-results-dropdown.visible {
    display: block;
}

.mobile-menu-overlay .result-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-color);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-menu-overlay .result-item:last-child {
    border-bottom: none;
}

.mobile-menu-overlay .result-item:hover {
    background-color: var(--background-color);
    color: var(--secondary-color);
}

.mobile-menu-overlay .result-item .category {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light-color);
    margin-left: 0.5rem;
}

.mobile-menu-overlay .empty-search-results {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-light-color);
    font-style: italic;
}


/* REVISED: Mobile Main Nav for the overlay (now part of overlay-content) */
.mobile-main-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    align-items: flex-start;
}

/* Style for the text span within mobile-nav-item */
.mobile-nav-item .mobile-nav-link-text {
    display: block;
    color: var(--text-color);
    font-size: 1.3rem;
    font-weight: 500;
    text-decoration: none;
    width: 100%;
    padding: 1rem 0; /* Padding relative to its container */
    text-align: left;
    transition: color 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.mobile-nav-item .mobile-nav-link-text:hover {
    color: var(--secondary-color);
}


/* Base style for direct navigation links (Home, Favorites) */
.mobile-nav-link {
    display: block;
    width: 100%;
    padding: 1rem 0; /* Apply padding here for direct links */
    color: var(--text-color);
    font-size: 1.3rem;
    font-weight: 500;
    text-decoration: none;
    text-align: left;
    transition: all 0.2s ease, background-color 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.mobile-nav-link:last-child {
    border-bottom: none;
}

.mobile-nav-link:hover {
    background-color: var(--background-color);
    color: var(--secondary-color);
}

/* REMOVED: Arrow icon for expandable mobile-nav-item as it's no longer needed */
.mobile-nav-arrow {
    display: none;
}

/* Mobile Sub-menu Container - Always expanded now */
.mobile-sub-menu {
    max-height: none;
    overflow: visible;
    width: 100%;
    background-color: transparent;
    padding-top: 1rem;
    padding-bottom: 1rem;
    margin-top: 0;
}

/* Specific styles for content within mobile sub-menu */
.mobile-sub-menu .mobile-tag-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem 0.5rem;
    padding: 0; /* Remove horizontal padding here, handled by parent overlay-content */
    margin-bottom: 1.5rem;
}

.mobile-sub-menu .tag-pill {
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

.mobile-sub-menu .sub-menu-separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 1rem 0; /* Removed horizontal padding */
}

.mobile-sub-menu .mobile-articles-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0; /* Removed horizontal padding here, handled by parent overlay-content */
}

.mobile-sub-menu .mobile-article-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s ease;
    padding: 0.5rem;
    border-radius: 4px;
}

.mobile-sub-menu .mobile-article-card:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.mobile-sub-menu .mobile-article-card-image {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.mobile-sub-menu .mobile-article-card-content {
    flex-grow: 1;
}

.mobile-sub-menu .mobile-article-card-title {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-sub-menu .mobile-article-card-date {
    font-size: 0.75rem;
    color: var(--text-light-color);
}