/* ============================================
   AI SEO DOMINATION — Mega-Guide Styles
   /ai-seo page only
   ============================================ */

/* ---- PROGRESS BAR OVERRIDE ---- */
/* The page uses the existing .scroll-progress from styles.css.
   Override only what differs: gradient color and ensure top positioning.
   The base .scroll-progress is already position:fixed, top:0, height:3px, z-index:100. */
.scroll-progress {
    background: linear-gradient(90deg, var(--accent), var(--green));
}

/* ---- HERO ---- */
.guide-hero {
    padding: calc(80px + var(--space-2xl)) 0 var(--space-2xl);
    background: linear-gradient(170deg, var(--bg-deep) 0%, #0d0a0a 40%, #0a0d0c 70%, var(--bg-deep) 100%);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.guide-hero-bg {
    position: absolute;
    inset: 0;
    opacity: 0.3;
    pointer-events: none;
}
.guide-hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.guide-hero .wrap {
    position: relative;
    z-index: 1;
}

.guide-hero-tag {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.guide-hero-tag::before {
    content: '';
    display: block;
    width: 32px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent), var(--green));
}

.guide-hero-title {
    font-size: var(--fs-3xl);
    font-weight: 800;
    line-height: 1.08;
    max-width: 900px;
    margin-bottom: var(--space-md);
}

.guide-hero-sub {
    font-size: var(--fs-lg);
    color: var(--text-secondary);
    max-width: 700px;
    line-height: 1.6;
    margin-bottom: var(--space-xl);
}

.guide-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
    max-width: 700px;
    margin-bottom: var(--space-lg);
}

.guide-stat-number {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: var(--fs-2xl);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
}
.guide-stat:nth-child(1) .guide-stat-number { color: var(--accent); }
.guide-stat:nth-child(2) .guide-stat-number { color: var(--green-light); }
.guide-stat:nth-child(3) .guide-stat-number { color: var(--violet); }

.guide-stat-label {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.guide-hero-meta {
    font-size: var(--fs-xs);
    color: var(--text-dim);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ---- LAYOUT ---- */
.guide-layout {
    display: flex;
    gap: var(--space-xl);
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-xl) clamp(1.5rem, 3vw, 4rem);
}

.guide-content {
    flex: 1;
    min-width: 0;
    max-width: 800px;
}

/* ---- SIDEBAR TOC ---- */
.guide-sidebar {
    position: sticky;
    top: calc(80px + var(--space-md));
    width: 220px;
    height: calc(100vh - 80px - var(--space-lg));
    overflow-y: auto;
    flex-shrink: 0;
    padding-right: var(--space-md);
    border-right: 1px solid var(--border);
}

.guide-toc {
    position: relative;
}

.guide-toc-progress {
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 0%;
    background: var(--accent);
    border-radius: 2px;
    transition: height 0.1s linear;
}

.guide-toc-group {
    margin-bottom: var(--space-md);
}

.guide-toc-act {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: var(--space-xs);
    padding-left: var(--space-sm);
}
.guide-toc-group:nth-child(1) .guide-toc-act { color: var(--accent); }
.guide-toc-group:nth-child(2) .guide-toc-act { color: var(--green); }
.guide-toc-group:nth-child(3) .guide-toc-act { color: var(--violet); }
.guide-toc-group:nth-child(4) .guide-toc-act { color: var(--amber); }
.guide-toc-group:nth-child(5) .guide-toc-act { color: var(--accent); }

.guide-toc-link {
    display: block;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 0 4px var(--space-sm);
    border-left: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.guide-toc-link:hover {
    color: var(--text-secondary);
}
.guide-toc-link.active {
    color: var(--text-primary);
    border-left-color: var(--accent);
}

.guide-toc-footer {
    padding: var(--space-sm) 0;
    border-top: 1px solid var(--border);
    margin-top: var(--space-md);
}

.guide-toc-remaining {
    font-size: var(--fs-xs);
    color: var(--text-dim);
}

/* Mobile TOC */
.guide-mobile-toc {
    display: none;
}

/* ---- INFOGRAPHIC IMAGES ---- */
.guide-pipeline-img {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-lg);
    position: relative;
}
.guide-pipeline-img img {
    width: 100%;
    height: auto;
    display: block;
}
.guide-pipeline-labels {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 8%;
}
.guide-pipeline-labels span {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.guide-pillars-img {
    max-width: 600px;
    margin: var(--space-lg) auto;
}
.guide-pillars-img img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .guide-pipeline-labels span {
        font-size: 9px;
        letter-spacing: 0;
    }
    .guide-pillars-img {
        max-width: 100%;
    }
}

/* ---- CONTENT TYPOGRAPHY ---- */
.guide-content h2 {
    font-size: var(--fs-xl);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
    scroll-margin-top: calc(80px + var(--space-lg));
}
.guide-content h2:first-child {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.guide-content h3 {
    font-size: var(--fs-lg);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
}

.guide-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--space-md);
}

