/* === Variables ===
   Terracotta décliné :
   - --terracotta         : décoratif (bordures, trait allumette)
   - --terracotta-fonce   : fond plein avec texte blanc dessus  (≥ 4.7:1)
   - --terracotta-profond : hover des fonds bouton              (≥ 8:1)
   - --terracotta-texte   : couleur de TEXTE sur fond crème     (≥ 5.4:1)
*/
:root {
    --terracotta: #c4705a;
    --terracotta-fonce: #a85a45;
    --terracotta-profond: #7d3f2f;
    --terracotta-texte: #9b4d38;
    --terracotta-clair: #e8d5cf;
    --fond: #faf8f5;
    --texte: #333;
    --texte-leger: #666;
    --blanc: #fff;
    --encre-noire: #1a1410;  /* noir tinté terre cuite (jamais #000 pur) */
}

/* === Reset et base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

/* === Focus visible (clavier) ===
   Contour terracotta sur fond clair ; basculer en crème sur fonds terracotta */
:focus-visible {
    outline: 2px solid var(--terracotta-fonce);
    outline-offset: 3px;
}

.btn:focus-visible,
.auteur-tab:hover:focus-visible,
.auteur-tab:focus-visible:hover {
    outline-color: var(--fond);
}

/* === Skip link (accès clavier au contenu) === */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background: var(--terracotta-fonce);
    color: var(--blanc);
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
    width: auto;
    height: auto;
    overflow: visible;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background-color: var(--fond);
    color: var(--texte);
    line-height: 1.7;
    min-height: 100vh;
}

/* === Structure principale === */
.site-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

main {
    padding: 1.5rem 0;
}

/* === En-tête du site === */
.site-header {
    padding: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--terracotta-clair);
}

.site-title {
    font-size: 1.4rem;
    font-weight: normal;
    letter-spacing: 0.1em;
    color: var(--terracotta-texte);
    text-decoration: none;
    flex-shrink: 0;
}

.site-title:hover {
    color: var(--terracotta-profond);
}

.page-title {
    font-size: 1.6rem;
    font-weight: normal;
    color: var(--terracotta-texte);
    text-align: center;
    flex-grow: 1;
    margin: 0;
}

.header-spacer {
    width: 70px;
    flex-shrink: 0;
}

/* Page d'accueil sans titre de page - Nisarga centré */
.site-header.no-page-title {
    justify-content: center;
    flex-direction: column;
    padding-bottom: 1.5rem;
}

.site-header.no-page-title .site-title {
    font-size: 2rem;
}

/* Trait allumette sous Nisarga */
.site-header.no-page-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: linear-gradient(to right, var(--terracotta-clair) 0%, var(--terracotta-clair) 75%, var(--terracotta) 75%, var(--terracotta) 100%);
    margin-top: 0.75rem;
    border-radius: 2px;
}

/* === Citation du jour === */
.citation-du-jour {
    background: var(--blanc);
    padding: 2rem;
    margin: 2rem 0;
}

.citation-icone {
    color: var(--terracotta-texte);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.citation-texte {
    font-style: italic;
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.citation-auteur {
    color: var(--terracotta-texte);
    font-size: 0.95rem;
}

/* === Navigation auteurs === */
.auteurs-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.auteur-tab {
    padding: 0.75rem 1.5rem;
    background: var(--blanc);
    border: 2px solid var(--terracotta);
    color: var(--terracotta-texte);
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.auteur-tab:hover,
.auteur-tab:focus-visible {
    background: var(--terracotta-fonce);
    border-color: var(--terracotta-fonce);
    color: var(--blanc);
}

.auteur-tab.has-image {
    padding: 0.5rem 1.25rem 0.5rem 0.5rem;
}

.auteur-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--terracotta);
    transition: border-color 0.2s ease;
}

.auteur-tab:hover .auteur-image {
    border-color: var(--blanc);
}

.auteur-name {
    white-space: nowrap;
}

/* === En-tête de page (ancien, gardé pour compatibilité) === */
.page-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--terracotta-clair);
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: normal;
    color: var(--terracotta-texte);
}

/* === Onglets Textes/Vidéos === */
.section-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--terracotta-clair);
}

