/**
 * BFAI Homepage — Premium SaaS Styles v2
 * Improvements: fixed-height cards, internal tool scroll, desktop horizontal snap for categories,
 * section padding, mobile centering + scroll arrows, 2-line desc clamp, design polish.
 *
 * @package BFAITools\UI
 */

/* ============================================================
   COLOR TOKENS
============================================================ */
:root {
    --hp-card-new: 6, 182, 212;
    --hp-card-trending: 124, 58, 237;
    --hp-card-popular: 245, 158, 11;

    --hp-cat-1: 99, 102, 241;
    --hp-cat-2: 168, 85, 247;
    --hp-cat-3: 16, 185, 129;
    --hp-cat-4: 59, 130, 246;
    --hp-cat-5: 236, 72, 153;
    --hp-cat-6: 245, 158, 11;
    --hp-cat-7: 239, 68, 68;
    --hp-cat-8: 20, 184, 166;
    --hp-cat-9: 14, 165, 233;
    --hp-cat-10: 234, 179, 8;
    --hp-cat-11: 249, 115, 22;
    --hp-cat-12: 132, 204, 22;

    --hp-card-radius: 18px;
    --hp-card-gap: 1.25rem;
    --hp-section-gap: 5rem;
    /* top + bottom spacing between sections */
    --hp-featured-h: 510px;
    /* fixed height for featured tool cards */
    --hp-cat-card-h: 480px;
    /* fixed height for category cards */
    --hp-cat-card-w: 272px;
    /* desktop: 4 visible in ~1200px container */
}

/* ============================================================
   SECTION SPACING (after hero, each section gets top+bottom)
============================================================ */
.hp-featured-tools-section,
.hp-trending-categories-section {
    padding: var(--hp-section-gap) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Separator + padding for category grid, SEO, why us, FAQ, CTA */
.hp-section {
    padding: var(--hp-section-gap) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.hp-cta-section {
    text-align: center;
    border-bottom: none;
    padding-top: calc(var(--hp-section-gap) * 1.4);
    padding-bottom: calc(var(--hp-section-gap) * 1.4);
}

/* Final CTA button — generous internal padding */
.btn-final-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1rem 2.25rem;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    transition: transform 0.2s cubic-bezier(.22, .68, 0, 1.4),
        box-shadow 0.2s ease,
        opacity 0.2s ease;
}

.btn-final-cta:hover {
    transform: translateY(-3px);
    opacity: 0.92;
}

.btn-final-cta:active {
    transform: translateY(0) scale(0.97);
    transition-duration: 0.1s;
}

body.light-mode .hp-featured-tools-section,
body.light-mode .hp-trending-categories-section {
    border-bottom-color: rgba(0, 0, 0, 0.07);
}

body.light-mode .hp-section {
    border-top-color: rgba(0, 0, 0, 0.07);
}

/* Explore button — smaller text in card CTA */
.hp-cat-card-action .btn-explore {
    font-size: 10px;
}

.btn-explore-arrow {
    font-size: 0.9rem;
    line-height: 1;
    flex-shrink: 0;
}

/* ============================================================
   SECTION HEADER
============================================================ */
.section-header-centered {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 2.5rem;
}

.section-header-centered .section-title {
    font-size: clamp(1.7rem, 3.5vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0 0 0.65rem;
}

.section-header-centered .section-subtitle {
    font-size: 1rem;
    opacity: 0.68;
    line-height: 1.65;
    margin: 0;
}

/* Sponsored badge — top of hero, centered */
.hp-sponsored-top {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

/* ============================================================
   HERO OVERRIDES (homepage-specific)
============================================================ */
.hp-hero .hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.hp-hero-title {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    line-height: 1.18;
    text-align: center;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 1.2rem;
}

/* ============================================================
   SCROLL NAV ARROWS — shared
============================================================ */
.hp-scroll-nav {
    display: none;
    /* hidden by default, shown per section */
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    user-select: none;
}

.hp-scroll-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s cubic-bezier(.22, .68, 0, 1.5),
        color 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.hp-scroll-btn svg {
    pointer-events: none;
    display: block;
    flex-shrink: 0;
}

.hp-scroll-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.32);
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35),
        0 0 0 3px rgba(255, 255, 255, 0.07),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: scale(1.12);
}

.hp-scroll-btn:active {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(0.9);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
    transition-duration: 0.07s;
}

.hp-scroll-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.55);
    outline-offset: 2px;
}


.hp-scroll-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transition: background 0.2s, transform 0.2s;
}

.hp-scroll-dot.active {
    background: rgba(255, 255, 255, 0.75);
    transform: scale(1.3);
}