.guide-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.guide-content ul,
.guide-content ol {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--space-md);
    padding-left: var(--space-md);
}

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

.guide-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(255, 96, 96, 0.3);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s;
}
.guide-content a:hover {
    text-decoration-color: var(--accent);
}

/* ---- TABLES (desktop + mobile card transform) ---- */
.guide-table {
    margin: var(--space-lg) 0;
    overflow-x: auto;
}

.guide-table table {
    border-collapse: collapse;
    width: 100%;
    font-size: var(--fs-sm);
}

.guide-table th {
    text-align: left;
    padding: var(--space-sm);
    border-bottom: 2px solid var(--border-light);
    color: var(--text-primary);
    font-weight: 700;
    white-space: nowrap;
}

.guide-table td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.guide-table td:first-child {
    color: var(--text-primary);
    font-weight: 600;
}

.guide-table tr:hover td {
    background: var(--bg-surface);
}

/* ---- TYPED CALLOUT BOXES ---- */
.guide-callout {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0 12px 12px 0;
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-lg) 0;
}

.guide-callout-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.guide-callout-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.guide-callout-type {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.guide-callout-body p {
    color: var(--text-primary);
    font-size: var(--fs-body);
    line-height: 1.7;
}
.guide-callout-body p:last-child {
    margin-bottom: 0;
}

/* Definition callout */
.guide-callout--definition {
    border-left: 3px solid var(--green);
    box-shadow: inset 0 1px 0 rgba(34, 197, 94, 0.15);
}
.guide-callout--definition .guide-callout-type { color: var(--green); }
.guide-callout--definition .guide-callout-icon { color: var(--green); }

/* Key Insight callout */
.guide-callout--insight {
    border-left: 3px solid var(--violet);
    box-shadow: inset 0 1px 0 rgba(168, 85, 247, 0.15);
}
.guide-callout--insight .guide-callout-type { color: var(--violet); }
.guide-callout--insight .guide-callout-icon { color: var(--violet); }

/* Pro Tip callout */
.guide-callout--tip {
    border-left: 3px solid var(--accent);
    box-shadow: inset 0 1px 0 rgba(255, 77, 77, 0.15);
}
.guide-callout--tip .guide-callout-type { color: var(--accent); }
.guide-callout--tip .guide-callout-icon { color: var(--accent); }

/* Warning callout */
.guide-callout--warning {
    border-left: 3px solid var(--amber);
    box-shadow: inset 0 1px 0 rgba(245, 158, 11, 0.15);
}
.guide-callout--warning .guide-callout-type { color: var(--amber); }
.guide-callout--warning .guide-callout-icon { color: var(--amber); }

/* ---- STYLED CODE BLOCKS ---- */
.guide-code {
    background: #0a0b10;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin: var(--space-lg) 0;
}

.guide-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
}