.section-tab {
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: var(--texte-leger);
    font-size: 1rem;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.section-tab:hover {
    color: var(--terracotta-texte);
}

.section-tab.active {
    color: var(--terracotta-texte);
    border-bottom-color: var(--terracotta);
}

/* === Liste des articles === */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.post-entry {
    background: var(--blanc);
    padding: 1.5rem;
}

.entry-header h2 {
    font-size: 1.3rem;
    font-weight: normal;
    margin-bottom: 0.5rem;
}

.entry-header a {
    color: var(--terracotta-texte);
    text-decoration: none;
}

.entry-header a:hover {
    text-decoration: underline;
}

.entry-content {
    color: var(--texte-leger);
    font-size: 0.95rem;
}

/* === Grille de vidéos === */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.video-card {
    text-decoration: none;
    color: inherit;
    background: var(--blanc);
    transition: transform 0.2s ease;
}

.video-card:hover,
.video-card:focus-visible {
    transform: translateY(-3px);
}

.video-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(168, 90, 69, 0.92);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blanc);
    font-size: 1.5rem;
}

.video-title {
    padding: 1rem;
    font-size: 1rem;
    font-weight: normal;
    color: var(--texte);
}

/* === Article === */
.breadcrumb {
    color: var(--texte-leger);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: var(--terracotta-texte);
    text-decoration: none;
}

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

.article-content {
    background: var(--blanc);
    padding: 2rem;
}

.article-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--terracotta-clair);
}

.article-header h1 {
    font-size: 1.6rem;
    font-weight: normal;
    color: var(--terracotta-texte);
}

.article-body {
    font-size: 1.1rem;
}

.article-body p {
    margin-bottom: 0.3rem;
}

.article-body p:empty,
.article-body p:has(br:only-child) {
    margin-bottom: 0.8rem;
}

.article-body h2 {
    font-size: 1.4rem;
    color: var(--terracotta-texte);
    margin: 2rem 0 1rem;
}

.article-body blockquote {
    border-left: 1px solid var(--terracotta-clair);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--texte-leger);
}

/* === Page d'erreur === */
.error-page {
    text-align: center;
    padding: 4rem 0;
}

.error-page h1 {
    font-size: 5rem;
    color: var(--terracotta-texte);
    margin-bottom: 1rem;
}

.error-page p {
    font-size: 1.2rem;
    color: var(--texte-leger);
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--terracotta-fonce);
    color: var(--blanc);
    text-decoration: none;
    transition: background 0.2s ease;
}

.btn:hover,
.btn:focus-visible {
    background: var(--terracotta-profond);
}

/* === Messages === */
.no-content {
    text-align: center;
    color: var(--texte-leger);
    padding: 2rem;
    font-style: italic;
}

/* === Préférence utilisateur : motion réduit === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* === Responsive === */
@media (max-width: 600px) {
    .site-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .site-title {
        font-size: 1.3rem;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .header-spacer {
        display: none;
    }

    .citation-du-jour {
        padding: 1.5rem;
    }

    .auteurs-nav {
        flex-direction: column;
        align-items: center;
    }

    .auteur-tab {
        width: 100%;
        justify-content: center;
    }

    .auteur-tab.has-image {
        justify-content: flex-start;
    }

    .section-tabs {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .section-tab {
        padding: 0.75rem 1rem;
    }

    .article-content {
        padding: 1.5rem;
    }
}

/* === Video locale === */
.video-local video {
    width: 100%;
    display: block;
    background: var(--encre-noire);
}

.video-local {
    text-decoration: none;
}

/* === Livres === */
.livre-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--terracotta-clair);
}

.livre-thumbs {
    display: flex;
    gap: 0.5rem;
}

.livre-thumb-btn {
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
    line-height: 0;
    transition: transform 0.2s ease;
}

.livre-thumb-btn:hover,
.livre-thumb-btn:focus-visible {
    transform: scale(1.05);
}

.livre-thumb {
    width: 80px;
    height: 120px;
    object-fit: cover;
    display: block;
}

.livre-info h3 {
    margin: 0 0 0.5rem;
}

.livre-author {
    color: var(--texte-leger);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.livre-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--terracotta-texte);
}

/* === Modale image livre (élément <dialog> natif) === */
.image-modal {
    background: transparent;
    border: 0;
    padding: 0;
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    color: var(--blanc);
}

.image-modal::backdrop {
    background: rgba(20, 12, 8, 0.88);
}

.image-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.modal-image {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.modal-controls {
    display: flex;
    gap: 0.75rem;
}

.modal-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0.75rem 1.25rem;
    background: var(--blanc);
    color: var(--texte);
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.1rem;
    transition: background 0.2s ease;
}

.modal-btn:hover,
.modal-btn:focus-visible {
    background: var(--terracotta-clair);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    min-width: 44px;
    min-height: 44px;
    padding: 0.25rem 0.75rem;
    background: transparent;
    color: var(--blanc);
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 2rem;
    line-height: 1;
}

.modal-close:hover,
.modal-close:focus-visible {
    color: var(--terracotta-clair);
}
