/*
Theme Name: Yieldoptic Engine
Theme URI: https://yieldoptic.com
Author: Yieldoptic Media Limited
Description: Універсальна, швидка та SEO-оптимізована тема. Повна підтримка WCAG, Core Web Vitals та динамічних компонентів.
Version: 3.2
Text Domain: yieldoptic
*/

/* =========================================
   1. ЗМІННІ ТА КОЛЬОРИ (ФОЛБЕКИ)
   ========================================= */
:root {
    --rs-primary: #1a1a1a;        
    --rs-accent: #0056b3;         /* Динамічно змінюється через Customizer */
    --rs-bg-body: #ffffff;        
    --rs-bg-light: #f8f9fa;       
    --rs-text-main: #2d3748;      
    --rs-text-muted: #6c757d;     
    --rs-focus-ring: #ff9900;     /* Колір для фокусу клавіатури (ADA) */

    --rs-font-head: 'Playfair Display', serif;
    --rs-font-body: 'Montserrat', sans-serif;
}

/* =========================================
   2. БАЗА ТА ДОСТУПНІСТЬ (A11Y)
   ========================================= */
html { 
    scroll-behavior: smooth; /* Плавний скрол до якорів та кнопки "Вгору" */
}

body {
    background-color: var(--rs-bg-body);
    color: var(--rs-text-main);
    font-family: var(--rs-font-body);
    line-height: 1.7; 
    -webkit-font-smoothing: antialiased;
}

/* Чіткий фокус для навігації з клавіатури (ADA Compliance) */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--rs-focus-ring) !important;
    outline-offset: 3px;
    border-radius: 2px;
}

/* Клас для приховування елементів від очей, але читання скрін-рідерами */
.screen-reader-text,
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Скіп-лінк для переходу до контенту (з'являється при натисканні Tab) */
.visually-hidden-focusable:focus, .visually-hidden-focusable:focus-within {
    position: absolute;
    top: 0;
    left: 0;
    background-color: var(--rs-primary);
    color: white;
    padding: 15px 30px;
    z-index: 100000;
    text-decoration: none;
    font-weight: bold;
}

/* Мінімальна висота контенту (щоб футер завжди був внизу сторінки) */
.site-content { min-height: 65vh; }

/* =========================================
   3. ТИПОГРАФІКА ТА ПОСИЛАННЯ
   ========================================= */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--rs-font-head);
    color: var(--rs-primary);
    font-weight: 700;
}

