/* Подключение шрифтов */
@font-face {
    font-family: 'Roboto Thin';
    /* Исключаем TTF из web-цепочки и оставляем только современные форматы для более быстрой загрузки первого экрана. */
    src: url('../fonts/roboto-thin.woff2') format('woff2'),
         url('../fonts/roboto-thin.woff') format('woff');
    font-weight: 100;
    font-style: normal;
    /* Включаем swap, чтобы hero-текст рендерился сразу системным fallback и не блокировал FCP/LCP. */
    font-display: swap;
}
@font-face {
    font-family: 'Roboto Regular';
    /* Исключаем TTF из web-цепочки и оставляем только современные форматы для более быстрой загрузки первого экрана. */
    src: url('../fonts/roboto-regular.woff2') format('woff2'),
         url('../fonts/roboto-regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    /* Включаем swap, чтобы hero-текст рендерился сразу системным fallback и не блокировал FCP/LCP. */
    font-display: swap;
}
@font-face {
    font-family: 'Raleway Regular';
    /* Исключаем TTF из web-цепочки и оставляем только современные форматы для более быстрой загрузки первого экрана. */
    src: url('../fonts/raleway-regular.woff2') format('woff2'),
         url('../fonts/raleway-regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    /* Включаем swap, чтобы hero-текст рендерился сразу системным fallback и не блокировал FCP/LCP. */
    font-display: swap;
}

/* Цветовые переменные */
:root {
    --color-primary: #ff4800;
    --color-background: #0e140e;
    --color-foreground: #ffffff;
    --color-accent: #ffb4b0;
    /* CTA animation base tokens: this is the global foundation, and local template styles should only override variables/modifiers instead of duplicating hover rules. */
    --cta-hover-lift: 3px;
    --cta-hover-scale: 1.05;
    --cta-transition-duration: 0.3s;
    --cta-transition-ease: ease;
    /* Scenario button motion/shell tokens centralize hover/active behavior so section CSS keeps only layout rules. */
    --scenario-hover-scale: 1.05;
    --scenario-transition-duration: 0.3s;
    --scenario-shadow-hover: 0 4px 12px rgba(255, 72, 0, 0.4);
    --scenario-border-radius: 6px;
}

/* Общие стили */
body {
    background-color: var(--color-background);
    color: var(--color-foreground);
    font-family: 'Raleway Regular', sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

strong, b {
    font-weight: normal;
    color: var(--color-primary);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Roboto Thin', sans-serif;
    color: var(--color-foreground);
    margin: 0.5em 0;
}

.subtitle {
    font-family: 'Roboto Regular', sans-serif;
    color: var(--color-foreground);
}

/* Ссылки */
a {
    color: var(--color-primary);
    text-decoration: none;
}
a:hover {
    color: var(--color-accent);
}

/* Кнопки */
button, .button {
    background-color: var(--color-primary);
    color: var(--color-foreground);
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-family: 'Raleway Regular', sans-serif;
    text-transform: uppercase;
    cursor: pointer;
}

/* CTA animation base layer: keeps transition and transform logic in one global place so local files can extend behavior via variables/modifiers without copying hover blocks. */
.cta-button,
button.cta-button,
.button.cta-button {
    /* Добавляем базовый shell CTA глобально, чтобы front-page/services/why использовали единый внешний вид без локального дублирования. */
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--color-primary);
    color: var(--color-foreground);
    border-radius: 6px;
    font-family: 'Raleway Regular', sans-serif;
    font-size: 1rem;
    /* Переопределяем inherited uppercase от button/.button, чтобы все CTA в front-page/services/why следовали sentence-case контракту. */
    text-transform: none;
    text-decoration: none;
    transition:
        transform var(--cta-transition-duration) var(--cta-transition-ease),
        background-color var(--cta-transition-duration) var(--cta-transition-ease),
        color var(--cta-transition-duration) var(--cta-transition-ease);
}

/* CTA hover base rule: shared translateY + scale effect is centralized here, while templates can customize only variable values per context. */
.cta-button:hover,
button.cta-button:hover,
.button.cta-button:hover {
    /* Фиксируем hover глобально по референсу front-page, чтобы front-page/services/why имели одинаковую реакцию на наведение. */
    background-color: var(--color-accent);
    color: var(--color-background);
    transform: translateY(calc(-1 * var(--cta-hover-lift))) scale(var(--cta-hover-scale));
}

.cta-button:focus-visible,
button.cta-button:focus-visible,
.button.cta-button:focus-visible {
    /* Добавляем keyboard focus-state для глобальных CTA (front-page/services/why), не затрагивая поведение mouse-hover. */
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    /* CTA reduced-motion fallback: disables lift/scale animation globally while preserving readable color-state change on hover. */
    .cta-button,
    button.cta-button,
    .button.cta-button {
        --cta-hover-lift: 0px;
        --cta-hover-scale: 1;
        --cta-transition-duration: 0.01ms;
    }
}

/* Shared scenario/chapter control pattern for Services + Front Page + Why: base container keeps action buttons in a readable row with controlled wrapping. */
.scenario-buttons-base {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

/* Shared scenario/chapter control pattern for Services + Front Page + Why: base button style unifies chapter/scenario controls without touching CTA defaults. */
.scenario-button-base {
    display: inline-block;
    padding: 12px 20px;
    font-family: 'Raleway Regular', sans-serif;
    font-size: 1rem;
    line-height: 1.35;
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    /* Подключаем системный радиус scenario-кнопки из :root, чтобы shell был единым на Services/Front Page/Why. */
    border-radius: var(--scenario-border-radius);
    /* Фиксируем регистр текста для scenario-button-base, чтобы <button> и <a> выглядели одинаково и не зависели от глобального button{text-transform}. */
    text-transform: none;
    text-decoration: none;
    text-align: center;
    /* Убираем transition: all в пользу явного списка свойств для предсказуемой анимации сценарных кнопок. */
    transition:
        transform var(--scenario-transition-duration) ease,
        background-color var(--scenario-transition-duration) ease,
        color var(--scenario-transition-duration) ease,
        box-shadow var(--scenario-transition-duration) ease,
        border-color var(--scenario-transition-duration) ease;
    cursor: pointer;
}

/* Shared scenario/chapter control pattern for Services + Front Page + Why: hover keeps the selected-action feedback consistent on pointer devices. */
.scenario-button-base:hover {
    background-color: var(--color-primary);
    color: var(--color-background);
    /* Переводим scale/shadow на переменные, чтобы убрать хардкод hover-эффекта из глобального сценарного паттерна. */
    transform: scale(var(--scenario-hover-scale));
    box-shadow: var(--scenario-shadow-hover);
}

/* Shared scenario/chapter control pattern for Services + Front Page + Why: active class preserves selected chapter/scenario state after click. */
.scenario-button-base.is-active {
    background-color: var(--color-primary);
    color: var(--color-background);
    /* Применяем тот же token shadow для активного состояния, чтобы hover/is-active были синхронизированы. */
    box-shadow: var(--scenario-shadow-hover);
}

/* Shared scenario/chapter control pattern for Services + Front Page + Why: focus-visible adds keyboard-accessible outline without changing mouse-only state. */
.scenario-button-base:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

@media (max-width: 768px) {
    /* Shared scenario/chapter control pattern for Services + Front Page + Why: mobile sizing keeps controls readable and touch-friendly. */
    .scenario-button-base {
        padding: 11px 16px;
        font-size: 0.95rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    /* Отключаем scale-анимацию scenario-кнопок при reduce-motion, сохраняя визуальную смену цветов/тени. */
    .scenario-button-base {
        --scenario-hover-scale: 1;
        --scenario-transition-duration: 0.01ms;
    }
}

/* Базовый note-box для рамочных заметок по всей теме, чтобы унифицировать ширину, рамку и центрирование. */
.note-box {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 24px;
    padding-inline: clamp(16px, 4vw, 24px);
    border: 1px solid rgba(255, 72, 0, 0.2);
    border-radius: 12px;
    text-align: center;
    color: var(--color-foreground);
}

/* Usage for media-card: `.media-card` is mandatory for every screenshot/figure card, modifiers are optional and combined only when needed, and section files (services.css, front-page.css, etc.) must not override the base card appearance from this global block. */
/* Reusable media-card pattern centralizes screenshot/card framing in one global source of truth for Services (`page-services.php`) and other templates with figure+caption media blocks. */
.media-card {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 6px 18px rgba(0,0,0,0.3);
}

/* Keep media-card image behavior consistent: full-width responsive image without inline-gap artifacts in figure cards. */
.media-card img {
    display: block;
    width: 100%;
    height: auto;
}

/* Standard caption treatment for screenshot cards keeps dark background, accent color and readable typography across templates. */
.media-card figcaption {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.28);
    color: var(--color-accent, #ff4800);
    font-size: 0.95rem;
    text-align: left;
}

/* Modifier mirrors CTA-style utility usage: explicitly center captions where section narrative needs centered labels. */
.media-card--center-caption figcaption {
    text-align: center;
}

/* Modifier adds standard top rhythm before a media-card when the block follows text content in sections like Services. */
.media-card--spaced {
    margin-top: 20px;
}

/* Compact modifier supports dense sections by slightly reducing caption footprint while preserving shared media-card styling. */
.media-card--compact figcaption {
    padding: 8px 10px;
    font-size: 0.9rem;
}

/* Шапка сайта */
.site-header {
    background-color: var(--color-background);
    border-bottom: 2px solid var(--color-primary);
    padding: 10px 0;
}
.site-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.site-header .logo {
    display: flex;
    align-items: center;
}
.site-header .logo svg {
    height: 90px;
    width: auto;
    display: block;
}

/* ==== FOOTER ==== */
.site-footer {
    background-color: var(--color-background);
    color: var(--color-foreground);
    padding: 40px 20px;
    font-size: 0.9rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-nav ul {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-nav ul li a {
    /* Делаем ссылку блочным чипом, чтобы footer-nav в footer.php мог использовать фон как в header menu и не ломать поток строк. */
    display: inline-block;
    padding: 10px 15px;
    color: var(--color-foreground);
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.footer-nav ul li a:hover {
    /* Синхронизируем hover-паттерн footer menu с .menu > li > a:hover в header: оранжевый фон + тёмный текст + скругление. */
    color: var(--color-background);
    background-color: var(--color-primary);
    border-radius: 5px;
}
.footer-policy {
    flex: 1;
    text-align: left;
}

.footer-policy a {
    color: var(--color-foreground);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-policy a:hover {
    color: var(--color-primary);
}

.footer-socials {
    /* Перестраиваем футер-соцссылки в две строки, чтобы разделить основные CTA и отдельный Telegram-блок по новому UX-сценарию. */
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.footer-socials-row {
    /* Формируем горизонтальные строки внутри footer-socials, чтобы иконки и текстовые CTA выравнивались в одном визуальном ряду. */
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-socials-row--secondary {
    /* Для второй строки задаём компактный отступ, чтобы подпись Russian speaking question: была визуально связана с Telegram-иконкой. */
    gap: 10px;
}

.footer-socials a {
    /* Оставляем единый inline-flex для всех ссылок футера, чтобы иконки и текст внутри CTA корректно центрировались по вертикали. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.3s ease;
}

.footer-secondary-label {
    /* Добавляем подпись второй строки футера для русскоязычной аудитории перед Telegram-ссылкой. */
    font-size: 0.95rem;
    line-height: 1.2;
}

.footer-socials a:hover {
    transform: scale(1.1);
}

.footer-socials svg {
    width: 20px;
    height: 20px;
    fill: var(--color-primary);
    transition: transform 0.3s ease, fill 0.3s ease;
}

.footer-socials a:hover svg {
    transform: scale(1.1);
    fill: var(--color-accent);
}

.footer-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 40px;
}

.footer-left, .footer-right {
    flex: 1 1 300px;
}

.footer-quote-title {
    font-family: 'Roboto Regular', sans-serif;
    font-size: 1.2rem;
    font-style: italic;
    font-weight: normal;
    margin: 0 0 15px 0;
}

.footer-quote {
    max-width: 600px;
    margin-bottom: 5px;
    line-height: 1.5;
}

.footer-logo {
    text-align: right;
}

.footer-logo img {
    width: 70px;
    height: auto;
    display: inline-block;
}

.footer-bottom {
    border-top: 1px solid var(--color-primary);
    padding-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--color-foreground);
}

.credits {
    margin: 0px 0 0;
}
/* Кнопка возврата наверх: базовые стили для фиксированного отображения на странице. */
.back-to-top {
    position: fixed;
    right: 32px;
    bottom: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: var(--color-foreground);
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    z-index: 998;
}
/* Увеличиваем размер SVG-стрелки внутри кнопки на странице, чтобы усилить акцент, не меняя диаметр круга. */
.back-to-top svg {
    width: 36px;
    height: 36px;
}
/* Показываем кнопку только на десктопе, чтобы не перекрывать мобильный интерфейс. */
@media (min-width: 1024px) {
    .back-to-top {
        display: inline-flex;
    }
    .back-to-top.is-visible {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }
}
/* Добавляем hover-эффект для кнопки наверх, чтобы подсветить действие пользователю. */
.back-to-top:hover {
    background-color: var(--color-accent);
    color: var(--color-background);
}
/* === HEADER FIX === */

.site-header {
    background-color: var(--color-background);
    border-bottom: 2px solid var(--color-primary);
    padding: 10px 0;
}

.site-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-header .logo img {
    height: 90px;
    width: auto;
    display: block;
}

.menu {
    display: flex;
    justify-content: flex-end;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 20px;
}

.menu > li {
    position: relative;
}

.menu > li > a {
    color: var(--color-foreground);
    text-transform: uppercase;
    font-size: 1rem;
    text-decoration: none;
    padding: 10px 15px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.menu > li > a:hover {
    /* Desktop header hover text uses brand black for stronger contrast on the orange hover background. */
    color: var(--color-background);
    background-color: var(--color-primary);
    border-radius: 5px;
}

.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--color-background);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    padding: 10px 0;
    border-radius: 5px;
    z-index: 100;
}

.menu > li:hover .sub-menu {
    display: block;
}

.footer-latest-posts {
    margin-top: 20px;
}

.footer-latest-title {
    font-family: 'Roboto Regular', sans-serif;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

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

.footer-latest-posts ul li {
    margin-bottom: 6px;
}

.footer-latest-posts ul li a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-latest-posts ul li a:hover {
    color: var(--color-accent);
}
.site-slogan {
    max-width: 50px;
    margin: 0 20px;
    padding-left: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: sloganFadeIn 1.5s ease-out 1s forwards;
}

.site-slogan img.slogan-svg {
    max-height: 30px;
    height: auto;
    width: auto;
    display: block;
    filter: brightness(95%);
}

/* Анимация появления */
@keyframes sloganFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Адаптив: скрываем слоган на мобильных */
@media (max-width: 768px) {
    .site-slogan {
        display: none;
    }
}

/* === Плавный скролл к якорям === */
html {
  scroll-behavior: smooth;
}
/* Временно отключаем плавный скролл при закрытии меню, чтобы восстановление позиции было мгновенным. */
html.no-smooth-scroll {
  scroll-behavior: auto;
}


/* ==== СТИЛИ ДЛЯ КАРТОЧЕК БЛОГА ==== */
.archive-post {
    background-color: #1a1a1a; /* оттенённый фон */
    border: 2px solid var(--color-primary);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 20px;
    transition: all 0.3s ease;
}

.archive-post:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 18px rgba(255, 72, 0, 0.4);
}

/* Ссылки внутри карточек */
.archive-post a {
    color: var(--color-primary);
    text-decoration: none;
    position: relative;
    transition: all 0.3s ease;
}

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

.archive-post a:hover::before {
    color: var(--color-accent);
    transform: translateX(3px);
}

.category-tile {
    background-color: #1a1a1a;
    border: 2px solid var(--color-primary);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 20px;
    transition: all 0.3s ease;
}

/* Ссылки карточек */
.category-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 18px rgba(255, 72, 0, 0.4);
}

/* Формируем сетку и безопасные внешние отступы для карточек рубрик на home.php, чтобы блоки не прилипали к краям экрана. */
.home-page {
    max-width: 1360px;
    margin: 0 auto;
    padding: 24px;
}

/* Добавляем стабильные зазоры между карточками на desktop, чтобы соседние блоки визуально не слипались. */
.categories-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

/* Правки в footer */
.footer {
  position: relative;
  z-index: 1; /* Ниже, чем у меню (у него z-index: 999) */
}

.menu-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Блокируем прокрутку страницы, когда меню открыто (fallback, т.к. основной lock делает JS через position: fixed). */
body.menu-open {
  overflow: hidden;
}