.guide-code-lang {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.guide-code-copy {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    font-family: inherit;
}
.guide-code-copy:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.guide-code-body {
    padding: var(--space-md);
    overflow-x: auto;
}

.guide-code-body code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: var(--fs-sm);
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Syntax colors */
.code-comment { color: var(--text-muted); }
.code-directive { color: var(--blue); }
.code-value { color: var(--green); }
.code-property { color: var(--violet); }
.code-string { color: var(--amber); }

/* ---- BEFORE / AFTER PANELS ---- */
.guide-before-after {
    display: flex;
    gap: 0;
    margin: var(--space-lg) 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.guide-ba-panel {
    flex: 1;
    padding: var(--space-lg);
}

.guide-ba-before {
    background: rgba(255, 77, 77, 0.03);
    border-right: 1px solid var(--border);
}
.guide-ba-before blockquote {
    color: var(--text-muted);
    font-style: normal;
    border: none;
    padding: 0;
    margin: 0;
    font-size: var(--fs-sm);
    line-height: 1.7;
}

.guide-ba-after {
    background: rgba(34, 197, 94, 0.03);
}
.guide-ba-after blockquote {
    color: var(--text-primary);
    font-style: normal;
    border: none;
    padding: 0;
    margin: 0;
    font-size: var(--fs-sm);
    line-height: 1.7;
}

.guide-ba-label {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: var(--space-sm);
}
.guide-ba-before .guide-ba-label { color: var(--accent); }
.guide-ba-after .guide-ba-label { color: var(--green); }

.guide-ba-divider {
    width: 3px;
    background: var(--border);
    cursor: col-resize;
    position: relative;
    flex-shrink: 0;
}

.guide-ba-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
}
.guide-ba-handle::before {
    content: '⟷';
    font-size: 12px;
    color: var(--text-muted);
}

/* ---- INTERACTIVE PLATFORM CARDS ---- */
.guide-platforms {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin: var(--space-lg) 0 var(--space-md);
}

.guide-platform-card {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    flex: 1;
    min-width: 120px;
    text-align: center;
    font-family: inherit;
    color: inherit;
}
.guide-platform-card:hover {
    border-color: var(--border-light);
}

.guide-platform-name {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.guide-platform-stat {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

/* Platform active states */
.guide-platform-card[data-platform="ai-overviews"].active {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(255, 77, 77, 0.1);
}
.guide-platform-card[data-platform="chatgpt"].active {
    border-color: var(--green);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.1);
}
.guide-platform-card[data-platform="perplexity"].active {
    border-color: var(--violet);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.1);
}
.guide-platform-card[data-platform="gemini"].active {
    border-color: var(--amber);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.1);
}
.guide-platform-card[data-platform="claude"].active {
    border-color: var(--blue);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.1);
}

.guide-platform-details {
    margin-bottom: var(--space-lg);
}

