/**
 * Home AI Page Styles
 * World-class progressive learning experience
 */

/* ===== CSS Variables ===== */
:root {
    --home-ai-blue: #4f46e5;
    --home-ai-purple: #7c3aed;
    --home-ai-green: #059669;
    --home-ai-amber: #d97706;
    --home-ai-red: #dc2626;
    --home-ai-teal: #0d9488;

    --home-ai-blue-bg: #eef2ff;
    --home-ai-purple-bg: #f3e8ff;
    --home-ai-green-bg: #ecfdf5;
    --home-ai-amber-bg: #fffbeb;
    --home-ai-red-bg: #fef2f2;

    --transition-smooth: 300ms ease;
    --transition-fast: 150ms ease;
}

/* ===== Reading Progress Bar ===== */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--home-ai-teal), var(--home-ai-blue));
    z-index: 9999;
    transition: width 50ms linear;
}

/* ===== Hero Section ===== */
.home-ai-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    color: white;
    padding: 5rem 2rem 4rem;
    text-align: center;
}

.home-ai-hero .container {
    max-width: 800px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--home-ai-teal), var(--home-ai-blue));
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    letter-spacing: 0.5px;
}

.home-ai-hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.home-ai-hero .tagline {
    font-size: 1.25rem;
    color: #94a3b8;
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.reading-time {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.9rem;
}

.reading-icon {
    font-size: 1.1rem;
}

/* ===== Table of Contents Sidebar ===== */
.toc-sidebar {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 250px;
    background: white;
    border-radius: 0 12px 12px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    z-index: 100;
    transition: transform var(--transition-smooth);
}

.toc-sidebar.collapsed {
    transform: translateY(-50%) translateX(-210px);
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toc-toggle-icon {
    width: 20px;
    height: 2px;
    background: #64748b;
    position: relative;
}

.toc-toggle-icon::before,
.toc-toggle-icon::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: #64748b;
    left: 0;
}

.toc-toggle-icon::before { top: -6px; }
.toc-toggle-icon::after { bottom: -6px; }

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

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #64748b;
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all var(--transition-fast);
    border-left: 2px solid transparent;
}

.toc-link:hover {
    color: #1e293b;
    background: #f1f5f9;
}

.toc-link.active {
    color: var(--home-ai-teal);
    background: #f0fdfa;
    border-left-color: var(--home-ai-teal);
    font-weight: 500;
}

.toc-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.btn-expand-all {
    width: 100%;
    padding: 0.5rem;
    background: #f1f5f9;
    border: none;
    border-radius: 6px;
    color: #64748b;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-expand-all:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Hide sidebar on mobile */
@media (max-width: 1200px) {
    .toc-sidebar {
        display: none;
    }
}

/* ===== Main Content ===== */
.home-ai-content {
    padding: 3rem 2rem;
}

.content-container {
    max-width: 800px;
    margin: 0 auto;
}

@media (min-width: 1200px) {
    .content-container {
        margin-left: calc(250px + 4rem);
        margin-right: 2rem;
        max-width: 900px;
    }
}

/* ===== Content Sections ===== */
.content-section {
    margin-bottom: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid #e2e8f0;
}

.content-section:last-child {
    border-bottom: none;
}

.section-summary h2 {
    font-size: 1.75rem;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.section-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.section-badge.blue { background: var(--home-ai-blue-bg); color: var(--home-ai-blue); }
.section-badge.purple { background: var(--home-ai-purple-bg); color: var(--home-ai-purple); }
.section-badge.green { background: var(--home-ai-green-bg); color: var(--home-ai-green); }
.section-badge.amber { background: var(--home-ai-amber-bg); color: var(--home-ai-amber); }

.lead {
    font-size: 1.125rem;
    color: #475569;
    line-height: 1.7;
    margin-bottom: 1rem;
}

/* ===== Expandable Sections ===== */
.expandable .section-summary {
    cursor: pointer;
}

.expand-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: #64748b;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 0.5rem;
}

.expand-toggle:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

.expand-icon {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    transition: transform var(--transition-fast);
}

.expand-toggle[aria-expanded="true"] .expand-icon {
    transform: rotate(180deg);
}

.expand-toggle[aria-expanded="true"] .expand-text::before {
    content: 'Show less';
}

.expand-toggle[aria-expanded="true"] .expand-text {
    font-size: 0;
}

.expand-toggle[aria-expanded="true"] .expand-text::before {
    font-size: 0.875rem;
}

.expandable .section-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}

