/*
Theme Name: FastBlog
Theme URI: https://example.com/fastblog
Author: Antigravity
Author URI: https://example.com
Description: Сверхлегкая, скоростная и адаптивная тема для блога на WordPress с поддержкой темной шапки, кастомизатора, бесконечной подгрузки статей и оптимизацией Core Web Vitals.
Version: 1.0.4
Tested up to: 6.7
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: fastblog
Tags: blog, clean, responsive, custom-colors, custom-header, custom-menu, featured-images, full-width-template
*/

/* ==========================================================================
   Reset & Base Variables
   ========================================================================== */
:root {
    --fb-header-bg: #111111;
    --fb-header-text: #ffffff;
    --fb-header-accent: #ffffff;
    --fb-header-border: rgba(255, 255, 255, 0.1);
    
    --fb-bg-color: #ffffff;
    --fb-text-color: #1a1a1a;
    --fb-text-muted: #737373;
    --fb-border-color: #e5e5e5;
    
    --fb-cta-bg: #111111;
    --fb-cta-text: #ffffff;
    
    --fb-font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --fb-menu-font: 'Montserrat', sans-serif;
    --fb-container-width: 1200px;
    --fb-header-height: 80px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: var(--fb-font-family);
    font-size: 16px;
    line-height: 1.6;
    color: var(--fb-text-color);
    background-color: var(--fb-bg-color);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease, color 0.2s ease;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

ul, ol {
    list-style: none;
}

/* ==========================================================================
   1. Layout & Containers
   ========================================================================== */
.fb-container {
    width: 100%;
    max-width: var(--fb-container-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

.fb-site-main {
    flex: 1 0 auto;
    padding-bottom: 60px;
}

/* ==========================================================================
   1.1. Шаблон главной страницы (Лендинг)
   ========================================================================== */
.fb-landing-container {
    padding-top: 50px;
    padding-bottom: 70px;
}

/* 1. Блок героя: Заголовок и приветственный текст */
.fb-landing-hero {
    text-align: center;
    max-width: 900px;
    margin: 0 auto 50px;
}

.fb-landing-hero__title {
    font-family: var(--fb-menu-font);
    font-size: 2.25rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    color: var(--fb-text-color);
}

@media (min-width: 768px) {
    .fb-landing-hero__title {
        font-size: 2.75rem;
    }
}

.fb-landing-hero__text {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #4b5563;
}

/* 2 & 4. Блоки произвольного кода */
.fb-landing-custom {
    margin-bottom: 50px;
}

/* 3. Сетка карточек проектов/ресурсов (2 на ПК, 1 на мобильном) */
.fb-landing-projects {
    margin-bottom: 60px;
}

.fb-project-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

@media (min-width: 860px) {
    .fb-project-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }
}

/* Карточка проекта */
.fb-project-card {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.fb-project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.1);
}

/* Логотип 200x200 слева */
.fb-project-card__logo-wrap {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 6px;
    background-color: #f3f4f6;
}

@media (min-width: 1200px) {
    .fb-project-card__logo-wrap {
        width: 160px;
        height: 160px;
    }
}

.fb-project-card__logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fb-project-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
}

.fb-project-card__title {
    font-family: var(--fb-menu-font);
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 10px;
}

.fb-project-card__title a:hover {
    opacity: 0.8;
}

.fb-project-card__desc {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
}

.fb-project-card__btn-wrap {
    margin-top: auto;
}

.fb-project-card__btn {
    display: inline-block;
    padding: 10px 24px;
    font-family: var(--fb-menu-font);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.fb-project-card__btn:hover {
    transform: translateY(-2px);
    opacity: 0.92;
}

/* Адаптив карточки на узких экранах */
@media (max-width: 580px) {
    .fb-project-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 20px;
    }

    .fb-project-card__logo-wrap {
        width: 120px;
        height: 120px;
        margin-bottom: 12px;
    }

    .fb-project-card__btn {
        align-self: center;
    }
}

/* 5. Нижняя кнопка действия */
.fb-landing-action {
    text-align: center;
    margin: 50px 0 20px;
}

.fb-landing-action__btn {
    display: inline-block;
    padding: 16px 44px;
    font-family: var(--fb-menu-font);
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.fb-landing-action__btn:hover {
    transform: translateY(-2px);
    opacity: 0.92;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   2. Header & Navigation (Fixed on PC, Mobile Drawer)
   ========================================================================== */
.fb-header {
    width: 100%;
    position: relative;
    z-index: 1000;
}

.fb-header__nav-wrapper {
    background-color: var(--fb-header-bg);
    color: var(--fb-header-text);
    position: sticky;
    top: 0;
    width: 100%;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    transition: background-color 0.2s ease;
    z-index: 1010;
}

.fb-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--fb-header-height);
}

.fb-header__branding {
    display: flex;
    align-items: center;
}

.fb-header__branding .custom-logo-link img {
    max-height: 55px;
    width: auto;
    display: block;
}

.fb-header__site-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--fb-header-text);
}

/* Навигация на ПК */
.fb-header__nav {
    display: none;
}

@media (min-width: 992px) {
    .fb-header__nav {
        display: block;
    }
}

