/*
Theme Name: Perma Passion Theme - Encyclopédie Classique
Description: Thème WordPress encyclopédique minimaliste low-tech, édition classique inspirée des manuels anciens et de la nature observée
Version: 1.0.0
Author: Perma Passion
Text Domain: permapassion
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: encyclopedia, minimal, low-tech, nature, rustic, timeless, classic
*/

/* ==========================================================================
   RESET & BASE STYLES - ENCYCLOPÉDIQUE RUSTIQUE
   ========================================================================== */

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'EB Garamond', 'Times New Roman', serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #1a1a1a;
    background-color: #fafafa;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(0,0,0,0.03) 1px, transparent 1px),
        radial-gradient(circle at 80% 20%, rgba(0,0,0,0.02) 2px, transparent 2px),
        linear-gradient(45deg, transparent 49%, rgba(0,0,0,0.01) 50%, rgba(0,0,0,0.01) 51%, transparent 52%);
    background-size: 50px 50px, 30px 30px, 25px 25px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   PALETTE ENCYCLOPÉDIQUE RUSTIQUE - NOIR, BLANC, GRIS ÂGÉS
   ========================================================================== */

:root {
    --text-primary: #1a1a1a;          /* Noir profond d'encre */
    --text-secondary: #404040;        /* Gris foncé patiné */
    --text-tertiary: #666666;         /* Gris moyen vieilli */
    --text-muted: #808080;            /* Gris clair ancien */
    --background-primary: #ffffff;    /* Blanc de papier jauni */
    --background-secondary: #f5f5f5;  /* Gris très pâle usé */
    --background-tertiary: #fafafa;   /* Fond global parchemin */
    --border-primary: #cccccc;        /* Bordures usées */
    --border-secondary: #e0e0e0;      /* Bordures plus fines */
    --shadow-subtle: rgba(0, 0, 0, 0.08);
    --shadow-text: rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   TYPOGRAPHIE RUSTIQUE - GARMOND ANCIEN
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: 'EB Garamond', 'Times New Roman', serif;
    font-weight: 400;
    line-height: 1.2;
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    text-rendering: optimizeLegibility;
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: 1rem;
}

h2 {
    font-size: 2rem;
    font-weight: 500;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--text-primary);
    padding-left: 1rem;
    background-color: var(--background-secondary);
    padding: 0.5rem 1rem;
    margin-left: -1rem;
    margin-right: -1rem;
}

h3 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

h4 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

p {
    margin: 0 0 1.5rem 0;
    line-height: 1.7;
    text-align: justify;
    hyphens: auto;
    text-justify: inter-word;
}

a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: opacity 0.2s ease;
}

a:hover,
a:focus {
    opacity: 0.7;
    text-decoration-thickness: 2px;
}

/* ==========================================================================
   LAYOUT & CONTAINERS
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.site-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.site-header {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: box-shadow 0.3s ease;
}

.site-header.scrolled {
    box-shadow: 0 2px 10px var(--shadow-light);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
}

.site-branding {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.site-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2rem;
}

.site-navigation a {
    color: var(--text-dark);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease;
}

.site-navigation a:hover,
.site-navigation a:focus {
    color: var(--primary-green);
}

.site-navigation .current-menu-item a::after,
.site-navigation a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-green);
}

.search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-medium);
    transition: color 0.3s ease;
}

.search-toggle:hover,
.search-toggle:focus {
    color: var(--primary-green);
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */

.hero {
    background-color: var(--white);
    padding: 4rem 0 6rem;
    text-align: center;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-medium);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ==========================================================================
   FEATURED CONTENT
   ========================================================================== */

.featured-article {
    margin-bottom: 4rem;
}

.featured-card {
    background-color: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px var(--shadow-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.featured-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--shadow-medium);
}

.featured-image {
    position: relative;
    height: 400px;
    overflow: hidden;
}

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    padding: 3rem 2rem 2rem;
}

.featured-content {
    color: var(--white);
}

.featured-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.featured-excerpt {
    font-size: 1.1rem;
    line-height: 1.6;
    opacity: 0.9;
}

.category-badge {
    display: inline-block;
    background-color: var(--primary-green);
    color: var(--white);
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   ARTICLE GRID
   ========================================================================== */

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.article-card {
    background-color: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px var(--shadow-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--shadow-medium);
}

.article-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

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

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

/* Articles encyclopédiques - parchemin ancien XIXe siècle */
.article-content {
    background-color: var(--background-primary);
    background-image:
        radial-gradient(circle at 30% 70%, rgba(0,0,0,0.008) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(0,0,0,0.006) 0%, transparent 50%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 28px,
            rgba(0,0,0,0.005) 28px,
            rgba(0,0,0,0.005) 29px
        );
    background-size: 100px 100px, 80px 80px, 30px 30px;
    padding: 3rem 2rem;
    margin-bottom: 3rem;
    border: 1px solid var(--border-secondary);
    border-radius: 2px;
    box-shadow:
        var(--shadow-subtle),
        inset 0 0 80px rgba(0,0,0,0.03);
    position: relative;
}

.article-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 19px,
            rgba(0,0,0,0.003) 19px,
            rgba(0,0,0,0.003) 20px
        );
    pointer-events: none;
    opacity: 0.4;
}