a {
    color: var(--rs-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover { color: var(--rs-accent); }

/* =========================================
   4. ГЛОБАЛЬНІ УТИЛІТИ (Витягнуті з PHP)
   ========================================= */
/* Кольори */
.text-accent { color: var(--rs-accent) !important; }
.bg-accent { background-color: var(--rs-accent) !important; color: white !important; border-color: var(--rs-accent) !important; }
.bg-accent:hover { opacity: 0.9; color: white !important; }

/* Ховери кольорів */
.text-hover-accent:hover { color: var(--rs-accent) !important; opacity: 1 !important; }
.text-hover-white:hover { color: white !important; opacity: 1 !important; }
.text-hover-dark:hover { color: #212529 !important; }

/* Анімації та тіні */
.transition-all { transition: all 0.3s ease; }
.transition-hover-text { transition: color 0.3s ease; }
.transition-hover { transition: transform 0.3s ease, box-shadow 0.3s ease; }
.transition-hover:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important; 
}
.shadow-hover:hover { box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important; }

/* Інше */
.letter-spacing-1 { letter-spacing: 1px; }

/* =========================================
   5. КАРТКИ ТА КНОПКИ
   ========================================= */
.btn-primary, .btn-dark {
    border-radius: 4px;
    padding: 12px 30px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
    border: none;
    transition: 0.3s;
}

.review-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px; 
    overflow: hidden;
    position: relative;
}

/* =========================================
   6. ПАГІНАЦІЯ (Витягнуто з PHP)
   ========================================= */
.pagination-custom .nav-links { 
    display: flex; 
    gap: 0.5rem; 
    justify-content: center; 
    align-items: center; 
    flex-wrap: wrap;
}
.pagination-custom a, .pagination-custom span { 
    padding: 0.5rem 1rem; 
    border: 1px solid #dee2e6; 
    border-radius: 0.375rem; 
    text-decoration: none; 
    color: #333; 
    font-size: 0.875rem; 
    font-weight: bold; 
    transition: all 0.2s ease; 
}
.pagination-custom span.current { 
    background-color: var(--rs-accent); 
    color: white; 
    border-color: var(--rs-accent); 
}
.pagination-custom a:hover { 
    background-color: #f8f9fa; 
    color: var(--rs-accent); 
}

/* =========================================
   7. ФОРМИ: КОНТАКТИ ТА ПІДПИСКА (Витягнуто з PHP)
   ========================================= */
.custom-contact-form input,
.custom-contact-form textarea,
.rs-subscribe-form input {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    width: 100%;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.custom-contact-form input:focus,
.custom-contact-form textarea:focus,
.rs-subscribe-form input:focus {
    outline: none;
    border-color: var(--rs-accent);
    box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.05);
    background-color: #fff;
}

.custom-contact-form button[type="submit"] {
    background-color: var(--rs-accent) !important;
    border-color: var(--rs-accent) !important;
    color: white !important;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    transition: opacity 0.3s ease;
    font-weight: bold;
}

.custom-contact-form button[type="submit"]:hover {
    opacity: 0.9;
}

/* =========================================
   8. WP CONTENT FIXES (Для редактора Gutenberg)
   ========================================= */
.entry-content { line-height: 1.8; font-size: 1.05rem; color: #495057; }
.entry-content img { max-width: 100%; height: auto; border-radius: 8px; }
.entry-content p { margin-bottom: 1.5rem; }
.entry-content h2 { margin-top: 2.5rem; margin-bottom: 1rem; font-size: 1.75rem; font-weight: 700; color: var(--rs-primary); }
.entry-content h3 { margin-top: 2rem; margin-bottom: 1rem; font-size: 1.4rem; font-weight: 600; color: var(--rs-primary); }
.entry-content a { color: var(--rs-accent); text-decoration: none; font-weight: 500; }
.entry-content a:hover { text-decoration: underline; }

.entry-content ul, .entry-content ol { margin-bottom: 1.5rem; padding-left: 1.5rem; }
.entry-content ul { list-style-type: none; }
.entry-content ul li { margin-bottom: 0.5rem; position: relative; }
.entry-content ul li::before {
    content: "•";
    color: var(--rs-accent);
    font-weight: bold;
    position: absolute;
    left: -1rem;
}

/* =========================================
   9. ЕМОЦІЇ ТА DNA BOX (Універсальні компоненты)
   ========================================= */
.book-dna-box, .item-dna-box {
    background-color: var(--rs-bg-light);
    border-left: 5px solid var(--rs-accent);
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.btn-emotion {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}
.btn-emotion:hover:not(.voted) {
    transform: translateY(-3px);
    border-color: var(--rs-accent);
}
.emotion-label { font-weight: 600; font-size: 0.85rem; color: #333; margin: 0 5px; }

/* =========================================
   10. ЛОГОТИП ТА ХЕДЕР
   ========================================= */
.navbar-brand .custom-logo-link {
    display: flex;
    align-items: center;
    max-width: 250px; 
    height: 70px;     
    overflow: hidden;
}

.navbar-brand img, 
.custom-logo,
.navbar-brand .custom-logo-link img {
    display: block !important;
    width: auto !important;     
    height: 100% !important;     
    max-height: 70px !important; 
    max-width: 100% !important;  
    object-fit: contain !important; 
    transition: transform 0.3s ease-in-out;
}

.navbar-brand:hover img { transform: scale(1.05); }

@media (max-width: 768px) {
    .navbar-brand .custom-logo-link { height: 50px; max-width: 180px; }
    .navbar-brand img, .custom-logo { max-height: 50px !important; }
}

@media (max-width: 991.98px) {
    .navbar-nav .dropdown-menu {
        position: static !important;
        float: none;
        background-color: transparent;
        border: none;
        box-shadow: none;
        padding-left: 1.5rem; 
    }
}

/* =========================================
   11. ПОШУК В ХЕДЕРІ
   ========================================= */
.search-dropdown-box {
    position: absolute;
    top: 100%;
    left: -10px; 
    right: auto;
    width: 320px;
    background: #fff;
    padding: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-radius: 8px;
    z-index: 9999;
    display: none;
    animation: fadeInDown 0.2s ease-out;
}

@media (max-width: 991px) {
    .search-dropdown-box {
        position: fixed !important;
        top: 60px !important; 
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   12. BACK TO TOP КНОПКА
   ========================================= */
.back-to-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    display: none; 
    align-items: center;
    justify-content: center;
    z-index: 999;
    font-size: 24px;
    line-height: 1;
    transition: opacity 0.3s ease;
    border: none;
}

/* Адаптив для мобільних екранів (Додано) */
@media (max-width: 576px) {
    .back-to-top-btn { 
        bottom: 1rem; 
        right: 1rem; 
        width: 40px; 
        height: 40px; 
        font-size: 20px;
    }
}


/* =========================================
   13. AFFILIATE STICKY BOTTOM BAR (MOBILE)
   ========================================= */
.affiliate-sticky-bottom {
    padding-bottom: env(safe-area-inset-bottom, 15px) !important; /* Фікс для iPhone, щоб кнопка не наїжджала на полосу згортання */
}

/* Робимо відступ внизу сторінки на мобільних, щоб кнопка не перекривала текст футера */
@media (max-width: 991.98px) {
    body { padding-bottom: 70px; }
}