[data-theme="light"] .hp-scroll-btn {
    background: rgba(15, 23, 42, 0.08);
    border-color: rgba(15, 23, 42, 0.28);
    color: rgba(15, 23, 42, 0.85);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .hp-scroll-btn:hover {
    background: rgba(15, 23, 42, 0.14);
    border-color: rgba(15, 23, 42, 0.45);
    color: rgb(15, 23, 42);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18),
        0 0 0 3px rgba(15, 23, 42, 0.07);
}

[data-theme="light"] .hp-scroll-btn:active {
    background: rgba(15, 23, 42, 0.2);
}

/* ============================================================
   GLASS CARD BASE
============================================================ */
.hp-tool-card.glass-card-premium,
.hp-cat-card.glass-card-premium {
    background: rgba(255, 255, 255, 0.035);
    border-radius: var(--hp-card-radius);
    position: relative;
    overflow: hidden;
    transition: transform 0.28s cubic-bezier(.22, .68, 0, 1.2),
        box-shadow 0.28s ease,
        border-color 0.28s ease;
}

.hp-tool-card.glass-card-premium .card-glow,
.hp-cat-card.glass-card-premium .card-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
}

/* ============================================================
   FEATURED TOOLS — SECTION 2
   3-column grid on desktop | horizontal snap on mobile
============================================================ */
.hp-featured-scroll-outer {
    position: relative;
    width: 100%;
}

.hp-featured-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--hp-card-gap);
    align-items: start;
}

/* Fixed-height card */
.hp-tool-card.glass-card-premium {
    height: var(--hp-featured-h);
    border: 1px solid rgba(var(--card-accent, 99, 102, 241), 0.22);
    flex-shrink: 0;
}

.hp-tool-card.glass-card-premium .card-glow {
    background: radial-gradient(ellipse at top left, rgba(var(--card-accent), 0.12) 0%, transparent 70%);
}

.hp-tool-card.glass-card-premium:hover {
    transform: translateY(-5px);
    border-color: rgba(var(--card-accent), 0.5);
    box-shadow: 0 16px 48px rgba(var(--card-accent), 0.2);
}

/* Card layout — flex column so tool list fills remaining space */
.hp-tool-card .card-inner {
    padding: 1.5rem;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Header — fixed at top */
.hp-card-header {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(var(--card-accent), 0.18);
}

.hp-card-icon-wrap {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(var(--card-accent), 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(var(--card-accent));
    transition: background 0.2s;
}

.hp-tool-card:hover .hp-card-icon-wrap {
    background: rgba(var(--card-accent), 0.28);
}

.hp-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
    line-height: 1.3;
}

.hp-card-desc {
    font-size: 0.77rem;
    opacity: 0.6;
    margin: 0;
    line-height: 1.5;
}

/* Tool list — fills remaining height and scrolls internally */
.hp-tool-list {
    flex: 1;
    min-height: 0;
    /* critical for flex children overflow */
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--card-accent), 0.3) transparent;
}

.hp-tool-list::-webkit-scrollbar {
    width: 3px;
}

.hp-tool-list::-webkit-scrollbar-thumb {
    background: rgba(var(--card-accent), 0.35);
    border-radius: 3px;
}

.hp-tool-item {
    border-radius: 9px;
    transition: background 0.15s;
}

.hp-tool-item:hover {
    background: rgba(var(--card-accent), 0.1);
}

.hp-tool-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.48rem 0.55rem;
    text-decoration: none;
    color: inherit;
    border-radius: 9px;
}

.hp-tool-link:hover {
    color: rgb(var(--card-accent));
}

.hp-tool-rank {
    flex-shrink: 0;
    font-size: 0.67rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: rgb(var(--card-accent));
    min-width: 22px;
    text-align: right;
    opacity: 0.85;
}

.hp-tool-logo {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.18s;
}

.hp-tool-link:hover .hp-tool-logo {
    transform: scale(1.08);
}

.hp-tool-name {
    flex: 1;
    font-size: 0.865rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.hp-tool-ext-icon {
    flex-shrink: 0;
    opacity: 0.38;
    display: flex;
    align-items: center;
}

/* Empty state */
.hp-tool-empty {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.5rem 0.75rem;
    font-size: 0.875rem;
    opacity: 0.6;
    line-height: 1.55;
}

/* Card footer — pinned at bottom */
.hp-card-footer {
    flex-shrink: 0;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(var(--card-accent), 0.15);
}

.hp-view-all-link {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgb(var(--card-accent));
    text-decoration: none;
    transition: gap 0.18s;
}

.hp-view-all-link:hover {
    gap: 0.7rem;
}

/* ============================================================
   TRENDING CATEGORIES — SECTION 3
   Always horizontal scroll — 4 cards visible on desktop
============================================================ */
.hp-cat-scroll-outer {
    position: relative;
    width: 100%;
}

/* Scrollable wrapper — on ALL screen sizes */
.hp-trending-categories-scroll-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.5rem;
}

