/* =========================================
   EL-KALLAL - STYLES FINAUX OPTIMISÉS
   Version 3.0 - Marges corrigées + SEO
   ========================================= */

/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    --bg: #284161;
    --bg-gradient: radial-gradient(circle at 50% 0%, #1e293b 0%, #284161 80%);
    --surface: #17202a;
    --surface-hover: #1c232e;
    --text: #edeff1;
    --muted: #94a3b8;
    --accent: #60a5fa;
    --accent-glow: rgba(96, 165, 250, 0.15);
    --border: #2d3748;
    --font-main: 'Inter', sans-serif;
    --font-title: 'Playfair Display', serif;
    --container-width: 1100px;
    --header-height: 80px;
    --transition-speed: 0.3s;
    
    /* Système de marges unifié */
    --section-margin: 1rem;
    --section-margin-mobile: 1rem;
}

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

body {
    margin: 0;
    background-color: var(--bg);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-main);
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =========================================
   2. LAYOUT & TYPOGRAPHIE
   ========================================= */
.wrap {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 20px 24px;
}

h1, h2, h3, h4 {
    font-family: var(--font-title);
    color: #fff;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

h1 { 
    font-size: 2.8rem; 
    letter-spacing: -0.5px; 
}

h2 { 
    font-size: 2.2rem; 
    color: var(--text); 
}

h3 { 
    font-size: 1.5rem; 
    color: #fff; 
}

h4 { 
    font-size: 1.2rem; 
    color: var(--accent); 
}

p { 
    margin: 0 0 1.5rem 0; 
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--accent);
    transition: color var(--transition-speed);
    text-decoration: none;
}

a:hover {
    color: #fff;
}

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

.small { 
    font-size: 0.85rem; 
}

.center { 
    text-align: center; 
}

/* Accessibilité */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* =========================================
   3. HEADER & NAVIGATION
   ========================================= */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    margin-bottom: 40px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: relative;
    gap: 20px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 101;
}

.logo {
    font-family: var(--font-title);
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: opacity var(--transition-speed);
}

.logo:hover {
    opacity: 0.8;
}

.site-nav {
    display: flex;
    gap: 20px;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.site-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color var(--transition-speed);
    padding: 8px 12px;
    border-radius: 4px;
}

.site-nav a:hover,
.site-nav a:focus,
.site-nav a[aria-current="page"] {
    color: var(--accent);
    outline: none;
}

.lang-flags {
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 101;
}

.lang-flag {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition-speed);
    opacity: 0.6;
}

.lang-flag:hover,
.lang-flag.active {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 0 0 2px var(--accent);
}

.lang-flag svg {
    display: block;
    width: 24px;
    height: 16px;
    border-radius: 2px;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    z-index: 102;
    padding: 8px;
    border-radius: 4px;
    transition: all var(--transition-speed);
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================
   4. SECTIONS - MARGES UNIFIÉES
   ========================================= */
section {
    margin: var(--section-margin) 0;
}

/* Première section après le header */
section:first-of-type {
    margin-top: 0;
}

/* Dernière section avant le footer */
section:last-of-type {
    margin-bottom: var(--section-margin);
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

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

.section-subtitle {
    font-size: 1.15rem;
    color: var(--muted);
    font-style: italic;
}

/* =========================================
   5. HERO SECTION
   ========================================= */
.hero {
    margin-bottom: var(--section-margin);
    min-height: 30vh;
    padding: 3rem 0;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeInUp 1s ease;
}

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

.hero-subtitle {
    font-size: 1.25rem;
    line-height: 1.7;
    margin-bottom: 2.5rem;
    color: var(--muted);
    animation: fadeInUp 1s ease 0.2s backwards;
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    animation: fadeInUp 1s ease 0.4s backwards;
}

/* =========================================
   6. BOUTONS
   ========================================= */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-speed) ease;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
}

.btn:hover,
.btn:focus {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    outline: none;
}

.btn.primary {
    background: var(--accent);
    color: #0a0e1a;
    border-color: var(--accent);
    font-weight: 700;
}

.btn.primary:hover,
.btn.primary:focus {
    background: transparent;
    color: var(--accent);
}

.btn.ghost {
    background: transparent;
    border-color: var(--border);
}

.btn.ghost:hover,
.btn.ghost:focus {
    background: rgba(255,255,255,0.05);
}

.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* =========================================
   7. TRILOGIE - CARTES
   ========================================= */
.featured-trilogy {
    margin: var(--section-margin) 0;
}

.trilogy-grid {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    max-width: 1000px;
    margin: 0 auto;
}

.trilogy-book-card {
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 30px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    text-align: left;
    transition: box-shadow var(--transition-speed) ease;
}