.expandable .section-body.expanded {
    max-height: 5000px;
    opacity: 1;
    margin-top: 1.5rem;
}

/* ===== Contrast Grid (30-sec pitch) ===== */
.contrast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.contrast-card {
    padding: 1.5rem;
    border-radius: 12px;
}

.contrast-card.theirs {
    background: #fef2f2;
    border-left: 4px solid var(--home-ai-red);
}

.contrast-card.ours {
    background: #ecfdf5;
    border-left: 4px solid var(--home-ai-green);
}

.contrast-card h4 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.contrast-card.theirs h4 { color: var(--home-ai-red); }
.contrast-card.ours h4 { color: var(--home-ai-green); }

.contrast-card p {
    margin: 0;
    color: #475569;
    line-height: 1.6;
}

/* ===== Key Takeaway ===== */
.key-takeaway {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: linear-gradient(135deg, #f0fdfa, #ecfdf5);
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    margin: 2rem 0;
    border: 1px solid #99f6e4;
}

.takeaway-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.key-takeaway p {
    margin: 0;
    color: #0f766e;
    line-height: 1.6;
}

/* ===== Concept Cards ===== */
.concept-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.concept-card {
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.concept-card.blue { background: var(--home-ai-blue-bg); }
.concept-card.purple { background: var(--home-ai-purple-bg); }
.concept-card.green { background: var(--home-ai-green-bg); }

.concept-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.concept-card h4 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.concept-card.blue h4 { color: var(--home-ai-blue); }
.concept-card.purple h4 { color: var(--home-ai-purple); }
.concept-card.green h4 { color: var(--home-ai-green); }

.concept-card p {
    margin: 0;
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ===== Definition Cards ===== */
.definition-card {
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1.5rem 0;
    border-left: 4px solid;
}

.definition-card.blue { background: var(--home-ai-blue-bg); border-color: var(--home-ai-blue); }
.definition-card.purple { background: var(--home-ai-purple-bg); border-color: var(--home-ai-purple); }
.definition-card.green { background: var(--home-ai-green-bg); border-color: var(--home-ai-green); }
.definition-card.amber { background: var(--home-ai-amber-bg); border-color: var(--home-ai-amber); }

.definition-card h4 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.definition-card.blue h4 { color: var(--home-ai-blue); }
.definition-card.purple h4 { color: var(--home-ai-purple); }
.definition-card.green h4 { color: var(--home-ai-green); }
.definition-card.amber h4 { color: var(--home-ai-amber); }

.definition-card p {
    margin: 0;
    color: #374151;
    line-height: 1.7;
}

/* ===== Philosophy Quote ===== */
.philosophy-quote {
    background: #f8fafc;
    border-left: 4px solid var(--home-ai-teal);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    border-radius: 0 12px 12px 0;
}

.philosophy-quote p {
    margin: 0;
    font-style: italic;
    color: #334155;
    line-height: 1.8;
    font-size: 1.05rem;
}

/* ===== Feature Lists ===== */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.feature-list li {
    padding: 0.5rem 0 0.5rem 1.75rem;
    position: relative;
    color: #374151;
    line-height: 1.6;
}

.feature-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--home-ai-green);
    font-weight: bold;
}

.concern-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.concern-list li {
    padding: 0.5rem 0 0.5rem 1.75rem;
    position: relative;
    color: #374151;
    line-height: 1.6;
}

.concern-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--home-ai-amber);
    font-weight: bold;
    font-size: 1.2rem;
}