.hp-trending-categories-scroll-wrapper::-webkit-scrollbar {
    display: none;
}

.hp-trending-categories-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--hp-card-gap);
    padding: 0.25rem 0 0.5rem;
    /* room for hover shadow */
}

/* Category card — fixed width so 4 show at once on desktop */
.hp-cat-card.glass-card-premium {
    flex: 0 0 var(--hp-cat-card-w);
    width: var(--hp-cat-card-w);
    height: var(--hp-cat-card-h);
    border: 1px solid rgba(var(--cat-accent, 99, 102, 241), 0.2);
    scroll-snap-align: start;
}

.hp-cat-card.glass-card-premium .card-glow {
    background: radial-gradient(ellipse at top left, rgba(var(--cat-accent), 0.1) 0%, transparent 65%);
}

.hp-cat-card.glass-card-premium:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--cat-accent), 0.48);
    box-shadow: 0 14px 36px rgba(var(--cat-accent), 0.18);
}

/* Category card inner — flex column */
.hp-cat-card .card-inner {
    padding: 1.25rem;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    gap: 0.7rem;
}

/* Top row */
.hp-cat-card-top {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hp-cat-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: rgba(var(--cat-accent), 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(var(--cat-accent));
    flex-shrink: 0;
    transition: background 0.2s, transform 0.2s;
}

.hp-cat-card:hover .hp-cat-icon-wrap {
    background: rgba(var(--cat-accent), 0.28);
    transform: rotate(-5deg) scale(1.08);
}

.hp-cat-tool-count {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    background: rgba(var(--cat-accent), 0.16);
    color: rgb(var(--cat-accent));
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgb(var(--cat-accent));
    display: inline-block;
    animation: bfai-pulse 2s infinite;
}

/* Category card content — shrink: 0, clamp desc to 2 lines */
.hp-cat-card-content {
    flex-shrink: 0;
}

.hp-cat-title {
    font-size: 0.92rem;
    font-weight: 700;
    margin: 0 0 0.3rem;
    line-height: 1.3;
}

.hp-cat-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s;
}

.hp-cat-title a:hover {
    color: rgb(var(--cat-accent));
}

.hp-cat-desc {
    font-size: 0.77rem;
    opacity: 0.6;
    line-height: 1.5;
    margin: 0;
    /* 2-line clamp */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tool list — fills remaining space, scrolls internally */
.hp-cat-tool-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0.5rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    border-top: 1px solid rgba(var(--cat-accent), 0.14);
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--cat-accent), 0.3) transparent;
}

.hp-cat-tool-list::-webkit-scrollbar {
    width: 3px;
}

.hp-cat-tool-list::-webkit-scrollbar-thumb {
    background: rgba(var(--cat-accent), 0.35);
    border-radius: 3px;
}

.hp-cat-tool-item {
    border-radius: 8px;
    transition: background 0.13s;
}

.hp-cat-tool-item:hover {
    background: rgba(var(--cat-accent), 0.1);
}

.hp-cat-tool-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.5rem;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
}

.hp-cat-tool-link:hover .hp-tool-name {
    color: rgb(var(--cat-accent));
}

/* Card Action — pinned at bottom */
.hp-cat-card-action {
    flex-shrink: 0;
}

.hp-cat-card-action .btn-explore {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    background: rgba(var(--cat-accent), 0.14);
    color: rgb(var(--cat-accent));
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid rgba(var(--cat-accent), 0.22);
    transition: background 0.18s, border-color 0.18s, gap 0.18s;
    justify-content: center;
    white-space: nowrap;
}

.hp-cat-card-action .btn-explore:hover {
    background: rgba(var(--cat-accent), 0.26);
    border-color: rgba(var(--cat-accent), 0.45);
    gap: 0.65rem;
}

/* Empty state */
.hp-cat-empty {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 2rem;
    font-size: 0.875rem;
    opacity: 0.62;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.13);
}

/* Show category arrows on all screen sizes */
.hp-trending-categories-section .hp-scroll-nav {
    display: flex;
}