.guide-platform-detail {
    display: none;
    padding: var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.guide-platform-detail.active {
    display: block;
}
.guide-platform-detail p {
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    line-height: 1.7;
    margin-bottom: var(--space-sm);
}
.guide-platform-detail p:last-child {
    margin-bottom: 0;
}

/* ---- DIAGNOSTIC FLOWCHART ---- */
.guide-diagnostic {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: var(--space-xl);
    margin: var(--space-lg) 0;
}

.guide-diag-step {
    display: none;
}
.guide-diag-step.active {
    display: block;
}

.guide-diag-question {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.guide-diag-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.guide-diag-btn {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: var(--fs-sm);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.guide-diag-btn:hover {
    border-color: var(--green);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.1);
}

.guide-diag-result {
    background: rgba(34, 197, 94, 0.03);
    border-left: 3px solid var(--green);
    border-radius: 0 12px 12px 0;
    padding: var(--space-md) var(--space-lg);
}

.guide-diag-result-label {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--green);
    margin-bottom: var(--space-xs);
}

.guide-diag-result p {
    color: var(--text-primary);
    font-size: var(--fs-body);
    line-height: 1.7;
}

.guide-diag-restart {
    display: inline-block;
    margin-top: var(--space-sm);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}
.guide-diag-restart:hover {
    color: var(--text-primary);
}

/* ---- FAQ (details/summary) ---- */
.guide-faq details {
    border-bottom: 1px solid var(--border);
}
.guide-faq details:first-of-type {
    border-top: 1px solid var(--border);
}

.guide-faq summary {
    padding: var(--space-md) 0;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-primary);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s;
}
.guide-faq summary:hover { color: var(--green-light); }
.guide-faq summary::after {
    content: '+';
    font-size: 1.4rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.guide-faq details[open] summary::after {
    content: '−';
    color: var(--green);
}
.guide-faq summary::-webkit-details-marker { display: none; }

.guide-faq .faq-answer {
    padding-bottom: var(--space-md);
}
.guide-faq .faq-answer p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ---- CTA (ported from article.css, adapted for guide) ---- */
.guide-cta {
    margin-top: var(--space-xl);
    padding: var(--space-xl);
    background: linear-gradient(170deg, var(--bg-surface) 0%, #1a0a0a 50%, var(--bg-surface) 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: center;
}

.guide-cta h2 {
    font-size: var(--fs-xl);
    margin-bottom: var(--space-sm);
    border: none;
    padding-top: 0;
    margin-top: 0;
}

.guide-cta p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

/* ---- RELATED ARTICLES (ported from article.css) ---- */
.guide-related {
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}

.guide-related h2 {
    font-size: var(--fs-lg);
    margin-bottom: var(--space-md);
    border: none;
    padding-top: 0;
    margin-top: 0;
}

.guide-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
}

.guide-related-link {
    display: block;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.2s, background 0.2s;
    text-decoration: none;
    color: inherit;
}
.guide-related-link:hover {
    border-color: var(--border-light);
    background: var(--bg-surface);
}

.guide-related-link-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: var(--fs-body);
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.guide-related-link-desc {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    line-height: 1.5;
}

/* ---- RESPONSIVE ---- */

/* Tablet: sidebar collapses */
@media (max-width: 1024px) {
    .guide-sidebar {
        display: none;
    }

    .guide-mobile-toc {
        display: block;
        position: sticky;
        top: 60px;
        z-index: 50;
        background: var(--bg-deep);
        border-bottom: 1px solid var(--border);
        padding: var(--space-xs) clamp(1.5rem, 3vw, 4rem);
    }

    .guide-mobile-toc-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: var(--space-xs) 0;
        background: none;
        border: none;
        color: var(--text-primary);
        font-family: inherit;
        font-size: var(--fs-sm);
        font-weight: 600;
        cursor: pointer;
    }
    .guide-mobile-toc-toggle::after {
        content: '▾';
        font-size: 12px;
        color: var(--text-muted);
        transition: transform 0.2s;
    }
    .guide-mobile-toc.open .guide-mobile-toc-toggle::after {
        transform: rotate(180deg);
    }

    .guide-mobile-toc-dropdown {
        display: none;
        padding: var(--space-sm) 0;
        max-height: 60vh;
        overflow-y: auto;
    }
    .guide-mobile-toc.open .guide-mobile-toc-dropdown {
        display: block;
    }

    .guide-mobile-toc-dropdown a {
        display: block;
        padding: 6px 0;
        font-size: var(--fs-xs);
        color: var(--text-muted);
        text-decoration: none;
    }
    .guide-mobile-toc-dropdown a.active {
        color: var(--text-primary);
    }

    .guide-layout {
        flex-direction: column;
    }

    .guide-content {
        max-width: 100%;
    }
}

/* Mobile: tables transform to cards */
@media (max-width: 768px) {
    .guide-hero-title {
        font-size: var(--fs-2xl);
    }

    .guide-hero-stats {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .guide-table thead {
        display: none;
    }
    .guide-table tbody {
        display: block;
    }
    .guide-table tr {
        display: block;
        margin-bottom: var(--space-sm);
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: var(--space-md);
    }
    .guide-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 4px 0;
        border: none;
        gap: var(--space-sm);
    }
    .guide-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-muted);
        font-size: var(--fs-xs);
        flex-shrink: 0;
        min-width: 80px;
    }
    .guide-table td:first-child {
        font-size: var(--fs-body);
        font-weight: 700;
        color: var(--text-primary);
        display: block;
        margin-bottom: var(--space-xs);
        border-bottom: 1px solid var(--border);
        padding-bottom: var(--space-xs);
    }
    .guide-table td:first-child::before {
        display: none;
    }

    /* Before/After stacks */
    .guide-before-after {
        flex-direction: column;
    }
    .guide-ba-before {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .guide-ba-divider {
        display: none;
    }

    /* Platform cards wrap */
    .guide-platforms {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    /* Diagnostic options stack */
    .guide-diag-options {
        flex-direction: column;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .guide-hero {
        padding-top: calc(60px + var(--space-lg));
    }
    .guide-hero-title {
        font-size: var(--fs-xl);
    }
    .guide-platforms {
        grid-template-columns: 1fr;
    }
}
