/*
Theme Name: BlogNews
Description: A modern, multipurpose WordPress theme combining blog and newspaper functionality with Full Site Editing support, responsive design, and advanced customization options.
Author: BlogNews Team
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 8.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: blognews
Tags: blog, news, magazine, newspaper, responsive, accessibility-ready, custom-colors, custom-logo, custom-menu, editor-style, featured-images, footer-widgets, full-site-editing, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready, block-styles, wide-blocks
*/

/* CSS Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    line-height: 1.15;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 1rem 0;
    font-weight: 700;
    line-height: 1.2;
    color: #222;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin: 0 0 1rem 0;
}

a {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover,
a:focus {
    color: #005177;
    text-decoration: underline;
}

/* Layout Components */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col {
    flex: 1;
    padding: 0 15px;
}

.col-1 { flex: 0 0 8.333333%; }
.col-2 { flex: 0 0 16.666667%; }
.col-3 { flex: 0 0 25%; }
.col-4 { flex: 0 0 33.333333%; }
.col-6 { flex: 0 0 50%; }
.col-8 { flex: 0 0 66.666667%; }
.col-9 { flex: 0 0 75%; }
.col-12 { flex: 0 0 100%; }

/* Header Styles */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e1e1e1;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.site-header.header-hidden {
    transform: translateY(-100%);
}

.header-top {
    background: #f8f9fa;
    border-bottom: 1px solid #e1e1e1;
    padding: 8px 0;
    font-size: 14px;
}

.header-main {
    padding: 15px 0;
}

.site-branding {
    display: flex;
    align-items: center;
}

.site-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
    color: #222;
}

.site-description {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Breaking News Ticker */
.breaking-news {
    background: #dc3545;
    color: #fff;
    padding: 10px 0;
    overflow: hidden;
    position: relative;
}

.breaking-news-label {
    background: #c82333;
    padding: 5px 15px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    display: inline-block;
    margin-right: 15px;
}

.breaking-news-content {
    display: inline-block;
    white-space: nowrap;
    animation: ticker 30s linear infinite;
}

@keyframes ticker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Navigation */
.main-navigation {
    position: relative;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.main-navigation li {
    position: relative;
}

.main-navigation a {
    display: block;
    padding: 15px 20px;
    color: #333;
    font-weight: 500;
    transition: all 0.3s ease;
}

.main-navigation a:hover,
.main-navigation a:focus {
    background: #f8f9fa;
    color: #0073aa;
    text-decoration: none;
}

/* Mega Menu */
.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #e1e1e1;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    min-width: 600px;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.main-navigation li:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
}

.mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e1e1e1;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.mobile-menu.active {
    display: block;
}

/* Search Toggle */
.search-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 10px;
    color: #333;
}

.search-form-container {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #e1e1e1;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding: 20px;
    min-width: 300px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.search-form-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Content Area */
.site-content {
    padding: 40px 0;
}

.content-area {
    flex: 1;
}

.site-main {
    margin-bottom: 40px;
}

/* Post Styles */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.post-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

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

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

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

.post-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #dc3545;
    color: #fff;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 3px;
}

.post-badge.featured {
    background: #ffc107;
    color: #000;
}

.post-badge.trending {
    background: #28a745;
}

.post-content {
    padding: 20px;
}

.post-title {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    line-height: 1.3;
}

.post-title a {
    color: #222;
}

.post-title a:hover {
    color: #0073aa;
}

.post-meta {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.post-meta a {
    color: #666;
}

.post-meta a:hover {
    color: #0073aa;
}

.post-excerpt {
    margin-bottom: 15px;
    color: #555;
}

.read-more {
    color: #0073aa;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 14px;
}

/* Sidebar */
.sidebar {
    flex: 0 0 300px;
    margin-left: 40px;
}

.widget {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.widget-title {
    margin: 0 0 20px 0;
    font-size: 1.25rem;
    color: #222;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.widget ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.widget li:last-child {
    border-bottom: none;
}

/* Footer */
.site-footer {
    background: #222;
    color: #fff;
    padding: 40px 0 20px;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-widget h3 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.125rem;
}

.footer-widget ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-widget li {
    margin-bottom: 8px;
}

.footer-widget a {
    color: #ccc;
}

.footer-widget a:hover {
    color: #fff;
}

.site-info {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #444;
    color: #ccc;
    font-size: 14px;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #005177;
    transform: translateY(-3px);
}

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

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: #21759b;
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Focus Styles */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e1e1e1;
    }
    
    .site-header {
        background: #222;
        border-bottom-color: #444;
    }
    
    .post-card {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .widget {
        background: #2a2a2a;
        border-color: #444;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    a {
        text-decoration: underline;
    }
    
    .post-card {
        border-width: 2px;
    }
    
    button,
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .breaking-news-content {
        animation: none;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .row {
        margin: 0 -10px;
    }
    
    .col {
        padding: 0 10px;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .main-navigation ul {
        display: none;
    }
    
    .sidebar {
        flex: none;
        margin-left: 0;
        margin-top: 40px;
    }
    
    .post-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .footer-widgets {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .site-content {
        padding: 20px 0;
    }
    
    .post-content {
        padding: 15px;
    }
    
    .widget {
        padding: 15px;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* Print Styles */
@media print {
    .site-header,
    .sidebar,
    .site-footer,
    .back-to-top,
    .mobile-menu-toggle,
    .search-toggle {
        display: none;
    }
    
    .site-content {
        padding: 0;
    }
    
    a {
        text-decoration: underline;
    }
    
    .post-card {
        border: 1px solid #000;
        margin-bottom: 20px;
        break-inside: avoid;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.hidden { display: none; }
.invisible { visibility: hidden; }
.visible { visibility: visible; }
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}
