/* ==========================================================================
   FAQ Hub — Центр ответов (Astra Child unified design)
   High-specificity overrides to win against Astra parent theme
   ========================================================================== */

/* Box-sizing */
html body.page-template-template-faq-hub-php .faq-hub-hero,
html body.page-template-template-faq-hub-php .faq-hub-nav,
html body.page-template-template-faq-hub-php .faq-hub-body,
html body.page-template-template-faq-hub-php .faq-hub-cta,
html body.page-template-template-faq-hub-php .faq-hub-trust,
html body.page-template-template-faq-hub-php .faq-hub-hero *,
html body.page-template-template-faq-hub-php .faq-hub-nav *,
html body.page-template-template-faq-hub-php .faq-hub-body *,
html body.page-template-template-faq-hub-php .faq-hub-cta *,
html body.page-template-template-faq-hub-php .faq-hub-trust * {
    box-sizing: border-box;
}

/* Word wrapping */
html body.page-template-template-faq-hub-php .faq-hub-title,
html body.page-template-template-faq-hub-php .faq-hub-subtitle,
html body.page-template-template-faq-hub-php .faq-hub-cat-title,
html body.page-template-template-faq-hub-php .faq-hub-subcat-title,
html body.page-template-template-faq-hub-php .faq-hub-card,
html body.page-template-template-faq-hub-php .faq-hub-card-title,
html body.page-template-template-faq-hub-php .faq-hub-cta h2,
html body.page-template-template-faq-hub-php .faq-hub-cta p,
html body.page-template-template-faq-hub-php .faq-hub-nav-link {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    word-break: normal;
}

/* ==========================================================================
   OVERRIDE ASTRA .ast-container grid layout
   ========================================================================== */
html body.page-template-template-faq-hub-php .ast-container {
    display: block !important;
    width: 100% !important;
    max-width: var(--med-container) !important;
    margin-inline: auto !important;
    padding-inline: 24px !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    grid-auto-flow: row !important;
}

html body.page-template-template-faq-hub-php #primary {
    width: 100% !important;
    max-width: 100% !important;
}

/* ==========================================================================
   HERO
   ========================================================================== */
html body.page-template-template-faq-hub-php .faq-hub-hero {
    background: linear-gradient(135deg, var(--med-primary) 0%, var(--med-secondary) 100%);
    padding: 64px 0 48px;
    color: #fff;
}

html body.page-template-template-faq-hub-php .faq-hub-hero-inner {
    text-align: center;
    max-width: var(--med-container);
    margin-inline: auto;
    padding-inline: 24px;
}

html body.page-template-template-faq-hub-php .faq-hub-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 16px;
    color: #fff;
}

html body.page-template-template-faq-hub-php .faq-hub-subtitle {
    font-size: clamp(1rem, 2vw, 1.125rem);
    line-height: 1.65;
    margin: 0 auto 32px;
    max-width: 680px;
    opacity: 0.9;
}

/* Stats */
html body.page-template-template-faq-hub-php .faq-hub-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

html body.page-template-template-faq-hub-php .faq-hub-stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

html body.page-template-template-faq-hub-php .faq-hub-stat-label {
    display: block;
    font-size: 0.875rem;
    margin-top: 4px;
    opacity: 0.85;
}

/* ==========================================================================
   NAV
   ========================================================================== */
html body.page-template-template-faq-hub-php .faq-hub-nav {
    background: var(--med-bg);
    padding: 16px 0;
    border-bottom: 1px solid var(--med-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--med-shadow);
}

html body.page-template-template-faq-hub-php .faq-hub-nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--med-text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}

html body.page-template-template-faq-hub-php .faq-hub-nav-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

html body.page-template-template-faq-hub-php .faq-hub-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--med-bg-light);
    border-radius: 999px;
    color: var(--med-text);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--med-transition);
}

html body.page-template-template-faq-hub-php .faq-hub-nav-link:hover {
    background: var(--med-primary);
    color: #fff;
}

html body.page-template-template-faq-hub-php .faq-hub-nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: rgba(0,0,0,0.08);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

html body.page-template-template-faq-hub-php .faq-hub-nav-link:hover .faq-hub-nav-count {
    background: rgba(255,255,255,0.25);
}

/* ==========================================================================
   BODY & CATEGORIES
   ========================================================================== */
html body.page-template-template-faq-hub-php .faq-hub-body {
    display: block !important;
    width: 100% !important;
    padding: 48px 0;
    background: var(--med-bg-light);
}

html body.page-template-template-faq-hub-php .faq-hub-category {
    display: block !important;
    width: 100% !important;
    margin-bottom: 56px;
}

html body.page-template-template-faq-hub-php .faq-hub-category:last-child {
    margin-bottom: 0;
}

html body.page-template-template-faq-hub-php .faq-hub-cat-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--med-border);
}

html body.page-template-template-faq-hub-php .faq-hub-cat-title {
    font-size: clamp(1.25rem, 3vw, 1.625rem);
    font-weight: 700;
    color: var(--med-text);
    margin: 0;
}

html body.page-template-template-faq-hub-php .faq-hub-cat-count {
    font-size: 0.875rem;
    color: var(--med-text-muted);
    font-weight: 500;
    background: var(--med-bg-gray);
    padding: 4px 12px;
    border-radius: 999px;
}

