/* ==========================================================================
   AI Lensly V2 — Tool Detail Styles
   Single tool page only: hero, best for/not for, features, pricing, pros/cons.
   Loaded on single-ai_tool only.
   ========================================================================== */

/* --- Tool Hero --- */
.tool-hero {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* When gallery present — two-column layout */
.tool-hero.has-gallery {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--space-xl);
}

.tool-hero.has-gallery .tool-hero-left {
    flex: 0 0 55%;
}

.tool-hero.has-gallery .tool-hero-right {
    flex: 0 0 calc(45% - var(--space-xl));
    position: sticky;
    top: 88px;
}

.tool-hero-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Header: logo + title row */
.tool-hero-header {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.tool-hero-logo {
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    object-fit: cover;
}

.tool-hero-titles {
    flex: 1;
    min-width: 0;
}

.tool-hero-name {
    font-size: var(--font-size-2xl);
    margin-bottom: 2px;
}

.tool-hero-summary {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-xs);
}

.tool-hero-tags {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.tool-hero-tag {
    font-size: var(--font-size-xs);
    color: var(--color-secondary);
    background: var(--color-secondary-light);
    padding: 2px var(--space-sm);
    border-radius: var(--radius-sm);
    text-decoration: none;
}

.tool-hero-tag:hover {
    background: var(--color-secondary);
    color: white;
}

.tool-hero-right {
    display: flex;
    flex-direction: column;
}

/* Stats row */
.tool-hero-stats {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
    padding-top: var(--space-xs);
    border-top: 1px solid var(--color-border-light);
}

.tool-hero-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tool-hero-stat .stat-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tool-hero-stat .stat-value {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
}

.stat-note {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    display: block;
    margin-top: 1px;
}

/* --- Rating Details --- */
.rating-details {
    position: relative;
}

.rating-details summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.rating-details summary::-webkit-details-marker {
    display: none;
}

/* Hide duplicate number from rating_stars(); we show our own /5 text */
.rating-details .rating-number {
    display: none;
}

.rating-details-text {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    font-weight: var(--font-weight-medium);
}

.rating-details summary:hover .rating-details-text {
    color: var(--color-secondary);
}

.rating-details-body {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 20;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-md);
    min-width: 200px;
    margin-top: var(--space-xs);
}

.rating-details-body p {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-xs);
    font-weight: var(--font-weight-medium);
}

.rating-details-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rating-details-body li {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    padding: 3px 0;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.rating-details-body li::before {
    content: '\2022';
    color: var(--color-secondary);
    font-weight: bold;
}

/* --- Review Evidence Badge --- */
.tool-hero-evidence {
    padding-top: var(--space-xs);
}

.evidence-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-xs);
    padding: 4px var(--space-sm);
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-medium);
}

.evidence-hands-on {
    background: #dbeafe;
    color: #1e40af;
}

.evidence-editorial {
    background: #f1f5f9;
    color: var(--color-text-secondary);
}

/* --- Pricing Card Note --- */
.pricing-card-note {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-top: 2px;
}

/* --- Hero CTA Row --- */
.tool-hero-cta-row {
    margin-top: var(--space-xs);
}

.tool-hero-cta-buttons {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
}

.tool-hero-cta-note {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin: var(--space-xs) 0 0;
}

.tool-hero-cta {
    min-width: 250px;
}

/* --- Product Gallery (Hero Right) --- */
.tool-gallery {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.tool-gallery-main {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    cursor: zoom-in;
    aspect-ratio: 16 / 10;
}

.tool-gallery-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-md);
    transition: transform 0.3s ease;
}

.tool-gallery-main:hover .tool-gallery-img {
    transform: scale(1.02);
}

/* Zoom icon overlay on hover */
.tool-gallery-main::after {
    content: '\f176';
    font-family: dashicons;
    position: absolute;
    bottom: var(--space-sm);
    right: var(--space-sm);
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s;
}

.tool-gallery-main:hover::after {
    opacity: 1;
}

.tool-gallery-caption {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin: 4px var(--space-sm) 0;
    line-height: 1.4;
    padding: 0 2px;
}

/* Thumbnail strip */
.tool-gallery-thumbs {
    display: flex;
    gap: var(--space-xs);
}

.gallery-thumb {
    width: 64px;
    height: 48px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    padding: 2px;
    cursor: pointer;
    background: none;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 3px;
}

