/**
 * ALICE.CSS - Thème écrits/blog
 */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=Inter:wght@400;500;600&display=swap');

:root {
    --alice-blue: #4169E1;
    --alice-violet: #7C3AED;
    --alice-bg: #f8f8ff;
    --alice-surface: #ffffff;
    --alice-border: #e0e0ff;
    --alice-text: #1e1b4b;
    --alice-text-light: #4b5563;
    --font-serif: 'Crimson Text', Georgia, serif;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --max-width: 800px;
    --spacing: 2rem;
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    overflow-x: hidden;
}

body.alice-universe {
    font-family: var(--font-serif);
    color: var(--alice-text);
    line-height: 1.7;
    background: var(--alice-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ============================================================
   HEADER / NAVBAR CORRIGÉE
   ============================================================ */

.alice-header {
    padding: 1rem var(--spacing);
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #4169E1 0%, #7C3AED 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.alice-header nav {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Aligné à gauche au lieu de space-between */
    gap: 3rem; /* Espace fixe entre logo et liens */
}

.alice-header .logo {
    font-family: var(--font-sans);
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
    white-space: nowrap;
}

.alice-header .nav-links {
    display: flex;
    align-items: center;
    gap: 2rem; /* Espace entre les liens */
}

.alice-header nav a:not(.logo) {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.alice-header nav a:hover {
    color: #ffffff;
}

/* MAIN */
.alice-main {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing);
}

/* ============================================================
   LAYOUT ARTICLE AVEC IMAGE À DROITE (HAUTEUR ADAPTATIVE)
   ============================================================ */

.article-with-image {
    display: flex;
    gap: 2rem;
    align-items: stretch;
    margin: 2rem 0;
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: var(--radius);
    padding: 2rem;
}

/* Colonne texte (gauche) */
.article-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.article-text h2 {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.article-text h2 a {
    color: var(--alice-text);
    text-decoration: none;
}

.article-text .category {
    display: inline-block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--alice-blue);
    margin-bottom: 0.5rem;
}

.article-text .excerpt {
    color: var(--alice-text-light);
    margin-bottom: 1rem;
}

.article-text time {
    font-size: 0.9rem;
    color: var(--alice-text-light);
}

/* Colonne image (droite) - HAUTEUR MAX, LARGEUR AUTO */
.article-image {
    flex: 0 0 auto;
    max-height: 200px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.article-image a {
    display: block;
    max-height: 200px;
}

.article-image img {
    height: 200px;
    width: auto;
    max-width: 300px;
    object-fit: contain;
    object-position: right center;
    display: block;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(65, 105, 225, 0.15);
}

/* Variantes de hauteur */
.article-image.medium,
.article-image.medium img {
    max-height: 250px;
    height: 250px;
}

.article-image.large,
.article-image.large img {
    max-height: 300px;
    height: 300px;
}

.article-image.small,
.article-image.small img {
    max-height: 150px;
    height: 150px;
}

/* ============================================================
   LISTE ARTICLES STANDARD (sans layout côte à côte)
   ============================================================ */

.articles-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.article-separator {
    border: none;
    border-top: 2px solid var(--alice-blue);
    width: 60%;
    margin: 1rem auto;
    position: relative;
    opacity: 0.3;
}

.article-separator::after {
    content: "§";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--alice-bg);
    color: var(--alice-blue);
    padding: 0 0.75rem;
    font-size: 1.1rem;
    opacity: 1;
}

.article-card {
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: box-shadow 0.2s;
}

.article-card h2 {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.article-card h2 a {
    color: var(--alice-text);
    text-decoration: none;
}

.article-card .category {
    display: inline-block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--alice-blue);
    margin-bottom: 0.5rem;
}

.article-card .excerpt {
    color: var(--alice-text-light);
    margin-bottom: 1rem;
}

.article-card time {
    font-size: 0.9rem;
    color: var(--alice-text-light);
}

/* Image dans carte standard (en haut) */
.article-card .article-image-top {
    margin: -2rem -2rem 1.5rem -2rem;
    height: 200px;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
}

.article-card .article-image-top img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================================
   IMAGE COUVERTURE ARTICLE UNIQUE
   ============================================================ */

.cover-large {
    margin: 2rem 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(65, 105, 225, 0.15);
    max-height: 400px;
}

.cover-large img {
    width: 100%;
    height: 100%;
    max-height: 400px;
    object-fit: contain;
    display: block;
}

/* ============================================================
   ARTICLE UNIQUE
   ============================================================ */

.article-single {
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: var(--radius);
    padding: 3rem;
    margin: 2rem 0;
}

.article-single h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 1rem;
}

.article-single .chapeau {
    font-size: 1.25rem;
    color: var(--alice-text-light);
    font-style: italic;
    margin-bottom: 1.5rem;
}

.article-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: var(--alice-text-light);
}