/* ===== Supervision Grid ===== */
.supervision-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.supervision-item {
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 8px;
}

.supervision-item h5 {
    margin: 0 0 0.5rem;
    color: var(--home-ai-blue);
    font-size: 0.9rem;
}

.supervision-item p {
    margin: 0;
    color: #475569;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ===== Agent Grid ===== */
.agent-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1.5rem 0;
}

.agent-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--home-ai-purple-bg);
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
}

.agent-icon {
    font-size: 1.25rem;
}

.agent-name {
    font-weight: 500;
    color: var(--home-ai-purple);
    font-size: 0.9rem;
}

/* ===== Framework Grid ===== */
.framework-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.framework-item {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.4;
}

.framework-item strong {
    color: #1e293b;
    display: block;
    margin-bottom: 0.25rem;
}

/* ===== Comparison Table ===== */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: left;
    border: 1px solid #e2e8f0;
}

.comparison-table th {
    background: #0f172a;
    color: white;
    font-weight: 600;
}

.comparison-table td {
    color: #374151;
}

.comparison-table tr:nth-child(even) {
    background: #f8fafc;
}

.comparison-table td:first-child {
    font-weight: 500;
    color: #1e293b;
}

/* ===== Layer Stack ===== */
.layer-stack {
    margin: 1.5rem 0;
}