/* Category discovery grid — force header to span all columns, centered */
.categories-discovery-grid .section-header-centered {
    grid-column: 1 / -1;
    text-align: center;
    margin-bottom: 2rem;
}

/* ============================================================
   ANIMATIONS
============================================================ */
@keyframes bfai-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

@keyframes bfai-fade-up {
    from {
        opacity: 0;
        transform: translateY(22px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hp-featured-tools-grid>*,
.hp-trending-categories-grid>* {
    animation: bfai-fade-up 0.45s ease both;
}

.hp-featured-tools-grid>*:nth-child(1) {
    animation-delay: 0.05s;
}

.hp-featured-tools-grid>*:nth-child(2) {
    animation-delay: 0.13s;
}

.hp-featured-tools-grid>*:nth-child(3) {
    animation-delay: 0.21s;
}

.hp-trending-categories-grid>*:nth-child(1) {
    animation-delay: 0.04s;
}

.hp-trending-categories-grid>*:nth-child(2) {
    animation-delay: 0.08s;
}

.hp-trending-categories-grid>*:nth-child(3) {
    animation-delay: 0.12s;
}

.hp-trending-categories-grid>*:nth-child(4) {
    animation-delay: 0.16s;
}

.hp-trending-categories-grid>*:nth-child(5) {
    animation-delay: 0.20s;
}

.hp-trending-categories-grid>*:nth-child(6) {
    animation-delay: 0.24s;
}

.hp-trending-categories-grid>*:nth-child(7) {
    animation-delay: 0.28s;
}

.hp-trending-categories-grid>*:nth-child(8) {
    animation-delay: 0.32s;
}

.hp-trending-categories-grid>*:nth-child(9) {
    animation-delay: 0.36s;
}

.hp-trending-categories-grid>*:nth-child(10) {
    animation-delay: 0.40s;
}

.hp-trending-categories-grid>*:nth-child(11) {
    animation-delay: 0.44s;
}

.hp-trending-categories-grid>*:nth-child(12) {
    animation-delay: 0.48s;
}

/* ============================================================
   LIGHT MODE
============================================================ */
body.light-mode .hp-tool-card.glass-card-premium,
body.light-mode .hp-cat-card.glass-card-premium {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
}

body.light-mode .hp-tool-card.glass-card-premium:hover,
body.light-mode .hp-cat-card.glass-card-premium:hover {
    box-shadow: 0 14px 40px rgba(var(--card-accent, 99, 102, 241), 0.15);
}

body.light-mode .hp-card-header,
body.light-mode .hp-card-footer,
body.light-mode .hp-cat-tool-list {
    border-color: rgba(0, 0, 0, 0.09);
}

body.light-mode .hp-tool-logo {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .hp-cat-empty {
    background: rgba(0, 0, 0, 0.025);
    border-color: rgba(0, 0, 0, 0.1);
}

/* ============================================================
   RESPONSIVE — TABLET (≤1200px)
   Category: shrink card width so ~3 show
============================================================ */
@media (max-width: 1200px) {
    :root {
        --hp-cat-card-w: 255px;
    }
}

/* ============================================================
   RESPONSIVE — LAPTOP (≤992px)
   Featured: 2-column grid | Category: 240px cards (~3 visible)
============================================================ */
@media (max-width: 992px) {
    :root {
        --hp-cat-card-w: 240px;
    }

    .hp-featured-tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   RESPONSIVE — TABLET/MOBILE (≤768px)
   Featured: horizontal snap | Category: 1 card full-width
   Center cards, show prev/next arrows, smaller card sizes
============================================================ */
@media (max-width: 768px) {
    :root {
        --hp-section-gap: 2.75rem;
        --hp-featured-h: 480px;
        --hp-cat-card-h: 430px;
        --hp-cat-card-w: calc(100vw - 4rem);
    }

    /* — Featured: horizontal snap — */
    .hp-featured-scroll-outer {
        overflow-x: auto;
        overflow-y: visible;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Removed negative margin — let container padding be the guttering */
        padding: 0.25rem 0 1rem 1.25rem;
        scroll-padding-left: 1.25rem;
    }

    .hp-featured-scroll-outer::-webkit-scrollbar {
        display: none;
    }

    .hp-featured-tools-grid {
        display: flex;
        flex-wrap: nowrap;
        gap: var(--hp-card-gap);
        width: max-content;
        padding-right: 1.25rem;
        /* right breathing room */
    }

    .hp-tool-card.glass-card-premium {
        flex: 0 0 calc(100vw - 4rem);
        /* card width: vw minus container padding+left gutter */
        max-width: 310px;
        scroll-snap-align: start;
    }

    /* Show mobile arrows for featured section */
    .hp-featured-tools-section .hp-scroll-nav {
        display: flex;
    }

    /* — Category: same clean padding approach — */
    .hp-trending-categories-scroll-wrapper {
        padding: 0.25rem 0 1rem 1.25rem;
        scroll-padding-left: 1.25rem;
    }

    .hp-trending-categories-grid {
        padding-right: 1.25rem;
    }

    .hp-cat-card.glass-card-premium {
        max-width: 300px;
        font-size: 10px;
        /* Explore button inherits this override via 11px rule above */
    }

    .hp-cat-card-action .btn-explore {
        font-size: 10px;
    }

    .section-header-centered {
        margin-bottom: 1.5rem;
    }

    .section-header-centered .section-title {
        font-size: clamp(1.2rem, 5vw, 1.55rem);
    }

    .hp-hero-title {
        font-size: clamp(1.75rem, 7vw, 2.4rem);
    }

    /* Smaller section separation on mobile */
    .hp-featured-tools-section,
    .hp-trending-categories-section,
    .hp-section {
        padding: 2.5rem 0;
    }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE (≤480px)
============================================================ */
@media (max-width: 480px) {
    :root {
        --hp-featured-h: 450px;
        --hp-cat-card-h: 400px;
    }

    .hp-tool-card .card-inner,
    .hp-cat-card .card-inner {
        padding: 1rem;
    }

    .hp-card-title {
        font-size: 0.88rem;
    }

    .hp-cat-title {
        font-size: 0.85rem;
    }

    .hp-tool-card.glass-card-premium,
    .hp-cat-card.glass-card-premium {
        max-width: 280px;
    }
}

/* ============================================================
   PREMIUM CTA BLOCK (Section 8)
============================================================ */
.hp-cta-inner {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid rgba(124, 58, 237, 0.28);
    background: linear-gradient(135deg,
            rgba(124, 58, 237, 0.13) 0%,
            rgba(99, 102, 241, 0.08) 50%,
            rgba(16, 185, 129, 0.05) 100%);
}

.hp-cta-inner .card-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% -20%, rgba(124, 58, 237, 0.3) 0%, transparent 65%);
    pointer-events: none;
}

.hp-cta-content {
    position: relative;
    z-index: 1;
    padding: 4.5rem 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.4rem;
    text-align: center;
}

.hp-cta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 1rem;
    border-radius: 20px;
    background: rgba(124, 58, 237, 0.15);
    border: 1px solid rgba(124, 58, 237, 0.28);
    font-size: 0.76rem;
    font-weight: 600;
    color: rgb(167, 139, 250);
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.hp-cta-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin: 0;
}

.hp-cta-subtitle {
    font-size: 1rem;
    line-height: 1.65;
    opacity: 0.65;
    max-width: 520px;
    margin: 0;
}

.hp-cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin-top: 0.5rem;
}

.btn-cta-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.95rem 1.75rem;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}

.btn-cta-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
    transform: translateY(-2px);
}