.fb-menu--desktop {
    display: flex;
    align-items: center;
    gap: 36px;
}

.fb-menu--desktop > li {
    position: relative;
}

.fb-menu--desktop > li > a {
    font-family: var(--fb-menu-font);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--fb-header-text);
    padding: 10px 0;
    position: relative;
    display: inline-block;
}

.fb-menu--desktop > li > a::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--fb-header-accent);
    transition: width 0.25s ease;
}

.fb-menu--desktop > li > a:hover::after,
.fb-menu--desktop > li.current-menu-item > a::after,
.fb-menu--desktop > li.current_page_item > a::after {
    width: 100%;
}

.fb-menu--desktop > li.current-menu-item > a,
.fb-menu--desktop > li.current_page_item > a {
    color: var(--fb-header-accent);
}

/* Кнопка гамбургера для мобильных */
.fb-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--fb-header-text);
    background: transparent;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.fb-menu-toggle__icon {
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 992px) {
    .fb-menu-toggle {
        display: none;
    }
}

.fb-menu-toggle__icon--close {
    display: none;
}

.fb-menu-toggle.is-active .fb-menu-toggle__icon--open {
    display: none;
}

.fb-menu-toggle.is-active .fb-menu-toggle__icon--close {
    display: block;
}

/* Мобильная панель меню */
.fb-mobile-drawer {
    display: none;
    background-color: var(--fb-header-bg);
    border-top: 1px solid var(--fb-header-border);
    padding: 20px 0 30px;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.4);
    z-index: 1005;
    max-height: calc(100vh - var(--fb-header-height));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.fb-mobile-drawer.is-open {
    display: block !important;
    animation: fbFadeDown 0.25s ease-out;
}

@keyframes fbFadeDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fb-menu--mobile {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Пункты меню на мобильном: горизонтальные, белый жирный шрифт на темном фоне */
.fb-menu--mobile > li > a {
    display: block;
    font-family: var(--fb-menu-font);
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.fb-menu--mobile > li > a:hover,
.fb-menu--mobile > li > a:active,
.fb-menu--mobile > li.current-menu-item > a {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
    color: var(--fb-header-accent);
}

/* Опциональный фоновый баннер шапки (соотношение 10:3, адаптивное отображение без обрезки) */
.fb-header__banner {
    width: 100%;
    overflow: hidden;
    line-height: 0;
    background-color: var(--fb-header-bg);
}

.fb-header__banner-img {
    width: 100%;
    height: auto;
    max-width: 100%;
    display: block;
    object-fit: contain;
}

/* ==========================================================================
   3. Страница блога (Blog Page) & Заголовки
   ========================================================================== */
.fb-blog-page {
    padding-top: 40px;
}

.fb-page-header {
    margin-bottom: 36px;
}

.fb-page-title {
    font-size: 2.25rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--fb-text-color);
}

.fb-page-description {
    font-size: 1rem;
    color: var(--fb-text-muted);
    margin-top: 8px;
}

/* ==========================================================================
   4. Сетка статей (Blog Grid) & Карточка (Card)
   ========================================================================== */
.fb-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 36px;
}

@media (min-width: 768px) {
    .fb-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }
}

@media (min-width: 992px) {
    .fb-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 40px 30px;
    }
}

/* Карточка статьи */
.fb-card {
    display: flex;
    flex-direction: column;
}

.fb-card__image-link {
    display: block;
    margin-bottom: 16px;
    overflow: hidden;
    border-radius: 2px;
}

/* Соотношение сторон фото карточки: строго 5:4 */
.fb-card__image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 4;
    background-color: #f1f1f1;
    overflow: hidden;
}

.fb-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fb-card__image-link:hover .fb-card__img {
    transform: scale(1.04);
}

.fb-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e5e5e5;
    color: #888888;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.fb-card__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.fb-card__title {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    color: var(--fb-text-color);
}

.fb-card__title a {
    color: inherit;
}

.fb-card__title a:hover {
    opacity: 0.75;
}