.gallery-thumb:hover {
    border-color: var(--color-secondary-light);
}

.gallery-thumb.active {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 1px var(--color-secondary);
}

/* Hide mobile gallery on desktop (it's inside tool-hero-left) */
.tool-hero-gallery-mobile {
    display: none;
}

/* --- Lightbox Modal --- */
.tool-gallery-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.tool-gallery-lightbox.active {
    display: flex;
    opacity: 1;
}

.tool-gallery-lightbox-inner {
    max-width: 90vw;
    max-height: 85vh;
    position: relative;
}

.tool-gallery-lightbox-inner img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.tool-gallery-lightbox-caption {
    text-align: center;
    color: #ccc;
    font-size: 14px;
    margin-top: var(--space-sm);
    padding: 0 var(--space-md);
}

/* Lightbox close button */
.lb-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lb-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Lightbox nav arrows */
.lb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lb-arrow:hover {
    background: rgba(255, 255, 255, 0.28);
}

.lb-prev { left: -60px; }
.lb-next { right: -60px; }

/* Counter badge */
.lb-counter {
    position: absolute;
    bottom: -36px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

/* --- Tool Sections --- */
.tool-section {
    margin-bottom: var(--space-2xl);
}

.tool-section .section-title {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--color-border-light);
}

/* --- Page Nav — Sticky In-Page Navigation --- */
.tool-page-nav {
    position: relative;
    z-index: 100;
    margin-bottom: var(--space-xl);
}

.tool-page-nav-inner {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 var(--space-md);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    scroll-snap-type: x mandatory;

    /* Sticky bar styling */
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding-top: var(--space-sm);
    padding-bottom: var(--space-sm);

    /* When stuck at top */
    position: sticky;
    top: 72px;
    transition: box-shadow .2s ease, border-color .2s ease;
}

/* Shadow when scrolled / stuck */
.tool-page-nav.is-stuck .tool-page-nav-inner {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    border-color: transparent;
}

/* Hide scrollbar in webkit */
.tool-page-nav-inner::-webkit-scrollbar {
    display: none;
}

.tool-page-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    transition: all .2s ease;
    scroll-snap-align: start;
    flex-shrink: 0;
    position: relative;
    line-height: 1.3;
}

.tool-page-nav a::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: calc(100% - 28px);
    height: 2.5px;
    background: var(--color-secondary);
    border-radius: 2px;
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}

.tool-page-nav a:hover {
    color: var(--color-secondary);
    background: var(--color-secondary-light);
}

.tool-page-nav a:hover::after {
    transform: translateX(-50%) scaleX(0.6);
}

/* Active state (set by JS scroll spy) */
.tool-page-nav a.active {
    color: var(--color-secondary);
    font-weight: 600;
    background: rgba(37, 99, 235, 0.06);
}

.tool-page-nav a.active::after {
    transform: translateX(-50%) scaleX(1);
}

/* --- 30-Second Decision --- */
.decision-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: var(--space-md);
}

.decision-col {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.decision-yes {
    border-left: 3px solid var(--color-success);
    background: #f0fdf4;
}

.decision-no {
    border-left: 3px solid var(--color-warning);
    background: #fffbeb;
}

.decision-col h3 {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-sm);
    color: var(--color-heading);
}

.decision-yes h3 {
    color: var(--color-success);
}

.decision-no h3 {
    color: var(--color-warning);
}

.decision-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.decision-col li {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xs);
    padding-left: var(--space-md);
    position: relative;
}

.decision-yes li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: bold;
}

.decision-no li::before {
    content: '\2022';
    position: absolute;
    left: 2px;
    color: var(--color-warning);
    font-weight: bold;
}

/* --- Alternative Cards --- */
.alt-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-md);
}

.alt-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.alt-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-secondary);
}

.alt-card-header {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-start;
}

.alt-card-logo {
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.alt-card-info {
    flex: 1;
    min-width: 0;
}

.alt-card-name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--color-heading);
    text-decoration: none;
    display: block;
    margin-bottom: 2px;
}

.alt-card-name:hover {
    color: var(--color-secondary);
}

.alt-card-diff {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.alt-card-meta {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.alt-card-rating {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
}

.alt-card-price {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
}

.alt-card-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: auto;
}

.alt-card-details {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-decoration: none;
}

.alt-card-details:hover {
    color: var(--color-secondary);
}

/* --- Key Features --- */
.key-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-md);
}