[data-theme="light"] .hp-cta-badge {
    color: rgb(109, 40, 217);
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(124, 58, 237, 0.2);
}

[data-theme="light"] .hp-cta-inner {
    border-color: rgba(124, 58, 237, 0.2);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.07) 0%, rgba(99, 102, 241, 0.04) 50%, rgba(16, 185, 129, 0.03) 100%);
}

[data-theme="light"] .btn-cta-secondary {
    color: rgba(15, 23, 42, 0.72);
    border-color: rgba(15, 23, 42, 0.16);
    background: rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .btn-cta-secondary:hover {
    background: rgba(15, 23, 42, 0.1);
    border-color: rgba(15, 23, 42, 0.28);
    color: rgb(15, 23, 42);
}

@media (max-width: 768px) {
    .hp-cta-content {
        padding: 2.5rem 1.25rem;
        gap: 1.1rem;
    }

    .hp-cta-badge {
        font-size: 0.65rem;
        letter-spacing: 0.015em;
        padding: 0.28rem 0.85rem;
        white-space: nowrap;
        /* stay on one line */
    }

    .hp-cta-title {
        font-size: clamp(1.55rem, 6.5vw, 2rem);
    }

    .hp-cta-subtitle {
        font-size: 0.9rem;
    }

    .hp-cta-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .btn-final-cta {
        width: 100%;
        justify-content: center;
        padding: 1rem 1.25rem;
        font-size: 0.93rem;
        white-space: nowrap;
    }

    .btn-cta-secondary {
        width: 100%;
        justify-content: center;
        padding: 0.85rem 1.25rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }
}