/* ============================================
   RESET & BASE
   ============================================ */

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

/* ================================
   LIGHT THEME (DEFAULT)
   ================================ */

:root {

    /* Colors - REAL LIGHT MODE */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --bg-tertiary: #e9eef5;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #dbeafe;

    --border: #e2e8f0;

    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.10);
    --shadow-xl: 0 8px 30px rgba(0,0,0,0.14);

    /* Typography */

    --font-main: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Fira Code', monospace;

    /* Layout */

    --container-max: 1200px;
    --section-padding: 4rem;
    --header-height: 70px;

}


/* ================================
   DARK MODE (MANUAL TOGGLE)
   ================================ */

.dark {

    --bg-primary: #0b0b0c;
    --bg-secondary: #161618;
    --bg-tertiary: #222226;

    --text-primary: #f5f5f5;
    --text-secondary: #b5b5b5;
    --text-muted: #7a7a7a;

    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-light: rgba(59,130,246,0.12);

    --border: #2a2a2a;

    --shadow: 0 2px 8px rgba(0,0,0,0.35);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.45);
    --shadow-xl: 0 8px 30px rgba(0,0,0,0.55);

}


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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    width: 90%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================
   HEADER - ÉLÉGANT ET RESPONSIVE
   ============================================ */

.site-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
	background: var(--bg-primary);
    box-shadow: var(--shadow);
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
}

/* Logo - RESPONSIVE ET DIMENSIONNÉ */
.nav-brand {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.site-logo {
    height: 45px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    display: block;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
    justify-content: flex-end;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-list a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    position: relative;
}

.nav-list a:hover {
    color: var(--accent);
}

.nav-list a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.2s ease;
}

.nav-list a:hover::after {
    width: 100%;
}

/* Language Switcher */
.language-switcher {
    position: relative;
}

#lang-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.5rem 2rem 0.5rem 1rem;
    font-family: var(--font-main);
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

#lang-select:hover {
    border-color: var(--accent);
    background-color: var(--bg-tertiary);
}

#lang-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* Theme Toggle */
.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    transform: rotate(15deg);
}

.theme-icon-light {
    display: inline;
}

.theme-icon-dark {
    display: none;
}

.dark .theme-icon-light {
    display: none;
}

.dark .theme-icon-dark {
    display: inline;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* ============================================
   HERO SECTION - CORRIGÉ ET FONCTIONNEL
   ============================================ */

.hero {
    position: relative;
    padding: 4rem 2rem;
    text-align: center;
    margin-bottom: 3rem;
    overflow: hidden;
    border-radius: 0 0 30px 30px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hero avec image de fond */
.hero-with-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Hero avec gradient (fallback ou combiné) */
.hero-gradient {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
}

.site-title {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #323439 0%, #d81d73 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    transition: all 0.3s ease;
    position: relative;
    text-decoration: none;
}

.site-title:hover {
    transform: translateY(-2px);
}
.site-title a {
    text-decoration: none;
    color: inherit;
}

.site-title:hover::after {
    width: 100%;
}

/* Overlay pour hero avec image */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

/* Contenu du hero */
.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 2rem;
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero p {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    line-height: 1.6;
}

/* Hero sans image (gradient par défaut) */
.hero:not(.hero-with-image) {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
}

.hero:not(.hero-with-image) h1,
.hero:not(.hero-with-image) p {
    color: white;
}

/* ============================================
   POSTS GRID - Grille d'articles
   ============================================ */

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.post-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent);
}

.post-image {
    display: block;
    aspect-ratio: 16/9;
    overflow: hidden;
    position: relative;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card:hover .post-image img {
    transform: scale(1.05);
}

.post-content {
    padding: 1.5rem;
}

.post-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    align-items: center;
}