.article-meta .category {
    background: var(--alice-bg);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-content h2 {
    font-size: 1.75rem;
    margin: 2rem 0 1rem;
}

.article-content h3 {
    font-size: 1.4rem;
    margin: 1.5rem 0 0.75rem;
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content blockquote {
    border-left: 4px solid var(--alice-blue);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--alice-text-light);
}

.article-content ul {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

/* Images dans le contenu markdown */
.article-content img {
    max-width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    border-radius: var(--radius);
    margin: 2rem auto;
    display: block;
}

/* Séparateur horizontal */
.article-content hr {
    border: none;
    border-top: 2px solid var(--alice-border);
    margin: 3rem auto;
    width: 60%;
    position: relative;
}

.article-content hr::after {
    content: "§";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--alice-surface);
    color: var(--alice-text-light);
    padding: 0 1rem;
    font-size: 1.2rem;
}

.article-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--alice-border);
}

.back-link {
    color: var(--alice-blue);
    text-decoration: none;
    font-family: var(--font-sans);
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 0;
    margin-top: 1rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.pagination a {
    color: var(--alice-blue);
    text-decoration: none;
    font-weight: 500;
}

.pagination a:hover {
    text-decoration: underline;
}

.pagination-info {
    color: var(--alice-text-light);
}

/* ============================================================
   ARCHIVES
   ============================================================ */

.archives-page h1 {
    margin-bottom: 2rem;
}

.filters {
    margin-bottom: 2rem;
}

.filter-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-form select {
    padding: 0.5rem 1rem;
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    color: var(--alice-text);
}

.clear-filters {
    color: var(--alice-blue);
    text-decoration: none;
    font-size: 0.9rem;
}

.archives-list ul {
    list-style: none;
}

.archives-list li {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--alice-border);
}

.archives-list time {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--alice-text-light);
    min-width: 60px;
}

.archives-list a {
    color: var(--alice-text);
    text-decoration: none;
    flex: 1;
}

.archives-list a:hover {
    color: var(--alice-blue);
}

.category-tag {
    font-size: 0.75rem;
    background: var(--alice-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    color: var(--alice-text-light);
}

.year-heading {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--alice-blue);
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--alice-border);
}

/* ============================================================
   COMMENTAIRES
   ============================================================ */

.comments-section {
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: var(--radius);
    padding: 2.5rem 3rem;
    margin: 2rem 0;
}

.comments-section h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--alice-text);
}

.comments-empty {
    color: var(--alice-text-light);
    font-style: italic;
    margin-bottom: 2rem;
}

.comment-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.comment-alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.comment-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.comments-list {
    margin-bottom: 2rem;
}

.comment {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--alice-border);
}

.comment:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--alice-blue);
}

.comment-date {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--alice-text-light);
}

.comment-body {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--alice-text);
}

/* Formulaire */
.comment-form {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--alice-border);
}

.comment-form .form-group {
    margin-bottom: 1.25rem;
}

.comment-form label {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--alice-text);
    margin-bottom: 0.4rem;
}

.comment-form input[type="text"],
.comment-form textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--alice-border);
    border-radius: var(--radius);
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--alice-text);
    background: var(--alice-bg);
    transition: border-color 0.2s;
}

.comment-form input[type="text"]:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--alice-blue);
    box-shadow: 0 0 0 3px rgba(65, 105, 225, 0.1);
}

.comment-form textarea {
    resize: vertical;
    min-height: 100px;
}

.comment-submit {
    display: inline-block;
    padding: 0.7rem 2rem;
    background: linear-gradient(135deg, var(--alice-blue), var(--alice-violet));
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.comment-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(65, 105, 225, 0.3);
}

/* ============================================================
   TOGGLE UNIVERS (STYLO/SERINGUE) - POSITION FIXED
   ============================================================ */

.universe-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F5A9B8, #5BCEFA);
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    cursor: pointer;
    border: none;
    transition: transform 0.2s;
}

.universe-toggle:hover {
    transform: scale(1.1);
}

/* ============================================================
   FOOTER
   ============================================================ */

.alice-footer {
    flex-shrink: 0;
    width: 100%;
    text-align: center;
    padding: 2rem var(--spacing);
    color: var(--alice-text-light);
    font-size: 0.9rem;
    border-top: 1px solid var(--alice-border);
    background: var(--alice-bg);
    margin-top: auto;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .alice-header {
        padding: 1rem;
    }
    
    .alice-header nav {
        gap: 1.5rem;
    }
    
    .alice-main {
        padding: 1rem;
    }
    
    /* Layout côte à côte devient vertical sur mobile */
    .article-with-image {
        flex-direction: column;
        padding: 1.5rem;
    }
    
    .article-image {
        flex: none;
        max-height: none;
        width: 100%;
        order: -1;
        justify-content: center;
    }
    
    .article-image a {
        max-height: none;
        width: 100%;
    }
    
    .article-image img {
        height: auto;
        width: 100%;
        max-width: 100%;
        max-height: 300px;
        object-fit: contain;
    }
    
    .article-single {
        padding: 1.5rem;
    }
    
    .article-single h1 {
        font-size: 1.75rem;
    }
    
    .cover-large {
        max-height: 250px;
    }
    
    .cover-large img {
        max-height: 250px;
    }
    
    .article-content img {
        max-height: 300px;
    }
    
    .universe-toggle {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
        bottom: 1rem;
        right: 1rem;
    }
}

@media (max-width: 480px) {
    .alice-header nav {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .article-with-image {
        gap: 1rem;
    }
    
    .article-image img {
        max-height: 250px;
    }
}