/* Liens dans le contenu - style rustique */
.article-content a:not(.read-more-link) {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-style: wavy;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.article-content a:hover:not(.read-more-link) {
    opacity: 0.8;
    text-decoration-thickness: 1.5px;
}

/* Effets de parchemin vieilli */
.article-content::after {
    content: '';
    position: absolute;
    bottom: 15px;
    left: 15px;
    width: 15px;
    height: 15px;
    background: radial-gradient(circle, rgba(0,0,0,0.04) 1px, transparent 1px);
    border-radius: 50%;
    opacity: 0.5;
}

/* Bordures patinées */
.article-content {
    border-color: var(--border-primary);
    border-style: solid;
    border-width: 1px;
    border-image: linear-gradient(45deg, var(--border-primary) 30%, var(--border-secondary) 70%) 1;
}

.article-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

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

.article-title a:hover {
    color: var(--primary-green);
}

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

.article-excerpt {
    color: var(--text-medium);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.read-more {
    color: var(--primary-green);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   CATEGORY PAGES
   ========================================================================== */

.category-header {
    background-color: var(--white);
    padding: 4rem 0 2rem;
    border-bottom: 1px solid var(--border-color);
}

.category-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    align-items: start;
}

.category-info {
    padding-right: 2rem;
}

.category-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.category-description {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-medium);
    margin-bottom: 2rem;
}

.category-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 8px;
}

/* ==========================================================================
   SINGLE ARTICLE
   ========================================================================== */

.single-article {
    background-color: var(--white);
}

.article-header {
    padding: 4rem 0 2rem;
    border-bottom: 1px solid var(--border-color);
}

.article-title-single {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.article-meta-single {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 1rem;
    color: var(--text-medium);
    margin-bottom: 2rem;
}

.article-content-single {
    padding: 2rem 0;
    max-width: 700px;
    margin: 0 auto;
}

.article-content-single p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.article-content-single h2,
.article-content-single h3,
.article-content-single h4 {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
}

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

.site-footer {
    background-color: var(--secondary-gray);
    padding: 3rem 0 2rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.footer-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.footer-description {
    color: var(--text-medium);
    max-width: 400px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.footer-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-nav a {
    color: var(--text-medium);
    font-size: 0.875rem;
}

.footer-nav a:hover {
    color: var(--primary-green);
}

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

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

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .header-container {
        padding: 0 1rem;
        height: 60px;
    }

    .site-branding {
        font-size: 1.25rem;
    }

    .site-navigation ul {
        gap: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .hero {
        padding: 3rem 0 4rem;
    }

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

    .featured-title {
        font-size: 2rem;
    }

    .category-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .category-info {
        padding-right: 0;
    }

    .category-title {
        font-size: 2.25rem;
    }

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

    .article-title-single {
        font-size: 2.25rem;
    }

    .footer-nav ul {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .featured-title {
        font-size: 1.75rem;
    }

    .category-title {
        font-size: 2rem;
    }

    .article-title-single {
        font-size: 2rem;
    }
}

/* ==========================================================================
   INTERACTIVE ELEMENTS
   ========================================================================== */

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--text-dark);
    color: var(--white);
    padding: 1rem;
    z-index: 10000;
    box-shadow: 0 -2px 10px var(--shadow-light);
    transform: translateY(100%);
    animation: slideUp 0.5s ease-out forwards;
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.cookie-content p {
    margin: 0;
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.5;
}

.cookie-accept,
.cookie-decline {
    background: var(--primary-green);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.cookie-accept:hover {
    background-color: var(--primary-green-hover);
}

.cookie-decline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-medium);
    margin-left: 0.5rem;
}

.cookie-decline:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--secondary-gray);
    z-index: 10001;
}

.reading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-green), var(--primary-green-hover));
    width: 0%;
    transition: width 0.3s ease;
}

/* Search Form Styles */
.search-form-container {
    background-color: var(--white);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    display: none;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-green);
}

.search-submit {
    background-color: var(--primary-green);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-submit:hover {
    background-color: var(--primary-green-hover);
}

/* Social Sharing */
.social-sharing {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.social-sharing h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.social-links {
    display: flex;
    gap: 0.5rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--secondary-gray);
    color: var(--text-medium);
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-light);
}

.social-link.twitter:hover {
    background-color: #1da1f2;
    color: var(--white);
}

.social-link.facebook:hover {
    background-color: #1877f2;
    color: var(--white);
}

.social-link.linkedin:hover {
    background-color: #0077b5;
    color: var(--white);
}

/* Article Tags */
.article-tags {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.article-tags h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-link {
    display: inline-block;
    background-color: var(--secondary-gray);
    color: var(--text-medium);
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag-link:hover {
    background-color: var(--primary-green);
    color: var(--white);
    transform: translateY(-1px);
}

/* Load More Button */
.load-more-posts {
    display: inline-block;
    background-color: var(--primary-green);
    color: var(--white);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 2rem auto;
}

.load-more-posts:hover:not(:disabled) {
    background-color: var(--primary-green-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.load-more-posts:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Table of Contents */
.table-of-contents {
    background-color: var(--secondary-gray);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.table-of-contents ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.table-of-contents li {
    margin-bottom: 0.5rem;
}

.table-of-contents a {
    color: var(--text-medium);
    text-decoration: none;
    padding: 0.25rem 0;
    display: block;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.table-of-contents a:hover {
    color: var(--primary-green);
    border-bottom-color: var(--primary-green);
}

.toc-toggle {
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.toc-toggle:hover,
.toc-toggle.active {
    background-color: var(--primary-green);
    color: var(--white);
    border-color: var(--primary-green);
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: var(--white);
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: var(--text-dark);
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Skip Links */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--text-dark);
    color: var(--white);
    padding: 8px;
    text-decoration: none;
    z-index: 100000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
}

/* Focus styles for keyboard navigation */
.keyboard-navigation a:focus,
.keyboard-navigation button:focus,
.keyboard-navigation input:focus,
.keyboard-navigation textarea:focus,
.keyboard-navigation select:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}
