/* Extended styles - loaded asynchronously */

/* Typography */
p {
    margin-bottom: 1rem;
    max-width: 65ch;
}

.lead {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 300;
}

blockquote {
    border-left: 4px solid var(--france-blue);
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-secondary);
}

/* Lists */
ul, ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Links */
a {
    color: var(--france-blue);
    text-decoration: underline;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--france-red);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background: var(--bg-light);
    font-weight: 600;
}

/* Chapter Navigation */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e0e0e0;
}

.chapter-nav a {
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.3s ease;
}

.chapter-nav a:hover {
    background: var(--france-blue);
    color: var(--france-white);
}

/* Table of Contents */
.toc {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.toc h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--france-blue);
}

.toc ol {
    list-style-position: inside;
}

.toc a {
    text-decoration: none;
    color: var(--text-primary);
    display: block;
    padding: 0.5rem 0;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.toc a:hover {
    color: var(--france-blue);
    border-bottom-color: var(--france-blue);
    padding-left: 0.5rem;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    border-radius: 4px;
}

.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy.loaded {
    opacity: 1;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-secondary);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

/* Reading Progress */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--france-red);
    transition: width 0.3s ease;
    z-index: 101;
}

/* Skip Links */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--france-blue);
    color: var(--france-white);
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Print Styles */
@media print {
    .main-nav,
    .chapter-nav,
    footer,
    .menu-toggle {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: black;
        background: white;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
    
    article {
        box-shadow: none;
        padding: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    main {
        padding: 1rem;
    }
    
    article {
        padding: 1rem;
    }
    
    .chapter-nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .chapter-nav a {
        width: 100%;
        text-align: center;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background: var(--bg-dark);
        color: #e0e0e0;
    }
    
    article {
        background: #2c3e50;
        color: #e0e0e0;
    }
    
    .topic-card {
        background: #2c3e50;
        color: #e0e0e0;
    }
    
    a {
        color: var(--accent-gold);
    }
    
    a:hover {
        color: var(--france-red);
    }
    
    th {
        background: var(--bg-dark);
    }
    
    .breadcrumb {
        background: #2c3e50;
        border-bottom-color: #34495e;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease forwards;
}

/* Search Box */
.search-container {
    margin: 2rem 0;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--france-blue);
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--france-red);
}

.search-button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--france-blue);
    color: var(--france-white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-button:hover {
    background: var(--france-red);
}

/* Sticky TOC for long chapters */
@media (min-width: 1200px) {
    .content-with-toc {
        display: grid;
        grid-template-columns: 1fr 300px;
        gap: 2rem;
    }
    
    .sticky-toc {
        position: sticky;
        top: 5rem;
        height: fit-content;
        max-height: calc(100vh - 6rem);
        overflow-y: auto;
    }
}

/* Focus Styles */
*:focus {
    outline: 2px solid var(--france-blue);
    outline-offset: 2px;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-light);
    border-top-color: var(--france-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error Message */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    border-left: 4px solid #c62828;
}

/* Success Message */
.success-message {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    border-left: 4px solid #2e7d32;
}