.post-category {
    color: var(--accent);
    font-weight: 600;
    background: var(--accent-light);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.post-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.post-title a:hover {
    color: var(--accent);
}

.post-excerpt {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ============================================
   SINGLE POST - Page article individuel
   ============================================ */

.post-single {
    max-width: 800px;
    margin: 0 auto;
}

.post-header {
    text-align: center;
    margin-bottom: 2rem;
}

.post-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0;
    line-height: 1.2;
}

.post-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.post-hero-image {
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
}

.post-hero-image img {
    width: 100%;
    height: auto;
}

.post-body {
    font-size: 1.125rem;
    line-height: 1.8;
}

.post-body h2 {
    font-size: 1.75rem;
    margin: 2rem 0 1rem;
}

.post-body h3 {
    font-size: 1.5rem;
    margin: 1.5rem 0 0.75rem;
}

.post-body p {
    margin-bottom: 1.5rem;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.post-body code {
    background: var(--bg-secondary);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.875em;
}

.post-body pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.post-body pre code {
    background: none;
    padding: 0;
}

/* ============================================
   PAGE CONTENT - Pages statiques
   ============================================ */

.page-content {
    max-width: 800px;
    margin: 0 auto;
}

.page-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

/* ============================================
   SEARCH - Page de recherche
   ============================================ */

.search-page {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.search-box {
    margin: 2rem 0;
}

#search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
    border: 2px solid var(--border);
    border-radius: 50px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

#search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-results {
    text-align: left;
}

.search-result {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.search-result h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.search-result h3 a {
    color: var(--text-primary);
    text-decoration: none;
}

.search-result h3 a:hover {
    color: var(--accent);
}

.search-hint {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

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

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 3rem 0;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

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

/* ============================================
   FOOTER - ÉLÉGANT ET RESPONSIVE
   ============================================ */

.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-column h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 0.75rem;
}

.footer-column h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

.footer-column ul {
    list-style: none;
}

.footer-column li {
    margin-bottom: 0.75rem;
}

.footer-column a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-column a:hover {
    color: var(--accent);
    transform: translateX(4px);
}

.footer-column a::before {
    content: '→';
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 0.8rem;
}

.footer-column a:hover::before {
    opacity: 1;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-bottom p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ============================================
   TABLE DES MATIÈRES
   ============================================ */

.post-toc {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    border-left: 4px solid var(--accent);
}

.post-toc h4 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.post-toc ul {
    list-style: none;
    margin: 0;
}

.post-toc li {
    margin: 0.5rem 0;
}

.post-toc a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.post-toc a:hover {
    color: var(--accent);
}

.toc-h2 {
    font-weight: 600;
}

.toc-h3 {
    padding-left: 1.5rem;
    font-size: 0.9375rem;
}

/* ============================================
   ANCRES DANS LES TITRES
   ============================================ */

.post-body h2,
.post-body h3,
.post-body h4 {
    position: relative;
    scroll-margin-top: 100px;
}

.post-body h2::before,
.post-body h3::before {
    content: '#';
    position: absolute;
    left: -1.5rem;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}

.post-body h2:hover::before,
.post-body h3:hover::before {
    opacity: 1;
}

/* ============================================
   SECTION PARTAGE
   ============================================ */

.share-section {
    margin: 3rem 0;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    text-align: center;
}

.share-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    cursor: pointer;
    font-size: 0.9375rem;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.share-btn svg {
    width: 20px;
    height: 20px;
}

.share-btn.facebook {
    background: #1877f2;
    color: white;
}

.share-btn.twitter {
    background: #000000;
    color: white;
}

.share-btn.linkedin {
    background: #0a66c2;
    color: white;
}

.share-btn.bluesky {
    background: #0560ff;
    color: white;
}

.share-btn.copy {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.comments-section {
    margin: 3rem 0;
}

.comments-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* ============================================
   TAGS CLIQUABLES
   ============================================ */

.post-tags-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag-anchor {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.875rem;
    transition: opacity 0.2s;
}

.tag-anchor:hover {
    opacity: 0.7;
}

/* ============================================
   SÉPARATEUR ÉLÉGANT
   ============================================ */

.elegant-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 3rem 0;
    gap: 1rem;
}

.separator-line {
    flex: 1;
    max-width: 200px;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        var(--accent) 20%,
        var(--accent) 80%,
        transparent
    );
    opacity: 0.6;
}

.separator-icon {
    color: var(--accent);
    font-size: 1.2rem;
    opacity: 0.8;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* ============================================
   TAGS ÉLÉGANTS SOUS L'ARTICLE
   ============================================ */

.post-tags-section {
    margin: 3rem 0;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border-left: 4px solid var(--accent);
}

.post-tags-section h4 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-tags-elegant {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tag-elegant {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: 25px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tag-elegant::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(59, 130, 246, 0.1),
        transparent
    );
    transition: left 0.5s ease;
}

.tag-elegant:hover::before {
    left: 100%;
}

.tag-elegant:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.tag-elegant .tag-icon {
    color: var(--accent);
    font-weight: 700;
}

/* ============================================
   MENU DROPDOWN ET LOGO ALTERNATIF
   ============================================ */

.logo-with-image {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-img {
    height: 40px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

.nav-item.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.nav-item.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.dropdown-link:hover {
    background: var(--bg-secondary);
    color: var(--accent);
    border-left-color: var(--accent);
    padding-left: 1.5rem;
}

.language-dropdown {
    position: relative;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.lang-toggle:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.current-lang {
    font-size: 1.25rem;
}

.lang-arrow {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.language-dropdown:hover .lang-arrow {
    transform: rotate(180deg);
}

.lang-menu {
    right: 0;
    left: auto;
    min-width: 150px;
}

.lang-menu .dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lang-flag {
    font-size: 1.25rem;
}

.lang-name {
    font-size: 0.875rem;
}

/* ============================================
   IMAGES BBCODE DANS LES ARTICLES
   ============================================ */

.post-inline-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
    box-shadow: var(--shadow);
}

/* ============================================
   GISCUS DARK MODE
   ============================================ */

.dark .giscus-frame {
    color-scheme: dark;
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ============================================ */

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    /* Header Mobile */
    .mobile-menu-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-primary);
        flex-direction: column;
        padding: 2rem;
        gap: 1.5rem;
        border-bottom: 1px solid var(--border);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-list {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .nav-list a {
        font-size: 1.1rem;
        padding: 0.5rem 0;
    }

    .site-logo {
        height: 35px;
        max-width: 140px;
    }

    /* Hero Mobile */
    .hero {
        padding: 2.5rem 1rem;
        border-radius: 0 0 20px 20px;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 1rem;
    }

    /* Posts Grid Mobile */
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Single Post Mobile */
    .post-header h1 {
        font-size: 1.75rem;
    }

    .post-body {
        font-size: 1rem;
    }

    /* Footer Mobile */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .footer-column h4::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-column a {
        justify-content: center;
    }

    .footer-column a:hover {
        transform: translateX(0);
    }

    /* Search Mobile */
    .search-result {
        padding: 1rem;
    }

    /* Share Buttons Mobile */
    .share-btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .site-logo {
        height: 30px;
        max-width: 120px;
    }

    .main-nav {
        padding: 0 1rem;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    #lang-select {
        padding: 0.4rem 1.8rem 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }
}

/* Tablette */
@media (min-width: 769px) and (max-width: 1024px) {
    .site-logo {
        height: 40px;
        max-width: 160px;
    }

    .nav-list {
        gap: 1.5rem;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

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

.site-header {
    animation: fadeIn 0.3s ease;
}

.post-card {
    animation: slideUp 0.5s ease backwards;
}

.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.2s; }
.post-card:nth-child(3) { animation-delay: 0.3s; }
.post-card:nth-child(4) { animation-delay: 0.4s; }
.post-card:nth-child(5) { animation-delay: 0.5s; }
.post-card:nth-child(6) { animation-delay: 0.6s; }

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}



/* ============================================
   HERO OVERLAY OPTIONS
   ============================================ */

/* Option pour désactiver l'overlay */
.hero-overlay-disabled {
    display: none !important;
}

/* Hero avec image mais sans overlay - ajustements */
.hero-with-image:has(.hero-overlay-disabled) {
    color: var(--text-primary);
}

.hero-with-image:has(.hero-overlay-disabled) .hero-content h1,
.hero-with-image:has(.hero-overlay-disabled) .hero-content p {
    color: var(--text-primary);
    text-shadow: none;
}

/* Responsive pour hero sans overlay */
@media (max-width: 768px) {
    .hero-with-image:has(.hero-overlay-disabled) .hero-content h1,
    .hero-with-image:has(.hero-overlay-disabled) .hero-content p {
        color: var(--text-primary);
    }
}


/* ============================================
   GITHUB-STYLE CONTAINER - container-lg
   ============================================ */

.container-lg {
    max-width: 1012px;
    margin-right: auto;
    margin-left: auto;
    padding-left: 16px;
    padding-right: 16px;
}

@media (min-width: 768px) {
    .container-lg {
        padding-left: 24px;
        padding-right: 24px;
    }
}

@media (min-width: 1280px) {
    .container-lg {
        padding-left: 32px;
        padding-right: 32px;
    }
}

/* Post single avec container-lg */
.post-single .container-lg {
    width: 100%;
}

/* ============================================
   POST IMAGE CAPTION - Légende d'image
   ============================================ */

.post-hero-image {
    position: relative;
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
}

.post-hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

.post-image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    padding: 2rem 1.5rem 1.5rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    text-align: center;
}

.post-image-caption:empty {
    display: none;
}

/* Mode sombre pour la légende */
.dark .post-image-caption {
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
}

/* ============================================
   BBCODE CONTENT STYLES
   ============================================ */

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
    margin: 2rem 0 1rem;
    font-weight: 600;
    line-height: 1.25;
}

.post-body h1 { font-size: 2rem; }
.post-body h2 { font-size: 1.75rem; }
.post-body h3 { font-size: 1.5rem; }
.post-body h4 { font-size: 1.25rem; }
.post-body h5 { font-size: 1.125rem; }
.post-body h6 { font-size: 1rem; }

.post-body blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--accent);
    background: var(--bg-secondary);
    border-radius: 0 8px 8px 0;
}

.post-body blockquote cite {
    display: block;
    font-weight: 600;
    font-style: normal;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.post-body blockquote cite:empty {
    display: none;
}

.post-body pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
}

.post-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.post-body code {
    background: var(--bg-secondary);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: var(--accent);
}

.post-body .latex-math {
    display: inline-block;
    font-style: italic;
}

.post-body a {
    color: var(--accent);
    text-decoration: none;
}

.post-body a:hover {
    text-decoration: underline;
}

.post-body .anchor {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 0.5rem;
}

.post-body .anchor:hover {
    color: var(--accent);
}

.post-body ul,
.post-body ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.post-body li {
    margin: 0.5rem 0;
}

.post-body img.post-inline-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
    box-shadow: var(--shadow);
}

/* ============================================
   POST DESCRIPTION STYLES
   ============================================ */

.post-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 1rem 0 0;
}

.post-description p {
    margin-bottom: 0.75rem;
}

.post-description p:last-child {
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container-lg {
        padding-left: 16px;
        padding-right: 16px;
    }

    .post-body h1 { font-size: 1.5rem; }
    .post-body h2 { font-size: 1.375rem; }
    .post-body h3 { font-size: 1.25rem; }

    .post-image-caption {
        padding: 1.5rem 1rem 1rem;
        font-size: 0.875rem;
    }

    .post-description {
        font-size: 1rem;
    }
}