/* Subcategory */
html body.page-template-template-faq-hub-php .faq-hub-subcategory {
    display: block !important;
    width: 100% !important;
    margin-bottom: 36px;
}

html body.page-template-template-faq-hub-php .faq-hub-subcat-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--med-text-light);
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 3px solid var(--med-primary);
}

/* ==========================================================================
   GRID — Flexbox for equal-width cards
   ========================================================================== */
html body.page-template-template-faq-hub-php .faq-hub-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
    width: 100% !important;
}

/* Card */
html body.page-template-template-faq-hub-php .faq-hub-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    padding: 18px 20px;
    background: var(--med-bg);
    border: 1px solid var(--med-border);
    border-radius: var(--med-radius-sm);
    text-decoration: none;
    transition: var(--med-transition);
    position: relative;
    overflow: hidden;
    flex: 1 1 calc(33.333% - 11px);
    min-width: 280px;
    max-width: 100%;
}

html body.page-template-template-faq-hub-php .faq-hub-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--med-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

html body.page-template-template-faq-hub-php .faq-hub-card:hover,
html body.page-template-template-faq-hub-php .faq-hub-card:focus-visible {
    border-color: var(--med-primary);
    box-shadow: var(--med-shadow-hover);
    transform: translateY(-3px);
    outline: none;
}

html body.page-template-template-faq-hub-php .faq-hub-card:hover::before,
html body.page-template-template-faq-hub-php .faq-hub-card:focus-visible::before {
    opacity: 1;
}

html body.page-template-template-faq-hub-php .faq-hub-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--med-text);
    line-height: 1.4;
}

html body.page-template-template-faq-hub-php .faq-hub-card-meta {
    font-size: 0.8125rem;
    color: var(--med-text-muted);
}

html body.page-template-template-faq-hub-php .faq-hub-card-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: var(--med-text-muted);
    transition: var(--med-transition);
}

html body.page-template-template-faq-hub-php .faq-hub-card:hover .faq-hub-card-arrow,
html body.page-template-template-faq-hub-php .faq-hub-card:focus-visible .faq-hub-card-arrow {
    color: var(--med-primary);
    right: 12px;
}

/* ==========================================================================
   CTA
   ========================================================================== */
html body.page-template-template-faq-hub-php .faq-hub-cta {
    background: linear-gradient(135deg, var(--med-primary) 0%, var(--med-secondary) 100%);
    padding: 56px 0;
    color: #fff;
    text-align: center;
}

html body.page-template-template-faq-hub-php .faq-hub-cta-inner {
    max-width: var(--med-container);
    margin-inline: auto;
    padding-inline: 24px;
}

html body.page-template-template-faq-hub-php .faq-hub-cta h2 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
    margin-bottom: 12px;
    color: #fff;
}

html body.page-template-template-faq-hub-php .faq-hub-cta p {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 24px;
    line-height: 1.6;
}

/* ==========================================================================
   TRUST / EEAT
   ========================================================================== */
html body.page-template-template-faq-hub-php .faq-hub-trust {
    background: var(--med-text);
    padding: 28px 0;
    color: var(--med-bg-gray);
}

html body.page-template-template-faq-hub-php .faq-hub-trust-inner {
    max-width: var(--med-container);
    margin-inline: auto;
    padding-inline: 24px;
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    font-size: 0.875rem;
}

html body.page-template-template-faq-hub-php .faq-hub-trust-item strong {
    color: var(--med-bg);
}

html body.page-template-template-faq-hub-php .faq-hub-trust-item a {
    color: #93c5fd;
    text-decoration: none;
}

html body.page-template-template-faq-hub-php .faq-hub-trust-item a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1023px) {
    html body.page-template-template-faq-hub-php .faq-hub-card {
        flex: 1 1 calc(50% - 8px);
        min-width: 240px;
    }
}

@media (max-width: 639px) {
    html body.page-template-template-faq-hub-php .faq-hub-hero {
        padding: 40px 0 32px;
    }
    html body.page-template-template-faq-hub-php .faq-hub-stats {
        gap: 24px;
    }
    html body.page-template-template-faq-hub-php .faq-hub-nav-links {
        gap: 8px;
    }
    html body.page-template-template-faq-hub-php .faq-hub-nav-link {
        padding: 6px 12px;
        font-size: 0.8125rem;
    }
    html body.page-template-template-faq-hub-php .faq-hub-card {
        flex: 1 1 100%;
        min-width: auto;
    }
    html body.page-template-template-faq-hub-php .faq-hub-cat-header {
        flex-wrap: wrap;
    }
    html body.page-template-template-faq-hub-php .faq-hub-trust-inner {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        text-align: center;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    html body.page-template-template-faq-hub-php .faq-hub-card,
    html body.page-template-template-faq-hub-php .faq-hub-nav-link {
        transition: none !important;
    }
    html body.page-template-template-faq-hub-php .faq-hub-card:hover,
    html body.page-template-template-faq-hub-php .faq-hub-card:focus-visible {
        transform: none !important;
    }
}

/* ==========================================================================
   FIX: Prevent single cards from stretching full grid width
   ========================================================================== */
html body.page-template-template-faq-hub-php .faq-hub-grid .faq-hub-card {
    max-width: 360px !important;
    justify-self: start !important;
}

@media (max-width: 1023px) {
    html body.page-template-template-faq-hub-php .faq-hub-grid .faq-hub-card {
        max-width: 100% !important;
        justify-self: stretch !important;
    }
}
