/*
Theme Name: Magic Theme WP
Theme URI: https://mtfk.fr/
Author: MTF Karukera
Author URI: https://mtfk.fr/
Description: Thème sur-mesure pour le Hub personnel mtfk.fr (5 Univers, Vitrine Magic-Softs, Dark/Light Mode, Outils de lecture).
Version: 1.0.0
License: Proprietary
Text Domain: magic-theme-wp
*/

/* ==========================================================================
   1. VARIABLES DU DESIGN SYSTEM & PALETTES
   ========================================================================== */

:root {
    /* Palette Claire (Light Mode) */
    --bg-color-light: #f6f8fa;
    --text-color-light: #1f2328;
    --text-muted-light: #57606a;
    --bg-glass-light: rgba(255, 255, 255, 0.85);
    --border-glass-light: rgba(208, 215, 222, 0.6);
    --shadow-glass-light: 0 8px 24px rgba(140, 149, 159, 0.12);
    --card-hover-shadow-light: 0 12px 32px rgba(140, 149, 159, 0.22);
    --accent-color-light: #0969da;
    --accent-gold-light: #d97706;
    --code-bg-light: #eaeef2;

    /* Palette Sombre (Dark Mode) */
    --bg-color-dark: #0d1117;
    --text-color-dark: #e6edf3;
    --text-muted-dark: #8b949e;
    --bg-glass-dark: rgba(22, 27, 34, 0.85);
    --border-glass-dark: rgba(48, 54, 61, 0.8);
    --shadow-glass-dark: 0 8px 24px rgba(0, 0, 0, 0.4);
    --card-hover-shadow-dark: 0 12px 32px rgba(0, 0, 0, 0.65);
    --accent-color-dark: #58a6ff;
    --accent-gold-dark: #fbbf24;
    --code-bg-dark: #161b22;

    /* Typographies */
    --font-body: 'Josefin Sans', system-ui, -apple-system, sans-serif;
    --font-heading: 'Galindo', cursive, sans-serif;

    /* Variables Actives (Défaut : Light) */
    --bg-color: var(--bg-color-light);
    --text-color: var(--text-color-light);
    --text-muted: var(--text-muted-light);
    --bg-glass: var(--bg-glass-light);
    --border-glass: var(--border-glass-light);
    --shadow-glass: var(--shadow-glass-light);
    --card-hover-shadow: var(--card-hover-shadow-light);
    --accent-color: var(--accent-color-light);
    --accent-gold: var(--accent-gold-light);
    --code-bg: var(--code-bg-light);
}

/* Application automatique Dark Mode via Media Query */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: var(--bg-color-dark);
        --text-color: var(--text-color-dark);
        --text-muted: var(--text-muted-dark);
        --bg-glass: var(--bg-glass-dark);
        --border-glass: var(--border-glass-dark);
        --shadow-glass: var(--shadow-glass-dark);
        --card-hover-shadow: var(--card-hover-shadow-dark);
        --accent-color: var(--accent-color-dark);
        --accent-gold: var(--accent-gold-dark);
        --code-bg: var(--code-bg-dark);
    }
}

/* Surcharges manuelles via data-theme */
html[data-theme="light"] {
    --bg-color: var(--bg-color-light);
    --text-color: var(--text-color-light);
    --text-muted: var(--text-muted-light);
    --bg-glass: var(--bg-glass-light);
    --border-glass: var(--border-glass-light);
    --shadow-glass: var(--shadow-glass-light);
    --card-hover-shadow: var(--card-hover-shadow-light);
    --accent-color: var(--accent-color-light);
    --accent-gold: var(--accent-gold-light);
    --code-bg: var(--code-bg-light);
}

html[data-theme="dark"] {
    --bg-color: var(--bg-color-dark);
    --text-color: var(--text-color-dark);
    --text-muted: var(--text-muted-dark);
    --bg-glass: var(--bg-glass-dark);
    --border-glass: var(--border-glass-dark);
    --shadow-glass: var(--shadow-glass-dark);
    --card-hover-shadow: var(--card-hover-shadow-dark);
    --accent-color: var(--accent-color-dark);
    --accent-gold: var(--accent-gold-dark);
    --code-bg: var(--code-bg-dark);
}

/* ==========================================================================
   2. STYLES GLOBAUX & RESET
   ========================================================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.7;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-color);
    margin-top: 1.8rem;
    margin-bottom: 0.8rem;
    line-height: 1.3;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Barre de progression de lecture */
.magic-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #f59e0b, #ef4444, #8b5cf6, #3b82f6);
    z-index: 10000;
    transition: width 0.1s ease-out;
}