.key-feature-item {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-start;
    padding: var(--space-md);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}

.key-feature-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    margin-top: 6px;
}

/* --- Alternatives --- */
.tool-related-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
}

.alternative-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.alternative-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text);
    transition: all var(--transition-fast);
}

.alternative-item:hover {
    border-color: var(--color-secondary);
    box-shadow: var(--shadow-sm);
}

.alternative-logo {
    border-radius: var(--radius-sm);
}

.alternative-name {
    flex: 1;
    font-weight: var(--font-weight-medium);
}

.alternative-price {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
}

.comparison-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.comparison-link-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-fast);
}

.comparison-link-item:hover {
    border-color: var(--color-secondary);
    color: var(--color-secondary);
}

.comparison-link-item .vs {
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
}

.comparison-link-arrow {
    margin-left: auto;
    color: var(--color-text-muted);
}

/* --- Tool Content Body --- */
.tool-content-body {
    max-width: var(--content-max);
    line-height: var(--line-height-relaxed);
}

.tool-content-body h2 {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
}

.tool-content-body h3 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
}

.tool-content-body p {
    margin-bottom: var(--space-md);
}

.tool-content-body ul,
.tool-content-body ol {
    margin-bottom: var(--space-md);
    padding-left: var(--space-lg);
}

.tool-content-body li {
    margin-bottom: var(--space-xs);
}

/* --- Footer CTA --- */
.tool-footer-cta {
    background: var(--color-bg-alt);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
}

.tool-footer-cta .visit-cta-block {
    align-items: center;
}

/* --- Trust Note (on tool pages) --- */
.trust-note {
    background: #1e293b;
    color: #cbd5e1;
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.trust-note-icon {
    color: #60a5fa;
    flex-shrink: 0;
}

.trust-note-title {
    color: white;
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-xs);
}

.trust-note-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.trust-note-list li {
    font-size: var(--font-size-xs);
    color: #94a3b8;
    margin-bottom: var(--space-xs);
}

.trust-note-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.trust-note-meta-item {
    font-size: var(--font-size-xs);
    color: #cbd5e1;
}

.trust-note-meta-item strong {
    color: white;
    font-weight: var(--font-weight-medium);
}

.trust-note-methodology {
    display: inline-block;
    margin-top: var(--space-sm);
    font-size: var(--font-size-xs);
    color: #60a5fa;
    text-decoration: none;
    font-weight: var(--font-weight-medium);
}

.trust-note-methodology:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    /* Page nav — horizontal scroll, compact */
    .tool-page-nav {
        margin-bottom: var(--space-lg);
        margin-left: calc(-1 * var(--space-md));
        margin-right: calc(-1 * var(--space-md));
        padding-left: var(--space-sm);
        padding-right: var(--space-sm);
    }

    .tool-page-nav-inner {
        padding: 6px var(--space-sm);
        border-radius: var(--radius-md);
        gap: 0;
    }

    .tool-page-nav a {
        font-size: 13px;
        padding: 7px 12px;
        border-radius: 20px; /* pill shape on mobile */
    }

    .tool-page-nav a::after {
        display: none; /* hide underline indicator on mobile, use background only */
    }

    .tool-page-nav a.active {
        background: rgba(37, 99, 235, 0.1);
        color: #1d4ed8;
    }

    .tool-hero-cta-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .tool-hero-cta-buttons .btn {
        width: 100%;
        text-align: center;
    }

    /* Gallery responsive */
    .tool-hero.has-gallery {
        flex-direction: column;
    }

    .tool-hero.has-gallery .tool-hero-left,
    .tool-hero.has-gallery .tool-hero-right {
        flex: none;
        width: 100%;
        position: static;
    }

    .tool-hero-right {
        display: none; /* hide desktop gallery on mobile */
    }

    .tool-hero-gallery-mobile {
        display: block; /* show mobile gallery below CTA */
        margin-top: var(--space-md);
    }

    .lb-arrow {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .lb-prev { left: 8px; }
    .lb-next { right: 8px; }
    }

    .decision-grid {
        grid-template-columns: 1fr;
    }

    .best-for-not-for-grid {
        grid-template-columns: 1fr;
    }

    .tool-related-grid {
        grid-template-columns: 1fr;
    }
}