.trilogy-book-card:hover {
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
}

.trilogy-book-card.reverse {
    flex-direction: row-reverse;
}

.card-content {
    flex: 1;
}

.card-content h2,
.card-content h3 {
    margin-bottom: 1rem;
    color: var(--accent);
}

.card-content p {
    font-size: 1.1rem;
    color: var(--muted);
    line-height: 1.7;
}

.card-actions {
    display: flex;
    gap: 12px;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.card-cover {
    flex-shrink: 0;
    width: 220px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border-radius: 4px;
    overflow: hidden;
    transition: transform var(--transition-speed) ease;
}

.featured-cover {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.trilogy-book-card:hover .card-cover {
    transform: scale(1.05) rotate(1deg);
}

/* =========================================
   8. ACTUALITÉS & GRILLES
   ========================================= */
.news-section {
    margin: var(--section-margin) 0;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 2rem;
}

.news-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3);
    border-color: var(--accent);
}

.news-date {
    align-self: flex-start;
    padding: 4px 10px;
    background: rgba(96, 165, 250, 0.1);
    color: var(--accent);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.news-card h3 {
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
}

.news-card p {
    color: var(--muted);
}

.newsletter-cta {
    margin-top: 3rem;
    padding: 2rem;
    background: rgba(96, 165, 250, 0.05);
    border-radius: 8px;
    border: 1px solid var(--border);
    text-align: center;
}

.newsletter-cta p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

/* =========================================
   9. CTA FINAL
   ========================================= */
.final-cta {
    margin: var(--section-margin) 0;
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.1) 0%, transparent 100%);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.cta-content h2 {
    font-family: var(--font-title);
    font-size: 2.2rem;
    color: #fff;
    margin-bottom: 1.5rem;
}

.cta-content p {
    font-size: 1.15rem;
    color: var(--muted);
    margin-bottom: 2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.cta-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* =========================================
   10. FOOTER
   ========================================= */
footer {
    margin-top: var(--section-margin);
    padding: 40px 0 20px;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
}

.footer-info {
    flex: 1;
    min-width: 250px;
    text-align: center;
}

.footer-info div {
    margin-bottom: 8px;
}

.footer-info div:last-child {
    margin-bottom: 0;
}

.footer-social {
    flex: 0 0 auto;
}

.footer-social p {
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    text-align: center;
}

.social-links {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--muted);
    transition: all var(--transition-speed) ease;
}

