/* =============================================
   Article Layout - Shared layout for article/guide pages
   (arbitrage, staking, tracking)
   
   Provides: .main-content, .content-container, .toc-sidebar,
   .content-wrapper, .content-section, .section-header,
   .section-content, .highlight-box, hero base structure,
   and responsive breakpoints for the 2-column TOC layout.
   ============================================= */

/* ---- Main Content Layout ---- */
.main-content {
    padding: var(--spacing-xl) var(--spacing-md);
    position: relative;
    overflow-x: hidden;
    max-width: 100%;
}

.content-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    max-width: 1300px;
    margin: 0 auto;
    align-items: start;
    min-width: 0;
    width: 100%;
}

/* Grid children must have min-width: 0 to prevent overflow */
.content-container > *,
.content-wrapper,
.content-section,
.section-content {
    min-width: 0;
    max-width: 100%;
}

/* Word wrapping for all content text */
.section-content,
.section-content p,
.section-content li,
.section-content h3 {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ---- Table of Contents Sidebar ---- */
.toc-sidebar {
    position: sticky;
    top: calc(64px + var(--spacing-lg));
    width: 240px;
    background: #0d1b2e;
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(6, 182, 212, 0.18);
    animation: slideInFromLeft 0.8s ease-out 0.2s both;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(6, 182, 212, 0.3) transparent;
    min-width: 0;
}

.toc-sidebar > * {
    position: static;
}

@keyframes slideInFromLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}

.toc-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(6, 182, 212, 0.15);
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-title i {
    color: var(--primary-color);
}

.toc-list {
    list-style: none;
    counter-reset: toc-counter;
}

.toc-item {
    margin-bottom: 2px;
    counter-increment: toc-counter;
}

.toc-link {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    color: #94a3b8;
    text-decoration: none;
    padding: 0.42rem 0.6rem;
    border-radius: 6px;
    transition: all 0.25s ease;
    font-weight: 500;
    font-size: 0.82rem;
    line-height: 1.4;
}

.toc-link::before {
    content: counter(toc-counter) ".";
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
    min-width: 1.2rem;
    flex-shrink: 0;
    transition: color 0.25s ease;
}

.toc-link:hover,
.toc-link.active {
    color: var(--primary-color, #22d3ee);
    background: rgba(6, 182, 212, 0.1);
}

.toc-link:hover::before,
.toc-link.active::before {
    color: var(--primary-color, #22d3ee);
}

.toc-link.active {
    font-weight: 600;
}

/* ---- Content Wrapper ---- */
.content-wrapper {
    width: 100%;
    min-width: 0;
    animation: slideInFromRight 0.8s ease-out 0.4s both;
}

@keyframes slideInFromRight {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ---- Content Section Cards ---- */
.content-section {
    background: var(--background-white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.content-section:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* ---- Section Header ---- */
.section-header {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--background-light);
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.section-header h2 i {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: var(--spacing-lg) 0 var(--spacing-md) 0;
}

/* ---- Section Content ---- */
.section-content p {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    line-height: 1.7;
}

.section-content ul,
.section-content ol {
    margin: var(--spacing-md) 0;
    padding-left: var(--spacing-lg);
}

.section-content li {
    margin-bottom: var(--spacing-xs);
    color: var(--text-secondary);
    line-height: 1.6;
}

.section-content li::marker {
    color: var(--primary-color);
}

/* ---- Highlight Boxes ---- */
.highlight-box {
    background: linear-gradient(135deg, var(--light-color, rgba(255, 255, 255, 0.05)), var(--background-light));
    border-left: 4px solid var(--primary-color);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
}

.highlight-box.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), var(--background-light));
    border-left-color: var(--warning-orange);
}

.highlight-box.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), var(--background-light));
    border-left-color: var(--info-blue);
}

.highlight-box p {
    margin: 0;
    font-weight: 500;
}


/* =============================================
   Responsive - Article Layout
   ============================================= */

@media (max-width: 1100px) {
    .content-container {
        grid-template-columns: 200px 1fr;
        gap: 1.5rem;
        max-width: 960px;
    }

    .toc-sidebar {
        width: 200px;
    }
}

@media (max-width: 860px) {
    .content-container {
        grid-template-columns: 1fr;
        max-width: 720px;
    }

    .toc-sidebar {
        position: static;
        width: 100%;
        max-height: none;
        overflow-y: visible;
        margin-bottom: var(--spacing-md);
    }

    .content-section {
        padding: 1.75rem;
    }

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

@media (max-width: 768px) {
    .main-content {
        padding: var(--spacing-lg) 0.75rem;
    }

    .content-section {
        padding: 1.35rem 1.25rem;
    }

    .section-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    .section-header h2 {
        font-size: 1.3rem;
        gap: 0.5rem;
    }

    .section-header h2 i {
        font-size: 1.1rem;
    }

    .section-content h3 {
        font-size: 1rem;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: var(--spacing-lg) 0.5rem;
    }

    .content-section {
        padding: 1.1rem 1rem;
        border-radius: 0.75rem;
    }

    .section-header h2 {
        font-size: 1.15rem;
    }

    .section-header h2 i {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: var(--spacing-lg) 0.375rem;
    }

    .content-section {
        padding: 0.9rem 0.85rem;
        border-radius: 0.625rem;
    }

    .section-header h2 {
        font-size: 1.05rem;
        flex-wrap: wrap;
        row-gap: 0.25rem;
    }
}

/* ---- Print ---- */
@media print {
    .navbar,
    .toc-sidebar { display: none; }
    .content-container { grid-template-columns: 1fr; }
    .content-section { box-shadow: none; border: 1px solid var(--border-light); break-inside: avoid; }
}