/* Glassmorphism de base */
.glass-effect {
    background: var(--bg-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: var(--shadow-glass);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.magic-main-container {
    max-width: 1100px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

/* ==========================================================================
   3. EN-TÊTE & NAVIGATION
   ========================================================================== */

.magic-header {
    position: sticky;
    top: 1rem;
    z-index: 999;
    max-width: 1100px;
    margin: 1rem auto 0 auto;
    padding: 0.75rem 1.5rem;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-branding .brand-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--text-color);
}

.brand-tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.75rem;
}

.nav-item {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-item:hover {
    background: rgba(125, 125, 125, 0.12);
    text-decoration: none;
}

.magic-theme-toggle {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-color);
    padding: 0.5rem 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.2s ease, background 0.2s ease;
}

.magic-theme-toggle:hover {
    transform: scale(1.1);
    background: rgba(125, 125, 125, 0.15);
}

/* ==========================================================================
   4. HOMEPAGE HYBRIDE (front-page.php)
   ========================================================================== */

.hero-section {
    padding: 3rem 2rem;
    text-align: center;
    margin-bottom: 3rem;
}

.hero-badge {
    display: inline-block;
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    margin-bottom: 1rem;
}

.hero-title {
    font-size: 2.3rem;
    margin: 0.5rem 0 1rem 0;
}

.hero-bio {
    font-size: 1.15rem;
    max-width: 750px;
    margin: 0 auto;
    color: var(--text-muted);
}

/* Grille des 5 Univers */
.univers-section {
    margin-bottom: 3.5rem;
}

.section-title {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--accent-color);
    padding-left: 0.75rem;
}

.univers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}

.univers-card {
    display: flex;
    align-items: flex-start;
    padding: 1.5rem;
    gap: 1.25rem;
    color: var(--text-color);
    text-decoration: none;
}

.univers-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--accent-color);
    text-decoration: none;
}

.univers-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.univers-info h3 {
    margin: 0 0 0.4rem 0;
    font-size: 1.2rem;
}

.univers-info p {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.univers-link-text {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* Grille des Articles Récents */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.post-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.post-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-hover-shadow);
}

.post-thumbnail-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #000;
}

.post-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-card:hover .post-thumb {
    transform: scale(1.03);
}

