/*
Theme Name: Yieldoptic Engine
Theme URI: https://yieldoptic.com
Author: Yieldoptic Media Limited
Author URI: https://yieldoptic.com
Description: Universal, fast, and SEO-optimized theme. Full support for WCAG, Core Web Vitals, and dynamic components.
Requires PHP: 7.4
Tested up to: 6.5
Version: 3.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: yieldoptic-engine
Tags: custom-colors, custom-menu, e-commerce, education, portfolio, threaded-comments
*/

/* Copyright 2026 Yieldoptic Media Limited (License: GPLv2 or later) */

/* =========================================
   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. ГЛОБАЛЬНІ УТИЛІТИ
   ========================================= */
/* Кольори */
.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. ПАГІНАЦІЯ
   ========================================= */
.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. ФОРМИ: КОНТАКТИ ТА ПІДПИСКА
   ========================================= */
.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 ТА ALIGNMENTS
   ========================================= */
.entry-content { line-height: 1.8; font-size: 1.05rem; color: #495057; }
.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; }

/* WP Standard Image Alignment Classes (Обов'язково для WordPress) */
.entry-content img { max-width: 100%; height: auto; border-radius: 8px; }
.aligncenter { display: block; margin: 1.5rem auto; clear: both; }
.alignleft { float: left; margin: 0.5rem 1.5rem 1.5rem 0; }
.alignright { float: right; margin: 0.5rem 0 1.5rem 1.5rem; }
.wp-caption { margin-bottom: 1.5rem; max-width: 100%; }
.wp-caption img[class*="wp-image-"] { display: block; margin: 0 auto; }
.wp-caption-text { text-align: center; font-size: 0.85rem; color: var(--rs-text-muted); margin-top: 0.5rem; font-style: italic; }

.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: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
        box-sizing: border-box;
    }
}

@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) & WOOCOMMERCE
   ========================================= */
.affiliate-sticky-bottom {
    padding-bottom: env(safe-area-inset-bottom, 15px) !important; 
}

@media (max-width: 991.98px) {
    body { padding-bottom: 70px; }
}

.woocommerce-custom-wrapper {
    background-color: var(--rs-bg-body);
}



/* Recommended WordPress Classes */
.gallery-caption {
    font-size: 0.85em;
    color: #666;
    text-align: center;
    padding-top: 0.5em;
}
.bypostauthor {
    /* Class applied to comments by the post author */
    display: block;
}
.sticky {
    /* Class for sticky posts */
    display: block;
}