/*
Theme Name: Lite-v2
Theme URI: https://example.com/
Author: Олег
Author URI: https://google.com
Description: Лёгкая и быстрая тема с двухколоночной сеткой для блога. Улучшенная версия.
Version: 2.0.2
Requires at least: 5.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: two-columns, right-sidebar, custom-menu, post-formats, featured-images, translation-ready, modern, clean
Text Domain: lite-v2
*/

/*--------------------------------------------------------------
>>> TABLE OF CONTENTS:
----------------------------------------------------------------
# Reset & Basics
# Typography & Fonts
# Layout & Structure
    - Site Wrapper & Container
    - Header & Branding
    - Sidebar & Widgets (NEW)
    - Main Content
# Navigation & Menus
# Blog Grid & Posts
    - Post Grid Layout
    - Featured Image & Placeholder (FIXED)
# Single Post / Page
# Comments (IMPROVED)
# Forms & Search Widget (FIXED: Vertical/Adaptive)
# Footer
# Pagination
# Media Queries (Responsive)
# Editor Styles (FIX)
# Archive & 404 Styles (NEW)
--------------------------------------------------------------*/

/* # Reset & Basics
--------------------------------------------------------------*/
html {
    font-family: Merriweather, serif;
    font-size: 18px; 
    font-weight: 400;
    line-height: 1.7; 
    margin-top: 0 !important;
}

body {
    color: #333; 
    background-color: #F8F8F8; 
    margin: 0;
}

*, *:before, *:after {
    box-sizing: border-box;
}

a {
    color: #333;
    text-decoration: none;
    background-image: linear-gradient(to bottom, #F26E3F 0%, #F26E3F 100%);
    background-repeat: no-repeat;
    background-size: 0 2px; 
    background-position: 0 95%;
    transition: background-size .25s ease-out;
}

a:hover {
    color: #F26E3F;
    background-size: 100% 2px;
}

img {
    max-width: 100%;
    height: auto;
    border: none !important;
    box-shadow: none !important;
    display: block; 
}

/* # Typography & Fonts
--------------------------------------------------------------*/
h1, h2, h3, h4, h5, h6 {
    font-family: Merriweather, serif;
    font-weight: 700; 
    color: #222;
    margin: 0.7em 0 0.5em;
    line-height: 1.3;
}
h1 { font-size: 2.5em; }
h2 { font-size: 2.1em; }
h3 { font-size: 1.7em; }
p { margin: 0 0 1.2em; }

.entry-title {
    font-family: Merriweather, serif;
    color: #333;
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 0.5em;
    line-height: 1.4;
}

.entry-title a {
    background-image: linear-gradient(to bottom, #333 0%, #333 100%);
}

#site-title {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 2.2em;
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

#site-description {
    font-family: Lato, sans-serif;
    font-size: 0.9em;
    font-weight: 400;
    color: #888;
    margin-top: 0.5em;
}

/* # Layout & Structure
--------------------------------------------------------------*/
#site-wrapper {
    max-width: 1300px; 
    margin: 0 auto;
    padding: 20px;
}

#content {
    padding: 0;
}

#container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px; 
}

.main {
    width: calc(100% - 350px - 30px);
    margin-top: 0;
    flex-grow: 1;
    order: 1;
}

/* ## Header & Branding */
#header {
    background: transparent; 
    padding: 0;
    border-bottom: none;
    text-align: center;
}
#branding {
    padding: 2em;
    background-color: #fff;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

/* ## Sidebar */
#sidebar {
    width: 350px;
    background-color: #F8F8F8; 
    padding: 0;
    margin-left: 0; 
    position: sticky;
    top: 20px;
    align-self: flex-start;
    order: 2;
}

/* # Navigation & Menus
--------------------------------------------------------------*/
#access {
    margin-top: 1.5em;
    background-color: #fff;
    padding: 10px 0;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

#access ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

#access ul li {
    margin: 0;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    padding: 0;
}

#access ul li:last-child {
    border-bottom: none;
}

#access ul li a {
    display: block;
    font-family: Lato, sans-serif;
    font-size: 1em;
    font-weight: 500;
    color: #555;
    background-image: none;
    padding: 12px 20px;
    transition: background-color .2s;
}

#access ul li a:hover {
    color: #F26E3F;
    background-color: #fcfcfc;
}

/* # Blog Grid & Posts
--------------------------------------------------------------*/
#content-masonry {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px; 
}

article.hentry {
    background-color: #fff;
    padding: 0; 
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.07); 

    display: flex;
    flex-direction: column;
    overflow: hidden; 
}

.entry-body-wrap {
    padding: 20px;
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
}
.entry-summary {
    flex-grow: 1; 
    margin-bottom: 1em;
}