.post-card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.post-meta-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.magic-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-softs { background: #e0e7ff; color: #3730a3; }
.badge-blog { background: #dcfce7; color: #166534; }
.badge-lit { background: #fef3c7; color: #92400e; }
.badge-music { background: #fce7f3; color: #9d174d; }
.badge-pro { background: #ede9fe; color: #5b21b6; }
.badge-default { background: #f3f4f6; color: #374151; }

html[data-theme="dark"] .badge-softs { background: #312e81; color: #c7d2fe; }
html[data-theme="dark"] .badge-blog { background: #14532d; color: #bbf7d0; }
html[data-theme="dark"] .badge-lit { background: #78350f; color: #fde68a; }
html[data-theme="dark"] .badge-music { background: #831843; color: #fbcfe8; }
html[data-theme="dark"] .badge-pro { background: #4c1d95; color: #ddd6fe; }
html[data-theme="dark"] .badge-default { background: #374151; color: #e5e7eb; }

.reading-time, .reading-time-pill {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.post-card-title {
    font-size: 1.15rem;
    margin: 0 0 0.5rem 0;
}

.post-card-title a {
    color: var(--text-color);
}

.post-card-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.post-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    border-top: 1px solid var(--border-glass);
    padding-top: 0.75rem;
}

.post-date {
    color: var(--text-muted);
}

.read-more-link {
    font-weight: 700;
    color: var(--accent-color);
}

/* ==========================================================================
   5. PAGE VITRINE MAGIC-SOFTS (page-magic-softs.php)
   ========================================================================== */

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

.cartouche-banner {
    display: inline-block;
    background: #f59e0b;
    color: #000;
    padding: 0.8rem 2.5rem;
    border-radius: 40px;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
    margin-bottom: 1.25rem;
}

.cartouche-title {
    font-size: 2.2rem;
    margin: 0;
    letter-spacing: 2px;
}

.softs-intro-desc {
    font-size: 1.15rem;
    max-width: 750px;
    margin: 0 auto;
    color: var(--text-muted);
}

.section-label-tag {
    margin-bottom: 1.5rem;
}

.tag-badge {
    background: #f97316;
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 0.35rem 1rem;
    border-radius: 8px;
    letter-spacing: 1px;
}

.softs-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3.5rem;
}

.soft-card {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
}

.soft-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
}

.soft-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.soft-icon {
    font-size: 2.2rem;
}

.soft-platform-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
}

.tb-badge { background: #0284c7; color: #fff; }
.ff-badge { background: #ea580c; color: #fff; }
.multi-badge { background: #7c3aed; color: #fff; }

.soft-title {
    font-size: 1.3rem;
    margin: 0 0 0.5rem 0;
}

.soft-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.55;
    flex-grow: 1;
    margin-bottom: 1.25rem;
}

.soft-links {
    display: flex;
    gap: 0.75rem;
}

.btn-store, .btn-guide {
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-amo { background: #ea580c; color: #fff; }
.btn-atn { background: #0284c7; color: #fff; }
.btn-guide { background: var(--code-bg); color: var(--text-color); }

.btn-store:hover, .btn-guide:hover {
    opacity: 0.9;
    transform: scale(1.02);
    text-decoration: none;
}

/* Liste des articles sous forme de lignes (schéma Canva) */
.softs-articles-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.soft-article-row {
    display: flex;
    gap: 1.25rem;
    padding: 1.25rem;
    align-items: center;
}

.article-row-thumb {
    width: 100px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(125, 125, 125, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.row-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-row-content {
    flex-grow: 1;
}

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

.article-row-title {
    font-size: 1.1rem;
    margin: 0 0 0.3rem 0;
}

.article-row-title a {
    color: var(--text-color);
}

.article-row-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

/* ==========================================================================
   6. ARTICLE UNIQUE (single.php) & CONFORT DE LECTURE
   ========================================================================== */

.single-article-card {
    padding: 3rem 2.5rem;
    max-width: 850px;
    margin: 0 auto;
}

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

.single-post-meta-top {
    display: flex;
    justify-content: center;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.single-post-title {
    font-size: 2.2rem;
    line-height: 1.3;
    margin: 0.5rem 0 1rem 0;
}

.single-post-submeta {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.75rem;
}

.meta-separator {
    margin: 0 0.4rem;
}

.single-featured-image-wrap {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-glass);
    margin: 1.5rem 0;
}

.featured-sketchnote {
    width: 100%;
    height: auto;
}

/* Typographie Éditoriale Prose */
.prose {
    font-size: 1.15rem;
    line-height: 1.85;
    color: var(--text-color);
}

.prose p {
    margin-bottom: 1.5rem;
}

.prose h2 {
    font-size: 1.6rem;
    margin-top: 2.5rem;
    border-bottom: 2px solid var(--border-glass);
    padding-bottom: 0.5rem;
}

.prose h3 {
    font-size: 1.35rem;
    margin-top: 2rem;
}

.prose ul, .prose ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.prose li {
    margin-bottom: 0.5rem;
}

.prose pre, .prose code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.95rem;
}

.prose code:not(pre code) {
    background: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.prose pre {
    background: var(--code-bg);
    padding: 1.25rem;
    border-radius: 10px;
    overflow-x: auto;
    border: 1px solid var(--border-glass);
}

.prose blockquote {
    border-left: 4px solid var(--accent-gold);
    padding: 0.75rem 1.25rem;
    margin: 1.75rem 0;
    background: rgba(245, 158, 11, 0.08);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

/* Bio auteur en bas d'article */
.author-bio-box {
    display: flex;
    gap: 1.25rem;
    padding: 1.5rem;
    margin: 2.5rem 0 1.5rem 0;
    align-items: center;
}

.author-bio-avatar {
    font-size: 2.5rem;
}

.author-bio-text h4 {
    margin: 0 0 0.3rem 0;
    font-size: 1.15rem;
}

.author-bio-text p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.post-navigation-links {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-glass);
    padding-top: 1.5rem;
    margin-top: 2rem;
    font-weight: 700;
}

/* ==========================================================================
   7. ARCHIVES & PAGINATION (category.php)
   ========================================================================== */

.archive-header {
    padding: 2.5rem 2rem;
    text-align: center;
    margin-bottom: 2.5rem;
}

.archive-tag-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-color);
    letter-spacing: 1px;
}

.archive-title {
    font-size: 2rem;
    margin: 0.5rem 0;
}

.archive-description {
    color: var(--text-muted);
    max-width: 650px;
    margin: 0 auto;
}

.pagination-wrap {
    margin: 3rem 0;
    text-align: center;
}

.pagination-wrap .page-numbers {
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: 8px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-color);
    font-weight: 700;
}

.pagination-wrap .page-numbers.current {
    background: var(--accent-color);
    color: #fff;
}

/* ==========================================================================
   8. PIED DE PAGE (footer.php)
   ========================================================================== */

.magic-footer {
    max-width: 1100px;
    margin: 4rem auto 2rem auto;
    padding: 2.5rem 2rem 1.5rem 2rem;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

.footer-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin: 0 0 0.25rem 0;
}

.footer-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

.footer-links {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 1.25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.footer-bottom {
    border-top: 1px solid var(--border-glass);
    width: 100%;
    padding-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==========================================================================
   9. RESPONSIVE DESIGN (MOBILE & TABLET)
   ========================================================================== */

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.4rem;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .single-article-card {
        padding: 1.5rem 1rem;
    }

    .single-post-title {
        font-size: 1.6rem;
    }

    .soft-article-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .article-row-thumb {
        width: 100%;
        height: 160px;
    }
}