.social-links a:hover,
.social-links a:focus {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

/* =========================================
   11. MODAL
   ========================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(30, 40, 60, 0.4);
    backdrop-filter: blur(8px) saturate(1.1);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) ease, 
                visibility var(--transition-speed) ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-panel {
    width: 100%;
    max-width: 900px;
    height: 85vh;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    background: rgba(0,0,0,0.2);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background var(--transition-speed);
}

.modal-close:hover,
.modal-close:focus {
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.modal-content {
    flex: 1;
    background: #000;
}

.modal-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* =========================================
   12. FORMULAIRES
   ========================================= */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

input,
textarea,
select {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px;
    border-radius: 4px;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: border var(--transition-speed), 
                box-shadow var(--transition-speed);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* =========================================
   13. RESPONSIVE
   ========================================= */
@media (max-width: 900px) {
    :root {
        --section-margin: 3rem;
    }

    .site-header {
        flex-wrap: wrap;
        padding: 15px 0;
        gap: 15px;
    }

    .site-brand {
        order: 1;
        flex: 0 0 auto;
    }

    .lang-flags {
        order: 2;
        flex: 0 0 auto;
        margin-left: auto;
        margin-right: 15px;
    }

    .nav-toggle {
        order: 3;
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
    }

    .site-nav {
        display: none;
        order: 4;
        flex-basis: 100%;
        width: 100%;
        flex-direction: column;
        background: var(--surface);
        padding: 20px;
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-top: 0;
        gap: 12px;
        animation: slideDown 0.3s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .site-nav.open {
        display: flex;
    }

    .site-nav a {
        padding: 12px 16px;
        text-align: center;
        border-radius: 4px;
    }

    .site-nav a:hover,
    .site-nav a:focus {
        background: rgba(255, 255, 255, 0.05);
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .trilogy-book-card,
    .trilogy-book-card.reverse {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .card-cover {
        order: -1;
        margin-bottom: 20px;
        width: 60%;
        max-width: 250px;
    }

    .card-actions {
        justify-content: center;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }
}

@media (max-width: 600px) {
    :root {
        --section-margin: 2.5rem;
    }

    .wrap {
        padding: 15px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .news-grid {
        grid-template-columns: 1fr;
    }

    .final-cta {
        padding: 3rem 1.5rem;
    }

    .modal-panel {
        height: 90vh;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .site-header {
        padding: 12px 0;
    }

    .lang-flags {
        margin-right: 10px;
        gap: 4px;
    }

    .lang-flag svg {
        width: 20px;
        height: 14px;
    }

    .logo {
        font-size: 1.3rem;
    }

    .nav-toggle {
        width: 36px;
        height: 36px;
    }

    .card-cover {
        width: 80%;
    }
}

/* =========================================
   14. PRINT
   ========================================= */
@media print {
    .site-header,
    .lang-flags,
    .nav-toggle,
    .modal-overlay,
    .hero-visual,
    footer {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .wrap {
        max-width: 100%;
    }

    section {
        page-break-inside: avoid;
    }
}

/* =========================================
   CORRECTION : TRILOGIE - 3 COLONNES
   ========================================= */

.trilogy-books {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 40px;
}

.book-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3);
    border-color: var(--muted);
}

.book-cover {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    margin-bottom: 20px;
}

.book-header h3 {
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 8px 0;
}

.book-volume {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.book-header h4 {
    font-size: 1.3rem;
    line-height: 1.3;
    margin-bottom: 16px;
    color: #fff;
}

.book-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-synopsis {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 20px;
    line-height: 1.6;
}

.book-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Responsive */
@media (max-width: 900px) {
    .trilogy-books {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media (max-width: 600px) {
    .trilogy-books {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .book-card {
        padding: 20px;
    }
}

/* =========================================
   CORRECTION : RÉDUCTION ESPACE HERO -> TRILOGIE
   ========================================= */

/* Réduire la marge basse du hero */
.hero {
    min-height: 10vh;
    padding: 1rem 0; /* Réduit le padding si nécessaire */
}

/* Optionnel : réduire encore plus sur mobile */
@media (max-width: 900px) {
    .hero {
        margin-bottom: 1.5rem !important;
        padding: 1.5rem 0;
    }
}

/* Réduire la marge haute de la section trilogie */
.trilogy-section {
    margin-top: 1rem !important; 
}

/* Si vous voulez un contrôle plus précis, vous pouvez aussi ajuster les sections globalement */
section {
    margin: 1rem 0; /* Réduit les marges de toutes les sections si nécessaire */
}

/* Première section après le header - s'assurer qu'elle n'a pas de marge haute */
section:first-of-type {
    margin-top: 0;
}
/* =========================================
   CORRECTION : AUTHOR PROFILE - IMAGE À DROITE
   ========================================= */

.author-profile {

    padding: 40px;
    background: rgba(23, 32, 42, 0.6);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.author-header {
    text-align: center;
    margin-bottom: 3rem;
}

.author-header h2 {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.author-header h3 {
    font-size: 1.3rem;
    color: var(--muted);
    font-weight: 400;
    font-style: italic;
}

.author-row {
    display: grid;
    grid-template-columns: 1fr 200px; /* Texte à gauche, image à droite */
    gap: 40px;
    align-items: start;
}

.author-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    order: 2; /* Place l'image en deuxième position (à droite) */
}

.author-image img, 
.image-placeholder {
    width: 100%;
    height: 260px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

.author-image span {
    font-size: 0.9rem;
    color: var(--muted);
    font-style: italic;
}

.author-text {
    font-size: 1.1rem;
    color: var(--text);
    line-height: 1.8;
    order: 1; /* Place le texte en première position (à gauche) */
}

.author-text p {
    margin-bottom: 1.5rem;
}

.author-text p:last-child {
    margin-bottom: 0;
}

.author-quote {
    margin: 24px 0 0 0;
    padding-left: 24px;
    border-left: 4px solid var(--accent);
    color: var(--muted);
    font-style: italic;
    font-family: var(--font-title);
    font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 900px) {
    .author-profile {
        padding: 30px;
        margin: 1rem 0;
    }
    
    .author-row {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }
    
    .author-image {
        order: 1; /* Image en premier sur mobile */
    }
    
    .author-text {
        order: 2; /* Texte en second sur mobile */
    }
    
    .author-quote {
        border-left: none;
        border-top: 3px solid var(--accent);
        padding-left: 0;
        padding-top: 15px;
        margin-top: 20px;
    }
}

@media (max-width: 600px) {
    .author-profile {
        padding: 20px;
        margin: 2rem 0;
    }
    
    .author-header h2 {
        font-size: 2rem;
    }
    
    .author-header h3 {
        font-size: 1.1rem;
    }
    
    .author-image img,
    .image-placeholder {
        height: 220px;
    }
}