/* =====================================================
   BASE
   ===================================================== */

html {
    scroll-behavior: smooth;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    height: 100%;
    min-height: 100vh;
    font-family: sans-serif;
    line-height: 1.6;
}


/* =====================================================
   TEXTES & ÉDITEUR
   ===================================================== */

.editor-textarea {
    width: 100%;
    box-sizing: border-box;
    border-radius: 10px;
    border: 1px solid #ccc;
    line-height: 1.6;
}

.editor-toolbar {
    margin-bottom: 5px;
}

.editor-toolbar button {
    margin-right: 4px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f9f9f9;
    cursor: pointer;
}

.editor-toolbar button:hover {
    background: #eee;
}

blockquote {
    position: relative;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic; /* italique pour le style citation */
    font-size: 1.5em;
    line-height: 1.5em;
    margin: 1.5em 0;
    padding: 0.5em 1em;
/*    quotes: "“" "”" "‘" "’";  guillemets automatiques */
}

/* guillemet de début */
blockquote::before {
    content: "“";
    font-size: 4em;
    line-height: 0.1em;
    vertical-align: -0.4em;
    margin-right: 0.1em;
    color: #395eac;
    font-family: Georgia, serif;
}

/* guillemet de fin */
blockquote::after {
    content: "”";
    font-size: 4em;
    line-height: 0.1em;
    vertical-align: -0.5em;
    margin-left: 0.1em;
    color: #395eac;
    font-family: Georgia, serif;
}

blockquote p {
    margin: 0;
    padding: 0;
}


/* =====================================================
   HEADER
   ===================================================== */

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #ced8ee;
    border-bottom: 1px solid #ddd;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 20px;
}

.site-logo {
    height: 45px;
    vertical-align: middle;
}

.top-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-menu img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.top-menu a,
.top-menu span.user-display {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.menu a {
    margin: 0 10px;
    text-decoration: none;
    color: #333;
}

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

.welcome {
    margin-left: 15px;
    font-weight: bold;
}


/* =====================================================
   AVATAR UTILISATEUR
   ===================================================== */

.user-avatar {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #395eac;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 16px;
}


/* =====================================================
   MENU BURGER & OVERLAY
   ===================================================== */

.burger-btn {
    display: none;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 98;
}

.overlay.active {
    display: block;
}


/* =====================================================
   LAYOUT PRINCIPAL
   ===================================================== */

.container {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 2rem;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    flex: 1;
}

.sidebar-left,
.sidebar-right {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    height: fit-content;
    position: sticky;
    top: 80px;
}


/* =====================================================
   ARTICLES
   ===================================================== */

.article-preview {
    border-bottom: 1px solid #ccc;
    margin-bottom: 1em;
    padding-bottom: 1em;
}

.article-preview img {
    max-width: 50%;
    height: auto;
}

.content {
    margin-top: 2em;
    font-size: 1.2em;
}

.content img {
    max-width: 100%;
    display: block;
    margin: 1em auto;
}


/* =====================================================
   TAGS / CATÉGORIES
   ===================================================== */

.tag {
    display: inline-block;
    border-radius: 8px;
    padding: 3px 8px;
    margin: 2px;
    font-size: 0.9em;
    background: #ddd;
    color: #333;
}

.tag[data-parent="Terre"] { background-color: #ff9000; }
.tag[data-parent="Air"]   { background-color: #2ea1db; }
.tag[data-parent="Eau"]   { background-color: #a3b9e1; }


/* =====================================================
   RECHERCHE
   ===================================================== */

.search-form {
    display: flex;
}

.search-form input[type="text"] {
    font-size: 1.15rem;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid #ccc;
    width: 100%;
}

.search-form input[type="text"]:focus {
    border-color: #666;
}


/* =====================================================
   GALERIE & MODAL
   ===================================================== */

/*.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.thumb-container {
    text-align: center;
    max-width: 200px;
}
*/
.thumb-container img {
    max-width: 100%;
    cursor: pointer;
}

#modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    text-align: center;
    z-index: 1000;
}

#modal img {
    max-width: 90%;
    max-height: 80%;
    margin-top: 40px;
}

/* Grille de la galerie */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

/* Conteneur de chaque image */
.thumb-container {
  width: 100%;
}

/* Zone image avec ratio fixe */
.thumb {
  width: 100%;
  aspect-ratio: 16 / 9; /* 🔁 change ici : 1/1, 16/9, 3/2, 4/3 etc */
  object-fit: cover;
  border-radius: 3px;
  cursor: pointer;
  background: #eee;
  display: block;
}

/* Légende */
.legend {
  margin-top: 0.3rem;
  font-size: 1rem;
  text-align: center;
  color: #555;
}

/* ===============================
   MODAL MOBILE PLEIN ÉCRAN
   =============================== */

@media (max-width: 768px) {

  #modal {
    display: none;
    align-items: center;
    justify-content: center;
  }

  #modal img {
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    margin: 0;
  }

  #modalLegend {
    position: fixed;
    bottom: 10px;
    left: 0;
    width: 100%;
    text-align: center;
    color: #fff;
    font-size: 0.9rem;
    padding: 0 10px;
  }

  #closeModalBtn {
    position: fixed;
    top: 10px;
    right: 12px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    font-size: 1.6rem;
    padding: 6px 10px;
    border-radius: 50%;
    z-index: 1100;
    cursor: pointer;
  }

  .nav {
    position: fixed;
    top: 0;
    width: 50%;
    height: 100%;
    font-size: 0;
  }

  #prev { left: 0; }
  #next { right: 0; }
}



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

footer {
    background: #ffe2be;
    border-top: 1px solid #ccc;
    margin-top: 40px;
    padding: 20px;
    text-align: center;
    font-size: 0.9em;
    color: #444;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.footer-logo {
    height: 40px;
    width: auto;
}

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

@media (max-width: 992px) {

    .burger-btn {
        display: block;
    }

    .sidebar-left {
        position: fixed;
        top: 0;
        left: -350px;
        width: 280px;
        height: 100vh;
        background-color: #34495e;
        z-index: 99;
        transition: left 0.3s ease;
        padding-top: 4rem;
    }

    .sidebar-left.active {
        left: 0;
    }

    .container {
        grid-template-columns: 1fr 250px;
        gap: 1.5rem;
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {

    .container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .sidebar-right {
        position: static;
        order: 3;
    }

    .main-content {
        order: 2;
    }
}

/* ====== Upload zone ====== */
#dropZone {
  border: 2px dashed #888;
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  font-size: 16px;
  color: #555;
  cursor: pointer;
  background: #f9f9f9;
  transition: background 0.3s, border-color 0.3s;
  position: relative;
}

#dropZone.dragover {
  background: #e0ffe0;
  border-color: #2ecc71;
}

#dropZone input[type="file"] {
  position: absolute;
  top: 0; left: 0;
  opacity: 0;
  width: 100%; height: 100%;
  cursor: pointer;
}