.layer-card {
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.layer-card h4 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

.layer-card ul {
    margin: 0.75rem 0;
    padding-left: 1.25rem;
}

.layer-card li {
    margin-bottom: 0.5rem;
    color: #374151;
}

.layer-note {
    font-size: 0.875rem;
    color: #64748b;
    font-style: italic;
    margin: 0.75rem 0 0;
}

.layer-1 {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: white;
}

.layer-1 h4 { color: white; }
.layer-1 li { color: #f1f5f9; }
.layer-1 .layer-note { color: #cbd5e1; }

.layer-2 {
    background: var(--home-ai-blue-bg);
    border-left: 4px solid var(--home-ai-blue);
}

.layer-2 h4 { color: var(--home-ai-blue); }

.layer-3 {
    background: var(--home-ai-green-bg);
    border-left: 4px solid var(--home-ai-green);
}

.layer-3 h4 { color: var(--home-ai-green); }

/* ===== Example Box ===== */
.example-box {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.example-box p {
    margin: 0 0 0.75rem;
    color: #166534;
}

.example-box p:last-child {
    margin-bottom: 0;
}

/* ===== Trade-off Grid ===== */
.tradeoff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.tradeoff-card {
    padding: 1.5rem;
    border-radius: 12px;
}

.tradeoff-card.accept {
    background: #fef2f2;
    border-left: 4px solid var(--home-ai-red);
}

.tradeoff-card.gain {
    background: #ecfdf5;
    border-left: 4px solid var(--home-ai-green);
}

.tradeoff-card h5 {
    margin: 0 0 1rem;
    font-size: 1rem;
}

.tradeoff-card.accept h5 { color: #b91c1c; }
.tradeoff-card.gain h5 { color: #047857; }

.tradeoff-card ul {
    margin: 0;
    padding-left: 1.25rem;
}

.tradeoff-card li {
    margin-bottom: 0.5rem;
    color: #374151;
}

/* ===== Indigenous Box ===== */
.indigenous-box {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1.5rem 0;
}

.indigenous-box p {
    color: #e8eafc;
    line-height: 1.7;
    margin: 0 0 1rem;
}

.indigenous-box p:last-child {
    margin-bottom: 0;
}

.indigenous-box ul {
    margin: 0.75rem 0;
    padding-left: 1.25rem;
}

.indigenous-box li {
    color: #f1f3ff;
    margin-bottom: 0.5rem;
}

.indigenous-box strong {
    color: white;
}

/* ===== Assessment Grid ===== */
.assessment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.assessment-card {
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid;
}

.assessment-card.confident {
    background: #ecfdf5;
    border-color: var(--home-ai-green);
}

.assessment-card.promise {
    background: var(--home-ai-blue-bg);
    border-color: var(--home-ai-blue);
}

.assessment-card.learning {
    background: var(--home-ai-amber-bg);
    border-color: var(--home-ai-amber);
}

.assessment-card h4 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

.assessment-card.confident h4 { color: var(--home-ai-green); }
.assessment-card.promise h4 { color: var(--home-ai-blue); }
.assessment-card.learning h4 { color: var(--home-ai-amber); }

.assessment-section {
    margin-bottom: 1rem;
}

.assessment-section:last-child {
    margin-bottom: 0;
}

.assessment-section h5 {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: #1e293b;
}

.assessment-section ul {
    margin: 0;
    padding-left: 1.25rem;
}

.assessment-section li {
    color: #475569;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

/* ===== Summary Box ===== */
.summary-box {
    background: #f1f5f9;
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
}

.summary-box h2 {
    margin: 0 0 1.5rem;
    color: #0f172a;
}

.summary-grid {
    display: grid;
    gap: 1rem;
}

.summary-item {
    padding: 1rem;
    background: white;
    border-radius: 8px;
}

.summary-item strong {
    color: var(--home-ai-teal);
    display: block;
    margin-bottom: 0.25rem;
}

.summary-item p {
    margin: 0;
    color: #374151;
    font-size: 0.95rem;
}

/* ===== CTA Section ===== */
.cta-section {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #f0fdfa, #ecfdf5);
    border-radius: 12px;
    margin-top: 2rem;
}

.cta-section h3 {
    margin: 0 0 0.5rem;
    color: #0f172a;
}

.cta-section p {
    color: #475569;
    margin: 0 0 1.5rem;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.cta-buttons .btn {
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.cta-buttons .btn-primary {
    background: var(--home-ai-teal);
    color: white;
    border: none;
}

.cta-buttons .btn-primary:hover {
    background: #0f766e;
}

.cta-buttons .btn-secondary {
    background: white;
    color: var(--home-ai-teal);
    border: 2px solid var(--home-ai-teal);
}

.cta-buttons .btn-secondary:hover {
    background: var(--home-ai-teal);
    color: white;
}

/* ===== Back to Top Button ===== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: var(--home-ai-teal);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #0f766e;
    transform: translateY(-2px);
}

/* ===== Typography within sections ===== */
.section-body h3 {
    font-size: 1.25rem;
    color: #0f172a;
    margin: 2rem 0 1rem;
}

.section-body h3:first-child {
    margin-top: 0;
}

.section-body p {
    color: #374151;
    line-height: 1.8;
    margin-bottom: 1rem;
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 768px) {
    .home-ai-hero {
        padding: 3rem 1.5rem 2.5rem;
    }

    .home-ai-content {
        padding: 2rem 1rem;
    }

    .content-section {
        margin-bottom: 2rem;
        padding-bottom: 2rem;
    }

    .section-summary h2 {
        font-size: 1.5rem;
    }

    .comparison-table {
        font-size: 0.8rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.75rem 0.5rem;
    }

    .assessment-grid,
    .concept-cards {
        grid-template-columns: 1fr;
    }

    .layer-card {
        padding: 1.25rem;
    }

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
    }
}

/* ===== Print Styles ===== */
@media print {
    .reading-progress,
    .toc-sidebar,
    .back-to-top,
    .expand-toggle {
        display: none !important;
    }

    .expandable .section-body {
        max-height: none !important;
        opacity: 1 !important;
        overflow: visible !important;
    }

    .home-ai-hero {
        background: #f8fafc !important;
        color: #0f172a !important;
        -webkit-print-color-adjust: exact;
    }

    .content-container {
        margin: 0 auto;
        max-width: 100%;
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