/* --- FIX: стабильный контейнер превью + отображение картинки --- */
.post-thumbnail-container {
    position: relative;
    margin-bottom: 0; 
    
    aspect-ratio: 16 / 10; 
    height: auto;
    overflow: hidden;
    background-color: #ececec;
    
    background-image: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    background-size: cover;
    background-position: center;
}

.post-thumbnail-container img {
    /* FIX: Убрана opacity: 0, чтобы изображение было видно */
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: none; 
}

.entry-meta-overlay {
    position: static;
    background: transparent;
    color: #888;
    padding: 15px 20px 0;
    font-size: 0.8em;
    font-family: Lato, sans-serif;
    pointer-events: auto; 
}

.entry-meta-overlay .author a,
.entry-meta-overlay .onDate {
    color: #888;
    background-image: none;
}

.entry-meta-overlay .author a:hover {
    color: #F26E3F;
}

.entry-meta-overlay span:not(:last-child):after {
    content: '•'; 
    margin: 0 0.5em;
}

/* # Single Post / Page
--------------------------------------------------------------*/
.main.single-post .hentry,
.main.single-page .hentry { 
    padding: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.07);
    border-radius: 6px;
    background-color: #fff;
}

.main.single-post .post-thumbnail-container,
.main.single-page .post-thumbnail-container {
    border-radius: 4px;
    margin-bottom: 2em;
    aspect-ratio: 16 / 9; 
}

.main.single-post .entry-title,
.main.single-page .entry-title {
    font-size: 2em; 
    margin-top: 0;
    margin-bottom: 1em;
}
.main.single-post h1,
.main.single-post h2,
.main.single-post h3,
.main.single-page h1,
.main.single-page h2,
.main.single-page h3 {
    font-size: 1.4em;
    font-weight: 700;
    color: #333;
    padding-bottom: 8px;
    border-bottom: 2px solid #F26E3F; 
    margin-top: 1.8em;
    margin-bottom: 1em;
}
.entry-content p {
    margin-bottom: 1.5em;
}
.entry-content a {
    background-position: 0 100%;
}


/* # Comments
--------------------------------------------------------------*/
.comments-area {
    margin-top: 2.5em;
    padding: 30px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.07);
}

.comments-title {
    font-size: 1.7em;
    margin-bottom: 1em;
}

.comment-list {
    list-style: none;
    padding: 0;
}

.comment-list li {
    padding: 1.5em 0;
    border-bottom: 1px dashed #ddd; 
}

.comment-list li:last-child {
    border-bottom: none;
}

.comment-author img.avatar {
    float: left;
    margin-right: 1.2em;
    border-radius: 50%;
    border: 3px solid #F26E3F; 
}

.comment-metadata {
    font-size: 0.9em;
    color: #888;
}

.comment-content {
    margin-top: 0.8em;
    clear: both;
}