.fb-card__date {
    font-size: 0.82rem;
    color: var(--fb-text-muted);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   5. Индикатор бесконечной подгрузки (Infinite Sentinel)
   ========================================================================== */
.fb-infinite-sentinel {
    min-height: 60px;
    padding: 30px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fb-spinner {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fb-spinner__dot {
    width: 10px;
    height: 10px;
    background-color: var(--fb-text-color);
    border-radius: 50%;
    animation: fbBounce 0.6s infinite alternate;
}

.fb-spinner__dot:nth-child(2) {
    animation-delay: 0.2s;
}

.fb-spinner__dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes fbBounce {
    to {
        opacity: 0.2;
        transform: translateY(-6px);
    }
}

.fb-infinite-message {
    font-size: 0.9rem;
    color: var(--fb-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ==========================================================================
   6. Страница отдельной статьи (Single Post)
   ========================================================================== */
.fb-single-container {
    max-width: 940px;
    padding-top: 36px;
}

.fb-single-post {
    display: flex;
    flex-direction: column;
}

/* Кнопки соцсетей НАД заголовком статьи:
   на ПК 4 в ряд, на мобильном 2х2 */
.fb-post-social-bar {
    margin-bottom: 24px;
}

.fb-post-social-bar__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (min-width: 768px) {
    .fb-post-social-bar__grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }
}

.fb-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 14px;
    background-color: #f7f7f7;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    color: var(--fb-text-color);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.fb-social-btn:hover {
    background-color: #111111;
    color: #ffffff;
    border-color: #111111;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.fb-social-btn__icon {
    display: flex;
    align-items: center;
}

.fb-social-btn__icon svg {
    width: 18px;
    height: 18px;
}

.fb-social-btn__text {
    letter-spacing: 0.5px;
}

/* Заголовок статьи */
.fb-single-post__header {
    margin-bottom: 24px;
}

.fb-single-post__title {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--fb-text-color);
}

@media (min-width: 768px) {
    .fb-single-post__title {
        font-size: 2.5rem;
    }
}

/* Фото статьи */
.fb-single-post__featured-media {
    margin-bottom: 20px;
    border-radius: 4px;
    overflow: hidden;
}

.fb-single-post__img {
    width: 100%;
    height: auto;
    display: block;
}

/* Мета-информация (Автор, дата) */
.fb-single-post__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--fb-text-muted);
    margin-bottom: 30px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--fb-border-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.fb-single-post__meta-divider {
    color: #cccccc;
}

.fb-single-post__category a {
    color: var(--fb-text-color);
    font-weight: 600;
}

/* Контент статьи (Типографика) */
.fb-prose {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2b2b2b;
}

.fb-prose p {
    margin-bottom: 1.5em;
}

.fb-prose h2 {
    font-size: 1.65rem;
    font-weight: 800;
    margin-top: 1.8em;
    margin-bottom: 0.8em;
    line-height: 1.3;
}

.fb-prose h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.6em;
}

.fb-prose ul, .fb-prose ol {
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}

.fb-prose ul {
    list-style: disc;
}

.fb-prose ol {
    list-style: decimal;
}

.fb-prose li {
    margin-bottom: 0.5em;
}

.fb-prose blockquote {
    border-left: 4px solid var(--fb-text-color);
    padding: 12px 24px;
    margin: 2em 0;
    background-color: #fafafa;
    font-style: italic;
}

.fb-prose img {
    margin: 2em 0;
    border-radius: 4px;
}

/* Теги статьи */
.fb-single-post__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 30px 0;
}

.fb-tag-pill {
    padding: 6px 14px;
    background-color: #f1f1f1;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555555;
    transition: all 0.2s ease;
}

.fb-tag-pill:hover {
    background-color: #111111;
    color: #ffffff;
}

/* Кнопка возврата ко всем статьям */
.fb-single-post__back {
    margin: 36px 0 50px;
    padding-top: 24px;
    border-top: 1px solid var(--fb-border-color);
}

.fb-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    background-color: transparent;
    border: 1px solid var(--fb-border-color);
    border-radius: 4px;
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--fb-text-color);
    transition: all 0.2s ease;
}

.fb-back-btn:hover {
    background-color: #111111;
    color: #ffffff;
    border-color: #111111;
    transform: translateX(-4px);
}

.fb-back-btn__icon {
    display: flex;
    align-items: center;
}

/* Блок похожих статей в конце */
.fb-related-posts {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid var(--fb-border-color);
}

.fb-related-posts__heading {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 28px;
}

.fb-related-posts__grid {
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .fb-related-posts__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================================================
   7. Подвал (Footer)
   ========================================================================== */
.fb-footer {
    background-color: #ffffff;
    border-top: 1px solid var(--fb-border-color);
    padding: 60px 0 40px;
    margin-top: auto;
}

.fb-footer__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Центральная CTA-кнопка в подвале */
.fb-footer__cta-wrap {
    margin-bottom: 36px;
}

.fb-footer__cta-btn {
    display: inline-block;
    background-color: var(--fb-cta-bg);
    color: var(--fb-cta-text);
    padding: 16px 40px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.fb-footer__cta-btn:hover {
    transform: translateY(-2px);
    opacity: 0.92;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
}

/* Соцсети в подвале */
.fb-footer__socials {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 28px;
}

.fb-footer__social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: #f5f5f5;
    color: #222222;
    transition: all 0.2s ease;
}

.fb-footer__social-link:hover {
    background-color: #111111;
    color: #ffffff;
    transform: translateY(-3px);
}

.fb-footer__social-link svg {
    width: 20px;
    height: 20px;
}

.fb-footer__copyright {
    font-size: 0.85rem;
    color: var(--fb-text-muted);
}

/* 404 Page */
.fb-404-container {
    padding: 80px 20px;
    text-align: center;
}

.fb-404-title {
    font-size: 6rem;
    font-weight: 900;
    line-height: 1;
    color: #111111;
    margin-bottom: 16px;
}

.fb-404-subtitle {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.fb-404-text {
    color: var(--fb-text-muted);
    margin-bottom: 30px;
}

.fb-btn--primary {
    display: inline-block;
    background-color: #111111;
    color: #ffffff;
    padding: 12px 28px;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
}
