/**
 * Hero: Single Best / Top / Alternatives Pages
 * Background matches site's categories-discovery-hero: var(--bg-base) + .hero-glow
 * Sponsored badge CSS is NOT overridden — uses existing site class styles.
 */

/* =========================================================
   SECTION — Match archive hero exactly (var(--bg-base) + hero-glow overlay)
   ========================================================= */

.hbta-hero {
    position: relative;
    padding: 32px 0 64px 0;
    /* Reduced top padding for tighter look */
    background: var(--bg-base);
    overflow: hidden;
}

/* .hero-glow is already styled in ai-tools.css:
   radial-gradient(circle, rgba(168,85,247,0.1) 0%, transparent 70%)
   No need to redefine it here — it inherits that styling. */

.hbta-container {
    position: relative;
    z-index: 1;
}

/* =========================================================
   BREADCRUMB (full-width row, top)
   ========================================================= */

.hbta-hero .breadcrumbs-hero {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 0 32px 0 !important;
    /* Reduced from 48px */
    text-align: left !important;
    z-index: 5 !important;
    max-width: 60%;
    /* Align with desktop grid's 60% col */
    display: block !important;
}

@media (max-width: 768px) {
    .hbta-hero .breadcrumbs-hero {
        max-width: 100% !important;
        margin-bottom: 32px !important;
        /* Increased mobile gap */
    }
}

.hbta-hero .breadcrumb-pill {
    justify-content: flex-start !important;
    margin: 0 !important;
}

/* =========================================================
   SPONSORED BADGE — centered inline below breadcrumb
   (CSS is inherited from site. Only centering override here.)
   ========================================================= */

.hbta-sponsored-center {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.hbta-sponsored-col {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 12px;
}

/* =========================================================
   2-COL HERO GRID (60/40)
   ========================================================= */

.hbta-hero-grid {
    display: grid;
    grid-template-columns: 60fr 40fr;
    /* Matches editorial layout (60/40) */
    gap: 44px;
    align-items: start;
}

/* =========================================================
   LEFT COLUMN
   ========================================================= */

.hbta-hero-left {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: flex-start;
    /* Ensure everything stays left-aligned */
}

/* H1 title */
.hbta-hero-title {
    font-size: clamp(1.75rem, 3.5vw, 2.6rem);
    font-weight: 800;
    line-height: 1.25;
    color: var(--text-color);
    margin: 0;
}

/* Count prefix — same color as title text */
.hbta-title-count {
    color: inherit;
    margin-right: 4px;
}

/* Category Highlight — Brand Gradient Clip Style */
.hbta-hero-title .hbta-highlight {
    background: var(--brand-gradient, linear-gradient(135deg, #a855f7, #3b82f6));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* Year — same color as title text, same weight */
.hbta-title-year {
    color: inherit;
    font-size: 1em;
    font-weight: 800;
    margin-left: 8px;
}

/* SEO Summary — 2 lines max */
.hbta-hero-desc {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

/* Industry # tags — max 3 */
.hbta-industry-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hbta-industry-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    background: rgba(var(--primary-rgb), 0.07);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.18);
    text-decoration: none;
    transition: background 0.2s ease;
}

.hbta-industry-tag:hover {
    background: rgba(var(--primary-rgb), 0.14);
}

/* =========================================================
   TOC — SaaS Premium Style (matching single-toc.css)
   ========================================================= */

.hbta-toc-container {
    background: var(--glass-bg, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    margin-top: 12px;
    width: 100%;
    max-width: 480px;
    transition: var(--transition-base, all 0.3s ease);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
}

.hbta-toc-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.02);
    border: none;
    cursor: pointer;
    color: var(--text-primary, var(--text-color));
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    transition: all 0.2s ease;
}

.hbta-toc-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.hbta-toc-icon {
    display: flex;
    align-items: center;
    color: var(--primary);
    width: 18px;
    height: 18px;
}

.hbta-toc-label {
    flex: 1;
    margin-left: 10px;
}

.hbta-toc-arrow {
    color: var(--text-muted);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    width: 18px;
    height: 18px;
}

.hbta-toc-toggle[aria-expanded="true"] .hbta-toc-arrow {
    transform: rotate(180deg);
}

.hbta-toc-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
}

.hbta-toc-list:not([hidden]) {
    max-height: 240px;
    overflow-y: auto;
    padding: 10px 0;
}

/* Custom Scrollbar */
.hbta-toc-list::-webkit-scrollbar {
    width: 4px;
}

.hbta-toc-list::-webkit-scrollbar-track {
    background: transparent;
}

.hbta-toc-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.hbta-toc-list ol {
    list-style: none;
    margin: 0;
    padding: 0 8px;
}

.hbta-toc-item {
    border-radius: 8px;
    transition: background 0.15s ease;
}

.hbta-toc-link {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hbta-toc-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
    padding-left: 14px;
}

.hbta-toc-num {
    font-weight: 700;
    color: var(--primary);
    font-size: 12px;
    flex-shrink: 0;
    min-width: 20px;
}

/* =========================================================
   RIGHT COLUMN — Feature Image
   ========================================================= */

.hbta-hero-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.hbta-feature-img-wrap {
    position: relative;
    width: 100%;
    max-width: 420px;
    /* Made slightly smaller for tighter look */
    margin: 0;
    padding: 10px;
    background: var(--glass-bg, rgba(255, 255, 255, 0.03));
    border-radius: 20px;
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.2),
        0 0 40px color-mix(in srgb, var(--primary) 12%, transparent);
    /* Initial subtle glow */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    z-index: 10;
}

/* Hover Animation & Glow Intensification */
.hbta-feature-img-wrap:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary);
    box-shadow:
        0 20px 48px rgba(0, 0, 0, 0.3),
        0 0 60px color-mix(in srgb, var(--primary) 25%, transparent);
    /* Intensified glow */
}

/* Light Mode Adjustments */
[data-theme="light"] .hbta-feature-img-wrap {
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 0 30px rgba(var(--primary-rgb), 0.05);
}

.hbta-feature-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 16/10;
    /* Slightly taller for more visual impact */
    border-radius: 14px;
    /* Internal radius for the actual image */
    transition: transform 0.5s ease;
}

.hbta-feature-img-wrap:hover .hbta-feature-img {
    transform: scale(1.01);
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {
    .hbta-hero {
        padding: 24px 0 32px 0;
    }

    .hbta-hero-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* Feature image on top on mobile */
    .hbta-hero-right {
        order: -1;
    }

    .hbta-hero-title {
        font-size: clamp(1.35rem, 6vw, 1.85rem);
        text-align: center;
    }

    .hbta-hero-desc {
        text-align: center;
    }

    .hbta-industry-tags {
        justify-content: center;
    }

    .hbta-hero .breadcrumbs-hero {
        text-align: left !important;
        margin: 0 0 12px 0 !important;
        display: block !important;
        width: 100% !important;
    }

    .hbta-hero .breadcrumb-pill {
        font-size: 10px !important;
        gap: 8px !important;
        padding: 0 !important;
        display: inline-flex !important;
        margin: 0 !important;
        justify-content: flex-start !important;
        background: none !important;
        border: none !important;
    }

    .hbta-hero .breadcrumb-sep {
        font-size: 11px;
        margin: 0;
    }

    .hbta-sponsored-center,
    .hbta-sponsored-col {
        justify-content: center;
        margin-bottom: 16px;
    }
}