/* # Forms & Search Widget (FIXED: Vertical/Adaptive)
--------------------------------------------------------------*/
.comment-form p {
    margin-bottom: 1.2em;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea,
.widget_search input[type="search"],
.search-form input[type="search"] { 
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color .2s;
    font-family: Lato, sans-serif;
    box-sizing: border-box; /* Важно, чтобы padding не ломал 100% ширины */
}

.comment-form input:focus,
.comment-form textarea:focus,
.widget_search input[type="search"]:focus,
.search-form input[type="search"]:focus {
    border-color: #F26E3F;
    outline: none;
}

.comment-form input[type="submit"],
.widget_search input[type="submit"],
.search-form input[type="submit"] { 
    background: #F26E3F;
    color: #fff;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    transition: background .2s, transform .1s;
    background-image: none;
    border-radius: 4px;
    font-weight: 700;
    box-sizing: border-box; /* Важно, чтобы padding не ломал 100% ширины */
}

.comment-form input[type="submit"]:hover,
.widget_search input[type="submit"]:hover,
.search-form input[type="submit"]:hover {
    background: #e06030;
    transform: translateY(-1px);
}

/* ## Search Widget Specific (FIXED: Vertical/Adaptive) */
.widget_search form,
.search-form {
    display: flex;
    flex-direction: column; /* Вертикальное размещение */
    gap: 10px; /* Отступ между полем и кнопкой */
    align-items: stretch; /* Растягиваем элементы на всю ширину контейнера */
}

.widget_search input[type="search"],
.search-form input[type="search"] {
    flex-grow: 1; 
    width: 100%; 
    margin: 0; 
}

.widget_search input[type="submit"],
.search-form input[type="submit"] {
    flex-shrink: 0;
    width: 100%; /* Кнопка занимает всю ширину */
    padding-left: 15px;
    padding-right: 15px;
}

/* --- КЛЮЧЕВОЕ ИСПРАВЛЕНИЕ: Мы не скрываем LABEL, чтобы не скрыть INPUT внутри него. --- */
/* Мы скрываем только вспомогательный текст, который обычно находится внутри label */
.search-form label span.screen-reader-text,
.search-form label span.search-field-label { 
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
/* Мы гарантируем, что сам элемент <label> отображается корректно */
.widget_search label,
.search-form label {
    display: block; /* Убеждаемся, что label отображается и занимает место */
    width: 100%; /* Он должен занимать всю ширину, чтобы его input был 100% */
}

/* # Widgets
--------------------------------------------------------------*/
.widget-container {
    font-family: Merriweather, serif;
    font-size: 1em;
    font-weight: 400;
    margin-bottom: 30px;
    background-color: #fff;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.widget-title {
    font-family: Lato, sans-serif;
    font-size: 1em;
    font-weight: 700;
    color: #333;
    border-bottom: 2px solid #F26E3F;
    padding-bottom: 0.5em;
    margin-bottom: 1em;
}

.widget-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget-container ul li {
    margin-bottom: 8px;
    border: none;
    border-bottom: 1px dashed #eee;
    padding: 5px 0;
}

.widget-container ul li a {
    background-image: linear-gradient(to bottom, #333 0%, #333 100%);
    background-position: 0 95%;
}
.widget-container ul li a:hover {
    color: #F26E3F;
}

/* # Footer
--------------------------------------------------------------*/
#footer {
    text-align: center;
    padding: 2em 0;
    margin-top: 30px;
    border-top: 1px solid #eeeeee;
    color: #888;
    font-size: 0.9em;
}

/* # Pagination
--------------------------------------------------------------*/
.navigation.pagination {
    margin: 2em 0;
    text-align: center;
    width: 100%;
}

.nav-links {
    display: inline-flex;
    gap: 8px;
}

.page-numbers {
    display: inline-block;
    padding: 8px 15px;
    border: 1px solid #ddd;
    color: #555;
    background-color: #fff;
    font-size: 1em;
    line-height: 1.5;
    background-image: none;
    border-radius: 4px;
    text-align: center;
    transition: all .2s;
}

.page-numbers:hover {
    background-color: #f26e3f;
    border-color: #f26e3f;
    color: #fff;
}

.page-numbers.current {
    background-color: #333;
    border-color: #333;
    color: #fff;
}

.page-numbers.dots {
    border: none;
    background: none;
    padding: 8px 0;
}

/* # Related Posts
--------------------------------------------------------------*/
.related-posts {
    margin-top: 2em;
    padding: 30px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.07);
}
.related-posts h3 {
    font-size: 1.5em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-top: 0;
}
.related-posts ul {
    list-style: none;
    padding: 0;
    margin-top: 1em;
}
.related-post-item {
    border: none;
    border-bottom: 1px dashed #eee;
    border-radius: 0;
    padding: 10px 0;
    margin-bottom: 0;
    background-color: transparent;
}
.related-post-item a {
    font-weight: 500;
}

/* # Archive & 404 Styles (NEW)
--------------------------------------------------------------*/
.page-header {
    background-color: #fff;
    padding: 30px;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.07);
    margin-bottom: 30px;
}

.page-title {
    font-size: 2em;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0.5em;
    color: #222;
}

.taxonomy-description {
    font-size: 1em;
    color: #666;
    margin-top: 1em;
    padding-top: 1em;
    border-top: 1px dashed #eee;
}

.error-404-main .page-404-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.07);
    text-align: center;
}

.error-404-main .page-content {
    max-width: 500px;
    margin: 0 auto;
}

.error-404-main .page-content ul {
    list-style: none;
    padding: 0;
    margin-top: 1em;
    text-align: left;
    display: inline-block;
}
.error-404-main .page-content li {
    padding: 5px 0;
    border-bottom: 1px dashed #eee;
}


/* # Media Queries (Responsive)
--------------------------------------------------------------*/
@media (max-width: 1024px) {
    #container {
        flex-direction: column;
        gap: 0;
    }
    .main {
        width: 100%;
        order: 1;
    }
    #sidebar {
        width: 100%;
        margin-top: 30px;
        position: static;
        order: 2;
    }
    #site-wrapper {
        padding: 10px;
    }
    #content-masonry {
        gap: 20px;
    }
    .page-header {
        margin-bottom: 20px;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    #content-masonry {
        grid-template-columns: 1fr;
    }
    html {
        font-size: 17px;
    }
    .main.single-post .hentry,
    .main.single-page .hentry {
        padding: 20px;
    }
    .main.single-post .entry-title,
    .main.single-page .entry-title {
        font-size: 1.8em;
    }
}

/* # Editor Styles (FIX)
--------------------------------------------------------------*/
/* Стиль для блока изображения в редакторе Gutenberg */
.wp-block-image img {
    height: auto;
    width: auto;
    max-width: 100%;
}